From 3f4a0d5370ae6c34afe180df96add3b8522f4af1 Mon Sep 17 00:00:00 2001 From: mattkae Date: Wed, 11 May 2022 09:23:58 -0400 Subject: initial commit --- elpa/ac-js2-20190101.933/ac-js2-autoloads.el | 70 + elpa/ac-js2-20190101.933/ac-js2-pkg.el | 11 + elpa/ac-js2-20190101.933/ac-js2-tests.el | 76 + elpa/ac-js2-20190101.933/ac-js2-tests.elc | Bin 0 -> 5403 bytes elpa/ac-js2-20190101.933/ac-js2.el | 608 + elpa/ac-js2-20190101.933/ac-js2.elc | Bin 0 -> 21918 bytes elpa/ac-js2-20190101.933/skewer-addon.js | 116 + .../all-the-icons-autoloads.el | 75 + .../all-the-icons-faces.el | 230 + .../all-the-icons-faces.elc | Bin 0 -> 6261 bytes .../all-the-icons-pkg.el | 12 + elpa/all-the-icons-20220325.1238/all-the-icons.el | 1189 + elpa/all-the-icons-20220325.1238/all-the-icons.elc | Bin 0 -> 71083 bytes .../data/data-alltheicons.el | 70 + .../data/data-alltheicons.elc | Bin 0 -> 1734 bytes .../data/data-faicons.el | 641 + .../data/data-faicons.elc | Bin 0 -> 14554 bytes .../data/data-fileicons.el | 491 + .../data/data-fileicons.elc | Bin 0 -> 9642 bytes .../data/data-material.el | 935 + .../data/data-material.elc | Bin 0 -> 23293 bytes .../data/data-octicons.el | 165 + .../data/data-octicons.elc | Bin 0 -> 3902 bytes .../data/data-weathericons.el | 594 + .../data/data-weathericons.elc | Bin 0 -> 14992 bytes elpa/archives/gnu/archive-contents | 3501 +++ elpa/archives/gnu/archive-contents.signed | 1 + elpa/archives/melpa/archive-contents | 5184 ++++ elpa/archives/nongnu/archive-contents | 1643 ++ elpa/archives/nongnu/archive-contents.signed | 1 + elpa/bind-key-20210210.1609/bind-key-autoloads.el | 84 + elpa/bind-key-20210210.1609/bind-key-pkg.el | 2 + elpa/bind-key-20210210.1609/bind-key.el | 492 + elpa/bind-key-20210210.1609/bind-key.elc | Bin 0 -> 12131 bytes elpa/company-20220326.48/company-abbrev.el | 52 + elpa/company-20220326.48/company-abbrev.elc | Bin 0 -> 1289 bytes elpa/company-20220326.48/company-autoloads.el | 384 + elpa/company-20220326.48/company-bbdb.el | 63 + elpa/company-20220326.48/company-bbdb.elc | Bin 0 -> 1798 bytes elpa/company-20220326.48/company-capf.el | 225 + elpa/company-20220326.48/company-capf.elc | Bin 0 -> 5358 bytes elpa/company-20220326.48/company-clang.el | 420 + elpa/company-20220326.48/company-clang.elc | Bin 0 -> 15697 bytes elpa/company-20220326.48/company-cmake.el | 207 + elpa/company-20220326.48/company-cmake.elc | Bin 0 -> 6111 bytes elpa/company-20220326.48/company-css.el | 446 + elpa/company-20220326.48/company-css.elc | Bin 0 -> 16988 bytes elpa/company-20220326.48/company-dabbrev-code.el | 105 + elpa/company-20220326.48/company-dabbrev-code.elc | Bin 0 -> 3734 bytes elpa/company-20220326.48/company-dabbrev.el | 207 + elpa/company-20220326.48/company-dabbrev.elc | Bin 0 -> 7099 bytes elpa/company-20220326.48/company-elisp.el | 226 + elpa/company-20220326.48/company-elisp.elc | Bin 0 -> 6669 bytes elpa/company-20220326.48/company-etags.el | 108 + elpa/company-20220326.48/company-etags.elc | Bin 0 -> 3148 bytes elpa/company-20220326.48/company-files.el | 161 + elpa/company-20220326.48/company-files.elc | Bin 0 -> 4914 bytes elpa/company-20220326.48/company-gtags.el | 161 + elpa/company-20220326.48/company-gtags.elc | Bin 0 -> 5275 bytes elpa/company-20220326.48/company-ispell.el | 83 + elpa/company-20220326.48/company-ispell.elc | Bin 0 -> 2033 bytes elpa/company-20220326.48/company-keywords.el | 354 + elpa/company-20220326.48/company-keywords.elc | Bin 0 -> 19999 bytes elpa/company-20220326.48/company-nxml.el | 143 + elpa/company-20220326.48/company-nxml.elc | Bin 0 -> 4470 bytes elpa/company-20220326.48/company-oddmuse.el | 57 + elpa/company-20220326.48/company-oddmuse.elc | Bin 0 -> 1569 bytes elpa/company-20220326.48/company-pkg.el | 12 + elpa/company-20220326.48/company-semantic.el | 168 + elpa/company-20220326.48/company-semantic.elc | Bin 0 -> 5208 bytes elpa/company-20220326.48/company-template.el | 272 + elpa/company-20220326.48/company-template.elc | Bin 0 -> 8444 bytes elpa/company-20220326.48/company-tempo.el | 71 + elpa/company-20220326.48/company-tempo.elc | Bin 0 -> 2255 bytes elpa/company-20220326.48/company-tng.el | 196 + elpa/company-20220326.48/company-tng.elc | Bin 0 -> 4986 bytes elpa/company-20220326.48/company-yasnippet.el | 184 + elpa/company-20220326.48/company-yasnippet.elc | Bin 0 -> 4333 bytes elpa/company-20220326.48/company.el | 3917 +++ elpa/company-20220326.48/company.elc | Bin 0 -> 131133 bytes elpa/company-20220326.48/company.info | 1695 ++ elpa/company-20220326.48/dir | 18 + elpa/company-20220326.48/icons/LICENSE | 395 + elpa/company-20220326.48/icons/attribution.md | 5 + .../icons/vscode-dark/folder.svg | 3 + .../icons/vscode-dark/references.svg | 3 + .../icons/vscode-dark/symbol-array.svg | 3 + .../icons/vscode-dark/symbol-boolean.svg | 3 + .../icons/vscode-dark/symbol-class.svg | 3 + .../icons/vscode-dark/symbol-color.svg | 3 + .../icons/vscode-dark/symbol-constant.svg | 4 + .../icons/vscode-dark/symbol-enumerator-member.svg | 3 + .../icons/vscode-dark/symbol-enumerator.svg | 3 + .../icons/vscode-dark/symbol-event.svg | 3 + .../icons/vscode-dark/symbol-field.svg | 3 + .../icons/vscode-dark/symbol-file.svg | 3 + .../icons/vscode-dark/symbol-interface.svg | 3 + .../icons/vscode-dark/symbol-key.svg | 3 + .../icons/vscode-dark/symbol-keyword.svg | 3 + .../icons/vscode-dark/symbol-method.svg | 3 + .../icons/vscode-dark/symbol-misc.svg | 3 + .../icons/vscode-dark/symbol-namespace.svg | 3 + .../icons/vscode-dark/symbol-numeric.svg | 3 + .../icons/vscode-dark/symbol-operator.svg | 3 + .../icons/vscode-dark/symbol-parameter.svg | 3 + .../icons/vscode-dark/symbol-property.svg | 3 + .../icons/vscode-dark/symbol-ruler.svg | 3 + .../icons/vscode-dark/symbol-snippet.svg | 3 + .../icons/vscode-dark/symbol-string.svg | 3 + .../icons/vscode-dark/symbol-structure.svg | 3 + .../icons/vscode-dark/symbol-variable.svg | 3 + .../icons/vscode-light/folder.svg | 3 + .../icons/vscode-light/references.svg | 10 + .../icons/vscode-light/symbol-array.svg | 3 + .../icons/vscode-light/symbol-boolean.svg | 3 + .../icons/vscode-light/symbol-class.svg | 3 + .../icons/vscode-light/symbol-color.svg | 3 + .../icons/vscode-light/symbol-constant.svg | 4 + .../vscode-light/symbol-enumerator-member.svg | 3 + .../icons/vscode-light/symbol-enumerator.svg | 3 + .../icons/vscode-light/symbol-event.svg | 3 + .../icons/vscode-light/symbol-field.svg | 3 + .../icons/vscode-light/symbol-file.svg | 3 + .../icons/vscode-light/symbol-interface.svg | 3 + .../icons/vscode-light/symbol-key.svg | 3 + .../icons/vscode-light/symbol-keyword.svg | 3 + .../icons/vscode-light/symbol-method.svg | 3 + .../icons/vscode-light/symbol-misc.svg | 3 + .../icons/vscode-light/symbol-namespace.svg | 10 + .../icons/vscode-light/symbol-numeric.svg | 3 + .../icons/vscode-light/symbol-operator.svg | 3 + .../icons/vscode-light/symbol-parameter.svg | 3 + .../icons/vscode-light/symbol-property.svg | 3 + .../icons/vscode-light/symbol-ruler.svg | 3 + .../icons/vscode-light/symbol-snippet.svg | 3 + .../icons/vscode-light/symbol-string.svg | 3 + .../icons/vscode-light/symbol-structure.svg | 3 + .../icons/vscode-light/symbol-variable.svg | 3 + .../company-20220326.48/images/small/echo-meta.png | Bin 0 -> 43396 bytes elpa/company-20220326.48/images/small/echo-qa.png | Bin 0 -> 18377 bytes .../images/small/echo-strip-qa.png | Bin 0 -> 21063 bytes .../images/small/echo-strip.png | Bin 0 -> 15339 bytes elpa/company-20220326.48/images/small/echo.png | Bin 0 -> 16360 bytes .../images/small/preview-dark.png | Bin 0 -> 5168 bytes .../images/small/preview-light.png | Bin 0 -> 5559 bytes .../images/small/tooltip-annotations.png | Bin 0 -> 29532 bytes .../images/small/tooltip-faces-light.png | Bin 0 -> 14633 bytes .../images/small/tooltip-filter.png | Bin 0 -> 29646 bytes .../images/small/tooltip-flip.png | Bin 0 -> 33501 bytes .../images/small/tooltip-icon-bg.png | Bin 0 -> 25540 bytes .../images/small/tooltip-icon-face.png | Bin 0 -> 28233 bytes .../images/small/tooltip-icons-dot.png | Bin 0 -> 45177 bytes .../images/small/tooltip-icons-text.png | Bin 0 -> 41525 bytes .../images/small/tooltip-icons-vscode.png | Bin 0 -> 47354 bytes .../images/small/tooltip-limit.png | Bin 0 -> 21246 bytes .../images/small/tooltip-margin.png | Bin 0 -> 29931 bytes .../images/small/tooltip-minimum-above.png | Bin 0 -> 42117 bytes .../images/small/tooltip-minimum-below.png | Bin 0 -> 22238 bytes .../images/small/tooltip-offset-display.png | Bin 0 -> 28312 bytes .../images/small/tooltip-qa-faces-light.png | Bin 0 -> 27127 bytes .../images/small/tooltip-quick-access.png | Bin 0 -> 19467 bytes .../images/small/tooltip-search.png | Bin 0 -> 45384 bytes .../company-irony-autoloads.el | 36 + .../company-irony-pkg.el | 2 + elpa/company-irony-20190124.2346/company-irony.el | 158 + elpa/company-irony-20190124.2346/company-irony.elc | Bin 0 -> 4225 bytes elpa/dash-20210826.1149/dash-autoloads.el | 74 + elpa/dash-20210826.1149/dash-pkg.el | 12 + elpa/dash-20210826.1149/dash.el | 3531 +++ elpa/dash-20210826.1149/dash.elc | Bin 0 -> 138391 bytes elpa/dash-20210826.1149/dash.info | 4738 ++++ elpa/dash-20210826.1149/dir | 18 + elpa/epl-20180205.2049/epl-autoloads.el | 22 + elpa/epl-20180205.2049/epl-pkg.el | 2 + elpa/epl-20180205.2049/epl.el | 712 + elpa/epl-20180205.2049/epl.elc | Bin 0 -> 32521 bytes elpa/flycheck-20220314.27/flycheck-autoloads.el | 306 + elpa/flycheck-20220314.27/flycheck-buttercup.el | 157 + elpa/flycheck-20220314.27/flycheck-ert.el | 507 + elpa/flycheck-20220314.27/flycheck-ert.elc | Bin 0 -> 24846 bytes elpa/flycheck-20220314.27/flycheck-pkg.el | 16 + elpa/flycheck-20220314.27/flycheck.el | 12465 ++++++++++ elpa/flycheck-20220314.27/flycheck.elc | Bin 0 -> 553689 bytes .../flycheck-irony-autoloads.el | 28 + .../flycheck-irony-pkg.el | 2 + .../flycheck-irony-20180604.2152/flycheck-irony.el | 121 + .../flycheck-irony.elc | Bin 0 -> 3165 bytes elpa/gnupg/pubring.kbx | Bin 0 -> 2413 bytes elpa/gnupg/trustdb.gpg | Bin 0 -> 1200 bytes elpa/ht-20210119.741/ht-autoloads.el | 22 + elpa/ht-20210119.741/ht-pkg.el | 2 + elpa/ht-20210119.741/ht.el | 337 + elpa/ht-20210119.741/ht.elc | Bin 0 -> 13905 bytes elpa/irony-20220110.849/.dir-locals.el | 10 + elpa/irony-20220110.849/irony-autoloads.el | 169 + .../irony-20220110.849/irony-cdb-clang-complete.el | 79 + .../irony-cdb-clang-complete.elc | Bin 0 -> 1655 bytes elpa/irony-20220110.849/irony-cdb-json.el | 336 + elpa/irony-20220110.849/irony-cdb-json.elc | Bin 0 -> 10353 bytes elpa/irony-20220110.849/irony-cdb-libclang.el | 73 + elpa/irony-20220110.849/irony-cdb-libclang.elc | Bin 0 -> 1744 bytes elpa/irony-20220110.849/irony-cdb.el | 218 + elpa/irony-20220110.849/irony-cdb.elc | Bin 0 -> 6228 bytes elpa/irony-20220110.849/irony-completion.el | 426 + elpa/irony-20220110.849/irony-completion.elc | Bin 0 -> 10814 bytes elpa/irony-20220110.849/irony-diagnostics.el | 90 + elpa/irony-20220110.849/irony-diagnostics.elc | Bin 0 -> 2215 bytes elpa/irony-20220110.849/irony-iotask.el | 441 + elpa/irony-20220110.849/irony-iotask.elc | Bin 0 -> 33819 bytes elpa/irony-20220110.849/irony-pkg.el | 13 + elpa/irony-20220110.849/irony-snippet.el | 135 + elpa/irony-20220110.849/irony-snippet.elc | Bin 0 -> 2997 bytes elpa/irony-20220110.849/irony.el | 917 + elpa/irony-20220110.849/irony.elc | Bin 0 -> 31843 bytes elpa/irony-20220110.849/server/.clang-format | 8 + elpa/irony-20220110.849/server/.clang-tidy | 24 + elpa/irony-20220110.849/server/CMakeLists.txt | 33 + .../server/build-aux/run-clang-tidy/LICENSE.TXT | 43 + .../server/build-aux/run-clang-tidy/README | 12 + .../build-aux/run-clang-tidy/run-clang-tidy.py | 236 + .../server/cmake/CheckClangResourceDir.cmake | 90 + .../server/cmake/LibClangDiagnosticsChecker.cpp | 47 + .../server/cmake/modules/FindLibClang.cmake | 106 + elpa/irony-20220110.849/server/src/CMakeLists.txt | 111 + elpa/irony-20220110.849/server/src/Command.cpp | 278 + elpa/irony-20220110.849/server/src/Command.h | 73 + elpa/irony-20220110.849/server/src/Commands.def | 39 + elpa/irony-20220110.849/server/src/CompDBCache.cpp | 71 + elpa/irony-20220110.849/server/src/CompDBCache.h | 86 + elpa/irony-20220110.849/server/src/Irony.cpp | 638 + elpa/irony-20220110.849/server/src/Irony.h | 147 + elpa/irony-20220110.849/server/src/Style.h | 17 + elpa/irony-20220110.849/server/src/TUManager.cpp | 182 + elpa/irony-20220110.849/server/src/TUManager.h | 109 + elpa/irony-20220110.849/server/src/main.cpp | 235 + .../irony-20220110.849/server/src/support/CIndex.h | 33 + .../server/src/support/CommandLineParser.cpp | 119 + .../server/src/support/CommandLineParser.h | 21 + .../server/src/support/NonCopyable.h | 34 + .../server/src/support/TemporaryFile.cpp | 74 + .../server/src/support/TemporaryFile.h | 36 + .../server/src/support/iomanip_quoted.h | 52 + elpa/irony-20220110.849/server/test/CMakeLists.txt | 3 + .../server/test/elisp/CMakeLists.txt | 47 + .../server/test/elisp/irony-cdb-json.el | 87 + .../server/test/elisp/irony-iotask.el | 249 + elpa/irony-20220110.849/server/test/elisp/irony.el | 121 + .../server/test/elisp/test-config.el | 14 + .../js2-highlight-vars-autoloads.el | 44 + .../js2-highlight-vars-pkg.el | 2 + .../js2-highlight-vars.el | 210 + .../js2-highlight-vars.elc | Bin 0 -> 7623 bytes elpa/js2-mode-20220402.2211/js2-imenu-extras.el | 518 + elpa/js2-mode-20220402.2211/js2-imenu-extras.elc | Bin 0 -> 21305 bytes elpa/js2-mode-20220402.2211/js2-mode-autoloads.el | 126 + elpa/js2-mode-20220402.2211/js2-mode-pkg.el | 15 + elpa/js2-mode-20220402.2211/js2-mode.el | 13090 ++++++++++ elpa/js2-mode-20220402.2211/js2-mode.elc | Bin 0 -> 1220333 bytes elpa/js2-mode-20220402.2211/js2-old-indent.el | 712 + elpa/js2-mode-20220402.2211/js2-old-indent.elc | Bin 0 -> 15397 bytes .../js2-refactor-autoloads.el | 131 + .../js2-refactor-20210306.2003/js2-refactor-pkg.el | 17 + elpa/js2-refactor-20210306.2003/js2-refactor.el | 248 + elpa/js2-refactor-20210306.2003/js2-refactor.elc | Bin 0 -> 6594 bytes .../js2r-conditionals.el | 57 + .../js2r-conditionals.elc | Bin 0 -> 1101 bytes .../js2r-conveniences.el | 242 + .../js2r-conveniences.elc | Bin 0 -> 6927 bytes elpa/js2-refactor-20210306.2003/js2r-formatting.el | 251 + .../js2-refactor-20210306.2003/js2r-formatting.elc | Bin 0 -> 9109 bytes elpa/js2-refactor-20210306.2003/js2r-functions.el | 537 + elpa/js2-refactor-20210306.2003/js2r-functions.elc | Bin 0 -> 20598 bytes elpa/js2-refactor-20210306.2003/js2r-helpers.el | 221 + elpa/js2-refactor-20210306.2003/js2r-helpers.elc | Bin 0 -> 8930 bytes elpa/js2-refactor-20210306.2003/js2r-iife.el | 174 + elpa/js2-refactor-20210306.2003/js2r-iife.elc | Bin 0 -> 5336 bytes elpa/js2-refactor-20210306.2003/js2r-paredit.el | 227 + elpa/js2-refactor-20210306.2003/js2r-paredit.elc | Bin 0 -> 6044 bytes elpa/js2-refactor-20210306.2003/js2r-vars.el | 376 + elpa/js2-refactor-20210306.2003/js2r-vars.elc | Bin 0 -> 11338 bytes elpa/js2-refactor-20210306.2003/js2r-wrapping.el | 76 + elpa/js2-refactor-20210306.2003/js2r-wrapping.elc | Bin 0 -> 1286 bytes elpa/log4e-20211019.948/log4e-autoloads.el | 33 + elpa/log4e-20211019.948/log4e-pkg.el | 2 + elpa/log4e-20211019.948/log4e.el | 592 + elpa/log4e-20211019.948/log4e.elc | Bin 0 -> 21292 bytes .../mc-cycle-cursors.el | 123 + .../mc-cycle-cursors.elc | Bin 0 -> 3079 bytes .../mc-edit-lines.el | 110 + .../mc-edit-lines.elc | Bin 0 -> 2425 bytes .../mc-hide-unmatched-lines-mode.el | 109 + .../mc-hide-unmatched-lines-mode.elc | Bin 0 -> 4795 bytes .../multiple-cursors-20220328.1724/mc-mark-more.el | 737 + .../mc-mark-more.elc | Bin 0 -> 23159 bytes elpa/multiple-cursors-20220328.1724/mc-mark-pop.el | 22 + .../multiple-cursors-20220328.1724/mc-mark-pop.elc | Bin 0 -> 449 bytes .../mc-separate-operations.el | 151 + .../mc-separate-operations.elc | Bin 0 -> 4529 bytes .../multiple-cursors-autoloads.el | 388 + .../multiple-cursors-core.el | 879 + .../multiple-cursors-core.elc | Bin 0 -> 31361 bytes .../multiple-cursors-pkg.el | 12 + .../multiple-cursors.el | 202 + .../multiple-cursors.elc | Bin 0 -> 394 bytes .../rectangular-region-mode.el | 128 + .../rectangular-region-mode.elc | Bin 0 -> 5307 bytes elpa/org-9.5.2.signed | 1 + elpa/org-9.5.2/.dir-locals.el | 22 + elpa/org-9.5.2/CONTRIBUTE | 71 + elpa/org-9.5.2/COPYING | 674 + elpa/org-9.5.2/Makefile | 93 + elpa/org-9.5.2/README | 66 + elpa/org-9.5.2/README_ELPA | 38 + elpa/org-9.5.2/dir | 19 + elpa/org-9.5.2/doc/.aspell.org.conf | 81 + elpa/org-9.5.2/doc/.nosearch | 1 + elpa/org-9.5.2/doc/Documentation_Standards.org | 171 + elpa/org-9.5.2/doc/Makefile | 102 + elpa/org-9.5.2/doc/dir | 19 + elpa/org-9.5.2/doc/doc-setup.org | 53 + elpa/org-9.5.2/doc/fdl.org | 490 + elpa/org-9.5.2/doc/htmlxref.cnf | 2 + elpa/org-9.5.2/doc/org-guide.org | 2654 +++ elpa/org-9.5.2/doc/org-manual.org | 22234 +++++++++++++++++ elpa/org-9.5.2/doc/org-version.inc | 3 + elpa/org-9.5.2/doc/org.texi | 23491 ++++++++++++++++++ elpa/org-9.5.2/doc/orgcard.tex | 691 + elpa/org-9.5.2/doc/orgguide.texi | 2688 +++ elpa/org-9.5.2/doc/pdflayout.sty | 44 + elpa/org-9.5.2/doc/texinfo.tex | 10145 ++++++++ elpa/org-9.5.2/etc/Makefile | 31 + elpa/org-9.5.2/etc/ORG-NEWS | 6327 +++++ elpa/org-9.5.2/etc/csl/README | 10 + elpa/org-9.5.2/etc/csl/chicago-author-date.csl | 658 + elpa/org-9.5.2/etc/csl/locales-en-US.xml | 357 + .../org-9.5.2/etc/styles/OrgOdtContentTemplate.xml | 275 + elpa/org-9.5.2/etc/styles/OrgOdtStyles.xml | 861 + elpa/org-9.5.2/etc/styles/README | 36 + elpa/org-9.5.2/local.mk | 52 + elpa/org-9.5.2/ob-C.el | 505 + elpa/org-9.5.2/ob-C.elc | Bin 0 -> 15265 bytes elpa/org-9.5.2/ob-R.el | 570 + elpa/org-9.5.2/ob-R.elc | Bin 0 -> 19213 bytes elpa/org-9.5.2/ob-awk.el | 110 + elpa/org-9.5.2/ob-awk.elc | Bin 0 -> 3156 bytes elpa/org-9.5.2/ob-calc.el | 109 + elpa/org-9.5.2/ob-calc.elc | Bin 0 -> 2396 bytes elpa/org-9.5.2/ob-clojure.el | 254 + elpa/org-9.5.2/ob-clojure.elc | Bin 0 -> 8037 bytes elpa/org-9.5.2/ob-comint.el | 312 + elpa/org-9.5.2/ob-comint.elc | Bin 0 -> 10777 bytes elpa/org-9.5.2/ob-core.el | 3269 +++ elpa/org-9.5.2/ob-core.elc | Bin 0 -> 104908 bytes elpa/org-9.5.2/ob-css.el | 46 + elpa/org-9.5.2/ob-css.elc | Bin 0 -> 888 bytes elpa/org-9.5.2/ob-ditaa.el | 122 + elpa/org-9.5.2/ob-ditaa.elc | Bin 0 -> 3094 bytes elpa/org-9.5.2/ob-dot.el | 91 + elpa/org-9.5.2/ob-dot.elc | Bin 0 -> 2118 bytes elpa/org-9.5.2/ob-emacs-lisp.el | 110 + elpa/org-9.5.2/ob-emacs-lisp.elc | Bin 0 -> 3134 bytes elpa/org-9.5.2/ob-eshell.el | 110 + elpa/org-9.5.2/ob-eshell.elc | Bin 0 -> 3123 bytes elpa/org-9.5.2/ob-eval.el | 160 + elpa/org-9.5.2/ob-eval.elc | Bin 0 -> 4171 bytes elpa/org-9.5.2/ob-exp.el | 418 + elpa/org-9.5.2/ob-exp.elc | Bin 0 -> 11184 bytes elpa/org-9.5.2/ob-forth.el | 88 + elpa/org-9.5.2/ob-forth.elc | Bin 0 -> 2030 bytes elpa/org-9.5.2/ob-fortran.el | 170 + elpa/org-9.5.2/ob-fortran.elc | Bin 0 -> 5515 bytes elpa/org-9.5.2/ob-gnuplot.el | 299 + elpa/org-9.5.2/ob-gnuplot.elc | Bin 0 -> 8938 bytes elpa/org-9.5.2/ob-groovy.el | 113 + elpa/org-9.5.2/ob-groovy.elc | Bin 0 -> 3765 bytes elpa/org-9.5.2/ob-haskell.el | 281 + elpa/org-9.5.2/ob-haskell.elc | Bin 0 -> 10810 bytes elpa/org-9.5.2/ob-java.el | 490 + elpa/org-9.5.2/ob-java.elc | Bin 0 -> 15758 bytes elpa/org-9.5.2/ob-js.el | 204 + elpa/org-9.5.2/ob-js.elc | Bin 0 -> 6822 bytes elpa/org-9.5.2/ob-julia.el | 333 + elpa/org-9.5.2/ob-julia.elc | Bin 0 -> 11595 bytes elpa/org-9.5.2/ob-latex.el | 283 + elpa/org-9.5.2/ob-latex.elc | Bin 0 -> 8138 bytes elpa/org-9.5.2/ob-lilypond.el | 428 + elpa/org-9.5.2/ob-lilypond.elc | Bin 0 -> 14755 bytes elpa/org-9.5.2/ob-lisp.el | 125 + elpa/org-9.5.2/ob-lisp.elc | Bin 0 -> 3708 bytes elpa/org-9.5.2/ob-lob.el | 164 + elpa/org-9.5.2/ob-lob.elc | Bin 0 -> 5087 bytes elpa/org-9.5.2/ob-lua.el | 403 + elpa/org-9.5.2/ob-lua.elc | Bin 0 -> 13257 bytes elpa/org-9.5.2/ob-makefile.el | 45 + elpa/org-9.5.2/ob-makefile.elc | Bin 0 -> 876 bytes elpa/org-9.5.2/ob-matlab.el | 45 + elpa/org-9.5.2/ob-matlab.elc | Bin 0 -> 500 bytes elpa/org-9.5.2/ob-maxima.el | 128 + elpa/org-9.5.2/ob-maxima.elc | Bin 0 -> 3817 bytes elpa/org-9.5.2/ob-ocaml.el | 169 + elpa/org-9.5.2/ob-ocaml.elc | Bin 0 -> 5726 bytes elpa/org-9.5.2/ob-octave.el | 264 + elpa/org-9.5.2/ob-octave.elc | Bin 0 -> 9916 bytes elpa/org-9.5.2/ob-org.el | 70 + elpa/org-9.5.2/ob-org.elc | Bin 0 -> 1710 bytes elpa/org-9.5.2/ob-perl.el | 156 + elpa/org-9.5.2/ob-perl.elc | Bin 0 -> 4648 bytes elpa/org-9.5.2/ob-plantuml.el | 165 + elpa/org-9.5.2/ob-plantuml.elc | Bin 0 -> 5299 bytes elpa/org-9.5.2/ob-processing.el | 195 + elpa/org-9.5.2/ob-processing.elc | Bin 0 -> 4685 bytes elpa/org-9.5.2/ob-python.el | 444 + elpa/org-9.5.2/ob-python.elc | Bin 0 -> 15845 bytes elpa/org-9.5.2/ob-ref.el | 246 + elpa/org-9.5.2/ob-ref.elc | Bin 0 -> 6028 bytes elpa/org-9.5.2/ob-ruby.el | 279 + elpa/org-9.5.2/ob-ruby.elc | Bin 0 -> 10061 bytes elpa/org-9.5.2/ob-sass.el | 68 + elpa/org-9.5.2/ob-sass.elc | Bin 0 -> 1537 bytes elpa/org-9.5.2/ob-scheme.el | 241 + elpa/org-9.5.2/ob-scheme.elc | Bin 0 -> 6714 bytes elpa/org-9.5.2/ob-screen.el | 143 + elpa/org-9.5.2/ob-screen.elc | Bin 0 -> 4415 bytes elpa/org-9.5.2/ob-sed.el | 106 + elpa/org-9.5.2/ob-sed.elc | Bin 0 -> 2762 bytes elpa/org-9.5.2/ob-shell.el | 309 + elpa/org-9.5.2/ob-shell.elc | Bin 0 -> 11876 bytes elpa/org-9.5.2/ob-sql.el | 421 + elpa/org-9.5.2/ob-sql.elc | Bin 0 -> 11587 bytes elpa/org-9.5.2/ob-sqlite.el | 148 + elpa/org-9.5.2/ob-sqlite.elc | Bin 0 -> 4344 bytes elpa/org-9.5.2/ob-table.el | 152 + elpa/org-9.5.2/ob-table.elc | Bin 0 -> 3426 bytes elpa/org-9.5.2/ob-tangle.el | 616 + elpa/org-9.5.2/ob-tangle.elc | Bin 0 -> 18738 bytes elpa/org-9.5.2/ob.el | 43 + elpa/org-9.5.2/ob.elc | Bin 0 -> 692 bytes elpa/org-9.5.2/oc-basic.el | 789 + elpa/org-9.5.2/oc-basic.elc | Bin 0 -> 22076 bytes elpa/org-9.5.2/oc-biblatex.el | 318 + elpa/org-9.5.2/oc-biblatex.elc | Bin 0 -> 8508 bytes elpa/org-9.5.2/oc-csl.el | 631 + elpa/org-9.5.2/oc-csl.elc | Bin 0 -> 16308 bytes elpa/org-9.5.2/oc-natbib.el | 193 + elpa/org-9.5.2/oc-natbib.elc | Bin 0 -> 6413 bytes elpa/org-9.5.2/oc.el | 1650 ++ elpa/org-9.5.2/oc.elc | Bin 0 -> 63667 bytes elpa/org-9.5.2/ol-bbdb.el | 546 + elpa/org-9.5.2/ol-bbdb.elc | Bin 0 -> 12623 bytes elpa/org-9.5.2/ol-bibtex.el | 770 + elpa/org-9.5.2/ol-bibtex.elc | Bin 0 -> 26407 bytes elpa/org-9.5.2/ol-docview.el | 103 + elpa/org-9.5.2/ol-docview.elc | Bin 0 -> 2099 bytes elpa/org-9.5.2/ol-doi.el | 72 + elpa/org-9.5.2/ol-doi.elc | Bin 0 -> 1921 bytes elpa/org-9.5.2/ol-eshell.el | 68 + elpa/org-9.5.2/ol-eshell.elc | Bin 0 -> 1533 bytes elpa/org-9.5.2/ol-eww.el | 181 + elpa/org-9.5.2/ol-eww.elc | Bin 0 -> 3343 bytes elpa/org-9.5.2/ol-gnus.el | 272 + elpa/org-9.5.2/ol-gnus.elc | Bin 0 -> 8338 bytes elpa/org-9.5.2/ol-info.el | 148 + elpa/org-9.5.2/ol-info.elc | Bin 0 -> 4357 bytes elpa/org-9.5.2/ol-irc.el | 269 + elpa/org-9.5.2/ol-irc.elc | Bin 0 -> 6010 bytes elpa/org-9.5.2/ol-man.el | 86 + elpa/org-9.5.2/ol-man.elc | Bin 0 -> 2381 bytes elpa/org-9.5.2/ol-mhe.el | 219 + elpa/org-9.5.2/ol-mhe.elc | Bin 0 -> 5447 bytes elpa/org-9.5.2/ol-rmail.el | 117 + elpa/org-9.5.2/ol-rmail.elc | Bin 0 -> 2672 bytes elpa/org-9.5.2/ol-w3m.el | 221 + elpa/org-9.5.2/ol-w3m.elc | Bin 0 -> 4379 bytes elpa/org-9.5.2/ol.el | 2042 ++ elpa/org-9.5.2/ol.elc | Bin 0 -> 59986 bytes elpa/org-9.5.2/org-agenda.el | 10892 +++++++++ elpa/org-9.5.2/org-agenda.elc | Bin 0 -> 390040 bytes elpa/org-9.5.2/org-archive.el | 639 + elpa/org-9.5.2/org-archive.elc | Bin 0 -> 18853 bytes elpa/org-9.5.2/org-attach-git.el | 142 + elpa/org-9.5.2/org-attach-git.elc | Bin 0 -> 4817 bytes elpa/org-9.5.2/org-attach.el | 787 + elpa/org-9.5.2/org-attach.elc | Bin 0 -> 27138 bytes elpa/org-9.5.2/org-autoloads.el | 1528 ++ elpa/org-9.5.2/org-capture.el | 1965 ++ elpa/org-9.5.2/org-capture.elc | Bin 0 -> 62582 bytes elpa/org-9.5.2/org-clock.el | 3149 +++ elpa/org-9.5.2/org-clock.elc | Bin 0 -> 96631 bytes elpa/org-9.5.2/org-colview.el | 1738 ++ elpa/org-9.5.2/org-colview.elc | Bin 0 -> 57144 bytes elpa/org-9.5.2/org-compat.el | 1256 + elpa/org-9.5.2/org-compat.elc | Bin 0 -> 47300 bytes elpa/org-9.5.2/org-crypt.el | 320 + elpa/org-9.5.2/org-crypt.elc | Bin 0 -> 7397 bytes elpa/org-9.5.2/org-ctags.el | 534 + elpa/org-9.5.2/org-ctags.elc | Bin 0 -> 12106 bytes elpa/org-9.5.2/org-datetree.el | 270 + elpa/org-9.5.2/org-datetree.elc | Bin 0 -> 8441 bytes elpa/org-9.5.2/org-duration.el | 460 + elpa/org-9.5.2/org-duration.elc | Bin 0 -> 12170 bytes elpa/org-9.5.2/org-element.el | 6265 +++++ elpa/org-9.5.2/org-element.elc | Bin 0 -> 181342 bytes elpa/org-9.5.2/org-entities.el | 602 + elpa/org-9.5.2/org-entities.elc | Bin 0 -> 27463 bytes elpa/org-9.5.2/org-faces.el | 730 + elpa/org-9.5.2/org-faces.elc | Bin 0 -> 27029 bytes elpa/org-9.5.2/org-feed.el | 719 + elpa/org-9.5.2/org-feed.elc | Bin 0 -> 19722 bytes elpa/org-9.5.2/org-footnote.el | 1023 + elpa/org-9.5.2/org-footnote.elc | Bin 0 -> 29286 bytes elpa/org-9.5.2/org-goto.el | 291 + elpa/org-9.5.2/org-goto.elc | Bin 0 -> 9290 bytes elpa/org-9.5.2/org-habit.el | 476 + elpa/org-9.5.2/org-habit.elc | Bin 0 -> 13997 bytes elpa/org-9.5.2/org-id.el | 755 + elpa/org-9.5.2/org-id.elc | Bin 0 -> 23067 bytes elpa/org-9.5.2/org-indent.el | 428 + elpa/org-9.5.2/org-indent.elc | Bin 0 -> 15433 bytes elpa/org-9.5.2/org-inlinetask.el | 354 + elpa/org-9.5.2/org-inlinetask.elc | Bin 0 -> 9059 bytes elpa/org-9.5.2/org-keys.el | 931 + elpa/org-9.5.2/org-keys.elc | Bin 0 -> 26711 bytes elpa/org-9.5.2/org-lint.el | 1321 ++ elpa/org-9.5.2/org-lint.elc | Bin 0 -> 54329 bytes elpa/org-9.5.2/org-list.el | 3582 +++ elpa/org-9.5.2/org-list.elc | Bin 0 -> 94474 bytes elpa/org-9.5.2/org-loaddefs.el | 4612 ++++ elpa/org-9.5.2/org-macro.el | 421 + elpa/org-9.5.2/org-macro.elc | Bin 0 -> 11487 bytes elpa/org-9.5.2/org-macs.el | 1308 + elpa/org-9.5.2/org-macs.elc | Bin 0 -> 43850 bytes elpa/org-9.5.2/org-mobile.el | 1141 + elpa/org-9.5.2/org-mobile.elc | Bin 0 -> 37327 bytes elpa/org-9.5.2/org-mouse.el | 1100 + elpa/org-9.5.2/org-mouse.elc | Bin 0 -> 32769 bytes elpa/org-9.5.2/org-num.el | 476 + elpa/org-9.5.2/org-num.elc | Bin 0 -> 13218 bytes elpa/org-9.5.2/org-pcomplete.el | 451 + elpa/org-9.5.2/org-pcomplete.elc | Bin 0 -> 13142 bytes elpa/org-9.5.2/org-pkg.el | 2 + elpa/org-9.5.2/org-plot.el | 730 + elpa/org-9.5.2/org-plot.elc | Bin 0 -> 22403 bytes elpa/org-9.5.2/org-protocol.el | 777 + elpa/org-9.5.2/org-protocol.elc | Bin 0 -> 22016 bytes elpa/org-9.5.2/org-refile.el | 752 + elpa/org-9.5.2/org-refile.elc | Bin 0 -> 23662 bytes elpa/org-9.5.2/org-src.el | 1311 + elpa/org-9.5.2/org-src.elc | Bin 0 -> 42376 bytes elpa/org-9.5.2/org-table.el | 6340 +++++ elpa/org-9.5.2/org-table.elc | Bin 0 -> 207949 bytes elpa/org-9.5.2/org-tempo.el | 188 + elpa/org-9.5.2/org-tempo.elc | Bin 0 -> 5027 bytes elpa/org-9.5.2/org-timer.el | 494 + elpa/org-9.5.2/org-timer.elc | Bin 0 -> 14454 bytes elpa/org-9.5.2/org-version.el | 24 + elpa/org-9.5.2/org.el | 21484 +++++++++++++++++ elpa/org-9.5.2/org.elc | Bin 0 -> 719476 bytes elpa/org-9.5.2/org.info | 23626 +++++++++++++++++++ elpa/org-9.5.2/orgguide.info | 2642 +++ elpa/org-9.5.2/ox-ascii.el | 2205 ++ elpa/org-9.5.2/ox-ascii.elc | Bin 0 -> 67981 bytes elpa/org-9.5.2/ox-beamer.el | 1158 + elpa/org-9.5.2/ox-beamer.elc | Bin 0 -> 35390 bytes elpa/org-9.5.2/ox-html.el | 3895 +++ elpa/org-9.5.2/ox-html.elc | Bin 0 -> 132996 bytes elpa/org-9.5.2/ox-icalendar.el | 1031 + elpa/org-9.5.2/ox-icalendar.elc | Bin 0 -> 34342 bytes elpa/org-9.5.2/ox-koma-letter.el | 989 + elpa/org-9.5.2/ox-koma-letter.elc | Bin 0 -> 29675 bytes elpa/org-9.5.2/ox-latex.el | 3828 +++ elpa/org-9.5.2/ox-latex.elc | Bin 0 -> 122294 bytes elpa/org-9.5.2/ox-man.el | 1141 + elpa/org-9.5.2/ox-man.elc | Bin 0 -> 31879 bytes elpa/org-9.5.2/ox-md.el | 787 + elpa/org-9.5.2/ox-md.elc | Bin 0 -> 25563 bytes elpa/org-9.5.2/ox-odt.el | 4338 ++++ elpa/org-9.5.2/ox-odt.elc | Bin 0 -> 132921 bytes elpa/org-9.5.2/ox-org.el | 357 + elpa/org-9.5.2/ox-org.elc | Bin 0 -> 12648 bytes elpa/org-9.5.2/ox-publish.el | 1380 ++ elpa/org-9.5.2/ox-publish.elc | Bin 0 -> 44840 bytes elpa/org-9.5.2/ox-texinfo.el | 1757 ++ elpa/org-9.5.2/ox-texinfo.elc | Bin 0 -> 59693 bytes elpa/org-9.5.2/ox.el | 7029 ++++++ elpa/org-9.5.2/ox.elc | Bin 0 -> 242218 bytes elpa/org-9.5.2/request-assign-future.txt | 44 + elpa/pkg-info-20150517.1143/pkg-info-autoloads.el | 127 + elpa/pkg-info-20150517.1143/pkg-info-pkg.el | 2 + elpa/pkg-info-20150517.1143/pkg-info.el | 332 + elpa/pkg-info-20150517.1143/pkg-info.elc | Bin 0 -> 9914 bytes .../projectile-autoloads.el | 612 + elpa/projectile-20220313.1334/projectile-pkg.el | 2 + elpa/projectile-20220313.1334/projectile.el | 5746 +++++ elpa/projectile-20220313.1334/projectile.elc | Bin 0 -> 213969 bytes elpa/req-package-20180605.1141/req-package-args.el | 31 + .../req-package-20180605.1141/req-package-args.elc | Bin 0 -> 1150 bytes .../req-package-autoloads.el | 50 + .../req-package-cycles.el | 35 + .../req-package-cycles.elc | Bin 0 -> 1572 bytes .../req-package-20180605.1141/req-package-hooks.el | 26 + .../req-package-hooks.elc | Bin 0 -> 1236 bytes elpa/req-package-20180605.1141/req-package-pkg.el | 15 + elpa/req-package-20180605.1141/req-package.el | 494 + elpa/req-package-20180605.1141/req-package.elc | Bin 0 -> 19471 bytes elpa/s-20210616.619/s-autoloads.el | 22 + elpa/s-20210616.619/s-pkg.el | 2 + elpa/s-20210616.619/s.el | 745 + elpa/s-20210616.619/s.elc | Bin 0 -> 28078 bytes .../simple-httpd-autoloads.el | 38 + .../simple-httpd-20191103.1446/simple-httpd-pkg.el | 2 + elpa/simple-httpd-20191103.1446/simple-httpd.el | 904 + elpa/simple-httpd-20191103.1446/simple-httpd.elc | Bin 0 -> 25989 bytes elpa/skewer-mode-20200304.1142/cache-table.el | 66 + elpa/skewer-mode-20200304.1142/cache-table.elc | Bin 0 -> 6281 bytes elpa/skewer-mode-20200304.1142/example.html | 9 + elpa/skewer-mode-20200304.1142/skewer-bower.el | 217 + elpa/skewer-mode-20200304.1142/skewer-bower.elc | Bin 0 -> 7211 bytes elpa/skewer-mode-20200304.1142/skewer-css.el | 134 + elpa/skewer-mode-20200304.1142/skewer-css.elc | Bin 0 -> 5346 bytes .../skewer-everything.user.js | 54 + elpa/skewer-mode-20200304.1142/skewer-html.el | 165 + elpa/skewer-mode-20200304.1142/skewer-html.elc | Bin 0 -> 7845 bytes .../skewer-mode-autoloads.el | 160 + elpa/skewer-mode-20200304.1142/skewer-mode-pkg.el | 12 + elpa/skewer-mode-20200304.1142/skewer-mode.el | 620 + elpa/skewer-mode-20200304.1142/skewer-mode.elc | Bin 0 -> 29666 bytes elpa/skewer-mode-20200304.1142/skewer-repl.el | 210 + elpa/skewer-mode-20200304.1142/skewer-repl.elc | Bin 0 -> 8507 bytes elpa/skewer-mode-20200304.1142/skewer-setup.el | 21 + elpa/skewer-mode-20200304.1142/skewer-setup.elc | Bin 0 -> 378 bytes elpa/skewer-mode-20200304.1142/skewer.js | 436 + elpa/use-package-20210207.1926/dir | 18 + .../use-package-autoloads.el | 230 + .../use-package-bind-key.el | 172 + .../use-package-bind-key.elc | Bin 0 -> 4638 bytes elpa/use-package-20210207.1926/use-package-core.el | 1633 ++ .../use-package-20210207.1926/use-package-core.elc | Bin 0 -> 55873 bytes .../use-package-delight.el | 91 + .../use-package-delight.elc | Bin 0 -> 1852 bytes .../use-package-diminish.el | 80 + .../use-package-diminish.elc | Bin 0 -> 1766 bytes .../use-package-ensure.el | 214 + .../use-package-ensure.elc | Bin 0 -> 5395 bytes elpa/use-package-20210207.1926/use-package-jump.el | 79 + .../use-package-20210207.1926/use-package-jump.elc | Bin 0 -> 1773 bytes elpa/use-package-20210207.1926/use-package-lint.el | 84 + .../use-package-20210207.1926/use-package-lint.elc | Bin 0 -> 1545 bytes elpa/use-package-20210207.1926/use-package-pkg.el | 13 + elpa/use-package-20210207.1926/use-package.el | 54 + elpa/use-package-20210207.1926/use-package.elc | Bin 0 -> 718 bytes elpa/use-package-20210207.1926/use-package.info | 1048 + elpa/yasnippet-20200604.246/yasnippet-autoloads.el | 81 + elpa/yasnippet-20200604.246/yasnippet-pkg.el | 2 + elpa/yasnippet-20200604.246/yasnippet.el | 5311 +++++ elpa/yasnippet-20200604.246/yasnippet.elc | Bin 0 -> 227446 bytes 655 files changed, 331665 insertions(+) create mode 100644 elpa/ac-js2-20190101.933/ac-js2-autoloads.el create mode 100644 elpa/ac-js2-20190101.933/ac-js2-pkg.el create mode 100644 elpa/ac-js2-20190101.933/ac-js2-tests.el create mode 100644 elpa/ac-js2-20190101.933/ac-js2-tests.elc create mode 100644 elpa/ac-js2-20190101.933/ac-js2.el create mode 100644 elpa/ac-js2-20190101.933/ac-js2.elc create mode 100644 elpa/ac-js2-20190101.933/skewer-addon.js create mode 100644 elpa/all-the-icons-20220325.1238/all-the-icons-autoloads.el create mode 100644 elpa/all-the-icons-20220325.1238/all-the-icons-faces.el create mode 100644 elpa/all-the-icons-20220325.1238/all-the-icons-faces.elc create mode 100644 elpa/all-the-icons-20220325.1238/all-the-icons-pkg.el create mode 100644 elpa/all-the-icons-20220325.1238/all-the-icons.el create mode 100644 elpa/all-the-icons-20220325.1238/all-the-icons.elc create mode 100644 elpa/all-the-icons-20220325.1238/data/data-alltheicons.el create mode 100644 elpa/all-the-icons-20220325.1238/data/data-alltheicons.elc create mode 100644 elpa/all-the-icons-20220325.1238/data/data-faicons.el create mode 100644 elpa/all-the-icons-20220325.1238/data/data-faicons.elc create mode 100644 elpa/all-the-icons-20220325.1238/data/data-fileicons.el create mode 100644 elpa/all-the-icons-20220325.1238/data/data-fileicons.elc create mode 100644 elpa/all-the-icons-20220325.1238/data/data-material.el create mode 100644 elpa/all-the-icons-20220325.1238/data/data-material.elc create mode 100644 elpa/all-the-icons-20220325.1238/data/data-octicons.el create mode 100644 elpa/all-the-icons-20220325.1238/data/data-octicons.elc create mode 100644 elpa/all-the-icons-20220325.1238/data/data-weathericons.el create mode 100644 elpa/all-the-icons-20220325.1238/data/data-weathericons.elc create mode 100644 elpa/archives/gnu/archive-contents create mode 100644 elpa/archives/gnu/archive-contents.signed create mode 100644 elpa/archives/melpa/archive-contents create mode 100644 elpa/archives/nongnu/archive-contents create mode 100644 elpa/archives/nongnu/archive-contents.signed create mode 100644 elpa/bind-key-20210210.1609/bind-key-autoloads.el create mode 100644 elpa/bind-key-20210210.1609/bind-key-pkg.el create mode 100644 elpa/bind-key-20210210.1609/bind-key.el create mode 100644 elpa/bind-key-20210210.1609/bind-key.elc create mode 100644 elpa/company-20220326.48/company-abbrev.el create mode 100644 elpa/company-20220326.48/company-abbrev.elc create mode 100644 elpa/company-20220326.48/company-autoloads.el create mode 100644 elpa/company-20220326.48/company-bbdb.el create mode 100644 elpa/company-20220326.48/company-bbdb.elc create mode 100644 elpa/company-20220326.48/company-capf.el create mode 100644 elpa/company-20220326.48/company-capf.elc create mode 100644 elpa/company-20220326.48/company-clang.el create mode 100644 elpa/company-20220326.48/company-clang.elc create mode 100644 elpa/company-20220326.48/company-cmake.el create mode 100644 elpa/company-20220326.48/company-cmake.elc create mode 100644 elpa/company-20220326.48/company-css.el create mode 100644 elpa/company-20220326.48/company-css.elc create mode 100644 elpa/company-20220326.48/company-dabbrev-code.el create mode 100644 elpa/company-20220326.48/company-dabbrev-code.elc create mode 100644 elpa/company-20220326.48/company-dabbrev.el create mode 100644 elpa/company-20220326.48/company-dabbrev.elc create mode 100644 elpa/company-20220326.48/company-elisp.el create mode 100644 elpa/company-20220326.48/company-elisp.elc create mode 100644 elpa/company-20220326.48/company-etags.el create mode 100644 elpa/company-20220326.48/company-etags.elc create mode 100644 elpa/company-20220326.48/company-files.el create mode 100644 elpa/company-20220326.48/company-files.elc create mode 100644 elpa/company-20220326.48/company-gtags.el create mode 100644 elpa/company-20220326.48/company-gtags.elc create mode 100644 elpa/company-20220326.48/company-ispell.el create mode 100644 elpa/company-20220326.48/company-ispell.elc create mode 100644 elpa/company-20220326.48/company-keywords.el create mode 100644 elpa/company-20220326.48/company-keywords.elc create mode 100644 elpa/company-20220326.48/company-nxml.el create mode 100644 elpa/company-20220326.48/company-nxml.elc create mode 100644 elpa/company-20220326.48/company-oddmuse.el create mode 100644 elpa/company-20220326.48/company-oddmuse.elc create mode 100644 elpa/company-20220326.48/company-pkg.el create mode 100644 elpa/company-20220326.48/company-semantic.el create mode 100644 elpa/company-20220326.48/company-semantic.elc create mode 100644 elpa/company-20220326.48/company-template.el create mode 100644 elpa/company-20220326.48/company-template.elc create mode 100644 elpa/company-20220326.48/company-tempo.el create mode 100644 elpa/company-20220326.48/company-tempo.elc create mode 100644 elpa/company-20220326.48/company-tng.el create mode 100644 elpa/company-20220326.48/company-tng.elc create mode 100644 elpa/company-20220326.48/company-yasnippet.el create mode 100644 elpa/company-20220326.48/company-yasnippet.elc create mode 100644 elpa/company-20220326.48/company.el create mode 100644 elpa/company-20220326.48/company.elc create mode 100644 elpa/company-20220326.48/company.info create mode 100644 elpa/company-20220326.48/dir create mode 100644 elpa/company-20220326.48/icons/LICENSE create mode 100644 elpa/company-20220326.48/icons/attribution.md create mode 100644 elpa/company-20220326.48/icons/vscode-dark/folder.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/references.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-array.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-boolean.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-class.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-color.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-constant.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-enumerator-member.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-enumerator.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-event.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-field.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-file.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-interface.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-key.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-keyword.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-method.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-misc.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-namespace.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-numeric.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-operator.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-parameter.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-property.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-ruler.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-snippet.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-string.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-structure.svg create mode 100644 elpa/company-20220326.48/icons/vscode-dark/symbol-variable.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/folder.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/references.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-array.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-boolean.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-class.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-color.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-constant.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-enumerator-member.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-enumerator.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-event.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-field.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-file.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-interface.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-key.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-keyword.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-method.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-misc.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-namespace.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-numeric.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-operator.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-parameter.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-property.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-ruler.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-snippet.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-string.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-structure.svg create mode 100644 elpa/company-20220326.48/icons/vscode-light/symbol-variable.svg create mode 100755 elpa/company-20220326.48/images/small/echo-meta.png create mode 100755 elpa/company-20220326.48/images/small/echo-qa.png create mode 100755 elpa/company-20220326.48/images/small/echo-strip-qa.png create mode 100755 elpa/company-20220326.48/images/small/echo-strip.png create mode 100755 elpa/company-20220326.48/images/small/echo.png create mode 100755 elpa/company-20220326.48/images/small/preview-dark.png create mode 100755 elpa/company-20220326.48/images/small/preview-light.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-annotations.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-faces-light.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-filter.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-flip.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-icon-bg.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-icon-face.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-icons-dot.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-icons-text.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-icons-vscode.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-limit.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-margin.png create mode 100644 elpa/company-20220326.48/images/small/tooltip-minimum-above.png create mode 100644 elpa/company-20220326.48/images/small/tooltip-minimum-below.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-offset-display.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-qa-faces-light.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-quick-access.png create mode 100755 elpa/company-20220326.48/images/small/tooltip-search.png create mode 100644 elpa/company-irony-20190124.2346/company-irony-autoloads.el create mode 100644 elpa/company-irony-20190124.2346/company-irony-pkg.el create mode 100644 elpa/company-irony-20190124.2346/company-irony.el create mode 100644 elpa/company-irony-20190124.2346/company-irony.elc create mode 100644 elpa/dash-20210826.1149/dash-autoloads.el create mode 100644 elpa/dash-20210826.1149/dash-pkg.el create mode 100644 elpa/dash-20210826.1149/dash.el create mode 100644 elpa/dash-20210826.1149/dash.elc create mode 100644 elpa/dash-20210826.1149/dash.info create mode 100644 elpa/dash-20210826.1149/dir create mode 100644 elpa/epl-20180205.2049/epl-autoloads.el create mode 100644 elpa/epl-20180205.2049/epl-pkg.el create mode 100644 elpa/epl-20180205.2049/epl.el create mode 100644 elpa/epl-20180205.2049/epl.elc create mode 100644 elpa/flycheck-20220314.27/flycheck-autoloads.el create mode 100644 elpa/flycheck-20220314.27/flycheck-buttercup.el create mode 100644 elpa/flycheck-20220314.27/flycheck-ert.el create mode 100644 elpa/flycheck-20220314.27/flycheck-ert.elc create mode 100644 elpa/flycheck-20220314.27/flycheck-pkg.el create mode 100644 elpa/flycheck-20220314.27/flycheck.el create mode 100644 elpa/flycheck-20220314.27/flycheck.elc create mode 100644 elpa/flycheck-irony-20180604.2152/flycheck-irony-autoloads.el create mode 100644 elpa/flycheck-irony-20180604.2152/flycheck-irony-pkg.el create mode 100644 elpa/flycheck-irony-20180604.2152/flycheck-irony.el create mode 100644 elpa/flycheck-irony-20180604.2152/flycheck-irony.elc create mode 100644 elpa/gnupg/pubring.kbx create mode 100644 elpa/gnupg/trustdb.gpg create mode 100644 elpa/ht-20210119.741/ht-autoloads.el create mode 100644 elpa/ht-20210119.741/ht-pkg.el create mode 100644 elpa/ht-20210119.741/ht.el create mode 100644 elpa/ht-20210119.741/ht.elc create mode 100644 elpa/irony-20220110.849/.dir-locals.el create mode 100644 elpa/irony-20220110.849/irony-autoloads.el create mode 100644 elpa/irony-20220110.849/irony-cdb-clang-complete.el create mode 100644 elpa/irony-20220110.849/irony-cdb-clang-complete.elc create mode 100644 elpa/irony-20220110.849/irony-cdb-json.el create mode 100644 elpa/irony-20220110.849/irony-cdb-json.elc create mode 100644 elpa/irony-20220110.849/irony-cdb-libclang.el create mode 100644 elpa/irony-20220110.849/irony-cdb-libclang.elc create mode 100644 elpa/irony-20220110.849/irony-cdb.el create mode 100644 elpa/irony-20220110.849/irony-cdb.elc create mode 100644 elpa/irony-20220110.849/irony-completion.el create mode 100644 elpa/irony-20220110.849/irony-completion.elc create mode 100644 elpa/irony-20220110.849/irony-diagnostics.el create mode 100644 elpa/irony-20220110.849/irony-diagnostics.elc create mode 100644 elpa/irony-20220110.849/irony-iotask.el create mode 100644 elpa/irony-20220110.849/irony-iotask.elc create mode 100644 elpa/irony-20220110.849/irony-pkg.el create mode 100644 elpa/irony-20220110.849/irony-snippet.el create mode 100644 elpa/irony-20220110.849/irony-snippet.elc create mode 100644 elpa/irony-20220110.849/irony.el create mode 100644 elpa/irony-20220110.849/irony.elc create mode 100644 elpa/irony-20220110.849/server/.clang-format create mode 100644 elpa/irony-20220110.849/server/.clang-tidy create mode 100644 elpa/irony-20220110.849/server/CMakeLists.txt create mode 100644 elpa/irony-20220110.849/server/build-aux/run-clang-tidy/LICENSE.TXT create mode 100644 elpa/irony-20220110.849/server/build-aux/run-clang-tidy/README create mode 100755 elpa/irony-20220110.849/server/build-aux/run-clang-tidy/run-clang-tidy.py create mode 100644 elpa/irony-20220110.849/server/cmake/CheckClangResourceDir.cmake create mode 100644 elpa/irony-20220110.849/server/cmake/LibClangDiagnosticsChecker.cpp create mode 100644 elpa/irony-20220110.849/server/cmake/modules/FindLibClang.cmake create mode 100644 elpa/irony-20220110.849/server/src/CMakeLists.txt create mode 100644 elpa/irony-20220110.849/server/src/Command.cpp create mode 100644 elpa/irony-20220110.849/server/src/Command.h create mode 100644 elpa/irony-20220110.849/server/src/Commands.def create mode 100644 elpa/irony-20220110.849/server/src/CompDBCache.cpp create mode 100644 elpa/irony-20220110.849/server/src/CompDBCache.h create mode 100644 elpa/irony-20220110.849/server/src/Irony.cpp create mode 100644 elpa/irony-20220110.849/server/src/Irony.h create mode 100644 elpa/irony-20220110.849/server/src/Style.h create mode 100644 elpa/irony-20220110.849/server/src/TUManager.cpp create mode 100644 elpa/irony-20220110.849/server/src/TUManager.h create mode 100644 elpa/irony-20220110.849/server/src/main.cpp create mode 100644 elpa/irony-20220110.849/server/src/support/CIndex.h create mode 100644 elpa/irony-20220110.849/server/src/support/CommandLineParser.cpp create mode 100644 elpa/irony-20220110.849/server/src/support/CommandLineParser.h create mode 100644 elpa/irony-20220110.849/server/src/support/NonCopyable.h create mode 100644 elpa/irony-20220110.849/server/src/support/TemporaryFile.cpp create mode 100644 elpa/irony-20220110.849/server/src/support/TemporaryFile.h create mode 100644 elpa/irony-20220110.849/server/src/support/iomanip_quoted.h create mode 100644 elpa/irony-20220110.849/server/test/CMakeLists.txt create mode 100644 elpa/irony-20220110.849/server/test/elisp/CMakeLists.txt create mode 100644 elpa/irony-20220110.849/server/test/elisp/irony-cdb-json.el create mode 100644 elpa/irony-20220110.849/server/test/elisp/irony-iotask.el create mode 100644 elpa/irony-20220110.849/server/test/elisp/irony.el create mode 100644 elpa/irony-20220110.849/server/test/elisp/test-config.el create mode 100644 elpa/js2-highlight-vars-20170418.1829/js2-highlight-vars-autoloads.el create mode 100644 elpa/js2-highlight-vars-20170418.1829/js2-highlight-vars-pkg.el create mode 100644 elpa/js2-highlight-vars-20170418.1829/js2-highlight-vars.el create mode 100644 elpa/js2-highlight-vars-20170418.1829/js2-highlight-vars.elc create mode 100644 elpa/js2-mode-20220402.2211/js2-imenu-extras.el create mode 100644 elpa/js2-mode-20220402.2211/js2-imenu-extras.elc create mode 100644 elpa/js2-mode-20220402.2211/js2-mode-autoloads.el create mode 100644 elpa/js2-mode-20220402.2211/js2-mode-pkg.el create mode 100644 elpa/js2-mode-20220402.2211/js2-mode.el create mode 100644 elpa/js2-mode-20220402.2211/js2-mode.elc create mode 100644 elpa/js2-mode-20220402.2211/js2-old-indent.el create mode 100644 elpa/js2-mode-20220402.2211/js2-old-indent.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2-refactor-autoloads.el create mode 100644 elpa/js2-refactor-20210306.2003/js2-refactor-pkg.el create mode 100644 elpa/js2-refactor-20210306.2003/js2-refactor.el create mode 100644 elpa/js2-refactor-20210306.2003/js2-refactor.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2r-conditionals.el create mode 100644 elpa/js2-refactor-20210306.2003/js2r-conditionals.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2r-conveniences.el create mode 100644 elpa/js2-refactor-20210306.2003/js2r-conveniences.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2r-formatting.el create mode 100644 elpa/js2-refactor-20210306.2003/js2r-formatting.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2r-functions.el create mode 100644 elpa/js2-refactor-20210306.2003/js2r-functions.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2r-helpers.el create mode 100644 elpa/js2-refactor-20210306.2003/js2r-helpers.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2r-iife.el create mode 100644 elpa/js2-refactor-20210306.2003/js2r-iife.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2r-paredit.el create mode 100644 elpa/js2-refactor-20210306.2003/js2r-paredit.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2r-vars.el create mode 100644 elpa/js2-refactor-20210306.2003/js2r-vars.elc create mode 100644 elpa/js2-refactor-20210306.2003/js2r-wrapping.el create mode 100644 elpa/js2-refactor-20210306.2003/js2r-wrapping.elc create mode 100644 elpa/log4e-20211019.948/log4e-autoloads.el create mode 100644 elpa/log4e-20211019.948/log4e-pkg.el create mode 100644 elpa/log4e-20211019.948/log4e.el create mode 100644 elpa/log4e-20211019.948/log4e.elc create mode 100644 elpa/multiple-cursors-20220328.1724/mc-cycle-cursors.el create mode 100644 elpa/multiple-cursors-20220328.1724/mc-cycle-cursors.elc create mode 100644 elpa/multiple-cursors-20220328.1724/mc-edit-lines.el create mode 100644 elpa/multiple-cursors-20220328.1724/mc-edit-lines.elc create mode 100644 elpa/multiple-cursors-20220328.1724/mc-hide-unmatched-lines-mode.el create mode 100644 elpa/multiple-cursors-20220328.1724/mc-hide-unmatched-lines-mode.elc create mode 100644 elpa/multiple-cursors-20220328.1724/mc-mark-more.el create mode 100644 elpa/multiple-cursors-20220328.1724/mc-mark-more.elc create mode 100644 elpa/multiple-cursors-20220328.1724/mc-mark-pop.el create mode 100644 elpa/multiple-cursors-20220328.1724/mc-mark-pop.elc create mode 100644 elpa/multiple-cursors-20220328.1724/mc-separate-operations.el create mode 100644 elpa/multiple-cursors-20220328.1724/mc-separate-operations.elc create mode 100644 elpa/multiple-cursors-20220328.1724/multiple-cursors-autoloads.el create mode 100644 elpa/multiple-cursors-20220328.1724/multiple-cursors-core.el create mode 100644 elpa/multiple-cursors-20220328.1724/multiple-cursors-core.elc create mode 100644 elpa/multiple-cursors-20220328.1724/multiple-cursors-pkg.el create mode 100644 elpa/multiple-cursors-20220328.1724/multiple-cursors.el create mode 100644 elpa/multiple-cursors-20220328.1724/multiple-cursors.elc create mode 100644 elpa/multiple-cursors-20220328.1724/rectangular-region-mode.el create mode 100644 elpa/multiple-cursors-20220328.1724/rectangular-region-mode.elc create mode 100644 elpa/org-9.5.2.signed create mode 100644 elpa/org-9.5.2/.dir-locals.el create mode 100644 elpa/org-9.5.2/CONTRIBUTE create mode 100644 elpa/org-9.5.2/COPYING create mode 100644 elpa/org-9.5.2/Makefile create mode 100644 elpa/org-9.5.2/README create mode 100644 elpa/org-9.5.2/README_ELPA create mode 100644 elpa/org-9.5.2/dir create mode 100644 elpa/org-9.5.2/doc/.aspell.org.conf create mode 100644 elpa/org-9.5.2/doc/.nosearch create mode 100644 elpa/org-9.5.2/doc/Documentation_Standards.org create mode 100644 elpa/org-9.5.2/doc/Makefile create mode 100644 elpa/org-9.5.2/doc/dir create mode 100644 elpa/org-9.5.2/doc/doc-setup.org create mode 100644 elpa/org-9.5.2/doc/fdl.org create mode 100644 elpa/org-9.5.2/doc/htmlxref.cnf create mode 100644 elpa/org-9.5.2/doc/org-guide.org create mode 100644 elpa/org-9.5.2/doc/org-manual.org create mode 100644 elpa/org-9.5.2/doc/org-version.inc create mode 100644 elpa/org-9.5.2/doc/org.texi create mode 100644 elpa/org-9.5.2/doc/orgcard.tex create mode 100644 elpa/org-9.5.2/doc/orgguide.texi create mode 100644 elpa/org-9.5.2/doc/pdflayout.sty create mode 100644 elpa/org-9.5.2/doc/texinfo.tex create mode 100644 elpa/org-9.5.2/etc/Makefile create mode 100644 elpa/org-9.5.2/etc/ORG-NEWS create mode 100644 elpa/org-9.5.2/etc/csl/README create mode 100644 elpa/org-9.5.2/etc/csl/chicago-author-date.csl create mode 100644 elpa/org-9.5.2/etc/csl/locales-en-US.xml create mode 100644 elpa/org-9.5.2/etc/styles/OrgOdtContentTemplate.xml create mode 100644 elpa/org-9.5.2/etc/styles/OrgOdtStyles.xml create mode 100644 elpa/org-9.5.2/etc/styles/README create mode 100644 elpa/org-9.5.2/local.mk create mode 100644 elpa/org-9.5.2/ob-C.el create mode 100644 elpa/org-9.5.2/ob-C.elc create mode 100644 elpa/org-9.5.2/ob-R.el create mode 100644 elpa/org-9.5.2/ob-R.elc create mode 100644 elpa/org-9.5.2/ob-awk.el create mode 100644 elpa/org-9.5.2/ob-awk.elc create mode 100644 elpa/org-9.5.2/ob-calc.el create mode 100644 elpa/org-9.5.2/ob-calc.elc create mode 100644 elpa/org-9.5.2/ob-clojure.el create mode 100644 elpa/org-9.5.2/ob-clojure.elc create mode 100644 elpa/org-9.5.2/ob-comint.el create mode 100644 elpa/org-9.5.2/ob-comint.elc create mode 100644 elpa/org-9.5.2/ob-core.el create mode 100644 elpa/org-9.5.2/ob-core.elc create mode 100644 elpa/org-9.5.2/ob-css.el create mode 100644 elpa/org-9.5.2/ob-css.elc create mode 100644 elpa/org-9.5.2/ob-ditaa.el create mode 100644 elpa/org-9.5.2/ob-ditaa.elc create mode 100644 elpa/org-9.5.2/ob-dot.el create mode 100644 elpa/org-9.5.2/ob-dot.elc create mode 100644 elpa/org-9.5.2/ob-emacs-lisp.el create mode 100644 elpa/org-9.5.2/ob-emacs-lisp.elc create mode 100644 elpa/org-9.5.2/ob-eshell.el create mode 100644 elpa/org-9.5.2/ob-eshell.elc create mode 100644 elpa/org-9.5.2/ob-eval.el create mode 100644 elpa/org-9.5.2/ob-eval.elc create mode 100644 elpa/org-9.5.2/ob-exp.el create mode 100644 elpa/org-9.5.2/ob-exp.elc create mode 100644 elpa/org-9.5.2/ob-forth.el create mode 100644 elpa/org-9.5.2/ob-forth.elc create mode 100644 elpa/org-9.5.2/ob-fortran.el create mode 100644 elpa/org-9.5.2/ob-fortran.elc create mode 100644 elpa/org-9.5.2/ob-gnuplot.el create mode 100644 elpa/org-9.5.2/ob-gnuplot.elc create mode 100644 elpa/org-9.5.2/ob-groovy.el create mode 100644 elpa/org-9.5.2/ob-groovy.elc create mode 100644 elpa/org-9.5.2/ob-haskell.el create mode 100644 elpa/org-9.5.2/ob-haskell.elc create mode 100644 elpa/org-9.5.2/ob-java.el create mode 100644 elpa/org-9.5.2/ob-java.elc create mode 100644 elpa/org-9.5.2/ob-js.el create mode 100644 elpa/org-9.5.2/ob-js.elc create mode 100644 elpa/org-9.5.2/ob-julia.el create mode 100644 elpa/org-9.5.2/ob-julia.elc create mode 100644 elpa/org-9.5.2/ob-latex.el create mode 100644 elpa/org-9.5.2/ob-latex.elc create mode 100644 elpa/org-9.5.2/ob-lilypond.el create mode 100644 elpa/org-9.5.2/ob-lilypond.elc create mode 100644 elpa/org-9.5.2/ob-lisp.el create mode 100644 elpa/org-9.5.2/ob-lisp.elc create mode 100644 elpa/org-9.5.2/ob-lob.el create mode 100644 elpa/org-9.5.2/ob-lob.elc create mode 100644 elpa/org-9.5.2/ob-lua.el create mode 100644 elpa/org-9.5.2/ob-lua.elc create mode 100644 elpa/org-9.5.2/ob-makefile.el create mode 100644 elpa/org-9.5.2/ob-makefile.elc create mode 100644 elpa/org-9.5.2/ob-matlab.el create mode 100644 elpa/org-9.5.2/ob-matlab.elc create mode 100644 elpa/org-9.5.2/ob-maxima.el create mode 100644 elpa/org-9.5.2/ob-maxima.elc create mode 100644 elpa/org-9.5.2/ob-ocaml.el create mode 100644 elpa/org-9.5.2/ob-ocaml.elc create mode 100644 elpa/org-9.5.2/ob-octave.el create mode 100644 elpa/org-9.5.2/ob-octave.elc create mode 100644 elpa/org-9.5.2/ob-org.el create mode 100644 elpa/org-9.5.2/ob-org.elc create mode 100644 elpa/org-9.5.2/ob-perl.el create mode 100644 elpa/org-9.5.2/ob-perl.elc create mode 100644 elpa/org-9.5.2/ob-plantuml.el create mode 100644 elpa/org-9.5.2/ob-plantuml.elc create mode 100644 elpa/org-9.5.2/ob-processing.el create mode 100644 elpa/org-9.5.2/ob-processing.elc create mode 100644 elpa/org-9.5.2/ob-python.el create mode 100644 elpa/org-9.5.2/ob-python.elc create mode 100644 elpa/org-9.5.2/ob-ref.el create mode 100644 elpa/org-9.5.2/ob-ref.elc create mode 100644 elpa/org-9.5.2/ob-ruby.el create mode 100644 elpa/org-9.5.2/ob-ruby.elc create mode 100644 elpa/org-9.5.2/ob-sass.el create mode 100644 elpa/org-9.5.2/ob-sass.elc create mode 100644 elpa/org-9.5.2/ob-scheme.el create mode 100644 elpa/org-9.5.2/ob-scheme.elc create mode 100644 elpa/org-9.5.2/ob-screen.el create mode 100644 elpa/org-9.5.2/ob-screen.elc create mode 100644 elpa/org-9.5.2/ob-sed.el create mode 100644 elpa/org-9.5.2/ob-sed.elc create mode 100644 elpa/org-9.5.2/ob-shell.el create mode 100644 elpa/org-9.5.2/ob-shell.elc create mode 100644 elpa/org-9.5.2/ob-sql.el create mode 100644 elpa/org-9.5.2/ob-sql.elc create mode 100644 elpa/org-9.5.2/ob-sqlite.el create mode 100644 elpa/org-9.5.2/ob-sqlite.elc create mode 100644 elpa/org-9.5.2/ob-table.el create mode 100644 elpa/org-9.5.2/ob-table.elc create mode 100644 elpa/org-9.5.2/ob-tangle.el create mode 100644 elpa/org-9.5.2/ob-tangle.elc create mode 100644 elpa/org-9.5.2/ob.el create mode 100644 elpa/org-9.5.2/ob.elc create mode 100644 elpa/org-9.5.2/oc-basic.el create mode 100644 elpa/org-9.5.2/oc-basic.elc create mode 100644 elpa/org-9.5.2/oc-biblatex.el create mode 100644 elpa/org-9.5.2/oc-biblatex.elc create mode 100644 elpa/org-9.5.2/oc-csl.el create mode 100644 elpa/org-9.5.2/oc-csl.elc create mode 100644 elpa/org-9.5.2/oc-natbib.el create mode 100644 elpa/org-9.5.2/oc-natbib.elc create mode 100644 elpa/org-9.5.2/oc.el create mode 100644 elpa/org-9.5.2/oc.elc create mode 100644 elpa/org-9.5.2/ol-bbdb.el create mode 100644 elpa/org-9.5.2/ol-bbdb.elc create mode 100644 elpa/org-9.5.2/ol-bibtex.el create mode 100644 elpa/org-9.5.2/ol-bibtex.elc create mode 100644 elpa/org-9.5.2/ol-docview.el create mode 100644 elpa/org-9.5.2/ol-docview.elc create mode 100644 elpa/org-9.5.2/ol-doi.el create mode 100644 elpa/org-9.5.2/ol-doi.elc create mode 100644 elpa/org-9.5.2/ol-eshell.el create mode 100644 elpa/org-9.5.2/ol-eshell.elc create mode 100644 elpa/org-9.5.2/ol-eww.el create mode 100644 elpa/org-9.5.2/ol-eww.elc create mode 100644 elpa/org-9.5.2/ol-gnus.el create mode 100644 elpa/org-9.5.2/ol-gnus.elc create mode 100644 elpa/org-9.5.2/ol-info.el create mode 100644 elpa/org-9.5.2/ol-info.elc create mode 100644 elpa/org-9.5.2/ol-irc.el create mode 100644 elpa/org-9.5.2/ol-irc.elc create mode 100644 elpa/org-9.5.2/ol-man.el create mode 100644 elpa/org-9.5.2/ol-man.elc create mode 100644 elpa/org-9.5.2/ol-mhe.el create mode 100644 elpa/org-9.5.2/ol-mhe.elc create mode 100644 elpa/org-9.5.2/ol-rmail.el create mode 100644 elpa/org-9.5.2/ol-rmail.elc create mode 100644 elpa/org-9.5.2/ol-w3m.el create mode 100644 elpa/org-9.5.2/ol-w3m.elc create mode 100644 elpa/org-9.5.2/ol.el create mode 100644 elpa/org-9.5.2/ol.elc create mode 100644 elpa/org-9.5.2/org-agenda.el create mode 100644 elpa/org-9.5.2/org-agenda.elc create mode 100644 elpa/org-9.5.2/org-archive.el create mode 100644 elpa/org-9.5.2/org-archive.elc create mode 100644 elpa/org-9.5.2/org-attach-git.el create mode 100644 elpa/org-9.5.2/org-attach-git.elc create mode 100644 elpa/org-9.5.2/org-attach.el create mode 100644 elpa/org-9.5.2/org-attach.elc create mode 100644 elpa/org-9.5.2/org-autoloads.el create mode 100644 elpa/org-9.5.2/org-capture.el create mode 100644 elpa/org-9.5.2/org-capture.elc create mode 100644 elpa/org-9.5.2/org-clock.el create mode 100644 elpa/org-9.5.2/org-clock.elc create mode 100644 elpa/org-9.5.2/org-colview.el create mode 100644 elpa/org-9.5.2/org-colview.elc create mode 100644 elpa/org-9.5.2/org-compat.el create mode 100644 elpa/org-9.5.2/org-compat.elc create mode 100644 elpa/org-9.5.2/org-crypt.el create mode 100644 elpa/org-9.5.2/org-crypt.elc create mode 100644 elpa/org-9.5.2/org-ctags.el create mode 100644 elpa/org-9.5.2/org-ctags.elc create mode 100644 elpa/org-9.5.2/org-datetree.el create mode 100644 elpa/org-9.5.2/org-datetree.elc create mode 100644 elpa/org-9.5.2/org-duration.el create mode 100644 elpa/org-9.5.2/org-duration.elc create mode 100644 elpa/org-9.5.2/org-element.el create mode 100644 elpa/org-9.5.2/org-element.elc create mode 100644 elpa/org-9.5.2/org-entities.el create mode 100644 elpa/org-9.5.2/org-entities.elc create mode 100644 elpa/org-9.5.2/org-faces.el create mode 100644 elpa/org-9.5.2/org-faces.elc create mode 100644 elpa/org-9.5.2/org-feed.el create mode 100644 elpa/org-9.5.2/org-feed.elc create mode 100644 elpa/org-9.5.2/org-footnote.el create mode 100644 elpa/org-9.5.2/org-footnote.elc create mode 100644 elpa/org-9.5.2/org-goto.el create mode 100644 elpa/org-9.5.2/org-goto.elc create mode 100644 elpa/org-9.5.2/org-habit.el create mode 100644 elpa/org-9.5.2/org-habit.elc create mode 100644 elpa/org-9.5.2/org-id.el create mode 100644 elpa/org-9.5.2/org-id.elc create mode 100644 elpa/org-9.5.2/org-indent.el create mode 100644 elpa/org-9.5.2/org-indent.elc create mode 100644 elpa/org-9.5.2/org-inlinetask.el create mode 100644 elpa/org-9.5.2/org-inlinetask.elc create mode 100644 elpa/org-9.5.2/org-keys.el create mode 100644 elpa/org-9.5.2/org-keys.elc create mode 100644 elpa/org-9.5.2/org-lint.el create mode 100644 elpa/org-9.5.2/org-lint.elc create mode 100644 elpa/org-9.5.2/org-list.el create mode 100644 elpa/org-9.5.2/org-list.elc create mode 100644 elpa/org-9.5.2/org-loaddefs.el create mode 100644 elpa/org-9.5.2/org-macro.el create mode 100644 elpa/org-9.5.2/org-macro.elc create mode 100644 elpa/org-9.5.2/org-macs.el create mode 100644 elpa/org-9.5.2/org-macs.elc create mode 100644 elpa/org-9.5.2/org-mobile.el create mode 100644 elpa/org-9.5.2/org-mobile.elc create mode 100644 elpa/org-9.5.2/org-mouse.el create mode 100644 elpa/org-9.5.2/org-mouse.elc create mode 100644 elpa/org-9.5.2/org-num.el create mode 100644 elpa/org-9.5.2/org-num.elc create mode 100644 elpa/org-9.5.2/org-pcomplete.el create mode 100644 elpa/org-9.5.2/org-pcomplete.elc create mode 100644 elpa/org-9.5.2/org-pkg.el create mode 100644 elpa/org-9.5.2/org-plot.el create mode 100644 elpa/org-9.5.2/org-plot.elc create mode 100644 elpa/org-9.5.2/org-protocol.el create mode 100644 elpa/org-9.5.2/org-protocol.elc create mode 100644 elpa/org-9.5.2/org-refile.el create mode 100644 elpa/org-9.5.2/org-refile.elc create mode 100644 elpa/org-9.5.2/org-src.el create mode 100644 elpa/org-9.5.2/org-src.elc create mode 100644 elpa/org-9.5.2/org-table.el create mode 100644 elpa/org-9.5.2/org-table.elc create mode 100644 elpa/org-9.5.2/org-tempo.el create mode 100644 elpa/org-9.5.2/org-tempo.elc create mode 100644 elpa/org-9.5.2/org-timer.el create mode 100644 elpa/org-9.5.2/org-timer.elc create mode 100644 elpa/org-9.5.2/org-version.el create mode 100644 elpa/org-9.5.2/org.el create mode 100644 elpa/org-9.5.2/org.elc create mode 100644 elpa/org-9.5.2/org.info create mode 100644 elpa/org-9.5.2/orgguide.info create mode 100644 elpa/org-9.5.2/ox-ascii.el create mode 100644 elpa/org-9.5.2/ox-ascii.elc create mode 100644 elpa/org-9.5.2/ox-beamer.el create mode 100644 elpa/org-9.5.2/ox-beamer.elc create mode 100644 elpa/org-9.5.2/ox-html.el create mode 100644 elpa/org-9.5.2/ox-html.elc create mode 100644 elpa/org-9.5.2/ox-icalendar.el create mode 100644 elpa/org-9.5.2/ox-icalendar.elc create mode 100644 elpa/org-9.5.2/ox-koma-letter.el create mode 100644 elpa/org-9.5.2/ox-koma-letter.elc create mode 100644 elpa/org-9.5.2/ox-latex.el create mode 100644 elpa/org-9.5.2/ox-latex.elc create mode 100644 elpa/org-9.5.2/ox-man.el create mode 100644 elpa/org-9.5.2/ox-man.elc create mode 100644 elpa/org-9.5.2/ox-md.el create mode 100644 elpa/org-9.5.2/ox-md.elc create mode 100644 elpa/org-9.5.2/ox-odt.el create mode 100644 elpa/org-9.5.2/ox-odt.elc create mode 100644 elpa/org-9.5.2/ox-org.el create mode 100644 elpa/org-9.5.2/ox-org.elc create mode 100644 elpa/org-9.5.2/ox-publish.el create mode 100644 elpa/org-9.5.2/ox-publish.elc create mode 100644 elpa/org-9.5.2/ox-texinfo.el create mode 100644 elpa/org-9.5.2/ox-texinfo.elc create mode 100644 elpa/org-9.5.2/ox.el create mode 100644 elpa/org-9.5.2/ox.elc create mode 100644 elpa/org-9.5.2/request-assign-future.txt create mode 100644 elpa/pkg-info-20150517.1143/pkg-info-autoloads.el create mode 100644 elpa/pkg-info-20150517.1143/pkg-info-pkg.el create mode 100644 elpa/pkg-info-20150517.1143/pkg-info.el create mode 100644 elpa/pkg-info-20150517.1143/pkg-info.elc create mode 100644 elpa/projectile-20220313.1334/projectile-autoloads.el create mode 100644 elpa/projectile-20220313.1334/projectile-pkg.el create mode 100644 elpa/projectile-20220313.1334/projectile.el create mode 100644 elpa/projectile-20220313.1334/projectile.elc create mode 100644 elpa/req-package-20180605.1141/req-package-args.el create mode 100644 elpa/req-package-20180605.1141/req-package-args.elc create mode 100644 elpa/req-package-20180605.1141/req-package-autoloads.el create mode 100644 elpa/req-package-20180605.1141/req-package-cycles.el create mode 100644 elpa/req-package-20180605.1141/req-package-cycles.elc create mode 100644 elpa/req-package-20180605.1141/req-package-hooks.el create mode 100644 elpa/req-package-20180605.1141/req-package-hooks.elc create mode 100644 elpa/req-package-20180605.1141/req-package-pkg.el create mode 100644 elpa/req-package-20180605.1141/req-package.el create mode 100644 elpa/req-package-20180605.1141/req-package.elc create mode 100644 elpa/s-20210616.619/s-autoloads.el create mode 100644 elpa/s-20210616.619/s-pkg.el create mode 100644 elpa/s-20210616.619/s.el create mode 100644 elpa/s-20210616.619/s.elc create mode 100644 elpa/simple-httpd-20191103.1446/simple-httpd-autoloads.el create mode 100644 elpa/simple-httpd-20191103.1446/simple-httpd-pkg.el create mode 100644 elpa/simple-httpd-20191103.1446/simple-httpd.el create mode 100644 elpa/simple-httpd-20191103.1446/simple-httpd.elc create mode 100644 elpa/skewer-mode-20200304.1142/cache-table.el create mode 100644 elpa/skewer-mode-20200304.1142/cache-table.elc create mode 100644 elpa/skewer-mode-20200304.1142/example.html create mode 100644 elpa/skewer-mode-20200304.1142/skewer-bower.el create mode 100644 elpa/skewer-mode-20200304.1142/skewer-bower.elc create mode 100644 elpa/skewer-mode-20200304.1142/skewer-css.el create mode 100644 elpa/skewer-mode-20200304.1142/skewer-css.elc create mode 100644 elpa/skewer-mode-20200304.1142/skewer-everything.user.js create mode 100644 elpa/skewer-mode-20200304.1142/skewer-html.el create mode 100644 elpa/skewer-mode-20200304.1142/skewer-html.elc create mode 100644 elpa/skewer-mode-20200304.1142/skewer-mode-autoloads.el create mode 100644 elpa/skewer-mode-20200304.1142/skewer-mode-pkg.el create mode 100644 elpa/skewer-mode-20200304.1142/skewer-mode.el create mode 100644 elpa/skewer-mode-20200304.1142/skewer-mode.elc create mode 100644 elpa/skewer-mode-20200304.1142/skewer-repl.el create mode 100644 elpa/skewer-mode-20200304.1142/skewer-repl.elc create mode 100644 elpa/skewer-mode-20200304.1142/skewer-setup.el create mode 100644 elpa/skewer-mode-20200304.1142/skewer-setup.elc create mode 100644 elpa/skewer-mode-20200304.1142/skewer.js create mode 100644 elpa/use-package-20210207.1926/dir create mode 100644 elpa/use-package-20210207.1926/use-package-autoloads.el create mode 100644 elpa/use-package-20210207.1926/use-package-bind-key.el create mode 100644 elpa/use-package-20210207.1926/use-package-bind-key.elc create mode 100644 elpa/use-package-20210207.1926/use-package-core.el create mode 100644 elpa/use-package-20210207.1926/use-package-core.elc create mode 100644 elpa/use-package-20210207.1926/use-package-delight.el create mode 100644 elpa/use-package-20210207.1926/use-package-delight.elc create mode 100644 elpa/use-package-20210207.1926/use-package-diminish.el create mode 100644 elpa/use-package-20210207.1926/use-package-diminish.elc create mode 100644 elpa/use-package-20210207.1926/use-package-ensure.el create mode 100644 elpa/use-package-20210207.1926/use-package-ensure.elc create mode 100644 elpa/use-package-20210207.1926/use-package-jump.el create mode 100644 elpa/use-package-20210207.1926/use-package-jump.elc create mode 100644 elpa/use-package-20210207.1926/use-package-lint.el create mode 100644 elpa/use-package-20210207.1926/use-package-lint.elc create mode 100644 elpa/use-package-20210207.1926/use-package-pkg.el create mode 100644 elpa/use-package-20210207.1926/use-package.el create mode 100644 elpa/use-package-20210207.1926/use-package.elc create mode 100644 elpa/use-package-20210207.1926/use-package.info create mode 100644 elpa/yasnippet-20200604.246/yasnippet-autoloads.el create mode 100644 elpa/yasnippet-20200604.246/yasnippet-pkg.el create mode 100644 elpa/yasnippet-20200604.246/yasnippet.el create mode 100644 elpa/yasnippet-20200604.246/yasnippet.elc (limited to 'elpa') diff --git a/elpa/ac-js2-20190101.933/ac-js2-autoloads.el b/elpa/ac-js2-20190101.933/ac-js2-autoloads.el new file mode 100644 index 0000000..f6b19e7 --- /dev/null +++ b/elpa/ac-js2-20190101.933/ac-js2-autoloads.el @@ -0,0 +1,70 @@ +;;; ac-js2-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "ac-js2" "ac-js2.el" (0 0 0 0)) +;;; Generated autoloads from ac-js2.el + +(autoload 'ac-js2-expand-function "ac-js2" "\ +Expand the function definition left of point. +Expansion will only occur for candidates whose documentation +string contain a function prototype." t nil) + +(autoload 'ac-js2-completion-function "ac-js2" "\ +Function for `completions-at-point'." nil nil) + +(autoload 'ac-js2-company "ac-js2" "\ + + +\(fn COMMAND &optional ARG &rest IGNORED)" t nil) + +(autoload 'ac-js2-jump-to-definition "ac-js2" "\ +Jump to the definition of an object's property, variable or function. +Navigation to a property definend in an Object literal isn't +implemented." t nil) + +(autoload 'ac-js2-mode "ac-js2" "\ +A minor mode that provides auto-completion and navigation for Js2-mode. + +This is a minor mode. If called interactively, toggle the +`Ac-Js2 mode' mode. If the prefix argument is positive, enable +the mode, and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `ac-js2-mode'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. + +\(fn &optional ARG)" t nil) + +(register-definition-prefixes "ac-js2" '("ac-js2-")) + +;;;*** + +;;;### (autoloads nil "ac-js2-tests" "ac-js2-tests.el" (0 0 0 0)) +;;; Generated autoloads from ac-js2-tests.el + +(register-definition-prefixes "ac-js2-tests" '("completion-frontend-test")) + +;;;*** + +;;;### (autoloads nil nil ("ac-js2-pkg.el") (0 0 0 0)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; ac-js2-autoloads.el ends here diff --git a/elpa/ac-js2-20190101.933/ac-js2-pkg.el b/elpa/ac-js2-20190101.933/ac-js2-pkg.el new file mode 100644 index 0000000..9b42769 --- /dev/null +++ b/elpa/ac-js2-20190101.933/ac-js2-pkg.el @@ -0,0 +1,11 @@ +(define-package "ac-js2" "20190101.933" "Auto-complete source for Js2-mode, with navigation" + '((js2-mode "20090723") + (skewer-mode "1.4")) + :commit "2b56d09a16c1a0ce514cc1b85d64cb1be4502723" :authors + '(("Scott Barnett" . "scott.n.barnett@gmail.com")) + :maintainer + '("Scott Barnett" . "scott.n.barnett@gmail.com") + :url "https://github.com/ScottyB/ac-js2") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/ac-js2-20190101.933/ac-js2-tests.el b/elpa/ac-js2-20190101.933/ac-js2-tests.el new file mode 100644 index 0000000..05514e3 --- /dev/null +++ b/elpa/ac-js2-20190101.933/ac-js2-tests.el @@ -0,0 +1,76 @@ +;;; Tests for ac-js2 + +(require 'ert) +(require 'skewer-mode) +(require 'js2-mode) +(require 'ac-js2) + +;;; Must have a skewer client connected before running the tests +;; Need to call httpd-stop from main Emacs if running tests in batch mode +(unless skewer-clients + (run-skewer)) + +(ert-deftest ac-js2-candidates-test () + "Test the major function that returns candidates for all frontends." + (let (property + property-dot + func-call + var) + (with-temp-buffer + (insert " + var temp = function(param1, param2) { + var localParam = 15; + return param1 + param2; + }; + + var look; + +temp.aFun = function(lolParam) {}; +temp.anotherFunction = function() { return {about: 3};}") + (setq ac-js2-evaluate-calls t) + (setq ac-js2-external-libraries nil) + + (js2-mode) + (ac-js2-mode t) + (js2-parse) + + (insert "tem") + (ac-js2-candidates) + (setq var ac-js2-skewer-candidates) + (delete-char -3) + + (insert "temp.") + (js2-parse) + (ac-js2-candidates) + (setq property-dot ac-js2-skewer-candidates) + (delete-char -5) + + (insert "temp.aF") + (js2-parse) + (ac-js2-candidates) + (setq property ac-js2-skewer-candidates)) + + (should (assoc 'anotherFunction property-dot)) + (print property) + (should (assoc 'aFun property)) + (should (assoc 'temp var)))) + +(defmacro completion-frontend-test (test-name completion-function) + "Utility for testing completion front ends. +TODO: cover more cases" + `(ert-deftest ,test-name () + (let (var) + (with-temp-buffer + (insert "var testComplete = function(param1, param2) {};") + + (js2-mode) + (ac-js2-mode t) + (js2-parse) + + (insert "testComplet") + (funcall ',completion-function) + (setq var (thing-at-point 'word))) + (should (string= var "testComplete"))))) + +(completion-frontend-test auto-complete-test auto-complete) +(completion-frontend-test completion-at-point-test completion-at-point) diff --git a/elpa/ac-js2-20190101.933/ac-js2-tests.elc b/elpa/ac-js2-20190101.933/ac-js2-tests.elc new file mode 100644 index 0000000..030ca04 Binary files /dev/null and b/elpa/ac-js2-20190101.933/ac-js2-tests.elc differ diff --git a/elpa/ac-js2-20190101.933/ac-js2.el b/elpa/ac-js2-20190101.933/ac-js2.el new file mode 100644 index 0000000..1951388 --- /dev/null +++ b/elpa/ac-js2-20190101.933/ac-js2.el @@ -0,0 +1,608 @@ +;;; ac-js2.el --- Auto-complete source for Js2-mode, with navigation + +;; Copyright (C) 2013 Scott Barnett + +;; Author: Scott Barnett +;; URL: https://github.com/ScottyB/ac-js2 +;; Version: 1.0 +;; Package-Requires: ((js2-mode "20090723")(skewer-mode "1.4")) + +;; 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 . + +;;; Commentary: + +;; An attempt to get context sensitive Javascript completion in Emacs. +;; Basic completions are obtained by parsing Javascript code with +;; Js2-mode's parser. +;; +;; Installation +;; +;; Easiest way to get ac-js2 is to install it from MELPA. You may need +;; this snippet +;; +;; `(add-to-list 'package-archives +;; '("melpa" . "http://melpa.milkbox.net/packages/") t)' +;; +;; if you don't have it already to fetch packages from MELPA. +;; +;; Enable ac-js2 in js2-mode as follows: +;; +;; (add-hook 'js2-mode-hook 'ac-js2-mode) +;; +;; Ac-js2 does not require auto-complete mode but I suggest you grab +;; it anyway as ac-js2 is designed to work with a completion frontend. +;; Support for Company mode is on its way. +;; +;; For more comprehensive completions you can opt to evaluate the code +;; for candidates. A browser needs to be connected to Emacs for the +;; evaluation completions to work. Put this in your init.el file. +;; +;; `(setq ac-js2-evaluate-calls t)' +;; +;; To add completions for external libraries add something like this: +;; +;; (add-to-list 'ac-js2-external-libraries "path/to/lib/library.js") +;; +;; Then connect a browser to Emacs by calling `(run-skewer)'. You may +;; need to save the buffer for completions to start. +;; +;; If auto-complete mode is installed on your system then completions +;; should start showing up otherwise use `completion-at-point'. +;; +;; Note: library completions will only work if `ac-js2-evaluate-calls' +;; is set and a browser is connected to Emacs. +;; +;; Bonus: M-. is bound to `ac-js2-jump-to-definition' which will jump +;; to Javascript definitions found in the same buffer. Given the +;; following proprety reference: +;; +;; foo.bar.baz(); +;; +;; placing the cursor on `foo', `bar' or `baz' and executing M-. will +;; take you straight to their respective definitions. Use M-, to jump +;; back to where you were. Also works for object literals. +;; +;; Recently added `ac-js2-expand-function' that will expand a function's +;; parameters bound to `C-c C-c`. Expansion will only work if the cursor +;; is after the function. +;; +;; If you have any issues or suggestions please create an issue on Github: +;; https://github.com/ScottyB/ac-js2 + +;;; History: + +;; Version 1.0 +;; * Navigation within current buffer +;; * Completion and docstring for objects via Skewer +;; * External library support +;; * Basic completions of objects in current buffer + +;;; Code: + +(require 'js2-mode) +(require 'skewer-mode) +(require 'cl-lib) +(require 'etags) + +(defgroup ac-js2 nil + "Auto-completion for js2-mode." + :group 'completion + :prefix "ac-js2-") + +;;; Configuration variables + +(defcustom ac-js2-add-ecma-262-externs t + "If non-nil add `js2-ecma-262-externs' to completion candidates.") + +(defcustom ac-js2-add-browser-externs t + "If non-nil add `js2-browser-externs' to completion candidates.") + +(defcustom ac-js2-add-keywords t + "If non-nil add `js2-keywords' to completion candidates.") + +(defcustom ac-js2-add-prototype-completions t + "When non-nil traverse the prototype chain adding to completion candidates.") + +(defcustom ac-js2-external-libraries '() + "List of absolute paths to external Javascript libraries.") + +(defcustom ac-js2-evaluate-calls nil + "Warning. When true function calls will be evaluated in the browser. +This may cause undesired side effects however it will + provide better completions. Use at your own risk.") + +(defcustom ac-js2-force-reparse t + "Force Js2-mode to reparse buffer before fetching completion candidates.") + +;;; Internal variables + +(defvar ac-js2-keywords '() + "Cached string version of `js2-keywords'.") + +(defvar ac-js2-candidates '()) + +;; Types of skewer completion methods available +(defconst ac-js2-method-eval 0) +(defconst ac-js2-method-global 1 + "Return candidates for the global object. +Only keys of the object are returned as the other properties come + from js2-mode's externs.") + +(defvar ac-js2-data-root (file-name-directory load-file-name) + "Location of data files needed for `ac-js2-on-skewer-load'.") + +;;; Skewer integration + +(defvar ac-js2-skewer-candidates '() + "Cadidates obtained from skewering.") + +(defun ac-js2-on-skewer-load () + "Inject skewer addon and evaluate external libraries in browser." + (insert-file-contents (expand-file-name "skewer-addon.js" ac-js2-data-root)) + (and ac-js2-evaluate-calls + (mapcar (lambda (library) + (with-temp-buffer + (insert-file-contents (expand-file-name library)) + (skewer-eval (buffer-string) + nil + :type "complete"))) ac-js2-external-libraries))) + +(defun ac-js2-skewer-completion-candidates () + "Get completions returned from skewer." + (mapcar (lambda (candidate) (symbol-name (car candidate))) ac-js2-skewer-candidates)) + +(defun ac-js2-skewer-document-candidates (name) + "Return document string for NAME from skewer." + (let ((doc (cdr (assoc-string name ac-js2-skewer-candidates)))) + (or (ac-js2-format-function doc) doc))) + +(defun ac-js2-get-object-properties (name) + "Find properties of NAME for completion." + (ac-js2-skewer-eval-wrapper name `((prototypes . ,ac-js2-add-prototype-completions)))) + +(defun ac-js2-skewer-result-callback (result) + "Process the RESULT passed from the browser." + (let ((value (cdr (assoc 'value result)))) + (if (and (skewer-success-p result) value) + (setq ac-js2-skewer-candidates (append value nil))))) + +(defun ac-js2-skewer-eval-wrapper (str &optional extras) + "Wrap `skewer-eval-synchronously' to check if a skewer-client is avilable. +STR is the text to send to the browser for evaluation. Extra +parameters can be passed to the browser using EXTRAS. EXTRAS must +be of the form (param-string . value) where param-string is the +reference and value is the value that can be retrieved from the +request object in Javacript." + (setq ac-js2-skewer-candidates nil) + (if skewer-clients + (if (or ac-js2-evaluate-calls + (not (ac-js2-has-function-calls str))) + (ac-js2-skewer-result-callback + (skewer-eval-synchronously str + :type "complete" + :extra extras))) + (setq skewer-queue nil))) + +;; Generate candidates +(defun ac-js2-candidates () + "Main function called to gather candidates for auto-completion." + (if ac-js2-force-reparse (js2-reparse)) + (let ((node (js2-node-parent (js2-node-at-point (1- (point))))) + beg + (prop-get-regex "[a-zA-Z)]\\.") + name) + (setq ac-js2-candidates nil) + (cond + ((looking-back "\\.") + ;; TODO: Need to come up with a better way to extract object than this regex!! + (save-excursion + (setq beg (and (skip-chars-backward "[a-zA-Z_$][0-9a-zA-Z_$#\"())]+\\.") (point)))) + (setq name (buffer-substring-no-properties beg (1- (point)))) + (ac-js2-get-object-properties name) + (setq node (ac-js2-initialized-node (if (string-match prop-get-regex name) + (reverse (split-string name prop-get-regex)) name))) + (if (js2-object-node-p node) + (setq ac-js2-candidates + (mapcar (lambda (elem) + (ac-js2-format-node (js2-node-string (js2-object-prop-node-left elem)) + elem)) + (js2-object-node-elems node)))) + (append (mapcar 'cl-first ac-js2-candidates) + (ac-js2-skewer-completion-candidates))) + ((js2-prop-get-node-p node) + (setq node (js2-prop-get-node-left node)) + (setq name (js2-node-string node)) + (ac-js2-get-object-properties name) + (ac-js2-skewer-completion-candidates)) + (t + (ac-js2-skewer-eval-wrapper "" `((method . ,ac-js2-method-global))) + (append (ac-js2-skewer-completion-candidates) + (ac-js2-add-extra-completions + (mapcar 'cl-first (ac-js2-get-names-in-scope)))))))) + +(defun ac-js2-document (name) + "Show documentation for NAME from local buffer if present +otherwise use documentation obtained from skewer." + (let* ((docs (cdr (assoc name ac-js2-candidates))) + (doc (if (listp docs) (cl-first docs) docs))) + (if doc doc (ac-js2-skewer-document-candidates name)))) + +;; Auto-complete settings + +(defun ac-js2-ac-candidates () + "Completion candidates for auto-complete mode." + (ac-js2-candidates)) + +(defun ac-js2-ac-document (name) + "Documentation to be shown for auto-complete mode." + (ac-js2-document name)) + +(defun ac-js2-ac-prefix() + (or (ac-prefix-default) (ac-prefix-c-dot))) + +(defun ac-js2-save () + "Called on `before-save-hook' to evaluate buffer." + (interactive) + (when (string= major-mode "js2-mode") + (ac-js2-skewer-eval-wrapper (buffer-string))) + t) + +;;;###autoload +(defun ac-js2-expand-function() + "Expand the function definition left of point. +Expansion will only occur for candidates whose documentation +string contain a function prototype." + (interactive) + (let* ((word (progn + (if (featurep 'auto-complete) (ac-complete)) + (substring-no-properties (or (thing-at-point 'word) "")))) + (candidate (ac-js2-ac-document word))) + (if (and (looking-back word) (stringp candidate)) + (when (string-match "^function" candidate) + (cond ((featurep 'yasnippet) + (yas-expand-snippet + (concat "(" + (replace-regexp-in-string "\\([a-zA-Z0-9]+\\)" + (lambda (txt) (concat "${" txt "}")) + (cl-second (split-string candidate "[()]"))) + ")$0")))))))) + +(defun ac-js2-setup-auto-complete-mode () + "Setup ac-js2 to be used with auto-complete-mode." + (add-to-list 'ac-sources 'ac-source-js2) + (auto-complete-mode) + (ac-define-source "js2" + '((candidates . ac-js2-ac-candidates) + (document . ac-js2-ac-document) + (prefix . ac-js2-ac-prefix) + (requires . -1)))) + +;;; Completion at point function + +;;;###autoload +(defun ac-js2-completion-function () + "Function for `completions-at-point'." + (save-excursion + (let ((bounds (if (looking-back "\\.") + (cons (point) (point)) + (bounds-of-thing-at-point 'word)))) + (list (car bounds) (cdr bounds) (ac-js2-candidates))))) + +;;; Company + +;;;###autoload +(defun ac-js2-company (command &optional arg &rest ignored) + (interactive (list 'interactive)) + (if (not (featurep 'company)) + (message "Company is not installed") + (cl-case command + (interactive (company-begin-backend 'ac-js2-company)) + (prefix (when ac-js2-mode + (or (company-grab-symbol) + 'stop))) + (candidates (all-completions arg (ac-js2-candidates))) + (duplicates t) + (meta (let ((doc (ac-js2-document arg))) + (when doc + (with-temp-buffer + (insert doc) + (js-mode) + (if (fboundp 'font-lock-ensure) + (font-lock-ensure) + (with-no-warnings + (font-lock-fontify-buffer))) + (buffer-string)))))))) + +;;; Helper functions + +(defun ac-js2-build-prop-name-list (prop-node) + "Build a list of names from a PROP-NODE." + (let* (names + left + left-node) + (unless (js2-prop-get-node-p prop-node) + (error "Node is not a property prop-node")) + (while (js2-prop-get-node-p prop-node) + (push (js2-name-node-name (js2-prop-get-node-right prop-node)) names) + (setq left-node (js2-prop-get-node-left prop-node)) + (when (js2-name-node-p left-node) + (setq left (js2-name-node-name left-node))) + (setq prop-node (js2-node-parent prop-node))) + (append names `(,left)))) + +(defun ac-js2-prop-names-left (name-node) + "Create a list of all of the names in the property NAME-NODE. +NAME-NODE must have a js2-prop-get-node as parent. Only adds +properties to the left of point. This is so individual jump +points can be found for each property in the chain." + (let* (name + (parent (js2-node-parent name-node)) + left + names) + (unless (or (js2-prop-get-node-p parent) (js2-name-node-p name-node)) + (error "Not a name node or doesn't have a prop-get-node as parent")) + (setq name (js2-name-node-name name-node) + left (js2-prop-get-node-left parent)) + (if (and (js2-name-node-p left) + (string= name (js2-name-node-name left))) + (setq names name) + (js2-visit-ast + parent + (lambda (node endp) + (unless endp + (if (js2-name-node-p node) + (push (js2-name-node-name node) names) + t)))) + names))) + +(defun ac-js2-has-function-calls (string) + "Check if the Javascript code in STRING has a Js2-call-node." + (with-temp-buffer + (insert string) + (let* ((ast (js2-parse))) + (catch 'call-node + (js2-visit-ast-root + ast + (lambda (node end-p) + (unless end-p + (if (js2-call-node-p node) + (throw 'call-node t) + t)))))))) + +(defun ac-js2-add-extra-completions (completions) + "Add extra candidates to COMPLETIONS." + (append completions + (if ac-js2-add-keywords (or ac-js2-keywords (setq ac-js2-keywords (mapcar 'symbol-name js2-keywords)))) + (if ac-js2-add-ecma-262-externs js2-ecma-262-externs) + (if ac-js2-add-browser-externs js2-browser-externs))) + +(defun ac-js2-root-or-node () + "Return the current node or js2-ast-root node." + (let ((node (js2-node-at-point))) + (if (js2-ast-root-p node) + node + (js2-node-get-enclosing-scope node)))) + +(defun ac-js2-get-names-in-scope () + "Fetches all symbols in scope and formats them for completion." + (let* ((scope (ac-js2-root-or-node)) + result) + (while scope + (setq result (append result + (cl-loop for item in (js2-scope-symbol-table scope) + if (not (assoc (car item) result)) + collect item))) + (setq scope (js2-scope-parent-scope scope))) + (setq ac-js2-candidates + (mapcar #'(lambda (x) + (let* ((name (symbol-name (car x))) + (init (ac-js2-initialized-node name))) + (ac-js2-format-node name init))) + result)))) + +(defun ac-js2-initialized-node (name) + "Return initial value assigned to NAME. +NAME may be either a variable, a function or a variable that +holds a function. NAME may also be a list of names that make up a +object property. Returns nil if no initial value can be found." + (let* ((node (if (listp name) (ac-js2-find-property name) + (ac-js2-name-declaration name))) + (parent (if node (js2-node-parent node))) + (init (cond + ((js2-function-node-p parent) + parent) + ((js2-function-node-p node) + node) + ((js2-var-init-node-p parent) + (js2-var-init-node-initializer parent)) + ((js2-assign-node-p parent) + (js2-assign-node-right parent)) + (t + nil)))) + init)) + +(defun ac-js2-name-declaration (name) + "Return the declaration node for node named NAME." + (let* ((node (ac-js2-root-or-node)) + (scope-def (js2-get-defining-scope node name)) + (scope (if scope-def (js2-scope-get-symbol scope-def name) nil)) + (symbol (if scope (js2-symbol-ast-node scope) nil))) + (if (not symbol) + (ac-js2-get-function-node name scope-def) + symbol))) + +;;; Completion candidate formatting + +(defun ac-js2-format-node (name node) + "Format NAME and NODE for completion. +Returned format is a list where the first element is the NAME of +the node (shown in completion candidate list) and the last +element is the text to show as documentation." + (let ((node (if (js2-object-prop-node-p node) (js2-object-prop-node-right node) node)) + (name-format (replace-regexp-in-string "\"" "" name)) + (doc (if (and (js2-function-node-p node) + (cl-find name (js2-function-node-params node) + :test '(lambda (name param) (string= name (js2-name-node-name param))))) + "Function parameter" + (ac-js2-format-node-doc node)))) + `(,name-format . ,doc))) + +(defun ac-js2-format-object-node-doc (obj-node) + "Format OBJ-NODE to display as documentation." + (let (elems) + (unless (js2-object-node-p obj-node) + (error "Node is not an object node")) + (setq elems (js2-object-node-elems obj-node)) + (if (not elems) + "{}" + (mapconcat #'(lambda (x) (ac-js2-format-js2-object-prop-doc x)) elems "\n")))) + +(defun ac-js2-format-node-doc (node) + "Format NODE for displaying in a document string." + (let* ((node-above (and node (js2-node-at-point + (save-excursion + (goto-char (js2-node-abs-pos node)) + (forward-line -1) + (point))))) + (comment (if (js2-comment-node-p node-above) + (ac-js2-format-comment (js2-node-string node-above)))) + (doc (cond + ((js2-function-node-p node) + (ac-js2-format-function node)) + ((js2-object-node-p node) + (ac-js2-format-object-node-doc node)) + ((js2-object-prop-node-p node) + (ac-js2-format-node-doc (js2-object-prop-node-right node))) + (t + (if (js2-node-p node) (js2-node-string node) ""))))) + (if comment (concat comment "\n" doc) doc))) + +(defun ac-js2-format-js2-object-prop-doc (obj-prop) + "Format an OBJ-PROP for displaying as a document string." + (unless (js2-object-prop-node-p obj-prop) + (error "Node is not an object property node")) + (let* ((left (js2-object-prop-node-left obj-prop)) + (right (js2-object-prop-node-right obj-prop))) + (concat (js2-node-string left) " : " + (ac-js2-format-node-doc right)))) + +(defun ac-js2-format-function (func) + "Formats a function for a document string. +FUNC can be either a function node or a string starting with +'function'. Returns nil if neither." + (let ((str (or (and (js2-function-node-p func) (js2-node-string func)) + (and (stringp func) (eq 0 (string-match "function" func)) func)))) + (if str (substring str 0 (1+ (string-match ")" str)))))) + +(defun ac-js2-format-comment (comment) + "Prepare a COMMENT node for displaying in a popup." + (let* ((node-string (if (js2-comment-node-p comment) + (js2-node-string comment) + comment)) + (string (replace-regexp-in-string "[ \t]$" "" + (replace-regexp-in-string "^[ \t\n*/*]+" "" node-string)))) + string)) + +;;; Navigation commands for js2-mode + +(defun ac-js2-find-property (list-names) + "Find the property definition that consists of LIST-NAMES. +Supports navigation to 'foo.bar = 3' and 'foo = {bar: 3}'." + (catch 'prop-found + (js2-visit-ast-root + js2-mode-ast + (lambda (node endp) + (let ((parent (js2-node-parent node))) + (unless endp + (if (or (and (js2-prop-get-node-p node) + (not (or (js2-elem-get-node-p parent) (js2-call-node-p parent))) + (equal list-names (ac-js2-build-prop-name-list node))) + (and (js2-name-node-p node) + (js2-object-prop-node-p parent) + (string= (js2-name-node-name node) + (cl-first list-names)))) + (throw 'prop-found node)) + t)))))) + +(defun ac-js2-get-function-node (name scope) + "Return node of function named NAME in SCOPE." + (catch 'function-found + (js2-visit-ast + scope + (lambda (node end-p) + (when (and (not end-p) + (string= name (ac-js2-get-function-name node))) + (throw 'function-found node)) + t)) + nil)) + +;;;###autoload +(defun ac-js2-jump-to-definition () + "Jump to the definition of an object's property, variable or function. +Navigation to a property definend in an Object literal isn't +implemented." + (interactive) + (ring-insert find-tag-marker-ring (point-marker)) + (let* ((node (js2-node-at-point)) + (parent (js2-node-parent node)) + (prop-names (if (js2-prop-get-node-p parent) + (ac-js2-prop-names-left node))) + (name (if (and (js2-name-node-p node) + (not (js2-object-prop-node-p parent))) + (js2-name-node-name node) + (error "Node is not a supported jump node"))) + (node-init (if (and prop-names (listp prop-names)) + (ac-js2-find-property prop-names) + (ac-js2-name-declaration name)))) + (unless node-init + (pop-tag-mark) + (error "No jump location found")) + (goto-char (js2-node-abs-pos node-init)))) + +(defun ac-js2-get-function-name (fn-node) + "Return the name of the function FN-NODE. +Value may be either function name or the variable name that holds +the function." + (let ((parent (js2-node-parent fn-node))) + (if (js2-function-node-p fn-node) + (or (js2-function-name fn-node) + (if (js2-var-init-node-p parent) + (js2-name-node-name (js2-var-init-node-target parent))))))) + +(defvar ac-js2-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "M-.") 'ac-js2-jump-to-definition) + (define-key map (kbd "M-,") 'pop-tag-mark) + (define-key map (kbd "C-c C-c") 'ac-js2-expand-function) + map) + "Keymap for `ac-js2-mode'.") + +;;; Minor mode + +;;;###autoload +(define-minor-mode ac-js2-mode + "A minor mode that provides auto-completion and navigation for Js2-mode." + :keymap ac-js2-mode-map + (if (featurep 'auto-complete) + (ac-js2-setup-auto-complete-mode)) + (set (make-local-variable 'completion-at-point-functions) + (cons 'ac-js2-completion-function completion-at-point-functions)) + (ac-js2-skewer-eval-wrapper (buffer-string)) + (add-hook 'before-save-hook 'ac-js2-save nil t) + (add-hook 'skewer-js-hook 'ac-js2-on-skewer-load)) + + +(provide 'ac-js2) + +;;; ac-js2.el ends here diff --git a/elpa/ac-js2-20190101.933/ac-js2.elc b/elpa/ac-js2-20190101.933/ac-js2.elc new file mode 100644 index 0000000..abe484e Binary files /dev/null and b/elpa/ac-js2-20190101.933/ac-js2.elc differ diff --git a/elpa/ac-js2-20190101.933/skewer-addon.js b/elpa/ac-js2-20190101.933/skewer-addon.js new file mode 100644 index 0000000..8e2b5a1 --- /dev/null +++ b/elpa/ac-js2-20190101.933/skewer-addon.js @@ -0,0 +1,116 @@ +/** + * @fileOverview Completion request handler for skewer.js + * @requires skewer + * @version 1.0 + */ + +/** + * Handles a completion request from Emacs. + * @param request The request object sent by Emacs + * @returns The completions and init values to be returned to Emacs + */ +skewer.fn.complete = function(request) { + var result = { + type : request.type, + id : request.id, + strict : request.strict, + status : "success" + }, + + /** + * Methods for generating candidates + */ + METHOD = { + EVAL : 0, + GLOBAL : 1 + }, + + /** + * Add the properties from object to extendObject. Properties + * may be from the prototype but we still want to add them. + */ + extend = function(extendObject, object) { + for(var key in object) { + extendObject[key] = object[key]; + } + }, + + globalCompletion = function() { + var global = Function('return this')(), + keys = Object.keys(global); + candidates = buildCandidates(global, keys); + }, + + evalCompletion = function(evalObject) { + var obj = (eval, eval)(evalObject); + if (typeof obj === "object") { + candidates = buildCandidates(obj) || {}; + while (request.prototypes && (obj = Object.getPrototypeOf(obj)) !== null) { + extend(candidates, buildCandidates(obj)); + } + } else if (typeof obj === "function"){ + candidates = buildCandidates(obj) || {}; + extend(candidates, buildCandidates(Object.getPrototypeOf(obj))); + if (request.prototypes) { + var protoObject = Object.getPrototypeOf(obj.prototype); + if (protoObject !== null) { + extend(candidates, buildCandidates(protoObject)); + } else { + extend(candidates, buildCandidates(obj.prototype)); + } + } + } + }, + + /** + * Completion candidates sent back to Emacs. Keys are + * completion candidates the values are the inital items or + * function interfaces. + */ + candidates = {}, + + /** + * Build the candiates to return to Emacs. + * @param obj The object to get candidates from + * @param items The selected keys from obj to create candidates for + * @return object containing completion candidates and documentation strings + */ + buildCandidates = function(obj, items) { + var keys = items || Object.getOwnPropertyNames(obj), values = {}; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (key === "callee" || key === "caller" || key === "arguments") continue; + if (Object.prototype.toString.call(obj[key]) === "[object Function]") { + values[key] = obj[key].toString(); + } else if (typeof obj[key] === "object"){ + values[key] = "[object Object]"; + } else if (typeof obj[key] === "number") { + if (!(obj instanceof Array)) { + values[key] = obj[key].toString(); + } + } else if (typeof obj[key] === "string") { + values[key] = obj[key].toString(); + } else if(obj[key] === true) { + values[key] = "true"; + } else if (obj[key] === false) { + values[key] = "false"; + } else { + values[key] = ""; + } + } + return values; + }; + try { + switch (request.method) { + case METHOD.GLOBAL: + globalCompletion(); + break; + default: + evalCompletion(request.eval); + } + result.value = candidates; + } catch (error){ + skewer.errorResult(error, result, request); + } + return result; +}; diff --git a/elpa/all-the-icons-20220325.1238/all-the-icons-autoloads.el b/elpa/all-the-icons-20220325.1238/all-the-icons-autoloads.el new file mode 100644 index 0000000..121bfa6 --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/all-the-icons-autoloads.el @@ -0,0 +1,75 @@ +;;; all-the-icons-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "all-the-icons" "all-the-icons.el" (0 0 0 0)) +;;; Generated autoloads from all-the-icons.el + +(autoload 'all-the-icons-icon-for-dir "all-the-icons" "\ +Get the formatted icon for DIR. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +Note: You want chevron, please use `all-the-icons-icon-for-dir-with-chevron'. + +\(fn DIR &rest ARG-OVERRIDES)" nil nil) + +(autoload 'all-the-icons-icon-for-file "all-the-icons" "\ +Get the formatted icon for FILE. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +\(fn FILE &rest ARG-OVERRIDES)" nil nil) + +(autoload 'all-the-icons-icon-for-mode "all-the-icons" "\ +Get the formatted icon for MODE. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +\(fn MODE &rest ARG-OVERRIDES)" nil nil) + +(autoload 'all-the-icons-icon-for-url "all-the-icons" "\ +Get the formatted icon for URL. +If an icon for URL isn't found in `all-the-icons-url-alist', a globe is used. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +\(fn URL &rest ARG-OVERRIDES)" nil nil) + +(autoload 'all-the-icons-install-fonts "all-the-icons" "\ +Helper function to download and install the latests fonts based on OS. +When PFX is non-nil, ignore the prompt and just install + +\(fn &optional PFX)" t nil) + +(autoload 'all-the-icons-insert "all-the-icons" "\ +Interactive icon insertion function. +When Prefix ARG is non-nil, insert the propertized icon. +When FAMILY is non-nil, limit the candidates to the icon set matching it. + +\(fn &optional ARG FAMILY)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "all-the-icons" '("all-the-icons-"))) + +;;;*** + +;;;### (autoloads nil nil ("all-the-icons-faces.el" "all-the-icons-pkg.el") +;;;;;; (0 0 0 0)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; all-the-icons-autoloads.el ends here diff --git a/elpa/all-the-icons-20220325.1238/all-the-icons-faces.el b/elpa/all-the-icons-20220325.1238/all-the-icons-faces.el new file mode 100644 index 0000000..4408e97 --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/all-the-icons-faces.el @@ -0,0 +1,230 @@ +;;; all-the-icons-faces.el --- A module of faces for all-the-icons + +;; Copyright (C) 2016 Dominic Charlesworth + +;; Author: Dominic Charlesworth +;; Version: 1.0.0 +;; Package-Requires: ((emacs "24.3")) +;; URL: https://github.com/domtronn/all-the-icons.el +;; Keywords: convenient, lisp + +;; 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 . + +;;; Commentary: + +;; This file contains all of the faces used by the package for +;; colouring icons + +;;; Code: + +(defgroup all-the-icons-faces nil + "Manage how All The Icons icons are coloured and themed." + :prefix "all-the-icons-" + :group 'tools + :group 'all-the-icons) + + +;; red +(defface all-the-icons-red + '((((background dark)) :foreground "#AC4142") + (((background light)) :foreground "#AC4142")) + "Face for red icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lred + '((((background dark)) :foreground "#EB595A") + (((background light)) :foreground "#EB595A")) + "Face for lred icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dred + '((((background dark)) :foreground "#843031") + (((background light)) :foreground "#843031")) + "Face for dred icons" + :group 'all-the-icons-faces) +(defface all-the-icons-red-alt + '((((background dark)) :foreground "#ce5643") + (((background light)) :foreground "#843031")) + "Face for dred icons" + :group 'all-the-icons-faces) + +;; green +(defface all-the-icons-green + '((((background dark)) :foreground "#90A959") + (((background light)) :foreground "#90A959")) + "Face for green icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lgreen + '((((background dark)) :foreground "#C6E87A") + (((background light)) :foreground "#3D6837")) + "Face for lgreen icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dgreen + '((((background dark)) :foreground "#6D8143") + (((background light)) :foreground "#6D8143")) + "Face for dgreen icons" + :group 'all-the-icons-faces) + +;; yellow +(defface all-the-icons-yellow + '((((background dark)) :foreground "#FFD446") + (((background light)) :foreground "#FFCC0E")) + "Face for yellow icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lyellow + '((((background dark)) :foreground "#FFC16D") + (((background light)) :foreground "#FF9300")) + "Face for lyellow icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dyellow + '((((background dark)) :foreground "#B48D56") + (((background light)) :foreground "#B48D56")) + "Face for dyellow icons" + :group 'all-the-icons-faces) + +;; blue +(defface all-the-icons-blue + '((((background dark)) :foreground "#6A9FB5") + (((background light)) :foreground "#6A9FB5")) + "Face for blue icons" + :group 'all-the-icons-faces) +(defface all-the-icons-blue-alt + '((((background dark)) :foreground "#2188b6") + (((background light)) :foreground "#2188b6")) + "Face for blue icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lblue + '((((background dark)) :foreground "#8FD7F4") + (((background light)) :foreground "#677174")) + "Face for lblue icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dblue + '((((background dark)) :foreground "#446674") + (((background light)) :foreground "#446674")) + "Face for dblue icons" + :group 'all-the-icons-faces) + +;; maroon +(defface all-the-icons-maroon + '((((background dark)) :foreground "#8F5536") + (((background light)) :foreground "#8F5536")) + "Face for maroon icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lmaroon + '((((background dark)) :foreground "#CE7A4E") + (((background light)) :foreground "#CE7A4E")) + "Face for lmaroon icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dmaroon + '((((background dark)) :foreground "#72584B") + (((background light)) :foreground "#72584B")) + "Face for dmaroon icons" + :group 'all-the-icons-faces) + +;; purple +(defface all-the-icons-purple + '((((background dark)) :foreground "#AA759F") + (((background light)) :foreground "#68295B")) + "Face for purple icons" + :group 'all-the-icons-faces) +(defface all-the-icons-purple-alt + '((((background dark)) :foreground "#5D54E1") + (((background light)) :foreground "#5D54E1")) + "Face for purple icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lpurple + '((((background dark)) :foreground "#E69DD6") + (((background light)) :foreground "#E69DD6")) + "Face for lpurple icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dpurple + '((((background dark)) :foreground "#694863") + (((background light)) :foreground "#694863")) + "Face for dpurple icons" + :group 'all-the-icons-faces) + +;; orange +(defface all-the-icons-orange + '((((background dark)) :foreground "#D4843E") + (((background light)) :foreground "#D4843E")) + "Face for orange icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lorange + '((((background dark)) :foreground "#FFA500") + (((background light)) :foreground "#FFA500")) + "Face for lorange icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dorange + '((((background dark)) :foreground "#915B2D") + (((background light)) :foreground "#915B2D")) + "Face for dorange icons" + :group 'all-the-icons-faces) + +;; cyan +(defface all-the-icons-cyan + '((((background dark)) :foreground "#75B5AA") + (((background light)) :foreground "#75B5AA")) + "Face for cyan icons" + :group 'all-the-icons-faces) +(defface all-the-icons-cyan-alt + '((((background dark)) :foreground "#61dafb") + (((background light)) :foreground "#0595bd")) + "Face for cyan icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lcyan + '((((background dark)) :foreground "#A5FDEC") + (((background light)) :foreground "#2C7D6E")) + "Face for lcyan icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dcyan + '((((background dark)) :foreground "#48746D") + (((background light)) :foreground "#48746D")) + "Face for dcyan icons" + :group 'all-the-icons-faces) + +;; pink +(defface all-the-icons-pink + '((((background dark)) :foreground "#F2B4B8") + (((background light)) :foreground "#FC505B")) + "Face for pink icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lpink + '((((background dark)) :foreground "#FFBDC1") + (((background light)) :foreground "#FF505B")) + "Face for lpink icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dpink + '((((background dark)) :foreground "#B18286") + (((background light)) :foreground "#7E5D5F")) + "Face for dpink icons" + :group 'all-the-icons-faces) + +;; silver +(defface all-the-icons-silver + '((((background dark)) :foreground "#716E68") + (((background light)) :foreground "#716E68")) + "Face for silver icons" + :group 'all-the-icons-faces) +(defface all-the-icons-lsilver + '((((background dark)) :foreground "#B9B6AA") + (((background light)) :foreground "#7F7869")) + "Face for lsilver icons" + :group 'all-the-icons-faces) +(defface all-the-icons-dsilver + '((((background dark)) :foreground "#838484") + (((background light)) :foreground "#838484")) + "Face for dsilver icons" + :group 'all-the-icons-faces) + + +(provide 'all-the-icons-faces) +;;; all-the-icons-faces.el ends here diff --git a/elpa/all-the-icons-20220325.1238/all-the-icons-faces.elc b/elpa/all-the-icons-20220325.1238/all-the-icons-faces.elc new file mode 100644 index 0000000..26c672b Binary files /dev/null and b/elpa/all-the-icons-20220325.1238/all-the-icons-faces.elc differ diff --git a/elpa/all-the-icons-20220325.1238/all-the-icons-pkg.el b/elpa/all-the-icons-20220325.1238/all-the-icons-pkg.el new file mode 100644 index 0000000..b606660 --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/all-the-icons-pkg.el @@ -0,0 +1,12 @@ +(define-package "all-the-icons" "20220325.1238" "A library for inserting Developer icons" + '((emacs "24.3")) + :commit "65c496d3d1d1298345beb9845840067bffb2ffd8" :authors + '(("Dominic Charlesworth" . "dgc336@gmail.com")) + :maintainer + '("Dominic Charlesworth" . "dgc336@gmail.com") + :keywords + '("convenient" "lisp") + :url "https://github.com/domtronn/all-the-icons.el") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/all-the-icons-20220325.1238/all-the-icons.el b/elpa/all-the-icons-20220325.1238/all-the-icons.el new file mode 100644 index 0000000..999246e --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/all-the-icons.el @@ -0,0 +1,1189 @@ +;;; all-the-icons.el --- A library for inserting Developer icons -*- lexical-binding: t; -*- + +;; Copyright (C) 2016 Dominic Charlesworth + +;; Author: Dominic Charlesworth +;; Version: 5.0.0 +;; Package-Requires: ((emacs "24.3")) +;; URL: https://github.com/domtronn/all-the-icons.el +;; Keywords: convenient, lisp + +;; 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 . + +;;; Commentary: + +;; This package is a utility for using and formatting various Icon +;; fonts within Emacs. Icon Fonts allow you to propertize and format +;; icons the same way you would normal text. This enables things such +;; as better scaling of and anti aliasing of the icons. + +;; This package was inspired by + +;; - `mode-icons' for Emacs, found at https://github.com/ryuslash/mode-icons +;; - `file-icons' for Atom, found at https://atom.io/packages/file-icons + +;; Currently, this package provides an interface to the following Icon Fonts + +;; - Atom File Icons, found at https://atom.io/packages/file-icons +;; - FontAwesome Icons, found at http://fontawesome.io/ +;; - GitHub Octicons, found at http://octicons.github.com +;; - Material Design Icons, found at http://google.github.io/material-design-icons/ +;; - Weather Icons, found at https://erikflowers.github.io/weather-icons/ +;; - AllTheIcons, a custom Icon Font maintained as part of this package + +;; Requests for new icons will be accepted and added to the AllTheIcons Icon Font + +;;; Usage: + +;; The simplest usage for this package is to use the following functions; + +;; `all-the-icons-icon-for-buffer' +;; `all-the-icons-icon-for-dir' +;; `all-the-icons-icon-for-file' +;; `all-the-icons-icon-for-mode' +;; `all-the-icons-icon-for-url' + +;; Which can be used to get a formatted icon for the current buffer, a +;; file name, a major mode, or an URL respectively. e.g. + +;; (insert (all-the-icons-icon-for-file "foo.js")) + +;; Inserts a JavaScript icon formatted like this + +;; #("some-icon" 0 1 (display (raise -0.24) +;; face (:family "dev-icons" :height 1.08 :foreground "#FFD446"))) + +;; You can also insert icons directly using the individual icon family +;; functions + +;; `all-the-icons-alltheicon' // Custom font with fewest icons +;; `all-the-icons-devicon' // Developer Icons +;; `all-the-icons-faicon' // Font Awesome Icons +;; `all-the-icons-fileicon' // File Icons from the Atom File Icons package +;; `all-the-icons-octicon' // GitHub Octicons +;; `all-the-icons-material' // Material Design Icons +;; `all-the-icons-wicon' // Weather Icons + +;; You can call these functions with the icon name you want to insert, e.g. + +;; (all-the-icons-octicon "file-binary") // GitHub Octicon for Binary File +;; (all-the-icons-faicon "cogs") // FontAwesome icon for cogs +;; (all-the-icons-wicon "tornado") // Weather Icon for tornado + +;; A list of all the icon names for the different font families can be +;; found in the data directory, or by inspecting the alist variables. +;; All the alist variables are prefixed with `all-the-icons-data/' + +;;; Code: +(require 'cl-lib) + +(require 'data-alltheicons "./data/data-alltheicons") +(require 'data-faicons "./data/data-faicons") +(require 'data-fileicons "./data/data-fileicons") +(require 'data-octicons "./data/data-octicons") +(require 'data-weathericons "./data/data-weathericons") +(require 'data-material "./data/data-material") + +(require 'all-the-icons-faces) + +(defvar web-mode-content-type) ;silence byte-compiler warning +;;; Custom Variables +(defgroup all-the-icons nil + "Manage how All The Icons formats icons." + :prefix "all-the-icons-" + :group 'appearance + :group 'convenience) + +(defcustom all-the-icons-color-icons t + "Whether or not to include a foreground colour when formatting the icon." + :group 'all-the-icons + :type 'boolean) + +(defcustom all-the-icons-scale-factor 1.2 + "The base Scale Factor for the `height' face property of an icon." + :group 'all-the-icons + :type 'number) + +(defcustom all-the-icons-default-adjust -0.2 + "The default adjustment to be made to the `raise' display property of an icon." + :group 'all-the-icons + :type 'number) + +(defvar all-the-icons-font-families '() "List of defined icon font families.") +(defvar all-the-icons-font-names '() "List of defined font file names this package was built with.") + +(defvar all-the-icons-extension-icon-alist + '( + ("fish" all-the-icons-alltheicon "terminal" :face all-the-icons-lpink) + ("zsh" all-the-icons-alltheicon "terminal" :face all-the-icons-lcyan) + ("sh" all-the-icons-alltheicon "terminal" :face all-the-icons-purple) + ;; Meta + ("tags" all-the-icons-octicon "tag" :height 1.0 :v-adjust 0.0 :face all-the-icons-blue) + ("log" all-the-icons-octicon "bug" :height 1.0 :v-adjust 0.0 :face all-the-icons-maroon) + ;; Config + ("node" all-the-icons-alltheicon "nodejs" :height 1.0 :face all-the-icons-green) + ("babelrc" all-the-icons-fileicon "babel" :face all-the-icons-yellow) + ("bashrc" all-the-icons-alltheicon "script" :height 0.9 :face all-the-icons-dpink) + ("bowerrc" all-the-icons-alltheicon "bower" :height 1.0 :v-adjust 0.0 :face all-the-icons-silver) + ("ini" all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-yellow) + ("eslintignore" all-the-icons-fileicon "eslint" :height 0.9 :face all-the-icons-purple) + ("eslint" all-the-icons-fileicon "eslint" :height 0.9 :face all-the-icons-lpurple) + ("git" all-the-icons-alltheicon "git" :height 1.0 :face all-the-icons-lred) + ("mk" all-the-icons-fileicon "gnu" :face all-the-icons-dorange) + ("cmake" all-the-icons-fileicon "cmake" :face all-the-icons-red) + ("dockerignore" all-the-icons-fileicon "dockerfile" :height 1.2 :face all-the-icons-dblue) + ("xml" all-the-icons-faicon "file-code-o" :height 0.95 :face all-the-icons-lorange) + ("json" all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-yellow) + ("cson" all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-yellow) + ("yml" all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-dyellow) + ("yaml" all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-dyellow) + ;; ? + ("pkg" all-the-icons-octicon "package" :v-adjust 0.0 :face all-the-icons-dsilver) + ("rpm" all-the-icons-octicon "package" :v-adjust 0.0 :face all-the-icons-dsilver) + ("elc" all-the-icons-octicon "file-binary" :v-adjust 0.0 :face all-the-icons-dsilver) + ("gz" all-the-icons-octicon "file-binary" :v-adjust 0.0 :face all-the-icons-lmaroon) + ("zip" all-the-icons-octicon "file-zip" :v-adjust 0.0 :face all-the-icons-lmaroon) + ("7z" all-the-icons-octicon "file-zip" :v-adjust 0.0 :face all-the-icons-lmaroon) + ("dat" all-the-icons-faicon "bar-chart" :face all-the-icons-cyan :height 0.9) + ("dmg" all-the-icons-octicon "tools" :v-adjust 0.0 :face all-the-icons-lsilver) + ("dll" all-the-icons-faicon "cogs" :face all-the-icons-silver) + ("ds_store" all-the-icons-faicon "cogs" :face all-the-icons-silver) + ;; Source Codes + ("scpt" all-the-icons-fileicon "apple" :face all-the-icons-pink) + ("aup" all-the-icons-fileicon "audacity" :face all-the-icons-yellow) + ("elm" all-the-icons-fileicon "elm" :face all-the-icons-blue) + ("erl" all-the-icons-alltheicon "erlang" :face all-the-icons-red :v-adjust -0.1 :height 0.9) + ("hrl" all-the-icons-alltheicon "erlang" :face all-the-icons-dred :v-adjust -0.1 :height 0.9) + ("eex" all-the-icons-alltheicon "elixir" :face all-the-icons-lorange :v-adjust -0.1 :height 0.9) + ("leex" all-the-icons-alltheicon "elixir" :face all-the-icons-lorange :v-adjust -0.1 :height 0.9) + ("heex" all-the-icons-alltheicon "elixir" :face all-the-icons-lorange :v-adjust -0.1 :height 0.9) + ("ex" all-the-icons-alltheicon "elixir" :face all-the-icons-lpurple :v-adjust -0.1 :height 0.9) + ("exs" all-the-icons-alltheicon "elixir" :face all-the-icons-lred :v-adjust -0.1 :height 0.9) + ("java" all-the-icons-alltheicon "java" :height 1.0 :face all-the-icons-purple) + ("gradle" all-the-icons-fileicon "gradle" :height 1.0 :face all-the-icons-silver) + ("ebuild" all-the-icons-fileicon "gentoo" :face all-the-icons-cyan) + ("eclass" all-the-icons-fileicon "gentoo" :face all-the-icons-blue) + ("go" all-the-icons-fileicon "go" :height 1.0 :face all-the-icons-blue) + ("jl" all-the-icons-fileicon "julia" :face all-the-icons-purple :v-adjust 0.0) + ("magik" all-the-icons-faicon "magic" :face all-the-icons-blue) + ("matlab" all-the-icons-fileicon "matlab" :face all-the-icons-orange) + ("nix" all-the-icons-fileicon "nix" :face all-the-icons-blue) + ("pl" all-the-icons-alltheicon "perl" :face all-the-icons-lorange) + ("pm" all-the-icons-alltheicon "perl" :face all-the-icons-lorange) + ("pl6" all-the-icons-fileicon "raku" :face all-the-icons-cyan) + ("pm6" all-the-icons-fileicon "raku" :face all-the-icons-pink) + ("pod" all-the-icons-alltheicon "perldocs" :height 1.2 :face all-the-icons-lgreen) + ("php" all-the-icons-fileicon "php" :face all-the-icons-lsilver) + ("pony" all-the-icons-fileicon "pony" :face all-the-icons-maroon) + ("ps1" all-the-icons-fileicon "powershell" :face all-the-icons-blue) + ("pro" all-the-icons-alltheicon "prolog" :height 1.1 :face all-the-icons-lmaroon) + ("proog" all-the-icons-alltheicon "prolog" :height 1.1 :face all-the-icons-lmaroon) + ("py" all-the-icons-alltheicon "python" :height 1.0 :face all-the-icons-dblue) + ("idr" all-the-icons-fileicon "idris" :face all-the-icons-red) + ("ipynb" all-the-icons-fileicon "jupyter" :height 1.0 :face all-the-icons-dorange) + ("gem" all-the-icons-alltheicon "ruby-alt" :face all-the-icons-red) + ("raku" all-the-icons-fileicon "raku" :face all-the-icons-cyan) + ("rakumod" all-the-icons-fileicon "raku" :face all-the-icons-pink) + ("rb" all-the-icons-octicon "ruby" :v-adjust 0.0 :face all-the-icons-lred) + ("rs" all-the-icons-alltheicon "rust" :height 1.2 :face all-the-icons-maroon) + ("rlib" all-the-icons-alltheicon "rust" :height 1.2 :face all-the-icons-dmaroon) + ("r" all-the-icons-fileicon "R" :face all-the-icons-lblue) + ("rd" all-the-icons-fileicon "R" :face all-the-icons-lblue) + ("rdx" all-the-icons-fileicon "R" :face all-the-icons-lblue) + ("rsx" all-the-icons-fileicon "R" :face all-the-icons-lblue) + ;; There seems to be a a bug with this font icon which does not + ;; let you propertise it without it reverting to being a lower + ;; case phi + ("c" all-the-icons-alltheicon "c-line" :face all-the-icons-blue) + ("h" all-the-icons-alltheicon "c-line" :face all-the-icons-purple) + ("m" all-the-icons-fileicon "apple" :v-adjust 0.0 :height 1.0) + ("mm" all-the-icons-fileicon "apple" :v-adjust 0.0 :height 1.0) + ;; + ("cc" all-the-icons-alltheicon "cplusplus-line" :v-adjust -0.2 :face all-the-icons-blue) + ("cpp" all-the-icons-alltheicon "cplusplus-line" :v-adjust -0.2 :face all-the-icons-blue) + ("cxx" all-the-icons-alltheicon "cplusplus-line" :v-adjust -0.2 :face all-the-icons-blue) + ("hh" all-the-icons-alltheicon "cplusplus-line" :v-adjust -0.2 :face all-the-icons-purple) + ("hpp" all-the-icons-alltheicon "cplusplus-line" :v-adjust -0.2 :face all-the-icons-purple) + ("hxx" all-the-icons-alltheicon "cplusplus-line" :v-adjust -0.2 :face all-the-icons-purple) + ;; Lisps + ("cl" all-the-icons-fileicon "clisp" :face all-the-icons-lorange) + ("l" all-the-icons-fileicon "lisp" :face all-the-icons-orange) + ("lisp" all-the-icons-fileicon "lisp" :face all-the-icons-orange) + ("hy" all-the-icons-fileicon "hy" :face all-the-icons-blue) + ("el" all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.2 :face all-the-icons-purple) + ("clj" all-the-icons-alltheicon "clojure-line" :height 1.0 :face all-the-icons-blue :v-adjust 0.0) + ("cljc" all-the-icons-alltheicon "clojure-line" :height 1.0 :face all-the-icons-blue :v-adjust 0.0) + ("cljs" all-the-icons-fileicon "cljs" :height 1.0 :face all-the-icons-dblue :v-adjust 0.0) + ("coffee" all-the-icons-alltheicon "coffeescript" :height 1.0 :face all-the-icons-maroon) + ("iced" all-the-icons-alltheicon "coffeescript" :height 1.0 :face all-the-icons-lmaroon) + ("dart" all-the-icons-fileicon "dart" :height 1.0 :face all-the-icons-blue :v-adjust 0.0) + ("rkt" all-the-icons-fileicon "racket" :height 1.2 :face all-the-icons-red) + ("scrbl" all-the-icons-fileicon "racket" :height 1.2 :face all-the-icons-blue) + ;; Stylesheeting + ("css" all-the-icons-alltheicon "css3" :face all-the-icons-yellow) + ("scss" all-the-icons-alltheicon "sass" :face all-the-icons-pink) + ("sass" all-the-icons-alltheicon "sass" :face all-the-icons-dpink) + ("less" all-the-icons-alltheicon "less" :height 0.8 :face all-the-icons-dyellow) + ("postcss" all-the-icons-fileicon "postcss" :face all-the-icons-dred) + ("sss" all-the-icons-fileicon "postcss" :face all-the-icons-dred) + ("styl" all-the-icons-alltheicon "stylus" :face all-the-icons-lgreen) + ("csv" all-the-icons-octicon "graph" :v-adjust 0.0 :face all-the-icons-dblue) + ;; haskell + ("hs" all-the-icons-alltheicon "haskell" :height 1.0 :face all-the-icons-red) + ("chs" all-the-icons-alltheicon "haskell" :height 1.0 :face all-the-icons-red) + ("lhs" all-the-icons-alltheicon "haskell" :height 1.0 :face all-the-icons-red) + ("hsc" all-the-icons-alltheicon "haskell" :height 1.0 :face all-the-icons-red) + ;; Web modes + ("inky-haml" all-the-icons-fileicon "haml" :face all-the-icons-lyellow) + ("haml" all-the-icons-fileicon "haml" :face all-the-icons-lyellow) + ("htm" all-the-icons-alltheicon "html5" :face all-the-icons-orange) + ("html" all-the-icons-alltheicon "html5" :face all-the-icons-orange) + ("inky-er" all-the-icons-alltheicon "html5" :face all-the-icons-lred) + ("inky-erb" all-the-icons-alltheicon "html5" :face all-the-icons-lred) + ("erb" all-the-icons-alltheicon "html5" :face all-the-icons-lred) + ("hbs" all-the-icons-fileicon "moustache" :face all-the-icons-green) + ("inky-slim" all-the-icons-octicon "dashboard" :v-adjust 0.0 :face all-the-icons-yellow) + ("slim" all-the-icons-octicon "dashboard" :v-adjust 0.0 :face all-the-icons-yellow) + ("jade" all-the-icons-fileicon "jade" :face all-the-icons-red) + ("pug" all-the-icons-fileicon "pug-alt" :face all-the-icons-red) + ;; Javascript + ("d3js" all-the-icons-alltheicon "d3" :height 0.8 :face all-the-icons-lgreen) + ("re" all-the-icons-fileicon "reason" :height 1.0 :face all-the-icons-red-alt) + ("rei" all-the-icons-fileicon "reason" :height 1.0 :face all-the-icons-dred) + ("ml" all-the-icons-fileicon "ocaml" :height 1.0 :face all-the-icons-lpink) + ("mli" all-the-icons-fileicon "ocaml" :height 1.0 :face all-the-icons-dpink) + ("react" all-the-icons-alltheicon "react" :height 1.1 :face all-the-icons-lblue) + ("ts" all-the-icons-fileicon "typescript" :height 1.0 :v-adjust -0.1 :face all-the-icons-blue-alt) + ("js" all-the-icons-alltheicon "javascript" :height 1.0 :v-adjust 0.0 :face all-the-icons-yellow) + ("es" all-the-icons-alltheicon "javascript" :height 1.0 :v-adjust 0.0 :face all-the-icons-yellow) + ("jsx" all-the-icons-fileicon "jsx-2" :height 1.0 :v-adjust -0.1 :face all-the-icons-cyan-alt) + ("tsx" all-the-icons-fileicon "tsx" :height 1.0 :v-adjust -0.1 :face all-the-icons-cyan-alt) + ("njs" all-the-icons-alltheicon "nodejs" :height 1.2 :face all-the-icons-lgreen) + ("vue" all-the-icons-fileicon "vue" :face all-the-icons-lgreen) + + ("sbt" all-the-icons-fileicon "sbt" :face all-the-icons-red) + ("scala" all-the-icons-alltheicon "scala" :face all-the-icons-red) + ("scm" all-the-icons-fileicon "scheme" :height 1.2 :face all-the-icons-red) + ("swift" all-the-icons-alltheicon "swift" :height 1.0 :v-adjust -0.1 :face all-the-icons-green) + + ("tcl" all-the-icons-fileicon "tcl" :height 1.0 :face all-the-icons-dred) + + ("tf" all-the-icons-fileicon "terraform" :height 1.0 :face all-the-icons-purple-alt) + ("tfvars" all-the-icons-fileicon "terraform" :height 1.0 :face all-the-icons-purple-alt) + ("tfstate" all-the-icons-fileicon "terraform" :height 1.0 :face all-the-icons-purple-alt) + + ("asm" all-the-icons-fileicon "assembly" :height 1.0 :face all-the-icons-blue) + ;; Verilog(-AMS) and SystemVerilog(-AMS) + ("v" all-the-icons-fileicon "verilog" :height 1.0 :v-adjust -0.2 :face all-the-icons-red) + ("vams" all-the-icons-fileicon "verilog" :height 1.0 :v-adjust -0.2 :face all-the-icons-red) + ("sv" all-the-icons-fileicon "verilog" :height 1.0 :v-adjust -0.2 :face all-the-icons-red) + ("sva" all-the-icons-fileicon "verilog" :height 1.0 :v-adjust -0.2 :face all-the-icons-red) + ("svh" all-the-icons-fileicon "verilog" :height 1.0 :v-adjust -0.2 :face all-the-icons-red) + ("svams" all-the-icons-fileicon "verilog" :height 1.0 :v-adjust -0.2 :face all-the-icons-red) + ;; VHDL(-AMS) + ("vhd" all-the-icons-fileicon "vhdl" :face all-the-icons-blue) + ("vhdl" all-the-icons-fileicon "vhdl" :face all-the-icons-blue) + ("vhms" all-the-icons-fileicon "vhdl" :face all-the-icons-blue) + ;; Cabal + ("cabal" all-the-icons-fileicon "cabal" :face all-the-icons-lblue) + ;; Kotlin + ("kt" all-the-icons-fileicon "kotlin" :face all-the-icons-orange) + ("kts" all-the-icons-fileicon "kotlin" :face all-the-icons-orange) + ;; Nimrod + ("nim" all-the-icons-fileicon "nimrod" :face all-the-icons-yellow) + ("nims" all-the-icons-fileicon "nimrod" :face all-the-icons-yellow) + ;; SQL + ("sql" all-the-icons-octicon "database" :face all-the-icons-silver) + ;; Styles + ("styles" all-the-icons-material "style" :face all-the-icons-red) + ;; Lua + ("lua" all-the-icons-fileicon "lua" :face all-the-icons-dblue) + ;; ASCII doc + ("adoc" all-the-icons-fileicon "asciidoc" :face all-the-icons-lblue) + ("asciidoc" all-the-icons-fileicon "asciidoc" :face all-the-icons-lblue) + ;; Puppet + ("pp" all-the-icons-fileicon "puppet" :face all-the-icons-yellow) + ;; Jinja + ("j2" all-the-icons-fileicon "jinja" :face all-the-icons-silver) + ("jinja2" all-the-icons-fileicon "jinja" :face all-the-icons-silver) + ;; Docker + ("dockerfile" all-the-icons-fileicon "dockerfile" :face all-the-icons-cyan) + ;; Vagrant + ("vagrantfile" all-the-icons-fileicon "vagrant" :face all-the-icons-blue) + ;; GLSL + ("glsl" all-the-icons-fileicon "vertex-shader" :face all-the-icons-blue) + ("vert" all-the-icons-fileicon "vertex-shader" :face all-the-icons-blue) + ("tesc" all-the-icons-fileicon "vertex-shader" :face all-the-icons-purple) + ("tese" all-the-icons-fileicon "vertex-shader" :face all-the-icons-dpurple) + ("geom" all-the-icons-fileicon "vertex-shader" :face all-the-icons-green) + ("frag" all-the-icons-fileicon "vertex-shader" :face all-the-icons-red) + ("comp" all-the-icons-fileicon "vertex-shader" :face all-the-icons-dblue) + ;; CUDA + ("cu" all-the-icons-fileicon "nvidia" :face all-the-icons-green) + ("cuh" all-the-icons-fileicon "nvidia" :face all-the-icons-green) + ;; Fortran + ("f90" all-the-icons-fileicon "fortran" :face all-the-icons-purple) + ;; C# + ("cs" all-the-icons-alltheicon "csharp-line" :face all-the-icons-dblue) + ("csx" all-the-icons-alltheicon "csharp-line" :face all-the-icons-dblue) + ;; F# + ("fs" all-the-icons-fileicon "fsharp" :face all-the-icons-blue-alt) + ("fsi" all-the-icons-fileicon "fsharp" :face all-the-icons-blue-alt) + ("fsx" all-the-icons-fileicon "fsharp" :face all-the-icons-blue-alt) + ("fsscript" all-the-icons-fileicon "fsharp" :face all-the-icons-blue-alt) + ;; zig + ("zig" all-the-icons-fileicon "zig" :face all-the-icons-orange) + ;; File Types + ("ico" all-the-icons-octicon "file-media" :v-adjust 0.0 :face all-the-icons-blue) + ("png" all-the-icons-octicon "file-media" :v-adjust 0.0 :face all-the-icons-orange) + ("gif" all-the-icons-octicon "file-media" :v-adjust 0.0 :face all-the-icons-green) + ("jpeg" all-the-icons-octicon "file-media" :v-adjust 0.0 :face all-the-icons-dblue) + ("jpg" all-the-icons-octicon "file-media" :v-adjust 0.0 :face all-the-icons-dblue) + ("webp" all-the-icons-octicon "file-media" :v-adjust 0.0 :face all-the-icons-dblue) + ;; Audio + ("mp3" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("wav" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("m4a" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("ogg" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("flac" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("opus" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("au" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("aif" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("aifc" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("aiff" all-the-icons-faicon "volume-up" :face all-the-icons-dred) + ("svg" all-the-icons-alltheicon "svg" :height 0.9 :face all-the-icons-lgreen) + ;; Video + ("mov" all-the-icons-faicon "film" :face all-the-icons-blue) + ("mp4" all-the-icons-faicon "film" :face all-the-icons-blue) + ("ogv" all-the-icons-faicon "film" :face all-the-icons-dblue) + ("mpg" all-the-icons-faicon "film" :face all-the-icons-blue) + ("mpeg" all-the-icons-faicon "film" :face all-the-icons-blue) + ("flv" all-the-icons-faicon "film" :face all-the-icons-blue) + ("ogv" all-the-icons-faicon "film" :face all-the-icons-dblue) + ("mkv" all-the-icons-faicon "film" :face all-the-icons-blue) + ("webm" all-the-icons-faicon "film" :face all-the-icons-blue) + ;; Fonts + ("ttf" all-the-icons-fileicon "font" :v-adjust 0.0 :face all-the-icons-dcyan) + ("woff" all-the-icons-fileicon "font" :v-adjust 0.0 :face all-the-icons-cyan) + ("woff2" all-the-icons-fileicon "font" :v-adjust 0.0 :face all-the-icons-cyan) + ;; Doc + ("pdf" all-the-icons-octicon "file-pdf" :v-adjust 0.0 :face all-the-icons-dred) + ("text" all-the-icons-octicon "file-text" :v-adjust 0.0 :face all-the-icons-cyan) + ("txt" all-the-icons-octicon "file-text" :v-adjust 0.0 :face all-the-icons-cyan) + ("doc" all-the-icons-fileicon "word" :face all-the-icons-blue) + ("docx" all-the-icons-fileicon "word" :face all-the-icons-blue) + ("docm" all-the-icons-fileicon "word" :face all-the-icons-blue) + ("texi" all-the-icons-fileicon "tex" :face all-the-icons-lred) + ("tex" all-the-icons-fileicon "tex" :face all-the-icons-lred) + ("md" all-the-icons-octicon "markdown" :v-adjust 0.0 :face all-the-icons-lblue) + ("bib" all-the-icons-fileicon "bib" :face all-the-icons-maroon) + ("org" all-the-icons-fileicon "org" :face all-the-icons-lgreen) + ("pps" all-the-icons-fileicon "powerpoint" :face all-the-icons-orange) + ("ppt" all-the-icons-fileicon "powerpoint" :face all-the-icons-orange) + ("pptsx" all-the-icons-fileicon "powerpoint" :face all-the-icons-orange) + ("ppttx" all-the-icons-fileicon "powerpoint" :face all-the-icons-orange) + ("knt" all-the-icons-fileicon "powerpoint" :face all-the-icons-cyan) + ("xlsx" all-the-icons-fileicon "excel" :face all-the-icons-dgreen) + ("xlsm" all-the-icons-fileicon "excel" :face all-the-icons-dgreen) + ("xlsb" all-the-icons-fileicon "excel" :face all-the-icons-dgreen) + ("xltx" all-the-icons-fileicon "excel" :face all-the-icons-dgreen) + ("xltm" all-the-icons-fileicon "excel" :face all-the-icons-dgreen) + ("ly" all-the-icons-faicon "music" :face all-the-icons-green) + ;; + ("key" all-the-icons-octicon "key" :v-adjust 0.0 :face all-the-icons-lblue) + ("pem" all-the-icons-octicon "key" :v-adjust 0.0 :face all-the-icons-orange) + ("p12" all-the-icons-octicon "key" :v-adjust 0.0 :face all-the-icons-dorange) + ("crt" all-the-icons-octicon "key" :v-adjust 0.0 :face all-the-icons-lblue) + ("pub" all-the-icons-octicon "key" :v-adjust 0.0 :face all-the-icons-blue) + ("gpg" all-the-icons-octicon "key" :v-adjust 0.0 :face all-the-icons-lblue) + ("cache" all-the-icons-octicon "database" :height 1.0 :v-adjust 0.0 :face all-the-icons-green))) + + +(define-obsolete-variable-alias 'all-the-icons-icon-alist + 'all-the-icons-regexp-icon-alist + "5.0.0" + "`all-the-icons-icon-alist' has been split to +`all-the-icons-extension-icon-alist' and `all-the-icons-regexp-icon-alist' +for performance sake.") + +(defvar all-the-icons-regexp-icon-alist + '( + ;; + ("^TAGS$" all-the-icons-octicon "tag" :height 1.0 :v-adjust 0.0 :face all-the-icons-blue) + ("^TODO$" all-the-icons-octicon "checklist" :v-adjust 0.0 :face all-the-icons-lyellow) + ("^LICENSE$" all-the-icons-octicon "book" :height 1.0 :v-adjust 0.0 :face all-the-icons-blue) + ("^readme" all-the-icons-octicon "book" :height 1.0 :v-adjust 0.0 :face all-the-icons-lcyan) + + ;; Config + ("^bower.json$" all-the-icons-alltheicon "bower" :height 1.0 :v-adjust 0.0 :face all-the-icons-lorange) + ("nginx$" all-the-icons-fileicon "nginx" :height 0.9 :face all-the-icons-dgreen) + ("apache$" all-the-icons-alltheicon "apache" :height 0.9 :face all-the-icons-dgreen) + ("^Makefile$" all-the-icons-fileicon "gnu" :face all-the-icons-dorange) + ("^CMakeLists.txt$" all-the-icons-fileicon "cmake" :face all-the-icons-red) + ("^CMakeCache.txt$" all-the-icons-fileicon "cmake" :face all-the-icons-blue) + + ("^\\.?Dockerfile" all-the-icons-fileicon "dockerfile" :face all-the-icons-blue) + ("^Brewfile$" all-the-icons-faicon "beer" :face all-the-icons-lsilver) + ("\\.npmignore$" all-the-icons-fileicon "npm" :face all-the-icons-dred) + ("^package.json$" all-the-icons-fileicon "npm" :face all-the-icons-red) + ("^package.lock.json$" all-the-icons-fileicon "npm" :face all-the-icons-dred) + ("^yarn\\.lock" all-the-icons-fileicon "yarn" :face all-the-icons-blue-alt) + + ;; ;; AWS + ("^stack.*.json$" all-the-icons-alltheicon "aws" :face all-the-icons-orange) + + + ("^serverless\\.yml$" all-the-icons-faicon "bolt" :v-adjust 0.0 :face all-the-icons-yellow) + + ;; lock files + ("~$" all-the-icons-octicon "lock" :v-adjust 0.0 :face all-the-icons-maroon) + + ;; Source Codes + ("^mix.lock$" all-the-icons-alltheicon "elixir" :face all-the-icons-lyellow :v-adjust -0.1 :height 0.9) + + ("^Gemfile\\(\\.lock\\)?$" all-the-icons-alltheicon "ruby-alt" :face all-the-icons-red) + ("_?test\\.rb$" all-the-icons-fileicon "test-ruby" :height 1.0 :v-adjust 0.0 :face all-the-icons-red) + ("_?test_helper\\.rb$" all-the-icons-fileicon "test-ruby" :height 1.0 :v-adjust 0.0 :face all-the-icons-dred) + ("_?spec\\.rb$" all-the-icons-fileicon "test-ruby" :height 1.0 :v-adjust 0.0 :face all-the-icons-red) + ("_?spec_helper\\.rb$" all-the-icons-fileicon "test-ruby" :height 1.0 :v-adjust 0.0 :face all-the-icons-dred) + + ("-?spec\\.ts$" all-the-icons-fileicon "test-typescript" :height 1.0 :v-adjust 0.0 :face all-the-icons-blue) + ("-?test\\.ts$" all-the-icons-fileicon "test-typescript" :height 1.0 :v-adjust 0.0 :face all-the-icons-blue) + ("-?spec\\.js$" all-the-icons-fileicon "test-js" :height 1.0 :v-adjust 0.0 :face all-the-icons-lpurple) + ("-?test\\.js$" all-the-icons-fileicon "test-js" :height 1.0 :v-adjust 0.0 :face all-the-icons-lpurple) + ("-?spec\\.jsx$" all-the-icons-fileicon "test-react" :height 1.0 :v-adjust 0.0 :face all-the-icons-blue-alt) + ("-?test\\.jsx$" all-the-icons-fileicon "test-react" :height 1.0 :v-adjust 0.0 :face all-the-icons-blue-alt) + + ;; Git + ("^MERGE_" all-the-icons-octicon "git-merge" :v-adjust 0.0 :face all-the-icons-red) + ("^COMMIT_EDITMSG" all-the-icons-octicon "git-commit" :v-adjust 0.0 :face all-the-icons-red) + + ;; Stylesheeting + ("stylelint" all-the-icons-fileicon "stylelint" :face all-the-icons-lyellow) + ;; JavaScript + ("^gulpfile" all-the-icons-alltheicon "gulp" :height 1.0 :face all-the-icons-lred) + ("^gruntfile" all-the-icons-alltheicon "grunt" :height 1.0 :v-adjust -0.1 :face all-the-icons-lyellow) + ("^webpack" all-the-icons-fileicon "webpack" :face all-the-icons-lblue) + + ("bookmark" all-the-icons-octicon "bookmark" :height 1.1 :v-adjust 0.0 :face all-the-icons-lpink) + + ("^\\*scratch\\*$" all-the-icons-faicon "sticky-note" :face all-the-icons-lyellow) + ("^\\*scratch.*" all-the-icons-faicon "sticky-note" :face all-the-icons-yellow) + ("^\\*new-tab\\*$" all-the-icons-material "star" :face all-the-icons-cyan) + + ("^\\." all-the-icons-octicon "gear" :v-adjust 0.0) + )) + +(defvar all-the-icons-default-file-icon + '(all-the-icons-faicon "file-o" :v-adjust 0.0 :face all-the-icons-dsilver)) + +(defvar all-the-icons-dir-icon-alist + '( + ("trash" all-the-icons-faicon "trash-o" :height 1.2 :v-adjust -0.1) + ("dropbox" all-the-icons-faicon "dropbox" :height 1.0 :v-adjust -0.1) + ("google[ _-]drive" all-the-icons-alltheicon "google-drive" :height 1.0 :v-adjust -0.1) + ("^atom$" all-the-icons-alltheicon "atom" :height 1.2 :v-adjust -0.1) + ("documents" all-the-icons-faicon "book" :height 1.0 :v-adjust -0.1) + ("download" all-the-icons-faicon "cloud-download" :height 0.9 :v-adjust -0.1) + ("desktop" all-the-icons-octicon "device-desktop" :height 1.0 :v-adjust -0.1) + ("pictures" all-the-icons-faicon "picture-o" :height 0.9 :v-adjust -0.2) + ("photos" all-the-icons-faicon "camera-retro" :height 1.0 :v-adjust -0.1) + ("music" all-the-icons-faicon "music" :height 1.0 :v-adjust -0.1) + ("movies" all-the-icons-faicon "film" :height 0.9 :v-adjust -0.1) + ("code" all-the-icons-octicon "code" :height 1.1 :v-adjust -0.1) + ("workspace" all-the-icons-octicon "code" :height 1.1 :v-adjust -0.1) + ("test" all-the-icons-fileicon "test-dir" :height 0.9) + ("\\.git" all-the-icons-alltheicon "git" :height 1.0) + (".?" all-the-icons-octicon "file-directory" :height 1.0 :v-adjust -0.1) + )) + +(defvar all-the-icons-weather-icon-alist + '( + ("tornado" all-the-icons-wicon "tornado") + ("hurricane" all-the-icons-wicon "hurricane") + ("thunderstorms" all-the-icons-wicon "thunderstorm") + ("sunny" all-the-icons-wicon "day-sunny") + ("rain.*snow" all-the-icons-wicon "rain-mix") + ("rain.*hail" all-the-icons-wicon "rain-mix") + ("sleet" all-the-icons-wicon "sleet") + ("hail" all-the-icons-wicon "hail") + ("drizzle" all-the-icons-wicon "sprinkle") + ("rain" all-the-icons-wicon "showers" :height 1.1 :v-adjust 0.0) + ("showers" all-the-icons-wicon "showers") + ("blowing.*snow" all-the-icons-wicon "snow-wind") + ("snow" all-the-icons-wicon "snow") + ("dust" all-the-icons-wicon "dust") + ("fog" all-the-icons-wicon "fog") + ("haze" all-the-icons-wicon "day-haze") + ("smoky" all-the-icons-wicon "smoke") + ("blustery" all-the-icons-wicon "cloudy-windy") + ("windy" all-the-icons-wicon "cloudy-gusts") + ("cold" all-the-icons-wicon "snowflake-cold") + ("partly.*cloudy.*night" all-the-icons-wicon "night-alt-partly-cloudy") + ("partly.*cloudy" all-the-icons-wicon "day-cloudy-high") + ("cloudy.*night" all-the-icons-wicon "night-alt-cloudy") + ("cxloudy.*day" all-the-icons-wicon "day-cloudy") + ("cloudy" all-the-icons-wicon "cloudy") + ("clear.*night" all-the-icons-wicon "night-clear") + ("fair.*night" all-the-icons-wicon "stars") + ("fair.*day" all-the-icons-wicon "horizon") + ("hot" all-the-icons-wicon "hot") + ("not.*available" all-the-icons-wicon "na") + )) + +(defvar all-the-icons-mode-icon-alist + '( + (emacs-lisp-mode all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1 :face all-the-icons-purple) + (circe-server-mode all-the-icons-faicon "commenting-o" :height 1.0 :v-adjust 0.0) + (circe-channel-mode all-the-icons-faicon "commenting-o" :height 1.0 :v-adjust 0.0) + (erc-mode all-the-icons-faicon "commenting-o" :height 1.0 :v-adjust 0.0) + (inferior-emacs-lisp-mode all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1 :face all-the-icons-lblue) + (dired-mode all-the-icons-octicon "file-directory" :v-adjust 0.0) + (lisp-interaction-mode all-the-icons-fileicon "lisp" :v-adjust -0.1 :face all-the-icons-orange) + (sly-mrepl-mode all-the-icons-fileicon "clisp" :v-adjust -0.1 :face all-the-icons-orange) + (slime-repl-mode all-the-icons-fileicon "clisp" :v-adjust -0.1 :face all-the-icons-orange) + (org-mode all-the-icons-fileicon "org" :v-adjust 0.0 :face all-the-icons-lgreen) + (typescript-mode all-the-icons-fileicon "typescript" :v-adjust -0.1 :face all-the-icons-blue-alt) + (typescript-tsx-mode all-the-icons-fileicon "tsx" :v-adjust -0.1 :face all-the-icons-cyan-alt) + (js-mode all-the-icons-alltheicon "javascript" :v-adjust -0.1 :face all-the-icons-yellow) + (js-jsx-mode all-the-icons-alltheicon "javascript" :v-adjust -0.1 :face all-the-icons-yellow) + (js2-mode all-the-icons-alltheicon "javascript" :v-adjust -0.1 :face all-the-icons-yellow) + (js3-mode all-the-icons-alltheicon "javascript" :v-adjust -0.1 :face all-the-icons-yellow) + (rjsx-mode all-the-icons-fileicon "jsx-2" :v-adjust -0.1 :face all-the-icons-cyan-alt) + (term-mode all-the-icons-octicon "terminal" :v-adjust 0.2) + (vterm-mode all-the-icons-octicon "terminal" :v-adjust 0.2) + (eshell-mode all-the-icons-octicon "terminal" :v-adjust 0.0 :face all-the-icons-purple) + (magit-refs-mode all-the-icons-octicon "git-branch" :v-adjust 0.0 :face all-the-icons-red) + (magit-process-mode all-the-icons-octicon "mark-github" :v-adjust 0.0) + (magit-diff-mode all-the-icons-octicon "git-compare" :v-adjust 0.0 :face all-the-icons-lblue) + (ediff-mode all-the-icons-octicon "git-compare" :v-adjust 0.0 :Face all-the-icons-red) + (comint-mode all-the-icons-faicon "terminal" :v-adjust 0.0 :face all-the-icons-lblue) + (eww-mode all-the-icons-faicon "firefox" :v-adjust -0.1 :face all-the-icons-red) + (org-agenda-mode all-the-icons-octicon "checklist" :v-adjust 0.0 :face all-the-icons-lgreen) + (cfw:calendar-mode all-the-icons-octicon "calendar" :v-adjust 0.0) + (ibuffer-mode all-the-icons-faicon "files-o" :v-adjust 0.0 :face all-the-icons-dsilver) + (messages-buffer-mode all-the-icons-faicon "file-o" :v-adjust 0.0 :face all-the-icons-dsilver) + (help-mode all-the-icons-faicon "info" :v-adjust -0.1 :face all-the-icons-purple) + (benchmark-init/tree-mode all-the-icons-octicon "dashboard" :v-adjust 0.0) + (jenkins-mode all-the-icons-fileicon "jenkins" :face all-the-icons-blue) + (magit-popup-mode all-the-icons-alltheicon "git" :face all-the-icons-red) + (magit-status-mode all-the-icons-alltheicon "git" :face all-the-icons-lred) + (magit-log-mode all-the-icons-alltheicon "git" :face all-the-icons-green) + (mu4e-compose-mode all-the-icons-octicon "pencil" :v-adjust 0.0) + (mu4e-headers-mode all-the-icons-octicon "mail" :v-adjust 0.0) + (mu4e-main-mode all-the-icons-octicon "mail" :v-adjust 0.0) + (mu4e-view-mode all-the-icons-octicon "mail-read" :v-adjust 0.0) + (package-menu-mode all-the-icons-faicon "archive" :height 1.0 :v-adjust 0.0 :face all-the-icons-silver) + (paradox-menu-mode all-the-icons-faicon "archive" :height 1.0 :v-adjust 0.0 :face all-the-icons-silver) + (Custom-mode all-the-icons-octicon "settings" :v-adjust -0.1) + + ;; Special matcher for Web Mode based on the `web-mode-content-type' of the current buffer + (web-mode all-the-icons--web-mode-icon) + + (fundamental-mode all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1 :face all-the-icons-dsilver) + (special-mode all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1 :face all-the-icons-yellow) + (text-mode all-the-icons-octicon "file-text" :v-adjust 0.0 :face all-the-icons-cyan) + (enh-ruby-mode all-the-icons-alltheicon "ruby-alt" :face all-the-icons-lred) + (ruby-mode all-the-icons-alltheicon "ruby-alt" :face all-the-icons-lred) + (inf-ruby-mode all-the-icons-alltheicon "ruby-alt" :face all-the-icons-red) + (projectile-rails-compilation-mode all-the-icons-alltheicon "ruby-alt" :face all-the-icons-red) + (rspec-compilation-mode all-the-icons-alltheicon "ruby-alt" :face all-the-icons-red) + (rake-compilation-mode all-the-icons-alltheicon "ruby-alt" :face all-the-icons-red) + (sh-mode all-the-icons-alltheicon "terminal" :face all-the-icons-purple) + (shell-mode all-the-icons-alltheicon "terminal" :face all-the-icons-purple) + (fish-mode all-the-icons-alltheicon "terminal" :face all-the-icons-lpink) + (nginx-mode all-the-icons-fileicon "nginx" :height 0.9 :face all-the-icons-dgreen) + (apache-mode all-the-icons-alltheicon "apache" :height 0.9 :face all-the-icons-dgreen) + (makefile-mode all-the-icons-fileicon "gnu" :face all-the-icons-dorange) + (cmake-mode all-the-icons-fileicon "cmake" :face all-the-icons-red) + (dockerfile-mode all-the-icons-fileicon "dockerfile" :face all-the-icons-blue) + (docker-compose-mode all-the-icons-fileicon "dockerfile" :face all-the-icons-lblue) + (nxml-mode all-the-icons-faicon "file-code-o" :height 0.95 :face all-the-icons-lorange) + (json-mode all-the-icons-octicon "settings" :face all-the-icons-yellow) + (yaml-mode all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-dyellow) + (elisp-byte-code-mode all-the-icons-octicon "file-binary" :v-adjust 0.0 :face all-the-icons-dsilver) + (archive-mode all-the-icons-octicon "file-zip" :v-adjust 0.0 :face all-the-icons-lmaroon) + (elm-mode all-the-icons-fileicon "elm" :face all-the-icons-blue) + (erlang-mode all-the-icons-alltheicon "erlang" :face all-the-icons-red :v-adjust -0.1 :height 0.9) + (elixir-mode all-the-icons-alltheicon "elixir" :face all-the-icons-lorange :v-adjust -0.1 :height 0.9) + (java-mode all-the-icons-alltheicon "java" :height 1.0 :face all-the-icons-purple) + (go-mode all-the-icons-fileicon "go" :height 1.0 :face all-the-icons-blue) + (matlab-mode all-the-icons-fileicon "matlab" :face all-the-icons-orange) + (nix-mode all-the-icons-fileicon "nix" :face all-the-icons-blue) + (perl-mode all-the-icons-alltheicon "perl" :face all-the-icons-lorange) + (cperl-mode all-the-icons-alltheicon "perl" :face all-the-icons-lorange) + (php-mode all-the-icons-fileicon "php" :face all-the-icons-lsilver) + (prolog-mode all-the-icons-alltheicon "prolog" :height 1.1 :face all-the-icons-lmaroon) + (python-mode all-the-icons-alltheicon "python" :height 1.0 :face all-the-icons-dblue) + (inferior-python-mode all-the-icons-alltheicon "python" :height 1.0 :face all-the-icons-dblue) + (racket-mode all-the-icons-fileicon "racket" :height 1.2 :face all-the-icons-red) + (rust-mode all-the-icons-alltheicon "rust" :height 1.2 :face all-the-icons-maroon) + (scala-mode all-the-icons-alltheicon "scala" :face all-the-icons-red) + (scheme-mode all-the-icons-fileicon "scheme" :height 1.2 :face all-the-icons-red) + (swift-mode all-the-icons-alltheicon "swift" :height 1.0 :v-adjust -0.1 :face all-the-icons-green) + (c-mode all-the-icons-alltheicon "c-line" :face all-the-icons-blue) + (c++-mode all-the-icons-alltheicon "cplusplus-line" :v-adjust -0.2 :face all-the-icons-blue) + (csharp-mode all-the-icons-alltheicon "csharp-line" :face all-the-icons-dblue) + (clojure-mode all-the-icons-alltheicon "clojure" :height 1.0 :face all-the-icons-blue) + (cider-repl-mode all-the-icons-alltheicon "clojure" :height 1.0 :face all-the-icons-green) + (clojurescript-mode all-the-icons-fileicon "cljs" :height 1.0 :face all-the-icons-dblue) + (coffee-mode all-the-icons-alltheicon "coffeescript" :height 1.0 :face all-the-icons-maroon) + (lisp-mode all-the-icons-fileicon "lisp" :face all-the-icons-orange) + (css-mode all-the-icons-alltheicon "css3" :face all-the-icons-yellow) + (scss-mode all-the-icons-alltheicon "sass" :face all-the-icons-pink) + (sass-mode all-the-icons-alltheicon "sass" :face all-the-icons-dpink) + (less-css-mode all-the-icons-alltheicon "less" :height 0.8 :face all-the-icons-dyellow) + (stylus-mode all-the-icons-alltheicon "stylus" :face all-the-icons-lgreen) + (csv-mode all-the-icons-octicon "graph" :v-adjust 0.0 :face all-the-icons-dblue) + (haskell-mode all-the-icons-alltheicon "haskell" :height 1.0 :face all-the-icons-red) + (haskell-c2hs-mode all-the-icons-alltheicon "haskell" :height 1.0 :face all-the-icons-red) + (literate-haskell-mode all-the-icons-alltheicon "haskell" :height 1.0 :face all-the-icons-red) + (haml-mode all-the-icons-fileicon "haml" :face all-the-icons-lyellow) + (html-mode all-the-icons-alltheicon "html5" :face all-the-icons-orange) + (rhtml-mode all-the-icons-alltheicon "html5" :face all-the-icons-lred) + (mustache-mode all-the-icons-fileicon "moustache" :face all-the-icons-green) + (slim-mode all-the-icons-octicon "dashboard" :v-adjust 0.0 :face all-the-icons-yellow) + (jade-mode all-the-icons-fileicon "jade" :face all-the-icons-red) + (pug-mode all-the-icons-fileicon "pug" :face all-the-icons-red) + (react-mode all-the-icons-alltheicon "react" :height 1.1 :face all-the-icons-lblue) + (image-mode all-the-icons-octicon "file-media" :v-adjust 0.0 :face all-the-icons-blue) + (texinfo-mode all-the-icons-fileicon "tex" :face all-the-icons-lred) + (markdown-mode all-the-icons-octicon "markdown" :v-adjust 0.0 :face all-the-icons-lblue) + (bibtex-mode all-the-icons-fileicon "bib" :face all-the-icons-maroon) + (org-mode all-the-icons-fileicon "org" :face all-the-icons-lgreen) + (compilation-mode all-the-icons-faicon "cogs" :v-adjust 0.0 :height 1.0) + (objc-mode all-the-icons-faicon "apple" :v-adjust 0.0 :height 1.0) + (tuareg-mode all-the-icons-fileicon "ocaml" :v-adjust 0.0 :height 1.0) + (purescript-mode all-the-icons-fileicon "purescript" :v-adjust 0.0 :height 1.0) + (verilog-mode all-the-icons-fileicon "verilog" :height 1.0 :v-adjust -0.2 :face all-the-icons-red) + (vhdl-mode all-the-icons-fileicon "vhdl" :face all-the-icons-blue) + (haskell-cabal-mode all-the-icons-fileicon "cabal" :face all-the-icons-lblue) + (kotlin-mode all-the-icons-fileicon "kotlin" :face all-the-icons-orange) + (nim-mode all-the-icons-fileicon "nimrod" :face all-the-icons-yellow) + (sql-mode all-the-icons-octicon "database" :face all-the-icons-silver) + (lua-mode all-the-icons-fileicon "lua" :face all-the-icons-dblue) + (adoc-mode all-the-icons-fileicon "asciidoc" :face all-the-icons-lblue) + (puppet-mode all-the-icons-fileicon "puppet" :face all-the-icons-yellow) + (jinja2-mode all-the-icons-fileicon "jinja" :face all-the-icons-silver) + (powershell-mode all-the-icons-fileicon "powershell" :face all-the-icons-blue) + (tex-mode all-the-icons-fileicon "tex" :face all-the-icons-lred) + (latex-mode all-the-icons-fileicon "tex" :face all-the-icons-lred) + (dart-mode all-the-icons-fileicon "dart" :height 1.0 :face all-the-icons-blue) + (fsharp-mode all-the-icons-fileicon "fsharp" :height 1.0 :face all-the-icons-blue) + (asm-mode all-the-icons-fileicon "assembly" :height 1.0 :face all-the-icons-blue) + (nasm-mode all-the-icons-fileicon "assembly" :height 1.0 :face all-the-icons-blue) + (tcl-mode all-the-icons-fileicon "tcl" :height 1.0 :face all-the-icons-dred) + (cuda-mode all-the-icons-fileicon "nvidia" :face all-the-icons-green) + (f90-mode all-the-icons-fileicon "fortran" :face all-the-icons-purple) + (hy-mode all-the-icons-fileicon "hy" :face all-the-icons-blue) + (glsl-mode all-the-icons-fileicon "vertex-shader" :face all-the-icons-green) + (zig-mode all-the-icons-fileicon "zig" :face all-the-icons-orange) + (pdf-view-mode all-the-icons-octicon "file-pdf" :v-adjust 0.0 :face all-the-icons-dred) + (elfeed-search-mode all-the-icons-faicon "rss-square" :face all-the-icons-orange) + (elfeed-show-mode all-the-icons-faicon "rss" :face all-the-icons-orange) + (lilypond-mode all-the-icons-faicon "music" :face all-the-icons-green) + (magik-session-mode all-the-icons-alltheicon "terminal" :face all-the-icons-blue) + (magik-cb-mode all-the-icons-faicon "book" :face all-the-icons-blue))) + +(defvar all-the-icons-url-alist + '( + ;; Social media and communities + ("^\\(https?://\\)?\\(www\\.\\)?del\\.icio\\.us" all-the-icons-faicon "delicious") + ("^\\(https?://\\)?\\(www\\.\\)?behance\\.net" all-the-icons-faicon "behance") + ("^\\(https?://\\)?\\(www\\.\\)?dribbble\\.com" all-the-icons-faicon "dribbble") + ("^\\(https?://\\)?\\(www\\.\\)?facebook\\.com" all-the-icons-faicon "facebook-official") + ("^\\(https?://\\)?\\(www\\.\\)?glide\\.me" all-the-icons-faicon "glide-g") + ("^\\(https?://\\)?\\(www\\.\\)?plus\\.google\\.com" all-the-icons-faicon "google-plus") + ("linkedin\\.com" all-the-icons-faicon "linkedin") + ("^\\(https?://\\)?\\(www\\.\\)?ok\\.ru" all-the-icons-faicon "odnoklassniki") + ("^\\(https?://\\)?\\(www\\.\\)?reddit\\.com" all-the-icons-faicon "reddit-alien") + ("^\\(https?://\\)?\\(www\\.\\)?slack\\.com" all-the-icons-faicon "slack") + ("^\\(https?://\\)?\\(www\\.\\)?snapchat\\.com" all-the-icons-faicon "snapchat-ghost") + ("^\\(https?://\\)?\\(www\\.\\)?weibo\\.com" all-the-icons-faicon "weibo") + ("^\\(https?://\\)?\\(www\\.\\)?twitter\\.com" all-the-icons-faicon "twitter") + ;; Blogging + ("joomla\\.org" all-the-icons-faicon "joomla") + ("^\\(https?://\\)?\\(www\\.\\)?medium\\.com" all-the-icons-faicon "medium") + ("tumblr\\.com" all-the-icons-faicon "tumblr") + ("^wordpress\\.com" all-the-icons-faicon "wordpress") + ;; Programming + ("^\\(https?://\\)?\\(www\\.\\)?bitbucket\\.org" all-the-icons-faicon "bitbucket") + ("^\\(https?://\\)?\\(www\\.\\)?codepen\\.io" all-the-icons-faicon "codepen") + ("^\\(https?://\\)?\\(www\\.\\)?codiepie\\.com" all-the-icons-faicon "codiepie") + ("^\\(https?://\\)?\\(www\\.\\)?gist\\.github\\.com" all-the-icons-octicon "gist") + ("^\\(https?://\\)?\\(www\\.\\)?github\\.com" all-the-icons-octicon "mark-github") + ("^\\(https?://\\)?\\(www\\.\\)?gitlab\\.com" all-the-icons-faicon "gitlab") + ("^\\(https?://\\)?\\(www\\.\\)?news\\.ycombinator\\.com" all-the-icons-faicon "hacker-news") + ("^\\(https?://\\)?\\(www\\.\\)?jsfiddle\\.net" all-the-icons-faicon "jsfiddle") + ("^\\(https?://\\)?\\(www\\.\\)?maxcdn\\.com" all-the-icons-faicon "maxcdn") + ("^\\(https?://\\)?\\(www\\.\\)?stackoverflow\\.com" all-the-icons-faicon "stack-overflow") + ;; Video + ("^\\(https?://\\)?\\(www\\.\\)?twitch\\.tv" all-the-icons-faicon "twitch") + ("^\\(https?://\\)?\\(www\\.\\)?vimeo\\.com" all-the-icons-faicon "vimeo") + ("^\\(https?://\\)?\\(www\\.\\)?youtube\\.com" all-the-icons-faicon "youtube") + ("^\\(https?://\\)?\\(www\\.\\)?youtu\\.be" all-the-icons-faicon "youtube") + ("^\\(https?://\\)?\\(www\\.\\)?vine\\.co" all-the-icons-faicon "vine") + ;; Sound + ("^\\(https?://\\)?\\(www\\.\\)?last\\.fm" all-the-icons-faicon "lastfm") + ("^\\(https?://\\)?\\(www\\.\\)?mixcloud\\.com" all-the-icons-faicon "mixcloud") + ("^\\(https?://\\)?\\(www\\.\\)?soundcloud\\.com" all-the-icons-faicon "soundcloud") + ("spotify\\.com" all-the-icons-faicon "spotify") + ;; Shopping + ("^\\(https?://\\)?\\(www\\.\\)?amazon\\." all-the-icons-faicon "amazon") + ("^\\(https?://\\)?\\(www\\.\\)?opencart\\.com" all-the-icons-faicon "opencart") + ("^\\(https?://\\)?\\(www\\.\\)?paypal\\.com" all-the-icons-faicon "paypal") + ("^\\(https?://\\)?\\(www\\.\\)?shirtsinbulk\\.com" all-the-icons-faicon "shitsinbulk") + ;; Images + ("^\\(https?://\\)?\\(www\\.\\)?500px\\.com" all-the-icons-faicon "500px") + ("^\\(https?://\\)?\\(www\\.\\)?deviantart\\.com" all-the-icons-faicon "deviantart") + ("^\\(https?://\\)?\\(www\\.\\)?flickr\\.com" all-the-icons-faicon "flickr") + ("^\\(https?://\\)?\\(www\\.\\)?instagram\\.com" all-the-icons-faicon "instagram") + ("^\\(https?://\\)?\\(www\\.\\)?pinterest\\." all-the-icons-faicon "pinterest") + ;; Information and books + ("^\\(https?://\\)?\\(www\\.\\)?digg\\.com" all-the-icons-faicon "digg") + ("^\\(https?://\\)?\\(www\\.\\)?foursquare\\.com" all-the-icons-faicon "foursquare") + ("^\\(https?://\\)?\\(www\\.\\)?getpocket\\.com" all-the-icons-faicon "get-pocket") + ("^\\(https?://\\)?\\(www\\.\\)?scribd\\.com" all-the-icons-faicon "scribd") + ("^\\(https?://\\)?\\(www\\.\\)?slideshare\\.net" all-the-icons-faicon "slideshare") + ("stackexchange\\.com" all-the-icons-faicon "stack-exchange") + ("^\\(https?://\\)?\\(www\\.\\)?stumbleupon\\.com" all-the-icons-faicon "stumbleupon") + ("^\\(https?://\\)?\\(www\\.\\)?tripadvisor\\." all-the-icons-faicon "tripadvisor") + ("^\\(https?://\\)?\\(www\\.\\)?yelp\\." all-the-icons-faicon "yelp") + + ("wikipedia\\.org" all-the-icons-faicon "wikipedia-w") + ;; Various companies and tools + ("^\\(https?://\\)?\\(www\\.\\)?angel\\.co" all-the-icons-faicon "angellist") + ("^\\(https?://\\)?\\(www\\.\\)?apple\\.com" all-the-icons-faicon "apple") + ("^\\(https?://\\)?\\(www\\.\\)?buysellads\\.com" all-the-icons-faicon "buysellads") + ("^\\(https?://\\)?\\(www\\.\\)?connectdevelop\\.com" all-the-icons-faicon "connectdevelop") + ("^\\(https?://\\)?\\(www\\.\\)?dashcube\\.com" all-the-icons-faicon "dashcube") + ("^\\(https?://\\)?\\(www\\.\\)?dropbox\\.com" all-the-icons-faicon "dropbox") + ("^\\(https?://\\)?\\(www\\.\\)?enviragallery\\.com" all-the-icons-faicon "envira") + ("^\\(https?://\\)?\\(www\\.\\)?fortawesome\\.com" all-the-icons-faicon "fort-awesome") + ("^\\(https?://\\)?\\(www\\.\\)?forumbee\\.com" all-the-icons-faicon "forumbee") + ("^\\(https?://\\)?\\(www\\.\\)?gratipay\\.com" all-the-icons-faicon "gratipay") + ("^\\(https?://\\)?\\(www\\.\\)?modx\\.com" all-the-icons-faicon "modx") + ("^\\(https?://\\)?\\(www\\.\\)?pagelines\\.com" all-the-icons-faicon "pagelines") + ("^\\(https?://\\)?\\(www\\.\\)?producthunt\\.com" all-the-icons-faicon "product-hunt") + ("sellsy\\.com" all-the-icons-faicon "sellsy") + ("^\\(https?://\\)?\\(www\\.\\)?simplybuilt\\.com" all-the-icons-faicon "simplybuilt") + ("^\\(https?://\\)?\\(www\\.\\)?skyatlas\\.com" all-the-icons-faicon "skyatlas") + ("^\\(https?://\\)?\\(www\\.\\)?skype\\.com" all-the-icons-faicon "skype") + ("steampowered\\.com" all-the-icons-faicon "steam") + ("^\\(https?://\\)?\\(www\\.\\)?themeisle\\.com" all-the-icons-faicon "themeisle") + ("^\\(https?://\\)?\\(www\\.\\)?trello\\.com" all-the-icons-faicon "trello") + ("^\\(https?://\\)?\\(www\\.\\)?whatsapp\\.com" all-the-icons-faicon "whatsapp") + ("^\\(https?://\\)?\\(www\\.\\)?ycombinator\\.com" all-the-icons-faicon "y-combinator") + ("yahoo\\.com" all-the-icons-faicon "yahoo") + ("^\\(https?://\\)?\\(www\\.\\)?yoast\\.com" all-the-icons-faicon "yoast") + ;; Catch all + ("android" all-the-icons-faicon "android") + ("creativecommons" all-the-icons-faicon "creative-commons") + ("forums?" all-the-icons-octicon "comment-discussion") + ("\\.pdf$" all-the-icons-octicon "file-pdf" :v-adjust 0.0 :face all-the-icons-dred) + ("google" all-the-icons-faicon "google") + ("\\.rss" all-the-icons-faicon "rss") + )) + +;; ==================== +;; Functions Start +;; ==================== + +(defun all-the-icons-auto-mode-match? (&optional file) + "Whether or not FILE's `major-mode' match against its `auto-mode-alist'." + (let* ((file (or file (buffer-file-name) (buffer-name))) + (auto-mode (all-the-icons-match-to-alist file auto-mode-alist))) + (eq major-mode auto-mode))) + +(defun all-the-icons-match-to-alist (file alist) + "Match FILE against an entry in ALIST using `string-match'." + (cdr (cl-find-if (lambda (it) (string-match (car it) file)) alist))) + +(defun all-the-icons-dir-is-submodule (dir) + "Checker whether or not DIR is a git submodule." + (let* ((gitmodule-dir (locate-dominating-file dir ".gitmodules")) + (modules-file (expand-file-name (format "%s.gitmodules" gitmodule-dir))) + (module-search (format "submodule \".*?%s\"" (file-name-base dir)))) + + (when (and gitmodule-dir (file-exists-p (format "%s/.git" dir))) + (with-temp-buffer + (insert-file-contents modules-file) + (search-forward-regexp module-search (point-max) t))))) + +;; Icon functions +(defun all-the-icons-icon-for-dir-with-chevron (dir &optional chevron padding) + "Format an icon for DIR with CHEVRON similar to tree based directories. + +If PADDING is provided, it will prepend and separate the chevron +and directory with PADDING. + +Produces different symbols by inspecting DIR to distinguish +symlinks and git repositories which do not depend on the +directory contents" + (let ((icon (all-the-icons-icon-for-dir dir)) + (chevron (if chevron (all-the-icons-octicon (format "chevron-%s" chevron) :height 0.8 :v-adjust -0.1) "")) + (padding (or padding "\t"))) + (format "%s%s%s%s%s" padding chevron padding icon padding))) + +(defun all-the-icons-icon-for-buffer () + "Get the formatted icon for the current buffer. + +This function prioritises the use of the buffers file extension to +discern the icon when its `major-mode' matches its auto mode, +otherwise it will use the buffers `major-mode' to decide its +icon." + (all-the-icons--icon-info-for-buffer)) + +(defun all-the-icons-icon-family-for-buffer () + "Get the icon font family for the current buffer." + (all-the-icons--icon-info-for-buffer "family")) + +(defun all-the-icons--web-mode-icon (&rest arg-overrides) "Get icon for a `web-mode' buffer with ARG-OVERRIDES." (all-the-icons--web-mode nil arg-overrides)) +(defun all-the-icons--web-mode-icon-family () "Get icon family for a `web-mode' buffer." (all-the-icons--web-mode t)) +(defun all-the-icons--web-mode (&optional family arg-overrides) + "Return icon or FAMILY for `web-mode' based on `web-mode-content-type'. +Providing ARG-OVERRIDES will modify the creation of the icon." + (let ((non-nil-args (cl-reduce (lambda (acc it) (if it (append acc (list it)) acc)) arg-overrides :initial-value '()))) + (cond + ((equal web-mode-content-type "jsx") + (if family (all-the-icons-fileicon-family) (apply 'all-the-icons-fileicon (append '("jsx-2") non-nil-args)))) + ((equal web-mode-content-type "javascript") + (if family (all-the-icons-alltheicon-family) (apply 'all-the-icons-alltheicon (append '("javascript") non-nil-args)))) + ((equal web-mode-content-type "json") + (if family (all-the-icons-alltheicon-family) (apply 'all-the-icons-alltheicon (append '("less") non-nil-args)))) + ((equal web-mode-content-type "xml") + (if family (all-the-icons-faicon-family) (apply 'all-the-icons-faicon (append '("file-code-o") non-nil-args)))) + ((equal web-mode-content-type "css") + (if family (all-the-icons-alltheicon-family) (apply 'all-the-icons-alltheicon (append '("css3") non-nil-args)))) + (t + (if family (all-the-icons-alltheicon-family) (apply 'all-the-icons-alltheicon (append '("html5") non-nil-args))))))) + +;; Icon Functions + +;;;###autoload +(defun all-the-icons-icon-for-dir (dir &rest arg-overrides) + "Get the formatted icon for DIR. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +Note: You want chevron, please use `all-the-icons-icon-for-dir-with-chevron'." + (let* ((dirname (file-name-base (directory-file-name dir))) + (path (expand-file-name dir)) + (icon (all-the-icons-match-to-alist dirname all-the-icons-dir-icon-alist)) + (args (cdr icon))) + (when arg-overrides (setq args (append `(,(car args)) arg-overrides (cdr args)))) + (cond + ((file-remote-p path) + (apply #'all-the-icons-octicon "terminal" (cdr args))) + ((file-symlink-p path) + (apply #'all-the-icons-octicon "file-symlink-directory" (cdr args))) + ((all-the-icons-dir-is-submodule path) + (apply #'all-the-icons-octicon "file-submodule" (cdr args))) + ((file-exists-p (format "%s/.git" path)) + (apply #'all-the-icons-octicon "repo" (cdr args))) + (t (apply (car icon) args))))) + +;;;###autoload +(defun all-the-icons-icon-for-file (file &rest arg-overrides) + "Get the formatted icon for FILE. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions." + (let* ((ext (file-name-extension file)) + (icon (or (all-the-icons-match-to-alist file all-the-icons-regexp-icon-alist) + (and ext + (cdr (assoc (downcase ext) + all-the-icons-extension-icon-alist))) + all-the-icons-default-file-icon)) + (args (cdr icon))) + (when arg-overrides (setq args (append `(,(car args)) arg-overrides (cdr args)))) + (apply (car icon) args))) + +;;;###autoload +(defun all-the-icons-icon-for-mode (mode &rest arg-overrides) + "Get the formatted icon for MODE. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions." + (let* ((icon (cdr (or (assoc mode all-the-icons-mode-icon-alist) + (assoc (get mode 'derived-mode-parent) all-the-icons-mode-icon-alist)))) + (args (cdr icon))) + (when arg-overrides (setq args (append `(,(car args)) arg-overrides (cdr args)))) + (if icon (apply (car icon) args) mode))) + +;;;###autoload +(defun all-the-icons-icon-for-url (url &rest arg-overrides) + "Get the formatted icon for URL. +If an icon for URL isn't found in `all-the-icons-url-alist', a globe is used. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions." + (let* ((icon (all-the-icons-match-to-alist url all-the-icons-url-alist)) + (args (cdr icon))) + (unless icon + (setq icon '(all-the-icons-faicon "globe")) + (setq args (cdr icon))) + (when arg-overrides (setq args (append `(,(car args)) arg-overrides (cdr args)))) + (apply (car icon) args))) + +(defcustom all-the-icons--cache-limit 2048 + "Maximum cache size for functions cached by `all-the-icons-cache'." + :type 'integer) + +(defun all-the-icons-cache (func) + "Set a cache for FUNC. Does not work on interactive functions." + (unless (get func 'all-the-icons--cached) + (let ((cache (make-hash-table :test #'equal + :size all-the-icons--cache-limit)) + (orig-fn (symbol-function func))) + (fset func + (lambda (&rest args) + (or (gethash args cache) + (progn + (when (> (hash-table-count cache) + all-the-icons--cache-limit) + (clrhash cache)) + (puthash args (apply orig-fn args) cache))))))) + + (put func 'all-the-icons--cached t)) + +(all-the-icons-cache #'all-the-icons-icon-for-dir) +(all-the-icons-cache #'all-the-icons-icon-for-file) +(all-the-icons-cache #'all-the-icons-icon-for-mode) +(all-the-icons-cache #'all-the-icons-icon-for-url) + +;; Family Face Functions +(defun all-the-icons-icon-family-for-file (file) + "Get the icons font family for FILE." + (let ((icon (all-the-icons-match-to-alist file all-the-icons-regexp-icon-alist))) + (funcall (intern (format "%s-family" (car icon)))))) + +(defun all-the-icons-icon-family-for-mode (mode) + "Get the icons font family for MODE." + (let ((icon (cdr (assoc mode all-the-icons-mode-icon-alist)))) + (if icon (funcall (intern (format "%s-family" (car icon)))) nil))) + +(defun all-the-icons-icon-family (icon) + "Get a propertized ICON family programmatically." + (plist-get (get-text-property 0 'face icon) :family)) + +(all-the-icons-cache #'all-the-icons-icon-family-for-file) +(all-the-icons-cache #'all-the-icons-icon-family-for-mode) +(all-the-icons-cache #'all-the-icons-icon-family) + +(defun all-the-icons--icon-info-for-buffer (&optional f) + "Get icon info for the current buffer. + +When F is provided, the info function is calculated with the format +`all-the-icons-icon-%s-for-file' or `all-the-icons-icon-%s-for-mode'." + (let* ((base-f (concat "all-the-icons-icon" (when f (format "-%s" f)))) + (file-f (intern (concat base-f "-for-file"))) + (mode-f (intern (concat base-f "-for-mode")))) + (if (and (buffer-file-name) + (all-the-icons-auto-mode-match?)) + (funcall file-f (file-name-nondirectory (buffer-file-name))) + (funcall mode-f major-mode)))) + +;; Weather icons +(defun all-the-icons-icon-for-weather (weather) + "Get an icon for a WEATHER status." + (let ((icon (all-the-icons-match-to-alist weather all-the-icons-weather-icon-alist))) + (if icon (apply (car icon) (cdr icon)) weather))) + +;; Definitions + +(eval-and-compile + (defun all-the-icons--function-name (name) + "Get the symbol for an icon function name for icon set NAME." + (intern (concat "all-the-icons-" (downcase (symbol-name name))))) + + (defun all-the-icons--family-name (name) + "Get the symbol for an icon family function for icon set NAME." + (intern (concat "all-the-icons-" (downcase (symbol-name name)) "-family"))) + + (defun all-the-icons--data-name (name) + "Get the symbol for an icon family function for icon set NAME." + (intern (concat "all-the-icons-" (downcase (symbol-name name)) "-data"))) + + (defun all-the-icons--insert-function-name (name) + "Get the symbol for an icon insert function for icon set NAME." + (intern (concat "all-the-icons-insert-" (downcase (symbol-name name))))) + + (defun all-the-icons--family-scale-factor (family) + (intern (concat "all-the-icons-" (symbol-name family) "-scale-factor"))) + + (defun all-the-icons--family-adjust (family) + (intern (concat "all-the-icons-default-" (symbol-name family) "-adjust")))) + +;; Icon insertion functions + +(defun all-the-icons--read-candidates () + "Helper to build a list of candidates for all families." + (cl-reduce 'append (mapcar (lambda (it) (all-the-icons--read-candidates-for-family it t)) all-the-icons-font-families))) + +(defun all-the-icons--read-candidates-for-family (family &optional show-family) + "Helper to build read candidates for FAMILY. +If SHOW-FAMILY is non-nil, displays the icons family in the candidate string." + (let ((data (funcall (all-the-icons--data-name family))) + (icon-f (all-the-icons--function-name family))) + (mapcar + (lambda (it) + (let* ((icon-name (car it)) + (icon-name-head (substring icon-name 0 1)) + (icon-name-tail (substring icon-name 1)) + + (icon-display (propertize icon-name-head 'display (format "%s\t%s" (funcall icon-f icon-name) icon-name-head))) + (icon-family (if show-family (format "\t[%s]" family) "")) + + (candidate-name (format "%s%s%s" icon-display icon-name-tail icon-family)) + (candidate-icon (funcall (all-the-icons--function-name family) icon-name))) + + (cons candidate-name candidate-icon))) + data))) + +;;;###autoload +(defun all-the-icons-install-fonts (&optional pfx) + "Helper function to download and install the latests fonts based on OS. +When PFX is non-nil, ignore the prompt and just install" + (interactive "P") + (when (or pfx (yes-or-no-p "This will download and install fonts, are you sure you want to do this?")) + (let* ((url-format "https://raw.githubusercontent.com/domtronn/all-the-icons.el/master/fonts/%s") + (font-dest (cond + ;; Default Linux install directories + ((member system-type '(gnu gnu/linux gnu/kfreebsd)) + (concat (or (getenv "XDG_DATA_HOME") + (concat (getenv "HOME") "/.local/share")) + "/fonts/")) + ;; Default MacOS install directory + ((eq system-type 'darwin) + (concat (getenv "HOME") "/Library/Fonts/")))) + (known-dest? (stringp font-dest)) + (font-dest (or font-dest (read-directory-name "Font installation directory: " "~/")))) + + (unless (file-directory-p font-dest) (mkdir font-dest t)) + + (mapc (lambda (font) + (url-copy-file (format url-format font) (expand-file-name font font-dest) t)) + all-the-icons-font-names) + (when known-dest? + (message "Fonts downloaded, updating font cache... ") + (shell-command-to-string (format "fc-cache -f -v"))) + (message "%s Successfully %s `all-the-icons' fonts to `%s'!" + (all-the-icons-wicon "stars" :v-adjust 0.0) + (if known-dest? "installed" "downloaded") + font-dest)))) + +;;;###autoload +(defun all-the-icons-insert (&optional arg family) + "Interactive icon insertion function. +When Prefix ARG is non-nil, insert the propertized icon. +When FAMILY is non-nil, limit the candidates to the icon set matching it." + (interactive "P") + (let* ((standard-output (current-buffer)) + (candidates (if family + (all-the-icons--read-candidates-for-family family) + (all-the-icons--read-candidates))) + (prompt (if family + (format "%s Icon: " (funcall (all-the-icons--family-name family))) + "Icon : ")) + + (selection (completing-read prompt candidates nil t)) + (result (cdr (assoc selection candidates)))) + + (if arg (prin1 result) (insert result)))) + +;; Debug Helpers + +(defun all-the-icons-insert-icons-for (family &optional height duration) + "Insert all of the available icons associated with FAMILY. +If a HEIGHT is provided it will render the icons at this height. +This is useful both to see the icons more clearly and to test +different height rendering. If DURATION is provided, it will +pause for DURATION seconds between printing each character." + (let* ((data-f (all-the-icons--data-name family)) + (insert-f (all-the-icons--function-name family)) + + (height (or height 2.0)) + (data (funcall data-f))) + (mapc + (lambda (it) + (insert (format "%s - %s\n" (funcall insert-f (car it) :height height) (car it))) + (when duration (sit-for duration 0))) + data))) + +(defmacro all-the-icons-define-icon (name alist family &optional font-name) + "Macro to generate functions for inserting icons for icon set NAME. + +NAME defines is the name of the iconset and will produce a +function of the for `all-the-icons-NAME'. + +ALIST is the alist containing maps between icon names and the +UniCode for the character. All of these can be found in the data +directory of this package. + +FAMILY is the font family to use for the icons. +FONT-NAME is the name of the .ttf file providing the font, defaults to FAMILY." + `(progn + (add-to-list 'all-the-icons-font-families (quote ,name)) + (add-to-list 'all-the-icons-font-names (quote ,(downcase (format "%s.ttf" (or font-name family))))) + (defcustom ,(all-the-icons--family-scale-factor name) 1.0 + ,(format "The additional `height' face property Scale Factor for %s icons." + (symbol-name name)) + :group 'all-the-icons + :type 'number) + (defcustom ,(all-the-icons--family-adjust name) 0.0 + ,(format "The additional `raise' display property adjustment for %s icons." + (symbol-name name)) + :group 'all-the-icons + :type 'number) + (defun ,(all-the-icons--family-name name) () ,family) + (defun ,(all-the-icons--data-name name) () ,alist) + (defun ,(all-the-icons--function-name name) (icon-name &rest args) + (let ((icon (cdr (assoc icon-name ,alist))) + (other-face (when all-the-icons-color-icons (plist-get args :face))) + (height (* all-the-icons-scale-factor + ,(all-the-icons--family-scale-factor name) + (or (plist-get args :height) 1.0))) + (v-adjust (* all-the-icons-scale-factor ,(all-the-icons--family-scale-factor name) + (+ (or (plist-get args :v-adjust) all-the-icons-default-adjust) + ,(all-the-icons--family-adjust name)))) + (family ,family)) + (unless icon + (error (format "Unable to find icon with name `%s' in icon set `%s'" icon-name (quote ,name)))) + (let ((face (if other-face + `(:family ,family :height ,height :inherit ,other-face) + `(:family ,family :height ,height)))) + (propertize icon + 'face face ;so that this works without `font-lock-mode' enabled + 'font-lock-face face ;so that `font-lock-mode' leaves this alone + 'display `(raise ,v-adjust) + 'rear-nonsticky t)))) + (defun ,(all-the-icons--insert-function-name name) (&optional arg) + ,(format "Insert a %s icon at point." family) + (interactive "P") + (all-the-icons-insert arg (quote ,name))))) + +(define-obsolete-function-alias 'define-icon 'all-the-icons-define-icon "4.0.0") + +(all-the-icons-define-icon alltheicon all-the-icons-data/alltheicons-alist "all-the-icons") +(all-the-icons-define-icon fileicon all-the-icons-data/file-icon-alist "file-icons") +(all-the-icons-define-icon faicon all-the-icons-data/fa-icon-alist "FontAwesome") +(all-the-icons-define-icon octicon all-the-icons-data/octicons-alist "github-octicons" "octicons") +(all-the-icons-define-icon wicon all-the-icons-data/weather-icons-alist "Weather Icons" "weathericons") +(all-the-icons-define-icon material all-the-icons-data/material-icons-alist "Material Icons" "material-design-icons") + +(provide 'all-the-icons) + +;;; all-the-icons.el ends here diff --git a/elpa/all-the-icons-20220325.1238/all-the-icons.elc b/elpa/all-the-icons-20220325.1238/all-the-icons.elc new file mode 100644 index 0000000..1990d6b Binary files /dev/null and b/elpa/all-the-icons-20220325.1238/all-the-icons.elc differ diff --git a/elpa/all-the-icons-20220325.1238/data/data-alltheicons.el b/elpa/all-the-icons-20220325.1238/data/data-alltheicons.el new file mode 100644 index 0000000..3322500 --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/data/data-alltheicons.el @@ -0,0 +1,70 @@ +(defvar all-the-icons-data/alltheicons-alist + '( + + ( "apache" . "\xe909" ) + ( "atom" . "\xe917" ) + ( "aws" . "\xe90c" ) + ( "bower" . "\xe918" ) + ( "c" . "\xe915" ) + ( "c-line" . "\xe90f" ) + ( "clojure" . "\xe919" ) + ( "clojure-line" . "\xe91a" ) + ( "coffeescript" . "\xe914" ) + ( "cplusplus" . "\xe913" ) + ( "cplusplus-line" . "\xe910" ) + ( "csharp" . "\xe911" ) + ( "csharp-line" . "\xe912" ) + ( "css3" . "\xe91b" ) + ( "css3-alt" . "\xe91c" ) + ( "d3" . "\xe90e" ) + ( "dlang" . "\xe935" ) + ( "elixir" . "\xe936" ) + ( "erlang" . "\xe934" ) + ( "git" . "\xe907" ) + ( "go" . "\xe91d" ) + ( "google-drive" . "\xe91e" ) + ( "grunt" . "\xe90d" ) + ( "grunt-line" . "\xe91f" ) + ( "gulp" . "\xe920" ) + ( "haskell" . "\xe921" ) + ( "html5" . "\xe932" ) + ( "jasmine" . "\xe904" ) + ( "java" . "\xe922" ) + ( "javascript" . "\xe906" ) + ( "javascript-badge" . "\xe923" ) + ( "javascript-shield" . "\xe924" ) + ( "less" . "\xe90b" ) + ( "nginx" . "\xe933" ) + ( "nodejs" . "\xe925" ) + ( "perl" . "\xe905" ) + ( "perldocs" . "\xe926" ) + ( "postgresql" . "\xe938" ) + ( "prolog" . "\xe927" ) + ( "python" . "\xe928" ) + ( "react" . "\xe929" ) + ( "ruby" . "\xe92a" ) + ( "ruby-alt" . "\xe92b" ) + ( "rust" . "\xe92c" ) + ( "sass" . "\xe92d" ) + ( "scala" . "\xe908" ) + ( "script" . "\xe90a" ) + ( "spring" . "\xe937" ) + ( "stylus" . "\xe92e" ) + ( "svg" . "\xe903" ) + ( "swift" . "\xe92f" ) + ( "terminal" . "\xe930" ) + ( "terminal-alt" . "\xe931" ) + ( "battery-charging" . "\xe939" ) + + ( "arrow-left" . "\xe93a" ) + ( "arrow-right" . "\xe93b" ) + ( "cup-left" . "\xe93c" ) + ( "cup-right" . "\xe93d" ) + ( "slant-left" . "\xe93e" ) + ( "slant-right" . "\xe93f" ) + ( "wave-left" . "\xe940" ) + ( "wave-right" . "\xe941" ) + + )) + +(provide 'data-alltheicons) diff --git a/elpa/all-the-icons-20220325.1238/data/data-alltheicons.elc b/elpa/all-the-icons-20220325.1238/data/data-alltheicons.elc new file mode 100644 index 0000000..76b2125 Binary files /dev/null and b/elpa/all-the-icons-20220325.1238/data/data-alltheicons.elc differ diff --git a/elpa/all-the-icons-20220325.1238/data/data-faicons.el b/elpa/all-the-icons-20220325.1238/data/data-faicons.el new file mode 100644 index 0000000..6ab0480 --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/data/data-faicons.el @@ -0,0 +1,641 @@ +(defvar all-the-icons-data/fa-icon-alist + '( + + ("500px" . "\xf26e") + ("adjust" . "\xf042") + ("adn" . "\xf170") + ("align-center" . "\xf037") + ("align-justify" . "\xf039") + ("align-left" . "\xf036") + ("align-right" . "\xf038") + ("amazon" . "\xf270") + ("ambulance" . "\xf0f9") + ("american-sign-language-interpreting" . "\xf2a3") + ("anchor" . "\xf13d") + ("android" . "\xf17b") + ("angellist" . "\xf209") + ("angle-double-down" . "\xf103") + ("angle-double-left" . "\xf100") + ("angle-double-right" . "\xf101") + ("angle-double-up" . "\xf102") + ("angle-down" . "\xf107") + ("angle-left" . "\xf104") + ("angle-right" . "\xf105") + ("angle-up" . "\xf106") + ("apple" . "\xf179") + ("archive" . "\xf187") + ("area-chart" . "\xf1fe") + ("arrow-circle-down" . "\xf0ab") + ("arrow-circle-left" . "\xf0a8") + ("arrow-circle-o-down" . "\xf01a") + ("arrow-circle-o-left" . "\xf190") + ("arrow-circle-o-right" . "\xf18e") + ("arrow-circle-o-up" . "\xf01b") + ("arrow-circle-right" . "\xf0a9") + ("arrow-circle-up" . "\xf0aa") + ("arrow-down" . "\xf063") + ("arrow-left" . "\xf060") + ("arrow-right" . "\xf061") + ("arrow-up" . "\xf062") + ("arrows" . "\xf047") + ("arrows-alt" . "\xf0b2") + ("arrows-h" . "\xf07e") + ("arrows-v" . "\xf07d") + ("assistive-listening-systems" . "\xf2a2") + ("asterisk" . "\xf069") + ("at" . "\xf1fa") + ("audio-description" . "\xf29e") + ("backward" . "\xf04a") + ("balance-scale" . "\xf24e") + ("ban" . "\xf05e") + ("bar-chart" . "\xf080") + ("barcode" . "\xf02a") + ("bars" . "\xf0c9") + ("battery-empty" . "\xf244") + ("battery-full" . "\xf240") + ("battery-half" . "\xf242") + ("battery-quarter" . "\xf243") + ("battery-three-quarters" . "\xf241") + ("bed" . "\xf236") + ("beer" . "\xf0fc") + ("behance" . "\xf1b4") + ("behance-square" . "\xf1b5") + ("bell" . "\xf0f3") + ("bell-o" . "\xf0a2") + ("bell-slash" . "\xf1f6") + ("bell-slash-o" . "\xf1f7") + ("bicycle" . "\xf206") + ("binoculars" . "\xf1e5") + ("birthday-cake" . "\xf1fd") + ("bitbucket" . "\xf171") + ("bitbucket-square" . "\xf172") + ("black-tie" . "\xf27e") + ("blind" . "\xf29d") + ("bluetooth" . "\xf293") + ("bluetooth-b" . "\xf294") + ("bold" . "\xf032") + ("bolt" . "\xf0e7") + ("bomb" . "\xf1e2") + ("book" . "\xf02d") + ("bookmark" . "\xf02e") + ("bookmark-o" . "\xf097") + ("braille" . "\xf2a1") + ("briefcase" . "\xf0b1") + ("btc" . "\xf15a") + ("bug" . "\xf188") + ("building" . "\xf1ad") + ("building-o" . "\xf0f7") + ("bullhorn" . "\xf0a1") + ("bullseye" . "\xf140") + ("bus" . "\xf207") + ("buysellads" . "\xf20d") + ("calculator" . "\xf1ec") + ("calendar" . "\xf073") + ("calendar-check-o" . "\xf274") + ("calendar-minus-o" . "\xf272") + ("calendar-o" . "\xf133") + ("calendar-plus-o" . "\xf271") + ("calendar-times-o" . "\xf273") + ("camera" . "\xf030") + ("camera-retro" . "\xf083") + ("car" . "\xf1b9") + ("caret-down" . "\xf0d7") + ("caret-left" . "\xf0d9") + ("caret-right" . "\xf0da") + ("caret-square-o-down" . "\xf150") + ("caret-square-o-left" . "\xf191") + ("caret-square-o-right" . "\xf152") + ("caret-square-o-up" . "\xf151") + ("caret-up" . "\xf0d8") + ("cart-arrow-down" . "\xf218") + ("cart-plus" . "\xf217") + ("cc" . "\xf20a") + ("cc-amex" . "\xf1f3") + ("cc-diners-club" . "\xf24c") + ("cc-discover" . "\xf1f2") + ("cc-jcb" . "\xf24b") + ("cc-mastercard" . "\xf1f1") + ("cc-paypal" . "\xf1f4") + ("cc-stripe" . "\xf1f5") + ("cc-visa" . "\xf1f0") + ("certificate" . "\xf0a3") + ("chain-broken" . "\xf127") + ("check" . "\xf00c") + ("check-circle" . "\xf058") + ("check-circle-o" . "\xf05d") + ("check-square" . "\xf14a") + ("check-square-o" . "\xf046") + ("chevron-circle-down" . "\xf13a") + ("chevron-circle-left" . "\xf137") + ("chevron-circle-right" . "\xf138") + ("chevron-circle-up" . "\xf139") + ("chevron-down" . "\xf078") + ("chevron-left" . "\xf053") + ("chevron-right" . "\xf054") + ("chevron-up" . "\xf077") + ("child" . "\xf1ae") + ("chrome" . "\xf268") + ("circle" . "\xf111") + ("circle-o" . "\xf10c") + ("circle-o-notch" . "\xf1ce") + ("circle-thin" . "\xf1db") + ("clipboard" . "\xf0ea") + ("clock-o" . "\xf017") + ("clone" . "\xf24d") + ("cloud" . "\xf0c2") + ("cloud-download" . "\xf0ed") + ("cloud-upload" . "\xf0ee") + ("code" . "\xf121") + ("code-fork" . "\xf126") + ("codepen" . "\xf1cb") + ("codiepie" . "\xf284") + ("coffee" . "\xf0f4") + ("cog" . "\xf013") + ("cogs" . "\xf085") + ("columns" . "\xf0db") + ("comment" . "\xf075") + ("comment-o" . "\xf0e5") + ("commenting" . "\xf27a") + ("commenting-o" . "\xf27b") + ("comments" . "\xf086") + ("comments-o" . "\xf0e6") + ("compass" . "\xf14e") + ("compress" . "\xf066") + ("connectdevelop" . "\xf20e") + ("contao" . "\xf26d") + ("copyright" . "\xf1f9") + ("creative-commons" . "\xf25e") + ("credit-card" . "\xf09d") + ("credit-card-alt" . "\xf283") + ("crop" . "\xf125") + ("crosshairs" . "\xf05b") + ("css3" . "\xf13c") + ("cube" . "\xf1b2") + ("cubes" . "\xf1b3") + ("cutlery" . "\xf0f5") + ("dashcube" . "\xf210") + ("database" . "\xf1c0") + ("deaf" . "\xf2a4") + ("delicious" . "\xf1a5") + ("desktop" . "\xf108") + ("deviantart" . "\xf1bd") + ("diamond" . "\xf219") + ("digg" . "\xf1a6") + ("dot-circle-o" . "\xf192") + ("download" . "\xf019") + ("dribbble" . "\xf17d") + ("dropbox" . "\xf16b") + ("drupal" . "\xf1a9") + ("edge" . "\xf282") + ("eject" . "\xf052") + ("ellipsis-h" . "\xf141") + ("ellipsis-v" . "\xf142") + ("empire" . "\xf1d1") + ("envelope" . "\xf0e0") + ("envelope-o" . "\xf003") + ("envelope-square" . "\xf199") + ("envira" . "\xf299") + ("eraser" . "\xf12d") + ("eur" . "\xf153") + ("exchange" . "\xf0ec") + ("exclamation" . "\xf12a") + ("exclamation-circle" . "\xf06a") + ("exclamation-triangle" . "\xf071") + ("expand" . "\xf065") + ("expeditedssl" . "\xf23e") + ("external-link" . "\xf08e") + ("external-link-square" . "\xf14c") + ("eye" . "\xf06e") + ("eye-slash" . "\xf070") + ("eyedropper" . "\xf1fb") + ("facebook" . "\xf09a") + ("facebook-official" . "\xf230") + ("facebook-square" . "\xf082") + ("fast-backward" . "\xf049") + ("fast-forward" . "\xf050") + ("fax" . "\xf1ac") + ("female" . "\xf182") + ("fighter-jet" . "\xf0fb") + ("file" . "\xf15b") + ("file-archive-o" . "\xf1c6") + ("file-audio-o" . "\xf1c7") + ("file-code-o" . "\xf1c9") + ("file-excel-o" . "\xf1c3") + ("file-image-o" . "\xf1c5") + ("file-o" . "\xf016") + ("file-pdf-o" . "\xf1c1") + ("file-powerpoint-o" . "\xf1c4") + ("file-text" . "\xf15c") + ("file-text-o" . "\xf0f6") + ("file-video-o" . "\xf1c8") + ("file-word-o" . "\xf1c2") + ("files-o" . "\xf0c5") + ("film" . "\xf008") + ("filter" . "\xf0b0") + ("fire" . "\xf06d") + ("fire-extinguisher" . "\xf134") + ("firefox" . "\xf269") + ("first-order" . "\xf2b0") + ("flag" . "\xf024") + ("flag-checkered" . "\xf11e") + ("flag-o" . "\xf11d") + ("flask" . "\xf0c3") + ("flickr" . "\xf16e") + ("floppy-o" . "\xf0c7") + ("folder" . "\xf07b") + ("folder-o" . "\xf114") + ("folder-open" . "\xf07c") + ("folder-open-o" . "\xf115") + ("font" . "\xf031") + ("font-awesome" . "\xf2b4") + ("fonticons" . "\xf280") + ("fort-awesome" . "\xf286") + ("forumbee" . "\xf211") + ("forward" . "\xf04e") + ("foursquare" . "\xf180") + ("frown-o" . "\xf119") + ("futbol-o" . "\xf1e3") + ("gamepad" . "\xf11b") + ("gavel" . "\xf0e3") + ("gbp" . "\xf154") + ("genderless" . "\xf22d") + ("get-pocket" . "\xf265") + ("gg" . "\xf260") + ("gg-circle" . "\xf261") + ("gift" . "\xf06b") + ("git" . "\xf1d3") + ("git-square" . "\xf1d2") + ("github" . "\xf09b") + ("github-alt" . "\xf113") + ("github-square" . "\xf092") + ("gitlab" . "\xf296") + ("glass" . "\xf000") + ("glide" . "\xf2a5") + ("glide-g" . "\xf2a6") + ("globe" . "\xf0ac") + ("google" . "\xf1a0") + ("google-plus" . "\xf0d5") + ("google-plus-official" . "\xf2b3") + ("google-plus-square" . "\xf0d4") + ("google-wallet" . "\xf1ee") + ("graduation-cap" . "\xf19d") + ("gratipay" . "\xf184") + ("h-square" . "\xf0fd") + ("hacker-news" . "\xf1d4") + ("hand-lizard-o" . "\xf258") + ("hand-o-down" . "\xf0a7") + ("hand-o-left" . "\xf0a5") + ("hand-o-right" . "\xf0a4") + ("hand-o-up" . "\xf0a6") + ("hand-paper-o" . "\xf256") + ("hand-peace-o" . "\xf25b") + ("hand-pointer-o" . "\xf25a") + ("hand-rock-o" . "\xf255") + ("hand-scissors-o" . "\xf257") + ("hand-spock-o" . "\xf259") + ("hashtag" . "\xf292") + ("hdd-o" . "\xf0a0") + ("header" . "\xf1dc") + ("headphones" . "\xf025") + ("heart" . "\xf004") + ("heart-o" . "\xf08a") + ("heartbeat" . "\xf21e") + ("history" . "\xf1da") + ("home" . "\xf015") + ("hospital-o" . "\xf0f8") + ("hourglass" . "\xf254") + ("hourglass-end" . "\xf253") + ("hourglass-half" . "\xf252") + ("hourglass-o" . "\xf250") + ("hourglass-start" . "\xf251") + ("houzz" . "\xf27c") + ("html5" . "\xf13b") + ("i-cursor" . "\xf246") + ("ils" . "\xf20b") + ("inbox" . "\xf01c") + ("indent" . "\xf03c") + ("industry" . "\xf275") + ("info" . "\xf129") + ("info-circle" . "\xf05a") + ("inr" . "\xf156") + ("instagram" . "\xf16d") + ("internet-explorer" . "\xf26b") + ("ioxhost" . "\xf208") + ("italic" . "\xf033") + ("joomla" . "\xf1aa") + ("jpy" . "\xf157") + ("jsfiddle" . "\xf1cc") + ("key" . "\xf084") + ("keyboard-o" . "\xf11c") + ("krw" . "\xf159") + ("language" . "\xf1ab") + ("laptop" . "\xf109") + ("lastfm" . "\xf202") + ("lastfm-square" . "\xf203") + ("leaf" . "\xf06c") + ("leanpub" . "\xf212") + ("lemon-o" . "\xf094") + ("level-down" . "\xf149") + ("level-up" . "\xf148") + ("life-ring" . "\xf1cd") + ("lightbulb-o" . "\xf0eb") + ("line-chart" . "\xf201") + ("link" . "\xf0c1") + ("linkedin" . "\xf0e1") + ("linkedin-square" . "\xf08c") + ("linux" . "\xf17c") + ("list" . "\xf03a") + ("list-alt" . "\xf022") + ("list-ol" . "\xf0cb") + ("list-ul" . "\xf0ca") + ("location-arrow" . "\xf124") + ("lock" . "\xf023") + ("long-arrow-down" . "\xf175") + ("long-arrow-left" . "\xf177") + ("long-arrow-right" . "\xf178") + ("long-arrow-up" . "\xf176") + ("low-vision" . "\xf2a8") + ("magic" . "\xf0d0") + ("magnet" . "\xf076") + ("male" . "\xf183") + ("map" . "\xf279") + ("map-marker" . "\xf041") + ("map-o" . "\xf278") + ("map-pin" . "\xf276") + ("map-signs" . "\xf277") + ("mars" . "\xf222") + ("mars-double" . "\xf227") + ("mars-stroke" . "\xf229") + ("mars-stroke-h" . "\xf22b") + ("mars-stroke-v" . "\xf22a") + ("maxcdn" . "\xf136") + ("meanpath" . "\xf20c") + ("medium" . "\xf23a") + ("medkit" . "\xf0fa") + ("meh-o" . "\xf11a") + ("mercury" . "\xf223") + ("microphone" . "\xf130") + ("microphone-slash" . "\xf131") + ("minus" . "\xf068") + ("minus-circle" . "\xf056") + ("minus-square" . "\xf146") + ("minus-square-o" . "\xf147") + ("mixcloud" . "\xf289") + ("mobile" . "\xf10b") + ("modx" . "\xf285") + ("money" . "\xf0d6") + ("moon-o" . "\xf186") + ("motorcycle" . "\xf21c") + ("mouse-pointer" . "\xf245") + ("music" . "\xf001") + ("neuter" . "\xf22c") + ("newspaper-o" . "\xf1ea") + ("object-group" . "\xf247") + ("object-ungroup" . "\xf248") + ("odnoklassniki" . "\xf263") + ("odnoklassniki-square" . "\xf264") + ("opencart" . "\xf23d") + ("openid" . "\xf19b") + ("opera" . "\xf26a") + ("optin-monster" . "\xf23c") + ("outdent" . "\xf03b") + ("pagelines" . "\xf18c") + ("paint-brush" . "\xf1fc") + ("paper-plane" . "\xf1d8") + ("paper-plane-o" . "\xf1d9") + ("paperclip" . "\xf0c6") + ("paragraph" . "\xf1dd") + ("pause" . "\xf04c") + ("pause-circle" . "\xf28b") + ("pause-circle-o" . "\xf28c") + ("paw" . "\xf1b0") + ("paypal" . "\xf1ed") + ("pencil" . "\xf040") + ("pencil-square" . "\xf14b") + ("pencil-square-o" . "\xf044") + ("percent" . "\xf295") + ("phone" . "\xf095") + ("phone-square" . "\xf098") + ("picture-o" . "\xf03e") + ("pie-chart" . "\xf200") + ("pied-piper" . "\xf2ae") + ("pied-piper-alt" . "\xf1a8") + ("pied-piper-pp" . "\xf1a7") + ("pinterest" . "\xf0d2") + ("pinterest-p" . "\xf231") + ("pinterest-square" . "\xf0d3") + ("plane" . "\xf072") + ("play" . "\xf04b") + ("play-circle" . "\xf144") + ("play-circle-o" . "\xf01d") + ("plug" . "\xf1e6") + ("plus" . "\xf067") + ("plus-circle" . "\xf055") + ("plus-square" . "\xf0fe") + ("plus-square-o" . "\xf196") + ("power-off" . "\xf011") + ("print" . "\xf02f") + ("product-hunt" . "\xf288") + ("puzzle-piece" . "\xf12e") + ("qq" . "\xf1d6") + ("qrcode" . "\xf029") + ("question" . "\xf128") + ("question-circle" . "\xf059") + ("question-circle-o" . "\xf29c") + ("quote-left" . "\xf10d") + ("quote-right" . "\xf10e") + ("random" . "\xf074") + ("rebel" . "\xf1d0") + ("recycle" . "\xf1b8") + ("reddit" . "\xf1a1") + ("reddit-alien" . "\xf281") + ("reddit-square" . "\xf1a2") + ("refresh" . "\xf021") + ("registered" . "\xf25d") + ("renren" . "\xf18b") + ("repeat" . "\xf01e") + ("reply" . "\xf112") + ("reply-all" . "\xf122") + ("retweet" . "\xf079") + ("road" . "\xf018") + ("rocket" . "\xf135") + ("rss" . "\xf09e") + ("rss-square" . "\xf143") + ("rub" . "\xf158") + ("safari" . "\xf267") + ("scissors" . "\xf0c4") + ("scribd" . "\xf28a") + ("search" . "\xf002") + ("search-minus" . "\xf010") + ("search-plus" . "\xf00e") + ("sellsy" . "\xf213") + ("server" . "\xf233") + ("share" . "\xf064") + ("share-alt" . "\xf1e0") + ("share-alt-square" . "\xf1e1") + ("share-square" . "\xf14d") + ("share-square-o" . "\xf045") + ("shield" . "\xf132") + ("ship" . "\xf21a") + ("shirtsinbulk" . "\xf214") + ("shopping-bag" . "\xf290") + ("shopping-basket" . "\xf291") + ("shopping-cart" . "\xf07a") + ("sign-in" . "\xf090") + ("sign-language" . "\xf2a7") + ("sign-out" . "\xf08b") + ("signal" . "\xf012") + ("simplybuilt" . "\xf215") + ("sitemap" . "\xf0e8") + ("skyatlas" . "\xf216") + ("skype" . "\xf17e") + ("slack" . "\xf198") + ("sliders" . "\xf1de") + ("slideshare" . "\xf1e7") + ("smile-o" . "\xf118") + ("snapchat" . "\xf2ab") + ("snapchat-ghost" . "\xf2ac") + ("snapchat-square" . "\xf2ad") + ("sort" . "\xf0dc") + ("sort-alpha-asc" . "\xf15d") + ("sort-alpha-desc" . "\xf15e") + ("sort-amount-asc" . "\xf160") + ("sort-amount-desc" . "\xf161") + ("sort-asc" . "\xf0de") + ("sort-desc" . "\xf0dd") + ("sort-numeric-asc" . "\xf162") + ("sort-numeric-desc" . "\xf163") + ("soundcloud" . "\xf1be") + ("space-shuttle" . "\xf197") + ("spinner" . "\xf110") + ("spoon" . "\xf1b1") + ("spotify" . "\xf1bc") + ("square" . "\xf0c8") + ("square-o" . "\xf096") + ("stack-exchange" . "\xf18d") + ("stack-overflow" . "\xf16c") + ("star" . "\xf005") + ("star-half" . "\xf089") + ("star-half-o" . "\xf123") + ("star-o" . "\xf006") + ("steam" . "\xf1b6") + ("steam-square" . "\xf1b7") + ("step-backward" . "\xf048") + ("step-forward" . "\xf051") + ("stethoscope" . "\xf0f1") + ("sticky-note" . "\xf249") + ("sticky-note-o" . "\xf24a") + ("stop" . "\xf04d") + ("stop-circle" . "\xf28d") + ("stop-circle-o" . "\xf28e") + ("street-view" . "\xf21d") + ("strikethrough" . "\xf0cc") + ("stumbleupon" . "\xf1a4") + ("stumbleupon-circle" . "\xf1a3") + ("subscript" . "\xf12c") + ("subway" . "\xf239") + ("suitcase" . "\xf0f2") + ("sun-o" . "\xf185") + ("superscript" . "\xf12b") + ("table" . "\xf0ce") + ("tablet" . "\xf10a") + ("tachometer" . "\xf0e4") + ("tag" . "\xf02b") + ("tags" . "\xf02c") + ("tasks" . "\xf0ae") + ("taxi" . "\xf1ba") + ("television" . "\xf26c") + ("tencent-weibo" . "\xf1d5") + ("terminal" . "\xf120") + ("text-height" . "\xf034") + ("text-width" . "\xf035") + ("th" . "\xf00a") + ("th-large" . "\xf009") + ("th-list" . "\xf00b") + ("themeisle" . "\xf2b2") + ("thumb-tack" . "\xf08d") + ("thumbs-down" . "\xf165") + ("thumbs-o-down" . "\xf088") + ("thumbs-o-up" . "\xf087") + ("thumbs-up" . "\xf164") + ("ticket" . "\xf145") + ("times" . "\xf00d") + ("times-circle" . "\xf057") + ("times-circle-o" . "\xf05c") + ("tint" . "\xf043") + ("toggle-off" . "\xf204") + ("toggle-on" . "\xf205") + ("trademark" . "\xf25c") + ("train" . "\xf238") + ("transgender" . "\xf224") + ("transgender-alt" . "\xf225") + ("trash" . "\xf1f8") + ("trash-o" . "\xf014") + ("tree" . "\xf1bb") + ("trello" . "\xf181") + ("tripadvisor" . "\xf262") + ("trophy" . "\xf091") + ("truck" . "\xf0d1") + ("try" . "\xf195") + ("tty" . "\xf1e4") + ("tumblr" . "\xf173") + ("tumblr-square" . "\xf174") + ("twitch" . "\xf1e8") + ("twitter" . "\xf099") + ("twitter-square" . "\xf081") + ("umbrella" . "\xf0e9") + ("underline" . "\xf0cd") + ("undo" . "\xf0e2") + ("universal-access" . "\xf29a") + ("university" . "\xf19c") + ("unlock" . "\xf09c") + ("unlock-alt" . "\xf13e") + ("upload" . "\xf093") + ("usb" . "\xf287") + ("usd" . "\xf155") + ("user" . "\xf007") + ("user-md" . "\xf0f0") + ("user-plus" . "\xf234") + ("user-secret" . "\xf21b") + ("user-times" . "\xf235") + ("users" . "\xf0c0") + ("venus" . "\xf221") + ("venus-double" . "\xf226") + ("venus-mars" . "\xf228") + ("viacoin" . "\xf237") + ("viadeo" . "\xf2a9") + ("viadeo-square" . "\xf2aa") + ("video-camera" . "\xf03d") + ("vimeo" . "\xf27d") + ("vimeo-square" . "\xf194") + ("vine" . "\xf1ca") + ("vk" . "\xf189") + ("volume-control-phone" . "\xf2a0") + ("volume-down" . "\xf027") + ("volume-off" . "\xf026") + ("volume-up" . "\xf028") + ("weibo" . "\xf18a") + ("weixin" . "\xf1d7") + ("whatsapp" . "\xf232") + ("wheelchair" . "\xf193") + ("wheelchair-alt" . "\xf29b") + ("wifi" . "\xf1eb") + ("wikipedia-w" . "\xf266") + ("windows" . "\xf17a") + ("wordpress" . "\xf19a") + ("wpbeginner" . "\xf297") + ("wpforms" . "\xf298") + ("wrench" . "\xf0ad") + ("xing" . "\xf168") + ("xing-square" . "\xf169") + ("y-combinator" . "\xf23b") + ("yahoo" . "\xf19e") + ("yelp" . "\xf1e9") + ("yoast" . "\xf2b1") + ("youtube" . "\xf167") + ("youtube-play" . "\xf16a") + ("youtube-square" . "\xf166") + + )) + +(provide 'data-faicons) diff --git a/elpa/all-the-icons-20220325.1238/data/data-faicons.elc b/elpa/all-the-icons-20220325.1238/data/data-faicons.elc new file mode 100644 index 0000000..3d0970d Binary files /dev/null and b/elpa/all-the-icons-20220325.1238/data/data-faicons.elc differ diff --git a/elpa/all-the-icons-20220325.1238/data/data-fileicons.el b/elpa/all-the-icons-20220325.1238/data/data-fileicons.el new file mode 100644 index 0000000..df91ac4 --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/data/data-fileicons.el @@ -0,0 +1,491 @@ +(defvar all-the-icons-data/file-icon-alist + '( + + ( "1c" . "\xa5ea" ) + ( "1c-alt" . "\xea28" ) + ( "MJML" . "\xea6f" ) + ( "R" . "\xe905" ) + ( "abap" . "\xe92b" ) + ( "abif" . "\xea4e" ) + ( "access" . "\xe9ea" ) + ( "actionscript" . "\xe92e" ) + ( "ada" . "\xe90b" ) + ( "ae" . "\xe9f3" ) + ( "ai" . "\xe6b4" ) + ( "akka" . "\xea0e" ) + ( "alex" . "\x29cb" ) + ( "alloy" . "\xe935" ) + ( "alpine-linux" . "\xe9ff" ) + ( "ampl" . "\xe94e" ) + ( "amx" . "\xe99b" ) + ( "angelscript" . "\xea5b" ) + ( "ansible" . "\x24b6" ) + ( "ansible-alt" . "\x61" ) + ( "ant" . "\xe93e" ) + ( "antlr" . "\xe92c" ) + ( "antwar" . "\x2591" ) + ( "api-blueprint" . "\xe92d" ) + ( "apl" . "\x234b" ) + ( "apl-old" . "\xe909" ) + ( "apple" . "\xe925" ) + ( "appveyor" . "\xe923" ) + ( "arc" . "\xe92f" ) + ( "arch-linux" . "\x41" ) + ( "arduino" . "\xe930" ) + ( "arttext" . "\x24d0" ) + ( "asciidoc" . "\xe918" ) + ( "assembly" . "\xEB4F" ) + ( "ats" . "\xe934" ) + ( "audacity" . "\xe9f9" ) + ( "augeas" . "\xe931" ) + ( "aurelia" . "\xea48" ) + ( "auto-hotkey" . "\xe932" ) + ( "autoit" . "\xe933" ) + ( "babel" . "\xe91f" ) + ( "bazel" . "\xea5a" ) + ( "bem" . "\xea59" ) + ( "bib" . "\xe601" ) + ( "bintray" . "\xea6e" ) + ( "bithound" . "\xea2a" ) + ( "blender" . "\xe9fa" ) + ( "bluespec" . "\xe93c" ) + ( "boo" . "\xe939" ) + ( "brain" . "\xe93a" ) + ( "brakeman" . "\xe9d6" ) + ( "bro" . "\xe93b" ) + ( "broccoli" . "\xe922" ) + ( "brotli" . "\xea6c" ) + ( "browserslist" . "\xea80" ) + ( "brunch" . "\xea47" ) + ( "buck" . "\xea46" ) + ( "build-boot" . "\xf103" ) + ( "bundler" . "\xea45" ) + ( "byond" . "\xe962" ) + ( "cabal" . "\xe9c2" ) + ( "caddy" . "\xea58" ) + ( "cake" . "\xe9e3" ) + ( "cakefile" . "\xe924" ) + ( "cakephp" . "\xea43" ) + ( "cakephp-old" . "\xe9d3" ) + ( "cc" . "\xe9d5" ) + ( "ceylon" . "\xe94f" ) + ( "chai" . "\x63" ) + ( "chapel" . "\xe950" ) + ( "chartjs" . "\xea0b" ) + ( "chef" . "\xea42" ) + ( "chuck" . "\xe943" ) + ( "circle-ci" . "\xea12" ) + ( "cirru" . "\xe951" ) + ( "ckeditor" . "\xea0c" ) + ( "clarion" . "\xe952" ) + ( "clean" . "\xe95b" ) + ( "click" . "\xe95c" ) + ( "clips" . "\xe940" ) + ( "clj" . "\xf105" ) + ( "cljs" . "\xf104" ) + ( "closure-template" . "\xea82" ) + ( "cmake" . "\xe93f" ) + ( "cobol" . "\xea44" ) + ( "codecov" . "\x2602" ) + ( "codekit" . "\xea41" ) + ( "codemirror" . "\xea0d" ) + ( "codeship" . "\xea6a" ) + ( "cold-fusion" . "\xe929" ) + ( "clisp" . "\xe972" ) + ( "composer" . "\xe683" ) + ( "config" . "\xf07c" ) + ( "coq" . "\xe95f" ) + ( "cordova" . "\xea11" ) + ( "cp" . "\xe942" ) + ( "cpan" . "\xea87" ) + ( "creole" . "\xe95e" ) + ( "crystal" . "\xe902" ) + ( "cs-script" . "\xe9e2" ) + ( "csound" . "\xe9f0" ) + ( "cucumber" . "\xf02b" ) + ( "cython" . "\xe963" ) + ( "d3" . "\xea10" ) + ( "darcs" . "\xe964" ) + ( "dart" . "\xe698" ) + ( "dashboard" . "\xf07d" ) + ( "dbase" . "\xe9f1" ) + ( "default" . "\x1f5cc" ) + ( "delphi" . "\xea40" ) + ( "devicetree" . "\xea57" ) + ( "diff" . "\xe960" ) + ( "dockerfile" . "\xf106" ) + ( "doclets" . "\xea3f" ) + ( "doge" . "\xe946" ) + ( "dom" . "\xea71" ) + ( "donejs" . "\x1f3c1" ) + ( "doxygen" . "\xe928" ) + ( "dragula" . "\x1f44c" ) + ( "drone" . "\xea3d" ) + ( "dyalog" . "\xe90c" ) + ( "dylib" . "\xea15" ) + ( "e" . "\x45" ) + ( "eagle" . "\xe965" ) + ( "easybuild" . "\xea85" ) + ( "ec" . "\xe9c9" ) + ( "ecere" . "\xe966" ) + ( "edge" . "\xea78" ) + ( "editorconfig" . "\xea1b" ) + ( "eiffel" . "\xe967" ) + ( "ejs" . "\xea4b" ) + ( "electron" . "\xea27" ) + ( "elm" . "\xf102" ) + ( "emacs" . "\xe926" ) + ( "elisp" . "\xe926" ) + ( "ember" . "\xe61b" ) + ( "emberscript" . "\xe968" ) + ( "eq" . "\xea0a" ) + ( "esdoc" . "\xea5c" ) + ( "eslint" . "\xea0f" ) + ( "eslint-old" . "\xe90e" ) + ( "excel" . "\xe9ee" ) + ( "fabfile" . "\xe94b" ) + ( "factor" . "\xe96a" ) + ( "fancy" . "\xe96b" ) + ( "fantom" . "\xe96f" ) + ( "fbx" . "\xe9fc" ) + ( "ffmpeg" . "\xea22" ) + ( "finder" . "\xe9e9" ) + ( "firebase" . "\xea7f" ) + ( "flow" . "\xe921" ) + ( "flux" . "\xe969" ) + ( "font" . "\xe90f" ) + ( "fontforge" . "\xfb00" ) + ( "fortran" . "\xe90a" ) + ( "franca" . "\xea56" ) + ( "freemarker" . "\xe970" ) + ( "frege" . "\xe96e" ) + ( "fsharp" . "\xe6a7" ) + ( "fuel-ux" . "\xea09" ) + ( "gams" . "\xe973" ) + ( "gap" . "\xe971" ) + ( "gdb" . "\xea08" ) + ( "genshi" . "\xe976" ) + ( "gentoo" . "\xe96d" ) + ( "gf" . "\xe978" ) + ( "gitlab" . "\xea3c" ) + ( "glade" . "\xe938" ) + ( "glyphs" . "\x47" ) + ( "gn" . "\xea25" ) + ( "gnu" . "\xe679" ) + ( "go" . "\xeaae" ) + ( "godot" . "\xe974" ) + ( "golo" . "\xe979" ) + ( "gosu" . "\xe97a" ) + ( "gradle" . "\xe903" ) + ( "graphql" . "\xe97c" ) + ( "graphviz" . "\xe97d" ) + ( "groovy" . "\xe904" ) + ( "grunt" . "\xe611" ) + ( "gulp" . "\xe610" ) + ( "hack" . "\xe9ce" ) + ( "haml" . "\xf15b" ) + ( "harbour" . "\xe97b" ) + ( "hashicorp" . "\xe97e" ) + ( "haxe" . "\xe907" ) + ( "haxedevelop" . "\xea3b" ) + ( "hg" . "\x263f" ) + ( "hoplon" . "\xea4d" ) + ( "hy" . "\xe97f" ) + ( "icu" . "\xea23" ) + ( "id" . "\xe9f4" ) + ( "idl" . "\xe947" ) + ( "idris" . "\xe983" ) + ( "igorpro" . "\xe980" ) + ( "image" . "\xf012" ) + ( "inform7" . "\xe984" ) + ( "inno" . "\xe985" ) + ( "io" . "\xe981" ) + ( "ioke" . "\xe982" ) + ( "ionic-project" . "\xf14b" ) + ( "isabelle" . "\xe945" ) + ( "j" . "\xe937" ) + ( "jade" . "\xe90d" ) + ( "jake" . "\xe948" ) + ( "jasmine" . "\xea3a" ) + ( "jenkins" . "\xe667" ) + ( "jest" . "\xea39" ) + ( "jinja" . "\xe944" ) + ( "jison" . "\xea55" ) + ( "jolie" . "\xea75" ) + ( "jsonld" . "\xe958" ) + ( "jsx" . "\xf100" ) + ( "jsx-2" . "\xf101" ) + ( "jsx2-alt" . "\xe9e6" ) + ( "julia" . "\x26ec" ) + ( "junos" . "\xea81" ) + ( "jupyter" . "\xe987" ) + ( "karma" . "\xe9cd" ) + ( "keynote" . "\xe9e5" ) + ( "khronos" . "\xe9f8" ) + ( "kicad" . "\xea4c" ) + ( "kitchenci" . "\xea38" ) + ( "kivy" . "\xe901" ) + ( "knockout" . "\x4b" ) + ( "kotlin" . "\xe989" ) + ( "krl" . "\xe988" ) + ( "labview" . "\xe98a" ) + ( "lasso" . "\xe98c" ) + ( "leaflet" . "\xea07" ) + ( "lean" . "\x4c" ) + ( "lerna" . "\xea37" ) + ( "lfe" . "\xe94c" ) + ( "libuv" . "\xea21" ) + ( "lightwave" . "\xe9fb" ) + ( "lime" . "\xea36" ) + ( "lisp" . "\xe908" ) + ( "livescript" . "\xe914" ) + ( "llvm" . "\xe91d" ) + ( "logtalk" . "\xe98d" ) + ( "lookml" . "\xe98e" ) + ( "lsl" . "\xe98b" ) + ( "lua" . "\xe91b" ) + ( "mako" . "\xe98f" ) + ( "man-page" . "\xe936" ) + ( "mapbox" . "\xe941" ) + ( "markdownlint" . "\xf0c9" ) + ( "marko" . "\xe920" ) + ( "mathematica" . "\xe990" ) + ( "mathjax" . "\xea06" ) + ( "matlab" . "\xe991" ) + ( "max" . "\xe993" ) + ( "maxscript" . "\xe900" ) + ( "maya" . "\xe9f6" ) + ( "mediawiki" . "\xe954" ) + ( "mercury" . "\xe994" ) + ( "meson" . "\xea54" ) + ( "metal" . "\x4d" ) + ( "meteor" . "\xe6a5" ) + ( "microsoft-infopath" . "\xea35" ) + ( "minecraft" . "\xe9dc" ) + ( "minizinc" . "\xea53" ) + ( "mirah" . "\xe995" ) + ( "miranda" . "\xea52" ) + ( "mocha" . "\x26fe" ) + ( "modula-2" . "\xe996" ) + ( "moment" . "\x1f558" ) + ( "moment-tz" . "\x1f30d" ) + ( "monkey" . "\xe997" ) + ( "moustache" . "\xe60f" ) + ( "mruby" . "\xea18" ) + ( "mupad" . "\xe9ca" ) + ( "nano" . "\xea76" ) + ( "nanoc" . "\xea51" ) + ( "nant" . "\xe9e1" ) + ( "nasm" . "\xea72" ) + ( "neko" . "\xea05" ) + ( "netlogo" . "\xe99c" ) + ( "new-relic" . "\xe9d7" ) + ( "nginx" . "\xf146b" ) + ( "nib" . "\x2712" ) + ( "nimrod" . "\xe998" ) + ( "nit" . "\xe999" ) + ( "nix" . "\xe99a" ) + ( "nmap" . "\xe94d" ) + ( "nodemon" . "\xea26" ) + ( "normalize" . "\xea04" ) + ( "npm" . "\xe91c" ) + ( "npm-old" . "\xf17b" ) + ( "nsis" . "\xea1e" ) + ( "nsis-old" . "\xe992" ) + ( "nuclide" . "\xea34" ) + ( "nuget" . "\xe9d9" ) + ( "numpy" . "\xe99d" ) + ( "nunjucks" . "\xe953" ) + ( "nvidia" . "\xe95d" ) + ( "nxc" . "\xea6b" ) + ( "obj" . "\xe9e8" ) + ( "objective-j" . "\xe99e" ) + ( "ocaml" . "\xe91a" ) + ( "octave" . "\xea33" ) + ( "onenote" . "\xe9eb" ) + ( "ooc" . "\xe9cb" ) + ( "opa" . "\x2601" ) + ( "opencl" . "\xe99f" ) + ( "opengl" . "\xea7a" ) + ( "openoffice" . "\xe9e4" ) + ( "openscad" . "\xe911" ) + ( "org" . "\xe917" ) + ( "owl" . "\xe957" ) + ( "ox" . "\xe9a1" ) + ( "oxygene" . "\xe9bf" ) + ( "oz" . "\xe9be" ) + ( "p4" . "\xea50" ) + ( "pan" . "\xe9bd" ) + ( "papyrus" . "\xe9bc" ) + ( "parrot" . "\xe9bb" ) + ( "pascal" . "\xe92a" ) + ( "patch" . "\xe961" ) + ( "pawn" . "\x265f" ) + ( "pb" . "\xea14" ) + ( "pegjs" . "\xea74" ) + ( "raku" . "\xe96c" ) + ( "phalcon" . "\xe94a" ) + ( "phoenix" . "\xea5f" ) + ( "php" . "\xf147" ) + ( "phpunit" . "\xea32" ) + ( "pickle" . "\xe9c4" ) + ( "pike" . "\xe9b9" ) + ( "platformio" . "\xea2c" ) + ( "pm2" . "\x2630" ) + ( "pod" . "\xea84" ) + ( "pogo" . "\xe9b8" ) + ( "pointwise" . "\xe977" ) + ( "polymer" . "\xea2b" ) + ( "pony" . "\xe9b7" ) + ( "postcss" . "\xe910" ) + ( "postscript" . "\xe955" ) + ( "povray" . "\x50" ) + ( "powerpoint" . "\xe9ec" ) + ( "powershell" . "\xe9da" ) + ( "precision" . "\x2295" ) + ( "premiere" . "\xe9f5" ) + ( "processing" . "\xe9a0" ) + ( "progress" . "\xe9c0" ) + ( "propeller" . "\xe9b5" ) + ( "proselint" . "\xea6d" ) + ( "protractor" . "\xe9de" ) + ( "ps" . "\xe6b8" ) + ( "pug" . "\xea13" ) + ( "pug-alt" . "\xe9d0" ) + ( "puppet" . "\xf0c3" ) + ( "purebasic" . "\x1b5" ) + ( "purescript" . "\xe9b2" ) + ( "racket" . "\xe9b1" ) + ( "raml" . "\xe913" ) + ( "rascal" . "\xea24" ) + ( "rdoc" . "\xe9b0" ) + ( "realbasic" . "\xe9af" ) + ( "reason" . "\xea1d" ) + ( "rebol" . "\xe9ae" ) + ( "red" . "\xe9ad" ) + ( "redux" . "\xea30" ) + ( "regex" . "\x2a" ) + ( "rexx" . "\xea16" ) + ( "rhino" . "\xea4a" ) + ( "ring" . "\x1f48d" ) + ( "riot" . "\xe919" ) + ( "robot" . "\xe9ac" ) + ( "rollup" . "\xea20" ) + ( "rollup-old" . "\xe9fd" ) + ( "rot" . "\x1f764" ) + ( "rspec" . "\xea31" ) + ( "rst" . "\xe9cc" ) + ( "sage" . "\xe9ab" ) + ( "saltstack" . "\xe915" ) + ( "sas" . "\xe95a" ) + ( "sbt" . "\xe9d2" ) + ( "sc" . "\xe9a2" ) + ( "scheme" . "\x3bb" ) + ( "scilab" . "\xe9a9" ) + ( "scrutinizer" . "\xe9d4" ) + ( "self" . "\xe9a8" ) + ( "sequelize" . "\xea2f" ) + ( "sf" . "\xe9db" ) + ( "shen" . "\xe9a7" ) + ( "shipit" . "\x26f5" ) + ( "shippable" . "\xea2d" ) + ( "shopify" . "\xe9cf" ) + ( "shuriken" . "\x272b" ) + ( "silverstripe" . "\xe800" ) + ( "sinatra" . "\xea03" ) + ( "sketch" . "\xe927" ) + ( "sketchup-layout" . "\xea7c" ) + ( "sketchup-make" . "\xea7e" ) + ( "sketchup-stylebuilder" . "\xea7d" ) + ( "slash" . "\xe9a6" ) + ( "snyk" . "\xea1c" ) + ( "solidity" . "\xea86" ) + ( "sparql" . "\xe959" ) + ( "spray" . "\xea02" ) + ( "sqf" . "\xe9a5" ) + ( "sqlite" . "\xe9dd" ) + ( "squarespace" . "\xea5e" ) + ( "stan" . "\xe9a4" ) + ( "stata" . "\xe9a3" ) + ( "storyist" . "\xe9ef" ) + ( "strings" . "\xe9e0" ) + ( "stylelint" . "\xe93d" ) + ( "stylus" . "\x73" ) + ( "stylus-full" . "\xe9f7" ) + ( "stylus-orb" . "\x53" ) + ( "sublime" . "\xe986" ) + ( "sv" . "\xe9c3" ) + ( "svn" . "\xea17" ) + ( "swagger" . "\xea29" ) + ( "tag" . "\xf015" ) + ( "tcl" . "\xe956" ) + ( "telegram" . "\x2708" ) + ( "terminal" . "\xf0c8" ) + ( "tern" . "\x1f54a" ) + ( "terraform" . "\xe916" ) + ( "test-coffeescript" . "\xea62" ) + ( "test-dir" . "\xea60" ) + ( "test-generic" . "\xea63" ) + ( "test-js" . "\xea64" ) + ( "test-perl" . "\xea65" ) + ( "test-python" . "\xea66" ) + ( "test-react" . "\xea67" ) + ( "test-ruby" . "\xea68" ) + ( "test-typescript" . "\xea69" ) + ( "tex" . "\xe600" ) + ( "textile" . "\x74" ) + ( "textmate" . "\x2122" ) + ( "thor" . "\xe9d8" ) + ( "tinymce" . "\xea01" ) + ( "tsx" . "\xe9d1" ) + ( "tsx-alt" . "\xe9e7" ) + ( "tt" . "\x54" ) + ( "turing" . "\xe9b6" ) + ( "twig" . "\x2e19" ) + ( "twine" . "\xea5d" ) + ( "txl" . "\xe9c1" ) + ( "typedoc" . "\xe9fe" ) + ( "typescript" . "\xe912" ) + ( "typescript-alt" . "\x2a6" ) + ( "typings" . "\xe9df" ) + ( "uno" . "\xe9b3" ) + ( "unreal" . "\x75" ) + ( "urweb" . "\xe9ba" ) + ( "v8" . "\xea1f" ) + ( "vagrant" . "\x56" ) + ( "vcl" . "\xe9b4" ) + ( "verilog" . "\xe949" ) + ( "vertex-shader" . "\xea79" ) + ( "vhdl" . "\xe9aa" ) + ( "video" . "\xf057" ) + ( "virtualbox" . "\xea3e" ) + ( "virtualbox-alt" . "\xea2e" ) + ( "visio" . "\xea83" ) + ( "vmware" . "\xea49" ) + ( "vue" . "\xe906" ) + ( "wasm" . "\xea70" ) + ( "watchman" . "\xea4f" ) + ( "webgl" . "\xea7b" ) + ( "webpack" . "\xea61" ) + ( "webpack-old" . "\xe91e" ) + ( "wercker" . "\xea19" ) + ( "word" . "\xe9ed" ) + ( "x10" . "\x2169" ) + ( "xamarin" . "\xea77" ) + ( "xmos" . "\x58" ) + ( "xpages" . "\xe9c5" ) + ( "xtend" . "\xe9c6" ) + ( "yarn" . "\xea1a" ) + ( "yasm" . "\xea73" ) + ( "yin-yang" . "\x262f" ) + ( "yoyo" . "\xe975" ) + ( "yui" . "\xea00" ) + ( "zbrush" . "\xe9f2" ) + ( "zephir" . "\xe9c7" ) + ("zig" . "\x7A") + ( "zimpl" . "\xe9c8" ) + + ) + ) + +(provide 'data-fileicons) diff --git a/elpa/all-the-icons-20220325.1238/data/data-fileicons.elc b/elpa/all-the-icons-20220325.1238/data/data-fileicons.elc new file mode 100644 index 0000000..7f11538 Binary files /dev/null and b/elpa/all-the-icons-20220325.1238/data/data-fileicons.elc differ diff --git a/elpa/all-the-icons-20220325.1238/data/data-material.el b/elpa/all-the-icons-20220325.1238/data/data-material.el new file mode 100644 index 0000000..bafcfe7 --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/data/data-material.el @@ -0,0 +1,935 @@ +(defvar all-the-icons-data/material-icons-alist + '(("3d_rotation" . "\xe84d") + ("ac_unit" . "\xeb3b") + ("access_alarm" . "\xe190") + ("access_alarms" . "\xe191") + ("access_time" . "\xe192") + ("accessibility" . "\xe84e") + ("accessible" . "\xe914") + ("account_balance" . "\xe84f") + ("account_balance_wallet" . "\xe850") + ("account_box" . "\xe851") + ("account_circle" . "\xe853") + ("adb" . "\xe60e") + ("add" . "\xe145") + ("add_a_photo" . "\xe439") + ("add_alarm" . "\xe193") + ("add_alert" . "\xe003") + ("add_box" . "\xe146") + ("add_circle" . "\xe147") + ("add_circle_outline" . "\xe148") + ("add_location" . "\xe567") + ("add_shopping_cart" . "\xe854") + ("add_to_photos" . "\xe39d") + ("add_to_queue" . "\xe05c") + ("adjust" . "\xe39e") + ("airline_seat_flat" . "\xe630") + ("airline_seat_flat_angled" . "\xe631") + ("airline_seat_individual_suite" . "\xe632") + ("airline_seat_legroom_extra" . "\xe633") + ("airline_seat_legroom_normal" . "\xe634") + ("airline_seat_legroom_reduced" . "\xe635") + ("airline_seat_recline_extra" . "\xe636") + ("airline_seat_recline_normal" . "\xe637") + ("airplanemode_active" . "\xe195") + ("airplanemode_inactive" . "\xe194") + ("airplay" . "\xe055") + ("airport_shuttle" . "\xeb3c") + ("alarm" . "\xe855") + ("alarm_add" . "\xe856") + ("alarm_off" . "\xe857") + ("alarm_on" . "\xe858") + ("album" . "\xe019") + ("all_inclusive" . "\xeb3d") + ("all_out" . "\xe90b") + ("android" . "\xe859") + ("announcement" . "\xe85a") + ("apps" . "\xe5c3") + ("archive" . "\xe149") + ("arrow_back" . "\xe5c4") + ("arrow_downward" . "\xe5db") + ("arrow_drop_down" . "\xe5c5") + ("arrow_drop_down_circle" . "\xe5c6") + ("arrow_drop_up" . "\xe5c7") + ("arrow_forward" . "\xe5c8") + ("arrow_upward" . "\xe5d8") + ("art_track" . "\xe060") + ("aspect_ratio" . "\xe85b") + ("assessment" . "\xe85c") + ("assignment" . "\xe85d") + ("assignment_ind" . "\xe85e") + ("assignment_late" . "\xe85f") + ("assignment_return" . "\xe860") + ("assignment_returned" . "\xe861") + ("assignment_turned_in" . "\xe862") + ("assistant" . "\xe39f") + ("assistant_photo" . "\xe3a0") + ("attach_file" . "\xe226") + ("attach_money" . "\xe227") + ("attachment" . "\xe2bc") + ("audiotrack" . "\xe3a1") + ("autorenew" . "\xe863") + ("av_timer" . "\xe01b") + ("backspace" . "\xe14a") + ("backup" . "\xe864") + ("battery_alert" . "\xe19c") + ("battery_charging_full" . "\xe1a3") + ("battery_full" . "\xe1a4") + ("battery_std" . "\xe1a5") + ("battery_unknown" . "\xe1a6") + ("beach_access" . "\xeb3e") + ("beenhere" . "\xe52d") + ("block" . "\xe14b") + ("bluetooth" . "\xe1a7") + ("bluetooth_audio" . "\xe60f") + ("bluetooth_connected" . "\xe1a8") + ("bluetooth_disabled" . "\xe1a9") + ("bluetooth_searching" . "\xe1aa") + ("blur_circular" . "\xe3a2") + ("blur_linear" . "\xe3a3") + ("blur_off" . "\xe3a4") + ("blur_on" . "\xe3a5") + ("book" . "\xe865") + ("bookmark" . "\xe866") + ("bookmark_border" . "\xe867") + ("border_all" . "\xe228") + ("border_bottom" . "\xe229") + ("border_clear" . "\xe22a") + ("border_color" . "\xe22b") + ("border_horizontal" . "\xe22c") + ("border_inner" . "\xe22d") + ("border_left" . "\xe22e") + ("border_outer" . "\xe22f") + ("border_right" . "\xe230") + ("border_style" . "\xe231") + ("border_top" . "\xe232") + ("border_vertical" . "\xe233") + ("branding_watermark" . "\xe06b") + ("brightness_1" . "\xe3a6") + ("brightness_2" . "\xe3a7") + ("brightness_3" . "\xe3a8") + ("brightness_4" . "\xe3a9") + ("brightness_5" . "\xe3aa") + ("brightness_6" . "\xe3ab") + ("brightness_7" . "\xe3ac") + ("brightness_auto" . "\xe1ab") + ("brightness_high" . "\xe1ac") + ("brightness_low" . "\xe1ad") + ("brightness_medium" . "\xe1ae") + ("broken_image" . "\xe3ad") + ("brush" . "\xe3ae") + ("bubble_chart" . "\xe6dd") + ("bug_report" . "\xe868") + ("build" . "\xe869") + ("burst_mode" . "\xe43c") + ("business" . "\xe0af") + ("business_center" . "\xeb3f") + ("cached" . "\xe86a") + ("cake" . "\xe7e9") + ("call" . "\xe0b0") + ("call_end" . "\xe0b1") + ("call_made" . "\xe0b2") + ("call_merge" . "\xe0b3") + ("call_missed" . "\xe0b4") + ("call_missed_outgoing" . "\xe0e4") + ("call_received" . "\xe0b5") + ("call_split" . "\xe0b6") + ("call_to_action" . "\xe06c") + ("camera" . "\xe3af") + ("camera_alt" . "\xe3b0") + ("camera_enhance" . "\xe8fc") + ("camera_front" . "\xe3b1") + ("camera_rear" . "\xe3b2") + ("camera_roll" . "\xe3b3") + ("cancel" . "\xe5c9") + ("card_giftcard" . "\xe8f6") + ("card_membership" . "\xe8f7") + ("card_travel" . "\xe8f8") + ("casino" . "\xeb40") + ("cast" . "\xe307") + ("cast_connected" . "\xe308") + ("center_focus_strong" . "\xe3b4") + ("center_focus_weak" . "\xe3b5") + ("change_history" . "\xe86b") + ("chat" . "\xe0b7") + ("chat_bubble" . "\xe0ca") + ("chat_bubble_outline" . "\xe0cb") + ("check" . "\xe5ca") + ("check_box" . "\xe834") + ("check_box_outline_blank" . "\xe835") + ("check_circle" . "\xe86c") + ("chevron_left" . "\xe5cb") + ("chevron_right" . "\xe5cc") + ("child_care" . "\xeb41") + ("child_friendly" . "\xeb42") + ("chrome_reader_mode" . "\xe86d") + ("class" . "\xe86e") + ("clear" . "\xe14c") + ("clear_all" . "\xe0b8") + ("close" . "\xe5cd") + ("closed_caption" . "\xe01c") + ("cloud" . "\xe2bd") + ("cloud_circle" . "\xe2be") + ("cloud_done" . "\xe2bf") + ("cloud_download" . "\xe2c0") + ("cloud_off" . "\xe2c1") + ("cloud_queue" . "\xe2c2") + ("cloud_upload" . "\xe2c3") + ("code" . "\xe86f") + ("collections" . "\xe3b6") + ("collections_bookmark" . "\xe431") + ("color_lens" . "\xe3b7") + ("colorize" . "\xe3b8") + ("comment" . "\xe0b9") + ("compare" . "\xe3b9") + ("compare_arrows" . "\xe915") + ("computer" . "\xe30a") + ("confirmation_number" . "\xe638") + ("contact_mail" . "\xe0d0") + ("contact_phone" . "\xe0cf") + ("contacts" . "\xe0ba") + ("content_copy" . "\xe14d") + ("content_cut" . "\xe14e") + ("content_paste" . "\xe14f") + ("control_point" . "\xe3ba") + ("control_point_duplicate" . "\xe3bb") + ("copyright" . "\xe90c") + ("create" . "\xe150") + ("create_new_folder" . "\xe2cc") + ("credit_card" . "\xe870") + ("crop" . "\xe3be") + ("crop_16_9" . "\xe3bc") + ("crop_3_2" . "\xe3bd") + ("crop_5_4" . "\xe3bf") + ("crop_7_5" . "\xe3c0") + ("crop_din" . "\xe3c1") + ("crop_free" . "\xe3c2") + ("crop_landscape" . "\xe3c3") + ("crop_original" . "\xe3c4") + ("crop_portrait" . "\xe3c5") + ("crop_rotate" . "\xe437") + ("crop_square" . "\xe3c6") + ("dashboard" . "\xe871") + ("data_usage" . "\xe1af") + ("date_range" . "\xe916") + ("dehaze" . "\xe3c7") + ("delete" . "\xe872") + ("delete_forever" . "\xe92b") + ("delete_sweep" . "\xe16c") + ("description" . "\xe873") + ("desktop_mac" . "\xe30b") + ("desktop_windows" . "\xe30c") + ("details" . "\xe3c8") + ("developer_board" . "\xe30d") + ("developer_mode" . "\xe1b0") + ("device_hub" . "\xe335") + ("devices" . "\xe1b1") + ("devices_other" . "\xe337") + ("dialer_sip" . "\xe0bb") + ("dialpad" . "\xe0bc") + ("directions" . "\xe52e") + ("directions_bike" . "\xe52f") + ("directions_boat" . "\xe532") + ("directions_bus" . "\xe530") + ("directions_car" . "\xe531") + ("directions_railway" . "\xe534") + ("directions_run" . "\xe566") + ("directions_subway" . "\xe533") + ("directions_transit" . "\xe535") + ("directions_walk" . "\xe536") + ("disc_full" . "\xe610") + ("dns" . "\xe875") + ("do_not_disturb" . "\xe612") + ("do_not_disturb_alt" . "\xe611") + ("do_not_disturb_off" . "\xe643") + ("do_not_disturb_on" . "\xe644") + ("dock" . "\xe30e") + ("domain" . "\xe7ee") + ("done" . "\xe876") + ("done_all" . "\xe877") + ("donut_large" . "\xe917") + ("donut_small" . "\xe918") + ("drafts" . "\xe151") + ("drag_handle" . "\xe25d") + ("drive_eta" . "\xe613") + ("dvr" . "\xe1b2") + ("edit" . "\xe3c9") + ("edit_location" . "\xe568") + ("eject" . "\xe8fb") + ("email" . "\xe0be") + ("enhanced_encryption" . "\xe63f") + ("equalizer" . "\xe01d") + ("error" . "\xe000") + ("error_outline" . "\xe001") + ("euro_symbol" . "\xe926") + ("ev_station" . "\xe56d") + ("event" . "\xe878") + ("event_available" . "\xe614") + ("event_busy" . "\xe615") + ("event_note" . "\xe616") + ("event_seat" . "\xe903") + ("exit_to_app" . "\xe879") + ("expand_less" . "\xe5ce") + ("expand_more" . "\xe5cf") + ("explicit" . "\xe01e") + ("explore" . "\xe87a") + ("exposure" . "\xe3ca") + ("exposure_neg_1" . "\xe3cb") + ("exposure_neg_2" . "\xe3cc") + ("exposure_plus_1" . "\xe3cd") + ("exposure_plus_2" . "\xe3ce") + ("exposure_zero" . "\xe3cf") + ("extension" . "\xe87b") + ("face" . "\xe87c") + ("fast_forward" . "\xe01f") + ("fast_rewind" . "\xe020") + ("favorite" . "\xe87d") + ("favorite_border" . "\xe87e") + ("featured_play_list" . "\xe06d") + ("featured_video" . "\xe06e") + ("feedback" . "\xe87f") + ("fiber_dvr" . "\xe05d") + ("fiber_manual_record" . "\xe061") + ("fiber_new" . "\xe05e") + ("fiber_pin" . "\xe06a") + ("fiber_smart_record" . "\xe062") + ("file_download" . "\xe2c4") + ("file_upload" . "\xe2c6") + ("filter" . "\xe3d3") + ("filter_1" . "\xe3d0") + ("filter_2" . "\xe3d1") + ("filter_3" . "\xe3d2") + ("filter_4" . "\xe3d4") + ("filter_5" . "\xe3d5") + ("filter_6" . "\xe3d6") + ("filter_7" . "\xe3d7") + ("filter_8" . "\xe3d8") + ("filter_9" . "\xe3d9") + ("filter_9_plus" . "\xe3da") + ("filter_b_and_w" . "\xe3db") + ("filter_center_focus" . "\xe3dc") + ("filter_drama" . "\xe3dd") + ("filter_frames" . "\xe3de") + ("filter_hdr" . "\xe3df") + ("filter_list" . "\xe152") + ("filter_none" . "\xe3e0") + ("filter_tilt_shift" . "\xe3e2") + ("filter_vintage" . "\xe3e3") + ("find_in_page" . "\xe880") + ("find_replace" . "\xe881") + ("fingerprint" . "\xe90d") + ("first_page" . "\xe5dc") + ("fitness_center" . "\xeb43") + ("flag" . "\xe153") + ("flare" . "\xe3e4") + ("flash_auto" . "\xe3e5") + ("flash_off" . "\xe3e6") + ("flash_on" . "\xe3e7") + ("flight" . "\xe539") + ("flight_land" . "\xe904") + ("flight_takeoff" . "\xe905") + ("flip" . "\xe3e8") + ("flip_to_back" . "\xe882") + ("flip_to_front" . "\xe883") + ("folder" . "\xe2c7") + ("folder_open" . "\xe2c8") + ("folder_shared" . "\xe2c9") + ("folder_special" . "\xe617") + ("font_download" . "\xe167") + ("format_align_center" . "\xe234") + ("format_align_justify" . "\xe235") + ("format_align_left" . "\xe236") + ("format_align_right" . "\xe237") + ("format_bold" . "\xe238") + ("format_clear" . "\xe239") + ("format_color_fill" . "\xe23a") + ("format_color_reset" . "\xe23b") + ("format_color_text" . "\xe23c") + ("format_indent_decrease" . "\xe23d") + ("format_indent_increase" . "\xe23e") + ("format_italic" . "\xe23f") + ("format_line_spacing" . "\xe240") + ("format_list_bulleted" . "\xe241") + ("format_list_numbered" . "\xe242") + ("format_paint" . "\xe243") + ("format_quote" . "\xe244") + ("format_shapes" . "\xe25e") + ("format_size" . "\xe245") + ("format_strikethrough" . "\xe246") + ("format_textdirection_l_to_r" . "\xe247") + ("format_textdirection_r_to_l" . "\xe248") + ("format_underlined" . "\xe249") + ("forum" . "\xe0bf") + ("forward" . "\xe154") + ("forward_10" . "\xe056") + ("forward_30" . "\xe057") + ("forward_5" . "\xe058") + ("free_breakfast" . "\xeb44") + ("fullscreen" . "\xe5d0") + ("fullscreen_exit" . "\xe5d1") + ("functions" . "\xe24a") + ("g_translate" . "\xe927") + ("gamepad" . "\xe30f") + ("games" . "\xe021") + ("gavel" . "\xe90e") + ("gesture" . "\xe155") + ("get_app" . "\xe884") + ("gif" . "\xe908") + ("golf_course" . "\xeb45") + ("gps_fixed" . "\xe1b3") + ("gps_not_fixed" . "\xe1b4") + ("gps_off" . "\xe1b5") + ("grade" . "\xe885") + ("gradient" . "\xe3e9") + ("grain" . "\xe3ea") + ("graphic_eq" . "\xe1b8") + ("grid_off" . "\xe3eb") + ("grid_on" . "\xe3ec") + ("group" . "\xe7ef") + ("group_add" . "\xe7f0") + ("group_work" . "\xe886") + ("hd" . "\xe052") + ("hdr_off" . "\xe3ed") + ("hdr_on" . "\xe3ee") + ("hdr_strong" . "\xe3f1") + ("hdr_weak" . "\xe3f2") + ("headset" . "\xe310") + ("headset_mic" . "\xe311") + ("healing" . "\xe3f3") + ("hearing" . "\xe023") + ("help" . "\xe887") + ("help_outline" . "\xe8fd") + ("high_quality" . "\xe024") + ("highlight" . "\xe25f") + ("highlight_off" . "\xe888") + ("history" . "\xe889") + ("home" . "\xe88a") + ("hot_tub" . "\xeb46") + ("hotel" . "\xe53a") + ("hourglass_empty" . "\xe88b") + ("hourglass_full" . "\xe88c") + ("http" . "\xe902") + ("https" . "\xe88d") + ("image" . "\xe3f4") + ("image_aspect_ratio" . "\xe3f5") + ("import_contacts" . "\xe0e0") + ("import_export" . "\xe0c3") + ("important_devices" . "\xe912") + ("inbox" . "\xe156") + ("indeterminate_check_box" . "\xe909") + ("info" . "\xe88e") + ("info_outline" . "\xe88f") + ("input" . "\xe890") + ("insert_chart" . "\xe24b") + ("insert_comment" . "\xe24c") + ("insert_drive_file" . "\xe24d") + ("insert_emoticon" . "\xe24e") + ("insert_invitation" . "\xe24f") + ("insert_link" . "\xe250") + ("insert_photo" . "\xe251") + ("invert_colors" . "\xe891") + ("invert_colors_off" . "\xe0c4") + ("iso" . "\xe3f6") + ("keyboard" . "\xe312") + ("keyboard_arrow_down" . "\xe313") + ("keyboard_arrow_left" . "\xe314") + ("keyboard_arrow_right" . "\xe315") + ("keyboard_arrow_up" . "\xe316") + ("keyboard_backspace" . "\xe317") + ("keyboard_capslock" . "\xe318") + ("keyboard_hide" . "\xe31a") + ("keyboard_return" . "\xe31b") + ("keyboard_tab" . "\xe31c") + ("keyboard_voice" . "\xe31d") + ("kitchen" . "\xeb47") + ("label" . "\xe892") + ("label_outline" . "\xe893") + ("landscape" . "\xe3f7") + ("language" . "\xe894") + ("laptop" . "\xe31e") + ("laptop_chromebook" . "\xe31f") + ("laptop_mac" . "\xe320") + ("laptop_windows" . "\xe321") + ("last_page" . "\xe5dd") + ("launch" . "\xe895") + ("layers" . "\xe53b") + ("layers_clear" . "\xe53c") + ("leak_add" . "\xe3f8") + ("leak_remove" . "\xe3f9") + ("lens" . "\xe3fa") + ("library_add" . "\xe02e") + ("library_books" . "\xe02f") + ("library_music" . "\xe030") + ("lightbulb_outline" . "\xe90f") + ("line_style" . "\xe919") + ("line_weight" . "\xe91a") + ("linear_scale" . "\xe260") + ("link" . "\xe157") + ("linked_camera" . "\xe438") + ("list" . "\xe896") + ("live_help" . "\xe0c6") + ("live_tv" . "\xe639") + ("local_activity" . "\xe53f") + ("local_airport" . "\xe53d") + ("local_atm" . "\xe53e") + ("local_bar" . "\xe540") + ("local_cafe" . "\xe541") + ("local_car_wash" . "\xe542") + ("local_convenience_store" . "\xe543") + ("local_dining" . "\xe556") + ("local_drink" . "\xe544") + ("local_florist" . "\xe545") + ("local_gas_station" . "\xe546") + ("local_grocery_store" . "\xe547") + ("local_hospital" . "\xe548") + ("local_hotel" . "\xe549") + ("local_laundry_service" . "\xe54a") + ("local_library" . "\xe54b") + ("local_mall" . "\xe54c") + ("local_movies" . "\xe54d") + ("local_offer" . "\xe54e") + ("local_parking" . "\xe54f") + ("local_pharmacy" . "\xe550") + ("local_phone" . "\xe551") + ("local_pizza" . "\xe552") + ("local_play" . "\xe553") + ("local_post_office" . "\xe554") + ("local_printshop" . "\xe555") + ("local_see" . "\xe557") + ("local_shipping" . "\xe558") + ("local_taxi" . "\xe559") + ("location_city" . "\xe7f1") + ("location_disabled" . "\xe1b6") + ("location_off" . "\xe0c7") + ("location_on" . "\xe0c8") + ("location_searching" . "\xe1b7") + ("lock" . "\xe897") + ("lock_open" . "\xe898") + ("lock_outline" . "\xe899") + ("looks" . "\xe3fc") + ("looks_3" . "\xe3fb") + ("looks_4" . "\xe3fd") + ("looks_5" . "\xe3fe") + ("looks_6" . "\xe3ff") + ("looks_one" . "\xe400") + ("looks_two" . "\xe401") + ("loop" . "\xe028") + ("loupe" . "\xe402") + ("low_priority" . "\xe16d") + ("loyalty" . "\xe89a") + ("mail" . "\xe158") + ("mail_outline" . "\xe0e1") + ("map" . "\xe55b") + ("markunread" . "\xe159") + ("markunread_mailbox" . "\xe89b") + ("memory" . "\xe322") + ("menu" . "\xe5d2") + ("merge_type" . "\xe252") + ("message" . "\xe0c9") + ("mic" . "\xe029") + ("mic_none" . "\xe02a") + ("mic_off" . "\xe02b") + ("mms" . "\xe618") + ("mode_comment" . "\xe253") + ("mode_edit" . "\xe254") + ("monetization_on" . "\xe263") + ("money_off" . "\xe25c") + ("monochrome_photos" . "\xe403") + ("mood" . "\xe7f2") + ("mood_bad" . "\xe7f3") + ("more" . "\xe619") + ("more_horiz" . "\xe5d3") + ("more_vert" . "\xe5d4") + ("motorcycle" . "\xe91b") + ("mouse" . "\xe323") + ("move_to_inbox" . "\xe168") + ("movie" . "\xe02c") + ("movie_creation" . "\xe404") + ("movie_filter" . "\xe43a") + ("multiline_chart" . "\xe6df") + ("music_note" . "\xe405") + ("music_video" . "\xe063") + ("my_location" . "\xe55c") + ("nature" . "\xe406") + ("nature_people" . "\xe407") + ("navigate_before" . "\xe408") + ("navigate_next" . "\xe409") + ("navigation" . "\xe55d") + ("near_me" . "\xe569") + ("network_cell" . "\xe1b9") + ("network_check" . "\xe640") + ("network_locked" . "\xe61a") + ("network_wifi" . "\xe1ba") + ("new_releases" . "\xe031") + ("next_week" . "\xe16a") + ("nfc" . "\xe1bb") + ("no_encryption" . "\xe641") + ("no_sim" . "\xe0cc") + ("not_interested" . "\xe033") + ("note" . "\xe06f") + ("note_add" . "\xe89c") + ("notifications" . "\xe7f4") + ("notifications_active" . "\xe7f7") + ("notifications_none" . "\xe7f5") + ("notifications_off" . "\xe7f6") + ("notifications_paused" . "\xe7f8") + ("offline_pin" . "\xe90a") + ("ondemand_video" . "\xe63a") + ("opacity" . "\xe91c") + ("open_in_browser" . "\xe89d") + ("open_in_new" . "\xe89e") + ("open_with" . "\xe89f") + ("pages" . "\xe7f9") + ("pageview" . "\xe8a0") + ("palette" . "\xe40a") + ("pan_tool" . "\xe925") + ("panorama" . "\xe40b") + ("panorama_fish_eye" . "\xe40c") + ("panorama_horizontal" . "\xe40d") + ("panorama_vertical" . "\xe40e") + ("panorama_wide_angle" . "\xe40f") + ("party_mode" . "\xe7fa") + ("pause" . "\xe034") + ("pause_circle_filled" . "\xe035") + ("pause_circle_outline" . "\xe036") + ("payment" . "\xe8a1") + ("people" . "\xe7fb") + ("people_outline" . "\xe7fc") + ("perm_camera_mic" . "\xe8a2") + ("perm_contact_calendar" . "\xe8a3") + ("perm_data_setting" . "\xe8a4") + ("perm_device_information" . "\xe8a5") + ("perm_identity" . "\xe8a6") + ("perm_media" . "\xe8a7") + ("perm_phone_msg" . "\xe8a8") + ("perm_scan_wifi" . "\xe8a9") + ("person" . "\xe7fd") + ("person_add" . "\xe7fe") + ("person_outline" . "\xe7ff") + ("person_pin" . "\xe55a") + ("person_pin_circle" . "\xe56a") + ("personal_video" . "\xe63b") + ("pets" . "\xe91d") + ("phone" . "\xe0cd") + ("phone_android" . "\xe324") + ("phone_bluetooth_speaker" . "\xe61b") + ("phone_forwarded" . "\xe61c") + ("phone_in_talk" . "\xe61d") + ("phone_iphone" . "\xe325") + ("phone_locked" . "\xe61e") + ("phone_missed" . "\xe61f") + ("phone_paused" . "\xe620") + ("phonelink" . "\xe326") + ("phonelink_erase" . "\xe0db") + ("phonelink_lock" . "\xe0dc") + ("phonelink_off" . "\xe327") + ("phonelink_ring" . "\xe0dd") + ("phonelink_setup" . "\xe0de") + ("photo" . "\xe410") + ("photo_album" . "\xe411") + ("photo_camera" . "\xe412") + ("photo_filter" . "\xe43b") + ("photo_library" . "\xe413") + ("photo_size_select_actual" . "\xe432") + ("photo_size_select_large" . "\xe433") + ("photo_size_select_small" . "\xe434") + ("picture_as_pdf" . "\xe415") + ("picture_in_picture" . "\xe8aa") + ("picture_in_picture_alt" . "\xe911") + ("pie_chart" . "\xe6c4") + ("pie_chart_outlined" . "\xe6c5") + ("pin_drop" . "\xe55e") + ("place" . "\xe55f") + ("play_arrow" . "\xe037") + ("play_circle_filled" . "\xe038") + ("play_circle_outline" . "\xe039") + ("play_for_work" . "\xe906") + ("playlist_add" . "\xe03b") + ("playlist_add_check" . "\xe065") + ("playlist_play" . "\xe05f") + ("plus_one" . "\xe800") + ("poll" . "\xe801") + ("polymer" . "\xe8ab") + ("pool" . "\xeb48") + ("portable_wifi_off" . "\xe0ce") + ("portrait" . "\xe416") + ("power" . "\xe63c") + ("power_input" . "\xe336") + ("power_settings_new" . "\xe8ac") + ("pregnant_woman" . "\xe91e") + ("present_to_all" . "\xe0df") + ("print" . "\xe8ad") + ("priority_high" . "\xe645") + ("public" . "\xe80b") + ("publish" . "\xe255") + ("query_builder" . "\xe8ae") + ("question_answer" . "\xe8af") + ("queue" . "\xe03c") + ("queue_music" . "\xe03d") + ("queue_play_next" . "\xe066") + ("radio" . "\xe03e") + ("radio_button_checked" . "\xe837") + ("radio_button_unchecked" . "\xe836") + ("rate_review" . "\xe560") + ("receipt" . "\xe8b0") + ("recent_actors" . "\xe03f") + ("record_voice_over" . "\xe91f") + ("redeem" . "\xe8b1") + ("redo" . "\xe15a") + ("refresh" . "\xe5d5") + ("remove" . "\xe15b") + ("remove_circle" . "\xe15c") + ("remove_circle_outline" . "\xe15d") + ("remove_from_queue" . "\xe067") + ("remove_red_eye" . "\xe417") + ("remove_shopping_cart" . "\xe928") + ("reorder" . "\xe8fe") + ("repeat" . "\xe040") + ("repeat_one" . "\xe041") + ("replay" . "\xe042") + ("replay_10" . "\xe059") + ("replay_30" . "\xe05a") + ("replay_5" . "\xe05b") + ("reply" . "\xe15e") + ("reply_all" . "\xe15f") + ("report" . "\xe160") + ("report_problem" . "\xe8b2") + ("restaurant" . "\xe56c") + ("restaurant_menu" . "\xe561") + ("restore" . "\xe8b3") + ("restore_page" . "\xe929") + ("ring_volume" . "\xe0d1") + ("room" . "\xe8b4") + ("room_service" . "\xeb49") + ("rotate_90_degrees_ccw" . "\xe418") + ("rotate_left" . "\xe419") + ("rotate_right" . "\xe41a") + ("rounded_corner" . "\xe920") + ("router" . "\xe328") + ("rowing" . "\xe921") + ("rss_feed" . "\xe0e5") + ("rv_hookup" . "\xe642") + ("satellite" . "\xe562") + ("save" . "\xe161") + ("scanner" . "\xe329") + ("schedule" . "\xe8b5") + ("school" . "\xe80c") + ("screen_lock_landscape" . "\xe1be") + ("screen_lock_portrait" . "\xe1bf") + ("screen_lock_rotation" . "\xe1c0") + ("screen_rotation" . "\xe1c1") + ("screen_share" . "\xe0e2") + ("sd_card" . "\xe623") + ("sd_storage" . "\xe1c2") + ("search" . "\xe8b6") + ("security" . "\xe32a") + ("select_all" . "\xe162") + ("send" . "\xe163") + ("sentiment_dissatisfied" . "\xe811") + ("sentiment_neutral" . "\xe812") + ("sentiment_satisfied" . "\xe813") + ("sentiment_very_dissatisfied" . "\xe814") + ("sentiment_very_satisfied" . "\xe815") + ("settings" . "\xe8b8") + ("settings_applications" . "\xe8b9") + ("settings_backup_restore" . "\xe8ba") + ("settings_bluetooth" . "\xe8bb") + ("settings_brightness" . "\xe8bd") + ("settings_cell" . "\xe8bc") + ("settings_ethernet" . "\xe8be") + ("settings_input_antenna" . "\xe8bf") + ("settings_input_component" . "\xe8c0") + ("settings_input_composite" . "\xe8c1") + ("settings_input_hdmi" . "\xe8c2") + ("settings_input_svideo" . "\xe8c3") + ("settings_overscan" . "\xe8c4") + ("settings_phone" . "\xe8c5") + ("settings_power" . "\xe8c6") + ("settings_remote" . "\xe8c7") + ("settings_system_daydream" . "\xe1c3") + ("settings_voice" . "\xe8c8") + ("share" . "\xe80d") + ("shop" . "\xe8c9") + ("shop_two" . "\xe8ca") + ("shopping_basket" . "\xe8cb") + ("shopping_cart" . "\xe8cc") + ("short_text" . "\xe261") + ("show_chart" . "\xe6e1") + ("shuffle" . "\xe043") + ("signal_cellular_4_bar" . "\xe1c8") + ("signal_cellular_connected_no_internet_4_bar" . "\xe1cd") + ("signal_cellular_no_sim" . "\xe1ce") + ("signal_cellular_null" . "\xe1cf") + ("signal_cellular_off" . "\xe1d0") + ("signal_wifi_4_bar" . "\xe1d8") + ("signal_wifi_4_bar_lock" . "\xe1d9") + ("signal_wifi_off" . "\xe1da") + ("sim_card" . "\xe32b") + ("sim_card_alert" . "\xe624") + ("skip_next" . "\xe044") + ("skip_previous" . "\xe045") + ("slideshow" . "\xe41b") + ("slow_motion_video" . "\xe068") + ("smartphone" . "\xe32c") + ("smoke_free" . "\xeb4a") + ("smoking_rooms" . "\xeb4b") + ("sms" . "\xe625") + ("sms_failed" . "\xe626") + ("snooze" . "\xe046") + ("sort" . "\xe164") + ("sort_by_alpha" . "\xe053") + ("spa" . "\xeb4c") + ("space_bar" . "\xe256") + ("speaker" . "\xe32d") + ("speaker_group" . "\xe32e") + ("speaker_notes" . "\xe8cd") + ("speaker_notes_off" . "\xe92a") + ("speaker_phone" . "\xe0d2") + ("spellcheck" . "\xe8ce") + ("star" . "\xe838") + ("star_border" . "\xe83a") + ("star_half" . "\xe839") + ("stars" . "\xe8d0") + ("stay_current_landscape" . "\xe0d3") + ("stay_current_portrait" . "\xe0d4") + ("stay_primary_landscape" . "\xe0d5") + ("stay_primary_portrait" . "\xe0d6") + ("stop" . "\xe047") + ("stop_screen_share" . "\xe0e3") + ("storage" . "\xe1db") + ("store" . "\xe8d1") + ("store_mall_directory" . "\xe563") + ("straighten" . "\xe41c") + ("streetview" . "\xe56e") + ("strikethrough_s" . "\xe257") + ("style" . "\xe41d") + ("subdirectory_arrow_left" . "\xe5d9") + ("subdirectory_arrow_right" . "\xe5da") + ("subject" . "\xe8d2") + ("subscriptions" . "\xe064") + ("subtitles" . "\xe048") + ("subway" . "\xe56f") + ("supervisor_account" . "\xe8d3") + ("surround_sound" . "\xe049") + ("swap_calls" . "\xe0d7") + ("swap_horiz" . "\xe8d4") + ("swap_vert" . "\xe8d5") + ("swap_vertical_circle" . "\xe8d6") + ("switch_camera" . "\xe41e") + ("switch_video" . "\xe41f") + ("sync" . "\xe627") + ("sync_disabled" . "\xe628") + ("sync_problem" . "\xe629") + ("system_update" . "\xe62a") + ("system_update_alt" . "\xe8d7") + ("tab" . "\xe8d8") + ("tab_unselected" . "\xe8d9") + ("tablet" . "\xe32f") + ("tablet_android" . "\xe330") + ("tablet_mac" . "\xe331") + ("tag_faces" . "\xe420") + ("tap_and_play" . "\xe62b") + ("terrain" . "\xe564") + ("text_fields" . "\xe262") + ("text_format" . "\xe165") + ("textsms" . "\xe0d8") + ("texture" . "\xe421") + ("theaters" . "\xe8da") + ("thumb_down" . "\xe8db") + ("thumb_up" . "\xe8dc") + ("thumbs_up_down" . "\xe8dd") + ("time_to_leave" . "\xe62c") + ("timelapse" . "\xe422") + ("timeline" . "\xe922") + ("timer" . "\xe425") + ("timer_10" . "\xe423") + ("timer_3" . "\xe424") + ("timer_off" . "\xe426") + ("title" . "\xe264") + ("toc" . "\xe8de") + ("today" . "\xe8df") + ("toll" . "\xe8e0") + ("tonality" . "\xe427") + ("touch_app" . "\xe913") + ("toys" . "\xe332") + ("track_changes" . "\xe8e1") + ("traffic" . "\xe565") + ("train" . "\xe570") + ("tram" . "\xe571") + ("transfer_within_a_station" . "\xe572") + ("transform" . "\xe428") + ("translate" . "\xe8e2") + ("trending_down" . "\xe8e3") + ("trending_flat" . "\xe8e4") + ("trending_up" . "\xe8e5") + ("tune" . "\xe429") + ("turned_in" . "\xe8e6") + ("turned_in_not" . "\xe8e7") + ("tv" . "\xe333") + ("unarchive" . "\xe169") + ("undo" . "\xe166") + ("unfold_less" . "\xe5d6") + ("unfold_more" . "\xe5d7") + ("update" . "\xe923") + ("usb" . "\xe1e0") + ("verified_user" . "\xe8e8") + ("vertical_align_bottom" . "\xe258") + ("vertical_align_center" . "\xe259") + ("vertical_align_top" . "\xe25a") + ("vibration" . "\xe62d") + ("video_call" . "\xe070") + ("video_label" . "\xe071") + ("video_library" . "\xe04a") + ("videocam" . "\xe04b") + ("videocam_off" . "\xe04c") + ("videogame_asset" . "\xe338") + ("view_agenda" . "\xe8e9") + ("view_array" . "\xe8ea") + ("view_carousel" . "\xe8eb") + ("view_column" . "\xe8ec") + ("view_comfy" . "\xe42a") + ("view_compact" . "\xe42b") + ("view_day" . "\xe8ed") + ("view_headline" . "\xe8ee") + ("view_list" . "\xe8ef") + ("view_module" . "\xe8f0") + ("view_quilt" . "\xe8f1") + ("view_stream" . "\xe8f2") + ("view_week" . "\xe8f3") + ("vignette" . "\xe435") + ("visibility" . "\xe8f4") + ("visibility_off" . "\xe8f5") + ("voice_chat" . "\xe62e") + ("voicemail" . "\xe0d9") + ("volume_down" . "\xe04d") + ("volume_mute" . "\xe04e") + ("volume_off" . "\xe04f") + ("volume_up" . "\xe050") + ("vpn_key" . "\xe0da") + ("vpn_lock" . "\xe62f") + ("wallpaper" . "\xe1bc") + ("warning" . "\xe002") + ("watch" . "\xe334") + ("watch_later" . "\xe924") + ("wb_auto" . "\xe42c") + ("wb_cloudy" . "\xe42d") + ("wb_incandescent" . "\xe42e") + ("wb_iridescent" . "\xe436") + ("wb_sunny" . "\xe430") + ("wc" . "\xe63d") + ("web" . "\xe051") + ("web_asset" . "\xe069") + ("weekend" . "\xe16b") + ("whatshot" . "\xe80e") + ("widgets" . "\xe1bd") + ("wifi" . "\xe63e") + ("wifi_lock" . "\xe1e1") + ("wifi_tethering" . "\xe1e2") + ("work" . "\xe8f9") + ("wrap_text" . "\xe25b") + ("youtube_searched_for" . "\xe8fa") + ("zoom_in" . "\xe8ff") + ("zoom_out" . "\xe900") + ("zoom_out_map" . "\xe56b"))) + + (provide 'data-material) diff --git a/elpa/all-the-icons-20220325.1238/data/data-material.elc b/elpa/all-the-icons-20220325.1238/data/data-material.elc new file mode 100644 index 0000000..96cb645 Binary files /dev/null and b/elpa/all-the-icons-20220325.1238/data/data-material.elc differ diff --git a/elpa/all-the-icons-20220325.1238/data/data-octicons.el b/elpa/all-the-icons-20220325.1238/data/data-octicons.el new file mode 100644 index 0000000..432251e --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/data/data-octicons.el @@ -0,0 +1,165 @@ +(defvar all-the-icons-data/octicons-alist + '( + + ("alert" . "\xf02d") + ("arrow-down" . "\xf03f") + ("arrow-left" . "\xf040") + ("arrow-right" . "\xf03e") + ("arrow-small-down" . "\xf0a0") + ("arrow-small-left" . "\xf0a1") + ("arrow-small-right" . "\xf071") + ("arrow-small-up" . "\xf09f") + ("arrow-up" . "\xf03d") + ("book" . "\xf007") + ("bookmark" . "\xf07b") + ("briefcase" . "\xf0d3") + ("broadcast" . "\xf048") + ("browser" . "\xf0c5") + ("bug" . "\xf091") + ("calendar" . "\xf068") + ("check" . "\xf03a") + ("checklist" . "\xf076") + ("chevron-down" . "\xf0a3") + ("chevron-left" . "\xf0a4") + ("chevron-right" . "\xf078") + ("chevron-up" . "\xf0a2") + ("circle-slash" . "\xf084") + ("circuit-board" . "\xf0d6") + ("clippy" . "\xf035") + ("clock" . "\xf046") + ("cloud-download" . "\xf00b") + ("cloud-upload" . "\xf00c") + ("code" . "\xf05f") + ("comment" . "\xf02b") + ("comment-discussion" . "\xf04f") + ("credit-card" . "\xf045") + ("dash" . "\xf0ca") + ("dashboard" . "\xf07d") + ("database" . "\xf096") + ("device-camera" . "\xf056") + ("device-camera-video" . "\xf057") + ("device-desktop" . "\xf27c") + ("device-mobile" . "\xf038") + ("diff" . "\xf04d") + ("diff-added" . "\xf06b") + ("diff-ignored" . "\xf099") + ("diff-modified" . "\xf06d") + ("diff-removed" . "\xf06c") + ("diff-renamed" . "\xf06e") + ("ellipsis" . "\xf09a") + ("eye" . "\xf04e") + ("file-binary" . "\xf094") + ("file-code" . "\xf010") + ("file-directory" . "\xf016") + ("file-media" . "\xf012") + ("file-pdf" . "\xf014") + ("file-submodule" . "\xf017") + ("file-symlink-directory" . "\xf0b1") + ("file-symlink-file" . "\xf0b0") + ("file-text" . "\xf011") + ("file-zip" . "\xf013") + ("flame" . "\xf0d2") + ("fold" . "\xf0cc") + ("gear" . "\xf02f") + ("gift" . "\xf042") + ("gist" . "\xf00e") + ("gist-secret" . "\xf08c") + ("git-branch" . "\xf020") + ("git-commit" . "\xf01f") + ("git-compare" . "\xf0ac") + ("git-merge" . "\xf023") + ("git-pull-request" . "\xf009") + ("globe" . "\xf0b6") + ("graph" . "\xf043") + ("beaker" . "\xf0dd") + ("heart" . "\x2665") + ("history" . "\xf07e") + ("home" . "\xf08d") + ("horizontal-rule" . "\xf070") + ("hourglass" . "\xf09e") + ("hubot" . "\xf09d") + ("inbox" . "\xf0cf") + ("info" . "\xf059") + ("issue-closed" . "\xf028") + ("issue-opened" . "\xf026") + ("issue-reopened" . "\xf027") + ("jersey" . "\xf019") + ("key" . "\xf049") + ("keyboard" . "\xf00d") + ("law" . "\xf0d8") + ("light-bulb" . "\xf000") + ("link" . "\xf05c") + ("link-external" . "\xf07f") + ("list-ordered" . "\xf062") + ("list-unordered" . "\xf061") + ("location" . "\xf060") + ("lock" . "\xf06a") + ("logo-github" . "\xf092") + ("mail" . "\xf03b") + ("mail-read" . "\xf03c") + ("mail-reply" . "\xf051") + ("mark-github" . "\xf00a") + ("markdown" . "\xf0c9") + ("megaphone" . "\xf077") + ("mention" . "\xf0be") + ("milestone" . "\xf075") + ("mirror" . "\xf024") + ("mortar-board" . "\xf0d7") + ("mute" . "\xf080") + ("no-newline" . "\xf09c") + ("octoface" . "\xf008") + ("organization" . "\xf037") + ("package" . "\xf0c4") + ("paintcan" . "\xf0d1") + ("pencil" . "\xf058") + ("person" . "\xf018") + ("pin" . "\xf041") + ("plug" . "\xf0d4") + ("plus" . "\xf05d") + ("primitive-dot" . "\xf052") + ("primitive-square" . "\xf053") + ("pulse" . "\xf085") + ("puzzle" . "\xf0c0") + ("question" . "\xf02c") + ("quote" . "\xf063") + ("radio-tower" . "\xf030") + ("repo" . "\xf001") + ("repo-clone" . "\xf04c") + ("repo-force-push" . "\xf04a") + ("repo-forked" . "\xf002") + ("repo-pull" . "\xf006") + ("repo-push" . "\xf005") + ("rocket" . "\xf033") + ("rss" . "\xf034") + ("ruby" . "\xf047") + ("search" . "\xf02e") + ("server" . "\xf097") + ("settings" . "\xf07c") + ("sign-in" . "\xf036") + ("sign-out" . "\xf032") + ("squirrel" . "\xf0b2") + ("star" . "\xf02a") + ("steps" . "\xf0c7") + ("stop" . "\xf08f") + ("sync" . "\xf087") + ("tag" . "\xf015") + ("telescope" . "\xf088") + ("terminal" . "\xf0c8") + ("three-bars" . "\xf05e") + ("thumbsdown" . "\xf0db") + ("thumbsup" . "\xf0da") + ("tools" . "\xf031") + ("trashcan" . "\xf0d0") + ("triangle-down" . "\xf05b") + ("triangle-left" . "\xf044") + ("triangle-right" . "\xf05a") + ("triangle-up" . "\xf0aa") + ("unfold" . "\xf039") + ("unmute" . "\xf0ba") + ("versions" . "\xf064") + ("x" . "\xf081") + ("zap" . "\x26A1") + + )) + +(provide 'data-octicons) diff --git a/elpa/all-the-icons-20220325.1238/data/data-octicons.elc b/elpa/all-the-icons-20220325.1238/data/data-octicons.elc new file mode 100644 index 0000000..3b3968b Binary files /dev/null and b/elpa/all-the-icons-20220325.1238/data/data-octicons.elc differ diff --git a/elpa/all-the-icons-20220325.1238/data/data-weathericons.el b/elpa/all-the-icons-20220325.1238/data/data-weathericons.el new file mode 100644 index 0000000..676581c --- /dev/null +++ b/elpa/all-the-icons-20220325.1238/data/data-weathericons.el @@ -0,0 +1,594 @@ +(defvar all-the-icons-data/weather-icons-alist + '( + + ("alien" . "\xf075") + ("barometer" . "\xf079") + ("celsius" . "\xf03c") + ("cloud" . "\xf041") + ("cloud-down" . "\xf03d") + ("cloud-refresh" . "\xf03e") + ("cloud-up" . "\xf040") + ("cloudy" . "\xf013") + ("cloudy-gusts" . "\xf011") + ("cloudy-windy" . "\xf012") + ("day-cloudy" . "\xf002") + ("day-cloudy-gusts" . "\xf000") + ("day-cloudy-high" . "\xf07d") + ("day-cloudy-windy" . "\xf001") + ("day-fog" . "\xf003") + ("day-hail" . "\xf004") + ("day-haze" . "\xf0b6") + ("day-light-wind" . "\xf0c4") + ("day-lightning" . "\xf005") + ("day-rain" . "\xf008") + ("day-rain-mix" . "\xf006") + ("day-rain-wind" . "\xf007") + ("day-showers" . "\xf009") + ("day-sleet" . "\xf0b2") + ("day-sleet-storm" . "\xf068") + ("day-snow" . "\xf00a") + ("day-snow-thunderstorm" . "\xf06b") + ("day-snow-wind" . "\xf065") + ("day-sprinkle" . "\xf00b") + ("day-storm-showers" . "\xf00e") + ("day-sunny" . "\xf00d") + ("day-sunny-overcast" . "\xf00c") + ("day-thunderstorm" . "\xf010") + ("day-windy" . "\xf085") + ("degrees" . "\xf042") + ("direction-down" . "\xf044") + ("direction-down-left" . "\xf043") + ("direction-down-right" . "\xf088") + ("direction-left" . "\xf048") + ("direction-right" . "\xf04d") + ("direction-up" . "\xf058") + ("direction-up-left" . "\xf087") + ("direction-up-right" . "\xf057") + ("dust" . "\xf063") + ("earthquake" . "\xf0c6") + ("fahrenheit" . "\xf045") + ("fire" . "\xf0c7") + ("flood" . "\xf07c") + ("fog" . "\xf014") + ("forecast-io-clear-day" . "\xf00d") + ("forecast-io-clear-night" . "\xf02e") + ("forecast-io-cloudy" . "\xf013") + ("forecast-io-fog" . "\xf014") + ("forecast-io-hail" . "\xf015") + ("forecast-io-partly-cloudy-day" . "\xf002") + ("forecast-io-partly-cloudy-night" . "\xf031") + ("forecast-io-rain" . "\xf019") + ("forecast-io-sleet" . "\xf0b5") + ("forecast-io-snow" . "\xf01b") + ("forecast-io-thunderstorm" . "\xf01e") + ("forecast-io-tornado" . "\xf056") + ("forecast-io-wind" . "\xf050") + ("gale-warning" . "\xf0cd") + ("hail" . "\xf015") + ("horizon" . "\xf047") + ("horizon-alt" . "\xf046") + ("hot" . "\xf072") + ("humidity" . "\xf07a") + ("hurricane" . "\xf073") + ("hurricane-warning" . "\xf0cf") + ("lightning" . "\xf016") + ("lunar-eclipse" . "\xf070") + ("meteor" . "\xf071") + ("moon-0" . "\xf095") + ("moon-1" . "\xf096") + ("moon-10" . "\xf09f") + ("moon-11" . "\xf0a0") + ("moon-12" . "\xf0a1") + ("moon-13" . "\xf0a2") + ("moon-14" . "\xf0a3") + ("moon-15" . "\xf0a4") + ("moon-16" . "\xf0a5") + ("moon-17" . "\xf0a6") + ("moon-18" . "\xf0a7") + ("moon-19" . "\xf0a8") + ("moon-2" . "\xf097") + ("moon-20" . "\xf0a9") + ("moon-21" . "\xf0aa") + ("moon-22" . "\xf0ab") + ("moon-23" . "\xf0ac") + ("moon-24" . "\xf0ad") + ("moon-25" . "\xf0ae") + ("moon-26" . "\xf0af") + ("moon-27" . "\xf0b0") + ("moon-3" . "\xf098") + ("moon-4" . "\xf099") + ("moon-5" . "\xf09a") + ("moon-6" . "\xf09b") + ("moon-7" . "\xf09c") + ("moon-8" . "\xf09d") + ("moon-9" . "\xf09e") + ("moon-alt-first-quarter" . "\xf0d6") + ("moon-alt-full" . "\xf0dd") + ("moon-alt-new" . "\xf0eb") + ("moon-alt-third-quarter" . "\xf0e4") + ("moon-alt-waning-crescent-1" . "\xf0e5") + ("moon-alt-waning-crescent-2" . "\xf0e6") + ("moon-alt-waning-crescent-3" . "\xf0e7") + ("moon-alt-waning-crescent-4" . "\xf0e8") + ("moon-alt-waning-crescent-5" . "\xf0e9") + ("moon-alt-waning-crescent-6" . "\xf0ea") + ("moon-alt-waning-gibbous-1" . "\xf0de") + ("moon-alt-waning-gibbous-2" . "\xf0df") + ("moon-alt-waning-gibbous-3" . "\xf0e0") + ("moon-alt-waning-gibbous-4" . "\xf0e1") + ("moon-alt-waning-gibbous-5" . "\xf0e2") + ("moon-alt-waning-gibbous-6" . "\xf0e3") + ("moon-alt-waxing-crescent-1" . "\xf0d0") + ("moon-alt-waxing-crescent-2" . "\xf0d1") + ("moon-alt-waxing-crescent-3" . "\xf0d2") + ("moon-alt-waxing-crescent-4" . "\xf0d3") + ("moon-alt-waxing-crescent-5" . "\xf0d4") + ("moon-alt-waxing-crescent-6" . "\xf0d5") + ("moon-alt-waxing-gibbous-1" . "\xf0d7") + ("moon-alt-waxing-gibbous-2" . "\xf0d8") + ("moon-alt-waxing-gibbous-3" . "\xf0d9") + ("moon-alt-waxing-gibbous-4" . "\xf0da") + ("moon-alt-waxing-gibbous-5" . "\xf0db") + ("moon-alt-waxing-gibbous-6" . "\xf0dc") + ("moon-first-quarter" . "\xf09c") + ("moon-full" . "\xf0a3") + ("moon-new" . "\xf095") + ("moon-third-quarter" . "\xf0aa") + ("moon-waning-crescent-1" . "\xf0ab") + ("moon-waning-crescent-2" . "\xf0ac") + ("moon-waning-crescent-3" . "\xf0ad") + ("moon-waning-crescent-4" . "\xf0ae") + ("moon-waning-crescent-5" . "\xf0af") + ("moon-waning-crescent-6" . "\xf0b0") + ("moon-waning-gibbous-1" . "\xf0a4") + ("moon-waning-gibbous-2" . "\xf0a5") + ("moon-waning-gibbous-3" . "\xf0a6") + ("moon-waning-gibbous-4" . "\xf0a7") + ("moon-waning-gibbous-5" . "\xf0a8") + ("moon-waning-gibbous-6" . "\xf0a9") + ("moon-waxing-crescent-1" . "\xf096") + ("moon-waxing-crescent-2" . "\xf097") + ("moon-waxing-crescent-3" . "\xf098") + ("moon-waxing-crescent-4" . "\xf099") + ("moon-waxing-crescent-5" . "\xf09a") + ("moon-waxing-crescent-6" . "\xf09b") + ("moon-waxing-gibbous-1" . "\xf09d") + ("moon-waxing-gibbous-2" . "\xf09e") + ("moon-waxing-gibbous-3" . "\xf09f") + ("moon-waxing-gibbous-4" . "\xf0a0") + ("moon-waxing-gibbous-5" . "\xf0a1") + ("moon-waxing-gibbous-6" . "\xf0a2") + ("moonrise" . "\xf0c9") + ("moonset" . "\xf0ca") + ("na" . "\xf07b") + ("night-alt-cloudy" . "\xf086") + ("night-alt-cloudy-gusts" . "\xf022") + ("night-alt-cloudy-high" . "\xf07e") + ("night-alt-cloudy-windy" . "\xf023") + ("night-alt-hail" . "\xf024") + ("night-alt-lightning" . "\xf025") + ("night-alt-partly-cloudy" . "\xf081") + ("night-alt-rain" . "\xf028") + ("night-alt-rain-mix" . "\xf026") + ("night-alt-rain-wind" . "\xf027") + ("night-alt-showers" . "\xf029") + ("night-alt-sleet" . "\xf0b4") + ("night-alt-sleet-storm" . "\xf06a") + ("night-alt-snow" . "\xf02a") + ("night-alt-snow-thunderstorm" . "\xf06d") + ("night-alt-snow-wind" . "\xf067") + ("night-alt-sprinkle" . "\xf02b") + ("night-alt-storm-showers" . "\xf02c") + ("night-alt-thunderstorm" . "\xf02d") + ("night-clear" . "\xf02e") + ("night-cloudy" . "\xf031") + ("night-cloudy-gusts" . "\xf02f") + ("night-cloudy-high" . "\xf080") + ("night-cloudy-windy" . "\xf030") + ("night-fog" . "\xf04a") + ("night-hail" . "\xf032") + ("night-lightning" . "\xf033") + ("night-partly-cloudy" . "\xf083") + ("night-rain" . "\xf036") + ("night-rain-mix" . "\xf034") + ("night-rain-wind" . "\xf035") + ("night-showers" . "\xf037") + ("night-sleet" . "\xf0b3") + ("night-sleet-storm" . "\xf069") + ("night-snow" . "\xf038") + ("night-snow-thunderstorm" . "\xf06c") + ("night-snow-wind" . "\xf066") + ("night-sprinkle" . "\xf039") + ("night-storm-showers" . "\xf03a") + ("night-thunderstorm" . "\xf03b") + ("owm-200" . "\xf01e") + ("owm-201" . "\xf01e") + ("owm-202" . "\xf01e") + ("owm-210" . "\xf016") + ("owm-211" . "\xf016") + ("owm-212" . "\xf016") + ("owm-221" . "\xf016") + ("owm-230" . "\xf01e") + ("owm-231" . "\xf01e") + ("owm-232" . "\xf01e") + ("owm-300" . "\xf01c") + ("owm-301" . "\xf01c") + ("owm-302" . "\xf019") + ("owm-310" . "\xf017") + ("owm-311" . "\xf019") + ("owm-312" . "\xf019") + ("owm-313" . "\xf01a") + ("owm-314" . "\xf019") + ("owm-321" . "\xf01c") + ("owm-500" . "\xf01c") + ("owm-501" . "\xf019") + ("owm-502" . "\xf019") + ("owm-503" . "\xf019") + ("owm-504" . "\xf019") + ("owm-511" . "\xf017") + ("owm-520" . "\xf01a") + ("owm-521" . "\xf01a") + ("owm-522" . "\xf01a") + ("owm-531" . "\xf01d") + ("owm-600" . "\xf01b") + ("owm-601" . "\xf01b") + ("owm-602" . "\xf0b5") + ("owm-611" . "\xf017") + ("owm-612" . "\xf017") + ("owm-615" . "\xf017") + ("owm-616" . "\xf017") + ("owm-620" . "\xf017") + ("owm-621" . "\xf01b") + ("owm-622" . "\xf01b") + ("owm-701" . "\xf01a") + ("owm-711" . "\xf062") + ("owm-721" . "\xf0b6") + ("owm-731" . "\xf063") + ("owm-741" . "\xf014") + ("owm-761" . "\xf063") + ("owm-762" . "\xf063") + ("owm-771" . "\xf011") + ("owm-781" . "\xf056") + ("owm-800" . "\xf00d") + ("owm-801" . "\xf011") + ("owm-802" . "\xf011") + ("owm-803" . "\xf012") + ("owm-804" . "\xf013") + ("owm-900" . "\xf056") + ("owm-901" . "\xf01d") + ("owm-902" . "\xf073") + ("owm-903" . "\xf076") + ("owm-904" . "\xf072") + ("owm-905" . "\xf021") + ("owm-906" . "\xf015") + ("owm-957" . "\xf050") + ("owm-day-200" . "\xf010") + ("owm-day-201" . "\xf010") + ("owm-day-202" . "\xf010") + ("owm-day-210" . "\xf005") + ("owm-day-211" . "\xf005") + ("owm-day-212" . "\xf005") + ("owm-day-221" . "\xf005") + ("owm-day-230" . "\xf010") + ("owm-day-231" . "\xf010") + ("owm-day-232" . "\xf010") + ("owm-day-300" . "\xf00b") + ("owm-day-301" . "\xf00b") + ("owm-day-302" . "\xf008") + ("owm-day-310" . "\xf008") + ("owm-day-311" . "\xf008") + ("owm-day-312" . "\xf008") + ("owm-day-313" . "\xf008") + ("owm-day-314" . "\xf008") + ("owm-day-321" . "\xf00b") + ("owm-day-500" . "\xf00b") + ("owm-day-501" . "\xf008") + ("owm-day-502" . "\xf008") + ("owm-day-503" . "\xf008") + ("owm-day-504" . "\xf008") + ("owm-day-511" . "\xf006") + ("owm-day-520" . "\xf009") + ("owm-day-521" . "\xf009") + ("owm-day-522" . "\xf009") + ("owm-day-531" . "\xf00e") + ("owm-day-600" . "\xf00a") + ("owm-day-601" . "\xf0b2") + ("owm-day-602" . "\xf00a") + ("owm-day-611" . "\xf006") + ("owm-day-612" . "\xf006") + ("owm-day-615" . "\xf006") + ("owm-day-616" . "\xf006") + ("owm-day-620" . "\xf006") + ("owm-day-621" . "\xf00a") + ("owm-day-622" . "\xf00a") + ("owm-day-701" . "\xf009") + ("owm-day-711" . "\xf062") + ("owm-day-721" . "\xf0b6") + ("owm-day-731" . "\xf063") + ("owm-day-741" . "\xf003") + ("owm-day-761" . "\xf063") + ("owm-day-762" . "\xf063") + ("owm-day-781" . "\xf056") + ("owm-day-800" . "\xf00d") + ("owm-day-801" . "\xf000") + ("owm-day-802" . "\xf000") + ("owm-day-803" . "\xf000") + ("owm-day-804" . "\xf00c") + ("owm-day-900" . "\xf056") + ("owm-day-902" . "\xf073") + ("owm-day-903" . "\xf076") + ("owm-day-904" . "\xf072") + ("owm-day-906" . "\xf004") + ("owm-day-957" . "\xf050") + ("owm-night-200" . "\xf02d") + ("owm-night-201" . "\xf02d") + ("owm-night-202" . "\xf02d") + ("owm-night-210" . "\xf025") + ("owm-night-211" . "\xf025") + ("owm-night-212" . "\xf025") + ("owm-night-221" . "\xf025") + ("owm-night-230" . "\xf02d") + ("owm-night-231" . "\xf02d") + ("owm-night-232" . "\xf02d") + ("owm-night-300" . "\xf02b") + ("owm-night-301" . "\xf02b") + ("owm-night-302" . "\xf028") + ("owm-night-310" . "\xf028") + ("owm-night-311" . "\xf028") + ("owm-night-312" . "\xf028") + ("owm-night-313" . "\xf028") + ("owm-night-314" . "\xf028") + ("owm-night-321" . "\xf02b") + ("owm-night-500" . "\xf02b") + ("owm-night-501" . "\xf028") + ("owm-night-502" . "\xf028") + ("owm-night-503" . "\xf028") + ("owm-night-504" . "\xf028") + ("owm-night-511" . "\xf026") + ("owm-night-520" . "\xf029") + ("owm-night-521" . "\xf029") + ("owm-night-522" . "\xf029") + ("owm-night-531" . "\xf02c") + ("owm-night-600" . "\xf02a") + ("owm-night-601" . "\xf0b4") + ("owm-night-602" . "\xf02a") + ("owm-night-611" . "\xf026") + ("owm-night-612" . "\xf026") + ("owm-night-615" . "\xf026") + ("owm-night-616" . "\xf026") + ("owm-night-620" . "\xf026") + ("owm-night-621" . "\xf02a") + ("owm-night-622" . "\xf02a") + ("owm-night-701" . "\xf029") + ("owm-night-711" . "\xf062") + ("owm-night-721" . "\xf0b6") + ("owm-night-731" . "\xf063") + ("owm-night-741" . "\xf04a") + ("owm-night-761" . "\xf063") + ("owm-night-762" . "\xf063") + ("owm-night-781" . "\xf056") + ("owm-night-800" . "\xf02e") + ("owm-night-801" . "\xf022") + ("owm-night-802" . "\xf022") + ("owm-night-803" . "\xf022") + ("owm-night-804" . "\xf086") + ("owm-night-900" . "\xf056") + ("owm-night-902" . "\xf073") + ("owm-night-903" . "\xf076") + ("owm-night-904" . "\xf072") + ("owm-night-906" . "\xf024") + ("owm-night-957" . "\xf050") + ("rain" . "\xf019") + ("rain-mix" . "\xf017") + ("rain-wind" . "\xf018") + ("raindrop" . "\xf078") + ("raindrops" . "\xf04e") + ("refresh" . "\xf04c") + ("refresh-alt" . "\xf04b") + ("sandstorm" . "\xf082") + ("showers" . "\xf01a") + ("sleet" . "\xf0b5") + ("small-craft-advisory" . "\xf0cc") + ("smog" . "\xf074") + ("smoke" . "\xf062") + ("snow" . "\xf01b") + ("snow" . "\xf01b") + ("snow-wind" . "\xf064") + ("snowflake-cold" . "\xf076") + ("solar-eclipse" . "\xf06e") + ("sprinkle" . "\xf01c") + ("stars" . "\xf077") + ("storm-showers" . "\xf01d") + ("storm-showers" . "\xf01d") + ("storm-warning" . "\xf0ce") + ("strong-wind" . "\xf050") + ("sunrise" . "\xf051") + ("sunset" . "\xf052") + ("thermometer" . "\xf055") + ("thermometer-exterior" . "\xf053") + ("thermometer-internal" . "\xf054") + ("thunderstorm" . "\xf01e") + ("thunderstorm" . "\xf01e") + ("time-1" . "\xf08a") + ("time-10" . "\xf093") + ("time-11" . "\xf094") + ("time-12" . "\xf089") + ("time-2" . "\xf08b") + ("time-3" . "\xf08c") + ("time-4" . "\xf08d") + ("time-5" . "\xf08e") + ("time-6" . "\xf08f") + ("time-7" . "\xf090") + ("time-8" . "\xf091") + ("time-9" . "\xf092") + ("tornado" . "\xf056") + ("train" . "\xf0cb") + ("tsunami" . "\xf0c5") + ("umbrella" . "\xf084") + ("volcano" . "\xf0c8") + ("wind-beaufort-0" . "\xf0b7") + ("wind-beaufort-1" . "\xf0b8") + ("wind-beaufort-10" . "\xf0c1") + ("wind-beaufort-11" . "\xf0c2") + ("wind-beaufort-12" . "\xf0c3") + ("wind-beaufort-2" . "\xf0b9") + ("wind-beaufort-3" . "\xf0ba") + ("wind-beaufort-4" . "\xf0bb") + ("wind-beaufort-5" . "\xf0bc") + ("wind-beaufort-6" . "\xf0bd") + ("wind-beaufort-7" . "\xf0be") + ("wind-beaufort-8" . "\xf0bf") + ("wind-beaufort-9" . "\xf0c0") + ("wind-direction" . "\xf0b1") + ("windy" . "\xf021") + ("wmo4680-00" . "\xf055") + ("wmo4680-01" . "\xf013") + ("wmo4680-02" . "\xf055") + ("wmo4680-03" . "\xf013") + ("wmo4680-04" . "\xf014") + ("wmo4680-05" . "\xf014") + ("wmo4680-10" . "\xf014") + ("wmo4680-11" . "\xf014") + ("wmo4680-12" . "\xf016") + ("wmo4680-18" . "\xf050") + ("wmo4680-20" . "\xf014") + ("wmo4680-21" . "\xf017") + ("wmo4680-22" . "\xf017") + ("wmo4680-23" . "\xf019") + ("wmo4680-24" . "\xf01b") + ("wmo4680-25" . "\xf015") + ("wmo4680-26" . "\xf01e") + ("wmo4680-27" . "\xf063") + ("wmo4680-28" . "\xf063") + ("wmo4680-29" . "\xf063") + ("wmo4680-30" . "\xf014") + ("wmo4680-31" . "\xf014") + ("wmo4680-32" . "\xf014") + ("wmo4680-33" . "\xf014") + ("wmo4680-34" . "\xf014") + ("wmo4680-35" . "\xf014") + ("wmo4680-40" . "\xf017") + ("wmo4680-41" . "\xf01c") + ("wmo4680-42" . "\xf019") + ("wmo4680-43" . "\xf01c") + ("wmo4680-44" . "\xf019") + ("wmo4680-45" . "\xf015") + ("wmo4680-46" . "\xf015") + ("wmo4680-47" . "\xf01b") + ("wmo4680-48" . "\xf01b") + ("wmo4680-50" . "\xf01c") + ("wmo4680-51" . "\xf01c") + ("wmo4680-52" . "\xf019") + ("wmo4680-53" . "\xf019") + ("wmo4680-54" . "\xf076") + ("wmo4680-55" . "\xf076") + ("wmo4680-56" . "\xf076") + ("wmo4680-57" . "\xf01c") + ("wmo4680-58" . "\xf019") + ("wmo4680-60" . "\xf01c") + ("wmo4680-61" . "\xf01c") + ("wmo4680-62" . "\xf019") + ("wmo4680-63" . "\xf019") + ("wmo4680-64" . "\xf015") + ("wmo4680-65" . "\xf015") + ("wmo4680-66" . "\xf015") + ("wmo4680-67" . "\xf017") + ("wmo4680-68" . "\xf017") + ("wmo4680-70" . "\xf01b") + ("wmo4680-71" . "\xf01b") + ("wmo4680-72" . "\xf01b") + ("wmo4680-73" . "\xf01b") + ("wmo4680-74" . "\xf076") + ("wmo4680-75" . "\xf076") + ("wmo4680-76" . "\xf076") + ("wmo4680-77" . "\xf01b") + ("wmo4680-78" . "\xf076") + ("wmo4680-80" . "\xf019") + ("wmo4680-81" . "\xf01c") + ("wmo4680-82" . "\xf019") + ("wmo4680-83" . "\xf019") + ("wmo4680-84" . "\xf01d") + ("wmo4680-85" . "\xf017") + ("wmo4680-86" . "\xf017") + ("wmo4680-87" . "\xf017") + ("wmo4680-89" . "\xf015") + ("wmo4680-90" . "\xf016") + ("wmo4680-91" . "\xf01d") + ("wmo4680-92" . "\xf01e") + ("wmo4680-93" . "\xf01e") + ("wmo4680-94" . "\xf016") + ("wmo4680-95" . "\xf01e") + ("wmo4680-96" . "\xf01e") + ("wmo4680-99" . "\xf056") + ("wu-chanceflurries" . "\xf064") + ("wu-chancerain" . "\xf019") + ("wu-chancesleat" . "\xf0b5") + ("wu-chancesnow" . "\xf01b") + ("wu-chancetstorms" . "\xf01e") + ("wu-clear" . "\xf00d") + ("wu-cloudy" . "\xf002") + ("wu-flurries" . "\xf064") + ("wu-hazy" . "\xf0b6") + ("wu-mostlycloudy" . "\xf002") + ("wu-mostlysunny" . "\xf00d") + ("wu-partlycloudy" . "\xf002") + ("wu-partlysunny" . "\xf00d") + ("wu-rain" . "\xf01a") + ("wu-sleat" . "\xf0b5") + ("wu-snow" . "\xf01b") + ("wu-sunny" . "\xf00d") + ("wu-tstorms" . "\xf01e") + ("wu-unknown" . "\xf00d") + ("yahoo-0" . "\xf056") + ("yahoo-1" . "\xf00e") + ("yahoo-10" . "\xf015") + ("yahoo-11" . "\xf01a") + ("yahoo-12" . "\xf01a") + ("yahoo-13" . "\xf01b") + ("yahoo-14" . "\xf00a") + ("yahoo-15" . "\xf064") + ("yahoo-16" . "\xf01b") + ("yahoo-17" . "\xf015") + ("yahoo-18" . "\xf017") + ("yahoo-19" . "\xf063") + ("yahoo-2" . "\xf073") + ("yahoo-20" . "\xf014") + ("yahoo-21" . "\xf021") + ("yahoo-22" . "\xf062") + ("yahoo-23" . "\xf050") + ("yahoo-24" . "\xf050") + ("yahoo-25" . "\xf076") + ("yahoo-26" . "\xf013") + ("yahoo-27" . "\xf031") + ("yahoo-28" . "\xf002") + ("yahoo-29" . "\xf031") + ("yahoo-3" . "\xf01e") + ("yahoo-30" . "\xf002") + ("yahoo-31" . "\xf02e") + ("yahoo-32" . "\xf00d") + ("yahoo-3200" . "\xf077") + ("yahoo-33" . "\xf083") + ("yahoo-34" . "\xf00c") + ("yahoo-35" . "\xf017") + ("yahoo-36" . "\xf072") + ("yahoo-37" . "\xf00e") + ("yahoo-38" . "\xf00e") + ("yahoo-39" . "\xf00e") + ("yahoo-4" . "\xf01e") + ("yahoo-40" . "\xf01a") + ("yahoo-41" . "\xf064") + ("yahoo-42" . "\xf01b") + ("yahoo-43" . "\xf064") + ("yahoo-44" . "\xf00c") + ("yahoo-45" . "\xf00e") + ("yahoo-46" . "\xf01b") + ("yahoo-47" . "\xf00e") + ("yahoo-5" . "\xf017") + ("yahoo-6" . "\xf017") + ("yahoo-7" . "\xf017") + ("yahoo-8" . "\xf015") + ("yahoo-9" . "\xf01a") + + )) + +(provide 'data-weathericons) diff --git a/elpa/all-the-icons-20220325.1238/data/data-weathericons.elc b/elpa/all-the-icons-20220325.1238/data/data-weathericons.elc new file mode 100644 index 0000000..0e10e04 Binary files /dev/null and b/elpa/all-the-icons-20220325.1238/data/data-weathericons.elc differ diff --git a/elpa/archives/gnu/archive-contents b/elpa/archives/gnu/archive-contents new file mode 100644 index 0000000..9bc5840 --- /dev/null +++ b/elpa/archives/gnu/archive-contents @@ -0,0 +1,3501 @@ +(1 + (ace-window . + [(0 10 0) + ((avy + (0 5 0))) + "Quickly switch windows." tar + ((:url . "https://github.com/abo-abo/ace-window") + (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") + (:authors + ("Oleh Krehel" . "ohwoeowho@gmail.com")) + (:keywords "window" "location"))]) + (ack . + [(1 10) + nil "interface to ack-like tools" tar + ((:url . "https://github.com/leoliu/ack-el") + (:maintainer "João Távora" . "joaotavora@gmail.com") + (:authors + ("Leo Liu" . "sdl.web@gmail.com")) + (:keywords "tools" "processes" "convenience"))]) + (ada-mode . + [(7 2 0) + ((uniquify-files + (1 0 1)) + (wisi + (3 1 5)) + (emacs + (25 3))) + "major-mode for editing Ada sources" tar + ((:url . "http://www.nongnu.org/ada-mode/") + (:keywords "languages" "ada") + (:maintainer "Stephen Leake" . "stephen_leake@stephe-leake.org") + (:authors + ("Stephen Leake" . "stephen_leake@stephe-leake.org")))]) + (ada-ref-man . + [(2020 1) + nil "Ada Reference Manual 2012" tar + ((:url . "http://stephe-leake.org/ada/arm.html") + (:maintainer "Stephen Leake" . "stephen_leake@member.fsf.org") + (:authors + ("Stephen Leake" . "stephen_leake@member.fsf.org")) + (:keywords "languages" "ada"))]) + (adaptive-wrap . + [(0 8) + nil "Smart line-wrapping with wrap-prefix" tar + ((:maintainer "Stephen Berman" . "stephen.berman@gmx.net") + (:authors + ("Stephen Berman" . "stephen.berman@gmx.net") + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:url . "https://elpa.gnu.org/packages/adaptive-wrap.html"))]) + (adjust-parens . + [(3 1) + nil "Indent and dedent Lisp code, automatically adjust close parens" tar + ((:maintainer "Barry O'Reilly" . "gundaetiapo@gmail.com") + (:authors + ("Barry O'Reilly" . "gundaetiapo@gmail.com")) + (:url . "http://elpa.gnu.org/packages/adjust-parens.html"))]) + (advice-patch . + [(0 1) + ((emacs + (24 4))) + "Use patches to advise the inside of functions" single + ((:url . "http://elpa.gnu.org/packages/advice-patch.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (aggressive-completion . + [(1 7) + ((emacs + (27 1))) + "Automatic minibuffer completion" tar + ((:keywords "minibuffer" "completion") + (:maintainer "Tassilo Horn" . "tsdh@gnu.org") + (:authors + ("Tassilo Horn" . "tsdh@gnu.org")) + (:url . "https://elpa.gnu.org/packages/aggressive-completion.html") + (:commit . "d92bf2428133b6e261780e16b7030afe91d3668e"))]) + (aggressive-indent . + [(1 10 0) + ((emacs + (24 3))) + "Minor mode to aggressively keep your code always indented" tar + ((:url . "https://github.com/Malabarba/aggressive-indent-mode") + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:keywords "indent" "lisp" "maint" "tools"))]) + (ahungry-theme . + [(1 10 0) + ((emacs + (24))) + "Ahungry color theme for Emacs. Make sure to (load-theme 'ahungry)." tar + ((:url . "https://github.com/ahungry/color-theme-ahungry") + (:maintainer "Matthew Carter" . "m@ahungry.com") + (:authors + ("Matthew Carter" . "m@ahungry.com")) + (:keywords "ahungry" "palette" "color" "theme" "emacs" "color-theme" "deftheme"))]) + (all . + [(1 0) + nil "Edit all lines matching a given regexp" single + ((:url . "http://elpa.gnu.org/packages/all.html") + (:keywords "matching") + (:authors + ("Per Abrahamsen" . "per.abrahamsen@gmail.com")) + (:maintainer "Per Abrahamsen" . "per.abrahamsen@gmail.com"))]) + (ampc . + [(0 2) + nil "Asynchronous Music Player Controller" single + ((:url . "http://elpa.gnu.org/packages/ampc.html") + (:keywords "ampc" "mpc" "mpd") + (:authors + ("Christopher Schmidt" . "christopher@ch.ristopher.com")) + (:maintainer nil . "emacs-devel@gnu.org"))]) + (arbitools . + [(0 977) + ((cl-lib + (0 5))) + "Package for chess tournaments administration" single + ((:url . "http://elpa.gnu.org/packages/arbitools.html") + (:authors + ("David Gonzalez Gandara" . "dggandara@member.fsf.org")) + (:maintainer "David Gonzalez Gandara" . "dggandara@member.fsf.org"))]) + (ascii-art-to-unicode . + [(1 13) + nil "a small artist adjunct" single + ((:keywords "ascii" "unicode" "box-drawing") + (:authors + ("Thien-Thi Nguyen" . "ttn@gnu.org")) + (:maintainer "Thien-Thi Nguyen" . "ttn@gnu.org") + (:url . "http://www.gnuvola.org/software/aa2u/"))]) + (async . + [(1 9 5) + ((emacs + (24 3))) + "Asynchronous processing in Emacs" tar + ((:url . "https://github.com/jwiegley/emacs-async") + (:maintainer "John Wiegley" . "jwiegley@gmail.com") + (:authors + ("John Wiegley" . "jwiegley@gmail.com")) + (:keywords "async"))]) + (auctex . + [(13 1 3) + ((emacs + (25 1))) + "Integrated environment for *TeX*" tar + ((:url . "https://www.gnu.org/software/auctex/") + (:keywords "tex" "latex" "texinfo" "context" "doctex" "preview-latex") + (:maintainer nil . "auctex-devel@gnu.org") + (:commit . "b91f15b3a375445985143ed1d6e41490ea62780a"))]) + (aumix-mode . + [(7) + nil "run the aumix program in a buffer" single + ((:keywords "multimedia" "mixer" "aumix") + (:authors + ("Kevin Ryde" . "user42_kevin@yahoo.com.au")) + (:maintainer "Kevin Ryde" . "user42_kevin@yahoo.com.au") + (:url . "http://user42.tuxfamily.org/aumix-mode/index.html"))]) + (auto-correct . + [(1 1 4) + nil "Remembers and automatically fixes past corrections" single + ((:url . "http://elpa.gnu.org/packages/auto-correct.html") + (:keywords "editing") + (:authors + ("Ian Dunn" . "dunni@gnu.org")) + (:maintainer "Ian Dunn" . "dunni@gnu.org"))]) + (auto-overlays . + [(0 10 10) + ((cl-lib + (0 5))) + "Automatic regexp-delimited overlays" tar + ((:url . "http://www.dr-qubit.org/tags/computing-code-emacs.html") + (:maintainer "Toby Cubitt" . "toby-predictive@dr-qubit.org") + (:authors + ("Toby Cubitt" . "toby-predictive@dr-qubit.org")) + (:keywords "extensions"))]) + (avy . + [(0 5 0) + ((emacs + (24 1)) + (cl-lib + (0 5))) + "Jump to arbitrary positions in visible text and select text quickly." tar + ((:url . "https://github.com/abo-abo/avy") + (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") + (:authors + ("Oleh Krehel" . "ohwoeowho@gmail.com")) + (:keywords "point" "location"))]) + (bbdb . + [(3 2 2 2) + ((emacs + (24)) + (cl-lib + (0 5))) + "Big Brother DataBase" tar + ((:maintainer "Roland Winkler" . "winkler@gnu.org") + (:url . "https://elpa.gnu.org/packages/bbdb.html") + (:commit . "715f35b5f53d6bcdcb3754b4f98933df01b57c15"))]) + (beacon . + [(1 3 3) + ((seq + (2 14))) + "Highlight the cursor whenever the window scrolls" single + ((:keywords "convenience") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") + (:url . "https://github.com/Malabarba/beacon"))]) + (blist . + [(0 1) + nil "Display bookmarks in an ibuffer way" tar + ((:keywords "convenience") + (:maintainer "Durand" . "mmemmew@gmail.com") + (:authors + ("Durand" . "mmemmew@gmail.com")) + (:url . "https://elpa.gnu.org/packages/blist.html"))]) + (bluetooth . + [(0 3 1) + ((emacs + (25 1)) + (dash + (2 18 1))) + "A Major mode for Bluetooth devices" tar + ((:url . "https://gitlab.com/rstocker/emacs-bluetooth") + (:keywords "hardware") + (:maintainer "Raffael Stocker" . "r.stocker@mnet-mail.de") + (:authors + ("Raffael Stocker" . "r.stocker@mnet-mail.de") + ("Etienne Prud’homme" . "e.e.f.prudhomme@gmail.com")) + (:commit . "84488dfdd2355e512f9e9444a233448221b3d9cc"))]) + (bnf-mode . + [(0 4 5) + ((cl-lib + (0 5)) + (emacs + (24 3))) + "Major mode for editing BNF grammars." tar + ((:url . "https://github.com/sergeyklay/bnf-mode") + (:maintainer "Serghei Iakovlev" . "egrep@protonmail.ch") + (:authors + ("Serghei Iakovlev" . "egrep@protonmail.ch")) + (:keywords "languages"))]) + (boxy . + [(1 0 5) + ((emacs + (26 1))) + "A boxy layout framework" tar + ((:url . "https://gitlab.com/tygrdev/boxy.el") + (:keywords "tools") + (:maintainer "Tyler Grinn" . "tylergrinn@gmail.com") + (:authors + ("Tyler Grinn" . "tylergrinn@gmail.com")) + (:commit . "3a949d5b14349f33f27bc5041178445a0fedcc6c"))]) + (boxy-headings . + [(2 1 2) + ((emacs + (26 1)) + (boxy + (1 0)) + (org + (9 3))) + "View org files in a boxy diagram" tar + ((:url . "https://gitlab.com/tygrdev/boxy-headings") + (:keywords "tools") + (:maintainer "Tyler Grinn" . "tylergrinn@gmail.com") + (:authors + ("Tyler Grinn" . "tylergrinn@gmail.com")))]) + (brief . + [(5 87) + nil "Brief Editor Emulator (Brief Mode)" tar + ((:maintainer "Luke Lee" . "luke.yx.lee@gmail.com") + (:authors + ("Luke Lee" . "luke.yx.lee@gmail.com")) + (:keywords "brief" "emulations" "crisp") + (:url . "http://elpa.gnu.org/packages/brief.html"))]) + (buffer-env . + [(0 3) + ((emacs + (27 1))) + "Buffer-local process environments" tar + ((:url . "https://github.com/astoff/buffer-env") + (:keywords "processes" "tools") + (:maintainer "Augusto Stoffel" . "arstoffel@gmail.com") + (:authors + ("Augusto Stoffel" . "arstoffel@gmail.com")) + (:commit . "ba1c9d24d3f1ba58445cbf1f762ba6859b66f6bf"))]) + (buffer-expose . + [(0 4 3) + ((emacs + (25)) + (cl-lib + (0 5))) + "Visual buffer switching using a window grid" single + ((:keywords "convenience") + (:authors + ("Clemens Radermacher" . "clemera@posteo.net")) + (:maintainer "Clemens Radermacher" . "clemera@posteo.net") + (:url . "https://github.com/clemera/buffer-expose"))]) + (bug-hunter . + [(1 3 1) + ((seq + (1 3)) + (cl-lib + (0 5))) + "Hunt down errors by bisecting elisp files" tar + ((:url . "https://github.com/Malabarba/elisp-bug-hunter") + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:keywords "lisp"))]) + (cape . + [(0 7) + ((emacs + (27 1))) + "Completion At Point Extensions" tar + ((:url . "https://github.com/minad/cape") + (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") + (:authors + ("Daniel Mendler" . "mail@daniel-mendler.de")) + (:commit . "51b9bf1276445faebfbad636d9b6a39dc57b22bc"))]) + (capf-autosuggest . + [(0 3) + ((emacs + (25 1))) + "History autosuggestions for comint and eshell" tar + ((:url . "https://repo.or.cz/emacs-capf-autosuggest.git") + (:maintainer "jakanakaevangeli" . "jakanakaevangeli@chiru.no") + (:authors + ("jakanakaevangeli" . "jakanakaevangeli@chiru.no")))]) + (caps-lock . + [(1 0) + nil "Caps-lock as a minor mode" single + ((:url . "http://elpa.gnu.org/packages/caps-lock.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (captain . + [(1 0 3) + nil "CAPiTalization is Automatic IN emacs" single + ((:url . "http://elpa.gnu.org/packages/captain.html") + (:keywords "editing") + (:authors + ("Ian Dunn" . "dunni@gnu.org")) + (:maintainer "Ian Dunn" . "dunni@gnu.org"))]) + (chess . + [(2 0 5) + ((cl-lib + (0 5))) + "Play chess in GNU Emacs" tar + ((:maintainer "Mario Lang" . "mlang@delysid.org") + (:authors + ("John Wiegley" . "johnw@gnu.org")) + (:keywords "games") + (:url . "http://elpa.gnu.org/packages/chess.html"))]) + (cl-generic . + [(0 3) + nil "Forward cl-generic compatibility for Emacs<25" single + ((:url . "http://elpa.gnu.org/packages/cl-generic.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (cl-lib . + [(0 7) + nil "Forward cl-lib compatibility library for Emacs<24.3" tar + ((:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:url . "https://elpa.gnu.org/packages/cl-lib.html"))]) + (cl-print . + [(1 0) + ((emacs + (25))) + "CL-style generic printing" single + ((:url . "http://elpa.gnu.org/packages/cl-print.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (clipboard-collector . + [(0 3) + ((emacs + (25))) + "Collect clipboard entries according to regex rules" tar + ((:url . "https://github.com/clemera/clipboard-collector") + (:maintainer "Clemens Radermacher" . "clemera@posteo.net") + (:authors + ("Clemens Radermacher" . "clemera@posteo.net")) + (:keywords "convenience"))]) + (cobol-mode . + [(1 0 0) + ((cl-lib + (0 5))) + "Mode for editing COBOL code" single + ((:url . "http://elpa.gnu.org/packages/cobol-mode.html") + (:keywords "languages") + (:authors + ("Edward Hart" . "edward.dan.hart@gmail.com")) + (:maintainer "Edward Hart" . "edward.dan.hart@gmail.com"))]) + (code-cells . + [(0 2) + ((emacs + (27 1))) + "Lightweight notebooks with support for ipynb files" tar + ((:url . "https://github.com/astoff/code-cells.el") + (:keywords "convenience" "outlines") + (:maintainer "Augusto Stoffel" . "arstoffel@gmail.com") + (:authors + ("Augusto Stoffel" . "arstoffel@gmail.com")) + (:commit . "ea7799c447066fee78c4efbafbdaf09520c7109d"))]) + (coffee-mode . + [(0 4 1 1) + nil "Major mode for CoffeeScript files" single + ((:keywords "coffeescript" "major" "mode") + (:authors + ("Chris Wanstrath" . "chris@ozmm.org")) + (:maintainer "Chris Wanstrath" . "chris@ozmm.org") + (:url . "http://github.com/defunkt/coffee-mode"))]) + (comint-mime . + [(0 1) + ((emacs + (28 1))) + "Display content of various MIME types in comint buffers" tar + ((:url . "https://github.com/astoff/comint-mime") + (:keywords "processes" "multimedia") + (:maintainer "Augusto Stoffel" . "arstoffel@gmail.com") + (:authors + ("Augusto Stoffel" . "arstoffel@gmail.com")) + (:commit . "2ac67834d9bb8e6a3521d75b934a4b496a3a0f9d"))]) + (compact-docstrings . + [(0 2) + nil "Shrink blank lines in docstrings and doc comments" single + ((:keywords "convenience" "faces" "lisp" "maint" "c") + (:authors + ("Clément Pit-Claudel" . "clement.pitclaudel@live.com")) + (:maintainer "Clément Pit-Claudel" . "clement.pitclaudel@live.com") + (:url . "https://github.com/cpitclaudel/compact-docstrings"))]) + (company . + [(0 9 13) + ((emacs + (24 3))) + "Modular text completion framework" tar + ((:url . "http://company-mode.github.io/") + (:maintainer "Dmitry Gutov" . "dgutov@yandex.ru") + (:authors + ("Nikolaj Schumacher")) + (:keywords "abbrev" "convenience" "matching"))]) + (company-ebdb . + [(1 1) + ((company + (0 9 4)) + (ebdb + (0 2))) + "company-mode completion backend for EBDB in message-mode" single + ((:url . "http://elpa.gnu.org/packages/company-ebdb.html") + (:authors + ("Jan Tatarik" . "jan.tatarik@gmail.com")) + (:maintainer "Eric Abrahamsen" . "eric@ericabrahamsen.net"))]) + (company-math . + [(1 4) + ((company + (0 8 0)) + (math-symbol-lists + (1 3))) + "Completion backends for unicode math symbols and latex tags" tar + ((:url . "https://github.com/vspinu/company-math") + (:maintainer "Vitalie Spinu" . "spinuvit@gmail.com") + (:authors + ("Vitalie Spinu" . "spinuvit@gmail.com")) + (:keywords "unicode" "symbols" "completion"))]) + (company-statistics . + [(0 2 3) + ((emacs + (24 3)) + (company + (0 8 5))) + "Sort candidates using completion history" tar + ((:url . "https://github.com/company-mode/company-statistics") + (:maintainer "Ingo Lohmar" . "i.lohmar@gmail.com") + (:authors + ("Ingo Lohmar" . "i.lohmar@gmail.com")) + (:keywords "abbrev" "convenience" "matching"))]) + (compat . + [(28 1 1 1) + ((emacs + (24 3)) + (nadvice + (0 3))) + "Compatibility Library" tar + ((:url . "https://sr.ht/~pkal/compat") + (:keywords "lisp") + (:maintainer "Compat Development" . "~pkal/compat-devel@lists.sr.ht") + (:authors + ("Philip Kaludercic" . "philipk@posteo.net")) + (:commit . "5f1f156d8048c44e727cf3dd9a55422822562c3e"))]) + (consult . + [(0 17) + ((emacs + (27 1))) + "Consulting completing-read" tar + ((:url . "https://github.com/minad/consult") + (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") + (:authors + ("Daniel Mendler and Consult contributors")) + (:commit . "f517b70dd8a3be0b8c883633f2a7721448b40f0f"))]) + (context-coloring . + [(8 1 0) + ((emacs + (24 3))) + "Highlight by scope" tar + ((:url . "https://github.com/jacksonrayhamilton/context-coloring") + (:maintainer "Jackson Ray Hamilton" . "jackson@jacksonrayhamilton.com") + (:authors + ("Jackson Ray Hamilton" . "jackson@jacksonrayhamilton.com")) + (:keywords "convenience" "faces" "tools"))]) + (corfu . + [(0 23) + ((emacs + (27 1))) + "Completion Overlay Region FUnction" tar + ((:url . "https://github.com/minad/corfu") + (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") + (:authors + ("Daniel Mendler" . "mail@daniel-mendler.de")) + (:commit . "bf9bb725f70fb3165e2831c5926217bd6a8bc68d"))]) + (coterm . + [(1 5) + ((emacs + (26 1))) + "Terminal emulation for comint" tar + ((:url . "https://repo.or.cz/emacs-coterm.git") + (:keywords "processes") + (:maintainer "jakanakaevangeli" . "jakanakaevangeli@chiru.no") + (:authors + ("jakanakaevangeli" . "jakanakaevangeli@chiru.no")) + (:commit . "ef4b5fb55304266244c87d2c6aaefab58149da62"))]) + (counsel . + [(0 13 4) + ((emacs + (24 5)) + (ivy + (0 13 4)) + (swiper + (0 13 4))) + "Various completion functions using Ivy" tar + ((:url . "https://github.com/abo-abo/swiper") + (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") + (:authors + ("Oleh Krehel" . "ohwoeowho@gmail.com")) + (:keywords "convenience" "matching" "tools"))]) + (cpio-mode . + [(0 17) + ((emacs + (24 5))) + "Handle cpio archives in the style of dired." tar + ((:maintainer "Douglas Lewan" . "d.lewan2000@gmail.com") + (:authors + ("Douglas Lewan" . "d.lewan2000@gmail.com")) + (:keywords "files") + (:url . "http://elpa.gnu.org/packages/cpio-mode.html"))]) + (cpupower . + [(1 0 4) + nil "cpupower command interface" tar + ((:url . "https://gitlab.com/steve-emacs-stuff/cpupower-el") + (:keywords "hardware" "cpupower" "cpu" "frequency-scaling") + (:maintainer "Stephen Meister" . "pallagun@gmail.com") + (:authors + ("Stephen Meister" . "pallagun@gmail.com")) + (:commit . "36520f1fa7bbfdbfd525a4c729b3fd067f7a05f1"))]) + (crdt . + [(0 2 7) + nil "Collaborative editing using Conflict-free Replicated Data Types" tar + ((:url . "https://code.librehq.com/qhong/crdt.el") + (:keywords "collaboration" "crdt") + (:maintainer "Qiantan Hong" . "qhong@alum.mit.edu") + (:authors + ("Qiantan Hong" . "qhong@alum.mit.edu")))]) + (crisp . + [(1 3 6) + nil "CRiSP/Brief Emacs emulator" single + ((:url . "http://elpa.gnu.org/packages/crisp.html") + (:keywords "emulations" "brief" "crisp") + (:authors + ("Gary D. Foster" . "Gary.Foster@Corp.Sun.COM")) + (:maintainer "Luke Lee" . "luke.yx.lee@gmail.com"))]) + (csharp-mode . + [(1 1 1) + ((emacs + (26 1))) + "C# mode derived mode" tar + ((:url . "https://github.com/emacs-csharp/csharp-mode") + (:keywords "c#" "languages" "oop" "mode") + (:maintainer "Jostein Kjønigsen" . "jostein@gmail.com") + (:authors + ("Theodor Thornhill" . "theo@thornhill.no")))]) + (csv-mode . + [(1 19) + ((emacs + (24 1)) + (cl-lib + (0 5))) + "Major mode for editing comma/char separated values" tar + ((:keywords "convenience") + (:maintainer nil . "emacs-devel@gnu.org") + (:authors + ("\"Francis J. Wright\"" . "F.J.Wright@qmul.ac.uk")) + (:url . "https://elpa.gnu.org/packages/csv-mode.html") + (:commit . "5c19624398bfd6b976cc9876db582e3e23611601"))]) + (cursory . + [(0 1 4) + ((emacs + (27 1))) + "Manage cursor styles using presets" tar + ((:url . "https://git.sr.ht/~protesilaos/cursory") + (:keywords "convenience" "cursor") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:commit . "63c4b42ebe4446484bfb2a81b0b97ff65bcfbb3d"))]) + (cycle-quotes . + [(0 1) + nil "Cycle between quote styles" tar + ((:maintainer "Simen Heggestøyl" . "simenheg@gmail.com") + (:authors + ("Simen Heggestøyl" . "simenheg@gmail.com")) + (:keywords "convenience") + (:url . "http://elpa.gnu.org/packages/cycle-quotes.html"))]) + (darkroom . + [(0 3) + ((cl-lib + (0 5))) + "Remove visual distractions and focus on writing" single + ((:url . "http://elpa.gnu.org/packages/darkroom.html") + (:keywords "convenience" "emulations") + (:authors + ("João Távora" . "joaotavora@gmail.com")) + (:maintainer "João Távora" . "joaotavora@gmail.com"))]) + (dash . + [(2 19 1) + ((emacs + (24))) + "A modern list library for Emacs" tar + ((:url . "https://github.com/magnars/dash.el") + (:maintainer "Magnar Sveen" . "magnars@gmail.com") + (:authors + ("Magnar Sveen" . "magnars@gmail.com")) + (:keywords "extensions" "lisp"))]) + (dbus-codegen . + [(0 1) + ((cl-lib + (0 5))) + "Lisp code generation for D-Bus." single + ((:url . "http://elpa.gnu.org/packages/dbus-codegen.html") + (:keywords "comm" "dbus" "convenience") + (:authors + ("Daiki Ueno" . "ueno@gnu.org")) + (:maintainer nil . "emacs-devel@gnu.org"))]) + (debbugs . + [(0 32) + ((emacs + (26 1)) + (soap-client + (3 1 5))) + "SOAP library to access debbugs servers" tar + ((:keywords "comm" "hypermedia") + (:maintainer "Michael Albinus" . "michael.albinus@gmx.de") + (:authors + ("Michael Albinus" . "michael.albinus@gmx.de")) + (:url . "https://elpa.gnu.org/packages/debbugs.html") + (:commit . "a35646a9798226b8630fbd7a0691edc78ccd92b3"))]) + (delight . + [(1 7) + ((cl-lib + (0 5)) + (nadvice + (0 3))) + "A dimmer switch for your lighter text" single + ((:keywords "convenience") + (:authors + ("Phil Sainty" . "psainty@orcon.net.nz")) + (:maintainer "Phil Sainty" . "psainty@orcon.net.nz") + (:url . "https://savannah.nongnu.org/projects/delight"))]) + (devdocs . + [(0 4) + ((emacs + (27 1))) + "Emacs viewer for DevDocs" tar + ((:url . "https://github.com/astoff/devdocs.el") + (:keywords "help") + (:maintainer "Augusto Stoffel" . "arstoffel@gmail.com") + (:authors + ("Augusto Stoffel" . "arstoffel@gmail.com")) + (:commit . "cdc1a7cc3f05235883ffb098fe1c5a8963ed06e2"))]) + (dict-tree . + [(0 16) + ((trie + (0 3)) + (tNFA + (0 1 1)) + (heap + (0 3))) + "Dictionary data structure" tar + ((:url . "http://www.dr-qubit.org/emacs.php") + (:maintainer "Toby Cubitt" . "toby-predictive@dr-qubit.org") + (:authors + ("Toby Cubitt" . "toby-predictive@dr-qubit.org")) + (:keywords "extensions" "matching" "data structures trie" "tree" "dictionary" "completion" "regexp"))]) + (diff-hl . + [(1 8 8) + ((cl-lib + (0 2)) + (emacs + (24 3))) + "Highlight uncommitted changes using VC" tar + ((:url . "https://github.com/dgutov/diff-hl") + (:maintainer "Dmitry Gutov" . "dgutov@yandex.ru") + (:authors + ("Dmitry Gutov" . "dgutov@yandex.ru")) + (:keywords "vc" "diff"))]) + (diffview . + [(1 0) + nil "View diffs in side-by-side format" single + ((:keywords "convenience" "diff") + (:authors + ("Mitchel Humpherys" . "mitch.special@gmail.com")) + (:maintainer "Mitchel Humpherys" . "mitch.special@gmail.com") + (:url . "https://github.com/mgalgs/diffview-mode"))]) + (diminish . + [(0 46) + ((emacs + (24 3))) + "Diminished modes are minor modes with no modeline display" tar + ((:url . "https://github.com/myrjola/diminish.el") + (:keywords "extensions" "diminish" "minor" "codeprose") + (:maintainer "Martin Yrjölä" . "martin.yrjola@gmail.com") + (:authors + ("Will Mengarini" . "seldon@eskimo.com")) + (:commit . "66b3902401059d161424b1b8d0abc3cb0a7d6df0"))]) + (dired-du . + [(0 5 2) + ((emacs + (24 4)) + (cl-lib + (0 5))) + "Dired with recursive directory sizes" tar + ((:maintainer "Tino Calancha" . "tino.calancha@gmail.com") + (:authors + ("Tino Calancha" . "tino.calancha@gmail.com")) + (:keywords "files" "unix" "convenience") + (:url . "http://elpa.gnu.org/packages/dired-du.html"))]) + (dired-git-info . + [(0 3 1) + ((emacs + (25))) + "Show git info in dired" single + ((:keywords "dired" "files") + (:authors + ("Clemens Radermacher" . "clemera@posteo.net")) + (:maintainer "Clemens Radermacher" . "clemera@posteo.net") + (:url . "https://github.com/clemera/dired-git-info"))]) + (disk-usage . + [(1 3 3) + ((emacs + (26 1))) + "Sort and browse disk usage listings" single + ((:keywords "files" "convenience" "tools") + (:authors + ("Pierre Neidhardt" . "mail@ambrevar.xyz")) + (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") + (:url . "https://gitlab.com/Ambrevar/emacs-disk-usage"))]) + (dismal . + [(1 5 2) + ((cl-lib + (0)) + (emacs + (24 3))) + "Dis Mode Ain't Lotus: Spreadsheet program Emacs" tar + ((:maintainer "UnMaintainer" . "emacs-devel@gnu.org") + (:authors + (nil . "David Fox, fox@cs.nyu.edu") + (nil . "Frank E. Ritter, ritter@cs.cmu.edu")) + (:url . "https://elpa.gnu.org/packages/dismal.html"))]) + (djvu . + [(1 1 2) + nil "Edit and view Djvu files via djvused" tar + ((:keywords "files" "wp") + (:maintainer "Roland Winkler" . "winkler@gnu.org") + (:authors + ("Roland Winkler" . "winkler@gnu.org")) + (:url . "https://elpa.gnu.org/packages/djvu.html") + (:commit . "071c8ab168588897475899c46eaa16e70141db8c"))]) + (docbook . + [(0 1) + nil "Info-like viewer for DocBook" single + ((:url . "http://elpa.gnu.org/packages/docbook.html") + (:keywords "docs" "help") + (:authors + ("Chong Yidong" . "cyd@gnu.org")) + (:maintainer "Chong Yidong" . "cyd@gnu.org"))]) + (dtache . + [(0 6) + ((emacs + (27 1))) + "Run and interact with detached shell commands" tar + ((:url . "https://www.gitlab.com/niklaseklund/dtache.git") + (:keywords "convenience" "processes") + (:maintainer "Niklas Eklund" . "niklas.eklund@posteo.net") + (:authors + ("Niklas Eklund" . "niklas.eklund@posteo.net")) + (:commit . "4ecda689e4ccddc23805a22484c95c4f3f65e3bb"))]) + (dts-mode . + [(1 0) + ((emacs + (24))) + "Major mode for Device Tree source files" tar + ((:keywords "languages") + (:maintainer "Ben Gamari" . "ben@smart-cactus.org") + (:authors + ("Ben Gamari" . "ben@smart-cactus.org")) + (:url . "https://elpa.gnu.org/packages/dts-mode.html") + (:commit . "8413d2dc9b3347831aa9e8c8b2524af3ef005441"))]) + (easy-escape . + [(0 2 1) + nil "Improve readability of escape characters in regular expressions" tar + ((:url . "https://github.com/cpitclaudel/easy-escape") + (:keywords "convenience" "lisp" "tools") + (:maintainer "Clément Pit-Claudel" . "clement.pitclaudel@live.com") + (:authors + ("Clément Pit-Claudel" . "clement.pitclaudel@live.com")))]) + (easy-kill . + [(0 9 5) + ((emacs + (25)) + (cl-lib + (0 5))) + "kill & mark things easily" tar + ((:url . "https://github.com/leoliu/easy-kill") + (:keywords "killing" "convenience") + (:maintainer "Leo Liu" . "sdl.web@gmail.com") + (:authors + ("Leo Liu" . "sdl.web@gmail.com")) + (:commit . "f155d19c528e27f8f6c72f0d75f652edbdcab37f"))]) + (ebdb . + [(0 8 14) + ((emacs + (25 1)) + (seq + (2 15))) + "Contact management package" tar + ((:url . "https://github.com/girzel/ebdb") + (:keywords "convenience" "mail") + (:maintainer "Eric Abrahamsen" . "eric@ericabrahamsen.net") + (:authors + ("Eric Abrahamsen" . "eric@ericabrahamsen.net")) + (:commit . "c98512ebb6984701bbf090f1eabedb120c51e7bd"))]) + (ebdb-gnorb . + [(1 0 2) + ((gnorb + (1 1 0)) + (ebdb + (0 2))) + "Utilities for connecting EBDB to Gnorb" single + ((:url . "http://elpa.gnu.org/packages/ebdb-gnorb.html") + (:authors + ("Eric Abrahamsen" . "eric@ericabrahamsen.net")) + (:maintainer "Eric Abrahamsen" . "eric@ericabrahamsen.net"))]) + (ebdb-i18n-chn . + [(1 3 2) + ((pyim + (1 6 0)) + (ebdb + (0 6 17))) + "China-specific internationalization support for EBDB" tar + ((:maintainer "Eric Abrahamsen" . "eric@ericabrahamsen.net") + (:authors + ("Eric Abrahamsen" . "eric@ericabrahamsen.net")) + (:url . "https://elpa.gnu.org/packages/ebdb-i18n-chn.html"))]) + (ediprolog . + [(2 1) + nil "Emacs Does Interactive Prolog" single + ((:keywords "languages" "processes") + (:authors + ("Markus Triska" . "triska@metalevel.at")) + (:maintainer "Markus Triska" . "triska@metalevel.at") + (:url . "https://www.metalevel.at/ediprolog/"))]) + (eev . + [(20220416) + ((emacs + (24 4))) + "Support for e-scripts (eepitch blocks, elisp hyperlinks, etc)" tar + ((:url . "http://angg.twu.net/#eev") + (:keywords "lisp" "e-scripts") + (:maintainer "Eduardo Ochs" . "eduardoochs@gmail.com") + (:authors + ("Eduardo Ochs" . "eduardoochs@gmail.com")) + (:commit . "84a0b6e6bb247efcb519c1e32de172aa55e184c7"))]) + (eglot . + [(1 8) + ((emacs + (26 1)) + (jsonrpc + (1 0 14)) + (flymake + (1 0 9)) + (project + (0 3 0)) + (xref + (1 0 1)) + (eldoc + (1 11 0))) + "Client for Language Server Protocol (LSP) servers" tar + ((:url . "https://github.com/joaotavora/eglot") + (:keywords "convenience" "languages") + (:maintainer "João Távora" . "joaotavora@gmail.com") + (:authors + ("João Távora" . "joaotavora@gmail.com")) + (:commit . "132ea08f97f94ad2e050fc8d1628ecb41de7229a"))]) + (el-search . + [(1 12 6 1) + ((emacs + (25)) + (stream + (2 2 4)) + (cl-print + (1 0))) + "Expression based interactive search for Emacs Lisp" tar + ((:maintainer "Michael Heerdegen" . "michael_heerdegen@web.de") + (:authors + ("Michael Heerdegen" . "michael_heerdegen@web.de")) + (:keywords "lisp") + (:url . "http://elpa.gnu.org/packages/el-search.html"))]) + (eldoc . + [(1 12 0) + ((emacs + (26 3))) + "Show function arglist or variable docstring in echo area" tar + ((:keywords "extensions") + (:maintainer "Noah Friedman" . "friedman@splode.com") + (:authors + ("Noah Friedman" . "friedman@splode.com")) + (:url . "https://elpa.gnu.org/packages/eldoc.html") + (:commit . "d377b396432412b06647eef01f837126982f3e6d"))]) + (eldoc-eval . + [(0 2) + nil "Enable eldoc support when minibuffer is in use." tar + ((:maintainer "Thierry Volpiatto" . "thievol@posteo.net") + (:authors + ("Thierry Volpiatto" . "thievol@posteo.net")) + (:url . "https://elpa.gnu.org/packages/eldoc-eval.html") + (:commit . "e91800503c90cb75dc70abe42f1d6ae499346cc1"))]) + (electric-spacing . + [(5 0) + nil "Insert operators with surrounding spaces smartly" single + ((:url . "http://elpa.gnu.org/packages/electric-spacing.html") + (:authors + ("William Xu" . "william.xwl@gmail.com")) + (:maintainer "William Xu" . "william.xwl@gmail.com"))]) + (elisp-benchmarks . + [(1 14) + nil "elisp benchmarks collection" tar + ((:keywords "languages" "lisp") + (:maintainer "Andrea Corallo" . "akrl@sdf.org") + (:authors + ("Andrea Corallo" . "akrl@sdf.org")) + (:url . "https://elpa.gnu.org/packages/elisp-benchmarks.html") + (:commit . "70e38dbfa8f4acbdebfd0f417410d99f5031e05f"))]) + (embark . + [(0 16) + ((emacs + (26 1))) + "Conveniently act on minibuffer completions" tar + ((:url . "https://github.com/oantolin/embark") + (:keywords "convenience") + (:maintainer "Omar Antolín Camarena" . "omar@matem.unam.mx") + (:authors + ("Omar Antolín Camarena" . "omar@matem.unam.mx")) + (:commit . "5faf1389162dd64bfe3511dfb8f52c18efb5140b"))]) + (embark-consult . + [(0 5) + ((emacs + (26 1)) + (embark + (0 12)) + (consult + (0 10))) + "Consult integration for Embark" tar + ((:url . "https://github.com/oantolin/embark") + (:keywords "convenience") + (:maintainer "Omar Antolín Camarena" . "omar@matem.unam.mx") + (:authors + ("Omar Antolín Camarena" . "omar@matem.unam.mx")) + (:commit . "5faf1389162dd64bfe3511dfb8f52c18efb5140b"))]) + (emms . + [(10) + ((cl-lib + (0 5)) + (nadvice + (0 3)) + (seq + (0))) + "The Emacs Multimedia System" tar + ((:url . "https://www.gnu.org/software/emms/") + (:keywords "emms" "mp3" "ogg" "flac" "music" "mpeg" "video" "multimedia") + (:maintainer "Yoni Rabkin" . "yrk@gnu.org") + (:authors + ("Jorgen Schäfer" . "forcer@forcix.cx")) + (:commit . "6afe1b26d679357586380ecd69c9795985231013"))]) + (engrave-faces . + [(0 3 0) + ((emacs + (27 1))) + "Convert font-lock faces to other formats" tar + ((:url . "https://github.com/tecosaur/engrave-faces") + (:keywords "faces") + (:maintainer "TEC" . "tec@tecosaur.com") + (:authors + ("TEC ")) + (:commit . "3739d9f690412beb5bf717b11bc828fe39ade231"))]) + (enwc . + [(2 0) + ((emacs + (25 1))) + "The Emacs Network Client" tar + ((:url . "https://savannah.nongnu.org/p/enwc") + (:maintainer "Ian Dunn" . "dunni@gnu.org") + (:authors + ("Ian Dunn" . "dunni@gnu.org")) + (:keywords "external" "network" "wicd" "manager" "nm"))]) + (epoch-view . + [(0 0 1) + nil "Minor mode to visualize epoch timestamps" single + ((:url . "http://elpa.gnu.org/packages/epoch-view.html") + (:keywords "data" "timestamp" "epoch" "unix") + (:authors + ("Ted Zlatanov" . "tzz@lifelogs.com")) + (:maintainer "Ted Zlatanov" . "tzz@lifelogs.com"))]) + (erc . + [(5 4 1) + ((emacs + (27 1))) + "An Emacs Internet Relay Chat client" tar + ((:url . "https://www.gnu.org/software/emacs/erc.html") + (:keywords "irc" "chat" "client" "internet") + (:maintainer "Amin Bandali" . "bandali@gnu.org") + (:authors + ("Alexander L. Belikoff" . "alexander@belikoff.net")))]) + (ergoemacs-mode . + [(5 16 10 12) + ((emacs + (24 1)) + (undo-tree + (0 6 5)) + (cl-lib + (0 5))) + "Emacs mode based on common modern interface and ergonomics." tar + ((:url . "https://github.com/ergoemacs/ergoemacs-mode") + (:maintainer "Matthew L. Fidler" . "matthew.fidler@gmail.com") + (:authors + ("Xah Lee" . "xah@xahlee.org") + ("David Capello" . "davidcapello@gmail.com") + ("Matthew L. Fidler" . "matthew.fidler@gmail.com")) + (:keywords "convenience"))]) + (excorporate . + [(1 0 0) + ((emacs + (24 1)) + (cl-lib + (0 6 1)) + (fsm + (0 2 1)) + (soap-client + (3 2 0)) + (url-http-ntlm + (2 0 4)) + (nadvice + (0 3))) + "Exchange Web Services (EWS) integration" tar + ((:url . "https://www.fitzsim.org/blog/") + (:maintainer "Thomas Fitzsimmons" . "fitzsim@fitzsim.org") + (:authors + ("Thomas Fitzsimmons" . "fitzsim@fitzsim.org")) + (:keywords "calendar"))]) + (expand-region . + [(0 11 0) + nil "Increase selected region by semantic units." tar + ((:url . "https://github.com/magnars/expand-region.el") + (:maintainer "Magnar Sveen" . "magnars@gmail.com") + (:authors + ("Magnar Sveen" . "magnars@gmail.com")) + (:keywords "marking" "region"))]) + (exwm . + [(0 26) + ((xelb + (0 18))) + "Emacs X Window Manager" tar + ((:url . "https://github.com/ch11ng/exwm") + (:keywords "unix") + (:maintainer "Adrián Medraño Calvo" . "adrian@medranocalvo.com") + (:authors + ("Chris Feng" . "chris.w.feng@gmail.com")))]) + (f90-interface-browser . + [(1 1) + nil "Parse and browse f90 interfaces" single + ((:authors + ("Lawrence Mitchell" . "wence@gmx.li")) + (:maintainer "Lawrence Mitchell" . "wence@gmx.li") + (:url . "http://github.com/wence-/f90-iface/"))]) + (filladapt . + [(2 12 2) + ((emacs + (24 4))) + "Adaptive fill" single + ((:url . "http://elpa.gnu.org/packages/filladapt.html") + (:authors + ("Kyle E. Jones" . "kyle_jones@wonderworks.com")) + (:maintainer nil . "emacs-devel@gnu.org"))]) + (flylisp . + [(0 2) + ((emacs + (24 1)) + (cl-lib + (0 4))) + "Color unbalanced parentheses and parentheses inconsistent with indentation" single + ((:url . "http://elpa.gnu.org/packages/flylisp.html") + (:authors + ("Barry O'Reilly" . "gundaetiapo@gmail.com")) + (:maintainer "Barry O'Reilly" . "gundaetiapo@gmail.com"))]) + (flymake . + [(1 2 2) + ((emacs + (26 1)) + (eldoc + (1 1 0)) + (project + (0 7 1))) + "A universal on-the-fly syntax checker" tar + ((:keywords "c" "languages" "tools") + (:maintainer "João Távora" . "joaotavora@gmail.com") + (:authors + ("Pavel Kobyakov" . "pk_at_work@yahoo.com")) + (:url . "https://elpa.gnu.org/packages/flymake.html") + (:commit . "31af9bca99fa88350271e1a905c9b435eaec28cf"))]) + (flymake-proselint . + [(0 2 3) + ((emacs + (26 1))) + "Flymake backend for proselint" tar + ((:url . "https://github.com/manuel-uberti/flymake-proselint") + (:keywords "convenience") + (:maintainer "Manuel Uberti" . "manuel.uberti@inventati.org") + (:authors + ("Manuel Uberti" . "manuel.uberti@inventati.org")))]) + (fontaine . + [(0 2 0) + ((emacs + (27 1))) + "Set font configurations using presets" tar + ((:url . "https://git.sr.ht/~protesilaos/fontaine") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:commit . "a8e7f2e9b8ec6c4eaa75eb55acbc74702c96d438"))]) + (frame-tabs . + [(1 1) + nil "show buffer tabs in side window" single + ((:url . "http://elpa.gnu.org/packages/frame-tabs.html") + (:keywords "frames" "tabs") + (:authors + ("Martin Rudalics" . "rudalics@gmx.at")) + (:maintainer "Martin Rudalics" . "rudalics@gmx.at"))]) + (frog-menu . + [(0 2 11) + ((emacs + (26)) + (avy + (0 4)) + (posframe + (0 4))) + "Quickly pick items from ad hoc menus" single + ((:keywords "convenience") + (:authors + ("Clemens Radermacher" . "clemera@posteo.net")) + (:maintainer "Clemens Radermacher" . "clemera@posteo.net") + (:url . "https://github.com/clemera/frog-menu"))]) + (fsm . + [(0 2 1) + ((emacs + (24 1)) + (cl-lib + (0 5))) + "state machine library" single + ((:url . "http://elpa.gnu.org/packages/fsm.html") + (:keywords "extensions") + (:authors + ("Magnus Henoch" . "magnus.henoch@gmail.com")) + (:maintainer "Thomas Fitzsimmons" . "fitzsim@fitzsim.org"))]) + (ftable . + [(1 0) + ((emacs + (26 0))) + "Fill a table to fit in n columns" tar + ((:url . "https://github.com/casouri/ftable") + (:maintainer "Yuan Fu" . "casouri@gmail.com") + (:authors + ("Yuan Fu" . "casouri@gmail.com")) + (:keywords "convenience" "text" "table"))]) + (gcmh . + [(0 2 1) + ((emacs + (24))) + "the Garbage Collector Magic Hack" single + ((:keywords "internal") + (:authors + ("Andrea Corallo" . "akrl@sdf.org")) + (:maintainer nil . "akrl@sdf.org") + (:url . "https://gitlab.com/koral/gcmh"))]) + (ggtags . + [(0 9 0) + ((emacs + (25))) + "emacs frontend to GNU Global source code tagging system" tar + ((:url . "https://github.com/leoliu/ggtags") + (:maintainer "Leo Liu" . "sdl.web@gmail.com") + (:authors + ("Leo Liu" . "sdl.web@gmail.com")) + (:keywords "tools" "convenience"))]) + (gited . + [(0 6 0) + ((emacs + (24 4)) + (cl-lib + (0 5))) + "Operate on Git branches like dired" tar + ((:maintainer "Tino Calancha" . "tino.calancha@gmail.com") + (:authors + ("Tino Calancha" . "tino.calancha@gmail.com")) + (:keywords "git" "vc" "convenience") + (:url . "http://elpa.gnu.org/packages/gited.html"))]) + (gle-mode . + [(1 1) + ((cl-lib + (0 5))) + "Major mode to edit Graphics Layout Engine files" single + ((:url . "http://elpa.gnu.org/packages/gle-mode.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (gnome-c-style . + [(0 1) + nil "minor mode for editing GNOME-style C source code" tar + ((:maintainer "Daiki Ueno" . "ueno@gnu.org") + (:authors + ("Daiki Ueno" . "ueno@gnu.org")) + (:keywords "gnome" "c" "coding style") + (:url . "http://elpa.gnu.org/packages/gnome-c-style.html"))]) + (gnorb . + [(1 6 10) + ((cl-lib + (0 5))) + "Glue code between Gnus, Org, and BBDB" tar + ((:keywords "mail" "org" "gnus" "bbdb" "todo" "task") + (:maintainer "Eric Abrahamsen" . "eric@ericabrahamsen.net") + (:authors + ("Eric Abrahamsen" . "eric@ericabrahamsen.net")) + (:url . "https://elpa.gnu.org/packages/gnorb.html"))]) + (gnu-elpa . + [(1 1) + nil "Advertize GNU ELPA packages" tar + ((:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:url . "http://elpa.gnu.org/packages/gnu-elpa.html"))]) + (gnu-elpa-keyring-update . + [(2019 3) + nil "Update Emacs's GPG keyring for GNU ELPA" tar + ((:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:keywords "maint" "tools") + (:url . "http://elpa.gnu.org/packages/gnu-elpa-keyring-update.html"))]) + (gnugo . + [(3 1 2) + ((ascii-art-to-unicode + (1 5)) + (xpm + (1 0 1)) + (cl-lib + (0 5))) + "play GNU Go in a buffer" tar + ((:url . "https://www.gnuvola.org/software/gnugo/") + (:keywords "games" "processes") + (:maintainer "Thien-Thi Nguyen" . "ttn@gnu.org") + (:authors + ("Thien-Thi Nguyen" . "ttn@gnu.org")))]) + (gnus-mock . + [(0 5) + nil "Mock Gnus installation for testing" tar + ((:maintainer "Eric Abrahamsen" . "eric@ericabrahamsen.net") + (:authors + ("Eric Abrahamsen" . "eric@ericabrahamsen.net")) + (:url . "https://elpa.gnu.org/packages/gnus-mock.html"))]) + (gpastel . + [(0 5 0) + ((emacs + (25 1))) + "Integrates GPaste with the kill-ring" single + ((:keywords "tools") + (:authors + ("Damien Cassou" . "damien@cassou.me")) + (:maintainer "Damien Cassou" . "damien@cassou.me") + (:url . "https://gitlab.petton.fr/DamienCassou/desktop-environment"))]) + (greader . + [(0 1) + ((emacs + (25))) + "gnamù reader, a reader with espeak tts" tar + ((:maintainer "Michelangelo Rodriguez" . "michelangelo.rodriguez@gmail.com") + (:authors + ("Michelangelo Rodriguez" . "michelangelo.rodriguez@gmail.com")) + (:keywords "tools" "accessibility") + (:url . "http://elpa.gnu.org/packages/greader.html"))]) + (greenbar . + [(1 1) + nil "Mark comint output with \"greenbar\" background" single + ((:url . "http://elpa.gnu.org/packages/greenbar.html") + (:keywords "faces" "terminals") + (:authors + ("Michael R. Mauger" . "michael@mauger.com")) + (:maintainer "Michael R. Mauger" . "michael@mauger.com"))]) + (gtags-mode . + [(1 0) + ((emacs + (28))) + "GNU Global integration with xref, project and imenu." tar + ((:url . "https://github.com/Ergus/gtags-mode") + (:keywords "xref" "project" "imenu" "gtags" "global") + (:maintainer "Jimmy Aguilar Mena") + (:authors + ("Jimmy Aguilar Mena")) + (:commit . "f108a46c6c03eb5e18c73a908c655071aa153a14"))]) + (guess-language . + [(0 0 1) + ((cl-lib + (0 5)) + (emacs + (24)) + (nadvice + (0 1))) + "Robust automatic language detection" single + ((:authors + ("Titus von der Malsburg" . "malsburg@posteo.de")) + (:maintainer "Titus von der Malsburg" . "malsburg@posteo.de") + (:url . "https://github.com/tmalsburg/guess-language.el"))]) + (heap . + [(0 5) + nil "Heap (a.k.a. priority queue) data structure" single + ((:keywords "extensions" "data structures" "heap" "priority queue") + (:authors + ("Toby Cubitt" . "toby-predictive@dr-qubit.org")) + (:maintainer "Toby Cubitt" . "toby-predictive@dr-qubit.org") + (:url . "http://www.dr-qubit.org/emacs.php"))]) + (hiddenquote . + [(1 1) + ((emacs + (25 1))) + "Major mode for doing hidden quote puzzles" tar + ((:url . "http://mauroaranda.com/puzzles/hidden-quote-puzzle/") + (:maintainer "Mauro Aranda" . "maurooaranda@gmail.com") + (:authors + ("Mauro Aranda" . "maurooaranda@gmail.com")) + (:keywords "games"))]) + (highlight-escape-sequences . + [(0 4) + nil "Highlight escape sequences" single + ((:keywords "convenience") + (:authors + ("Dmitry Gutov" . "dgutov@yandex.ru") + ("Pavel Matcula" . "dev.plvlml@gmail.com")) + (:maintainer "Dmitry Gutov" . "dgutov@yandex.ru") + (:url . "https://github.com/dgutov/highlight-escape-sequences"))]) + (hook-helpers . + [(1 1 1) + ((emacs + (25 1))) + "Anonymous, modifiable hook functions" tar + ((:url . "https://savannah.nongnu.org/projects/hook-helpers-el/") + (:maintainer "Ian Dunn" . "dunni@gnu.org") + (:authors + ("Ian Dunn" . "dunni@gnu.org")) + (:keywords "development" "hooks"))]) + (html5-schema . + [(0 1) + nil "Add HTML5 schemas for use by nXML" tar + ((:url . "https://github.com/validator/validator") + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:keywords "html" "xml"))]) + (hydra . + [(0 14 0) + ((cl-lib + (0 5))) + "Make bindings that stick around." tar + ((:url . "https://github.com/abo-abo/hydra") + (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") + (:authors + ("Oleh Krehel" . "ohwoeowho@gmail.com")) + (:keywords "bindings"))]) + (hyperbole . + [(8 0 0) + ((emacs + (27 0))) + "GNU Hyperbole: The Everyday Hypertextual Information Manager" tar + ((:url . "http://www.gnu.org/software/hyperbole") + (:keywords "comm" "convenience" "files" "frames" "hypermedia" "languages" "mail" "matching" "mouse" "multimedia" "outlines" "tools" "wp") + (:maintainer "Bob Weiner , Mats Lidell" . "matsl@gnu.org") + (:authors + ("Bob Weiner")) + (:commit . "4214716e06920a3e10db5811bd22a343ad6435d9"))]) + (ilist . + [(0 1) + nil "Display a list in an ibuffer way." tar + ((:keywords "convenience") + (:maintainer "Durand" . "mmemmew@gmail.com") + (:authors + ("Durand" . "mmemmew@gmail.com")) + (:url . "https://elpa.gnu.org/packages/ilist.html"))]) + (ioccur . + [(2 6) + ((emacs + (24)) + (cl-lib + (0 5))) + "Incremental occur" tar + ((:url . "https://github.com/thierryvolpiatto/ioccur") + (:maintainer "Thierry Volpiatto" . "thievol@posteo.net") + (:authors + ("Thierry Volpiatto" . "thievol@posteo.net")))]) + (isearch-mb . + [(0 5) + ((emacs + (27 1))) + "Control isearch from the minibuffer" tar + ((:url . "https://github.com/astoff/isearch-mb") + (:keywords "matching") + (:maintainer "Augusto Stoffel" . "arstoffel@gmail.com") + (:authors + ("Augusto Stoffel" . "arstoffel@gmail.com")) + (:commit . "e70ba8f594afef989006493dd71bd693a29e9f42"))]) + (iterators . + [(0 1 1) + ((emacs + (25))) + "Functions for working with iterators" single + ((:url . "http://elpa.gnu.org/packages/iterators.html") + (:keywords "extensions" "elisp") + (:authors + ("Michael Heerdegen" . "michael_heerdegen@web.de")) + (:maintainer "Michael Heerdegen" . "michael_heerdegen@web.de"))]) + (ivy . + [(0 13 4) + ((emacs + (24 5))) + "Incremental Vertical completYon" tar + ((:url . "https://github.com/abo-abo/swiper") + (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") + (:authors + ("Oleh Krehel" . "ohwoeowho@gmail.com")) + (:keywords "matching"))]) + (ivy-avy . + [(0 13 4) + ((emacs + (24 5)) + (ivy + (0 13 4)) + (avy + (0 5 0))) + "Avy integration for Ivy" tar + ((:url . "https://github.com/abo-abo/swiper") + (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") + (:authors + ("Oleh Krehel" . "ohwoeowho@gmail.com")) + (:keywords "convenience"))]) + (ivy-explorer . + [(0 3 2) + ((emacs + (25)) + (ivy + (0 10 0))) + "Dynamic file browsing grid using ivy" single + ((:keywords "convenience" "files" "matching") + (:authors + ("Clemens Radermacher" . "clemera@posteo.net")) + (:maintainer "Clemens Radermacher" . "clemera@posteo.net") + (:url . "https://github.com/clemera/ivy-explorer"))]) + (ivy-hydra . + [(0 13 5) + ((emacs + (24 5)) + (ivy + (0 13 4)) + (hydra + (0 14 0))) + "Additional key bindings for Ivy" tar + ((:url . "https://github.com/abo-abo/swiper") + (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") + (:authors + ("Oleh Krehel" . "ohwoeowho@gmail.com")) + (:keywords "convenience"))]) + (ivy-posframe . + [(0 6 3) + ((emacs + (26 0)) + (posframe + (1 0 0)) + (ivy + (0 13 0))) + "Using posframe to show Ivy" tar + ((:url . "https://github.com/tumashu/ivy-posframe") + (:keywords "abbrev" "convenience" "matching" "ivy") + (:maintainer "Feng Shu" . "tumashu@163.com") + (:authors + ("Feng Shu" . "tumashu@163.com") + ("Naoya Yamashita" . "conao3@gmail.com")))]) + (javaimp . + [(0 8) + nil "Add and reorder Java import statements in Maven/Gradle projects" tar + ((:keywords "java" "maven" "gradle" "programming") + (:maintainer "Filipp Gunbin" . "fgunbin@fastmail.fm") + (:authors + ("Filipp Gunbin" . "fgunbin@fastmail.fm")) + (:url . "https://elpa.gnu.org/packages/javaimp.html"))]) + (jgraph-mode . + [(1 1) + ((cl-lib + (0 5))) + "Major mode for Jgraph files" single + ((:url . "http://elpa.gnu.org/packages/jgraph-mode.html") + (:keywords "tex" "wp") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (js2-mode . + [(20211229) + ((emacs + (24 1)) + (cl-lib + (0 5))) + "Improved JavaScript editing mode" tar + ((:url . "https://github.com/mooz/js2-mode/") + (:keywords "languages" "javascript") + (:maintainer "Steve Yegge" . "steve.yegge@gmail.com") + (:authors + ("Steve Yegge" . "steve.yegge@gmail.com") + ("mooz" . "stillpedant@gmail.com") + ("Dmitry Gutov" . "dgutov@yandex.ru")))]) + (json-mode . + [(0 2) + ((emacs + (25 1))) + "Major mode for editing JSON files" single + ((:url . "http://elpa.gnu.org/packages/json-mode.html") + (:keywords "data") + (:authors + ("Simen Heggestøyl" . "simenheg@gmail.com")) + (:maintainer "Simen Heggestøyl" . "simenheg@gmail.com"))]) + (jsonrpc . + [(1 0 15) + ((emacs + (25 2))) + "JSON-RPC library" tar + ((:keywords "processes" "languages" "extensions") + (:maintainer "João Távora" . "joaotavora@gmail.com") + (:authors + ("João Távora" . "joaotavora@gmail.com")) + (:url . "https://elpa.gnu.org/packages/jsonrpc.html") + (:commit . "50654cf0b1bf6210fc8f46d8e7ae13bbeeccecb5"))]) + (jumpc . + [(3 0) + nil "jump to previous insertion points" single + ((:url . "http://elpa.gnu.org/packages/jumpc.html") + (:authors + ("Ivan Kanis" . "ivan@kanis.fr")) + (:maintainer "Ivan Kanis" . "ivan@kanis.fr"))]) + (kind-icon . + [(0 1 5) + ((emacs + (27 1)) + (svg-lib + (0))) + "Completion kind icons" tar + ((:url . "https://github.com/jdtsmith/kind-icon") + (:keywords "completion") + (:maintainer "J.D. Smith" . "jdtsmith@gmail.com") + (:authors + ("J.D. Smith" . "jdtsmith@gmail.com")) + (:commit . "235c3d20d1e667d6ac73e11d55a380e070b7cacf"))]) + (kiwix . + [(1 1 5) + ((emacs + (25 1)) + (request + (0 3 0))) + "Searching offline Wikipedia through Kiwix." tar + ((:url . "https://github.com/stardiviner/kiwix.el") + (:keywords "kiwix" "wikipedia") + (:maintainer "stardiviner" . "numbchild@gmail.com") + (:authors + ("stardiviner" . "numbchild@gmail.com")))]) + (kmb . + [(0 1) + ((emacs + (24 1))) + "Kill buffers matching a regexp w/o confirmation" single + ((:url . "http://elpa.gnu.org/packages/kmb.html") + (:keywords "lisp" "convenience") + (:authors + ("Tino Calancha" . "tino.calancha@gmail.com")) + (:maintainer "Tino Calancha" . "tino.calancha@gmail.com"))]) + (landmark . + [(1 0) + nil "Neural-network robot that learns landmarks" single + ((:url . "http://elpa.gnu.org/packages/landmark.html") + (:keywords "games" "neural network" "adaptive search" "chemotaxis") + (:authors + ("Terrence Brannon" . "metaperl@gmail.com")) + (:maintainer nil . "emacs-devel@gnu.org"))]) + (leaf . + [(4 5 5) + ((emacs + (24 1))) + "Simplify your init.el configuration, extended use-package" tar + ((:url . "https://github.com/conao3/leaf.el") + (:keywords "lisp" "settings") + (:maintainer "Naoya Yamashita" . "conao3@gmail.com") + (:authors + ("Naoya Yamashita" . "conao3@gmail.com")) + (:commit . "7cc38f9739eadc569b1179fabe7f7893167105da"))]) + (let-alist . + [(1 0 6) + ((emacs + (24 1))) + "Easily let-bind values of an assoc-list by their names" single + ((:url . "http://elpa.gnu.org/packages/let-alist.html") + (:keywords "extensions" "lisp") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com"))]) + (lex . + [(1 1) + nil "Lexical analyser construction" tar + ((:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:url . "http://elpa.gnu.org/packages/lex.html"))]) + (lin . + [(0 3 1) + ((emacs + (27 1))) + "Make `hl-line-mode' more suitable for selection UIs" tar + ((:url . "https://git.sr.ht/~protesilaos/lin") + (:keywords "convenience" "faces" "theme") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:commit . "520621e51a6f6882beda4420fa5ccee6682748dd"))]) + (lmc . + [(1 4) + ((emacs + (24)) + (cl-lib + (0 5))) + "Little Man Computer in Elisp" single + ((:url . "http://elpa.gnu.org/packages/lmc.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (load-dir . + [(0 0 5) + ((cl-lib + (0 5))) + "Load all Emacs Lisp files in a given directory" single + ((:url . "http://elpa.gnu.org/packages/load-dir.html") + (:keywords "lisp" "files" "convenience") + (:maintainer "Teodor Zlatanov" . "tzz@lifelogs.com"))]) + (load-relative . + [(1 3 1) + nil "Relative file load (within a multi-file Emacs package)" single + ((:keywords "internal") + (:authors + ("Rocky Bernstein" . "rocky@gnu.org")) + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:url . "http://github.com/rocky/emacs-load-relative"))]) + (loc-changes . + [(1 2) + nil "keep track of positions even after buffer changes" single + ((:authors + ("Rocky Bernstein" . "rocky@gnu.org")) + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:url . "http://github.com/rocky/emacs-loc-changes"))]) + (loccur . + [(1 2 4) + ((emacs + (24 3))) + "Perform an occur-like folding in current buffer" single + ((:keywords "matching") + (:authors + ("Alexey Veretennikov" . "alexey.veretennikov@gmail.com")) + (:maintainer "Alexey Veretennikov" . "alexey.veretennikov@gmail.com") + (:url . "https://github.com/fourier/loccur"))]) + (logos . + [(0 3 2) + ((emacs + (27 1))) + "Simple focus mode and extras" tar + ((:url . "https://git.sr.ht/~protesilaos/logos") + (:keywords "convenience" "focus" "writing" "presentation" "narrowing") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:commit . "dd25e36b64320f2ba9400a3929443aa81085e697"))]) + (map . + [(3 2 1) + ((emacs + (26))) + "Map manipulation functions" tar + ((:keywords "extensions" "lisp") + (:maintainer nil . "emacs-devel@gnu.org") + (:authors + ("Nicolas Petton" . "nicolas@petton.fr")) + (:url . "https://elpa.gnu.org/packages/map.html") + (:commit . "fa92b040c6738de7278605cadeace0c5380a0814"))]) + (marginalia . + [(0 13) + ((emacs + (26 1))) + "Enrich existing commands with completion annotations" tar + ((:url . "https://github.com/minad/marginalia") + (:maintainer "Omar Antolín Camarena , Daniel Mendler" . "mail@daniel-mendler.de") + (:authors + ("Omar Antolín Camarena , Daniel Mendler" . "mail@daniel-mendler.de")) + (:commit . "bd98c02720bc59a5c185c293f60595d06dfd7637"))]) + (markchars . + [(0 2 2) + nil "Mark chars fitting certain characteristics" single + ((:url . "http://elpa.gnu.org/packages/markchars.html") + (:authors + ("Lennart Borgman" . "lennart.borgman@gmail.com")) + (:maintainer "Lennart Borgman" . "lennart.borgman@gmail.com"))]) + (math-symbol-lists . + [(1 2 1) + nil "Lists of Unicode math symbols and latex commands" single + ((:keywords "unicode" "symbols" "mathematics") + (:authors + ("Vitalie Spinu" . "spinuvit@gmail.com")) + (:maintainer "Vitalie Spinu" . "spinuvit@gmail.com") + (:url . "https://github.com/vspinu/math-symbol-lists"))]) + (mct . + [(0 5 0) + ((emacs + (27 1))) + "Minibuffer and Completions in Tandem" tar + ((:url . "https://gitlab.com/protesilaos/mct") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:commit . "680d7727216ed05ba58e7d2f04a046d1f27cf3e9"))]) + (memory-usage . + [(0 2) + nil "Analyze the memory usage of Emacs in various ways" single + ((:url . "http://elpa.gnu.org/packages/memory-usage.html") + (:keywords "maint") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (metar . + [(0 3) + ((cl-lib + (0 5))) + "Retrieve and decode METAR weather information" single + ((:url . "http://elpa.gnu.org/packages/metar.html") + (:keywords "comm") + (:authors + ("Mario Lang" . "mlang@delysid.org")) + (:maintainer "Mario Lang" . "mlang@delysid.org"))]) + (midi-kbd . + [(0 2) + ((emacs + (25))) + "Create keyboard events from Midi input" single + ((:url . "http://elpa.gnu.org/packages/midi-kbd.html") + (:keywords "convenience" "hardware" "multimedia") + (:authors + ("David Kastrup" . "dak@gnu.org")) + (:maintainer "David Kastrup" . "dak@gnu.org"))]) + (mines . + [(1 6) + ((emacs + (24 4)) + (cl-lib + (0 5))) + "Minesweeper game" tar + ((:url . "https://github.com/calancha/Minesweeper") + (:maintainer "Tino Calancha" . "tino.calancha@gmail.com") + (:authors + ("Tino Calancha" . "tino.calancha@gmail.com")) + (:keywords "games"))]) + (minibuffer-line . + [(0 1) + nil "Display status info in the minibuffer window" single + ((:url . "http://elpa.gnu.org/packages/minibuffer-line.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (minimap . + [(1 4) + nil "Sidebar showing a \"mini-map\" of a buffer" single + ((:url . "http://elpa.gnu.org/packages/minimap.html") + (:authors + ("David Engster" . "deng@randomsample.de")) + (:maintainer "David Engster" . "deng@randomsample.de"))]) + (mmm-mode . + [(0 5 8) + ((cl-lib + (0 2))) + "Allow Multiple Major Modes in a buffer" tar + ((:url . "https://github.com/purcell/mmm-mode") + (:maintainer "Dmitry Gutov" . "dgutov@yandex.ru") + (:authors + ("Michael Abraham Shulman" . "viritrilbia@gmail.com")) + (:keywords "convenience" "faces" "languages" "tools"))]) + (modus-operandi-theme . + [(0 13 2) + ((emacs + (26 1)) + (modus-themes + (1 2 4))) + "Accessible light theme (WCAG AAA) [DEPRECATED]" tar + ((:url . "https://gitlab.com/protesilaos/modus-themes") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:keywords "faces" "theme" "accessibility"))]) + (modus-themes . + [(2 3 0) + ((emacs + (27 1))) + "Elegant, highly legible and customizable themes" tar + ((:url . "https://gitlab.com/protesilaos/modus-themes") + (:keywords "faces" "theme" "accessibility") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:commit . "7b08e3a8e41db1483322f48305f837e705540249"))]) + (modus-vivendi-theme . + [(0 13 2) + ((emacs + (26 1)) + (modus-themes + (1 2 4))) + "Accessible dark theme (WCAG AAA) [DEPRECATED]" tar + ((:url . "https://gitlab.com/protesilaos/modus-themes") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:keywords "faces" "theme" "accessibility"))]) + (multi-mode . + [(1 14) + nil "support for multiple major modes" tar + ((:url . "http://www.loveshack.ukfsn.org/emacs") + (:keywords "languages" "extensions" "files") + (:maintainer "Dave Love" . "fx@gnu.org") + (:authors + ("Dave Love" . "fx@gnu.org")))]) + (multishell . + [(1 1 9) + ((cl-lib + (0 5))) + "Easily use multiple shell buffers, local and remote" tar + ((:url . "https://github.com/kenmanheimer/EmacsMultishell") + (:maintainer "Ken Manheimer" . "ken.manheimer@gmail.com") + (:authors + ("Ken Manheimer" . "ken.manheimer@gmail.com")) + (:keywords "processes"))]) + (muse . + [(3 20 2) + nil "Authoring and publishing tool for Emacs" tar + ((:url . "http://mwolson.org/projects/EmacsMuse.html") + (:maintainer "Michael Olson" . "mwolson@gnu.org") + (:authors + ("John Wiegley" . "johnw@gnu.org")) + (:keywords "hypermedia"))]) + (myers . + [(0 1) + ((emacs + (25))) + "Random-access singly-linked lists" single + ((:url . "http://elpa.gnu.org/packages/myers.html") + (:keywords "list" "containers") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (nadvice . + [(0 3) + nil "Forward compatibility for Emacs-24.4's nadvice" single + ((:url . "http://elpa.gnu.org/packages/nadvice.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (nameless . + [(1 0 2) + ((emacs + (24 4))) + "Hide package namespace in your emacs-lisp code" single + ((:keywords "convenience" "lisp") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") + (:url . "https://github.com/Malabarba/nameless"))]) + (names . + [(20151201 0) + ((emacs + (24 1)) + (cl-lib + (0 5)) + (nadvice + (0 3))) + "Namespaces for emacs-lisp. Avoid name clobbering without hiding symbols." tar + ((:url . "https://github.com/Malabarba/names") + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:keywords "extensions" "lisp"))]) + (nano-agenda . + [(0 2 1) + ((emacs + (27 1))) + "N Λ N O agenda" tar + ((:url . "https://github.com/rougier/nano-agenda") + (:keywords "convenience" "org-mode" "org-agenda") + (:maintainer "Nicolas P. Rougier" . "Nicolas.Rougier@inria.fr"))]) + (nano-modeline . + [(0 6) + ((emacs + (27 1))) + "N Λ N O modeline" tar + ((:url . "https://github.com/rougier/nano-modeline") + (:keywords "convenience" "mode-line" "header-line") + (:maintainer "Nicolas P. Rougier" . "Nicolas.Rougier@inria.fr") + (:commit . "1c743a9dbe72a1bdc2196ad43a217060e163c929"))]) + (nano-theme . + [(0 3 1) + ((emacs + (27 1))) + "N Λ N O theme" tar + ((:url . "https://github.com/rougier/nano-theme") + (:keywords "theme" "dark" "light") + (:maintainer "Nicolas P. Rougier" . "Nicolas.Rougier@inria.fr") + (:commit . "c4f296d349cf5ef2efd88d68535a4dbf577b9a87"))]) + (nhexl-mode . + [(1 5) + ((emacs + (24 4)) + (cl-lib + (0 5))) + "Minor mode to edit files via hex-dump format" single + ((:url . "http://elpa.gnu.org/packages/nhexl-mode.html") + (:keywords "data") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (nlinum . + [(1 9) + nil "Show line numbers in the margin" single + ((:url . "http://elpa.gnu.org/packages/nlinum.html") + (:keywords "convenience") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (notes-mode . + [(1 30) + nil "Indexing system for on-line note-taking" tar + ((:maintainer nil . ".") + (:authors + (nil . ".")) + (:url . "http://elpa.gnu.org/packages/notes-mode.html"))]) + (ntlm . + [(2 1 0) + nil "NTLM (NT LanManager) authentication support" single + ((:url . "http://elpa.gnu.org/packages/ntlm.html") + (:keywords "ntlm" "sasl" "comm") + (:authors + ("Taro Kawagishi" . "tarok@transpulse.org")) + (:maintainer "Thomas Fitzsimmons" . "fitzsim@fitzsim.org"))]) + (num3-mode . + [(1 3) + nil "highlight groups of digits in long numbers" single + ((:url . "http://elpa.gnu.org/packages/num3-mode.html") + (:keywords "faces" "minor-mode") + (:authors + ("Felix Lee , Michal Nazarewicz" . "mina86@mina86.com")) + (:maintainer "Michal Nazarewicz" . "mina86@mina86.com"))]) + (oauth2 . + [(0 16) + ((cl-lib + (0 5)) + (nadvice + (0 3))) + "OAuth 2.0 Authorization Protocol" tar + ((:maintainer "Julien Danjou" . "julien@danjou.info") + (:authors + ("Julien Danjou" . "julien@danjou.info")) + (:keywords "comm") + (:url . "https://elpa.gnu.org/packages/oauth2.html"))]) + (ob-haxe . + [(1 0) + nil "org-babel functions for haxe evaluation" tar + ((:url . "https://orgmode.org") + (:maintainer "Ian Martins" . "ianxm@jhu.edu") + (:authors + ("Ian Martins" . "ianxm@jhu.edu")) + (:keywords "literate programming" "reproducible research"))]) + (objed . + [(0 8 3) + ((emacs + (25)) + (cl-lib + (0 5))) + "Navigate and edit text objects." tar + ((:url . "https://github.com/clemera/objed") + (:maintainer "Clemens Radermacher" . "clemera@posteo.net") + (:authors + ("Clemens Radermacher" . "clemera@posteo.net")) + (:keywords "convenience"))]) + (omn-mode . + [(1 2) + nil "Support for OWL Manchester Notation" single + ((:url . "http://elpa.gnu.org/packages/omn-mode.html") + (:authors + ("Phillip Lord" . "phillip.lord@newcastle.ac.uk")) + (:maintainer "Phillip Lord" . "phillip.lord@newcastle.ac.uk"))]) + (on-screen . + [(1 3 3) + ((cl-lib + (0))) + "guide your eyes while scrolling" single + ((:keywords "convenience") + (:authors + ("Michael Heerdegen" . "michael_heerdegen@web.de")) + (:maintainer "Michael Heerdegen" . "michael_heerdegen@web.de") + (:url . "https://github.com/michael-heerdegen/on-screen.el"))]) + (orderless . + [(0 7) + ((emacs + (26 1))) + "Completion style for matching regexps in any order" tar + ((:url . "https://github.com/oantolin/orderless") + (:keywords "extensions") + (:maintainer "Omar Antolín Camarena" . "omar@matem.unam.mx") + (:authors + ("Omar Antolín Camarena" . "omar@matem.unam.mx")) + (:commit . "92008e762b30cb445a2227e458cbb9a5e1b1d4e8"))]) + (org . + [(9 5 3) + ((emacs + (25 1))) + "Outline-based notes management and organizer" tar + ((:url . "https://orgmode.org") + (:keywords "outlines" "hypermedia" "calendar" "wp") + (:maintainer "Bastien Guerry" . "bzg@gnu.org") + (:authors + ("Carsten Dominik" . "carsten.dominik@gmail.com")) + (:commit . "69c588947d1be9bca1eb8c773f2a8ff117d264ba"))]) + (org-edna . + [(1 1 2) + ((emacs + (25 1)) + (seq + (2 19)) + (org + (9 0 5))) + "Extensible Dependencies 'N' Actions" tar + ((:url . "https://savannah.nongnu.org/projects/org-edna-el/") + (:maintainer "Ian Dunn" . "dunni@gnu.org") + (:authors + ("Ian Dunn" . "dunni@gnu.org")) + (:keywords "convenience" "text" "org"))]) + (org-modern . + [(0 3) + ((emacs + (27 1))) + "Modern looks for Org" tar + ((:url . "https://github.com/minad/org-modern") + (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") + (:authors + ("Daniel Mendler" . "mail@daniel-mendler.de")) + (:commit . "64fa67a3e4cc7af4084bb879bd8a0e5380333bcf"))]) + (org-real . + [(1 0 4) + ((emacs + (26 1)) + (boxy + (1 0)) + (org + (9 3))) + "Keep track of real things as org-mode links" tar + ((:url . "https://gitlab.com/tygrdev/org-real") + (:keywords "tools") + (:maintainer "Tyler Grinn" . "tylergrinn@gmail.com") + (:authors + ("Tyler Grinn" . "tylergrinn@gmail.com")))]) + (org-remark . + [(1 0 4) + ((emacs + (27 1)) + (org + (9 4))) + "Highlight & annotate any text files" tar + ((:url . "https://github.com/nobiot/org-remark") + (:keywords "org-mode" "annotation" "writing" "note-taking" "marginal-notes") + (:maintainer "Noboru Ota" . "me@nobiot.com") + (:authors + ("Noboru Ota" . "me@nobiot.com")) + (:commit . "e78cdff25edffc74bfe4c65f3a02777d454f6d96"))]) + (org-transclusion . + [(1 2 0) + ((emacs + (27 1)) + (org + (9 4))) + "Transclude text content via links" tar + ((:url . "https://github.com/nobiot/org-transclusion") + (:keywords "org-mode" "transclusion" "writing") + (:maintainer "Noboru Ota" . "me@nobiot.com") + (:authors + ("Noboru Ota" . "me@nobiot.com")) + (:commit . "2d44c56fb666da2dbb6c988389a21bee5bdd406c"))]) + (org-translate . + [(0 1 4) + ((emacs + (27 1)) + (org + (9 1))) + "Org-based translation environment" tar + ((:maintainer "Eric Abrahamsen" . "eric@ericabrahamsen.net") + (:authors + ("Eric Abrahamsen" . "eric@ericabrahamsen.net")) + (:url . "https://elpa.gnu.org/packages/org-translate.html") + (:commit . "bdc5d169ef0c502f46aa673918ccf34fcc8415f2"))]) + (orgalist . + [(1 13) + ((emacs + (24 4))) + "Manage Org-like lists in non-Org buffers" single + ((:url . "http://elpa.gnu.org/packages/orgalist.html") + (:keywords "convenience") + (:authors + ("Nicolas Goaziou" . "mail@nicolasgoaziou.fr")) + (:maintainer "Nicolas Goaziou" . "mail@nicolasgoaziou.fr"))]) + (osc . + [(0 4) + nil "Open Sound Control protocol library" tar + ((:maintainer "Mario Lang" . "mlang@blind.guru") + (:authors + ("Mario Lang" . "mlang@blind.guru")) + (:keywords "comm" "processes" "multimedia") + (:url . "https://elpa.gnu.org/packages/osc.html"))]) + (osm . + [(0 7) + ((emacs + (27 1))) + "OpenStreetMap viewer" tar + ((:url . "https://github.com/minad/osm") + (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") + (:authors + ("Daniel Mendler" . "mail@daniel-mendler.de")) + (:commit . "e3ea969ce1bf84343f357efa2de97e1dd857f481"))]) + (other-frame-window . + [(1 0 6) + ((emacs + (24 4))) + "Minor mode to enable global prefix keys for other frame/window buffer placement" single + ((:url . "http://elpa.gnu.org/packages/other-frame-window.html") + (:keywords "frame" "window") + (:authors + ("Stephen Leake" . "stephen_leake@member.fsf.org")) + (:maintainer "Stephen Leake" . "stephen_leake@member.fsf.org"))]) + (pabbrev . + [(4 2 1) + nil "Predictive abbreviation expansion" single + ((:url . "http://elpa.gnu.org/packages/pabbrev.html") + (:authors + ("Phillip Lord" . "phillip.lord@newcastle.ac.uk")) + (:maintainer "Phillip Lord" . "phillip.lord@newcastle.ac.uk"))]) + (paced . + [(1 1 3) + ((emacs + (25 1)) + (async + (1 9 1))) + "Predictive Abbreviation Completion and Expansion using Dictionaries" tar + ((:url . "https://savannah.nongnu.org/projects/paced-el/") + (:maintainer "Ian Dunn" . "dunni@gnu.org") + (:authors + ("Ian Dunn" . "dunni@gnu.org")) + (:keywords "convenience" "completion"))]) + (parsec . + [(0 1 3) + ((emacs + (24)) + (cl-lib + (0 5))) + "Parser combinator library" tar + ((:url . "https://github.com/cute-jumper/parsec.el") + (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") + (:authors + ("Junpeng Qiu" . "qjpchmail@gmail.com")) + (:keywords "extensions"))]) + (parser-generator . + [(0 1 5) + ((emacs + (26))) + "Parser Generator library" tar + ((:url . "https://github.com/cjohansson/emacs-parser-generator") + (:keywords "tools" "convenience") + (:maintainer "Christian Johansson" . "christian@cvj.se") + (:authors + ("Christian Johansson" . "christian@cvj.se")) + (:commit . "bf7229332f7040d49fdac56e54da13d73752395d"))]) + (path-iterator . + [(1 0) + ((emacs + (25 0))) + "An iterator for traversing a directory path." tar + ((:maintainer "Stephen Leake" . "stephen_leake@stephe-leake.org") + (:authors + ("Stephen Leake" . "stephen_leake@stephe-leake.org")) + (:url . "http://elpa.gnu.org/packages/path-iterator.html"))]) + (peg . + [(1 0) + ((emacs + (25))) + "Parsing Expression Grammars in Emacs Lisp" tar + ((:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca") + (:authors + ("Helmut Eller" . "eller.helmut@gmail.com")) + (:url . "http://elpa.gnu.org/packages/peg.html"))]) + (persist . + [(0 4) + nil "Persist Variables between Emacs Sessions" tar + ((:maintainer "Phillip Lord" . "phillip.lord@russet.org.uk") + (:authors + ("Phillip Lord" . "phillip.lord@russet.org.uk")) + (:url . "http://elpa.gnu.org/packages/persist.html"))]) + (phps-mode . + [(0 4 20) + ((emacs + (26))) + "Major mode for PHP with code intelligence" tar + ((:url . "https://github.com/cjohansson/emacs-phps-mode") + (:keywords "tools" "convenience") + (:maintainer "Christian Johansson" . "christian@cvj.se") + (:authors + ("Christian Johansson" . "christian@cvj.se")) + (:commit . "3a09d15aa143b175235674f4cd45f92b0b0a6c36"))]) + (pinentry . + [(0 1) + nil "GnuPG Pinentry server implementation" single + ((:url . "http://elpa.gnu.org/packages/pinentry.html") + (:keywords "gnupg") + (:authors + ("Daiki Ueno" . "ueno@gnu.org")) + (:maintainer "Daiki Ueno" . "ueno@gnu.org"))]) + (poker . + [(0 2) + nil "Texas hold 'em poker" single + ((:url . "http://elpa.gnu.org/packages/poker.html") + (:keywords "games") + (:authors + ("Mario Lang" . "mlang@delysid.org")) + (:maintainer "Mario Lang" . "mlang@delysid.org"))]) + (posframe . + [(1 1 7) + ((emacs + (26 1))) + "Pop a posframe (just a frame) at point" tar + ((:url . "https://github.com/tumashu/posframe") + (:keywords "convenience" "tooltip") + (:maintainer "Feng Shu" . "tumashu@163.com") + (:authors + ("Feng Shu" . "tumashu@163.com")) + (:commit . "c91d4d53fa479ceb604071008ce0a901770eff57"))]) + (project . + [(0 8 1) + ((emacs + (26 1)) + (xref + (1 0 2))) + "Operations on the current project" tar + ((:url . "https://elpa.gnu.org/packages/project.html") + (:commit . "6bf29072e968401f842789c71468e624e5c913a9"))]) + (psgml . + [(1 3 4) + nil "SGML-editing mode with parsing support" tar + ((:maintainer "Lennart Staflin" . "lstaflin@gmail.com") + (:authors + ("Lennart Staflin" . "lenst@lysator.liu.se") + ("James Clark" . "jjc@clark.com")) + (:keywords "languages") + (:url . "http://elpa.gnu.org/packages/psgml.html"))]) + (pspp-mode . + [(1 1) + nil "Major mode for editing PSPP files" single + ((:url . "http://elpa.gnu.org/packages/pspp-mode.html") + (:keywords "pspp" "major-mode") + (:authors + ("Scott Andrew Borton" . "scott@pp.htv.fi")) + (:maintainer "John Darrington" . "john@darrington.wattle.id.au"))]) + (pulsar . + [(0 3 1) + ((emacs + (27 1))) + "Pulse highlight on demand or after select functions" tar + ((:url . "https://git.sr.ht/~protesilaos/pulsar") + (:keywords "convenience" "pulse" "highlight") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:commit . "86a7c429c6878287c068106b318889824cad3210"))]) + (pyim . + [(4 2 0) + ((emacs + (25 1)) + (async + (1 6)) + (xr + (1 13))) + "A Chinese input method support quanpin, shuangpin, wubi, cangjie and rime." tar + ((:url . "https://github.com/tumashu/pyim") + (:keywords "convenience" "chinese" "pinyin" "input-method") + (:maintainer "Feng Shu" . "tumashu@163.com") + (:authors + ("Ye Wenbin" . "wenbinye@163.com") + ("Feng Shu" . "tumashu@163.com")) + (:commit . "cd1bfd2bbc10fe0ac47d0ec383cde453f6019e6c"))]) + (pyim-basedict . + [(0 5 0) + nil "The default pinyin dict of pyim" tar + ((:url . "https://github.com/tumashu/pyim-basedict") + (:maintainer "Feng Shu" . "tumashu@163.com") + (:authors + ("Feng Shu" . "tumashu@163.com")) + (:keywords "convenience" "chinese" "pinyin" "input-method" "complete"))]) + (python . + [(0 28) + ((emacs + (24 4)) + (cl-lib + (1 0))) + "Python's flying circus support for Emacs" tar + ((:url . "https://github.com/fgallina/python.el") + (:keywords "languages") + (:maintainer nil . "emacs-devel@gnu.org") + (:authors + ("Fabián E. Gallina" . "fgallina@gnu.org")) + (:commit . "b3d0f53b296a0876ec7a55ae840868e65ed54e14"))]) + (quarter-plane . + [(0 1) + nil "Minor mode for quarter-plane style editing" single + ((:url . "http://elpa.gnu.org/packages/quarter-plane.html") + (:keywords "convenience" "wp") + (:authors + ("Peter J. Weisberg" . "pj@irregularexpressions.net")) + (:maintainer "Peter J. Weisberg" . "pj@irregularexpressions.net"))]) + (queue . + [(0 2) + nil "Queue data structure" single + ((:keywords "extensions" "data structures" "queue") + (:authors + ("Inge Wallin" . "inge@lysator.liu.se") + ("Toby Cubitt" . "toby-predictive@dr-qubit.org")) + (:maintainer "Toby Cubitt" . "toby-predictive@dr-qubit.org") + (:url . "http://www.dr-qubit.org/emacs.php"))]) + (rainbow-mode . + [(1 0 6) + nil "Colorize color names in buffers" tar + ((:keywords "faces") + (:maintainer "Julien Danjou" . "julien@danjou.info") + (:authors + ("Julien Danjou" . "julien@danjou.info")) + (:url . "https://elpa.gnu.org/packages/rainbow-mode.html") + (:commit . "ac68593018ef3555e64ea592d72334f4e3e39209"))]) + (rbit . + [(0 1) + nil "Red-black persistent interval trees" single + ((:url . "http://elpa.gnu.org/packages/rbit.html") + (:keywords "data structures" "binary tree" "intervals") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (rcirc-color . + [(0 4 2) + ((emacs + (24 4))) + "color nicks" tar + ((:maintainer "Alex Schroeder" . "alex@gnu.org") + (:authors + ("Alex Schroeder" . "alex@gnu.org")) + (:keywords "comm") + (:url . "https://elpa.gnu.org/packages/rcirc-color.html"))]) + (rcirc-menu . + [(1 1) + nil "A menu of all your rcirc connections" single + ((:url . "http://elpa.gnu.org/packages/rcirc-menu.html") + (:keywords "comm") + (:authors + ("Alex Schroeder" . "alex@gnu.org")) + (:maintainer "Alex Schroeder" . "alex@gnu.org"))]) + (realgud . + [(1 5 1) + ((load-relative + (1 3 1)) + (loc-changes + (1 2)) + (test-simple + (1 3 0)) + (emacs + (25))) + "A modular front-end for interacting with external debuggers" tar + ((:url . "http://github.com/realgud/realgud/") + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:authors + ("Rocky Bernstein" . "rocky@gnu.org")) + (:keywords "debugger" "gdb" "python" "perl" "go" "bash" "zsh" "bashdb" "zshdb" "remake" "trepan" "perldb" "pdb"))]) + (realgud-ipdb . + [(1 0 0) + ((realgud + (1 5 0)) + (load-relative + (1 3 1)) + (emacs + (25))) + "Realgud front-end to ipdb" tar + ((:url . "http://github.com/rocky/realgud-ipdb") + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:authors + ("Rocky Bernstein" . "rocky@gnu.org")))]) + (realgud-jdb . + [(1 0 0) + ((realgud + (1 4 5)) + (load-relative + (1 2)) + (cl-lib + (0 5)) + (emacs + (25))) + "Realgud front-end to Java's jdb debugger\"" tar + ((:url . "http://github.com/realgud/realgud-jdb") + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:authors + ("Rocky Bernstein" . "rocky@gnu.org")))]) + (realgud-lldb . + [(1 0 2) + ((load-relative + (1 3 1)) + (realgud + (1 5 0)) + (emacs + (25))) + "Realgud front-end to lldb" tar + ((:url . "http://github.com/realgud/realgud-lldb") + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:authors + ("Rocky Bernstein" . "rocky@gnu.org")))]) + (realgud-node-debug . + [(1 0 0) + ((realgud + (1 4 5)) + (load-relative + (1 2)) + (cl-lib + (0 5)) + (emacs + (25))) + "Realgud front-end to older \"node debug\"" tar + ((:url . "http://github.com/realgud/realgud-node-debug") + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:authors + ("Rocky Bernstein" . "rocky@gnu.org")))]) + (realgud-node-inspect . + [(1 0 0) + ((realgud + (1 4 5)) + (load-relative + (1 2)) + (cl-lib + (0 5)) + (emacs + (24))) + "Realgud front-end to newer \"node inspect\"" tar + ((:url . "http://github.com/realgud/realgud-node-inspect") + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:authors + ("Rocky Bernstein" . "rocky@gnu.org")))]) + (realgud-trepan-ni . + [(1 0 1) + ((load-relative + (1 2)) + (realgud + (1 5 0)) + (cl-lib + (0 5)) + (emacs + (25))) + "Realgud front-end to trepan-ni" tar + ((:url . "http://github.com/realgud/realgud-trepan-ni") + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:authors + ("Rocky Bernstein" . "rocky@gnu.org")))]) + (rec-mode . + [(1 8 3) + ((emacs + (25))) + "Major mode for viewing/editing rec files" tar + ((:url . "https://www.gnu.org/software/recutils/") + (:maintainer "Antoine Kalmbach" . "ane@iki.fi") + (:authors + ("Jose E. Marchesi" . "jemarch@gnu.org")) + (:commit . "24adb19f70f682f28d6edac03598b1fee971d599"))]) + (register-list . + [(0 1) + nil "Interactively list/edit registers" single + ((:url . "http://elpa.gnu.org/packages/register-list.html") + (:keywords "register") + (:authors + ("Bastien Guerry" . "bzg@gnu.org")) + (:maintainer "Bastien Guerry" . "bzg@gnu.org"))]) + (relint . + [(1 20) + ((xr + (1 22)) + (emacs + (26 1))) + "Elisp regexp mistake finder" tar + ((:url . "https://github.com/mattiase/relint") + (:keywords "lisp" "regexps") + (:maintainer "Mattias Engdegård" . "mattiase@acm.org") + (:authors + ("Mattias Engdegård" . "mattiase@acm.org")) + (:commit . "5a918af0c99ab83355d4ec73a2fb39e70c173956"))]) + (repology . + [(1 2 3) + ((emacs + (26 1))) + "Repology API access via Elisp" tar + ((:keywords "web") + (:maintainer "Nicolas Goaziou" . "mail@nicolasgoaziou.fr") + (:authors + ("Nicolas Goaziou" . "mail@nicolasgoaziou.fr")) + (:url . "https://elpa.gnu.org/packages/repology.html") + (:commit . "b5829003decbdbe9002e7e1d29f45989a4659927"))]) + (rich-minority . + [(1 0 3) + ((cl-lib + (0 5))) + "Clean-up and Beautify the list of minor-modes." tar + ((:url . "https://github.com/Malabarba/rich-minority") + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:keywords "mode-line" "faces"))]) + (rnc-mode . + [(0 2) + nil "Emacs mode to edit Relax-NG Compact files" single + ((:url . "http://elpa.gnu.org/packages/rnc-mode.html") + (:keywords "xml" "relaxng") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (rt-liberation . + [(5) + nil "Emacs interface to RT" tar + ((:url . "http://www.nongnu.org/rtliber/") + (:keywords "rt" "tickets") + (:maintainer "Yoni Rabkin" . "yrk@gnu.org") + (:authors + ("Yoni Rabkin" . "yrk@gnu.org")) + (:commit . "b76ae2828b12efc5f45f51ba873489e049a70924"))]) + (rudel . + [(0 3 2) + ((emacs + (24)) + (cl-lib + (0 5)) + (cl-generic + (0 3)) + (cl-print + (1 0))) + "A collaborative editing framework for Emacs" tar + ((:url . "http://rudel.sourceforge.net/") + (:maintainer "Jan Moringen" . "scymtym@users.sourceforge.net") + (:authors + ("Jan Moringen" . "scymtym@users.sourceforge.net")) + (:keywords "rudel" "collaboration"))]) + (satchel . + [(0 2) + ((emacs + (27 2)) + (project + (0 8 1))) + "A bag for your files, separated by git branches" tar + ((:keywords "tools" "languages") + (:maintainer "Theodor Thornhill" . "theo@thornhill.no") + (:authors + ("Theodor Thornhill" . "theo@thornhill.no")) + (:url . "https://elpa.gnu.org/packages/satchel.html") + (:commit . "6e5613e203f6937202cb5d55249e7e6be939067b"))]) + (scanner . + [(0 2) + ((emacs + (25 1)) + (dash + (2 12 0))) + "Scan documents and images" tar + ((:url . "https://gitlab.com/rstocker/scanner.git") + (:maintainer "Raffael Stocker" . "r.stocker@mnet-mail.de") + (:authors + ("Raffael Stocker" . "r.stocker@mnet-mail.de")) + (:keywords "hardware" "multimedia"))]) + (scroll-restore . + [(1 0) + nil "restore original position after scrolling" single + ((:url . "http://elpa.gnu.org/packages/scroll-restore.html") + (:keywords "scrolling") + (:authors + ("Martin Rudalics" . "rudalics@gmx.at")) + (:maintainer "Martin Rudalics" . "rudalics@gmx.at"))]) + (sed-mode . + [(1 0) + nil "Major mode to edit sed scripts" single + ((:url . "http://elpa.gnu.org/packages/sed-mode.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (seq . + [(2 23) + nil "Sequence manipulation functions" tar + ((:keywords "sequences") + (:maintainer nil . "emacs-devel@gnu.org") + (:authors + ("Nicolas Petton" . "nicolas@petton.fr")) + (:url . "https://elpa.gnu.org/packages/seq.html"))]) + (setup . + [(1 2 0) + ((emacs + (26 1))) + "Helpful Configuration Macro" tar + ((:url . "https://git.sr.ht/~pkal/setup") + (:keywords "lisp" "local") + (:maintainer "Philip Kaludercic" . "philipk@posteo.net") + (:authors + ("Philip Kaludercic" . "philipk@posteo.net")))]) + (shelisp . + [(1 0 0) + nil "execute elisp in shell" tar + ((:keywords "terminals" "lisp" "processes") + (:maintainer "Michael R. Mauger" . "michael@mauger.com") + (:authors + ("Michael R. Mauger" . "michael@mauger.com")) + (:url . "https://elpa.gnu.org/packages/shelisp.html"))]) + (shell-command+ . + [(2 3 2) + ((emacs + (24 1))) + "An extended shell-command" tar + ((:url . "https://git.sr.ht/~pkal/shell-command-plus") + (:keywords "unix" "processes" "convenience") + (:maintainer "Philip Kaludercic" . "philipk@posteo.net") + (:authors + ("Philip Kaludercic" . "philipk@posteo.net")))]) + (shen-mode . + [(0 1) + nil "A major mode for editing shen source code" tar + ((:maintainer "Eric Schulte" . "schulte.eric@gmail.com") + (:authors + ("Eric Schulte" . "schulte.eric@gmail.com")) + (:keywords "languages" "shen") + (:url . "http://elpa.gnu.org/packages/shen-mode.html"))]) + (sisu-mode . + [(7 1 8) + nil "Major mode for SiSU markup text" single + ((:keywords "text" "syntax" "processes" "tools") + (:authors + ("Ralph Amissah & Ambrose Kofi Laing")) + (:maintainer "Ralph Amissah" . "ralph.amissah@gmail.com") + (:url . "http://www.sisudoc.org/"))]) + (sketch-mode . + [(1 0 4) + nil "Quickly create svg sketches using keyboard and mouse" tar + ((:url . "https://github.com/dalanicolai/sketch-mode") + (:keywords "multimedia") + (:maintainer "D.L. Nicolai" . "dalanicolai@gmail.com") + (:authors + ("D.L. Nicolai" . "dalanicolai@gmail.com")))]) + (slime-volleyball . + [(1 2 0) + ((cl-lib + (0 5))) + "An SVG Slime Volleyball Game" tar + ((:maintainer "Thomas Fitzsimmons" . "fitzsim@fitzsim.org") + (:authors + ("Thomas Fitzsimmons" . "fitzsim@fitzsim.org")) + (:keywords "games") + (:url . "https://elpa.gnu.org/packages/slime-volleyball.html"))]) + (sm-c-mode . + [(1 1) + nil "C major mode based on SMIE" single + ((:url . "http://elpa.gnu.org/packages/sm-c-mode.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (smalltalk-mode . + [(4 0) + nil "Major mode for the GNU Smalltalk programming language" tar + ((:maintainer "Derek Zhou" . "derek@3qin.us") + (:authors + ("Steve Byrne")) + (:url . "https://elpa.gnu.org/packages/smalltalk-mode.html"))]) + (smart-yank . + [(0 1 1) + ((emacs + (24))) + "A different approach of yank pointer handling" single + ((:url . "http://elpa.gnu.org/packages/smart-yank.html") + (:keywords "convenience") + (:authors + ("Michael Heerdegen" . "michael_heerdegen@web.de")) + (:maintainer "Michael Heerdegen" . "michael_heerdegen@web.de"))]) + (sml-mode . + [(6 10) + ((emacs + (24 3)) + (cl-lib + (0 5))) + "Major mode for editing (Standard) ML" single + ((:url . "http://elpa.gnu.org/packages/sml-mode.html") + (:keywords "sml") + (:authors + ("Lars Bo Nielsen") + (" Olin Shivers") + (" Fritz Knabe (?)") + (" Steven Gilmore (?)") + (" Matthew Morley" . "mjm@scs.leeds.ac.uk") + (" Matthias Blume" . "blume@cs.princeton.edu") + (" (Stefan Monnier)" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (so-long . + [(1 1 2) + ((emacs + (24 4))) + "Say farewell to performance problems with minified code." tar + ((:url . "https://savannah.nongnu.org/projects/so-long") + (:keywords "convenience") + (:maintainer "Phil Sainty" . "psainty@orcon.net.nz") + (:authors + ("Phil Sainty" . "psainty@orcon.net.nz")) + (:commit . "045a4fe94c18cd36ef297e62a80cdff449af3aa5"))]) + (soap-client . + [(3 2 1) + ((emacs + (24 1)) + (cl-lib + (0 6 1))) + "Access SOAP web services" tar + ((:url . "https://github.com/alex-hhh/emacs-soap-client") + (:keywords "soap" "web-services" "comm" "hypermedia") + (:maintainer "Alexandru Harsanyi" . "AlexHarsanyi@gmail.com") + (:authors + ("Alexandru Harsanyi" . "AlexHarsanyi@gmail.com")) + (:commit . "37eef19fd608ca81acb40f974b8d7bbe7fc27127"))]) + (sokoban . + [(1 4 8) + ((emacs + (23 1)) + (cl-lib + (0 5))) + "Implementation of Sokoban for Emacs." tar + ((:maintainer "Dieter Deyke" . "dieter.deyke@gmail.com") + (:authors + ("Glynn Clements" . "glynn.clements@xemacs.org")) + (:keywords "games") + (:url . "http://elpa.gnu.org/packages/sokoban.html"))]) + (sotlisp . + [(1 6 2) + ((emacs + (24 1))) + "Write lisp at the speed of thought." single + ((:keywords "convenience" "lisp") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") + (:url . "https://github.com/Malabarba/speed-of-thought-lisp"))]) + (spinner . + [(1 7 4) + ((emacs + (24 3))) + "Add spinners and progress-bars to the mode-line for ongoing operations" tar + ((:url . "https://github.com/Malabarba/spinner.el") + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:keywords "processes" "mode-line"))]) + (sql-beeline . + [(0 1) + nil "Beeline support for sql.el" tar + ((:keywords "sql" "hive" "beeline" "hiveserver2") + (:maintainer "Filipp Gunbin" . "fgunbin@fastmail.fm") + (:authors + ("Filipp Gunbin" . "fgunbin@fastmail.fm")) + (:url . "https://elpa.gnu.org/packages/sql-beeline.html"))]) + (sql-cassandra . + [(0 2 1) + ((emacs + (29))) + "Cassandra support for sql.el" tar + ((:keywords "sql" "cassandra" "cql" "cqlsh") + (:maintainer "Filipp Gunbin" . "fgunbin@fastmail.fm") + (:authors + ("Filipp Gunbin" . "fgunbin@fastmail.fm")) + (:url . "https://elpa.gnu.org/packages/sql-cassandra.html") + (:commit . "2920f8c64e937904087f3636696501fb1cfe7acc"))]) + (sql-indent . + [(1 6) + ((cl-lib + (0 5))) + "Support for indenting code in SQL files." tar + ((:url . "https://github.com/alex-hhh/emacs-sql-indent") + (:maintainer "Alex Harsanyi" . "AlexHarsanyi@gmail.com") + (:authors + ("Alex Harsanyi" . "AlexHarsanyi@gmail.com")) + (:keywords "languages" "sql"))]) + (ssh-deploy . + [(3 1 13) + ((emacs + (25))) + "Deployment via Tramp, global or per directory." tar + ((:url . "https://github.com/cjohansson/emacs-ssh-deploy") + (:maintainer "Christian Johansson" . "christian@cvj.se") + (:authors + ("Christian Johansson" . "christian@cvj.se")) + (:keywords "tools" "convenience"))]) + (stream . + [(2 2 5) + ((emacs + (25))) + "Implementation of streams" tar + ((:maintainer nil . "nicolas@petton.fr") + (:authors + ("Nicolas Petton" . "nicolas@petton.fr")) + (:keywords "stream" "laziness" "sequences") + (:url . "http://elpa.gnu.org/packages/stream.html"))]) + (svg . + [(1 1) + ((emacs + (25))) + "SVG image creation functions" single + ((:url . "http://elpa.gnu.org/packages/svg.html") + (:keywords "image") + (:authors + ("Lars Magne Ingebrigtsen" . "larsi@gnus.org") + ("Felix E. Klee" . "felix.klee@inka.de")) + (:maintainer "Lars Magne Ingebrigtsen" . "larsi@gnus.org"))]) + (svg-clock . + [(1 2) + ((svg + (1 0)) + (emacs + (27 0))) + "Analog clock using Scalable Vector Graphics" single + ((:url . "http://elpa.gnu.org/packages/svg-clock.html") + (:keywords "demo" "svg" "clock") + (:authors + ("Ulf Jasper" . "ulf.jasper@web.de")) + (:maintainer "Ulf Jasper" . "ulf.jasper@web.de"))]) + (svg-lib . + [(0 2 5) + ((emacs + (27 1))) + "SVG tags, progress bars & icons" tar + ((:url . "https://github.com/rougier/svg-lib") + (:keywords "svg" "icons" "tags" "convenience") + (:maintainer "Nicolas P. Rougier" . "Nicolas.Rougier@inria.fr") + (:commit . "0486c9453449771bc3f5872f70bc5cb23580d0f4"))]) + (svg-tag-mode . + [(0 3 2) + ((emacs + (27 1)) + (svg-lib + (0 2))) + "Replace keywords with SVG tags" tar + ((:url . "https://github.com/rougier/svg-tag-mode") + (:keywords "convenience") + (:maintainer "Nicolas P. Rougier" . "Nicolas.Rougier@inria.fr") + (:authors + ("Nicolas P. Rougier" . "Nicolas.Rougier@inria.fr")))]) + (swiper . + [(0 13 4) + ((emacs + (24 5)) + (ivy + (0 13 4))) + "Isearch with an overview. Oh, man!" tar + ((:url . "https://github.com/abo-abo/swiper") + (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") + (:authors + ("Oleh Krehel" . "ohwoeowho@gmail.com")) + (:keywords "matching"))]) + (system-packages . + [(1 0 11) + ((emacs + (24 3))) + "functions to manage system packages" tar + ((:url . "https://gitlab.com/jabranham/system-packages") + (:maintainer "J. Alexander Branham" . "alex.branham@gmail.com") + (:authors + ("J. Alexander Branham" . "alex.branham@gmail.com")))]) + (tNFA . + [(0 1 1) + ((queue + (0 1))) + "Tagged non-deterministic finite-state automata" single + ((:keywords "extensions" "matching" "data structures tnfa" "nfa" "dfa" "finite state automata" "automata" "regexp") + (:authors + ("Toby Cubitt" . "toby-predictive@dr-qubit.org")) + (:maintainer "Toby Cubitt" . "toby-predictive@dr-qubit.org") + (:url . "http://www.dr-qubit.org/emacs.php"))]) + (taxy . + [(0 9) + ((emacs + (26 3))) + "Programmable taxonomical grouping for arbitrary objects" tar + ((:url . "https://github.com/alphapapa/taxy.el") + (:keywords "lisp") + (:maintainer "Adam Porter" . "adam@alphapapa.net") + (:authors + ("Adam Porter" . "adam@alphapapa.net")) + (:commit . "b209692b632bbe8d7f97ea8a39b0c28c1be3b7ec"))]) + (taxy-magit-section . + [(0 9 1) + ((emacs + (26 3)) + (magit-section + (3 2 1))) + "View Taxy structs in a Magit Section buffer" tar + ((:url . "https://github.com/alphapapa/taxy.el") + (:keywords "lisp") + (:maintainer "Adam Porter" . "adam@alphapapa.net") + (:authors + ("Adam Porter" . "adam@alphapapa.net")) + (:commit . "62624c32d7f58bfa4acc89becc7cc8427d546aab"))]) + (temp-buffer-browse . + [(1 5) + ((emacs + (24))) + "temp buffer browse mode" single + ((:url . "http://elpa.gnu.org/packages/temp-buffer-browse.html") + (:keywords "convenience") + (:authors + ("Leo Liu" . "sdl.web@gmail.com")) + (:maintainer "Leo Liu" . "sdl.web@gmail.com"))]) + (tempel . + [(0 3) + ((emacs + (27 1))) + "Tempo templates/snippets with in-buffer field editing" tar + ((:url . "https://github.com/minad/tempel") + (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") + (:authors + ("Daniel Mendler" . "mail@daniel-mendler.de")) + (:commit . "ee964c24b69579fcd5ec3c7d3d1d84d1ca3d90e4"))]) + (test-simple . + [(1 3 0) + ((cl-lib + (0))) + "Simple Unit Test Framework for Emacs Lisp" single + ((:keywords "unit-test") + (:authors + ("Rocky Bernstein" . "rocky@gnu.org")) + (:maintainer "Rocky Bernstein" . "rocky@gnu.org") + (:url . "http://github.com/rocky/emacs-test-simple"))]) + (timerfunctions . + [(1 4 2) + ((cl-lib + (0 5)) + (emacs + (24))) + "Enhanced versions of some timer.el functions" single + ((:url . "http://elpa.gnu.org/packages/timerfunctions.html") + (:authors + ("Dave Goel" . "deego3@gmail.com")) + (:maintainer "Dave Goel" . "deego3@gmail.com"))]) + (tiny . + [(0 2 1) + nil "Quickly generate linear ranges in Emacs" tar + ((:url . "https://github.com/abo-abo/tiny") + (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") + (:authors + ("Oleh Krehel" . "ohwoeowho@gmail.com")) + (:keywords "convenience"))]) + (tmr . + [(0 2 3) + ((emacs + (27 1))) + "Set timers using a convenient notation" tar + ((:url . "https://git.sr.ht/~protesilaos/tmr") + (:keywords "convenience" "timer") + (:maintainer "Protesilaos Stavrou" . "info@protesilaos.com") + (:authors + ("Protesilaos Stavrou" . "info@protesilaos.com")) + (:commit . "7157ec61c451e3b97ba6117688d0de52bf294bea"))]) + (tomelr . + [(0 3 0) + ((emacs + (26 3)) + (map + (3 2 1)) + (seq + (2 23))) + "Convert S-expressions to TOML" tar + ((:url . "https://github.com/kaushalmodi/tomelr/") + (:keywords "data" "tools" "toml" "serialization" "config") + (:maintainer "Kaushal Modi" . "kaushal.modi@gmail.com") + (:authors + ("Kaushal Modi" . "kaushal.modi@gmail.com")) + (:commit . "ede27810243a3bf0872d4d30bb02a51ba9e8166f"))]) + (tramp . + [(2 5 2 4) + ((emacs + (25 1))) + "Transparent Remote Access, Multiple Protocol" tar + ((:url . "https://www.gnu.org/software/tramp/") + (:keywords "comm" "processes") + (:maintainer "Michael Albinus" . "michael.albinus@gmx.de") + (:authors + ("Kai Großjohann" . "kai.grossjohann@gmx.net")) + (:commit . "8f2578d043d2d633c20a74a8b836920b7d0a3fa0"))]) + (tramp-nspawn . + [(1 0) + ((emacs + (23))) + "Tramp integration for systemd-nspawn containers" tar + ((:url . "https://github.com/bjc/tramp-nspawn") + (:keywords "tramp" "nspawn" "machinectl" "systemd" "systemd-nspawn") + (:maintainer "Brian Cully" . "bjc@kublai.com") + (:authors + ("Brian Cully" . "bjc@kublai.com")) + (:commit . "b8380ee8a7c15ad4b96963d224969fc1a0337180"))]) + (tramp-theme . + [(0 2) + ((emacs + (24 1))) + "Custom theme for remote buffers" single + ((:url . "http://elpa.gnu.org/packages/tramp-theme.html") + (:keywords "convenience" "faces") + (:authors + ("Michael Albinus" . "michael.albinus@gmx.de")) + (:maintainer "Michael Albinus" . "michael.albinus@gmx.de"))]) + (transcribe . + [(1 5 2) + nil "Package for audio transcriptions" single + ((:url . "http://elpa.gnu.org/packages/transcribe.html") + (:authors + ("David Gonzalez Gandara" . "dggandara@member.fsf.org")) + (:maintainer "David Gonzalez Gandara" . "dggandara@member.fsf.org"))]) + (transient . + [(0 3 7) + ((emacs + (25 1))) + "Transient commands" tar + ((:url . "https://github.com/magit/transient") + (:keywords "bindings") + (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") + (:authors + ("Jonas Bernoulli" . "jonas@bernoul.li")))]) + (transient-cycles . + [(1 0) + ((emacs + (27 1))) + "Define command variants with transient cycling" tar + ((:url . "https://git.spwhitton.name/dotfiles/tree/.emacs.d/site-lisp/transient-cycles.el") + (:keywords "buffer" "window" "minor-mode" "convenience") + (:maintainer "Sean Whitton" . "spwhitton@spwhitton.name") + (:authors + ("Sean Whitton" . "spwhitton@spwhitton.name")) + (:commit . "a5b86dd04e84e7ff1cf8c4062843fccb92991145"))]) + (trie . + [(0 5) + ((tNFA + (0 1 1)) + (heap + (0 3))) + "Trie data structure" tar + ((:url . "http://www.dr-qubit.org/emacs.php") + (:maintainer "Toby Cubitt" . "toby-predictive@dr-qubit.org") + (:authors + ("Toby Cubitt" . "toby-predictive@dr-qubit.org")) + (:keywords "extensions" "matching" "data structures trie" "ternary search tree" "tree" "completion" "regexp"))]) + (undo-tree . + [(0 8 2) + ((queue + (0 2)) + (emacs + (24 3))) + "Treat undo history as a tree" tar + ((:url . "https://www.dr-qubit.org/undo-tree.html") + (:keywords "convenience" "files" "undo" "redo" "history" "tree") + (:maintainer "Toby Cubitt" . "toby+undo-tree@dr-qubit.org") + (:authors + ("Toby Cubitt" . "toby+undo-tree@dr-qubit.org")) + (:commit . "42aab056e37e033816b2d192f9121b89410b958e"))]) + (uni-confusables . + [(0 3) + nil "Unicode confusables table" tar + ((:maintainer "Teodor Zlatanov" . "tzz@lifelogs.com") + (:url . "https://elpa.gnu.org/packages/uni-confusables.html") + (:commit . "393e1adeec5b0eb51f9606983655cfe2272c6e54"))]) + (uniquify-files . + [(1 0 3) + ((emacs + (25 0))) + "Completion style for files, minimizing directories" tar + ((:keywords "completion" "table" "uniquify") + (:maintainer "Stephen Leake" . "stephen_leake@stephe-leake.org") + (:authors + ("Stephen Leake" . "stephen_leake@stephe-leake.org")) + (:url . "https://elpa.gnu.org/packages/uniquify-files.html"))]) + (url-http-ntlm . + [(2 0 4) + ((cl-lib + (0 5)) + (ntlm + (2 1 0))) + "NTLM authentication for the url library" single + ((:keywords "comm" "data" "processes" "hypermedia") + (:authors + ("Tom Schutzer-Weissmann" . "tom.weissmann@gmail.com")) + (:maintainer "Thomas Fitzsimmons" . "fitzsim@fitzsim.org") + (:url . "https://code.google.com/p/url-http-ntlm/"))]) + (validate . + [(1 0 4) + ((emacs + (24 1)) + (cl-lib + (0 5)) + (seq + (2 16))) + "Schema validation for Emacs-lisp" single + ((:url . "http://elpa.gnu.org/packages/validate.html") + (:keywords "lisp") + (:authors + ("Artur Malabarba" . "emacs@endlessparentheses.com")) + (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com"))]) + (valign . + [(3 1 1) + ((emacs + (26 0))) + "Visually align tables" tar + ((:url . "https://github.com/casouri/valign") + (:maintainer "Yuan Fu" . "casouri@gmail.com") + (:authors + ("Yuan Fu" . "casouri@gmail.com")) + (:keywords "convenience" "text" "table"))]) + (vc-backup . + [(1 1 0) + nil "VC backend for versioned backups" tar + ((:url . "https://git.sr.ht/~pkal/vc-backup") + (:keywords "vc") + (:maintainer "Philip Kaludercic" . "philipk@posteo.net") + (:authors + ("Philip Kaludercic" . "philipk@posteo.net")))]) + (vc-got . + [(1 1) + ((emacs + (25 1))) + "VC backend for Game of Trees VCS" tar + ((:url . "https://git.omarpolo.com/vc-got/") + (:keywords "vc" "tools") + (:maintainer "Omar Polo" . "op@omarpolo.com") + (:authors + ("Omar Polo" . "op@omarpolo.com") + ("Timo Myyrä" . "timo.myyra@bittivirhe.fi")) + (:commit . "86d9909a7e54c02179e40afd05693c00f6689edc"))]) + (vc-hgcmd . + [(1 14 1) + ((emacs + (25 1))) + "VC mercurial backend that uses hg command server" tar + ((:url . "https://github.com/muffinmad/emacs-vc-hgcmd") + (:keywords "vc") + (:maintainer "Andrii Kolomoiets" . "andreyk.mad@gmail.com") + (:authors + ("Andrii Kolomoiets" . "andreyk.mad@gmail.com")))]) + (vcard . + [(0 2 1) + ((emacs + (27 1))) + "Package for handling vCard files" tar + ((:maintainer "Eric Abrahamsen" . "eric@ericabrahamsen.net") + (:authors + ("Eric Abrahamsen" . "eric@ericabrahamsen.net")) + (:url . "https://elpa.gnu.org/packages/vcard.html"))]) + (vcl-mode . + [(1 1) + nil "Major mode for Varnish Configuration Language" single + ((:url . "http://elpa.gnu.org/packages/vcl-mode.html") + (:keywords "varnish" "vcl") + (:authors + ("Sergey Poznyakoff" . "gray@gnu.org.ua")) + (:maintainer "Sergey Poznyakoff" . "gray@gnu.org.ua"))]) + (vdiff . + [(0 2 4) + ((emacs + (24 4)) + (hydra + (0 13 0))) + "A diff tool similar to vimdiff" tar + ((:url . "https://github.com/justbur/emacs-vdiff") + (:maintainer "Justin Burkett" . "justin@burkett.cc") + (:authors + ("Justin Burkett" . "justin@burkett.cc")) + (:keywords "diff"))]) + (verilog-mode . + [(2021 10 14 127365406) + nil "major mode for editing verilog source in Emacs" tar + ((:url . "https://www.veripool.org") + (:keywords "languages") + (:maintainer "Michael McNamara" . "mac@verilog.com") + (:authors + ("Michael McNamara" . "mac@verilog.com") + ("Wilson Snyder" . "wsnyder@wsnyder.org")) + (:commit . "86f08fb377e2b8f2df0614c48783bdce347f3758"))]) + (vertico . + [(0 23) + ((emacs + (27 1))) + "VERTical Interactive COmpletion" tar + ((:url . "https://github.com/minad/vertico") + (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") + (:authors + ("Daniel Mendler" . "mail@daniel-mendler.de")) + (:commit . "68bb4d67e295bd75b8ef1a6d5ddda26849510fa6"))]) + (vertico-posframe . + [(0 5 4) + ((emacs + (26 0)) + (posframe + (1 1 4)) + (vertico + (0 13 0))) + "Using posframe to show Vertico" tar + ((:url . "https://github.com/tumashu/vertico-posframe") + (:keywords "abbrev" "convenience" "matching" "vertico") + (:maintainer "Feng Shu" . "tumashu@163.com") + (:authors + ("Feng Shu" . "tumashu@163.com")) + (:commit . "7ca364d319e7ba8ccba26a0d57513f3e66f1b05b"))]) + (vigenere . + [(1 0) + ((emacs + (25 1))) + "Run a vigenere cipher on a block of text ;" single + ((:keywords "data" "vigenere" "cipher") + (:authors + ("Ian Dunn" . "dunni@gnu.org")) + (:maintainer "Ian Dunn" . "dunni@gnu.org") + (:url . "https://elpa.gnu.org/packages/vigenere.html"))]) + (visual-filename-abbrev . + [(1 1) + ((emacs + (26 1))) + "Visually abbreviate filenames" tar + ((:maintainer "Tassilo Horn" . "tsdh@gnu.org") + (:authors + ("Tassilo Horn" . "tsdh@gnu.org")) + (:keywords "tools") + (:url . "https://elpa.gnu.org/packages/visual-filename-abbrev.html"))]) + (visual-fill . + [(0 1) + nil "Auto-refill paragraphs without modifying the buffer" single + ((:url . "http://elpa.gnu.org/packages/visual-fill.html") + (:authors + ("Stefan Monnier" . "monnier@iro.umontreal.ca")) + (:maintainer "Stefan Monnier" . "monnier@iro.umontreal.ca"))]) + (vlf . + [(1 7 2) + nil "View Large Files" tar + ((:url . "https://github.com/m00natic/vlfi") + (:maintainer "Andrey Kotlarski" . "m00naticus@gmail.com") + (:keywords "large files" "utilities"))]) + (vundo . + [(2 0 0) + ((emacs + (28 1))) + "Visual undo tree" tar + ((:url . "https://github.com/casouri/vundo") + (:keywords "undo" "text" "editing") + (:maintainer "Yuan Fu" . "casouri@gmail.com") + (:authors + ("Yuan Fu" . "casouri@gmail.com")) + (:commit . "10d5debe317b2244d19085151040f955dda4a9ab"))]) + (wcheck-mode . + [(2021) + nil "General interface for text checkers" tar + ((:url . "https://github.com/tlikonen/wcheck-mode") + (:keywords "text" "spell" "check" "languages" "ispell") + (:maintainer "Teemu Likonen" . "tlikonen@iki.fi") + (:authors + ("Teemu Likonen" . "tlikonen@iki.fi")))]) + (wconf . + [(0 2 1) + ((emacs + (24 4))) + "Minimal window layout manager" single + ((:keywords "windows" "frames" "layout") + (:authors + ("Ingo Lohmar" . "i.lohmar@gmail.com")) + (:maintainer "Ingo Lohmar" . "i.lohmar@gmail.com") + (:url . "https://github.com/ilohmar/wconf"))]) + (web-server . + [(0 1 2) + ((emacs + (24 3))) + "Emacs Web Server" tar + ((:url . "https://github.com/eschulte/emacs-web-server") + (:maintainer "Eric Schulte" . "schulte.eric@gmail.com") + (:authors + ("Eric Schulte" . "schulte.eric@gmail.com")) + (:keywords "http" "server" "network"))]) + (webfeeder . + [(1 1 2) + ((emacs + (25 1))) + "Build RSS and Atom webfeeds from HTML files" tar + ((:url . "https://gitlab.com/Ambrevar/emacs-webfeeder") + (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") + (:authors + ("Pierre Neidhardt" . "mail@ambrevar.xyz")) + (:keywords "news" "hypermedia" "blog" "feed" "rss" "atom"))]) + (websocket . + [(1 13 1) + ((cl-lib + (0 5))) + "Emacs WebSocket client and server" tar + ((:url . "https://github.com/ahyatt/emacs-websocket") + (:maintainer "Andrew Hyatt" . "ahyatt@gmail.com") + (:authors + ("Andrew Hyatt" . "ahyatt@gmail.com")) + (:keywords "communication" "websocket" "server"))]) + (which-key . + [(3 6 0) + ((emacs + (24 4))) + "Display available keybindings in popup" tar + ((:url . "https://github.com/justbur/emacs-which-key") + (:maintainer "Justin Burkett" . "justin@burkett.cc") + (:authors + ("Justin Burkett" . "justin@burkett.cc")) + (:commit . "1217db8c6356659e67b35dedd9f5f260c06f6e99"))]) + (windower . + [(0 0 1) + ((emacs + (25))) + "Helper functions for window manipulation." single + ((:keywords "convenience" "tools") + (:authors + ("Pierre Neidhardt" . "mail@ambrevar.xyz")) + (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") + (:url . "https://gitlab.com/ambrevar/windower"))]) + (windresize . + [(0 1) + nil "Resize windows interactively" single + ((:url . "http://elpa.gnu.org/packages/windresize.html") + (:keywords "window") + (:authors + ("Bastien" . "bzg@gnu.org")) + (:maintainer "Bastien" . "bzg@gnu.org"))]) + (wisi . + [(3 1 7) + ((emacs + (25 3)) + (seq + (2 20))) + "Utilities for implementing an indentation/navigation engine using a generalized LALR parser" tar + ((:url . "http://stephe-leake.org/ada/wisitoken.html") + (:keywords "parser" "indentation" "navigation") + (:maintainer "Stephen Leake" . "stephen_leake@stephe-leake.org") + (:authors + ("Stephen Leake" . "stephen_leake@stephe-leake.org")))]) + (wisitoken-grammar-mode . + [(1 2 0) + ((wisi + (3 1 1)) + (emacs + (25 0)) + (mmm-mode + (0 5 7))) + "Major mode for editing WisiToken grammar files" tar + ((:url . "http://www.nongnu.org/ada-mode/") + (:maintainer "Stephen Leake" . "stephen_leake@stephe-leake.org") + (:authors + ("Stephen Leake" . "stephen_leake@stephe-leake.org")) + (:keywords "languages"))]) + (wpuzzle . + [(1 1) + nil "find as many word in a given time" single + ((:url . "http://elpa.gnu.org/packages/wpuzzle.html") + (:authors + ("Ivan Kanis" . "ivan@kanis.fr")) + (:maintainer "Ivan Kanis" . "ivan@kanis.fr"))]) + (xclip . + [(1 11) + nil "Copy&paste GUI clipboard from text terminal" tar + ((:keywords "convenience" "tools") + (:maintainer "Leo Liu" . "sdl.web@gmail.com") + (:authors + ("Leo Liu" . "sdl.web@gmail.com")) + (:url . "https://elpa.gnu.org/packages/xclip.html") + (:commit . "5b54645cab438e133e27b4690c57066f8271a992"))]) + (xelb . + [(0 18) + ((emacs + (24 4)) + (cl-generic + (0 2))) + "X protocol Emacs Lisp Binding" tar + ((:url . "https://github.com/ch11ng/xelb") + (:maintainer "Chris Feng" . "chris.w.feng@gmail.com") + (:authors + ("Chris Feng" . "chris.w.feng@gmail.com")) + (:keywords "unix"))]) + (xpm . + [(1 0 5) + ((cl-lib + (0 5)) + (queue + (0 2))) + "edit XPM images" tar + ((:url . "https://www.gnuvola.org/software/xpm/") + (:keywords "multimedia" "xpm") + (:maintainer "Thien-Thi Nguyen" . "ttn@gnu.org") + (:authors + ("Thien-Thi Nguyen" . "ttn@gnu.org")))]) + (xr . + [(1 22) + ((emacs + (26 1))) + "Convert string regexp to rx notation" tar + ((:url . "https://github.com/mattiase/xr") + (:keywords "lisp" "regexps") + (:maintainer "Mattias Engdegård" . "mattiase@acm.org") + (:authors + ("Mattias Engdegård" . "mattiase@acm.org")) + (:commit . "a873bbbe9cdf1abab63fc94730966f5a8f9adaa6"))]) + (xref . + [(1 4 1) + ((emacs + (26 1))) + "Cross-referencing commands" tar + ((:url . "https://elpa.gnu.org/packages/xref.html") + (:commit . "890b08e41580a716c2f0b3f1a40ef9b52a19372c"))]) + (yasnippet . + [(0 14 0) + ((cl-lib + (0 5))) + "Yet another snippet extension for Emacs" tar + ((:url . "http://github.com/joaotavora/yasnippet") + (:maintainer "Noam Postavsky" . "npostavs@gmail.com") + (:keywords "convenience" "emulation"))]) + (yasnippet-classic-snippets . + [(1 0 2) + ((yasnippet + (0 9 1))) + "\"Classic\" yasnippet snippets" tar + ((:maintainer "Noam Postavsky" . "npostavs@gmail.com") + (:keywords "snippets") + (:url . "http://elpa.gnu.org/packages/yasnippet-classic-snippets.html"))]) + (zones . + [(2019 7 13) + nil "Zones of text - like multiple regions" single + ((:keywords "narrow" "restriction" "widen" "region" "zone") + (:authors + ("Drew Adams")) + (:maintainer "Drew Adams" . "drew.adams@oracle.com") + (:url . "https://elpa.gnu.org/packages/zones.html"))]) + (ztree . + [(1 0 6) + ((cl-lib + (0))) + "Text mode directory tree" tar + ((:url . "https://github.com/fourier/ztree") + (:maintainer "Alexey Veretennikov" . "alexey.veretennikov@gmail.com") + (:authors + ("Alexey Veretennikov" . "alexey.veretennikov@gmail.com")) + (:keywords "files" "tools"))])) diff --git a/elpa/archives/gnu/archive-contents.signed b/elpa/archives/gnu/archive-contents.signed new file mode 100644 index 0000000..2667276 --- /dev/null +++ b/elpa/archives/gnu/archive-contents.signed @@ -0,0 +1 @@ +Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) (trust undefined) created at 2022-05-09T17:05:03-0400 using RSA \ No newline at end of file diff --git a/elpa/archives/melpa/archive-contents b/elpa/archives/melpa/archive-contents new file mode 100644 index 0000000..1db4d99 --- /dev/null +++ b/elpa/archives/melpa/archive-contents @@ -0,0 +1,5184 @@ +(1 + (0blayout . [(20190703 527) nil "Layout grouping with ease" single ((:commit . "fd9a8f353dbd45b4628b5f84b8d8c2525ebf571d") (:authors ("Elis \"etu\" Axelsson")) (:maintainer "Elis \"etu\" Axelsson") (:keywords "convenience" "window-management") (:url . "https://github.com/etu/0blayout"))]) + (0x0 . [(20210701 839) ((emacs (26 1))) "Upload sharing to 0x0.st" single ((:commit . "63cd5eccc85e527f28e1acc89502a53245000428") (:authors ("William Vaughn ")) (:maintainer "William Vaughn" . "vaughnwilld@gmail.com") (:url . "https://gitlab.com/willvaughn/emacs-0x0"))]) + (0xc . [(20201025 2105) ((emacs (24 4)) (s (1 11 0))) "Base conversion made easy" tar ((:commit . "eec4fb10b9288c0852f751cfb05d638664fa2411") (:authors ("Adam Niederer" . "adam.niederer@gmail.com")) (:maintainer "Adam Niederer" . "adam.niederer@gmail.com") (:keywords "base" "conversion") (:url . "http://github.com/AdamNiederer/0xc"))]) + (2048-game . [(20200417 259) nil "play 2048 in Emacs" single ((:commit . "aad4a590ea91f9a3256233b9b345e9159c6993f2") (:authors ("Zachary Kanfer" . "zkanfer@gmail.com")) (:maintainer "Zachary Kanfer" . "zkanfer@gmail.com") (:url . "https://hg.sr.ht/~zck/game-2048"))]) + (2bit . [(20200926 1418) ((emacs (24 3))) "Library for reading data from 2bit files" single ((:commit . "69b4ec1d6d2ad95c9e59dacb43224abbec7a8989") (:authors ("Dave Pearson" . "davep@davep.org")) (:maintainer "Dave Pearson" . "davep@davep.org") (:keywords "files" "data") (:url . "https://github.com/davep/2bit.el"))]) + (4clojure . [(20210102 459) ((request (0 2 0))) "Open and evaluate 4clojure.com questions." single ((:commit . "6f494d3905284ccdd57aae3d8ac16fc7ab431596") (:authors ("Joshua Hoff")) (:maintainer "Sasha Kovar" . "sasha-git@arcocene.org") (:keywords "languages" "data") (:url . "https://github.com/abend/4clojure.el"))]) + (750words . [(20210701 1950) ((emacs (24 4))) "Emacs integration and Org exporter for 750words.com" single ((:commit . "0fed7621c04debad64ea6455455494d4e6eb03fa") (:authors ("Diego Zamboni ")) (:maintainer "Diego Zamboni" . "diego@zzamboni.org") (:keywords "files" "org" "writing") (:url . "https://github.com/zzamboni/750words-client"))]) + (@ . [(20181225 1438) ((emacs (24 3))) "multiple-inheritance prototype-based objects DSL" tar ((:commit . "0a6189f8be42dbbc5d9358cbd447d471236135a2") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/at-el"))]) + (a . [(20210929 1510) ((emacs (25))) "Associative data structure functions" single ((:commit . "93e5ed8c495794d1ba3c04b43041b95ce01079b1") (:authors ("Arne Brasseur" . "arne@arnebrasseur.net")) (:maintainer "Arne Brasseur" . "arne@arnebrasseur.net") (:keywords "lisp") (:url . "https://github.com/plexus/a.el"))]) + (aa-edit-mode . [(20170119 320) ((emacs (24 3)) (navi2ch (2 0 0))) "Major mode for editing AA(S_JIS Art) and .mlt file" single ((:commit . "1dd801225b7ad3c23ad09698f5e77f0df7012a65") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "wp" "text" "shiftjis" "mlt" "yaruo"))]) + (aas . [(20220426 2058) ((emacs (26 3))) "Snippet expansions mid-typing" single ((:commit . "566944e3b336c29d3ac11cd739a954c9d112f3fb") (:authors ("Yoav Marco" . "yoavm448@gmail.com")) (:maintainer "Yoav Marco" . "yoavm448@gmail.com") (:keywords "abbrev" "tools") (:url . "https://github.com/ymarco/auto-activating-snippets"))]) + (abc-mode . [(20210508 1552) nil "Major mode for editing abc music files" single ((:commit . "80fa954787b57d14e21e19bd65e52abab1686f4a") (:authors ("Matthew K. Junker" . "junker@alum.mit.edu")) (:maintainer "Matthew K. Junker" . "junker@alum.mit.edu") (:keywords "local" "docs"))]) + (abgaben . [(20171119 646) ((pdf-tools (0 80)) (f (0 19 0)) (s (1 11 0))) "review and correct assignments received by mail" single ((:commit . "20d14830f07d66e2a04bcad1498a4a6fbf4b4451") (:authors ("Arne Köhn" . "arne@chark.eu")) (:maintainer "Arne Köhn" . "arne@chark.eu") (:keywords "mail" "outlines" "convenience") (:url . "http://arne.chark.eu/"))]) + (abl-mode . [(20210923 950) nil "Python TDD minor mode" single ((:commit . "0d6aace2ffd184137618a0c6e7f29826cbd8d1f9") (:authors ("Ulas Tuerkmen ")) (:maintainer "Ulas Tuerkmen ") (:url . "http://github.com/afroisalreadyinu/abl-mode"))]) + (abridge-diff . [(20220419 2358) ((emacs (26 1))) "Abridge long line-based diff hunks, including in magit" single ((:commit . "996d921da0a0ee651b3486c2afe29447f48be50f") (:authors ("J.D. Smith ")) (:maintainer "J.D. Smith ") (:keywords "magit" "diffs" "tools") (:url . "https://github.com/jdtsmith/abridge-diff"))]) + (abs-mode . [(20220316 921) ((emacs (26 1)) (erlang (2 8)) (maude-mode (0 3)) (flymake (1 0))) "Major mode for the modeling language Abs" single ((:commit . "d860ddbbd7cb93c7a77980c78c1a2a7634ef01e1") (:authors ("Rudi Schlatte" . "rudi@constantly.at")) (:maintainer "Rudi Schlatte" . "rudi@constantly.at") (:keywords "languages") (:url . "https://github.com/abstools/abs-mode"))]) + (abyss-theme . [(20170808 1345) ((emacs (24))) "A dark theme with contrasting colours." single ((:commit . "18791c6e8d9cc2b4815c9f08627a2e94fc0eeb14") (:authors ("Matt Russell" . "matt@mgrbyte.co.uk")) (:maintainer "Matt Russell" . "matt@mgrbyte.co.uk") (:keywords "theme" "dark" "contrasting colours") (:url . "https://github.com/mgrbyte/emacs-abyss-theme"))]) + (ac-alchemist . [(20150908 656) ((auto-complete (1 5 0)) (alchemist (1 5 0)) (cl-lib (0 5))) "auto-complete source for alchemist" single ((:commit . "b1891c3d41aed83f61d78a609ea97be5cc2758d9") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-ac-alchemist"))]) + (ac-c-headers . [(20200816 1007) ((auto-complete (1 3 1))) "auto-complete source for C headers" single ((:commit . "67e1e86a48c9bed57bc7ce5ce2553ad203f5752e") (:authors ("zk_phi")) (:maintainer "zk_phi") (:url . "http://zk-phi.gitub.io/"))]) + (ac-capf . [(20151101 217) ((auto-complete (1 4)) (cl-lib (0 5))) "auto-complete source with completion-at-point" single ((:commit . "17571dba0a8f98111f2ab758e9bea285b263781b") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-ac-capf"))]) + (ac-cider . [(20161006 719) ((cider (0 8 0)) (auto-complete (1 4)) (cl-lib (0 3))) "Clojure auto-complete sources using CIDER" single ((:commit . "fa13e067dd9c8c76151c7d140a2803da1d109b84") (:authors ("Alex Yakushev" . "alex@bytopia.org") ("Steve Purcell" . "steve@sanityinc.com") ("Sam Aaron" . "samaaron@gmail.com")) (:maintainer "Alex Yakushev" . "alex@bytopia.org") (:keywords "languages" "clojure" "nrepl" "cider" "compliment") (:url . "https://github.com/clojure-emacs/ac-cider"))]) + (ac-clang . [(20180710 546) ((emacs (24)) (cl-lib (0 5)) (auto-complete (1 4 0)) (pos-tip (0 4 6)) (yasnippet (0 8 0))) "Auto Completion source by libclang for GNU Emacs" tar ((:commit . "3294b968eb1a8317049190940193f9da47c085ef") (:authors ("yaruopooner [https://github.com/yaruopooner]")) (:maintainer "yaruopooner [https://github.com/yaruopooner]") (:keywords "completion" "convenience" "intellisense") (:url . "https://github.com/yaruopooner/ac-clang"))]) + (ac-dcd . [(20210428 1556) ((auto-complete (1 3 1)) (flycheck-dmd-dub (0 7))) "Auto Completion source for dcd for GNU Emacs" single ((:commit . "56d9817159acdebdbb3d5499c7e9379d29af0cd4") (:authors (nil . "")) (:maintainer nil . "") (:keywords "languages") (:url . "http://github.com/atilaneves/ac-dcd"))]) + (ac-emacs-eclim . [(20180911 1121) ((eclim (0 3)) (auto-complete (1 5))) "auto-complete source for eclim" single ((:commit . "222ddd48fcf0ee01592dec77c58e0cf3f2ea1100"))]) + (ac-emmet . [(20131015 1558) ((emmet-mode (1 0 2)) (auto-complete (1 4))) "auto-complete sources for emmet-mode's snippets" single ((:commit . "88f24876ee3b759978d4614a758280b5d512d543") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "completion" "convenience" "emmet") (:url . "https://github.com/yasuyk/ac-emmet"))]) + (ac-emoji . [(20150823 711) ((auto-complete (1 5 0)) (cl-lib (0 5))) "auto-complete source of Emoji" tar ((:commit . "40a639764eb654f1b4bb705c817b66032a26ff2b") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-ac-emoji"))]) + (ac-etags . [(20161001 1507) ((auto-complete (1 4))) "etags/ctags completion source for auto-complete" single ((:commit . "7983e631c226fe0fa53af3b2d56bf4eca3d785ce") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-ac-etags"))]) + (ac-geiser . [(20200318 824) ((geiser (0 5)) (auto-complete (1 4))) "Auto-complete backend for geiser" tar ((:commit . "93818c936ee7e2f1ba1b315578bde363a7d43d05"))]) + (ac-haskell-process . [(20150423 1402) ((auto-complete (1 4)) (haskell-mode (13))) "Haskell auto-complete source which uses the current haskell process" single ((:commit . "0362d4323511107ec70e7165cb612f3ab01b712f") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "languages"))]) + (ac-helm . [(20160319 233) ((helm (1 6 3)) (auto-complete (1 4 0)) (popup (0 5 0)) (cl-lib (0 5))) "Helm interface for auto-complete" single ((:commit . "baf2b1e04bcffa835084389c0fab415f26efbf32") (:authors ("rubikitch" . "rubikitch@ruby-lang.org") ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "completion" "convenience" "helm"))]) + (ac-html . [(20151005 731) ((auto-complete (1 4)) (s (1 9)) (f (0 17)) (dash (2 10))) "auto complete source for html tags and attributes" tar ((:commit . "668154cba123c321d1b07c2dc8b26d14092253b8") (:authors ("Zhang Kai Yu" . "yeannylam@gmail.com")) (:maintainer "Zhang Kai Yu" . "yeannylam@gmail.com") (:keywords "html" "auto-complete" "slim" "haml" "jade") (:url . "https://github.com/cheunghy/ac-html"))]) + (ac-html-angular . [(20151225 719) ((web-completion-data (0 1))) "auto complete angular15 data for `ac-html' and `company-web'" tar ((:commit . "6bafe09afe03112ca4183d58461c1a6f6c2b3c67") (:authors ("Olexandr Sydorchuk" . "olexandr.syd@gmail.com")) (:maintainer "Olexandr Sydorchuk" . "olexandr.syd@gmail.com") (:keywords "html" "auto-complete" "angular") (:url . "https://github.com/osv/ac-html-bootstrap"))]) + (ac-html-bootstrap . [(20160302 1701) ((web-completion-data (0 1))) "auto complete bootstrap3/fontawesome classes for `ac-html' and `company-web'" tar ((:commit . "481e6e441cd566554ce71cd8cb28c9e7ebb1c24b") (:authors ("Olexandr Sydorchuk" . "olexandr.syd@gmail.com")) (:maintainer "Olexandr Sydorchuk" . "olexandr.syd@gmail.com") (:keywords "html" "auto-complete" "bootstrap" "cssx") (:url . "https://github.com/osv/ac-html-bootstrap"))]) + (ac-html-csswatcher . [(20151208 2113) ((web-completion-data (0 1))) "css/less class/id completion with `ac-html' or `company-web'" single ((:commit . "b0f3e7e1a3fe49e88b6eb6432377232fc715f221") (:authors ("Olexandr Sydorchuck " . "olexandr.syd@gmail.com")) (:maintainer "Olexandr Sydorchuck " . "olexandr.syd@gmail.com") (:keywords "html" "css" "less" "auto-complete") (:url . "https://github.com/osv/ac-html-csswatcher"))]) + (ac-inf-ruby . [(20131115 1150) ((inf-ruby (2 3 2)) (auto-complete (1 4))) "Enable auto-complete in inf-ruby sessions" single ((:commit . "ee53fc9c61950da9a96df3ff5ef186f9a9faf151") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "languages" "tools"))]) + (ac-ispell . [(20151101 226) ((auto-complete (1 4)) (cl-lib (0 5))) "ispell completion source for auto-complete" single ((:commit . "22bace7387e9012002a6a444922f75f9913077b0") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-ac-ispell"))]) + (ac-js2 . [(20190101 933) ((js2-mode (20090723)) (skewer-mode (1 4))) "Auto-complete source for Js2-mode, with navigation" tar ((:commit . "2b56d09a16c1a0ce514cc1b85d64cb1be4502723") (:authors ("Scott Barnett" . "scott.n.barnett@gmail.com")) (:maintainer "Scott Barnett" . "scott.n.barnett@gmail.com") (:url . "https://github.com/ScottyB/ac-js2"))]) + (ac-math . [(20141116 2127) ((auto-complete (1 4)) (math-symbol-lists (1 0))) "Auto-complete sources for input of mathematical symbols and latex tags" single ((:commit . "c012a8f620a48cb18db7d78995035d65eae28f11") (:authors ("Vitalie Spinu")) (:maintainer "Vitalie Spinu") (:keywords "latex" "auto-complete" "unicode" "symbols") (:url . "https://github.com/vitoshka/ac-math"))]) + (ac-mozc . [(20150227 1619) ((cl-lib (0 5)) (auto-complete (1 4)) (mozc (0))) "auto-complete sources for Japanese input using Mozc" single ((:commit . "4c6c8be4701010d9362184437c0f783e0335c631") (:authors ("igjit" . "igjit1@gmail.com")) (:maintainer "igjit" . "igjit1@gmail.com") (:url . "https://github.com/igjit/ac-mozc"))]) + (ac-octave . [(20180406 334) ((auto-complete (1 4 0))) "An auto-complete source for Octave" single ((:commit . "fe0f931f2024f43de3c4fff4b1ace672413adeae") (:authors ("coldnew" . "coldnew.tw@gmail.com")) (:maintainer "coldnew" . "coldnew.tw@gmail.com") (:keywords "octave" "auto-complete" "completion") (:url . "https://github.com/coldnew/ac-octave"))]) + (ac-php . [(20200916 751) ((ac-php-core (2 0)) (auto-complete (1 4 0)) (yasnippet (0 8 0))) "Auto Completion source for PHP." single ((:commit . "f34e09783b77d1158ea139b7b3d8034bc52b0b9f") (:authors ("jim" . "xcwenn@qq.com")) (:maintainer "jim") (:keywords "completion" "convenience" "intellisense") (:url . "https://github.com/xcwen/ac-php"))]) + (ac-php-core . [(20220418 419) ((dash (1)) (php-mode (1)) (s (1)) (f (0 17 0)) (popup (0 5 0)) (xcscope (1 0))) "The core library of the ac-php" tar ((:commit . "f34e09783b77d1158ea139b7b3d8034bc52b0b9f") (:authors ("jim" . "xcwenn@qq.com") ("Serghei Iakovlev" . "sadhooklay@gmail.com")) (:maintainer "jim") (:keywords "completion" "convenience" "intellisense") (:url . "https://github.com/xcwen/ac-php"))]) + (ac-racer . [(20170114 809) ((emacs (24 3)) (auto-complete (1 5 0)) (racer (0 0 2))) "auto-complete source of racer" single ((:commit . "4408c2d652dec0432e20c05e001db8222d778c6b") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-ac-racer"))]) + (ac-rtags . [(20191222 920) ((auto-complete (1 4 0)) (rtags (2 10))) "auto-complete back-end for RTags" single ((:commit . "db39790fda5c2443bc790b8971ac140914f7e9c2") (:authors ("Jan Erik Hanssen" . "jhanssen@gmail.com") ("Anders Bakken" . "agbakken@gmail.com")) (:maintainer "Jan Erik Hanssen" . "jhanssen@gmail.com") (:url . "https://github.com/Andersbakken/rtags"))]) + (ac-skk . [(20141230 119) ((auto-complete (1 3 1)) (ddskk (16 0 50)) (tinysegmenter (0)) (cl-lib (0 5))) "auto-complete-mode source for DDSKK a.k.a Japanese input method" single ((:commit . "d25a265930430d080329789fb253d786c01dfa24") (:authors ("lugecy ")) (:maintainer "myuhe") (:keywords "convenience" "auto-complete") (:url . "https://github.com/myuhe/ac-skk.el"))]) + (ac-slime . [(20171027 2100) ((auto-complete (1 4)) (slime (2 9)) (cl-lib (0 5))) "An auto-complete source using slime completions" single ((:commit . "6c80cb602ddad46486288f94ad7546396c6e4b1a") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/ac-slime"))]) + (ac-sly . [(20170728 1027) ((sly (1 0 0 -3)) (auto-complete (1 4)) (cl-lib (0 5))) "An auto-complete source using sly completions" single ((:commit . "bf69c687c4ecf1994349d20c182e9b567399912e") (:authors ("Damian T. Dobroczy\\'nski" . "qoocku@gmail.com")) (:maintainer "Damian T. Dobroczy\\'nski" . "qoocku@gmail.com") (:url . "https://github.com/qoocku/ac-sly"))]) + (academic-phrases . [(20180723 1021) ((dash (2 12 0)) (s (1 12 0)) (ht (2 0)) (emacs (24))) "Bypass that mental block when writing your papers." single ((:commit . "25d9cf67feac6359cb213f061735e2679c84187f") (:authors ("Nasser Alshammari" . "designernasser@gmail.com")) (:maintainer "Nasser Alshammari" . "designernasser@gmail.com") (:keywords "academic" "convenience" "papers" "writing" "wp") (:url . "https://github.com/nashamri/academic-phrases"))]) + (accent . [(20220202 1312) ((emacs (24 3)) (popup (0 5 8))) "Popup for accented characters (diacritics)" single ((:commit . "6b502df6940587dae2dfbd349c22dfd44c803a86") (:authors ("Elia Scotto" . "eliascotto94@gmail.com")) (:maintainer "Elia Scotto" . "eliascotto94@gmail.com") (:keywords "i18n") (:url . "https://github.com/elias94/accent"))]) + (ace-flyspell . [(20170309 509) ((avy (0 4 0))) "Jump to and correct spelling errors using `ace-jump-mode' and flyspell" single ((:commit . "538d4f8508d305262ba0228dfe7c819fb65b53c9") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions") (:url . "https://github.com/cute-jumper/ace-flyspell"))]) + (ace-isearch . [(20210830 746) ((emacs (24))) "A seamless bridge between isearch, ace-jump-mode, avy, helm-swoop and swiper" single ((:commit . "8439136206a42e41ef95af923e0dc3bbd4fa306c") (:authors ("Akira Tamamori")) (:maintainer "Akira Tamamori") (:url . "https://github.com/tam17aki/ace-isearch"))]) + (ace-jump-buffer . [(20171031 1550) ((avy (0 4 0)) (dash (2 4 0))) "fast buffer switching extension to `avy'" single ((:commit . "0d335064230caf3efdd5a732e8fbd67e3948ed6a") (:authors ("Justin Talbott" . "justin@waymondo.com")) (:maintainer "Justin Talbott" . "justin@waymondo.com") (:url . "https://github.com/waymondo/ace-jump-buffer"))]) + (ace-jump-helm-line . [(20160918 1836) ((avy (0 4 0)) (helm (1 6 3))) "Ace-jump to a candidate in helm window" single ((:commit . "1483055255df3f8ae349f7520f05b1e43ea3ed37") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions") (:url . "https://github.com/cute-jumper/ace-jump-helm-line"))]) + (ace-jump-mode . [(20140616 815) nil "a quick cursor location minor mode for emacs" single ((:commit . "8351e2df4fbbeb2a4003f2fb39f46d33803f3dac") (:authors ("winterTTr" . "winterTTr@gmail.com")) (:maintainer "winterTTr" . "winterTTr@gmail.com") (:keywords "motion" "location" "cursor") (:url . "https://github.com/winterTTr/ace-jump-mode/"))]) + (ace-jump-zap . [(20170717 1849) ((ace-jump-mode (1 0)) (dash (2 10 0))) "Character zapping, `ace-jump-mode` style" single ((:commit . "52b5d4c6c73bd0fc833a0dcb4e803a5287d8cae8") (:authors ("justin talbott" . "justin@waymondo.com")) (:maintainer "justin talbott" . "justin@waymondo.com") (:keywords "convenience" "tools" "extensions") (:url . "https://github.com/waymondo/ace-jump-zap"))]) + (ace-link . [(20210121 923) ((avy (0 4 0))) "Quickly follow links" single ((:commit . "e1b1c91b280d85fce2194fea861a9ae29e8b03dd") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "convenience" "links" "avy") (:url . "https://github.com/abo-abo/ace-link"))]) + (ace-mc . [(20190206 749) ((ace-jump-mode (1 0)) (multiple-cursors (1 0)) (dash (2 10 0))) "Add multiple cursors quickly using ace jump" single ((:commit . "6877880efd99e177e4e9116a364576def3da391b") (:authors ("Josh Moller-Mara" . "jmm@cns.nyu.edu")) (:maintainer "Josh Moller-Mara" . "jmm@cns.nyu.edu") (:keywords "motion" "location" "cursor") (:url . "https://github.com/mm--/ace-mc"))]) + (ace-pinyin . [(20210827 355) ((avy (0 2 0)) (pinyinlib (0 1 0))) "Jump to Chinese characters using avy or ace-jump-mode" single ((:commit . "47662c0b05775ba353464b44c0f1a037c85e746e") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions") (:url . "https://github.com/cute-jumper/ace-pinyin"))]) + (ace-popup-menu . [(20210608 839) ((emacs (24 3)) (avy-menu (0 1))) "Replace GUI popup menu with something more efficient" single ((:commit . "bc3524eaa28b21725287b59b903c03624cbd5316") (:authors ("Mark Karpov" . "markkarpov92@gmail.com")) (:maintainer "Mark Karpov" . "markkarpov92@gmail.com") (:keywords "convenience" "popup" "menu") (:url . "https://github.com/mrkkrp/ace-popup-menu"))]) + (ace-window . [(20200606 1259) ((avy (0 5 0))) "Quickly switch windows." single ((:commit . "0577c426a9833ab107bab46c60d1885c611b2fb9") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "window" "location") (:url . "https://github.com/abo-abo/ace-window"))]) + (achievements . [(20150531 1317) ((keyfreq (0 0 3))) "Achievements for emacs usage." tar ((:commit . "c8275ee492d56255999d58f2988129ab29145182") (:authors ("Ivan Andrus" . "darthandrus@gmail.com")) (:maintainer "Ivan Andrus" . "darthandrus@gmail.com") (:keywords "games"))]) + (ack-menu . [(20150504 2022) ((mag-menu (0 1 0))) "A menu-based front-end for ack" single ((:commit . "f77be93a4697926ecf3195a355eb69580f695f4d") (:authors ("Steven Thomas") ("Nikolaj Schumacher")) (:maintainer "Steven Thomas") (:keywords "tools" "matching" "convenience") (:url . "https://github.com/chumpage/ack-menu"))]) + (acme-theme . [(20210430 302) nil "A color theme based on Acme & Sam from Plan 9" single ((:commit . "7c408d111c5e451ecb8fdd5f76cf7d8074aec793") (:authors ("Ian Y.E. Pan")) (:maintainer "Ian Y.E. Pan") (:url . "https://github.com/ianpan870102/acme-emacs-theme"))]) + (actionscript-mode . [(20180527 1701) nil "A simple mode for editing Actionscript 3 files" single ((:commit . "75639cc7fe85392b5671a1e94dcedb409a949cae") (:authors ("Austin Haas")) (:maintainer "Austin Haas") (:keywords "language" "modes"))]) + (activity-watch-mode . [(20220111 1121) ((emacs (25)) (request (0)) (json (0)) (cl-lib (0))) "Automatic time tracking extension." single ((:commit . "789ec3425623e43a29755e8daaa02305df8da8ed") (:authors ("Gabor Torok , Alan Hamlett" . "alan@wakatime.com")) (:maintainer "Paul d'Hubert" . "paul.dhubert@ya.ru") (:keywords "calendar" "comm") (:url . "https://github.com/pauldub/activity-watch-mode"))]) + (adafruit-wisdom . [(20200217 306) ((emacs (25 1)) (request (0 3 1))) "Get/display adafruit.com quotes" single ((:commit . "a9314331ba6ea846be9e1f7bded1e2e0ab70cd8e") (:authors ("Neil Okamoto" . "neil.okamoto+melpa@gmail.com")) (:maintainer "Neil Okamoto" . "neil.okamoto+melpa@gmail.com") (:keywords "games") (:url . "https://github.com/gonewest818/adafruit-wisdom.el"))]) + (add-hooks . [(20171217 123) nil "Functions for setting multiple hooks" single ((:commit . "1845137703461fc44bd77cf24014ba58f19c369d") (:authors ("Nick McCurdy" . "nick@nickmccurdy.com")) (:maintainer "Nick McCurdy" . "nick@nickmccurdy.com") (:keywords "lisp") (:url . "https://github.com/nickmccurdy/add-hooks"))]) + (add-node-modules-path . [(20220315 340) ((s (1 12 0))) "Add node_modules to your exec-path" single ((:commit . "63f047fd84b825876152743f66de7ee6f9ed203b") (:authors ("Neri Marschik" . "marschik_neri@cyberagent.co.jp")) (:maintainer "Neri Marschik" . "marschik_neri@cyberagent.co.jp") (:keywords "javascript" "node" "node_modules" "eslint") (:url . "https://github.com/codesuki/add-node-modules-path"))]) + (addressbook-bookmark . [(20190612 1638) ((emacs (24))) "An address book based on Standard Emacs bookmarks." single ((:commit . "d8e502fc2f3d3ab1508ce9e50ebf8a9addc6e5b3") (:authors ("Thierry Volpiatto" . "thierry.volpiatto@gmail.com")) (:maintainer "Thierry Volpiatto" . "thierry.volpiatto@gmail.com") (:url . "https://github.com/thierryvolpiatto/addressbook-bookmark"))]) + (ado-mode . [(20220415 1647) ((emacs (25 1))) "Major mode for editing Stata-related files" tar ((:commit . "695ea71cf4d6ae5f0afbc37b6fd08458e5c584c4") (:authors ("Bill Rising" . "brising@alum.mit.edu")) (:maintainer "Bill Rising" . "brising@alum.mit.edu") (:keywords "tools" "languages" "files" "convenience" "stata" "mata" "ado") (:url . "https://github.com/louabill/ado-mode"))]) + (adoc-mode . [(20160314 2130) ((markup-faces (1 0 0))) "a major-mode for editing AsciiDoc files in Emacs" single ((:commit . "745884359a1b8826ede2c4cfd2f0b5478953ac40") (:authors ("Florian Kaufmann" . "sensorflo@gmail.com")) (:maintainer "Florian Kaufmann" . "sensorflo@gmail.com") (:keywords "wp" "asciidoc") (:url . "https://github.com/sensorflo/adoc-mode/wiki"))]) + (aes . [(20211204 2348) ((emacs (26 1))) "Implementation of AES" single ((:commit . "c9cd12d6c1dbc18603eb4703276132cea59d5c78") (:authors ("Markus Sauermann" . "emacs-aes@sauermann-consulting.de")) (:maintainer "Markus Sauermann" . "emacs-aes@sauermann-consulting.de") (:keywords "data" "tools") (:url . "https://github.com/Sauermann/emacs-aes"))]) + (affe . [(20220407 2313) ((emacs (27 1)) (consult (0 16))) "Asynchronous Fuzzy Finder for Emacs" tar ((:commit . "a61d593d0cbff65a93111be96b9f53d3e640cf8d") (:authors ("Daniel Mendler")) (:maintainer "Daniel Mendler") (:url . "https://github.com/minad/affe"))]) + (afternoon-theme . [(20140104 1859) ((emacs (24 1))) "Dark color theme with a deep blue background" single ((:commit . "89b1d778a1f8b385775c122f2bd1c62f0fbf931a") (:authors ("Ozan Sener" . "ozan@ozansener.com")) (:maintainer "Ozan Sener" . "ozan@ozansener.com") (:keywords "themes") (:url . "http://github.com/osener/emacs-afternoon-theme"))]) + (ag . [(20201031 2202) ((dash (2 8 0)) (s (1 9 0)) (cl-lib (0 5))) "A front-end for ag ('the silver searcher'), the C ack replacement." single ((:commit . "ed7e32064f92f1315cecbfc43f120bbc7508672c") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk") (:url . "https://github.com/Wilfred/ag.el"))]) + (agda-editor-tactics . [(20211024 2357) ((s (1 12 0)) (dash (2 16 0)) (emacs (27 1)) (org (9 1))) "An editor tactic to produce Σ-types from Agda records" single ((:commit . "c401c0c1ec0ad38bb5ee1636504e0e531b9e34b9") (:authors ("Musa Al-hassy" . "alhassy@gmail.com")) (:maintainer "Musa Al-hassy" . "alhassy@gmail.com") (:keywords "abbrev" "convenience" "languages" "agda" "tools") (:url . "https://github.com/alhassy/next-700-module-systems"))]) + (aggressive-fill-paragraph . [(20180910 816) ((dash (2 10 0))) "A mode to automatically keep paragraphs filled" single ((:commit . "4a620e62b5e645a48b0a818bf4eb19daea4977df") (:authors ("David Shepherd" . "davidshepherd7@gmail.com")) (:maintainer "David Shepherd" . "davidshepherd7@gmail.com") (:keywords "fill-paragraph" "automatic" "comments") (:url . "https://github.com/davidshepherd7/aggressive-fill-paragraph-mode"))]) + (aggressive-indent . [(20210701 2224) ((emacs (24 3))) "Minor mode to aggressively keep your code always indented" single ((:commit . "cb416faf61c46977c06cf9d99525b04dc109a33c") (:authors ("Artur Malabarba" . "emacs@endlessparentheses.com")) (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") (:keywords "indent" "lisp" "maint" "tools") (:url . "https://github.com/Malabarba/aggressive-indent-mode"))]) + (agtags . [(20200730 116) ((emacs (25))) "A frontend to GNU Global" tar ((:commit . "d80c6f61dee74040c07b7010d48cab1df13a3abf") (:authors ("Vietor Liu" . "vietor.liu@gmail.com")) (:maintainer "Vietor Liu" . "vietor.liu@gmail.com") (:keywords "tools" "convenience") (:url . "https://github.com/vietor/agtags"))]) + (ah . [(20201213 218) ((emacs (25 1))) "Additional hooks" single ((:commit . "869219e7853510aeb00af3580aede0e5d49b324a") (:authors ("Takaaki ISHIKAWA ")) (:maintainer "Takaaki ISHIKAWA ") (:keywords "convenience") (:url . "https://github.com/takaxp/ah"))]) + (ahg . [(20210412 847) nil "Alberto's Emacs interface for Mercurial (Hg)" single ((:commit . "77bc2a628df006dcd2dc359ac12acdf8091a1356") (:authors ("Alberto Griggio" . "agriggio@users.sourceforge.net")) (:maintainer "Alberto Griggio" . "agriggio@users.sourceforge.net") (:url . "https://bitbucket.org/agriggio/ahg"))]) + (ahk-mode . [(20200412 1832) ((emacs (24 3))) "Major mode for editing AHK (AutoHotkey and AutoHotkey_L)" single ((:commit . "729007b5f22a49f5187ff47fca18c0d674e73047") (:authors ("Rich Alesi")) (:maintainer "Rich Alesi") (:keywords "ahk" "autohotkey" "hotkey" "keyboard shortcut" "automation") (:url . "https://github.com/ralesi/ahk-mode"))]) + (ahungry-theme . [(20180131 328) ((emacs (24))) "Ahungry color theme for Emacs. Make sure to (load-theme 'ahungry)." single ((:commit . "7d18c85c014671573628686012f3952fcd72c97b") (:authors ("Matthew Carter" . "m@ahungry.com")) (:maintainer "Matthew Carter" . "m@ahungry.com") (:keywords "ahungry" "palette" "color" "theme" "emacs" "color-theme" "deftheme") (:url . "https://github.com/ahungry/color-theme-ahungry"))]) + (aio . [(20200610 1904) ((emacs (26 1))) "async/await for Emacs Lisp" tar ((:commit . "da93523e235529fa97d6f251319d9e1d6fc24a41") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/emacs-aio"))]) + (airline-themes . [(20211214 1749) ((powerline (2 3))) "vim-airline themes for emacs powerline" tar ((:commit . "6bd102e49a7d87af1a72eb86e953991ff7bc954e") (:authors ("Anthony DiGirolamo" . "anthony.digirolamo@gmail.com")) (:maintainer "Anthony DiGirolamo" . "anthony.digirolamo@gmail.com") (:keywords "evil" "mode-line" "powerline" "airline" "themes") (:url . "http://github.com/AnthonyDiGirolamo/airline-themes"))]) + (airplay . [(20130212 1226) ((request (20130110 2144)) (simple-httpd (1 4 1)) (deferred (0 3 1))) "Airplay bindings to Emacs" tar ((:commit . "bd690aafcae3a887946e1bba8327597932d964ad") (:authors ("Wataru MIYAGUNI" . "gonngo@gmail.com")) (:maintainer "Wataru MIYAGUNI" . "gonngo@gmail.com") (:keywords "appletv" "airplay") (:url . "https://github.com/gongo/airplay-el"))]) + (alan-mode . [(20220106 727) ((flycheck (32)) (emacs (25 1)) (s (1 12))) "Major mode for editing Alan files" single ((:commit . "e96b06115f53ef81097f585f627855d97b35b89f") (:authors ("Paul van Dam" . "pvandam@kjerner.com")) (:maintainer "Paul van Dam" . "pvandam@kjerner.com") (:keywords "alan" "languages") (:url . "https://github.com/Kjerner/AlanForEmacs"))]) + (alarm-clock . [(20191204 716) ((emacs (24 4)) (f (0 17 0))) "Alarm Clock" tar ((:commit . "644f331071f8b09a898fae490541908b5054d2e6") (:authors ("Steve Lemuel" . "wlemuel@hotmail.com")) (:maintainer "Steve Lemuel" . "wlemuel@hotmail.com") (:keywords "calendar" "tools" "convenience") (:url . "https://github.com/wlemuel/alarm-clock"))]) + (alchemist . [(20180312 1304) ((elixir-mode (2 2 5)) (dash (2 11 0)) (emacs (24 4)) (company (0 8 0)) (pkg-info (0 4)) (s (1 11 0))) "Elixir tooling integration into Emacs" tar ((:commit . "6f99367511ae209f8fe2c990779764bbb4ccb6ed") (:authors ("Samuel Tonini" . "tonini.samuel@gmail.com")) (:maintainer "Samuel Tonini" . "tonini.samuel@gmail.com") (:keywords "languages" "elixir" "elixirc" "mix" "hex" "alchemist") (:url . "http://www.github.com/tonini/alchemist.el"))]) + (alda-mode . [(20210705 654) ((emacs (24 0))) "An Alda major mode" single ((:commit . "4de011d572e958a377fb16daae05a1b411f0c8ad") (:authors ("Jay Kamat" . "jaygkamat@gmail.com")) (:maintainer "Jay Kamat" . "jaygkamat@gmail.com") (:keywords "alda" "highlight") (:url . "http://gitlab.com/jgkamat/alda-mode"))]) + (alect-themes . [(20211022 1651) ((emacs (24 0))) "Configurable light, dark and black themes for Emacs 24 or later" tar ((:commit . "89560047934c236d05ea6b911c0c63702a8e06f3") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "color" "theme") (:url . "https://github.com/alezost/alect-themes"))]) + (alectryon . [(20211018 321) ((flycheck (31)) (emacs (25 1))) "Toggle between Coq and reStructuredText" tar ((:commit . "c8ab1ec50f7c62fb42a78c0617624b91ba62a162") (:authors ("Clément Pit-Claudel" . "clement.pitclaudel@live.com")) (:maintainer "Clément Pit-Claudel" . "clement.pitclaudel@live.com") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/cpitclaudel/alectryon"))]) + (alert . [(20200303 2118) ((gntp (0 1)) (log4e (0 3 0)) (cl-lib (0 5))) "Growl-style notification system for Emacs" single ((:commit . "7046393272686c7a1a9b3e7f7b1d825d2e5250a6") (:authors ("John Wiegley" . "jwiegley@gmail.com")) (:maintainer "John Wiegley" . "jwiegley@gmail.com") (:keywords "notification" "emacs" "message") (:url . "https://github.com/jwiegley/alert"))]) + (alert-termux . [(20181119 951) ((emacs (24 4))) "alert.el notifications on Termux" single ((:commit . "47c414285c2f5971f3be52aaf0a4066ea6989238") (:authors ("Gergely Polonkai" . "gergely@polonkai.eu")) (:maintainer "Gergely Polonkai" . "gergely@polonkai.eu") (:keywords "terminals") (:url . "https://github.com/gergelypolonkai/alert-termux"))]) + (alert-toast . [(20220312 229) ((emacs (25 1)) (alert (1 2)) (f (0 20 0)) (s (1 12 0))) "Windows 10 toast notifications" single ((:commit . "ba931529a266537783cfec2a28c2b8c058364ff2") (:authors ("Grzegorz Kowzan" . "grzegorz@kowzan.eu")) (:maintainer "Grzegorz Kowzan" . "grzegorz@kowzan.eu") (:url . "https://github.com/gkowzan/alert-toast"))]) + (align-cljlet . [(20160112 2101) ((clojure-mode (1 11 5))) "Space align various Clojure forms" single ((:commit . "602d72a7ad52788a0265e3c6da519464a98166b8") (:url . "https://github.com/gstamp/align-cljlet"))]) + (all-ext . [(20200315 1443) ((emacs (24 4)) (all (1 0))) "M-x all with helm-swoop/anything/multiple-cursors/line-number" single ((:commit . "c865c62506af2c9edc7705a7c24dc8b70d5d4de2") (:authors ("rubikitch" . "rubikitch@ruby-lang.org")) (:maintainer "rubikitch" . "rubikitch@ruby-lang.org") (:keywords "matching" "all" "search" "replace" "anything" "helm" "helm-swoop" "occur") (:url . "https://github.com/rubikitch/all-ext"))]) + (all-the-icons . [(20220427 1911) ((emacs (24 3))) "A library for inserting Developer icons" tar ((:commit . "68365b48f142d75ef4bdc3a274256d97752e3b65") (:authors ("Dominic Charlesworth" . "dgc336@gmail.com")) (:maintainer "Dominic Charlesworth" . "dgc336@gmail.com") (:keywords "convenient" "lisp") (:url . "https://github.com/domtronn/all-the-icons.el"))]) + (all-the-icons-completion . [(20220409 1204) ((emacs (26 1)) (all-the-icons (5 0))) "Add icons to completion candidates" single ((:commit . "286e2c064a1298be0d8d4100dc91d7a7a554d04a") (:authors ("Itai Y. Efrat ")) (:maintainer "Itai Y. Efrat" . "itai3397@gmail.com") (:keywords "convenient" "lisp") (:url . "https://github.com/iyefrat/all-the-icons-completion"))]) + (all-the-icons-dired . [(20220304 1638) ((emacs (24 4)) (all-the-icons (2 2 0))) "Shows icons for each file in dired mode" single ((:commit . "147ed0dfd1034a686795a08dc63e2c293128597e") (:authors ("jtbm37")) (:maintainer "Jimmy Yuen Ho Wong" . "wyuenho@gmail.com") (:keywords "files" "icons" "dired") (:url . "https://github.com/wyuenho/all-the-icons-dired"))]) + (all-the-icons-gnus . [(20180511 654) ((emacs (24 4)) (dash (2 12 0)) (all-the-icons (3 1 0))) "Shows icons for in Gnus" single ((:commit . "27f78996da0725943bcfb2d18038e6f7bddfa9c7") (:authors ("Nicolas Lamirault" . "nicolas.lamirault@gmail.com")) (:maintainer "Nicolas Lamirault" . "nicolas.lamirault@gmail.com") (:keywords "mail" "tools"))]) + (all-the-icons-ibuffer . [(20220424 1027) ((emacs (24 4)) (all-the-icons (2 2 0))) "Display icons for all buffers in ibuffer" single ((:commit . "0fcb43eb440e18078c8faf67c27a2189bbb45dfb") (:authors ("Vincent Zhang" . "seagle0128@gmail.com")) (:maintainer "Vincent Zhang" . "seagle0128@gmail.com") (:keywords "convenience" "icons" "ibuffer") (:url . "https://github.com/seagle0128/all-the-icons-ibuffer"))]) + (all-the-icons-ivy . [(20190508 1803) ((emacs (24 4)) (all-the-icons (2 4 0)) (ivy (0 8 0))) "Shows icons while using ivy and counsel" single ((:commit . "a70cbfa1effe36efc946a823a580cec686d5e88d") (:authors ("asok")) (:maintainer "asok") (:keywords "faces"))]) + (all-the-icons-ivy-rich . [(20220505 834) ((emacs (25 1)) (ivy-rich (0 1 0)) (all-the-icons (2 2 0))) "Better experience with icons for ivy" single ((:commit . "7c9db258ba7dd0a8c90eb7cebd335961cc45e031") (:authors ("Vincent Zhang" . "seagle0128@gmail.com")) (:maintainer "Vincent Zhang" . "seagle0128@gmail.com") (:keywords "convenience" "icons" "ivy") (:url . "https://github.com/seagle0128/all-the-icons-ivy-rich"))]) + (almost-mono-themes . [(20220422 1714) ((emacs (24))) "Almost monochromatic color themes" tar ((:commit . "0641bf565c113caef8d5c2a93f38cff32ebb62b7") (:authors ("John Olsson" . "john@cryon.se")) (:maintainer "John Olsson" . "john@cryon.se") (:keywords "faces") (:url . "https://github.com/cryon/almost-mono-themes"))]) + (alsamixer . [(20191002 1133) nil "Functions to call out to amixer." single ((:commit . "1bdb99e433acd38685f05408562746cfbf2bc820") (:authors ("R.W. van 't Veer")) (:maintainer "R.W. van 't Veer") (:keywords "convenience") (:url . "https://github.com/remvee/alsamixer-el"))]) + (alt-codes . [(20220212 1526) ((emacs (26 1))) "Insert alt codes using meta key" single ((:commit . "45deed4b9aadcd5e2a5482b0fe5110bb78ba1dd6") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/alt-codes"))]) + (amd-mode . [(20180111 1402) ((emacs (25)) (projectile (20161008 47)) (s (1 9 0)) (f (0 16 2)) (seq (2 16)) (makey (0 3)) (js2-mode (20140114)) (js2-refactor (0 6 1))) "Minor mode for handling JavaScript AMD module requirements." single ((:commit . "01fd19e0d635ccaf8e812364d8720733f2e84126") (:authors ("Nicolas Petton" . "petton.nicolas@gmail.com")) (:maintainer "Nicolas Petton" . "petton.nicolas@gmail.com") (:keywords "javascript" "amd" "projectile"))]) + (ameba . [(20200103 1454) ((emacs (24 4))) "An interface to Crystal Ameba linter" single ((:commit . "0c4925ae0e998818326adcb47ed27ddf9761c7dc") (:authors ("Vitalii Elenhaupt")) (:maintainer "Vitalii Elenhaupt") (:keywords "convenience") (:url . "https://github.com/crystal-ameba/ameba.el"))]) + (ample-regexps . [(20200508 1021) nil "ample regular expressions for Emacs" tar ((:commit . "153969ce547afe410b8986f01c9ed4087c9cd20b") (:authors ("immerrr" . "immerrr@gmail.com")) (:maintainer "immerrr" . "immerrr@gmail.com") (:keywords "regexps" "extensions" "tools"))]) + (ample-theme . [(20180207 1745) nil "Calm Dark Theme for Emacs" tar ((:commit . "f5a163626e04abda2d3c168f703c3f330f302a7c") (:authors ("Jordon Biondo" . "jordonbiondo@gmail.com")) (:maintainer "Jordon Biondo" . "jordonbiondo@gmail.com") (:keywords "theme" "dark") (:url . "https://github.com/jordonbiondo/ample-theme"))]) + (ample-zen-theme . [(20150119 2154) nil "AmpleZen Theme for Emacs 24" single ((:commit . "b277bb7abd4b6624e8d59f02474b79af50a007bd") (:authors ("Michael Wall")) (:maintainer "Michael Wall") (:keywords "theme" "dark" "emacs 24") (:url . "https://github.com/mjwall/ample-zen"))]) + (amread-mode . [(20220210 1354) ((emacs (24 3)) (cl-lib (0 6 1))) "A minor mode helper user speed-reading" single ((:commit . "a3358645582148e81bff54e18877451b747173bb") (:keywords "wp") (:url . "https://repo.or.cz/amread-mode.git"))]) + (amsreftex . [(20220115 1838) ((emacs (25 1))) "Add amsrefs bibliography support for reftex" single ((:commit . "facf47b82572e3f62bd8d9b8d4f4d5258f6c8a38") (:authors ("Fran Burstall" . "fran.burstall@gmail.com")) (:maintainer "Fran Burstall" . "fran.burstall@gmail.com") (:keywords "tex") (:url . "https://github.com/franburstall/amsreftex"))]) + (amx . [(20210305 118) ((emacs (24 4)) (s (0))) "Alternative M-x with extra features." single ((:commit . "37f9c7ae55eb0331b27200fb745206fc58ceffc0") (:authors ("Ryan C. Thompson" . "rct@thompsonclan.org") ("Cornelius Mika" . "cornelius.mika@gmail.com")) (:maintainer "Ryan C. Thompson" . "rct@thompsonclan.org") (:keywords "convenience" "usability" "completion") (:url . "http://github.com/DarwinAwardWinner/amx/"))]) + (anaconda-mode . [(20211122 817) ((emacs (25 1)) (pythonic (0 1 0)) (dash (2 6 0)) (s (1 9)) (f (0 16 2))) "Code navigation, documentation lookup and completion for Python" tar ((:commit . "cbea0fb3182321d34ff93981c5a59f8dd72d82a5") (:authors ("Artem Malyshev" . "proofit404@gmail.com")) (:maintainer "Artem Malyshev" . "proofit404@gmail.com") (:url . "https://github.com/proofit404/anaconda-mode"))]) + (anakondo . [(20210221 1727) ((emacs (26 3))) "Adds clj-kondo based Clojure[Script] editing facilities" single ((:commit . "16b0ba14d94a5d7e55655efc9e1d6d069a9306f2") (:authors ("Didier A." . "didibus@users.noreply.github.com")) (:maintainer "Didier A." . "didibus@users.noreply.github.com") (:keywords "clojure" "clojurescript" "cljc" "clj-kondo" "completion" "languages" "tools") (:url . "https://github.com/didibus/anakondo"))]) + (anaphora . [(20180618 2200) nil "anaphoric macros providing implicit temp variables" single ((:commit . "3b2da3f759b244975852e79721c4a2dbad3905cf") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "extensions") (:url . "http://github.com/rolandwalker/anaphora"))]) + (ancient-one-dark-theme . [(20211030 1358) ((emacs (24 1))) "A color theme based off uetchy's Ancient One Dark Theme" single ((:commit . "db79f86842c10874ce18c1a1e4496e9d0e28bed9") (:authors ("Daniils Petrovs")) (:maintainer "Daniils Petrovs") (:url . "https://github.com/DaniruKun/ancient-one-dark-emacs-theme"))]) + (android-env . [(20200722 1403) ((emacs (24 3))) "Helper functions for working in android" single ((:commit . "5c6a6d9449f300eec4f374a5410edc1cbab02e40") (:authors ("Fernando Jascovich")) (:maintainer "Fernando Jascovich") (:keywords "android" "gradle" "java" "tools" "convenience") (:url . "https://github.com/fernando-jascovich/android-env.el"))]) + (android-mode . [(20190903 811) nil "Minor mode for Android application development" single ((:commit . "d5332e339a1f5e30559a53feffb8442ca79265d6") (:authors ("R.W. van 't Veer")) (:maintainer "R.W. van 't Veer") (:keywords "tools" "processes") (:url . "https://github.com/remvee/android-mode"))]) + (angry-police-captain . [(20120829 1252) nil "Show quote from http://theangrypolicecaptain.com in the minibuffer" single ((:commit . "d11931c5cb63368dcc4a48797962428cca6d3e9d") (:authors ("Rolando Pereira" . "rolando_pereira@sapo.pt")) (:maintainer "Rolando Pereira" . "rolando_pereira@sapo.pt") (:keywords "games" "web" "fun"))]) + (angular-mode . [(20151201 2127) nil "Major mode for Angular.js" tar ((:commit . "8720cde86af0f1859ccc8580571e8d0ad1c52cff") (:authors ("Rudolf Olah" . "omouse@gmail.com")) (:maintainer "Rudolf Olah" . "omouse@gmail.com") (:keywords "languages" "javascript") (:url . "https://github.com/omouse/angularjs-mode"))]) + (angular-snippets . [(20140514 523) ((s (1 4 0)) (dash (1 2 0))) "Yasnippets for AngularJS" tar ((:commit . "af5ae0a4a8603b040446c28afcf6ca01a8b4bd7b") (:authors ("Magnar Sveen" . "magnars@gmail.com")) (:maintainer "Magnar Sveen" . "magnars@gmail.com") (:keywords "snippets"))]) + (anki-connect . [(20191123 1858) ((emacs (24 3))) "AnkiConnect API" single ((:commit . "1324f0c248aa2c6e73d6cf93fad6119d699f7dae") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "lisp" "anki") (:url . "https://github.com/lujun9972/anki-connect.el"))]) + (anki-editor . [(20190922 1223) ((emacs (25)) (request (0 3 0)) (dash (2 12 0))) "Minor mode for making Anki cards with Org" tar ((:commit . "546774a453ef4617b1bcb0d1626e415c67cc88df") (:authors ("Lei Tan")) (:maintainer "Lei Tan") (:url . "https://github.com/louietan/anki-editor"))]) + (anki-mode . [(20201223 719) ((emacs (24 4)) (dash (2 12 0)) (markdown-mode (2 2)) (s (1 11 0)) (request (0 3 0))) "A major mode for creating anki cards" single ((:commit . "d9b84028cd6a1ae040fb5604080a8b5fa8138562") (:authors ("David Shepherd" . "davidshepherd7@gmail.com")) (:maintainer "David Shepherd" . "davidshepherd7@gmail.com") (:keywords "tools") (:url . "https://github.com/davidshepherd7/anki-mode"))]) + (anki-vocabulary . [(20200103 325) ((emacs (24 4)) (s (1 0)) (youdao-dictionary (0 4)) (anki-connect (1 0)) (s (1 10))) "Help you to create vocabulary cards in Anki" single ((:commit . "863fe0219577f996ab126f1b7902db3c2cc59b2b") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "lisp" "anki" "translator" "chinese") (:url . "https://github.com/lujun9972/anki-vocabulary.el"))]) + (annalist . [(20190929 207) ((emacs (24 4)) (cl-lib (0 5))) "Record and display information such as keybindings" tar ((:commit . "134fa3f0fb91a636a1c005c483516d4b64905a6d") (:authors ("Fox Kiester" . "noct@posteo.net")) (:maintainer "Fox Kiester" . "noct@posteo.net") (:keywords "convenience" "tools" "keybindings" "org") (:url . "https://github.com/noctuid/annalist.el"))]) + (annotate . [(20220428 1339) nil "annotate files without changing them" single ((:commit . "e982a7b74a681a8c2c823d8dcaafd185ab5f719e") (:authors ("Bastian Bechtold")) (:maintainer "Bastian Bechtold , cage" . "cage-dev@twistfold.it") (:url . "https://github.com/bastibe/annotate.el"))]) + (annotate-depth . [(20160520 2040) nil "Annotate buffer if indentation depth is beyond threshold." single ((:commit . "fcb24fa36287250e40d195590c4ca4a8a696277b") (:authors ("Morten Slot Kristensen ")) (:maintainer "Morten Slot Kristensen ") (:keywords "convenience") (:url . "https://github.com/netromdk/annotate-depth"))]) + (annotation . [(20200914 644) nil "Functions for annotating text with faces and help bubbles" single ((:commit . "9a5f2b4a8cd14edbde9d16dcdfcb8db2a91be0d8") (:url . "https://github.com/agda/agda"))]) + (annoying-arrows-mode . [(20161024 646) ((cl-lib (0 5))) "Ring the bell if using arrows too much" single ((:commit . "3c42e9807d7696da2da2a21b63beebf9cdb3f5dc") (:authors ("Magnar Sveen" . "magnars@gmail.com")) (:maintainer "Magnar Sveen" . "magnars@gmail.com"))]) + (ansi . [(20211104 1420) ((emacs (24 1)) (cl-lib (0 6))) "Turn string into ansi strings" single ((:commit . "2367fba7b3b2340364a30cd6de7f3eb6bb9898a3") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "terminals" "color" "ansi") (:url . "http://github.com/rejeep/ansi"))]) + (ansible . [(20220114 45) ((s (1 9 0)) (f (0 16 2))) "Ansible minor mode" tar ((:commit . "d89ac0ee57742cca0f0e0a3453d9dcc521575690") (:authors ("k1LoW (Kenichirou Oyama), ")) (:maintainer "k1LoW (Kenichirou Oyama), ") (:url . "https://github.com/k1LoW/emacs-ansible"))]) + (ansible-doc . [(20160924 824) ((emacs (24 3))) "Ansible documentation Minor Mode" single ((:commit . "86083a7bb2ed0468ca64e52076b06441a2f8e9e0") (:authors ("Sebastian Wiesner" . "swiesner@lunaryorn")) (:maintainer "Sebastian Wiesner" . "swiesner@lunaryorn") (:keywords "tools" "help") (:url . "https://github.com/lunaryorn/ansible-doc.el"))]) + (ansible-vault . [(20211119 1500) ((emacs (24 3))) "Minor mode for editing ansible vault files" single ((:commit . "8da2ad658dbe94c71aad1c75d6fd22888338030c") (:maintainer "Zachary Elliott" . "contact@zell.io") (:keywords "ansible" "ansible-vault" "tools") (:url . "http://github.com/zellio/ansible-vault-mode"))]) + (ant . [(20160211 1543) nil "helpers for compiling with ant" single ((:commit . "510b5a3f57ee4b2855422d88d359a28922c1ab70") (:keywords "compilation" "ant" "java"))]) + (anti-zenburn-theme . [(20180712 1838) nil "Low-contrast Zenburn-inverted theme" single ((:commit . "dbafbaa86be67c1d409873f57a5c0bbe1e7ca158") (:authors ("Andrey Kotlarski" . "m00naticus@gmail.com")) (:maintainer "Andrey Kotlarski" . "m00naticus@gmail.com") (:url . "https://github.com/m00natic/anti-zenburn-theme"))]) + (anx-api . [(20140208 1514) nil "Interact with the AppNexus API from Emacs." single ((:commit . "b2411ebc966ac32c3ffc61bc22bf183834df0fa0") (:authors ("Rich Loveland")) (:maintainer "Rich Loveland") (:keywords "convenience" "json" "rest" "api" "appnexus"))]) + (anybar . [(20160816 1421) nil "Control AnyBar from Emacs" single ((:commit . "7a0743e0d31bcb36ab1bb2e351f3e7139c422ac5") (:authors ("Christopher Shea" . "cmshea@gmail.com")) (:maintainer "Christopher Shea" . "cmshea@gmail.com") (:keywords "anybar"))]) + (anyins . [(20131229 1041) nil "Insert content at multiple places from shell command or kill-ring" single ((:commit . "83844c17ac9b5b6c7655ee556b75689e4c8ea663") (:authors ("Anthony HAMON" . "hamon.anth@gmail.com")) (:maintainer "Anthony HAMON" . "hamon.anth@gmail.com") (:keywords "insert" "rectangular") (:url . "http://github.com/antham/anyins"))]) + (anzu . [(20211002 2255) ((emacs (25 1))) "Show number of matches in mode-line while searching" single ((:commit . "5abb37455ea44fa401d5f4c1bdc58adb2448db67") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Neil Okamoto" . "neil.okamoto+melpa@gmail.com") (:url . "https://github.com/emacsorphanage/anzu"))]) + (aozora-view . [(20140310 1317) nil "Aozora Bunko text Emacs viewer." tar ((:commit . "b0390616d19e45f15f9a2f5d5688274831e721fd") (:authors ("KAWABATA, Taichi ")) (:maintainer "KAWABATA, Taichi ") (:keywords "text") (:url . "https://github.com/kawabata/aozora-view"))]) + (apache-mode . [(20210519 1931) nil "Major mode for editing Apache httpd configuration files" single ((:commit . "f2c11aac2f5fc598123e04f4604bea248689a117") (:authors ("Karl Chen" . "quarl@nospam.quarl.org")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "languages" "faces") (:url . "https://github.com/emacs-php/apache-mode"))]) + (apdl-mode . [(20211023 1831) ((emacs (25 1))) "Major mode for the APDL programming language." tar ((:commit . "c55c6468526100ba0da00bff05cfb17cdf8839cf") (:authors ("H. Dieter Wilhelm" . "dieter@duenenhof-wilhelm.de")) (:maintainer "H. Dieter Wilhelm") (:keywords "languages" "convenience" "tools" "ansys" "apdl") (:url . "https://github.com/dieter-wilhelm/apdl-mode"))]) + (apel . [(20220427 1121) ((emacs (24 5))) "A Portable Emacs Library provides support for portable Emacs Lisp programs" tar ((:commit . "6947dc4605ebbb87762edf7051a78a3f7b5f17c5"))]) + (apheleia . [(20220509 2258) ((emacs (26))) "Reformat buffer stably" single ((:commit . "a0737fd69591f4186a626eb72ccd9488a6da437c") (:authors ("Radian LLC" . "contact+apheleia@radian.codes")) (:maintainer "Radian LLC" . "contact+apheleia@radian.codes") (:keywords "tools") (:url . "https://github.com/raxod502/apheleia"))]) + (apib-mode . [(20200101 1017) ((markdown-mode (2 1))) "Major mode for API Blueprint files" single ((:commit . "c6dd05201f6eb9295736d8668a79a7510d11159e") (:authors ("Vilibald Wanča" . "vilibald@wvi.cz")) (:maintainer "Vilibald Wanča" . "vilibald@wvi.cz") (:keywords "tools" "api-blueprint") (:url . "http://github.com/w-vi/apib-mode"))]) + (apiwrap . [(20180602 2231) ((emacs (25))) "api-wrapping macros" single ((:commit . "a4fb21d96027369307b22439a4a6c765ee272f44") (:authors ("Sean Allred" . "code@seanallred.com")) (:maintainer "Sean Allred" . "code@seanallred.com") (:keywords "tools" "maint" "convenience") (:url . "https://github.com/vermiculus/apiwrap.el"))]) + (apparmor-mode . [(20220411 648) ((emacs (24 4))) "Major mode for editing AppArmor policy files" single ((:commit . "abc2a6adf563b89daee9f8fa07a71d78957defdb") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/apparmor-mode"))]) + (apples-mode . [(20110121 418) nil "Major mode for editing and executing AppleScript code" tar ((:commit . "83a9ab0d6ba82496e2f7df386909b1a55701fccb") (:authors ("tequilasunset" . "tequilasunset.mac@gmail.com")) (:maintainer "tequilasunset" . "tequilasunset.mac@gmail.com") (:keywords "applescript" "languages"))]) + (applescript-mode . [(20210802 1715) ((emacs (24 3))) "major mode for editing AppleScript source" single ((:commit . "ea9a32aa33580b0695e7298d56c3d5f050a02b87") (:authors ("sakito" . "sakito@users.sourceforge.jp")) (:maintainer "sakito" . "sakito@users.sourceforge.jp") (:keywords "languages" "tools") (:url . "https://github.com/emacsorphanage/applescript-mode"))]) + (aproject . [(20220410 541) nil "Basic project framework for Emacs" tar ((:commit . "13e176ee69851403bec6471c5cceed17b7912b6f") (:authors ("Vietor Liu" . "vietor.liu@gmail.com")) (:maintainer "Vietor Liu" . "vietor.liu@gmail.com") (:keywords "environment" "project") (:url . "https://github.com/vietor/aproject"))]) + (apropospriate-theme . [(20220418 1554) nil "A colorful, low-contrast, light & dark theme set for Emacs with a fun name." tar ((:commit . "52ed4bf4aaa01c527271d71e6ce00f3607839777"))]) + (apt-sources-list . [(20180527 1241) ((emacs (24 4))) "Mode for editing APT source.list files" single ((:commit . "5289443ceff230dfc8a2c1c6b524c90560eb08a5") (:authors ("Dr. Rafael Sepúlveda" . "drs@gnulinux.org.mx")) (:maintainer "Joe Wreschnig" . "joe.wreschnig@gmail.com") (:url . "https://git.korewanetadesu.com/apt-sources-list.git"))]) + (aqi . [(20200215 1334) ((emacs (25 1)) (request (0 3)) (let-alist (0 0))) "Air quality data from the World Air Quality Index" single ((:commit . "c107a2e21cd1ac6008d8baaeeedb3fab26583d45") (:authors ("nik gaffney" . "nik@fo.am")) (:maintainer "nik gaffney" . "nik@fo.am") (:keywords "air quality" "aqi" "pollution" "weather" "data") (:url . "https://github.com/zzkt/aqi"))]) + (arc-dark-theme . [(20190314 1632) ((emacs (24))) "Arc dark theme" single ((:commit . "ee17dcca35dd0304145efc468b3f25af6907a59d") (:authors ("Christopher Fraser" . "cfraz89@gmail.com")) (:maintainer "Christopher Fraser" . "cfraz89@gmail.com") (:keywords "faces" "theme") (:url . "https://github.com/cfraz89/arc-dark-theme"))]) + (arch-packer . [(20170730 1321) ((emacs (25 1)) (s (1 11 0)) (async (1 9 2)) (dash (2 12 0))) "Arch Linux package management frontend" single ((:commit . "940e96f7d357c6570b675a0f942181c787f1bfd7") (:authors ("Fritz Stelzer" . "brotzeitmacher@gmail.com")) (:maintainer "Fritz Stelzer" . "brotzeitmacher@gmail.com") (:url . "https://github.com/brotzeitmacher/arch-packer"))]) + (archive-region . [(20200316 1425) ((emacs (24 4))) "Move region to archive file instead of killing" single ((:commit . "53cd2d96ea7c33f320353982b36854f25c900c2e") (:authors ("rubikitch" . "rubikitch@ruby-lang.org")) (:maintainer "rubikitch" . "rubikitch@ruby-lang.org") (:keywords "languages") (:url . "http://www.emacswiki.org/cgi-bin/wiki/download/archive-region.el"))]) + (archive-rpm . [(20220314 1647) ((emacs (24 4))) "RPM and CPIO support for archive-mode" tar ((:commit . "515d2230352fffcc982ae2e322d95cbee6aca760") (:authors ("Magnus Henoch" . "magnus.henoch@gmail.com")) (:maintainer "Magnus Henoch" . "magnus.henoch@gmail.com") (:keywords "files"))]) + (arduino-cli-mode . [(20210511 653) ((emacs (25 1))) "Arduino-CLI command wrapper" single ((:commit . "a93de7e8fef202163df4657f2ab522b57f70f202") (:authors ("Love Lagerkvist")) (:maintainer "Love Lagerkvist") (:keywords "processes" "tools") (:url . "https://github.com/motform/arduino-cli-mode"))]) + (arduino-mode . [(20220210 1355) ((emacs (25 1)) (spinner (1 7 3))) "Major mode for editing Arduino code" tar ((:commit . "652c6a328fa8f2db06534d5f231c6b6933be3edc") (:maintainer "stardiviner" . "numbchild@gmail.com") (:keywords "languages" "arduino") (:url . "https://repo.or.cz/arduino-mode.git"))]) + (aria2 . [(20190816 25) ((emacs (24 4))) "Control aria2c commandline tool from Emacs" single ((:commit . "32e08d5a8ad2f305578e0f783e087c1d312238c7") (:authors ("Łukasz Gruner" . "lukasz@gruner.lu")) (:maintainer "Łukasz Gruner" . "lukasz@gruner.lu") (:keywords "download" "bittorrent" "aria2") (:url . "https://bitbucket.org/ukaszg/aria2-mode"))]) + (ariadne . [(20131117 1711) ((bert (0 1))) "Ariadne plugin for Emacs" single ((:commit . "6fe401c7f996bcbc2f685e7971324c6f5e5eaf15") (:authors ("Oleksandr Manzyuk" . "manzyuk@gmail.com")) (:maintainer "Oleksandr Manzyuk" . "manzyuk@gmail.com") (:keywords "comm" "convenience" "processes"))]) + (arjen-grey-theme . [(20170522 2047) nil "A soothing dark grey theme" single ((:commit . "4cd0be72b65d42390e2105cfdaa408a1ead8d8d1") (:authors ("Arjen Wiersma" . "arjen@wiersma.org")) (:maintainer "Arjen Wiersma" . "arjen@wiersma.org") (:keywords "faces") (:url . "https://github.com/credmp/arjen-grey"))]) + (artbollocks-mode . [(20170524 422) nil "Improve your writing (especially about art)" single ((:commit . "33a41ca4f8206f57e5498a526d3b0ea18d08bb93") (:authors ("Rob Myers , Sacha Chua" . "sacha@sachachua.com")) (:maintainer "Rob Myers , Sacha Chua" . "sacha@sachachua.com") (:url . "https://github.com/sachac/artbollocks-mode"))]) + (arview . [(20160419 2109) nil "extract and view archives in the temporary directory" single ((:commit . "5437b4221b64b238c273a651d4792c577dba6d45") (:authors ("Andrey Fainer" . "fandrey@gmx.com")) (:maintainer "Andrey Fainer" . "fandrey@gmx.com") (:keywords "files") (:url . "https://github.com/afainer/arview"))]) + (arxiv-mode . [(20220128 920) ((emacs (27 1)) (hydra (0))) "Read and search for articles on arXiv.org" tar ((:commit . "f550583d2da8bd9600bd26bb4028fe22a9744da2") (:authors ("Alex Chen (fizban007)" . "fizban007@gmail.com") ("Simon Lin (Simon-Lin)" . "n.sibetz@gmail.com")) (:maintainer "Alex Chen (fizban007)" . "fizban007@gmail.com") (:keywords "bib" "convenience" "hypermedia") (:url . "https://github.com/fizban007/arxiv-mode"))]) + (ascii-table . [(20201019 700) ((emacs (24 3)) (cl-lib (0 5))) "Interactive ASCII table" single ((:commit . "4f68ad0b36c365c0652756691ab1703d0d46b4b4") (:authors ("Lassi Kortela" . "lassi@lassi.io")) (:maintainer "Lassi Kortela" . "lassi@lassi.io") (:keywords "help" "tools") (:url . "https://github.com/lassik/emacs-ascii-table"))]) + (asilea . [(20150105 1525) ((emacs (24)) (cl-lib (0 5))) "Find best compiler options using simulated annealing" single ((:commit . "2aab1cc63b64ef08d12e84fd7ba5c94065f6039f") (:authors ("Fanael Linithien" . "fanael4@gmail.com")) (:maintainer "Fanael Linithien" . "fanael4@gmail.com") (:url . "https://github.com/Fanael/asilea"))]) + (asm-blox . [(20220124 1430) ((emacs (26 1)) (yaml (0 3 4))) "Programming game involving WAT and YAML" tar ((:commit . "47aa63d320c39f8566a8d95c61f27383f561b001") (:authors ("Zachary Romero")) (:maintainer "Zachary Romero") (:keywords "games") (:url . "https://github.com/zkry/asm-blox"))]) + (asn1-mode . [(20170729 226) ((emacs (24 3)) (s (1 10 0))) "ASN.1/GDMO mode for GNU Emacs" single ((:commit . "d5d4a8259daf708411699bcea85d322f18beb972") (:authors ("Taichi Kawabata ")) (:maintainer "Taichi Kawabata ") (:keywords "languages" "processes" "tools") (:url . "https://github.com/kawabata/asn1-mode/"))]) + (assess . [(20200211 1817) ((emacs (24 4)) (m-buffer (0 15))) "Test support functions" tar ((:commit . "5bac045b273623772b6a2d820997d50f7ab4e466") (:authors ("Phillip Lord" . "phillip.lord@russet.org.uk")) (:maintainer "Phillip Lord" . "phillip.lord@russet.org.uk"))]) + (astyle . [(20200328 616) ((emacs (24 4)) (reformatter (0 3))) "Astyle formatter functions" single ((:commit . "04ff2941f08c4b731fe6a18ee1697436d1ca1cc0") (:authors ("Petter Storvik")) (:maintainer "Petter Storvik") (:keywords "astyle" "c" "c++" "cpp" "reformatter") (:url . "https://github.com/storvik/emacs-astyle"))]) + (asx . [(20191024 1100) ((emacs (26 1))) "Ask StackExchange/StackOverflow" single ((:commit . "ec4bf74de602b97df1f306d51acf4cda45184aac") (:authors ("Alex Ragone" . "ragonedk@gmail.com")) (:maintainer "Alex Ragone" . "ragonedk@gmail.com") (:keywords "convenience") (:url . "https://github.com/ragone/asx"))]) + (async . [(20220318 1342) ((emacs (24 4))) "Asynchronous processing in Emacs" tar ((:commit . "c78bab7506a70a735d2c3deab13fa87bf44a83d3") (:authors ("John Wiegley" . "jwiegley@gmail.com")) (:maintainer "Thierry Volpiatto" . "thievol@posteo.net") (:keywords "async") (:url . "https://github.com/jwiegley/emacs-async"))]) + (async-await . [(20200117 828) ((emacs (25 1)) (promise (1 1)) (iter2 (0 9 10))) "Async/Await" single ((:commit . "deef2bb343463f5196545f1dd8c2a32d0cb3b146") (:authors ("chuntaro" . "chuntaro@sakura-games.jp")) (:maintainer "chuntaro" . "chuntaro@sakura-games.jp") (:keywords "async" "await" "convenience") (:url . "https://github.com/chuntaro/emacs-async-await"))]) + (async-backup . [(20220131 1438) ((emacs (24 4))) "Backup on each save without freezing Emacs" single ((:commit . "6ddb39fe77d66cdef48b87cb0d0554ad7d132308") (:authors ("contrapunctus" . "xmpp:contrapunctus@jabjab.de")) (:maintainer "contrapunctus" . "xmpp:contrapunctus@jabjab.de") (:keywords "files") (:url . "https://tildegit.org/contrapunctus/async-backup"))]) + (atcoder-tools . [(20200109 1236) ((emacs (26)) (f (0 20)) (s (1 12))) "An atcoder-tools client" single ((:commit . "cfe61ed18ea9b3b1bfb6f9e7d80a47599680cd1f") (:authors ("Seong Yong-ju" . "sei40kr@gmail.com")) (:maintainer "Seong Yong-ju" . "sei40kr@gmail.com") (:keywords "extensions" "tools") (:url . "https://github.com/sei40kr/atcoder-tools"))]) + (atl-long-lines . [(20201026 339) ((emacs (24 3))) "Turn off truncate-lines when the line is long" single ((:commit . "43ca538ecece4e14bb9bcd887854aeb14b3d45f4") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/atl-long-lines"))]) + (atl-markup . [(20210731 609) ((emacs (24 3))) "Automatically truncate lines for markup languages" single ((:commit . "e0d11744d9b2bca780322b1b282fb5ffb18cfd75") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/atl-markup"))]) + (atom-dark-theme . [(20220114 1902) nil "An Emacs port of the Atom Dark theme from Atom.io." single ((:commit . "2b3c7ad42bbcab3214a131f8957b92e717b36ad3") (:authors ("Jeremy Whitlock" . "jwhitlock@apache.org")) (:maintainer "Jeremy Whitlock" . "jwhitlock@apache.org") (:keywords "themes" "atom" "dark") (:url . "https://github.com/whitlockjc/atom-dark-theme-emacs"))]) + (atom-one-dark-theme . [(20210128 1640) nil "Atom One Dark color theme" single ((:commit . "b34b62e85593812b55ee552a1cb0eecfb04767bb") (:authors ("Jonathan Chu" . "me@jonathanchu.is")) (:maintainer "Jonathan Chu" . "me@jonathanchu.is") (:url . "https://github.com/jonathanchu/atom-one-dark-theme"))]) + (atomic-chrome . [(20210221 59) ((emacs (24 4)) (let-alist (1 0 4)) (websocket (1 4))) "Edit Chrome text area with Emacs using Atomic Chrome" single ((:commit . "c73367d8aa660f2b3c3f70ef5c39f5b502d60404") (:authors ("alpha22jp" . "alpha22jp@gmail.com")) (:maintainer "alpha22jp" . "alpha22jp@gmail.com") (:keywords "chrome" "edit" "textarea") (:url . "https://github.com/alpha22jp/atomic-chrome"))]) + (attrap . [(20220124 1253) ((dash (2 12 0)) (emacs (25 1)) (f (0 19 0)) (flycheck (0 30)) (s (1 11 0))) "ATtempt To Repair At Point" single ((:commit . "19a520ecb99529790906a1fb5599acdf2b4f005f") (:authors ("Jean-Philippe Bernardy" . "jeanphilippe.bernardy@gmail.com")) (:maintainer "Jean-Philippe Bernardy" . "jeanphilippe.bernardy@gmail.com") (:keywords "programming" "tools") (:url . "https://github.com/jyp/attrap"))]) + (auctex-cluttex . [(20210226 302) ((emacs (24 4)) (auctex (12 2))) "ClutTeX support for AUCTeX" single ((:commit . "9a15742a6de1285831329eac93f9e35752472685") (:authors ("Masahiro Nakamura" . "tsuucat@icloud.com")) (:maintainer "Masahiro Nakamura" . "tsuucat@icloud.com") (:keywords "tex") (:url . "https://github.com/tsuu32/auctex-cluttex"))]) + (auctex-latexmk . [(20170618 1636) ((auctex (11 87))) "Add LatexMk support to AUCTeX" single ((:commit . "4d353522650d7685acbf1d38f7dbc504f734bd84") (:authors ("Tomoya Tanjo" . "ttanjo@gmail.com")) (:maintainer "Tomoya Tanjo" . "ttanjo@gmail.com") (:keywords "tex") (:url . "https://github.com/tom-tan/auctex-latexmk/"))]) + (auctex-lua . [(20151121 1610) ((auctex (11 86)) (lua-mode (20130419))) "Lua editing support for AUCTeX" single ((:commit . "799cd8ac10c96991bb63d9aa60528ae5d8c786b5") (:authors ("Sean Allred" . "seallred@smcm.edu")) (:maintainer "Sean Allred" . "seallred@smcm.edu") (:keywords "latex" "lua") (:url . "http://github.com/vermiculus/auctex-lua"))]) + (audacious . [(20210917 51) ((helm (3 6 2)) (emacs (24 4))) "Emacs interface to control audacious" single ((:commit . "65c37f12a5c774a0ae434beee27ff7737006dd2f") (:authors ("Hitoshi Uchida" . "hitoshi.uchida@gmail.com")) (:maintainer "Hitoshi Uchida" . "hitoshi.uchida@gmail.com") (:url . "https://github.com/shishimaru/audacious.el"))]) + (audio-notes-mode . [(20170611 2159) nil "Play audio notes synced from somewhere else." single ((:commit . "fa38350829c7e97257efc746a010471d33748a68") (:authors ("Artur Malabarba" . "bruce.connor.am@gmail.com")) (:maintainer "Artur Malabarba" . "bruce.connor.am@gmail.com") (:keywords "hypermedia" "convenience") (:url . "http://github.com/Bruce-Connor/audio-notes-mode"))]) + (aurel . [(20170114 937) ((emacs (24 3)) (bui (1 1 0)) (dash (2 11 0))) "Search, get info, vote for and download AUR packages" single ((:commit . "fc7ad208f43f8525f84a18941c9b55f956df8961") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "tools") (:url . "https://github.com/alezost/aurel"))]) + (aurora-config-mode . [(20180216 2302) nil "Major mode for Apache Aurora configuration files" single ((:commit . "8273ec7937a21b469b9dbb6c11714255b890f410") (:authors ("Berk D. Demir" . "bdd@mindcast.org")) (:maintainer "Berk D. Demir" . "bdd@mindcast.org") (:keywords "languages" "configuration") (:url . "https://github.com/bdd/aurora-config.el"))]) + (auth-source-keytar . [(20220222 640) ((emacs (24 4)) (keytar (0 1 2)) (s (1 12 0))) "Integrate auth-source with keytar" single ((:commit . "5c6f0952f28ce722f4a75139f3dc1afc99e12396") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/emacs-grammarly/auth-source-keytar"))]) + (auth-source-kwallet . [(20210605 1032) ((emacs (24 4))) "KWallet integration for auth-source" single ((:commit . "053ed5e964acaf6f16a1708c36d812eeb7c1817d") (:authors ("Ekaterina Vaartis" . "vaartis@kotobank.ch")) (:maintainer "Ekaterina Vaartis" . "vaartis@kotobank.ch") (:url . "https://github.com/vaartis/auth-source-kwallet"))]) + (auth-source-xoauth2 . [(20200911 1554) ((emacs (26 1))) "Integrate auth-source with XOAUTH2" single ((:commit . "d3890eaa3a46dc89758ec6b789949e70ae782896") (:authors ("Cesar Crusius" . "ccrusius@google.com")) (:maintainer "Cesar Crusius" . "ccrusius@google.com") (:url . "https://github.com/ccrusius/auth-source-xoauth2"))]) + (auto-async-byte-compile . [(20160916 454) nil "Automatically byte-compile when saved" single ((:commit . "8681e74ddb8481789c5dbb3cafabb327db4c4484") (:authors ("rubikitch" . "rubikitch@ruby-lang.org")) (:maintainer "rubikitch" . "rubikitch@ruby-lang.org") (:keywords "lisp" "convenience") (:url . "http://www.emacswiki.org/cgi-bin/wiki/download/auto-async-byte-compile.el"))]) + (auto-auto-indent . [(20131106 1903) ((es-lib (0 1)) (cl-lib (1 0))) "Indents code as you type" single ((:commit . "0139378577f936d34b20276af6f022fb457af490") (:authors ("sabof")) (:maintainer "sabof") (:url . "https://github.com/sabof/auto-auto-indent"))]) + (auto-compile . [(20220422 1600) ((emacs (25 1)) (compat (28 1 1 0)) (packed (3 0 3))) "Automatically compile Emacs Lisp libraries" single ((:commit . "16de66c381dab3c1fb7bc248e0f81ef68966bd7d") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "compile" "convenience" "lisp") (:url . "https://github.com/emacscollective/auto-compile"))]) + (auto-complete . [(20220105 439) ((popup (0 5 0)) (cl-lib (0 5))) "Auto Completion for GNU Emacs" tar ((:commit . "d546b18c3e83e38686d9b7316c6c705597e1a8b3") (:authors ("Tomohiro Matsuyama" . "m2ym.pub@gmail.com")) (:maintainer "Jen-Chieh Shen" . "jcs090218@gmail.com") (:keywords "completion" "convenience") (:url . "https://github.com/auto-complete/auto-complete"))]) + (auto-complete-auctex . [(20140223 1758) ((yasnippet (0 6 1)) (auto-complete (1 4))) "auto-completion for auctex" single ((:commit . "855633f668bcc4b9408396742a7cb84e0c4a2f77") (:authors ("Christopher Monsanto" . "chris@monsan.to")) (:maintainer "Christopher Monsanto" . "chris@monsan.to"))]) + (auto-complete-c-headers . [(20150912 323) ((auto-complete (1 4))) "An auto-complete source for C/C++ header files" single ((:commit . "52fef720c6f274ad8de52bef39a343421006c511") (:authors ("Masafumi Oyamada" . "stillpedant@gmail.com")) (:maintainer "Masafumi Oyamada" . "stillpedant@gmail.com") (:keywords "c"))]) + (auto-complete-chunk . [(20140225 946) ((auto-complete (1 4))) "Auto-completion for dot.separated.words." single ((:commit . "a9aa77ffb84a1037984a7ce4dda25074272f13fe") (:authors ("ARAKAKI, Takafumi")) (:maintainer "ARAKAKI, Takafumi") (:url . "https://github.com/tkf/auto-complete-chunk"))]) + (auto-complete-clang . [(20140409 752) ((auto-complete (1 3 1))) "Auto Completion source for clang for GNU Emacs" single ((:commit . "a195db1d0593b4fb97efe50885e12aa6764d998c") (:authors ("Brian Jiang" . "brianjcj@gmail.com")) (:maintainer "Brian Jiang" . "brianjcj@gmail.com") (:keywords "completion" "convenience") (:url . "https://github.com/brianjcj/auto-complete-clang"))]) + (auto-complete-clang-async . [(20130526 1514) nil "Auto Completion source for clang for GNU Emacs" single ((:commit . "5d9c5cabbb6b31e0ac3637631c0c8b25184aa8b4") (:keywords "completion" "convenience"))]) + (auto-complete-distel . [(20180827 1344) ((auto-complete (1 4)) (distel-completion-lib (1 0 0))) "Erlang/distel completion backend for auto-complete-mode" single ((:commit . "acc4c0a5521904203d797fe96b08e5fae4233c7e") (:authors ("Sebastian Weddmark Olsson")) (:maintainer "Sebastian Weddmark Olsson") (:keywords "erlang" "distel" "auto-complete") (:url . "github.com/sebastiw/distel-completion"))]) + (auto-complete-exuberant-ctags . [(20140320 724) ((auto-complete (1 4 0))) "Exuberant ctags auto-complete.el source" single ((:commit . "ff6121ff8b71beb5aa606d28fd389c484ed49765") (:authors ("Kenichirou Oyama" . "k1lowxb@gmail.com")) (:maintainer "Kenichirou Oyama" . "k1lowxb@gmail.com") (:keywords "anto-complete" "exuberant ctags") (:url . "http://code.101000lab.org"))]) + (auto-complete-nxml . [(20140221 458) ((auto-complete (1 4))) "do completion by auto-complete.el on nXML-mode" single ((:commit . "ac7b09a23e45f9bd02affb31847263de4180163a") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "completion" "html" "xml") (:url . "https://github.com/aki2o/auto-complete-nxml"))]) + (auto-complete-pcmp . [(20140227 651) ((auto-complete (1 4 0)) (log4e (0 2 0)) (yaxception (0 1))) "Provide auto-complete sources using pcomplete results" single ((:commit . "2595d3dab1ef3549271ca922f212928e9d830eec") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "completion") (:url . "https://github.com/aki2o/auto-complete-pcmp"))]) + (auto-complete-rst . [(20140225 944) ((auto-complete (1 4))) "Auto-complete extension for ReST and Sphinx" tar ((:commit . "4803ce41a96224e6fa54e6741a5b5f40ebed7351") (:authors ("ARAKAKI, Takafumi")) (:maintainer "ARAKAKI, Takafumi") (:url . "https://github.com/tkf/auto-complete-rst"))]) + (auto-complete-sage . [(20160514 751) ((auto-complete (1 5 1)) (sage-shell-mode (0 1 0))) "An auto-complete source for sage-shell-mode." single ((:commit . "51b8e3905196d266e1f8aa47881189833151b398") (:authors ("Sho Takemori" . "stakemorii@gmail.com")) (:maintainer "Sho Takemori" . "stakemorii@gmail.com") (:keywords "sage" "math" "auto-complete") (:url . "https://github.com/stakemori/auto-complete-sage"))]) + (auto-dark . [(20220320 1703) ((emacs (24 4))) "Automatically set the dark-mode theme based on MacOS status" single ((:commit . "c5dd3afa6771f4777db9e427f21bfcbe4883abaf") (:authors ("Rahul M. Juliato") ("Tim Harper ")) (:maintainer "Rahul M. Juliato") (:keywords "tools" "unix" "faces") (:url . "https://github.com/LionyxML/auto-dark-emacs"))]) + (auto-dictionary . [(20150410 1610) nil "automatic dictionary switcher for flyspell" single ((:commit . "b364e08009fe0062cf0927d8a0582fad5a12b8e7") (:authors ("Nikolaj Schumacher ")) (:maintainer "Nikolaj Schumacher ") (:keywords "wp") (:url . "http://nschum.de/src/emacs/auto-dictionary/"))]) + (auto-dim-other-buffers . [(20220209 2101) nil "Makes windows without focus less prominent" single ((:commit . "33b5f88b799a17947c266b04ad59462c5aeb4ed7") (:authors ("Michal Nazarewicz" . "mina86@mina86.com")) (:maintainer "Michal Nazarewicz" . "mina86@mina86.com") (:url . "https://github.com/mina86/auto-dim-other-buffers.el"))]) + (auto-highlight-symbol . [(20220505 505) ((emacs (26 1)) (ht (2 3))) "Automatic highlighting current symbol minor mode" single ((:commit . "e31a2d2bb97ffcbeb493f3501311b30c3f10952f") (:authors ("Mitsuo Saito" . "arch320@NOSPAM.gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:keywords "highlight" "face" "match" "convenience") (:url . "http://github.com/jcs-elpa/auto-highlight-symbol"))]) + (auto-indent-mode . [(20211029 11) nil "Auto indent Minor mode" tar ((:commit . "664006b67329a8e27330541547f8c2187dab947c") (:authors ("Matthew L. Fidler, Le Wang & Others")) (:maintainer "Matthew L. Fidler") (:keywords "auto" "indentation") (:url . "https://github.com/mlf176f2/auto-indent-mode.el/"))]) + (auto-minor-mode . [(20180527 1123) ((emacs (24 4))) "Enable minor modes by file name and contents" single ((:commit . "17cfa1b54800fdef2975c0c0531dad34846a5065") (:authors ("Joe Wreschnig" . "joe.wreschnig@gmail.com")) (:maintainer "Joe Wreschnig" . "joe.wreschnig@gmail.com") (:keywords "convenience") (:url . "https://github.com/joewreschnig/auto-minor-mode"))]) + (auto-org-md . [(20180213 2343) ((emacs (24 4))) "export a markdown file automatically when you save an org-file" single ((:commit . "9318338bdb7fe8bd698d88f3af89b2d6413efdd2") (:authors ("jamcha" . "jamcha.aa@gmail.com")) (:maintainer "jamcha" . "jamcha.aa@gmail.com") (:keywords "org" "markdown") (:url . "https://github.com/jamcha-aa/auto-org-md"))]) + (auto-package-update . [(20211108 2025) ((emacs (24 4)) (dash (2 1 0))) "Automatically update Emacs packages." single ((:commit . "ad95435fefe2bb501d1d787b08272f9c1b7df488") (:authors ("Renan Ranelli")) (:maintainer "Renan Ranelli") (:keywords "package" "update") (:url . "http://github.com/rranelli/auto-package-update.el"))]) + (auto-pause . [(20160426 1216) ((emacs (24 4))) "Run processes which will be paused when Emacs is idle" single ((:commit . "a4d778de774ca3895542cb559a953e0d98657338") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "convenience" "menu") (:url . "https://github.com/lujun9972/auto-pause"))]) + (auto-read-only . [(20200827 1754) ((emacs (25 1)) (cl-lib (0 5))) "Automatically make the buffer to read-only" single ((:commit . "db209bf5b7f76f4c3dc4d0892fc6a24430779f29") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "files" "convenience") (:url . "https://github.com/zonuexe/auto-read-only.el"))]) + (auto-rename-tag . [(20210805 1344) ((emacs (24 4))) "Automatically rename paired HTML/XML tag" single ((:commit . "85b02fa6ce76ab872c025a82c2f14614af3d89e1") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/auto-rename-tag"))]) + (auto-save-buffers-enhanced . [(20161109 710) nil "Automatically save buffers in a decent way" single ((:commit . "461e8c816c1b7c650be5f209078b381fe55da8c6") (:authors ("Kentaro Kuribayashi" . "kentarok@gmail.com")) (:maintainer "Kentaro Kuribayashi" . "kentarok@gmail.com"))]) + (auto-shell-command . [(20180817 1502) ((deferred (20130312)) (popwin (20130329))) "Run the shell command asynchronously that you specified when you save the file." single ((:commit . "a8f9213e3c773b5687b81881240e6e648f2f56ba") (:authors ("ongaeshi")) (:maintainer "ongaeshi") (:keywords "shell" "save" "async" "deferred" "auto"))]) + (auto-sudoedit . [(20220421 1147) ((emacs (26 1)) (f (0 19 0))) "Auto sudo edit by tramp" single ((:commit . "39cb574a4b5ec74ad62857320bf5fec58abe876f") (:authors ("ncaq" . "ncaq@ncaq.net")) (:maintainer "ncaq" . "ncaq@ncaq.net") (:url . "https://github.com/ncaq/auto-sudoedit"))]) + (auto-virtualenv . [(20211215 907) ((cl-lib (0 5)) (pyvenv (1 9)) (s (1 10 0))) "Auto activate python virtualenvs" single ((:commit . "07064e05feb62277991b8a7c04f7cdad50acaddf") (:authors ("Marcwebbie" . "marcwebbie@gmail.com")) (:maintainer "Marcwebbie" . "marcwebbie@gmail.com") (:keywords "python" "virtualenv" "tools") (:url . "http://github.com/marcwebbie/auto-virtualenv"))]) + (auto-virtualenvwrapper . [(20200510 1006) ((cl-lib (0 6)) (s (1 10 0)) (virtualenvwrapper (0))) "Lightweight auto activate python virtualenvs" single ((:commit . "30fb54aa3c99f3c614ea9a92669d634df30c9439") (:authors ("Marcwebbie" . "marcwebbie@gmail.com") ("Robert Zaremba" . "robert-zaremba@scale-it.pl")) (:maintainer "Marcwebbie" . "marcwebbie@gmail.com") (:keywords "python" "virtualenv" "tools"))]) + (auto-yasnippet . [(20191015 942) ((yasnippet (0 13 0))) "Quickly create disposable yasnippets" single ((:commit . "db9e0dd4335b2202cd5dac95bbbc87a1032d9bbe") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:url . "https://github.com/abo-abo/auto-yasnippet"))]) + (autobookmarks . [(20220509 1712) ((dash (2 10 0)) (cl-lib (0 5))) "Save recently visited files and buffers" single ((:commit . "8acd6f182181e23257e01c1b5cf90b872507a74d") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (autobuild . [(20200713 227) ((cl-lib (0 3)) (emacs (26 1))) "Define and execute build rules and compilation pipelines" single ((:commit . "9b068d979bad78aba8e8bef9f9e7c3bfecb34d2d") (:authors ("Ernesto Alfonso")) (:maintainer nil . "(concat \"erjoalgo\" \"@\" \"gmail\" \".com\")") (:keywords "compile" "build" "pipeline" "autobuild" "extensions" "processes" "tools") (:url . "https://github.com/erjoalgo/autobuild"))]) + (autocrypt . [(20220215 1204) ((emacs (24 3))) "Autocrypt implementation" tar ((:commit . "c439cbe029f7ffeca6de0ea72258069c41350509") (:authors ("Philip Kaludercic" . "philipk@posteo.net")) (:maintainer "Philip Kaludercic" . "~pkal/public-inbox@lists.sr.ht") (:keywords "comm") (:url . "https://git.sr.ht/~pkal/autocrypt"))]) + (autodisass-java-bytecode . [(20211005 1920) nil "Automatically disassemble Java bytecode" tar ((:commit . "9eaddd63645e64825b2d07805999c5a645248c53") (:authors ("George Balatsouras ")) (:maintainer "George Balatsouras ") (:keywords "convenience" "data" "files"))]) + (autodisass-llvm-bitcode . [(20150411 125) nil "Automatically disassemble LLVM bitcode" tar ((:commit . "d2579e3a1427af2dc947c343e49eb3434078bf04") (:authors ("George Balatsouras ")) (:maintainer "George Balatsouras ") (:keywords "convenience" "data" "files"))]) + (autotest . [(20190331 2230) nil "ZenTest's autotest integration with emacs." single ((:commit . "09166f32d3ece2b297da036f0abbeba63329580e") (:authors ("Ryan Davis" . "ryand-ruby@zenspider.com")) (:maintainer "Ryan Davis" . "ryand-ruby@zenspider.com") (:keywords "testing" "ruby" "convenience") (:url . "https://github.com/zenspider/elisp/blob/master/autotest.el"))]) + (autotetris-mode . [(20141114 1646) ((cl-lib (0 5))) "automatically play tetris" single ((:commit . "0c3a746dcc304a67d2a6e7ad4ef93f512486343a") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/autotetris-mode"))]) + (autothemer . [(20220106 416) ((dash (2 10 0)) (emacs (24)) (cl-lib (0 5))) "Conveniently define themes." single ((:commit . "1dbc06ad430c51b5ec1a602a808ee46b9bd4bafa") (:authors ("Sebastian Sturm")) (:maintainer "Sebastian Sturm") (:url . "https://github.com/sebastiansturm/autothemer"))]) + (autumn-light-theme . [(20150515 1447) nil "A light color theme with muted, autumnal colors." single ((:commit . "1e3b2a43a3001e4a97a5ff073ba3f0d2ea3888f9") (:authors ("Adam Alpern" . "adam.alpern@gmail.com")) (:maintainer "Adam Alpern" . "adam.alpern@gmail.com") (:keywords "color" "theme") (:url . "http://github.com/aalpern/emacs-color-theme-autumn-light"))]) + (avandu . [(20170101 1903) nil "Gateway to Tiny Tiny RSS" tar ((:commit . "f44588d8e747fa880411cb4542cc39962252b90a") (:authors ("Tom Willemse" . "tom@ryuslash.org")) (:maintainer "Tom Willemse" . "tom@ryuslash.org") (:keywords "net"))]) + (avk-emacs-themes . [(20210521 1051) nil "Collection of avk themes" tar ((:commit . "7b9b6517873c4d4d73e6e34ca56c54062db60759") (:authors ("Alex V. Koval" . "alex@koval.kharkov.ua")) (:maintainer "Alex V. Koval" . "alex@koval.kharkov.ua") (:keywords "theme") (:url . "https://github.com/avkoval/avk-emacs-themes"))]) + (avy . [(20220102 805) ((emacs (24 1)) (cl-lib (0 5))) "Jump to arbitrary positions in visible text and select text quickly." single ((:commit . "ba5f035be33693d1a136a5cbeedb24327f551a92") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "point" "location") (:url . "https://github.com/abo-abo/avy"))]) + (avy-embark-collect . [(20220221 1638) ((emacs (25 1)) (embark (0 9)) (avy (0 5))) "Use avy to jump to Embark Collect entries" single ((:commit . "81c7f751be1de33dee9f7523fd3429ee3fe9a0d1") (:authors ("Omar Antolín Camarena" . "omar@matem.unam.mx")) (:maintainer "Omar Antolín Camarena" . "omar@matem.unam.mx") (:keywords "convenience") (:url . "https://github.com/oantolin/embark"))]) + (avy-flycheck . [(20160720 1500) ((emacs (24 1)) (flycheck (0 14)) (seq (1 11)) (avy (0 4 0))) "Jump to and fix syntax errors using `flycheck' with `avy' interface" single ((:commit . "5522f3bbbed1801d9278ed696ec0cbba38352985") (:authors ("Xu Ma" . "magicdirac@gmail.com")) (:maintainer "Xu Ma" . "magicdirac@gmail.com") (:keywords "tools" "convenience" "avy" "flycheck") (:url . "https://github.com/magicdirac/avy-flycheck"))]) + (avy-menu . [(20210321 1732) ((emacs (24 3)) (avy (0 4 0))) "Library providing avy-powered popup menu" single ((:commit . "18bb320f395b7e412f7e377cf4c46d205d4b4e1a") (:authors ("Mark Karpov" . "markkarpov92@gmail.com")) (:maintainer "Mark Karpov" . "markkarpov92@gmail.com") (:keywords "popup" "menu") (:url . "https://github.com/mrkkrp/avy-menu"))]) + (avy-migemo . [(20180716 1455) ((emacs (24 4)) (avy (0 4 0)) (migemo (1 9))) "avy with migemo" tar ((:commit . "922a6dd82c0bfa316b0fbb56a9d4dd4ffa5707e7") (:authors ("momomo5717")) (:maintainer "momomo5717") (:keywords "avy" "migemo") (:url . "https://github.com/momomo5717/avy-migemo"))]) + (avy-zap . [(20190801 329) ((avy (0 2 0))) "Zap to char using `avy'" single ((:commit . "7c8d1f40e43d03e2f6c1696bfa547526528ce8cb") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions") (:url . "https://github.com/cute-jumper/avy-zap"))]) + (aws-ec2 . [(20161007 1914) ((emacs (24 4)) (dash (2 12 1)) (tblui (0 1 0))) "Manage AWS EC2 instances" single ((:commit . "5601d4f268fc34b86a02ca90cde7d3771619a368") (:authors ("Yuki Inoue ")) (:maintainer "Yuki Inoue ") (:url . "https://github.com/Yuki-Inoue/aws.el"))]) + (aws-snippets . [(20191203 1553) ((yasnippet (0 8 0))) "Yasnippets for AWS" tar ((:commit . "557d19a0bc486e0fddb597b2be5087769d9bd47e") (:keywords "snippets"))]) + (awscli-capf . [(20190930 1517) ((emacs (26))) "Completion at point function for the AWS CLI" single ((:commit . "eadfb26b35802ae8164565581e4a9c4d0280a7b5") (:authors ("Sebastian Monia" . "smonia@outlook.com")) (:maintainer "Sebastian Monia" . "smonia@outlook.com") (:keywords "tools" "convenience" "abbrev") (:url . "https://github.com/sebasmonia/awscli-capf.git"))]) + (axe . [(20210816 1530) ((emacs (25 1)) (hmac (0 0)) (request (0 3 2)) (s (1 12 0)) (xmlgen (0 5)) (dash (2 17 0)) (mimetypes (1 0))) "AWS Extensions" tar ((:commit . "eb4a5b3b06c3cbed521e2c0e0985941c367f4e74") (:authors ("Craig Niles ")) (:maintainer "Craig Niles ") (:url . "https://github.com/cniles/axe"))]) + (axiom-environment . [(20211120 1646) ((emacs (24 2))) "An environment for using Axiom/OpenAxiom/FriCAS" tar ((:commit . "e60de5ed107ffeb530a56d24d04f38988124d12b") (:authors ("Paul Onions" . "paul.onions@acm.org")) (:maintainer "Paul Onions" . "paul.onions@acm.org") (:keywords "axiom" "openaxiom" "fricas"))]) + (ayu-theme . [(20200521 1157) ((emacs (24 1))) "Ayu theme" tar ((:commit . "ed98a9f41d9f0e08458ee71cc1038f66c50e1979") (:authors ("Tran Anh Vu")) (:maintainer "Tran Anh Vu") (:keywords "lisp" "theme" "emacs") (:url . "https://github.com/vutran1710/Ayu-Theme-Emacs"))]) + (babel . [(20210612 640) nil "interface to web translation services such as Babelfish" single ((:commit . "946e69c61188bc41793402ac48466d8967ddb43d") (:authors ("Juergen Hoetzel" . "juergen@hoetzel.info") ("Eric Marsden" . "emarsden@laas.fr")) (:maintainer "Juergen Hoetzel" . "juergen@hoetzel.info") (:keywords "translation" "web") (:url . "http://github.com/juergenhoetzel/babel"))]) + (babel-repl . [(20160504 2201) ((emacs (24))) "Run babel REPL" single ((:commit . "e619c16e349a1ee7bd0ee0d7f3650d33bff73fc3") (:authors ("Hung Phan")) (:maintainer "Hung Phan") (:keywords "babel" "javascript" "es6") (:url . "https://github.com/hung-phan/babel-repl/"))]) + (back-button . [(20150804 2004) ((nav-flash (1 0 0)) (smartrep (0 0 3)) (ucs-utils (0 7 2)) (list-utils (0 4 2)) (persistent-soft (0 8 8)) (pcache (0 2 3))) "Visual navigation through mark rings" single ((:commit . "98d92984a740acd1547bd7ed05cca0affdb21c3e") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "convenience" "navigation" "interface") (:url . "http://github.com/rolandwalker/back-button"))]) + (backlight . [(20210513 129) ((emacs (24 3))) "backlight brightness adjustment on GNU/Linux" single ((:commit . "b6826a60440d8bf440618e3cdafb40158de920e6") (:authors ("Michael Schuldt" . "mbschuldt@gmail.com")) (:maintainer "Michael Schuldt" . "mbschuldt@gmail.com") (:keywords "hardware") (:url . "https://github.com/mschuldt/backlight.el"))]) + (backline . [(20220424 2212) ((emacs (25 1)) (compat (28 1 1 0)) (outline-minor-faces (0 1 2))) "Preserve appearance of outline headings" single ((:commit . "edc5f1e8ca049c06d18d703479c4737f3530602e") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "outlines") (:url . "https://github.com/tarsius/backline"))]) + (backup-each-save . [(20180227 557) nil "backup each savepoint of a file" single ((:commit . "3c414b9d6b278911c95c5b8b71819e6af6f8a02a") (:authors ("Benjamin Rutt" . "brutt@bloomington.in.us")) (:maintainer "Conor Nash" . "conor@nashcobusinessservicesllc.com"))]) + (backup-walker . [(20130720 1516) nil "quickly traverse all backups of a file" single ((:commit . "934a4128c122972ac32bb9952addf279a60a94da") (:authors ("Le Wang")) (:maintainer "Le Wang") (:keywords "backup") (:url . "https://github.com/lewang/backup-walker"))]) + (backward-forward . [(20161229 550) ((emacs (24 5))) "navigation backwards and forwards across marks" single ((:commit . "58489957a62a0da25dfb5df902624d2548d800b4") (:authors ("Currell Berry" . "currellberry@gmail.com")) (:maintainer "Currell Berry" . "currellberry@gmail.com") (:keywords "navigation" "convenience" "backward" "forward") (:url . "https://gitlab.com/vancan1ty/emacs-backward-forward/tree/master"))]) + (badger-theme . [(20140717 232) nil "A dark theme for Emacs 24." single ((:commit . "493d672d5a5478976da7d5ca752008cc7837c57f") (:authors ("Cody Canning" . "cocanning11@gmail.com")) (:maintainer "Cody Canning" . "cocanning11@gmail.com") (:url . "https://github.com/ccann/badger-theme"))]) + (badwolf-theme . [(20161004 715) ((emacs (24))) "Bad Wolf color theme" single ((:commit . "ea01a3d9358e968f75e3ed15dec6a2a96ce3d9a1") (:authors ("bkruczyk" . "bartlomiej.kruczyk@gmail.com")) (:maintainer "bkruczyk" . "bartlomiej.kruczyk@gmail.com") (:keywords "themes") (:url . "https://github.com/bkruczyk/badwolf-emacs"))]) + (baff . [(20200824 1807) ((emacs (24 3)) (f (0 20 0))) "Create a byte array from a file" single ((:commit . "7af72db9c6e542ed2b60952933113d0aa86728cf") (:authors ("Dave Footitt" . "dave.footitt@gmail.com")) (:maintainer "Dave Footitt" . "dave.footitt@gmail.com") (:keywords "convenience" "usability") (:url . "https://github.com/dave-f/baff/"))]) + (baidu-translate . [(20211130 1235) ((unicode-escape (1 1))) "A plugin using baidu-translate-api" single ((:commit . "16101d5e6ce19bbcc8badf4422a95db457160999") (:authors (nil . "")) (:maintainer nil . "") (:keywords "docs") (:url . "https://github.com/liShiZhensPi/baidu-translate"))]) + (balanced-windows . [(20190903 1120) ((emacs (25))) "Keep windows balanced" single ((:commit . "1da5354ad8a9235d13928e2ee0863f3642ccdd13") (:authors ("wouter bolsterlee" . "wouter@bolsterl.ee")) (:maintainer "wouter bolsterlee" . "wouter@bolsterl.ee") (:keywords "convenience") (:url . "https://github.com/wbolster/emacs-balanced-windows"))]) + (banner-comment . [(20190606 1809) ((emacs (24 4))) "For producing banner comments." single ((:commit . "35d3315683d3f97605207691b77e9f447af18fe2") (:authors ("James Ferguson" . "james@faff.org")) (:maintainer "James Ferguson" . "james@faff.org") (:keywords "convenience") (:url . "https://github.com/WJCFerguson/banner-comment"))]) + (bap-mode . [(20200128 1354) nil "Major-mode for BAP's IR" single ((:commit . "8969679f60db0aa918d35f40d959c0a9c723b111") (:authors ("Thomas Barabosch ")) (:maintainer "Thomas Barabosch" . "thomas.barabosch@fkie.fraunhofer.de") (:keywords "languages") (:url . "https://github.com/fkie-cad/bap-mode"))]) + (bar-cursor . [(20201204 2244) nil "package used to switch block cursor to a bar" single ((:commit . "78f195b6db63459033c4f1c7e7add5d82f3ce424") (:authors ("Joe Casadonte" . "emacs@northbound-train.com")) (:maintainer "Andrew Johnson" . "andrew@andrewjamesjohnson.com") (:keywords "files") (:url . "https://github.com/ajsquared/bar-cursor"))]) + (bart-mode . [(20190601 1004) ((emacs (24 3))) "Real time BART departures info." single ((:commit . "f70b6c42452e47c0c6b3ebd4c90e555a9bedeec7") (:authors ("Michael Schuldt" . "mbschuldt@gmail.com")) (:maintainer "Michael Schuldt" . "mbschuldt@gmail.com") (:keywords "convenience" "transit") (:url . "https://github.com/mschuldt/bart-mode"))]) + (base16-theme . [(20220510 423) nil "Collection of themes built on combinations of 16 base colors" tar ((:commit . "43f3257aaf53e9c50f5db11b81fd66ec41ab2883") (:authors ("Kaleb Elwert" . "belak@coded.io") ("Neil Bhakta")) (:maintainer "Kaleb Elwert" . "belak@coded.io") (:url . "https://github.com/belak/base16-emacs"))]) + (bash-completion . [(20220328 844) ((emacs (24 3))) "BASH completion for the shell buffer" single ((:commit . "29b5fc860a5b0db9828acfceca09b773fbdb8e8a") (:authors ("Stephane Zermatten" . "szermatt@gmx.net")) (:maintainer "Stephane Zermatten" . "szermatt@gmail.com") (:keywords "shell" "bash" "bash-completion") (:url . "http://github.com/szermatt/emacs-bash-completion"))]) + (basic-c-compile . [(20170302 1112) ((cl-lib (0 5)) (f (0 19 0))) "Quickly create a Makefile, compile and run C." single ((:commit . "0129786aeee50d7bb0020d9fc2b7508875d403e8") (:authors ("Nick Spain" . "nicholas.spain96@gmail.com")) (:maintainer "Nick Spain" . "nicholas.spain96@gmail.com") (:keywords "c" "makefile" "compilation" "convenience") (:url . "https://github.com/nick96/basic-c-compile"))]) + (basic-ide . [(20200429 1104) ((emacs (25)) (basic-mode (0 4 2)) (company (0 9 12)) (flycheck (0 22)) (dash (2 12 0)) (f (0 17 0))) "BASIC IDE c64" single ((:commit . "1d026b6ae70db9cde36596dcf46b101058a2e004") (:authors ("Fermin MF" . "fmfs@posteo.net")) (:maintainer "Fermin MF" . "fmfs@posteo.net") (:keywords "languages" "basic") (:url . "https://gitlab.com/sasanidas/emacs-c64-basic-ide"))]) + (basic-mode . [(20210316 1253) ((seq (2 20)) (emacs (24 3))) "major mode for editing BASIC code" single ((:commit . "eaa5f24d2fb303d9e5d7de2a28c7c18b01532ab6") (:authors ("Johan Dykstrom")) (:maintainer "Johan Dykstrom") (:keywords "basic" "languages") (:url . "https://github.com/dykstrom/basic-mode"))]) + (basic-theme . [(20160817 827) ((emacs (24))) "Minimalistic light color theme" single ((:commit . "e2a855bd39f4b78296228d4b790f9123156f7d7e") (:authors ("Felix Geller" . "fgeller@gmail.com")) (:maintainer "Felix Geller" . "fgeller@gmail.com") (:keywords "theme" "basic" "minimal" "colors") (:url . "http://github.com/fgeller/basic-theme.el"))]) + (bats-mode . [(20160514 615) nil "Emacs mode for editing and running Bats tests" single ((:commit . "d519f7c89f5ae17dfc33400596df4564b478315f") (:authors ("Doug MacEachern")) (:maintainer "Doug MacEachern") (:keywords "bats" "tests") (:url . "https://github.com/dougm/bats-mode"))]) + (battery-notifier . [(20210521 1238) ((alert (1 3))) "Notify when battery capacity is low" single ((:commit . "ae2043db954e131d9de7347ab1a6107fd07e8893") (:authors ("Jason Johnson" . "jason@fullsteamlabs.com")) (:maintainer "Jason Johnson" . "jason@fullsteamlabs.com") (:keywords "hardware" "battery") (:url . "https://github.com/jasonmj/battery-notifier"))]) + (battle-haxe . [(20210219 354) ((emacs (25)) (company (0 9 9)) (helm (3 0)) (async (1 9 3)) (cl-lib (0 5)) (dash (2 18 0)) (s (1 10 0)) (f (0 19 0))) "A Haxe development system, with code completion and more" single ((:commit . "2f32c81dcecfc68fd410cb9d2aca303d6e3028c7") (:authors ("Alon Tzarafi " . "alontzarafi@gmail.com")) (:maintainer "Alon Tzarafi " . "alontzarafi@gmail.com") (:keywords "programming" "languages" "completion") (:url . "https://github.com/AlonTzarafi/battle-haxe"))]) + (bazel . [(20220222 1616) ((emacs (26 1))) "Bazel support for Emacs" single ((:commit . "e07a16666154c8ddc65ddaae599d58b25727350d") (:keywords "build tools" "languages") (:url . "https://github.com/bazelbuild/emacs-bazel-mode"))]) + (bbcode-mode . [(20190304 2122) ((emacs (24)) (cl-lib (0 5))) "Major mode for phpBB posts (BBCode markup)" single ((:commit . "e16619c80ea21154b4a4ccc2e13d0077e97c9caf") (:authors ("Eric James Michael Ritz" . "lobbyjones@gmail.com")) (:maintainer "Lassi Kortela" . "lassi@lassi.io") (:keywords "bbcode" "languages") (:url . "https://github.com/lassik/emacs-bbcode-mode"))]) + (bbdb . [(20220416 405) nil "The Insidious Big Brother Database for GNU Emacs" tar ((:commit . "ed7648f723d3fd03476b8a007a76e9058f7f7f47") (:maintainer "Roland Winkler" . "winkler@gnu.org"))]) + (bbdb- . [(20140221 2354) ((bbdb (20140123 1541)) (log4e (0 2 0)) (yaxception (0 1))) "provide interface for more easily search/choice than BBDB." single ((:commit . "2839e84c894de2513af41053e80a277a1b483d22") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "bbdb" "news" "mail") (:url . "https://github.com/aki2o/bbdb-"))]) + (bbdb-csv-import . [(20140802 1142) ((pcsv (1 3 3)) (dash (2 5 0)) (bbdb (20140412 1949))) "import csv to bbdb version 3+" single ((:commit . "dc9e722d1c1fcd55b71625ee3f05a4921851d186") (:authors ("Ian Kelling" . "ian@iankelling.org")) (:maintainer "Ian Kelling" . "ian@iankelling.org") (:keywords "csv" "util" "bbdb") (:url . "https://gitlab.com/iankelling/bbdb-csv-import"))]) + (bbdb-ext . [(20151220 2013) ((bbdb (2 36))) "Extra commands for BBDB" single ((:commit . "fee97b1b3faa83edaea00fbc5ad3cbca5e791a55") (:authors ("Joe Bloggs" . "vapniks@yahoo.com")) (:maintainer "Joe Bloggs" . "vapniks@yahoo.com") (:keywords "extensions") (:url . "https://github.com/vapniks/bbdb-ext"))]) + (bbdb-vcard . [(20210325 2208) ((bbdb (3 0))) "vCard import/export for BBDB" tar ((:commit . "113c66115ce68316e209f51ebce56de8dded3606") (:authors ("Bert Burgemeister" . "trebbu@googlemail.com") ("Toke Høiland-Jørgensen") ("Kevin Brubeck Unhammer") ("Steve Purcell") ("Vincent Geddes" . "vincent.geddes@gmail.com")) (:maintainer "Bert Burgemeister" . "trebbu@googlemail.com") (:keywords "data" "calendar" "mail" "news") (:url . "https://github.com/tohojo/bbdb-vcard"))]) + (bbdb2erc . [(20190822 907) ((bbdb (3 0))) "make bbdb show if pal is online with ERC, click i to chat" single ((:commit . "40b89e961762af3e7ade3a1844a9fbcd4084ac65") (:authors ("Kevin Brubeck Unhammer" . "unhammer@fsfe.org")) (:maintainer "Kevin Brubeck Unhammer" . "unhammer@fsfe.org") (:keywords "irc" "contacts" "chat" "client" "internet"))]) + (bbyac . [(20180206 1441) ((browse-kill-ring (1 3)) (cl-lib (0 5))) "Type a little Bit, and Bang! You Are Completed." tar ((:commit . "9f0de9cad13801891ffb590dc09f51ff9a7cb225") (:authors ("Bao Haojun" . "baohaojun@gmail.com")) (:maintainer "Bao Haojun" . "baohaojun@gmail.com") (:keywords "abbrev") (:url . "https://github.com/baohaojun/bbyac"))]) + (beacon . [(20190104 1931) ((seq (2 14))) "Highlight the cursor whenever the window scrolls" single ((:commit . "bde78180c678b233c94321394f46a81dc6dce1da") (:authors ("Artur Malabarba" . "emacs@endlessparentheses.com")) (:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com") (:keywords "convenience") (:url . "https://github.com/Malabarba/beacon"))]) + (beeminder . [(20201227 1533) ((emacs (24 3)) (seq (2 16)) (org (7))) "Emacs interface for Beeminder" tar ((:commit . "161d9c94c594614a01cb08219693d9e000af4f69") (:authors ("Phil Newton" . "phil@sodaware.net")) (:maintainer "Phil Newton" . "phil@sodaware.net") (:keywords "tools" "beeminder") (:url . "http://www.philnewton.net/code/beeminder-el/"))]) + (beginend . [(20220409 846) ((emacs (25 3))) "Redefine M-< and M-> for some modes" single ((:commit . "bbcfdc0909c20ddee41e95b7ade7de63af73b220") (:url . "https://github.com/DamienCassou/beginend"))]) + (belarus-holidays . [(20190102 1343) nil "Belarus holidays whith transfers" single ((:commit . "35a18273e19edc3b4c761030ffbd11116483b83e") (:authors ("Yauhen Makei" . "yauhen.makei@gmail.com")) (:maintainer "Yauhen Makei" . "yauhen.makei@gmail.com") (:url . "http://bitbucket.org/EugeneMakei/belarus-holidays.el"))]) + (benchmark-init . [(20220414 1612) ((emacs (24 3))) "Benchmarks for require and load calls" tar ((:commit . "02435560415bbadbcf5051fb7042880549170e7e") (:authors ("Steve Purcell")) (:maintainer "David Holm" . "dholmster@gmail.com") (:keywords "convenience" "benchmark") (:url . "https://github.com/dholm/benchmark-init-el"))]) + (benchstat . [(20171014 312) nil "proper benchmarking made simple" single ((:commit . "a5b67cf7972ca2bbc9f5bc6a0f521ab02b76d4f0") (:authors ("Iskander Sharipov" . "quasilyte@gmail.com")) (:maintainer "Iskander Sharipov" . "quasilyte@gmail.com") (:keywords "lisp") (:url . "https://github.com/Quasilyte/benchstat.el"))]) + (bencoding . [(20200331 1102) ((emacs (25 1))) "Bencoding decoding and encoding" single ((:commit . "1e16ccfd5c6560a83ae2926afe4a5076a541d3d6") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:keywords "tools") (:url . "https://github.com/xuchunyang/bencoding.el"))]) + (berrys-theme . [(20191201 1609) ((emacs (24 1))) "A light, clean and elegant theme" single ((:commit . "888a14206b2fb3dc45b5273aeb05075f3e0b5f60") (:authors ("Slava Buzin" . "v8v.buzin@gmail.com")) (:maintainer "Slava Buzin" . "v8v.buzin@gmail.com") (:url . "https://github.com/vbuzin/berrys-theme"))]) + (bert . [(20131117 1014) nil "BERT serialization library for Emacs" single ((:commit . "a3eec6980a725aa4abd2019e4c00246450260490") (:authors ("Oleksandr Manzyuk" . "manzyuk@gmail.com")) (:maintainer "Oleksandr Manzyuk" . "manzyuk@gmail.com") (:keywords "comm" "data"))]) + (better-defaults . [(20220116 2220) ((emacs (25 1))) "Fixing weird quirks and poor defaults" single ((:commit . "20ac176ccdc18ff8cb4a6b37cf1fe90fa7f88335") (:authors ("Phil Hagelberg")) (:maintainer "Phil Hagelberg") (:keywords "convenience") (:url . "https://github.com/technomancy/better-defaults"))]) + (better-jumper . [(20220110 118) ((emacs (25 1))) "configurable jump list" single ((:commit . "47622213783ece37d5337dc28d33b530540fc319") (:authors ("Bryan Gilbert ")) (:maintainer "Bryan Gilbert" . "bryan@bryan.sh") (:keywords "convenience" "jump" "history" "evil") (:url . "https://github.com/gilbertw1/better-jumper"))]) + (better-scroll . [(20210715 1004) ((emacs (24 3))) "Improve user experience when scrolling window" single ((:commit . "f04dad824b9879f7382f36780a0151e4ef544815") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/better-scroll"))]) + (better-shell . [(20191025 1737) ((emacs (24 4))) "Better shell management" single ((:commit . "70c787b981caeef8c5f8012b170eb7b9f167cd13") (:authors ("Russell Black" . "killdash9@github")) (:maintainer "Russell Black" . "killdash9@github") (:keywords "convenience") (:url . "https://github.com/killdash9/better-shell"))]) + (bf-mode . [(20130403 1442) nil "Browse file persistently on dired" single ((:commit . "7cc4d09aed64d9db6be95646f5f5067de68f8895") (:authors ("isojin")) (:maintainer "myuhe ") (:keywords "convenience") (:url . "https://github.com/emacs-jp/bf-mode"))]) + (bfbuilder . [(20210228 1740) ((cl-lib (0 3)) (emacs (24 4))) "A brainfuck development environment with interactive debugger" single ((:commit . "689f320a9a1326cdeff43b8538e0d739f8519c4b") (:authors ("zk_phi")) (:maintainer "zk_phi") (:url . "http://zk-phi.gitub.io/"))]) + (bibclean-format . [(20190302 2017) ((emacs (24 3)) (reformatter (0 3))) "Reformat BibTeX and Scribe using bibclean" single ((:commit . "b4003950a925d1c659bc359ab5e88e4441775d77") (:authors ("Peter W. V. Tran-Jørgensen" . "peter.w.v.jorgensen@gmail.com")) (:maintainer "Peter W. V. Tran-Jørgensen" . "peter.w.v.jorgensen@gmail.com") (:keywords "languages") (:url . "https://github.com/peterwvj/bibclean-format"))]) + (biblio . [(20210418 406) ((emacs (24 3)) (biblio-core (0 2))) "Browse and import bibliographic references from CrossRef, arXiv, DBLP, HAL, Dissemin, and doi.org" tar ((:commit . "517ec18f00f91b61481214b178f7ae0b8fbc499b") (:authors ("Clément Pit-Claudel" . "clement.pitclaudel@live.com")) (:maintainer "Clément Pit-Claudel" . "clement.pitclaudel@live.com") (:keywords "bib" "tex" "convenience" "hypermedia") (:url . "https://github.com/cpitclaudel/biblio.el"))]) + (biblio-bibsonomy . [(20190105 1200) ((emacs (24 4)) (biblio-core (0 2))) "Lookup bibliographic entries from Bibsonomy" single ((:commit . "778cc944db3c6dababe2e7fec5877fba42e8c00d") (:authors ("Andreas Jansson and contributors")) (:maintainer "Andreas Jansson and contributors") (:keywords "bib" "tex" "bibsonomy") (:url . "http://github.com/andreasjansson/biblio-bibsonomy/"))]) + (biblio-core . [(20210418 406) ((emacs (24 3)) (let-alist (1 0 4)) (seq (1 11)) (dash (2 12 1))) "A framework for looking up and displaying bibliographic entries" single ((:commit . "517ec18f00f91b61481214b178f7ae0b8fbc499b") (:authors ("Clément Pit-Claudel" . "clement.pitclaudel@live.com")) (:maintainer "Clément Pit-Claudel" . "clement.pitclaudel@live.com") (:keywords "bib" "tex" "convenience" "hypermedia") (:url . "https://github.com/cpitclaudel/biblio.el"))]) + (bibliothek . [(20190124 1828) ((emacs (24 4)) (pdf-tools (0 70)) (a (0 1 0 -3 4))) "Managing a digital library of PDFs" single ((:commit . "350af0e5d53307c900e4f8b2617f3852f51a74d2") (:authors ("Göktuğ Kayaalp" . "self@gkayaalp.com")) (:maintainer "Göktuğ Kayaalp" . "self@gkayaalp.com") (:keywords "tools") (:url . "https://dev.gkayaalp.com/elisp/index.html#bibliothek-el"))]) + (bibretrieve . [(20191124 1855) ((auctex (11 87)) (emacs (24 3))) "Retrieve BibTeX entries from the internet" tar ((:commit . "81dc8e0db3629cc180eafb2bc34b60dcd8980316") (:authors ("Antonio Sartori")) (:maintainer "Pavel Zorin-Kranich" . "pzorin@uni-bonn.de") (:keywords "bibtex" "bibliography" "mathscinet" "arxiv" "zbmath") (:url . "https://github.com/pzorin/bibretrieve"))]) + (bibslurp . [(20151202 2346) ((s (1 6 0)) (dash (1 5 0))) "retrieve BibTeX entries from NASA ADS" single ((:commit . "0116bbb04840d20a6b087e6d9c921bb1c2489a8f") (:keywords "bibliography" "nasa ads") (:url . "https://github.com/mkmcc/bibslurp"))]) + (bibtex-completion . [(20220404 1608) ((parsebib (1 0)) (s (1 9 0)) (dash (2 6 0)) (f (0 16 2)) (cl-lib (0 5)) (biblio (0 2)) (emacs (26 1))) "A BibTeX backend for completion frameworks" single ((:commit . "ce8c17690ddad73d01531084b282f221f8eb6669") (:authors ("Titus von der Malsburg" . "malsburg@posteo.de") ("Justin Burkett" . "justin@burkett.cc")) (:maintainer "Titus von der Malsburg" . "malsburg@posteo.de") (:url . "https://github.com/tmalsburg/helm-bibtex"))]) + (bibtex-utils . [(20190703 2117) nil "Provides utilities for extending BibTeX mode" single ((:commit . "26a8f0909b6adbf545a2b5e57ce7f779bf7a65af") (:authors ("Tyler Smith" . "tyler@plantarum.ca")) (:maintainer "Tyler Smith" . "tyler@plantarum.ca") (:keywords "bibtex") (:url . "https://github.com/plantarum/bibtex-utils"))]) + (bicycle . [(20220422 1600) ((emacs (25 1)) (compat (28 1 1 0))) "Cycle outline and code visibility" single ((:commit . "e6d8ca47f77e0579fcb5a1dcb88218087102c355") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "outlines") (:url . "https://github.com/tarsius/bicycle"))]) + (bifocal . [(20200325 539) ((emacs (24 4))) "Split-screen scrolling for comint-mode buffers" single ((:commit . "de8d09b08b0b30714c4f9b98c97e9577d47b9be6") (:keywords "frames" "processes") (:url . "https://github.com/riscy/bifocal-mode"))]) + (binclock . [(20170802 1116) ((cl-lib (0 5))) "Display the current time using a binary clock." single ((:commit . "87042230d7f3fe3e9a77fae0dbab7d8f7e7794ad") (:authors ("Dave Pearson" . "davep@davep.org")) (:maintainer "Dave Pearson" . "davep@davep.org") (:keywords "games" "time" "display") (:url . "https://github.com/davep/binclock.el"))]) + (bind-chord . [(20171204 2010) ((bind-key (1 0)) (key-chord (0 6))) "key-chord binding helper for use-package-chords" single ((:commit . "a7422fb8ab1baee19adb2717b5b47b9c3812a84c") (:authors ("Justin Talbott" . "justin@waymondo.com")) (:maintainer "Justin Talbott" . "justin@waymondo.com") (:keywords "convenience" "tools" "extensions") (:url . "https://github.com/waymondo/use-package-chords"))]) + (bind-key . [(20210210 1609) nil "A simple way to manage personal keybindings" single ((:commit . "a7422fb8ab1baee19adb2717b5b47b9c3812a84c") (:authors ("John Wiegley" . "johnw@newartisans.com")) (:maintainer "John Wiegley" . "johnw@newartisans.com") (:keywords "keys" "keybinding" "config" "dotemacs") (:url . "https://github.com/jwiegley/use-package"))]) + (bind-map . [(20220108 228) ((emacs (24 3))) "Bind personal keymaps in multiple locations" single ((:commit . "510a24138d8de3b8df0783f1ac493a551fc9bd74") (:authors ("Justin Burkett" . "justin@burkett.cc")) (:maintainer "Justin Burkett" . "justin@burkett.cc") (:url . "https://github.com/justbur/emacs-bind-map"))]) + (binder . [(20220429 2055) ((emacs (24 4)) (seq (2 20))) "Global minor mode to facilitate multi-file writing projects" tar ((:commit . "127463a7cb8cc2fa9904d3feb3fca95d2244ddcc") (:authors ("Paul W. Rankin" . "pwr@bydasein.com")) (:maintainer "Paul W. Rankin" . "pwr@bydasein.com") (:keywords "files" "outlines" "wp" "text") (:url . "https://github.com/rnkn/binder"))]) + (bing-dict . [(20200216 110) nil "Minimalists' English-Chinese Bing dictionary" tar ((:commit . "1d581aaa9622b34f8fb83af5579fa252aa24cfef") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions") (:url . "https://github.com/cute-jumper/bing-dict.el"))]) + (birds-of-paradise-plus-theme . [(20130419 2129) nil "A brown/orange light-on-dark theme for Emacs 24 (deftheme)." single ((:commit . "bb9f9d4ef7f7872a388ec4eee1253069adcadb6f") (:authors ("Jim Myhrberg" . "contact@jimeh.me")) (:maintainer "Jim Myhrberg" . "contact@jimeh.me") (:keywords "themes") (:url . "https://github.com/jimeh/birds-of-paradise-plus-theme.el"))]) + (bison-mode . [(20210527 717) nil "Major mode for editing bison, yacc and lex files." single ((:commit . "4f2e20394a475931409618c1635e9c9f1cf07d9c") (:authors ("Eric Beuscher" . "beuscher@eecs.tulane.edu")) (:maintainer "Eric Beuscher" . "beuscher@eecs.tulane.edu") (:keywords "bison-mode" "yacc-mode"))]) + (bitbake . [(20220509 1236) ((emacs (24 1)) (dash (2 6 0)) (mmm-mode (0 5 4)) (s (1 10 0))) "Running bitbake from emacs" single ((:commit . "434b088ab8715731d62978264cb934e34c75c4b3") (:authors ("Damien Merenne")) (:maintainer "Damien Merenne") (:keywords "convenience") (:url . "https://github.com/canatella/bitbake-el"))]) + (bitbucket . [(20170405 446) ((emacs (24)) (request (0 1 0)) (s (1 9 0))) "Bitbucket API wrapper" tar ((:commit . "5e663da1bd38a14c1ecf4d66a79d4321ac833bcf") (:authors ("2017 Tjaart van der Walt" . "tjaart@tjaart.co.za")) (:maintainer "2017 Tjaart van der Walt" . "tjaart@tjaart.co.za") (:keywords "bitbucket") (:url . "http://github.com/tjaartvdwalt/bitbucket.el/"))]) + (bitlbee . [(20151203 0) nil "Help get Bitlbee (http://www.bitlbee.org) up and running." single ((:commit . "3a92a4119e0c007df2c7dcf1b1c3a5f23ee40e05"))]) + (blackboard-bold-mode . [(20160813 206) ((cl-lib (0 5))) "Easily insert Unicode mathematical double-struck characters" single ((:commit . "5299cb064ba71baa3e331b8560bf8dd38cbbc4ed") (:authors ("Grant Rettke" . "gcr@wisdomandwonder.com")) (:maintainer nil . "") (:keywords "unicode" "double struck" "blackboard bold" "math" "mathematical") (:url . "https://github.com/grettke/blackboard-bold-mode"))]) + (blackboard-theme . [(20161216 656) ((emacs (24))) "TextMate Blackboard Theme" single ((:commit . "7a0d79410feb728ff5cce75c140fadc19a3f9a6d") (:authors ("Dong Zheng")) (:maintainer "Dong Zheng") (:url . "https://github.com/don9z/blackboard-theme"))]) + (blacken . [(20220110 1841) ((emacs (25 2))) "Reformat python buffers using the \"black\" formatter" single ((:commit . "563c744f545552cb92e8e84d5be4e2cdbabc93ca") (:authors ("Artem Malyshev" . "proofit404@gmail.com")) (:maintainer "Artem Malyshev" . "proofit404@gmail.com") (:url . "https://github.com/proofit404/blacken"))]) + (blackout . [(20220509 2350) ((emacs (26))) "Better mode lighter overriding" single ((:commit . "7707211370f03f03a2f74df15f42ac24a1e99300") (:authors ("Radian LLC" . "contact+blackout@radian.codes")) (:maintainer "Radian LLC" . "contact+blackout@radian.codes") (:keywords "extensions") (:url . "https://github.com/radian-software/blackout"))]) + (blamer . [(20220404 1917) ((emacs (27 1))) "Show git blame info about current line" single ((:commit . "f5c0b5ef2ae46062ba13dd03215cdfc49d0fd30b") (:authors ("Artur Yaroshenko" . "artawower@protonmail.com")) (:maintainer "Artur Yaroshenko" . "artawower@protonmail.com") (:url . "https://github.com/artawower/blamer.el"))]) + (blgrep . [(20150401 1416) ((clmemo (20140321 715))) "Block grep" tar ((:commit . "605beda210610a5829750a987f5fcebea97af546") (:authors ("Masayuki Ataka" . "masayuki.ataka@gmail.com")) (:maintainer "Masayuki Ataka" . "masayuki.ataka@gmail.com") (:keywords "tools" "convenience"))]) + (blimp . [(20180903 2240) ((emacs (25)) (eimp (1 4 0))) "Bustling Image Manipulation Package" single ((:commit . "39562f02acc1113595cb253a85bb3b9da743ddd2") (:authors ("Sebastian Wålinder" . "s.walinder@gmail.com")) (:maintainer "Sebastian Wålinder" . "s.walinder@gmail.com") (:keywords "multimedia" "unix") (:url . "https://github.com/walseb/blimp"))]) + (bliss-theme . [(20170808 1307) ((emacs (24 0))) "an Emacs 24 theme based on Bliss (tmTheme)" single ((:commit . "c3cf6d8a666ab26909b7da158f9e94df71a5fbbf") (:authors ("Jason Milkins")) (:maintainer "Jason Milkins") (:url . "https://github.com/emacsfodder/tmtheme-to-deftheme"))]) + (blitzmax-mode . [(20211128 2028) ((emacs (24 1))) "A major mode for editing BlitzMax source code" single ((:commit . "c9651fa69116b5821cd34fb34eabc3e12ce238e2") (:authors ("Phil Newton")) (:maintainer "Phil Newton") (:keywords "languages" "blitzmax") (:url . "https://www.sodaware.net/dev/tools/blitzmax-mode/"))]) + (bln-mode . [(20181121 918) nil "binary line navigation minor mode for cursor movement in long lines" single ((:commit . "a601b0bf975dd1432f6552ab6afe3f4f71133b4a") (:authors ("Maarten Grachten")) (:maintainer "Maarten Grachten") (:keywords "motion" "location" "cursor" "convenience") (:url . "https://github.com/mgrachten/bln-mode"))]) + (block-nav . [(20201005 202) ((emacs (25 1))) "Jump across indentation levels for quick navigation" single ((:commit . "d69acaa3d6c75bf4c518d8ab8896ad63580253fc") (:maintainer "Philip Dumaresq" . "phdumaresq@protonmail.com") (:keywords "convenience") (:url . "https://github.com/nixin72/block-nav.el"))]) + (blockdiag-mode . [(20160427 524) ((emacs (24 3))) "Major mode for editing blockdiag files" single ((:commit . "f3b21ba433d60327cebd103ae4492200750e24a9") (:authors ("xcezx" . "main.xcezx@gmail.com")) (:maintainer "xcezx" . "main.xcezx@gmail.com") (:url . "https://github.com/xcezx/xdiag-mode"))]) + (blog-admin . [(20170923 1409) ((ctable (0 1 1)) (s (1 10 0)) (f (0 17 3)) (names (20151201 0)) (cl-lib (0 5))) "Blog admin for emacs with hexo/org-page supported" tar ((:commit . "b5f2e1dad7d68ec903619f7280bb0bcb7e398a1e") (:authors (nil . "code.falling@gmail.com")) (:maintainer nil . "code.falling@gmail.com") (:keywords "tools" "blog" "org" "hexo" "org-page"))]) + (blog-minimal . [(20181021 849) ((ht (1 5)) (simple-httpd (1 4 6)) (mustache (0 22)) (s (1 11 0)) (org (9 0 3))) "a simple static site generator based on org mode" tar ((:commit . "356c878322258159021eecdd15757e11cf02e335") (:authors ("Thank Fly" . "thiefuniverses@gmail.com")) (:maintainer "Thank Fly" . "thiefuniverses@gmail.com") (:keywords "tools") (:url . "https://github.com/thiefuniverse/blog-minimal"))]) + (blox . [(20210225 1900) ((emacs (25 1))) "Interaction with Roblox tooling" single ((:commit . "2bf0e618451fb1da11263d8a35ffcd9210590c0a") (:authors ("Kenneth Loeffler" . "kenneth.loeffler@outlook.com")) (:maintainer "Kenneth Loeffler" . "kenneth.loeffler@outlook.com") (:keywords "roblox" "rojo" "tools") (:url . "https://github.com/kennethloeffler/blox"))]) + (bm . [(20210421 1351) nil "Visible bookmarks in buffer." tar ((:commit . "9a31c61f44e6f1033ca43bd7f3eb33ffdb2ca595") (:authors ("Jo Odland ")) (:maintainer "Jo Odland ") (:keywords "bookmark" "highlight" "faces" "persistent") (:url . "https://github.com/joodland/bm"))]) + (bmx-mode . [(20210319 620) ((emacs (25 1)) (cl-lib (0 5)) (company (0 9 4)) (dash (2 13 0)) (s (1 12 0))) "Batch Mode eXtras" single ((:commit . "6f008707efe0bb5646f0c1b0d6f57f0a8800e200") (:authors ("Jostein Kjønigsen" . "jostein@gmail.com")) (:maintainer "Jostein Kjønigsen" . "jostein@gmail.com") (:keywords "c" "convenience" "tools") (:url . "http://github.com/josteink/bmx-mode"))]) + (bnf-mode . [(20200323 1348) ((cl-lib (0 5)) (emacs (24 3))) "Major mode for editing BNF grammars." tar ((:commit . "d9329dd90e5d4f629295e85898362d9682047898") (:authors ("Serghei Iakovlev" . "egrep@protonmail.ch")) (:maintainer "Serghei Iakovlev" . "egrep@protonmail.ch") (:keywords "languages") (:url . "https://github.com/sergeyklay/bnf-mode"))]) + (bnfc . [(20160605 1927) ((emacs (24 3))) "Define context-free grammars for the BNFC tool" single ((:commit . "1b58df1dd0cb9b81900632fb2843a03b94f56fdb") (:authors ("Jacob Mitchell" . "jmitchell@member.fsf.org")) (:maintainer "Jacob Mitchell" . "jmitchell@member.fsf.org") (:keywords "languages" "tools") (:url . "https://github.com/jmitchell/bnfc-mode"))]) + (bog . [(20201030 357) ((cl-lib (0 5))) "Extensions for research notes in Org mode" single ((:commit . "af929c164c4ffaee0c33ba97c06733f0ce9431d4") (:authors ("Kyle Meyer" . "kyle@kyleam.com")) (:maintainer "Kyle Meyer" . "kyle@kyleam.com") (:keywords "bib" "outlines") (:url . "https://github.com/kyleam/bog"))]) + (bolt-mode . [(20180310 810) ((emacs (24 3))) "Editing support for Bolt language" single ((:commit . "85a5a752bfbebb4aed884326c25db64c000e9934") (:authors ("Mikhail Pontus" . "mpontus@gmail.com")) (:maintainer "Mikhail Pontus" . "mpontus@gmail.com") (:keywords "languages") (:url . "https://github.com/mpontus/bolt-mode"))]) + (bongo . [(20201002 1020) ((cl-lib (0 5)) (emacs (24 1))) "play music with Emacs" tar ((:commit . "9e9629090262bba6d0003dabe5a375e47a4477f1"))]) + (bonjourmadame . [(20170919 1134) nil "Say \"Hello ma'am!\"" single ((:commit . "d3df185fce78aefa689fded8e56a654f0fde4ac0"))]) + (boogie-friends . [(20220419 2240) ((cl-lib (0 5)) (dash (2 10 0)) (flycheck (0 23)) (yasnippet (0 9 0 1)) (company (0 8 12))) "A collection of programming modes for Boogie, Dafny, and Z3 (SMTLIB v2)." tar ((:commit . "d685a52259f50c2db51205ef9cc93f713ae8d8fa") (:authors ("Clément Pit--Claudel" . "clement.pitclaudel@live.com")) (:maintainer "Clément Pit--Claudel" . "clement.pitclaudel@live.com") (:keywords "convenience" "languages") (:url . "https://github.com/boogie-org/boogie-friends/"))]) + (bookmark-in-project . [(20220507 1118) ((emacs (27 1))) "Bookmark access within a project" single ((:commit . "0e08e4bd4fedc87b2371313d55691356bee0ad7d") (:authors ("Campbell Barton" . "ideasman42@gmail.com")) (:maintainer "Campbell Barton" . "ideasman42@gmail.com") (:keywords "convenience") (:url . "https://codeberg.com/ideasman42/emacs-bookmark-in-project"))]) + (bookmark-view . [(20220403 2204) ((emacs (27 1))) "Bookmark views" single ((:commit . "0d40ac67f53b7fa75fe65c38a5ef65701ce4c3da") (:authors ("Daniel Mendler")) (:maintainer "Daniel Mendler") (:url . "https://github.com/minad/bookmark-view"))]) + (bool-flip . [(20161215 1539) ((emacs (24 3))) "flip the boolean under the point" single ((:commit . "f58a9a7b9ab875bcfbd57c8262697ae404eb4485") (:authors ("Michael Brandt" . "michaelbrandt5@gmail.com")) (:maintainer "Michael Brandt" . "michaelbrandt5@gmail.com") (:keywords "boolean" "convenience" "usability") (:url . "http://github.com/michaeljb/bool-flip/"))]) + (boon . [(20220502 1850) ((emacs (26 1)) (dash (2 12 0)) (expand-region (0 10 0)) (multiple-cursors (1 3 0))) "Ergonomic Command Mode for Emacs." tar ((:commit . "db7b6083d390e3febf82f9af5782e1a36d30093c"))]) + (borg . [(20220509 2044) ((emacs (26)) (epkg (3 3 3)) (magit (3 3 0))) "Assimilate Emacs packages as Git submodules" tar ((:commit . "492e0e44bfa0576a8227be21635c6ef0a853ad38") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "tools") (:url . "https://github.com/emacscollective/borg"))]) + (borland-blue-theme . [(20160117 1321) ((emacs (24 1))) "Blue/yellow theme based on old DOS Borland/Turbo C IDE" single ((:commit . "db74eefebbc89d3c62575f8f50b319e87b4a3470") (:authors ("Alexey Veretennikov ")) (:maintainer "Alexey Veretennikov ") (:keywords "themes") (:url . "http://github.com/fourier/borland-blue-theme"))]) + (boron-theme . [(20170808 1308) ((emacs (24 0))) "an Emacs 24 theme based on Boron (tmTheme)" single ((:commit . "87ae1a765e07429fec25d2f29b004f84b52d2e0a") (:authors ("Jason Milkins")) (:maintainer "Jason Milkins") (:url . "https://github.com/emacsfodder/tmtheme-to-deftheme"))]) + (boxquote . [(20220105 1515) ((cl-lib (0 5))) "Quote text with a semi-box." single ((:commit . "67775ce80886b776efedceb31cdbacec1e26678e") (:authors ("Dave Pearson" . "davep@davep.org")) (:maintainer "Dave Pearson" . "davep@davep.org") (:keywords "quoting") (:url . "https://github.com/davep/boxquote.el"))]) + (bpe . [(20141228 2205) ((emacs (24 1))) "Blog from Org mode to Blogger" single ((:commit . "7b5b25f83506e6c9f4075d3803fa32404943a189") (:authors ("Yuta Yamada ")) (:maintainer "Yuta Yamada ") (:keywords "blogger" "blog") (:url . "https://github.com/yuutayamada/bpe"))]) + (bpftrace-mode . [(20190608 2201) ((emacs (24 0))) "Major mode for editing bpftrace script files" single ((:commit . "181065e1f9ab4ec7096bafffe6818b0d7f5362b1") (:authors ("Jay Kamat" . "jaygkamat@gmail.com")) (:maintainer "Jay Kamat" . "jaygkamat@gmail.com") (:keywords "highlight" "c") (:url . "http://gitlab.com/jgkamat/bpftrace-mode"))]) + (bpr . [(20180220 1844) ((emacs (24))) "Background Process Runner" tar ((:commit . "7f3c787ed80ac0e83447192ac5450dfa7110ade1") (:authors ("Ilya Babanov" . "ilya-babanov@ya.ru")) (:maintainer "Ilya Babanov" . "ilya-babanov@ya.ru") (:keywords "background" "async" "process" "management") (:url . "https://github.com/ilya-babanov/emacs-bpr"))]) + (bracketed-paste . [(20160407 2348) ((emacs (24 3))) "bracketed paste mode support within emacs -nw" single ((:commit . "843ce3bbb63d560face889e13a57a2f7543957d5") (:authors ("Takeshi Banse" . "takebi@laafc.net")) (:maintainer "Takeshi Banse" . "takebi@laafc.net") (:keywords "terminals"))]) + (brainfuck-mode . [(20150113 842) ((langdoc (20130601 1450))) "Brainfuck mode for Emacs" single ((:commit . "36e69552bb3b97a4f888d362c59845651bd0d492") (:authors ("Tomoya Tanjo" . "ttanjo@gmail.com")) (:maintainer "Tomoya Tanjo" . "ttanjo@gmail.com") (:keywords "brainfuck" "langdoc") (:url . "https://github.com/tom-tan/brainfuck-mode/"))]) + (brazilian-holidays . [(20210302 107) ((emacs (26))) "Brazilian holidays" single ((:commit . "68811fd5f3e9d9c0572995c3ca46ead2c35eb421") (:authors ("Jaguaraquem A. Reinaldo" . "jaguar.adler@gmail.com")) (:maintainer "Jaguaraquem A. Reinaldo" . "jaguar.adler@gmail.com") (:keywords "calendar" "holidays" "brazilian") (:url . "https://github.com/jadler/brazilian-holidays"))]) + (brf . [(20220104 2222) ((fringe-helper (0 1 1)) (emacs (24 3))) "Brf-mode provides features from the legendary editor Brief" tar ((:commit . "59ec15094917666f253eaf61d17664525a7971f4") (:authors ("Mike Woolley" . "mike@bulsara.com")) (:maintainer "Mike Woolley" . "mike@bulsara.com") (:keywords "brief" "crisp" "emulations") (:url . "https://bitbucket.org/MikeWoolley/brf-mode"))]) + (brightscript-mode . [(20200321 2126) ((emacs (26 3))) "Major mode for editing Brightscript files" single ((:commit . "71c555c2e254629c365e6fc44c2fc4d5b6d0ae8b") (:authors ("Daniel Mircea" . "daniel@viseztrance.com")) (:maintainer nil . "daniel@viseztrance.com") (:keywords "languages") (:url . "https://github.com/viseztrance/brightscript-mode"))]) + (broadcast . [(20151205 212) ((emacs (24 4))) "Links buffers together for simultaneous editing." single ((:commit . "f6f9cd2e0e3f8c31d6b8e7446c27eb0e50b25f16") (:authors ("Russell Black" . "killdash9@github")) (:maintainer "Russell Black" . "killdash9@github") (:keywords "convenience" "frames" "link" "cursors") (:url . "https://github.com/killdash9/broadcast.el"))]) + (browse-at-remote . [(20210603 802) ((f (0 17 2)) (s (1 9 0)) (cl-lib (0 5))) "Open github/gitlab/bitbucket/stash/gist/phab/sourcehut page from Emacs" single ((:commit . "cef26f2c063f2473af42d0e126c8613fe2f709e4") (:authors ("Rustem Muslimov" . "r.muslimov@gmail.com")) (:maintainer "Rustem Muslimov" . "r.muslimov@gmail.com") (:keywords "github" "gitlab" "bitbucket" "gist" "stash" "phabricator" "sourcehut" "pagure") (:url . "https://github.com/rmuslimov/browse-at-remote"))]) + (browse-kill-ring . [(20220410 1509) nil "interactively insert items from kill-ring" single ((:commit . "6e06736a8245a8cdf436f6585c71439239219836") (:authors ("Colin Walters" . "walters@verbum.org")) (:maintainer "browse-kill-ring" . "browse-kill-ring@tonotdo.com") (:keywords "convenience") (:url . "https://github.com/browse-kill-ring/browse-kill-ring"))]) + (browse-url-dwim . [(20140731 1922) ((string-utils (0 3 2))) "Context-sensitive external browse URL or Internet search" single ((:commit . "3d611dbb167c286109ac53995ad68286d87aafb9") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "hypermedia") (:url . "http://github.com/rolandwalker/browse-url-dwim"))]) + (brutalist-theme . [(20220507 909) nil "Brutalist theme" tar ((:commit . "c58131f3a8cb71cc0f8efa47766f29578c45bc59") (:authors ("Gergely Nagy")) (:maintainer "Gergely Nagy") (:url . "https://git.madhouse-project.org/algernon/brutalist-theme.el"))]) + (bshell . [(20201219 139) ((emacs (26)) (buffer-manage (0 11))) "Manage and track multiple inferior shells" single ((:commit . "469c841f19f28c271b4f172b40f3f9ca830254df") (:authors ("Paul Landes")) (:maintainer "Paul Landes") (:keywords "unix" "interactive" "shell" "management") (:url . "https://github.com/plandes/bshell"))]) + (btc-ticker . [(20220409 1647) ((json (1 2)) (request (0 2 0))) "Shows latest bitcoin price" single ((:commit . "2ed18ac6338d5fe98c578f0875840af07f0bc42a") (:authors ("Jorge Niedbalski R." . "jnr@metaklass.org")) (:maintainer "Jorge Niedbalski R." . "jnr@metaklass.org") (:keywords "news"))]) + (bts . [(20151109 1333) ((widget-mvc (0 0 2)) (log4e (0 3 0)) (yaxception (0 3 3)) (dash (2 9 0)) (s (1 9 0)) (pos-tip (0 4 5))) "A unified UI for various bug tracking systems" single ((:commit . "df42d58a36447697f93b56e69f5e700b2baef1f9") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "convenience") (:url . "https://github.com/aki2o/emacs-bts"))]) + (bts-github . [(20170401 1249) ((bts (0 0 1)) (gh (0 8 2))) "A plugin of bts.el for GitHub" single ((:commit . "ef2cf9202dc2128e5efdb613bfde9276a8cd95ad") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "convenience" "git" "github") (:url . "https://github.com/aki2o/emacs-bts-github"))]) + (bubbleberry-theme . [(20141017 944) ((emacs (24 1))) "A theme based on LightTable for Emacs24" single ((:commit . "22e9adf4586414024e4592972022ec297321b320") (:authors ("Jason Milkins" . "jasonm23@gmail.com") ("Gaurav Giri github.com/grvgr")) (:maintainer "Jason Milkins" . "jasonm23@gmail.com") (:url . "https://github.com/jasonm23/emacs-bubbleberry-theme"))]) + (buckwalter . [(20191119 1950) nil "Write arabic using Buckwalter transliteration" single ((:commit . "b8c0c2170c7113b515477b1bb39c58d22aad67e1") (:authors ("Joe HAKIM RAHME" . "joehakimrahme@gmail.com")) (:maintainer "Joe HAKIM RAHME" . "joehakimrahme@gmail.com") (:keywords "arabic" "transliteration" "i18n") (:url . "https://github.com/joehakimrahme/buckwalter-arabic"))]) + (buffer-buttons . [(20150106 1439) nil "Define, save, and load code-safe buttons in files for emacs" single ((:commit . "2feb8494fa7863b98256bc85da670d74a3a8a975") (:authors ("Ryan Pavlik" . "rpavlik@gmail.com")) (:maintainer "Ryan Pavlik" . "rpavlik@gmail.com") (:url . "https://github.com/rpav/buffer-buttons"))]) + (buffer-env . [(20220506 1506) ((emacs (27 1))) "Buffer-local process environments" single ((:commit . "7b7e5c2a79ad3b31b465387df0ccc18a5809f9d1") (:authors ("Augusto Stoffel" . "arstoffel@gmail.com")) (:maintainer "Augusto Stoffel" . "arstoffel@gmail.com") (:keywords "processes" "tools") (:url . "https://github.com/astoff/buffer-env"))]) + (buffer-flip . [(20180307 2251) nil "Cycle through buffers like Alt-Tab in Windows" single ((:commit . "b8ecbf0251a59c351a3e44607ee502af343da64b") (:authors ("Russell Black" . "killdash9@github")) (:maintainer "Russell Black" . "killdash9@github") (:keywords "convenience") (:url . "https://github.com/killdash9/buffer-flip.el"))]) + (buffer-manage . [(20211122 1957) ((emacs (26 1)) (choice-program (0 13)) (dash (2 17 0))) "Manage buffers" tar ((:commit . "819bbfd9ae2f028361f484bc3b60d751623a2df5") (:authors ("Paul Landes")) (:maintainer "Paul Landes") (:keywords "internal" "maint") (:url . "https://github.com/plandes/buffer-manage"))]) + (buffer-move . [(20160615 1803) nil "easily swap buffers" single ((:commit . "cb517ecf8409b5fdcda472d7190c6021f0c49751") (:keywords "lisp" "convenience") (:url . "https://github.com/lukhas/buffer-move"))]) + (buffer-ring . [(20220120 124) ((emacs (25 1)) (dynaring (0 3)) (s (1 12 0)) (ht (2 0))) "Rings and tori for buffer navigation" single ((:commit . "177d67238c4d126a0270585e21c0f03ae750ca2a") (:authors ("Mike Mattie" . "codermattie@gmail.com") ("Sid Kasivajhula" . "sid@countvajhula.com")) (:maintainer "Sid Kasivajhula" . "sid@countvajhula.com") (:url . "https://github.com/countvajhula/buffer-ring"))]) + (buffer-sets . [(20170718 340) ((cl-lib (0 5))) "Sets of Buffers for Buffer Management" single ((:commit . "bc84c2f79a33609cccf3c996101125859b2e26ab") (:authors ("Samuel W. Flint" . "swflint@flintfam.org")) (:maintainer "Samuel W. Flint" . "swflint@flintfam.org") (:keywords "buffer-management") (:url . "http://github.com/swflint/buffer-sets"))]) + (buffer-utils . [(20140512 1400) nil "Buffer-manipulation utility functions" single ((:commit . "685b13457e3a2085b7584e41365d2aa0779a1b6f") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "extensions") (:url . "http://github.com/rolandwalker/buffer-utils"))]) + (buffer-watcher . [(20170913 839) ((f (0 16 2)) (cl-lib (0 5))) "Easily run shell scripts per filetype/directory when a buffer is saved" single ((:commit . "b32c67c8a5d724257d759f4c903d0dedc32246ef") (:authors ("Nicolas Petton" . "nicolas@petton.fr")) (:maintainer "Nicolas Petton" . "nicolas@petton.fr"))]) + (buffer-wrap . [(20200924 345) ((emacs (24 4))) "Wrap the beginning and the end of buffer" single ((:commit . "b918ba023212b0e223a7ca7df3a2ec12a7c54206") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/buffer-wrap"))]) + (bufler . [(20210907 1145) ((emacs (26 3)) (dash (2 18)) (f (0 17)) (pretty-hydra (0 2 2)) (magit-section (0 1)) (map (2 1))) "Group buffers into workspaces with programmable rules" tar ((:commit . "a68e0eb2719c67ab8a3ad56c4036364061d06004") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "convenience") (:url . "https://github.com/alphapapa/bufler.el"))]) + (bufshow . [(20130726 1838) ((emacs (24 1))) "A simple presentation tool for Emacs." single ((:commit . "d60a554e7239e6f7520d9c3436d5ecdbc9cf6957") (:authors ("Peter Jones" . "pjones@pmade.com")) (:maintainer "Peter Jones" . "pjones@pmade.com") (:url . "https://github.com/pjones/bufshow"))]) + (bug-reference-github . [(20200206 2158) nil "Set `bug-reference-url-format' in Github repos" tar ((:commit . "c9512a010f19633e69f1d4b1597eff7048b21112") (:authors ("Arne Jørgensen" . "arne@arnested.dk")) (:maintainer "Arne Jørgensen" . "arne@arnested.dk") (:keywords "programming" "tools") (:url . "https://github.com/arnested/bug-reference-github"))]) + (bui . [(20210108 1141) ((emacs (24 3)) (dash (2 11 0))) "Buffer interface library" tar ((:commit . "f3a137628e112a91910fd33c0cff0948fa58d470") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "tools") (:url . "https://github.com/alezost/bui.el"))]) + (build-farm . [(20181218 2002) ((emacs (24 4)) (bui (1 2 1)) (magit-popup (2 1 0))) "Interface for Nix and Guix build farms (Hydra and Cuirass)" tar ((:commit . "5c268a3c235ace0d79ef1ec82c440120317e06f5") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "tools") (:url . "https://gitlab.com/alezost-emacs/build-farm"))]) + (build-helper . [(20161009 1755) ((projectile (0 9 0))) "Utilities to help build code" single ((:commit . "7a6fe71125a26ed1c492dab77cc688a7fe1d68ac") (:authors ("Afonso Bordado" . "afonsobordado@az8.co")) (:maintainer "Afonso Bordado" . "afonsobordado@az8.co") (:keywords "convenience") (:url . "http://github.com/afonso360/build-helper"))]) + (build-status . [(20190807 1231) ((cl-lib (0 5))) "Mode line build status indicator" single ((:commit . "1a1d2473aa62f2fdda47d8bfeb9fe352d2579b48") (:authors ("Skye Shaw" . "skye.shaw@gmail.com")) (:maintainer "Skye Shaw" . "skye.shaw@gmail.com") (:keywords "mode-line" "ci" "circleci" "travis-ci") (:url . "http://github.com/sshaw/build-status"))]) + (bundler . [(20200129 1338) ((inf-ruby (2 1)) (cl-lib (0 5))) "Interact with Bundler from Emacs" single ((:commit . "43efb6be4ed118b06d787ce7fbcffd68a31732a7") (:authors ("Tobias Svensson" . "tob@tobiassvensson.co.uk")) (:maintainer "Tobias Svensson" . "tob@tobiassvensson.co.uk") (:keywords "bundler" "ruby") (:url . "http://github.com/endofunky/bundler.el"))]) + (burly . [(20220413 1529) ((emacs (26 3)) (map (2 1))) "Save and restore frame/window configurations with buffers" tar ((:commit . "96f59fe24fdce14d14f204372f99bf522ab192bf") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "convenience") (:url . "https://github.com/alphapapa/burly.el"))]) + (burnt-toast . [(20201113 814) ((emacs (25 1)) (dash (2 10)) (alert (1 2))) "Elisp integration with the BurntToast PowerShell module" tar ((:commit . "eed66036d65b0ee26ce02371d14dce16a360acb4") (:authors ("Sam Cedarbaum" . "scedarbaum@gmail.com")) (:maintainer "Sam Cedarbaum" . "scedarbaum@gmail.com") (:keywords "alert" "notifications" "powershell" "comm") (:url . "https://github.com/cedarbaum/burnt-toast.el"))]) + (bury-successful-compilation . [(20181106 403) nil "Bury the *compilation* buffer after successful compilation" single ((:commit . "674644c844184605a1bb4f9487a60f7a780a6fe7") (:authors ("Eric Crosson" . "esc@ericcrosson.com")) (:maintainer "Eric Crosson" . "esc@ericcrosson.com") (:keywords "compilation"))]) + (buster-mode . [(20140928 1213) nil "Minor mode to speed up development when writing tests with Buster.js" single ((:commit . "de6958ef8369400922618b8d1e99abfa91b97ac5") (:keywords "buster" "testing" "javascript"))]) + (buster-snippets . [(20151125 1010) ((yasnippet (0 8 0))) "Yasnippets for the Buster javascript testing framework" tar ((:commit . "bb8769dae132659858e74d52f3f4e8790399423a") (:authors ("Magnar Sveen" . "magnars@gmail.com")) (:maintainer "Magnar Sveen" . "magnars@gmail.com") (:keywords "snippets"))]) + (busybee-theme . [(20170719 928) nil "port of vim's mustang theme" single ((:commit . "66b2315b030582d0ebee605cf455d386d8c30fcd") (:authors ("martin haesler")) (:maintainer "martin haesler") (:url . "http://github.com/mswift42/busybee-theme"))]) + (butler . [(20210928 230) ((deferred (0 3 2)) (json (1 2)) (emacs (24))) "Emacs client for Jenkins" tar ((:commit . "10943ccdf2030187b2f7bd97337d78acb7fd31c9") (:authors ("Ashton Kemerling" . "ashtonkemerling@gmail.com")) (:maintainer "Ashton Kemerling" . "ashtonkemerling@gmail.com") (:keywords "jenkins" "hudson" "ci") (:url . "http://www.github.com/AshtonKem/Butler.git"))]) + (buttercup . [(20220410 1557) ((emacs (24 3))) "Behavior-Driven Emacs Lisp Testing" tar ((:commit . "ceedad5efa797e860dbb356bc2c3028a4e0321ec") (:authors ("Jorgen Schaefer" . "contact@jorgenschaefer.de")) (:maintainer "Ola Nilsson" . "ola.nilsson@gmail.com") (:url . "https://github.com/jorgenschaefer/emacs-buttercup"))]) + (buttercup-junit . [(20190802 2258) ((emacs (24 3)) (buttercup (1 15))) "JUnit reporting for Buttercup" single ((:commit . "3ae4f84813c9e04e03a6e703990ca998b62b6deb") (:authors ("Ola Nilsson" . "ola.nilsson@gmail.com")) (:maintainer "Ola Nilsson" . "ola.nilsson@gmail.com") (:keywords "tools" "test" "unittest" "buttercup" "ci") (:url . "https://bitbucket.org/olanilsson/buttercup-junit"))]) + (button-lock . [(20200309 1323) nil "Clickable text defined by regular expression" single ((:commit . "9afe0f4d05910b0cccc94cb6d4d880119f3b0528") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "mouse" "button" "hypermedia" "extensions") (:url . "http://github.com/rolandwalker/button-lock"))]) + (buttons . [(20201123 2333) ((cl-lib (0 3))) "Define and visualize hierarchies of keymaps" single ((:commit . "de41b48244574a13000c4289fdb4216a2b0490ff") (:authors ("Ernesto Alfonso")) (:maintainer nil . "(concat \"erjoalgo\" \"@\" \"gmail\" \".com\")") (:keywords "keymap" "template" "snippet") (:url . "http://github.com/erjoalgo/emacs-buttons"))]) + (c-c-combo . [(20151224 255) nil "Make stuff happen when you reach a target wpm" tar ((:commit . "a261a833499a7fdc29610863b3aafc74818770ba") (:authors ("Diego Berrocal" . "cestdiego@gmail.com")) (:maintainer "Diego Berrocal" . "cestdiego@gmail.com") (:url . "https://www.github.com/CestDiego/c-c-combo.el"))]) + (c-eldoc . [(20201004 2347) nil "helpful description of the arguments to C functions" single ((:commit . "f4ede1f37f6de583376669735326367d84a0a917") (:authors ("Nathaniel Flath" . "flat0103@gmail.com")) (:maintainer "Nathaniel Flath" . "flat0103@gmail.com") (:url . "http://github.com/nflath/c-eldoc"))]) + (c-eval . [(20210611 705) ((emacs (24 5))) "Compile and run one-off C code snippets" single ((:commit . "fd129bfcb75475ac6820cc33862bd8efb8097fae") (:authors ("Lassi Kortela" . "lassi@lassi.io")) (:maintainer "Lassi Kortela" . "lassi@lassi.io") (:keywords "c" "languages") (:url . "https://github.com/lassik/emacs-c-eval"))]) + (c0-mode . [(20151110 1852) nil "Major mode for editing C0 files" tar ((:commit . "c214093c36864d6208fcb9e6a72413ed17ed5d60") (:authors ("Jakob Max Uecker")) (:maintainer "Jakob Max Uecker") (:keywords "c0" "languages") (:url . "http://c0.typesafety.net/"))]) + (ca65-mode . [(20210218 106) ((emacs (26 1))) "Major mode for ca65 assembly files" single ((:commit . "590d90cc0e1c1864dd7ce03df99b741ba866d52a") (:authors ("Wendel Scardua" . "wendel@scardua.net")) (:maintainer "Wendel Scardua" . "wendel@scardua.net") (:keywords "languages" "assembly" "ca65" "6502") (:url . "https://github.com/wendelscardua/ca65-mode"))]) + (cabledolphin . [(20160204 938) ((emacs (24 4)) (seq (1 0))) "capture Emacs network traffic" single ((:commit . "fffc192cafa61558e924323d6da8166fe5f2a6f9") (:authors ("Magnus Henoch" . "magnus.henoch@gmail.com")) (:maintainer "Magnus Henoch" . "magnus.henoch@gmail.com") (:keywords "comm"))]) + (cache . [(20111019 2300) nil "implementation of a hash table whose key-value pairs expire" single ((:commit . "7499586b6c8224df9f5c5bc4dec96b008258d580") (:authors ("Nathaniel Flath")) (:maintainer "Nathaniel Flath"))]) + (cacoo . [(20120319 2359) ((concurrent (0 3 1))) "Minor mode for Cacoo : http://cacoo.com" tar ((:commit . "c9fa04fbe97639b24698709530361c2bb5f3273c") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "convenience" "diagram") (:url . "https://github.com/kiwanami/emacs-cacoo/"))]) + (caddyfile-mode . [(20181204 858) ((emacs (25)) (loop (1 3))) "Major mode for Caddy configuration files" single ((:commit . "976ad0664c3f44bfa11cb9b8787ddfb094d0a666") (:authors ("Thomas Jost" . "schnouki@schnouki.net")) (:maintainer "Thomas Jost" . "schnouki@schnouki.net") (:keywords "languages") (:url . "https://github.com/Schnouki/caddyfile-mode/"))]) + (cake-inflector . [(20140415 858) ((s (1 9 0))) "Lazy porting CakePHP infrector.php to el" single ((:commit . "a1d338ec4840b1b1bc14f7f9298c07e2c1d2d8fc") (:authors ("k1LoW (Kenichirou Oyama), ")) (:maintainer "k1LoW (Kenichirou Oyama), ") (:url . "https://github.com/k1LoW/emacs-cake-inflector"))]) + (cakecrumbs . [(20180929 139) ((emacs (24 4))) "Show parents on header for HTML/Jade/Sass/Stylus" single ((:commit . "cf8c1df885eee004602f73c4f841301e200e5850") (:authors ("ono hiroko ")) (:maintainer "ono hiroko ") (:keywords "languages" "html" "jade" "pug" "sass" "scss" "stylus") (:url . "https://github.com/kuanyui/cakecrumbs.el"))]) + (cal-china-x . [(20200924 1837) ((cl-lib (0 5))) "Chinese localization, lunar/horoscope/zodiac info and more..." tar ((:commit . "94005e678a1d2522b7a00299779f40c5c77286b8") (:authors ("William Xu" . "william.xwl@gmail.com")) (:maintainer "William Xu" . "william.xwl@gmail.com") (:url . "https://github.com/xwl/cal-china-x"))]) + (calc-at-point . [(20210219 1252) ((emacs (26)) (dash (2 18 0))) "Perform calculations at point or over selection" single ((:commit . "0c1a9e94b519b0edb0abcbacdf6101eea2f2a524") (:authors ("Sebastian Wålinder" . "s.walinder@gmail.com")) (:maintainer "Sebastian Wålinder" . "s.walinder@gmail.com") (:keywords "convenience") (:url . "https://github.com/walseb/calc-at-point"))]) + (calendar-norway . [(20220211 1129) nil "Norwegian calendar" single ((:commit . "0db0ea63365f4ff5f7d18fb8335fa88af194a2cc") (:authors ("Kevin Brubeck Unhammer" . "unhammer@fsfe.org")) (:maintainer "Kevin Brubeck Unhammer" . "unhammer@fsfe.org") (:keywords "calendar" "norwegian" "localization"))]) + (calfw . [(20180118 45) nil "Calendar view framework on Emacs" single ((:commit . "03abce97620a4a7f7ec5f911e669da9031ab9088") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "calendar") (:url . "https://github.com/kiwanami/emacs-calfw"))]) + (calfw-cal . [(20170320 1206) nil "calendar view for emacs diary" single ((:commit . "03abce97620a4a7f7ec5f911e669da9031ab9088") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "calendar"))]) + (calfw-gcal . [(20120111 1000) nil "edit Google calendar for calfw.el." tar ((:commit . "14aab20687d6cc9e6c5ddb9e11984c4e14c3d870") (:authors ("myuhe ")) (:maintainer "myuhe") (:keywords "convenience" "calendar" "calfw.el") (:url . "https://github.com/myuhe/calfw-gcal.el"))]) + (calfw-howm . [(20170704 4) nil "calendar view for howm" single ((:commit . "03abce97620a4a7f7ec5f911e669da9031ab9088") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "calendar"))]) + (calfw-ical . [(20150703 819) nil "calendar view for ical format" single ((:commit . "03abce97620a4a7f7ec5f911e669da9031ab9088") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "calendar"))]) + (calfw-org . [(20160303 258) nil "calendar view for org-agenda" single ((:commit . "03abce97620a4a7f7ec5f911e669da9031ab9088") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "calendar" "org"))]) + (calibredb . [(20220504 516) ((emacs (25 1)) (org (9 3)) (transient (0 1 0)) (s (1 12 0)) (dash (2 17 0)) (request (0 3 3)) (esxml (0 3 7))) "Yet another calibre client" tar ((:commit . "a59e8ab65601e30073fa55bef76e95c964c678d8") (:authors ("Damon Chan" . "elecming@gmail.com")) (:maintainer "Damon Chan" . "elecming@gmail.com") (:keywords "tools") (:url . "https://github.com/chenyanming/calibredb.el"))]) + (call-graph . [(20220506 1214) ((emacs (25 1)) (hierarchy (0 7 0)) (tree-mode (1 0 0)) (ivy (0 10 0))) "Generate call graph for c/c++ functions" tar ((:commit . "42023e5d1781c75f425e8c72b63b28e53dae6e9c") (:authors ("Huming Chen" . "chenhuming@gmail.com")) (:maintainer "Huming Chen" . "chenhuming@gmail.com") (:keywords "programming" "convenience") (:url . "https://github.com/beacoder/call-graph"))]) + (calmer-forest-theme . [(20130926 510) nil "Darkish theme with green/orange tint" single ((:commit . "87ba7bae389084d13fe3bc34e0c923017eda6ba0") (:authors ("Artur Hefczyc, created 2003-04-18") ("David Caldwell" . "david@porkrind.org")) (:maintainer "Artur Hefczyc, created 2003-04-18") (:url . "https://github.com/caldwell/calmer-forest-theme"))]) + (camcorder . [(20190317 2138) ((emacs (24)) (names (20150000)) (cl-lib (0 5))) "Record screencasts in gif or other formats." single ((:commit . "b11ca61491a27681bb3131b72b51c105fd996bed") (:authors ("Artur Malabarba" . "bruce.connor.am@gmail.com")) (:maintainer "Artur Malabarba" . "bruce.connor.am@gmail.com") (:keywords "multimedia" "screencast") (:url . "http://github.com/Bruce-Connor/camcorder.el"))]) + (caml . [(20220503 1742) ((emacs (24 3))) "Caml mode for GNU Emacs" tar ((:commit . "f2f170f46b758341d96385986e8a93b9b4d248f1") (:authors ("Jacques Garrigue" . "garrigue@kurims.kyoto-u.ac.jp") ("Ian T Zimmerman" . "itz@rahul.net") ("Damien Doligez" . "damien.doligez@inria.fr")) (:maintainer "Christophe Troestler" . "Christophe.Troestler@umons.ac.be") (:keywords "ocaml") (:url . "https://github.com/ocaml/caml-mode"))]) + (cangjie . [(20211201 2307) ((emacs (24 4)) (s (1 12 0)) (dash (2 14 1)) (f (0 2 0))) "Retrieve cangjie code for han characters" tar ((:commit . "87408d79b73a69194842a8848de6d7708e98c3a4") (:keywords "convenience" "writing") (:url . "https://github.com/kisaragi-hiu/cangjie.el"))]) + (cape . [(20220506 1814) ((emacs (27 1))) "Completion At Point Extensions" tar ((:commit . "e72edf2d6357beb64798ef1894cc807190f80901") (:authors ("Daniel Mendler" . "mail@daniel-mendler.de")) (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") (:url . "https://github.com/minad/cape"))]) + (capnp-mode . [(20210707 2310) nil "Major mode for editing Capn' Proto Files" single ((:commit . "02dc92c900babbd232fbcdd14f7ccf44d234ee77") (:authors ("Brian Taylor" . "el.wubo@gmail.com")) (:maintainer "Brian Taylor" . "el.wubo@gmail.com") (:url . "https://github.com/capnproto/capnproto"))]) + (capture . [(20130828 1644) nil "screencasting with \"avconv\" or \"ffmpeg\"" tar ((:commit . "1bb26060311da76767f70096218313fc93b0c806") (:authors ("Sergey Pashinin ")) (:maintainer "Sergey Pashinin "))]) + (carbon-now-sh . [(20201028 950) ((emacs (24 4))) "https://carbon.now.sh integration." single ((:commit . "6444a77a6065803cf97c3321f811bd34a8063d76") (:authors ("Vitalii Elenhaupt")) (:maintainer "Vitalii Elenhaupt") (:keywords "convenience") (:url . "https://github.com/veelenga/carbon-now-sh.el"))]) + (cargo . [(20220311 827) ((emacs (24 3)) (markdown-mode (2 4))) "Emacs Minor Mode for Cargo, Rust's Package Manager." tar ((:commit . "8335b5577dfa526c645f7c1839c473f99b9ad1a8") (:authors ("Kevin W. van Rooijen")) (:maintainer "Kevin W. van Rooijen") (:keywords "tools"))]) + (cargo-mode . [(20210605 1003) ((emacs (25 1))) "Cargo Major Mode. Cargo is the Rust package manager" single ((:commit . "b98ea60ddec30eac174012671ee09e125748a193") (:authors ("Ayrat Badykov" . "ayratin555@gmail.com")) (:maintainer "Ayrat Badykov" . "ayratin555@gmail.com") (:keywords "tools") (:url . "https://github.com/ayrat555/cargo-mode"))]) + (caroline-theme . [(20160318 520) ((emacs (24))) "A trip down to New Orleans..." single ((:commit . "222fd483db304509f9e422dc82883d808e023ceb") (:authors ("Jack Killilea" . "jaaacckz1@gmail.com")) (:maintainer "Jack Killilea" . "jaaacckz1@gmail.com") (:url . "https://github.com/xjackk/carolines-theme"))]) + (cascading-dir-locals . [(20211013 1955) ((emacs (26 1))) "Apply all (!) .dir-locals.el from root to current directory" single ((:commit . "345d4b70e837d45ee84014684127e7399932d5e6") (:authors ("Fritz Grabo" . "hello@fritzgrabo.com")) (:maintainer "Fritz Grabo" . "hello@fritzgrabo.com") (:keywords "convenience") (:url . "https://github.com/fritzgrabo/cascading-dir-locals"))]) + (caseformat . [(20160115 1615) ((emacs (24)) (cl-lib (0 5)) (dash (2 12 1)) (s (1 10 0))) "Format based letter case converter" single ((:commit . "75ddb9c64eeb78b46d9e1db99bef8d0fb1e46b99") (:authors ("Hiroki YAMAKAWA" . "s06139@gmail.com")) (:maintainer "Hiroki YAMAKAWA" . "s06139@gmail.com") (:keywords "convenience") (:url . "https://github.com/HKey/caseformat"))]) + (cask . [(20220504 1421) ((emacs (24 5)) (s (1 8 0)) (f (0 16 0)) (epl (0 5)) (shut-up (0 1 0)) (cl-lib (0 3)) (package-build (0)) (ansi (0 4 1))) "Cask: Project management for package development" tar ((:commit . "2eb520e64c2e1047319761df0bcc6fa5149f8cd6") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "speed" "convenience") (:url . "http://github.com/cask/cask"))]) + (cask-mode . [(20160410 1449) ((emacs (24 3))) "major mode for editing Cask files" single ((:commit . "be8b69e55916cf2e78886927f58c7c49b969c0b8") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk"))]) + (cask-package-toolset . [(20170921 2256) ((emacs (24)) (cl-lib (0 3)) (s (1 6 1)) (dash (1 8 0)) (f (0 10 0)) (commander (0 2 0)) (ansi (0 1 0)) (shut-up (0 1 0))) "Toolsettize your package" tar ((:commit . "2c74cd827e88c7f8360581a841e45f0b794510e7") (:authors ("Adrien Becchis" . "adriean.khisbe@live.fr")) (:maintainer "Adrien Becchis" . "adriean.khisbe@live.fr") (:keywords "convenience" "tools") (:url . "http://github.com/AdrieanKhisbe/cask-package-toolset.el"))]) + (caskxy . [(20140513 1539) ((log4e (0 2 0)) (yaxception (0 1))) "Control Cask in Emacs" single ((:commit . "dc18dcab7ed526070ab76de071c9c5272e6ac40e") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "convenience") (:url . "https://github.com/aki2o/caskxy"))]) + (catmacs . [(20170826 1157) ((emacs (24))) "Simple CAT interface for Yaesu Transceivers." single ((:commit . "65d3e0563abe6ff9577202cf2278074d4130fbdd") (:authors ("Frank Singleton" . "b17flyboy@gmail.com")) (:maintainer "Frank Singleton" . "b17flyboy@gmail.com") (:keywords "comm" "hardware") (:url . "https://bitbucket.org/pymaximus/catmacs"))]) + (catppuccin-theme . [(20220330 1021) ((emacs (25 1))) "Catppuccin Theme" single ((:commit . "352ebf62099e95cb4a71060a7d4a228f00358b97") (:authors ("pspiagicw")) (:maintainer "pspiagicw" . "pspiagicw@gmail.com") (:url . "https://github.com/catppuccin/emacs"))]) + (cbm . [(20171116 1240) ((cl-lib (0 5))) "Switch to similar buffers." single ((:commit . "5b41c936ba9f6d170309a85ffebc9939c1050b31") (:authors ("Lukas Fürmetz" . "fuermetz@mailbox.org")) (:maintainer "Lukas Fürmetz" . "fuermetz@mailbox.org") (:keywords "buffers") (:url . "http://github.com/akermu/cbm.el"))]) + (cc-cedict . [(20210814 819) ((emacs (26 1))) "Interface to CC-CEDICT (a Chinese-English dictionary)" single ((:commit . "03fbe7d1589d36f627ef9fe7b86f9fe6f623cbb3") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:url . "https://github.com/xuchunyang/cc-cedict.el"))]) + (ccc . [(20210501 820) nil "buffer local cursor color control library" single ((:commit . "c664b26d0861621ac86b5b5f47835dd84f06dc93") (:authors ("Masatake YAMATO" . "masata-y@is.aist-nara.ac.jp")) (:maintainer "SKK Development Team") (:keywords "cursor") (:url . "https://github.com/skk-dev/ddskk"))]) + (ccls . [(20200820 308) ((emacs (25 1)) (lsp-mode (6 3 1)) (dash (2 14 1))) "ccls client for lsp-mode" tar ((:commit . "675a5704c14a27931e835a431beea3631d92e8e6") (:authors ("Tobias Pisani, Fangrui Song")) (:maintainer "Tobias Pisani, Fangrui Song") (:keywords "languages" "lsp" "c++") (:url . "https://github.com/MaskRay/emacs-ccls"))]) + (cd-compile . [(20141108 1957) nil "run compile in a specific directory" single ((:commit . "10284ccae86afda4a37b09ba90acd1e2efedec9f") (:authors ("Jamie Nicol" . "jamie@thenicols.net")) (:maintainer "Jamie Nicol" . "jamie@thenicols.net"))]) + (cdb . [(20200904 1431) nil "constant database (cdb) reader for Emacs Lisp" single ((:commit . "c664b26d0861621ac86b5b5f47835dd84f06dc93") (:authors ("Yusuke Shinyama ")) (:maintainer "SKK Development Team") (:keywords "cdb") (:url . "https://github.com/skk-dev/ddskk"))]) + (cdlatex . [(20210804 452) nil "Fast input methods for LaTeX environments and math" single ((:commit . "8e963c68531f75e459e8ebe7a34fd3ba9d3729a0") (:authors ("Carsten Dominik" . "carsten.dominik@gmail.com")) (:maintainer "Carsten Dominik" . "carsten.dominik@gmail.com") (:keywords "tex"))]) + (cdnjs . [(20161031 1522) ((dash (2 13 0)) (deferred (0 4)) (f (0 17 2)) (pkg-info (0 5))) "A front end for http://cdnjs.com" single ((:commit . "ce19880d3ec3d81e6c665d0b1dfea99cc7a3f908") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "tools") (:url . "https://github.com/yasuyk/cdnjs.el"))]) + (cedit . [(20200816 526) nil "paredit-like commands for c-like languages" single ((:commit . "cb38316903e6cfa8b8c978defa7e1dafcd4e0c12") (:authors ("zk_phi")) (:maintainer "zk_phi") (:url . "http://zk-phi.gitub.io/"))]) + (celery . [(20170225 924) ((emacs (24)) (dash-functional (2 11 0)) (s (1 9 0)) (deferred (0 3 2))) "a minor mode to draw stats from celery and more?" single ((:commit . "51197d74f5eaa8ae09144af7663a2f4277f07d16") (:authors ("ardumont" . "eniotna.t@gmail.com")) (:maintainer "ardumont" . "eniotna.t@gmail.com") (:keywords "celery" "convenience") (:url . "https://github.com/ardumont/emacs-celery"))]) + (celestial-mode-line . [(20180518 822) ((emacs (24))) "Show lunar phase and sunrise/-set time in modeline" single ((:commit . "3f5794aca99b977f1592cf1ab4516ae7922196a1") (:authors ("Peter" . "craven@gmx.net")) (:maintainer "Peter" . "craven@gmx.net") (:keywords "extensions") (:url . "https://github.com/ecraven/celestial-mode-line"))]) + (centaur-tabs . [(20220224 808) ((emacs (24 4)) (powerline (2 4)) (cl-lib (0 5))) "Aesthetic, modern looking customizable tabs plugin" tar ((:commit . "f4cef95acbd2eb99c8db3b6cdde74a6e0a966a0a") (:authors ("Emmanuel Bustos" . "ema2159@gmail.com")) (:maintainer "Emmanuel Bustos" . "ema2159@gmail.com") (:url . "https://github.com/ema2159/centaur-tabs"))]) + (centered-cursor-mode . [(20200507 1529) nil "cursor stays vertically centered" single ((:commit . "4093821cc9759ca5a3c6e527d4cc915fc3a5ad74") (:authors ("André Riemann" . "andre.riemann@web.de")) (:maintainer "André Riemann" . "andre.riemann@web.de") (:keywords "convenience") (:url . "https://github.com/andre-r/centered-cursor-mode.el"))]) + (centered-window . [(20220125 804) ((emacs (24 4))) "Center the text when there's only one window" single ((:commit . "80965f6c6afe8d918481433984b493de72af5399") (:authors ("Anler Hernández Peral" . "inbox+emacs@anler.me")) (:maintainer "Anler Hernández Peral" . "inbox+emacs@anler.me") (:keywords "faces" "windows") (:url . "https://github.com/anler/centered-window-mode"))]) + (centimacro . [(20201225 1132) nil "Assign multiple macros as global key bindings" single ((:commit . "0149877584b333c4f1953f0767f0cae23881b0df") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "macros") (:url . "https://github.com/abo-abo/centimacro"))]) + (cerbere . [(20181113 1641) ((pkg-info (0 5))) "Unit testing in Emacs for several programming languages" tar ((:commit . "c667c165d9c1657f13d2d46f09ba21b61f9402cc") (:authors ("Nicolas Lamirault" . "nicolas.lamirault@gmail.com")) (:maintainer "Nicolas Lamirault" . "nicolas.lamirault@gmail.com") (:keywords "python" "go" "php" "phpunit" "elisp" "ert" "tests" "tdd") (:url . "https://github.com/nlamirault/cerbere"))]) + (ceylon-mode . [(20180606 1324) ((emacs (25))) "Major mode for editing Ceylon source code" single ((:commit . "948515672bc596dc118e8e3ede3ede5ec6a3c95a") (:authors ("Lucas Werkmeister" . "mail@lucaswerkmeister.de")) (:maintainer "Lucas Werkmeister" . "mail@lucaswerkmeister.de") (:keywords "languages" "ceylon") (:url . "https://github.com/lucaswerkmeister/ceylon-mode"))]) + (cfengine-code-style . [(20171115 2108) nil "C code style for CFEngine project." single ((:commit . "0d98e5a6f0c08e2b1d2c8e96c3dfc7e619210f72") (:authors ("Mikhail Gusarov" . "mikhail.gusarov@cfengine.com")) (:maintainer "Mikhail Gusarov" . "mikhail.gusarov@cfengine.com") (:url . "https://github.com/cfengine/core"))]) + (cff . [(20160118 2018) ((cl-lib (0 5)) (emacs (24))) "Search of the C/C++ file header by the source and vice versa" single ((:commit . "b6ab2a28e64ef06f281ec74cfe3114e450644dfa") (:authors ("Alexey Veretennikov" . "alexey.veretennikov@gmail.com")) (:maintainer "Alexey Veretennikov" . "alexey.veretennikov@gmail.com") (:keywords "find-file") (:url . "https://github.com/fourier/cff"))]) + (cfml-mode . [(20190617 1130) ((emacs (25))) "Emacs mode for editing CFML files" single ((:commit . "2de315abddb6af088a2346e142cc305889dcd775") (:authors ("Andrew Myers" . "am2605@gmail.com")) (:maintainer "Andrew Myers" . "am2605@gmail.com") (:url . "https://github.com/am2605/cfml-mode"))]) + (cfn-mode . [(20220221 1029) ((emacs (26 0)) (f (0 20 0)) (s (1 12 0)) (yaml-mode (0 0 13))) "AWS cloudformation mode" tar ((:commit . "4cf56affe3035fda364109836e26499431095185") (:authors ("William Orr" . "will@worrbase.com")) (:maintainer "William Orr" . "will@worrbase.com") (:keywords "convenience" "languages" "tools") (:url . "https://gitlab.com/worr/cfn-mode"))]) + (cframe . [(20201222 1930) ((emacs (26)) (buffer-manage (0 11)) (dash (2 17 0))) "Customize a frame and fast switch size and positions" single ((:commit . "38544521e82befc06e397123a118dd96dda2c6b6") (:authors ("Paul Landes")) (:maintainer "Paul Landes") (:keywords "frames") (:url . "https://github.com/plandes/cframe"))]) + (cfrs . [(20220129 1149) ((emacs (26 1)) (dash (2 11 0)) (s (1 10 0)) (posframe (0 6 0))) "Child-frame based read-string" single ((:commit . "f3a21f237b2a54e6b9f8a420a9da42b4f0a63121") (:authors ("Alexander Miller" . "alexanderm@web.de")) (:maintainer "Alexander Miller" . "alexanderm@web.de") (:url . "https://github.com/Alexander-Miller/cfrs"))]) + (cg . [(20220318 1007) ((emacs (26 1))) "Major mode for editing Constraint Grammar files" single ((:commit . "06011b53bf64d671c74a79757332b9ef13f47f2b") (:authors ("Kevin Brubeck Unhammer" . "unhammer@fsfe.org")) (:maintainer "Kevin Brubeck Unhammer" . "unhammer@fsfe.org") (:keywords "languages") (:url . "https://visl.sdu.dk/constraint_grammar.html"))]) + (challenger-deep-theme . [(20210120 941) ((emacs (24))) "challenger-deep Theme" single ((:commit . "2a799259406a8b96a688873093ffab6630a3ad3b") (:authors ("MaxSt")) (:maintainer "MaxSt") (:url . "https://github.com/challenger-deep-theme/emacs"))]) + (change-inner . [(20210126 1456) ((expand-region (0 7))) "Change contents based on semantic units" single ((:commit . "42cad58aed2caec260f8e8ff61f78a7d3db72d1b") (:authors ("Magnar Sveen" . "magnars@gmail.com")) (:maintainer "Magnar Sveen" . "magnars@gmail.com") (:keywords "convenience" "extensions"))]) + (chapel-mode . [(20210513 457) ((emacs (25 1)) (hydra (0 15 0))) "A major mode for the Chapel programming language" single ((:commit . "39fd24bb7cf44808200354ac0496be4fc4fddd9a") (:keywords "chapel" "chpl" "programming" "languages") (:url . "https://github.com/damon-kwok/chapel-mode"))]) + (char-menu . [(20210321 1657) ((emacs (24 3)) (avy-menu (0 1))) "Create your own menu for fast insertion of arbitrary symbols" single ((:commit . "16e9ce0380a7661c6dae9ccec1172fe4757df682") (:authors ("Mark Karpov" . "markkarpov92@gmail.com")) (:maintainer "Mark Karpov" . "markkarpov92@gmail.com") (:keywords "convenience" "editing") (:url . "https://github.com/mrkkrp/char-menu"))]) + (charmap . [(20200616 1418) nil "Unicode table for Emacs" single ((:commit . "a810347b43b024a86167ab9be935dcf56c122743") (:authors ("Anan Mikami" . "lateau@gmail.com")) (:maintainer "Anan Mikami" . "lateau@gmail.com") (:keywords "unicode" "character" "ucs") (:url . "https://github.com/lateau/charmap"))]) + (chatwork . [(20170511 442) nil "ChatWork client for Emacs" single ((:commit . "fea231d479f06bf40dbfcf45de143eecc9ed744c") (:authors ("Masayuki Ataka" . "masayuki.ataka@gmail.com")) (:maintainer "Masayuki Ataka" . "masayuki.ataka@gmail.com") (:keywords "web") (:url . "https://github.com/ataka/chatwork"))]) + (cheat-sh . [(20210607 1307) ((emacs (25 1))) "Interact with cheat.sh" single ((:commit . "33bae22feae8d3375739c6bdef08d0dcdf47ee42") (:authors ("Dave Pearson" . "davep@davep.org")) (:maintainer "Dave Pearson" . "davep@davep.org") (:keywords "docs" "help") (:url . "https://github.com/davep/cheat-sh.el"))]) + (cheatsheet . [(20170126 2150) ((emacs (24)) (cl-lib (0 5))) "create your own cheatsheet" single ((:commit . "e4f8e0110167ea16a17a74517d1f10cb7ff805b8") (:authors ("Shirin Nikita" . "shirin.nikita@gmail.com")) (:maintainer "Shirin Nikita" . "shirin.nikita@gmail.com") (:keywords "convenience" "usability") (:url . "http://github.com/darksmile/cheatsheet/"))]) + (checkbox . [(20141117 58) ((emacs (24)) (cl-lib (0 5))) "Quick manipulation of textual checkboxes" single ((:commit . "335afa4404adf72973195a580458927004664d98") (:authors ("Cameron Desautels" . "camdez@gmail.com")) (:maintainer "Cameron Desautels" . "camdez@gmail.com") (:keywords "convenience") (:url . "http://github.com/camdez/checkbox.el"))]) + (chee . [(20171123 2233) ((dash (2 12 1)) (s (1 10 0)) (f (0 18 2))) "Interface to chee using dired and image-dired" tar ((:commit . "669ff9ee429f24c3c2d03b83d9cb9aec5f86bb8b") (:url . "https://github.com/eikek/chee/tree/release/0.3.0/emacs"))]) + (cheerilee . [(20160313 1835) ((xelb (0 1))) "Toolkit library" tar ((:commit . "41bd81b5b0bb657241ceda5be6af5e07254d7376") (:authors ("Alessio Vanni" . "vannilla@firemail.cc")) (:maintainer "Alessio Vanni" . "vannilla@firemail.cc") (:keywords "multimedia" "tools") (:url . "https://github.com/Vannil/cheerilee.el"))]) + (chef-mode . [(20180628 1453) nil "minor mode for editing an opscode chef repository" single ((:commit . "048d691cb63981ae235763d4a6ced4af5c729924") (:authors ("Maciej Pasternacki" . "maciej@pasternacki.net")) (:maintainer "Maciej Pasternacki" . "maciej@pasternacki.net") (:keywords "chef" "knife"))]) + (chembalance . [(20210601 1653) ((emacs (24 4))) "Balance chemical equations" single ((:commit . "ae36c823ca151f1dc6144ec96b2f5e98181c0dbb") (:authors ("Sergi Ruiz Trepat")) (:maintainer "Sergi Ruiz Trepat") (:keywords "convenience" "chemistry") (:url . "https://github.com/sergiruiztrepat/chembalance"))]) + (chemtable . [(20210713 1551) ((emacs (24 1))) "Periodic table of the elements" single ((:commit . "05fc1449db497e715b33b8e08359fa17c3148c7b") (:authors ("Sergi Ruiz Trepat")) (:maintainer "Sergi Ruiz Trepat") (:keywords "convenience" "chemistry") (:url . "https://github.com/sergiruiztrepat/chemtable"))]) + (cherry-blossom-theme . [(20150622 342) ((emacs (24 0))) "a soothing color theme for Emacs24." single ((:commit . "eea7653e00f35973857ee23b27bc2fae5e753e50") (:authors ("Ben Yelsey" . "byelsey1@gmail.com")) (:maintainer "Ben Yelsey" . "byelsey1@gmail.com") (:url . "https://github.com/inlinestyle/emacs-cherry-blossom-theme"))]) + (chezmoi . [(20220310 2014) ((emacs (26 1))) "A package for interacting with chezmoi" tar ((:commit . "781783c483bc8fcdba3a230bb774c3a8a5ebe396") (:authors ("Harrison Pielke-Lombardo")) (:maintainer "Harrison Pielke-Lombardo") (:keywords "vc") (:url . "http://www.github.com/tuh8888/chezmoi.el"))]) + (chinese-conv . [(20170807 2128) ((cl-lib (0 5))) "Conversion between Chinese Characters with opencc or cconv" single ((:commit . "b56815bbb163d642e97fa73093b5a7e87cc32574") (:authors ("gucong" . "gucong43216@gmail.com")) (:maintainer "gucong" . "gucong43216@gmail.com") (:url . "https://github.com/gucong/emacs-chinese-conv"))]) + (chinese-number . [(20161008 509) nil "Convert numbers between Arabic and Chinese formats" single ((:commit . "7311c2a0c5eea5f016a90d733dfe75144c302fb2") (:authors (nil . "zhcosin")) (:maintainer nil . "zhcosin") (:url . "https://github.com/zhcosin/chinese-number"))]) + (chinese-wbim . [(20190727 854) nil "Enable Wubi Input Method in Emacs." tar ((:commit . "5d496364b0b6bbaaf0f9b37e5a6d260d4994f260") (:authors (nil . "Guanghui Qu")) (:maintainer nil . "Guanghui Qu") (:keywords "wubi" "input" "method.") (:url . "https://github.com/andyque/chinese-wbim"))]) + (chinese-word-at-point . [(20170811 941) ((cl-lib (0 5))) "Add `chinese-word' thing to `thing-at-point'" single ((:commit . "8223d7439e005555b86995a005b225ae042f0538") (:authors ("Chunyang Xu" . "xuchunyang56@gmail.com")) (:maintainer "Chunyang Xu" . "xuchunyang56@gmail.com") (:keywords "convenience" "chinese") (:url . "https://github.com/xuchunyang/chinese-word-at-point.el"))]) + (chinese-yasdcv . [(20171015 144) ((cl-lib (0 5)) (pyim (1 6 0))) "Yet another StarDict frontend" tar ((:commit . "5ab830daf1273d5a5cddcb94b56a9737f12d996f") (:authors ("Feng Shu" . "tumashu@gmail.com")) (:maintainer "Feng Shu" . "tumashu@gmail.com") (:keywords "convenience" "chinese" "dictionary") (:url . "https://github.com/tumashu/chinese-yasdcv"))]) + (chocolate-theme . [(20210128 1647) ((emacs (24 1)) (autothemer (0 2))) "A dark chocolaty theme" single ((:commit . "ccc05f7ad96d3d1332727689bf6250443adc7ec0") (:url . "http://github.com/SavchenkoValeriy/emacs-chocolate-theme"))]) + (choice-program . [(20201217 1751) ((emacs (26)) (dash (2 17 0))) "Parameter based program" tar ((:commit . "b8b1b6c5568f8778783454d5747912487c8e69b8") (:authors ("Paul Landes")) (:maintainer "Paul Landes") (:keywords "execution" "processes" "unix" "lisp") (:url . "https://github.com/plandes/choice-program"))]) + (chronometer . [(20190304 1528) ((emacs (24))) "a [not so] simple chronometer" single ((:commit . "8457b296ef87be339cbe47730b922757d60bdcd5") (:authors ("Marcelo Toledo" . "marcelo@marcelotoledo.com")) (:maintainer "Marcelo Toledo" . "marcelo@marcelotoledo.com") (:keywords "tools" "convenience") (:url . "https://github.com/marcelotoledo/chronometer"))]) + (chronometrist . [(20220415 1213) ((emacs (27 1)) (dash (2 16 0)) (seq (2 20)) (ts (0 2))) "Friendly and powerful personal time tracker and analyzer" tar ((:commit . "f7b2defceed8bafb87da704ce3e7774f53abf1c4") (:authors ("contrapunctus" . "xmpp:contrapunctus@jabjab.de")) (:maintainer "contrapunctus" . "xmpp:contrapunctus@jabjab.de") (:keywords "calendar") (:url . "https://tildegit.org/contrapunctus/chronometrist"))]) + (chronometrist-goal . [(20210510 1831) ((emacs (25 1)) (alert (1 2)) (chronometrist (0 7 0))) "Adds support for time goals to Chronometrist" single ((:commit . "6cb939d160f5d5966d7853aa23f3ed7c7ef9df44") (:authors ("contrapunctus" . "xmpp:contrapunctus@jabber.fr")) (:maintainer "contrapunctus" . "xmpp:contrapunctus@jabber.fr") (:keywords "calendar") (:url . "https://tildegit.org/contrapunctus/chronometrist-goal"))]) + (chronometrist-key-values . [(20220414 726) ((chronometrist (0 7 0))) "add key-values to Chronometrist data" tar ((:commit . "f7b2defceed8bafb87da704ce3e7774f53abf1c4") (:authors ("contrapunctus" . "xmpp:contrapunctus@jabjab.de")) (:maintainer "contrapunctus" . "xmpp:contrapunctus@jabjab.de") (:keywords "calendar") (:url . "https://tildegit.org/contrapunctus/chronometrist"))]) + (chronometrist-spark . [(20220321 349) ((emacs (25 1)) (chronometrist (0 7 0)) (spark (0 1))) "Show sparklines in Chronometrist buffers" tar ((:commit . "f7b2defceed8bafb87da704ce3e7774f53abf1c4") (:authors ("contrapunctus" . "xmpp:contrapunctus@jabjab.de")) (:maintainer "contrapunctus" . "xmpp:contrapunctus@jabjab.de") (:keywords "calendar") (:url . "https://tildegit.org/contrapunctus/chronometrist"))]) + (chronos . [(20150602 1529) nil "multiple simultaneous countdown / countup timers" tar ((:commit . "b360d9dae57aa553cf2a14ffa0756a51ad71de09") (:authors ("David Knight" . "dxknight@opmbx.org")) (:maintainer "David Knight" . "dxknight@opmbx.org") (:keywords "calendar") (:url . "http://github.com/dxknight/chronos"))]) + (chruby . [(20180114 1652) ((cl-lib (0 5))) "Emacs integration for chruby" single ((:commit . "42bc6d521f832eca8e2ba210f30d03ad5529788f") (:authors ("Arne Brasseur" . "arne@arnebrasseur.net")) (:maintainer "Arne Brasseur" . "arne@arnebrasseur.net") (:keywords "languages") (:url . "https://github.com/plexus/chruby.el"))]) + (chyla-theme . [(20180302 1658) nil "chyla.org - green color theme." single ((:commit . "ae5e7ecace2ab474151eb0ac5ef07fba2dc32f8a") (:authors ("Adam Chyła" . "adam@chyla.org")) (:maintainer "Adam Chyła" . "adam@chyla.org") (:url . "https://github.com/chyla/ChylaThemeForEmacs"))]) + (cider . [(20220507 1357) ((emacs (26)) (clojure-mode (5 14)) (parseedn (1 0 6)) (queue (0 2)) (spinner (1 7)) (seq (2 22)) (sesman (0 3 2))) "Clojure Interactive Development Environment that Rocks" tar ((:commit . "69d374818bd0af1489ee8828b258c689ccc24a66") (:authors ("Tim King" . "kingtim@gmail.com") ("Phil Hagelberg" . "technomancy@gmail.com") ("Bozhidar Batsov" . "bozhidar@batsov.dev") ("Artur Malabarba" . "bruce.connor.am@gmail.com") ("Hugo Duncan" . "hugo@hugoduncan.org") ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Bozhidar Batsov" . "bozhidar@batsov.dev") (:keywords "languages" "clojure" "cider") (:url . "http://www.github.com/clojure-emacs/cider"))]) + (cider-decompile . [(20151122 537) ((cider (0 3 0)) (javap-mode (9))) "decompilation extension for cider" single ((:commit . "5d87035f3c3c14025e8f01c0c53d0ce2c8f56651") (:authors ("Dmitry Bushenko")) (:maintainer "Dmitry Bushenko") (:keywords "languages" "clojure" "cider") (:url . "http://www.github.com/clojure-emacs/cider-decompile"))]) + (cider-eval-sexp-fu . [(20190311 2152) ((emacs (24)) (eval-sexp-fu (0 5 0))) "Briefly highlights an evaluated sexp." single ((:commit . "7fd229f1441356866aedba611fd0cf4e89b50921") (:authors ("Sylvain Benner" . "sylvain.benner@gmail.com")) (:maintainer "Sylvain Benner" . "sylvain.benner@gmail.com") (:keywords "languages" "clojure" "cider"))]) + (cider-hydra . [(20190816 1121) ((cider (0 22 0)) (hydra (0 13 0))) "Hydras for CIDER." single ((:commit . "c3b8a15d72dddfbc390ab6a454bd7e4c765a2c95") (:authors ("Tianxiang Xiong" . "tianxiang.xiong@gmail.com")) (:maintainer "Tianxiang Xiong" . "tianxiang.xiong@gmail.com") (:keywords "convenience" "tools") (:url . "https://github.com/clojure-emacs/cider-hydra"))]) + (ciel . [(20180914 815) ((emacs (24))) "A command that is clone of \"ci\" in vim." single ((:commit . "429773a3c551691a463ecfddd634b8bae2f48503") (:authors ("Takuma Matsushita" . "cs14095@gmail.com")) (:maintainer "Takuma Matsushita" . "cs14095@gmail.com") (:keywords "convinience") (:url . "https://github.com/cs14095/ciel.el"))]) + (cil-mode . [(20160622 1430) nil "Common Intermediate Language mode" single ((:commit . "a78a88ca9a66a82f069329a96e34b67478ae2d9b") (:authors ("Friedrich von Never" . "friedrich@fornever.me")) (:maintainer "Friedrich von Never" . "friedrich@fornever.me") (:keywords "languages") (:url . "https://github.com/ForNeVeR/cil-mode"))]) + (cilk-mode . [(20220411 1342) ((emacs (25 1)) (flycheck (32 -4))) "Minor mode for Cilk code editing" single ((:commit . "794821e129ea47b04fdeedc61d9ccb3c4240c72d") (:authors ("Alexandros-Stavros Iliopoulos ")) (:maintainer "Alexandros-Stavros Iliopoulos" . "1577182+ailiop@users.noreply.github.com") (:keywords "c" "convenience" "faces" "languages") (:url . "https://github.com/ailiop/cilk-mode"))]) + (cinspect . [(20150716 233) ((emacs (24)) (cl-lib (0 5)) (deferred (0 3 1)) (python-environment (0 0 2))) "Use cinspect to look at the CPython source of builtins and other C objects!" single ((:commit . "4e199a90f89b335cccda1518aa0963e0a1d4fbab") (:authors ("Ben Yelsey" . "ben.yelsey@gmail.com")) (:maintainer "Ben Yelsey" . "ben.yelsey@gmail.com") (:keywords "python") (:url . "https://github.com/inlinestyle/cinspect-mode"))]) + (circadian . [(20181024 1256) ((emacs (24 4))) "Theme-switching based on daytime" single ((:commit . "bf5a00ea45c14dfdcda72c5d9f61bcd230c48159") (:authors ("Guido Schmidt")) (:maintainer "Guido Schmidt" . "git@guidoschmidt.cc") (:keywords "themes") (:url . "https://github.com/GuidoSchmidt/circadian"))]) + (circe . [(20220421 1956) ((emacs (24 5)) (cl-lib (0 5))) "Client for IRC in Emacs" tar ((:commit . "710f057fedae6e9b820cce9336fef24b7d057e4c") (:authors ("Jorgen Schaefer" . "forcer@forcix.cx")) (:maintainer "Jorgen Schaefer" . "forcer@forcix.cx") (:keywords "irc" "chat" "comm") (:url . "https://github.com/emacs-circe/circe"))]) + (circe-notifications . [(20180102 2318) ((emacs (24 4)) (circe (2 3)) (alert (1 2))) "Add desktop notifications to Circe." single ((:commit . "291149ac12877bbd062da993479d3533a26862b0") (:authors ("Ruben Maher" . "r@rkm.id.au")) (:maintainer "Ruben Maher" . "r@rkm.id.au") (:url . "https://github.com/eqyiel/circe-notifications"))]) + (circleci-api . [(20210227 1607) ((emacs (27)) (request (0 3 2))) "Bindings for the CircleCI API" single ((:commit . "2e39c5896819bb2063f9d7795c4299f419cf5542") (:authors ("Robin Schroer")) (:maintainer "Robin Schroer") (:url . "https://github.com/sulami/circleci-api"))]) + (citar . [(20220509 2336) ((emacs (27 1)) (parsebib (3 0)) (org (9 5)) (citeproc (0 9))) "Citation-related commands for org, latex, markdown" tar ((:commit . "9a6fc6da11ad2b475244cc4cbd51c77615e9aad3") (:authors ("Bruce D'Arcus ")) (:maintainer "Bruce D'Arcus ") (:url . "https://github.com/bdarcus/citar"))]) + (citeproc . [(20220124 721) ((emacs (25)) (dash (2 13 0)) (s (1 12 0)) (f (0 18 0)) (queue (0 2)) (string-inflection (1 0)) (org (9)) (parsebib (2 4))) "A CSL 1.0.2 Citation Processor" tar ((:commit . "ba49516265fa24b138346c4918d39d19b4de8a62") (:authors ("András Simonyi" . "andras.simonyi@gmail.com")) (:maintainer "András Simonyi" . "andras.simonyi@gmail.com") (:keywords "bib") (:url . "https://github.com/andras-simonyi/citeproc-el"))]) + (citeproc-org . [(20200915 2009) ((emacs (25 1)) (dash (2 12 0)) (org (9)) (f (0 18 0)) (citeproc (0 1)) (org-ref (1 1 1))) "Render org-mode references in CSL styles" tar ((:commit . "20cd7e817420a3f6e7b82faea901a3c67c6d4d9f") (:authors ("András Simonyi" . "andras.simonyi@gmail.com")) (:maintainer "András Simonyi" . "andras.simonyi@gmail.com") (:keywords "org-ref" "org-mode" "cite" "bib") (:url . "https://github.com/andras-simonyi/citeproc-org"))]) + (citre . [(20220427 1203) ((emacs (26 1))) "Ctags IDE on the True Editor" tar ((:commit . "87e2cbf3b2ae6d59ec919a2dcb38e56ccfa5ec14") (:authors ("Hao Wang" . "amaikinono@gmail.com")) (:maintainer "Hao Wang" . "amaikinono@gmail.com") (:keywords "convenience" "tools") (:url . "https://github.com/universal-ctags/citre"))]) + (cl-format . [(20210831 530) nil "CL format routine." tar ((:commit . "ad1a4fb6bc91e65ea90bcf6792cc5a1be5380f9d") (:authors ("Andreas Politz" . "politza@fh-trier.de")) (:maintainer "akater" . "nuclearspace@gmail.com") (:keywords "extensions") (:url . "https://gitlab.com/akater/elisp-cl-format"))]) + (cl-libify . [(20181130 230) ((emacs (25))) "Update elisp code to use cl-lib instead of cl" single ((:commit . "f215866d7d7c52e84220cd541f40608a5b85abf0") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "lisp") (:url . "https://github.com/purcell/cl-libify"))]) + (clang-capf . [(20220122 1219) ((emacs (24 4))) "Completion-at-point backend for c/c++ using clang" single ((:commit . "b1765719288a138e125cc5ce624ef561c80015bf") (:authors ("Philip K. ")) (:maintainer "Philip K. ") (:keywords "c" "abbrev" "convenience") (:url . "https://git.sr.ht/~pkal/clang-capf"))]) + (clang-format . [(20191106 950) ((cl-lib (0 3))) "Format code using clang-format" single ((:commit . "e48ff8ae18dc7ab6118c1f6752deb48cb1fc83ac") (:keywords "tools" "c"))]) + (clang-format+ . [(20190824 2216) ((emacs (25 1)) (clang-format (20180406 1514))) "Minor mode for automatic clang-format application" single ((:commit . "ddd4bfe1a13c2fd494ce339a320a51124c1d2f68") (:keywords "c" "c++" "clang-format") (:url . "https://github.com/SavchenkoValeriy/emacs-clang-format-plus"))]) + (clean-aindent-mode . [(20171017 2043) nil "Simple indent and unindent, trims indent white-space" single ((:commit . "a97bcae8f43a9ff64e95473e4ef0d8bafe829211") (:authors ("peter marinov" . "efravia@gmail.com")) (:maintainer "peter marinov" . "efravia@gmail.com") (:keywords "indentation" "whitespace" "backspace") (:url . "https://github.com/pmarinov/clean-aindent-mode"))]) + (clean-buffers . [(20160529 2259) ((cl-lib (0 5))) "clean useless buffers" single ((:commit . "1be6c54e3095761b6b64bf749faae3dfce94e72a") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "convenience" "usability" "buffers"))]) + (clear-text . [(20160406 2043) nil "Make you use clear text" tar ((:commit . "b50669b6077d6948f72cb3c649281d206e0c2f2b") (:authors ("Chunyang Xu" . "xuchunyang56@gmail.com")) (:maintainer "Chunyang Xu" . "xuchunyang56@gmail.com") (:keywords "convenience") (:url . "https://github.com/xuchunyang/clear-text.el"))]) + (clevercss . [(20131229 155) nil "A major mode for editing CleverCSS files" single ((:commit . "b8a3c0dd674367c62b1a1ffec84d88fe0c0219bc") (:authors ("Joe Schafer" . "joesmoe10@gmail.com")) (:maintainer "Joe Schafer" . "joesmoe10@gmail.com") (:keywords "languages" "css"))]) + (clhs . [(20210428 1911) nil "Access the Common Lisp HyperSpec (CLHS)" single ((:commit . "7b106c4fb5a6388ab753f94740f6dfadcdeedcbb") (:maintainer "Sam Steingold" . "sds@gnu.org") (:keywords "lisp" "common lisp" "emacs" "ansi cl" "hyperspec") (:url . "https://gitlab.com/sam-s/clhs"))]) + (click-mode . [(20180611 44) ((emacs (24))) "Major mode for the Click Modular Router Project" single ((:commit . "b94ea8cce89cf0e753b2ab915202d49ffc470fb6") (:authors ("Brian Malehorn" . "bmalehorn@gmail.com")) (:maintainer "Brian Malehorn" . "bmalehorn@gmail.com") (:keywords "click" "router") (:url . "https://github.com/bmalehorn/click-mode"))]) + (clingo-mode . [(20220502 2020) ((emacs (24 3))) "A major mode for editing Answer Set Programs" single ((:commit . "cf56ce6b5c50506f6cea27e1dde0441dd8d15ee9") (:authors ("Ivan Uemlianin" . "ivan@llaisdy.com")) (:maintainer "Ivan Uemlianin" . "ivan@llaisdy.com") (:keywords "asp" "clingo" "answer set programs" "potassco" "major mode" "languages") (:url . "https://github.com/llaisdy/clingo-mode"))]) + (clipetty . [(20200327 2241) ((emacs (25 1))) "Send every kill from a TTY frame to the system clipboard" single ((:commit . "01b39044b9b65fa4ea7d3166f8b1ffab6f740362") (:authors ("Mike Hamrick" . "mikeh@muppetlabs.com")) (:maintainer "Mike Hamrick" . "mikeh@muppetlabs.com") (:keywords "terminals" "convenience") (:url . "https://github.com/spudlyo/clipetty"))]) + (cliphist . [(20210813 750) ((emacs (25 1))) "paste from clipboard managers" tar ((:commit . "a794c95e2f70a9b042af7bd07e2483fde75f2a2e") (:authors ("Chen Bin ")) (:maintainer "Chen Bin ") (:keywords "clipboard" "manager" "history") (:url . "http://github.com/redguardtoo/cliphist"))]) + (clipmon . [(20180129 1054) nil "Clipboard monitor - watch system clipboard, add changes to kill ring/autoinsert" tar ((:commit . "95dc56c7ed84a654ec90f4740eb6df1050de8cf1") (:authors ("Brian Burns" . "bburns.km@gmail.com")) (:maintainer "Brian Burns" . "bburns.km@gmail.com") (:keywords "convenience") (:url . "https://github.com/bburns/clipmon"))]) + (clippy . [(20161028 1954) ((pos-tip (1 0))) "Show tooltip with function documentation at point" single ((:commit . "e77f6b63e54d74e243be98accad474e38f7e2a86") (:authors ("Matus Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matus Goljer" . "matus.goljer@gmail.com") (:keywords "docs") (:url . "https://github.com/Fuco1/clippy.el"))]) + (clips-mode . [(20170909 823) nil "Major mode for editing CLIPS code and REPL" tar ((:commit . "dd38e2822640a38f7d8bfec4f69d8dd24be27074") (:authors ("David E. Young" . "david.young@fnc.fujitsu.com") ("Andrey Kotlarski" . "m00naticus@gmail.com") ("Grant Rettke" . "grettke@acm.org")) (:maintainer "Grant Rettke" . "grettke@acm.org") (:keywords "clips"))]) + (clj-decompiler . [(20220103 1746) ((emacs (26 1)) (clojure-mode (5 12)) (cider (1 2 0))) "Clojure Java decompiler expansion" single ((:commit . "8c0c53f87e6e33f2be7e7aff6095eb586b50be1a") (:authors ("Ben Sless" . "ben.sless@gmail.com")) (:maintainer "Ben Sless" . "ben.sless@gmail.com") (:keywords "languages" "clojure" "cider" "java" "decompiler") (:url . "https://www.github.com/bsless/clj-decompiler.el"))]) + (clj-deps-new . [(20220221 2235) ((emacs (25 1)) (transient (0 3 7))) "Create clojure projects from templates" single ((:commit . "183089e6d4ded90efff491916e1c87411ead0461") (:authors ("jpe90" . "eskinjp@gmail.com")) (:maintainer "jpe90" . "eskinjp@gmail.com") (:url . "https://github.com/jpe90/emacs-deps-new"))]) + (clj-refactor . [(20220315 2251) ((emacs (26 1)) (seq (2 19)) (yasnippet (0 6 1)) (paredit (24)) (multiple-cursors (1 2 2)) (clojure-mode (5 14)) (cider (1 3)) (parseedn (1 0 6)) (inflections (2 3)) (hydra (0 13 2))) "A collection of commands for refactoring Clojure code" tar ((:commit . "f368c56c83843396b160440f472a661a3b639862") (:authors ("Magnar Sveen" . "magnars@gmail.com") ("Lars Andersen" . "expez@expez.com") ("Benedek Fazekas" . "benedek.fazekas@gmail.com") ("Bozhidar Batsov" . "bozhidar@batsov.dev")) (:maintainer "Magnar Sveen" . "magnars@gmail.com") (:keywords "convenience" "clojure" "cider"))]) + (cljr-helm . [(20160913 828) ((clj-refactor (0 13 0)) (helm-core (1 7 7)) (cl-lib (0 5))) "Wraps clojure refactor commands with helm" single ((:commit . "f2fc7b698a56e4a44d5dfbc6a55d77a93c0fa9a4") (:authors ("Phil Jackson" . "phil@shellarchive.co.uk")) (:maintainer "Phil Jackson" . "phil@shellarchive.co.uk") (:keywords "helm" "clojure" "refactor") (:url . "https://github.com/philjackson/cljr-helm"))]) + (cljr-ivy . [(20200602 1607) ((clj-refactor (2 5 0)) (ivy (0 13 0)) (emacs (24 3)) (cl-lib (0 6 1))) "Access clojure refactor with ivy completion" single ((:commit . "921ba65d0db7cda4edcd690c708946125b874a70") (:authors ("Wanderson Ferreira" . "iagwanderson@gmail.com")) (:maintainer "Wanderson Ferreira" . "iagwanderson@gmail.com") (:keywords "convenience" "matching") (:url . "https://github.com/wandersoncferreira/cljr-ivy"))]) + (cljsbuild-mode . [(20160402 1700) nil "A minor mode for the ClojureScript 'lein cljsbuild' command" single ((:commit . "fa2315660cb3ce944b5e16c679dcf5afd6a97f4c") (:keywords "clojure" "clojurescript" "leiningen" "compilation") (:url . "http://github.com/kototama/cljsbuild-mode"))]) + (clmemo . [(20220204 1345) nil "Change Log MEMO" tar ((:commit . "f695c38c551f72f6ac5e1a82badc540c80d3b33b") (:authors ("Masayuki Ataka" . "masayuki.ataka@gmail.com")) (:maintainer "Masayuki Ataka" . "masayuki.ataka@gmail.com") (:keywords "convenience") (:url . "https://github.com/ataka/clmemo"))]) + (cloc . [(20170728 1824) ((cl-lib (0 5))) "count lines of code over emacs buffers" single ((:commit . "f30f0472e465cc8d433d2473e9d3b8dfe2c94491") (:authors ("Danny McClanahan" . "danieldmcclanahan@gmail.com")) (:maintainer "Danny McClanahan" . "danieldmcclanahan@gmail.com") (:keywords "cloc" "count" "source" "code" "lines") (:url . "https://github.com/cosmicexplorer/cloc-emacs"))]) + (clocker . [(20190214 1833) ((projectile (0 11 0)) (dash (2 10)) (spaceline (2 0 1))) "Note taker and clock-in enforcer" single ((:commit . "c4d76968a49287ce3bac0832bb5d5d076054c96f") (:authors ("Roman Gonzalez" . "romanandreg@gmail.com")) (:maintainer "Roman Gonzalez" . "romanandreg@gmail.com") (:keywords "org"))]) + (clojars . [(20180825 1951) ((request-deferred (0 2 0))) "clojars.org search interface" single ((:commit . "696c5b056e45067512a7d6dcce2515f3c639f61b") (:authors ("Joshua Miller" . "josh@joshmiller.io")) (:maintainer "Joshua Miller" . "josh@joshmiller.io") (:keywords "docs" "help" "tools") (:url . "https://github.com/joshuamiller/clojars.el"))]) + (clojure-essential-ref . [(20200619 1653) ((emacs (24)) (cider (0 24 0))) "Cider-doc to \"Clojure, The Essential Reference\"" single ((:commit . "13ac560c25f7355fba00d9ca8c9f4ca03e7fd189") (:url . "https://github.com/p3r7/clojure-essential-ref"))]) + (clojure-essential-ref-nov . [(20200719 608) ((emacs (24)) (dash (2 16 0)) (nov (0 3 1)) (clojure-essential-ref (0 1 0))) "Cider-doc to \"Clojure, The Essential Reference\" (EPUB)" single ((:commit . "13ac560c25f7355fba00d9ca8c9f4ca03e7fd189") (:url . "https://github.com/p3r7/clojure-essential-ref"))]) + (clojure-mode . [(20220418 2015) ((emacs (25 1))) "Major mode for Clojure code" single ((:commit . "b6f41d74904daa9312648f3a7bea7a72fd8e140b") (:maintainer "Bozhidar Batsov" . "bozhidar@batsov.dev") (:keywords "languages" "clojure" "clojurescript" "lisp") (:url . "http://github.com/clojure-emacs/clojure-mode"))]) + (clojure-mode-extra-font-locking . [(20211230 817) ((clojure-mode (3 0))) "Extra font-locking for Clojure mode" single ((:commit . "b6f41d74904daa9312648f3a7bea7a72fd8e140b") (:authors ("Bozhidar Batsov" . "bozhidar@batsov.dev")) (:maintainer "Bozhidar Batsov" . "bozhidar@batsov.dev") (:keywords "languages" "lisp") (:url . "http://github.com/clojure-emacs/clojure-mode"))]) + (clojure-quick-repls . [(20150814 736) ((cider (0 8 1)) (dash (2 9 0))) "Quickly create Clojure and ClojureScript repls for a project." single ((:commit . "730311dd3ac4e0aceb0204f818b422017873467f") (:keywords "languages" "clojure" "cider" "clojurescript") (:url . "https://github.com/symfrog/clojure-quick-repls"))]) + (clojure-snippets . [(20180314 1308) ((yasnippet (0 10 0))) "Yasnippets for clojure" tar ((:commit . "6068dca90467a0f4ebc2cd39338a173d6f5ddc04") (:authors ("Max Penet" . "m@qbits.cc")) (:maintainer "Max Penet" . "m@qbits.cc") (:keywords "snippets"))]) + (clomacs . [(20220415 1035) ((emacs (24 3)) (cider (0 22 1)) (s (1 12 0)) (simple-httpd (1 4 6)) (dash (2 19 1))) "Simplifies Emacs Lisp interaction with Clojure." single ((:commit . "9cd7c9fd86bc7bc627a31275d1ef131378b90a49") (:authors ("Kostafey" . "kostafey@gmail.com")) (:maintainer "Kostafey" . "kostafey@gmail.com") (:keywords "clojure" "interaction") (:url . "https://github.com/clojure-emacs/clomacs"))]) + (closql . [(20220422 1601) ((emacs (25 1)) (compat (28 1 1 0)) (emacsql-sqlite (3 0 0))) "Store EIEIO objects using EmacSQL" single ((:commit . "87d2edae8bc3d390bcfc5e909e9c13ff9fce994a") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "extensions") (:url . "https://github.com/emacscollective/closql"))]) + (closure-lint-mode . [(20101118 2124) nil "minor mode for the Closure Linter" single ((:commit . "bc3d2fd5c35580bf1b8af43b12484c95a343b4b5") (:authors ("Roman Scherer" . "roman@burningswell.com")) (:maintainer "Roman Scherer" . "roman@burningswell.com") (:keywords "tools" "closure" "javascript" "lint" "flymake") (:url . "https://github.com/r0man/closure-lint-mode"))]) + (cloud-theme . [(20220205 1336) ((emacs (24))) "A light colored theme" single ((:commit . "16372ea1f527917102ac302afaec3ef09e289d24") (:authors ("Valerii Lysenko" . "vallyscode@gmail.com")) (:maintainer "Valerii Lysenko" . "vallyscode@gmail.com") (:keywords "color" "theme") (:url . "https://github.com/vallyscode/cloud-theme"))]) + (cloud-to-butt-erc . [(20130627 2308) nil "Replace 'the cloud' with 'my butt'" single ((:commit . "6710c03d1bc91736435cbfe845924940cae34e5c") (:authors ("David Leatherman" . "leathekd@gmail.com")) (:maintainer "David Leatherman" . "leathekd@gmail.com") (:url . "http://www.github.com/leathekd/cloud-to-butt-erc"))]) + (clues-theme . [(20161213 1127) ((emacs (24 0))) "an Emacs 24 theme which may well be fully awesome..." single ((:commit . "abd61f2b7f3e98de58ca26e6d1230e70c6406cc7") (:authors ("Jason Milkins" . "jasonm23@gmail.com")) (:maintainer "Jason Milkins" . "jasonm23@gmail.com") (:url . "https://github.com/emacsfodder/emacs-clues-theme"))]) + (cm-mode . [(20170203 2107) ((cl-lib (0 5))) "Minor mode for CriticMarkup" single ((:commit . "276d49c859822265070ae5dfbb403fd7d8d06436") (:authors ("Joost Kremers" . "joostkremers@fastmail.fm")) (:maintainer "Joost Kremers" . "joostkremers@fastmail.fm") (:keywords "text" "markdown"))]) + (cmake-font-lock . [(20211224 2006) ((cmake-mode (0 0))) "Advanced, type aware, highlight support for CMake" single ((:commit . "0d6111b36a66013aa9b452e664c93308df3b07e1") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "faces" "languages") (:url . "https://github.com/Lindydancer/cmake-font-lock"))]) + (cmake-ide . [(20210610 1525) ((emacs (24 4)) (cl-lib (0 5)) (seq (1 11)) (levenshtein (0)) (s (1 11 0))) "Calls CMake to find out include paths and other compiler flags" single ((:commit . "28dc4ab5bd01d99553901b4efeb7234280928b18") (:authors ("Atila Neves" . "atila.neves@gmail.com")) (:maintainer "Atila Neves" . "atila.neves@gmail.com") (:keywords "languages") (:url . "http://github.com/atilaneves/cmake-ide"))]) + (cmake-mode . [(20220322 1258) ((emacs (24 1))) "major-mode for editing CMake sources" single ((:commit . "02b4cd9827b7f2354350bef4e44cb3514edb5c26"))]) + (cmake-project . [(20171121 1115) nil "Integrates CMake build process with Emacs" single ((:commit . "a7cf9e4c01c4683e14b6942cc5cc5e8cddc98721") (:authors ("Alexander Lamaison" . "alexander.lamaison@gmail")) (:maintainer "Alexander Lamaison" . "alexander.lamaison@gmail") (:keywords "c" "cmake" "languages" "tools") (:url . "http://github.com/alamaison/emacs-cmake-project"))]) + (cmd-to-echo . [(20161203 2133) ((emacs (24 4)) (s (1 11 0)) (shell-split-string (20151224 208))) "Show the output of long-running commands in the echo area" single ((:commit . "e0e874fc0e1ad6d291e39ed76023445297ad438a") (:authors ("Tijs Mallaerts" . "tijs.mallaerts@gmail.com")) (:maintainer "Tijs Mallaerts" . "tijs.mallaerts@gmail.com"))]) + (cmm-mode . [(20150225 746) nil "Major mode for C-- source code" single ((:commit . "c3ad514dff3eb30434f6b20d953276d4c00de1ee"))]) + (cnfonts . [(20211227 248) ((emacs (24))) "A simple Chinese fonts config tool" tar ((:commit . "7279d4178b4d52ae763d2224140488887ce57261") (:authors ("Feng Shu" . "tumashu@163.com")) (:maintainer "Feng Shu" . "tumashu@163.com") (:keywords "convenience" "chinese" "font") (:url . "https://github.com/tumashu/cnfonts"))]) + (cobalt . [(20180304 1155) ((emacs (24))) "Easily use the Cobalt.rs static site generator" single ((:commit . "88ef936373a5493183d49ec69ca541bcc749a109") (:authors ("Juan Karlo Licudine" . "accidentalrebel@gmail.com")) (:maintainer "Juan Karlo Licudine" . "accidentalrebel@gmail.com") (:keywords "convenience") (:url . "https://github.com/cobalt-org/cobalt.el"))]) + (cobra-mode . [(20140116 2116) nil "Major mode for .NET-based Cobra language" single ((:commit . "acd6e53f6286af5176471d01f25257e5ddb6dd01") (:authors ("Taylor \"Nekroze\" Lawson")) (:maintainer "Taylor \"Nekroze\" Lawson") (:keywords "languages") (:url . "http://github.com/Nekroze/cobra-mode"))]) + (codcut . [(20190915 1009) nil "Share pieces of code to Codcut" single ((:commit . "7ca7db69e8c38ec45eb572ad16ab2b56086f2131") (:authors ("Diego Pasquali" . "hello@dgopsq.space")) (:maintainer "Diego Pasquali" . "hello@dgopsq.space") (:keywords "comm" "tools" "codcut" "share") (:url . "https://github.com/codcut/codcut-emacs"))]) + (code-archive . [(20190612 308) ((emacs (24 3))) "git supported code archive and reference for org-mode" single ((:commit . "1ad9af6679d0294c3056eab9cad673f29c562721") (:authors ("Michael Schuldt" . "mbschuldt@gmail.com")) (:maintainer "Michael Schuldt" . "mbschuldt@gmail.com") (:url . "https://github.com/mschuldt/code-archive"))]) + (code-cells . [(20220305 1320) ((emacs (27 1))) "Lightweight notebooks with support for ipynb files" single ((:commit . "8660bdeedee360e5eb632f1eb1356eb09d7dfbee") (:authors ("Augusto Stoffel" . "arstoffel@gmail.com")) (:maintainer "Augusto Stoffel" . "arstoffel@gmail.com") (:keywords "convenience" "outlines") (:url . "https://github.com/astoff/code-cells.el"))]) + (code-library . [(20160426 1218) ((gist (1 3 1))) "use org-mode to collect code snippets" single ((:commit . "32d59c5c845d6dbdda18f9bd1c03a58d55417fc5") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "lisp" "code"))]) + (code-review . [(20220503 1344) ((emacs (25 1)) (closql (1 2 0)) (magit (3 0 0)) (a (1 0 0)) (ghub (3 5 1)) (uuidgen (1 2)) (deferred (0 5 1)) (markdown-mode (2 4)) (forge (0 3 0)) (emojify (1 2))) "Perform code review from Github, Gitlab, and Bitbucket Cloud" tar ((:commit . "d38fbe59304ed31c759ce733cda16f69a8ef2d8c") (:authors ("Wanderson Ferreira ")) (:maintainer "Wanderson Ferreira" . "wand@hey.com") (:keywords "git" "tools" "vc") (:url . "https://github.com/wandersoncferreira/code-review"))]) + (code-stats . [(20201209 2135) ((emacs (25)) (request (0 3 0))) "Code::Stats plugin" single ((:commit . "9a467dfd6a3cef849468623e1c085cbf59dac154") (:authors ("Xu Chunyang" . "mail@xuchunyang.me")) (:maintainer "Xu Chunyang" . "mail@xuchunyang.me") (:url . "https://github.com/xuchunyang/code-stats-emacs"))]) + (codebug . [(20140929 2137) nil "Interact with codebug" single ((:commit . "ac0e4331ba94ccb5203fa492570e1ca6b90c3d52") (:authors ("Shane Dowling")) (:maintainer "Shane Dowling") (:url . "http://www.shanedowling.com/"))]) + (codesearch . [(20181006 1431) ((log4e (0 3 1))) "Core support for managing codesearch tools" tar ((:commit . "f6eb96f034a925444412cfa03e45e0ccbbafe3f2") (:authors ("Austin Bingham" . "austin.bingham@gmail.com") ("Youngjoo Lee" . "youngker@gmail.com")) (:maintainer "Austin Bingham" . "austin.bingham@gmail.com") (:keywords "tools" "development" "search") (:url . "https://github.com/abingham/emacs-codesearch"))]) + (codic . [(20150926 1127) ((emacs (24)) (cl-lib (0 5))) "Search Codic (codic.jp) naming dictionaries" tar ((:commit . "52bbb6997ef4ab9fb7fea43bbfff7f04671aa557") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-codic"))]) + (coffee-fof . [(20131012 1230) ((coffee-mode (0 4 1))) "A coffee-mode configuration for `ff-find-other-file'." single ((:commit . "211529594bc074721c6cbc4edb73a63cc05f89ac") (:authors ("Yasuyki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyki Oka" . "yasuyk@gmail.com") (:keywords "coffee-mode") (:url . "http://github.com/yasuyk/coffee-fof"))]) + (coffee-mode . [(20200315 1133) ((emacs (24 3))) "Major mode for CoffeeScript code" single ((:commit . "35a41c7d8233eac0b267d9593e67fb8b6235e134") (:authors ("Chris Wanstrath" . "chris@ozmm.org")) (:maintainer "Chris Wanstrath" . "chris@ozmm.org") (:keywords "coffeescript" "major" "mode") (:url . "http://github.com/defunkt/coffee-mode"))]) + (coin-ticker . [(20170611 727) ((request (0 3 0)) (emacs (25))) "Show a cryptocurrency price ticker" single ((:commit . "9efab90fe4e6f29464af14e0d8fd1e20c0147b80") (:authors ("Evan Klitzke" . "evan@eklitzke.org")) (:maintainer "Evan Klitzke" . "evan@eklitzke.org") (:keywords "news") (:url . "https://github.com/eklitzke/coin-ticker-mode"))]) + (colonoscopy-theme . [(20170808 1309) ((emacs (24 0))) "an Emacs 24 theme based on Colonoscopy (tmTheme)" single ((:commit . "64bbb322b13dae91ce9f1e3581f836f94f800ead") (:authors ("Jason Milkins")) (:maintainer "Jason Milkins") (:url . "https://github.com/emacsfodder/tmtheme-to-deftheme"))]) + (color-identifiers-mode . [(20220327 1143) ((dash (2 5 0)) (emacs (24))) "Color identifiers based on their names" single ((:commit . "6fe76f0c3090f6023da3806e9d760e93810905d4") (:authors ("Ankur Dave" . "ankurdave@gmail.com")) (:maintainer "Ankur Dave" . "ankurdave@gmail.com") (:keywords "faces" "languages") (:url . "https://github.com/ankurdave/color-identifiers-mode"))]) + (color-moccur . [(20141223 35) nil "multi-buffer occur (grep) mode" single ((:commit . "4f1c59ffd1ccc2ab1a171cd6b721e8cb9e002fb7") (:keywords "convenience") (:url . "http://www.bookshelf.jp/elc/color-moccur.el"))]) + (color-theme . [(20190220 1115) nil "An OBSOLETE color-theme implementation" tar ((:commit . "3a2f6b615f5e2401e30d93a3e0adc210bbb4b7aa") (:authors ("Jonadab the Unsightly One" . "jonadab@bright.net")) (:maintainer "Xavier Maillard" . "zedek@gnu.org") (:keywords "faces") (:url . "http://www.emacswiki.org/cgi-bin/wiki.pl?ColorTheme"))]) + (color-theme-approximate . [(20140228 436) nil "Makes Emacs theme works on terminal transparently" single ((:commit . "f54301ca39bc5d2ffb000f233f8114184a3e7d71") (:authors ("Tung Dao" . "me@tungdao.com")) (:maintainer "Tung Dao" . "me@tungdao.com"))]) + (color-theme-buffer-local . [(20170126 601) ((color-theme (0))) "Install color-themes by buffer." single ((:commit . "e606dec66f16a06140b9aad625a4fd52bca4f936") (:authors ("Victor Borja" . "vic.borja@gmail.com")) (:maintainer "Victor Borja" . "vic.borja@gmail.com") (:keywords "faces") (:url . "http://github.com/vic/color-theme-buffer-local"))]) + (color-theme-modern . [(20220506 858) ((emacs (24))) "Reimplement colortheme with Emacs 24 theme framework." tar ((:commit . "74ad69bbca6fcfff3c0960d888c7c9c1f9f3e2e8") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/emacs-jp/replace-colorthemes"))]) + (color-theme-sanityinc-solarized . [(20200805 603) ((emacs (24 1)) (cl-lib (0 6))) "A version of Ethan Schoonover's Solarized themes" tar ((:commit . "7ef39ac9d99bfb699903cfc3623521c0ceec7b86") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "faces" "themes") (:url . "https://github.com/purcell/color-theme-sanityinc-solarized"))]) + (color-theme-sanityinc-tomorrow . [(20220412 1643) nil "A version of Chris Kempson's \"tomorrow\" themes" tar ((:commit . "2b373a767129ed4e8c4d52e0ee827786224d7106") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "faces" "themes") (:url . "https://github.com/purcell/color-theme-sanityinc-tomorrow"))]) + (color-theme-x . [(20201204 2245) ((cl-lib (0 5))) "convert color themes to X11 resource settings" single ((:commit . "ec853dd931d625e07116fbc91d8829bd15f90889") (:authors ("Matthew Kennedy" . "mkennedy@killr.ath.cx")) (:maintainer "Andrew Johnson" . "andrew@andrewjamesjohnson.com") (:keywords "convenience" "faces" "frames") (:url . "https://github.com/ajsquared/color-theme-x"))]) + (colorless-themes . [(20210102 1035) ((emacs (24 1))) "A macro to generate mostly colorless themes" single ((:commit . "c1ed1e12541cf05cc6c558d23c089c07e10b54d7") (:authors ("Thomas Letan" . "contact@thomasletan.fr")) (:maintainer "Thomas Letan" . "contact@thomasletan.fr") (:keywords "faces themes" "faces") (:url . "https://git.sr.ht/~lthms/colorless-themes.el"))]) + (colormaps . [(20171008 2224) ((emacs (25))) "Hex colormaps" single ((:commit . "19fbb64a6288d505b9cf45c9b5a3eed0bfb135e2") (:authors ("Abhinav Tushar" . "lepisma@fastmail.com")) (:maintainer "Abhinav Tushar" . "lepisma@fastmail.com") (:keywords "tools") (:url . "https://github.com/lepisma/colormaps.el"))]) + (column-enforce-mode . [(20200605 1933) nil "Highlight text that extends beyond a column" single ((:commit . "14a7622f2268890e33536ccd29510024d51ee96f") (:authors ("Jordon Biondo")) (:maintainer "Jordon Biondo") (:url . "www.github.com/jordonbiondo/column-enforce-mode"))]) + (com-css-sort . [(20201002 1430) ((emacs (25 1)) (s (1 12 0))) "Common way of sorting the CSS attributes" single ((:commit . "fa85a6b9d852d725730a6ad1cc5afeb4ede93ca7") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs090218/com-css-sort"))]) + (comb . [(20201010 1147) ((emacs (25 1))) "Interactive code auditing and grep tool" tar ((:commit . "31f3e94afb2a7f7d18d30c2468a0c683700f7a66") (:authors ("Andrea Cardaci" . "cyrus.and@gmail.com")) (:maintainer "Andrea Cardaci" . "cyrus.and@gmail.com") (:keywords "matching") (:url . "https://github.com/cyrus-and/comb"))]) + (comby . [(20200629 140) ((emacs (25 1))) "Emacs comby integration" single ((:commit . "928b8b8959a2556aba5526f2a25801341eb59dc3") (:authors ("Sergey Kostyaev" . "feo.me@ya.ru")) (:maintainer "Sergey Kostyaev" . "feo.me@ya.ru") (:keywords "languages") (:url . "https://github.com/s-kostyaev/comby.el"))]) + (comint-hyperlink . [(20211026 100) ((emacs (24 3))) "Create hyperlinks in comint for SGR URL control sequences" single ((:commit . "905f2db1f95950899301b9f71faed9e9362cf5dc") (:authors ("Matthew Bauer" . "mjbauer95@gmail.com")) (:maintainer "Matthew Bauer" . "mjbauer95@gmail.com") (:keywords "comint" "shell" "processes" "hypermedia" "terminals") (:url . "https://github.com/matthewbauer/comint-hyperlink"))]) + (comint-intercept . [(20200106 454) ((emacs (24 3))) "Intercept input in comint-mode" single ((:commit . "3c9a6125e450435b79ab5e6466f830e57c5e0a30") (:authors ("\"Huang, Ying\"" . "huang.ying.caritas@gmail.com")) (:maintainer "\"Huang, Ying\"" . "huang.ying.caritas@gmail.com") (:keywords "processes" "terminals") (:url . "https://github.com/hying-caritas/comint-intercept"))]) + (command-log-mode . [(20160413 447) nil "log keyboard commands to buffer" single ((:commit . "af600e6b4129c8115f464af576505ea8e789db27") (:authors ("Michael Weber" . "michaelw@foldr.org")) (:maintainer "Michael Weber" . "michaelw@foldr.org") (:keywords "help") (:url . "https://github.com/lewang/command-log-mode"))]) + (command-queue . [(20160328 1725) ((emacs (24 3))) "shell command queue" single ((:commit . "f327c6f852592229a755ec6de0c62c6aeafd6659") (:authors ("Yuki INOUE ")) (:maintainer "Yuki INOUE ") (:url . "https://github.com/Yuki-Inoue/command-queue"))]) + (commander . [(20140120 1852) ((s (1 6 0)) (dash (2 0 0)) (cl-lib (0 3)) (f (0 6 1))) "Emacs command line parser" single ((:commit . "9ba1456b0a389a2f7b42b6f42a4208ddd87ce609") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "cli" "argv") (:url . "http://github.com/rejeep/commander.el"))]) + (comment-dwim-2 . [(20210101 1820) ((emacs (24 4))) "An all-in-one comment command to rule them all" single ((:commit . "7cdafd6d98234a7402865b8abdae54a2f2551c94") (:authors ("Rémy Ferré" . "dev@remyferre.net")) (:maintainer "Rémy Ferré" . "dev@remyferre.net") (:keywords "convenience") (:url . "https://github.com/remyferre/comment-dwim-2"))]) + (comment-or-uncomment-sexp . [(20190225 1122) ((emacs (24))) "Command for commenting the sexp under point." single ((:commit . "bec730d3fc1e6c17ff1339eb134af16c034a4d95") (:authors ("Artur Malabarba" . "artur@endlessparentheses.com")) (:maintainer "Artur Malabarba" . "artur@endlessparentheses.com") (:keywords "convenience") (:url . "https://github.com/Malabarba/comment-or-uncomment-sexp"))]) + (comment-tags . [(20170910 1735) ((emacs (24 5))) "Highlight & navigate comment tags like 'TODO'." single ((:commit . "7d914097f0a03484af71e621db533737fc692f58") (:authors ("Vincent Dumas" . "vincekd@gmail.com")) (:maintainer "Vincent Dumas" . "vincekd@gmail.com") (:keywords "convenience" "comments" "tags") (:url . "https://github.com/vincekd/comment-tags"))]) + (commentary-theme . [(20210714 1757) ((emacs (24))) "A minimal theme with contrasting comments" single ((:commit . "a73e1256f667065933e96bd6032c463cb115201d") (:url . "https://github.com/pzel/commentary-theme"))]) + (commenter . [(20160219 1627) ((emacs (24 4)) (let-alist (1 0 4))) "multiline-comment support package" single ((:commit . "6d1885419434ba779270c6fda0e30d390bb074bd") (:authors ("Yuta Yamada ")) (:maintainer "Yuta Yamada ") (:keywords "comment") (:url . "https://github.com/yuutayamada/commenter"))]) + (commify . [(20210904 1106) ((s (1 9 0))) "Toggle grouping commas in numbers" single ((:commit . "d6656bd3a909917a51ba033a11d4ab5f5fe55f83") (:authors ("Daniel E. Doherty" . "ded-commify@ddoherty.net")) (:maintainer "Daniel E. Doherty" . "ded-commify@ddoherty.net") (:keywords "convenience" "editing" "numbers" "grouping" "commas") (:url . "https://github.com/ddoherty03/commify"))]) + (common-lisp-snippets . [(20180226 1523) ((yasnippet (0 8 0))) "Yasnippets for Common Lisp" tar ((:commit . "c82ebf18f4ad49f390dd96ffcc59f8683c1a868b") (:authors ("Mark Karpov" . "markkarpov92@gmail.com")) (:maintainer "Mark Karpov" . "markkarpov92@gmail.com") (:keywords "snippets") (:url . "https://github.com/mrkkrp/common-lisp-snippets"))]) + (company . [(20220425 1145) ((emacs (25 1))) "Modular text completion framework" tar ((:commit . "d5145006b948f93e673f439a766da01f636d39fc") (:authors ("Nikolaj Schumacher")) (:maintainer "Dmitry Gutov" . "dgutov@yandex.ru") (:keywords "abbrev" "convenience" "matching") (:url . "http://company-mode.github.io/"))]) + (company-anaconda . [(20200404 1859) ((company (0 8 0)) (anaconda-mode (0 1 1)) (cl-lib (0 5 0)) (dash (2 6 0)) (s (1 9))) "Anaconda backend for company-mode" single ((:commit . "da1566db41a68809ef7f91ebf2de28118067c89b") (:authors ("Artem Malyshev" . "proofit404@gmail.com")) (:maintainer "Artem Malyshev" . "proofit404@gmail.com") (:url . "https://github.com/proofit404/anaconda-mode"))]) + (company-ansible . [(20200306 1441) ((emacs (24 4)) (company (0 8 12))) "A company back-end for ansible" tar ((:commit . "79dd421b161efa49fbdffad57fa40edb41f484a3") (:authors ("Krzysztof Magosa" . "krzysztof@magosa.pl")) (:maintainer "Krzysztof Magosa" . "krzysztof@magosa.pl") (:keywords "ansible") (:url . "https://github.com/krzysztof-magosa/company-ansible"))]) + (company-arduino . [(20160306 1739) ((emacs (24 1)) (company (0 8 0)) (irony (0 1 0)) (cl-lib (0 5)) (company-irony (0 1 0)) (company-c-headers (20140930)) (arduino-mode (1 0))) "company-mode for Arduino" single ((:commit . "d7e369702b8eee63e6dfdeba645ce28b6dc66fb1") (:authors ("Yuta Yamada" . "sleepboy.zzz@gmail.com")) (:maintainer "Yuta Yamada" . "sleepboy.zzz@gmail.com") (:keywords "convenience" "development" "company") (:url . "https://github.com/yuutayamada/company-arduino"))]) + (company-auctex . [(20200529 1835) ((yasnippet (0 8 0)) (company (0 8 0)) (auctex (11 87))) "Company-mode auto-completion for AUCTeX" single ((:commit . "9400a2ec7459dde8cbf1a5d50dfee4e300ed7e18") (:authors ("Christopher Monsanto , Alexey Romanov" . "alexey.v.romanov@gmail.com")) (:maintainer "Christopher Monsanto , Alexey Romanov" . "alexey.v.romanov@gmail.com") (:url . "https://github.com/alexeyr/company-auctex/"))]) + (company-axiom . [(20191027 1928) ((emacs (24)) (company (0 9)) (axiom-environment (20171021))) "A company-mode backend for the axiom-environment system" single ((:commit . "e60de5ed107ffeb530a56d24d04f38988124d12b") (:authors ("Paul Onions" . "paul.onions@acm.org")) (:maintainer "Paul Onions" . "paul.onions@acm.org") (:keywords "axiom" "openaxiom" "fricas" "axiom-environment"))]) + (company-bibtex . [(20171105 644) ((company (0 9 0)) (cl-lib (0 5)) (parsebib (1 0))) "Company completion for bibtex keys" single ((:commit . "da67faf3a6faba8e7f1b222dedfc5521b02c7655") (:authors ("GB Gardner" . "gbgar@users.noreply.github.com")) (:maintainer "GB Gardner" . "gbgar@users.noreply.github.com") (:keywords "company-mode" "bibtex") (:url . "https://github.com/gbgar/company-bibtex"))]) + (company-box . [(20211020 2007) ((emacs (26 0 91)) (dash (2 19 0)) (company (0 9 6)) (frame-local (0 0 1))) "Company front-end with icons" tar ((:commit . "f9cbbc7df8efbb56a8d31a5b422d158660d9109e") (:authors ("Sebastien Chapuis" . "sebastien@chapu.is")) (:maintainer "Sebastien Chapuis" . "sebastien@chapu.is") (:keywords "company" "completion" "front-end" "convenience") (:url . "https://github.com/sebastiencs/company-box"))]) + (company-c-headers . [(20190825 1631) ((emacs (24 1)) (company (0 8))) "Company mode backend for C/C++ header files" single ((:commit . "9d384571b1190e99d0a789e5296176d69a3d0771") (:authors ("Alastair Rankine" . "alastair@girtby.net")) (:maintainer "Alastair Rankine" . "alastair@girtby.net") (:keywords "development" "company"))]) + (company-cabal . [(20170917 1317) ((cl-lib (0 5)) (company (0 8 0)) (emacs (24))) "company-mode cabal backend" tar ((:commit . "62112a7259e24bd6c08885629a185afe512b7d3d") (:authors ("Iku Iwasa" . "iku.iwasa@gmail.com")) (:maintainer "Iku Iwasa" . "iku.iwasa@gmail.com") (:url . "https://github.com/iquiw/company-cabal"))]) + (company-coq . [(20220314 526) ((cl-lib (0 5)) (dash (2 12 1)) (yasnippet (0 11 0)) (company (0 8 12)) (company-math (1 1))) "A collection of extensions for Proof General's Coq mode" tar ((:commit . "a6e349e0131f676a885bd14c908fd26054b2df42") (:authors ("Clément Pit-Claudel" . "clement.pitclaudel@live.com")) (:maintainer "Clément Pit-Claudel" . "clement.pitclaudel@live.com") (:keywords "convenience" "languages") (:url . "https://github.com/cpitclaudel/company-coq"))]) + (company-ctags . [(20211211 338) ((emacs (25 1)) (company (0 9 0))) "Fastest company-mode completion backend for ctags" single ((:commit . "313508ba5d4f1e4b5d5d554faaa74076201c3248") (:authors ("Chen Bin" . "chenbin.sh@gmail.com")) (:maintainer "Chen Bin" . "chenbin.sh@gmail.com") (:keywords "convenience") (:url . "https://github.com/redguardtoo/company-ctags"))]) + (company-dcd . [(20210307 649) ((company (0 9)) (flycheck-dmd-dub (0 7)) (yasnippet (0 8)) (popwin (0 7)) (cl-lib (0 5)) (ivy (20160804 326))) "Company backend for Dlang using DCD." single ((:commit . "858500115d4f0285f963698ede9492f409a90e52") (:authors ("tsukimizake ")) (:maintainer "tsukimizake ") (:keywords "languages") (:url . "http://github.com/tsukimizake/company-dcd"))]) + (company-dict . [(20190302 5) ((emacs (24 4)) (company (0 8 12)) (parent-mode (2 3))) "A backend that emulates ac-source-dictionary" single ((:commit . "cd7b8394f6014c57897f65d335d6b2bd65dab1f4") (:authors ("Henrik Lissner ")) (:maintainer "Henrik Lissner" . "henrik@lissner.net") (:keywords "company" "dictionary" "ac-source-dictionary") (:url . "https://github.com/hlissner/emacs-company-dict"))]) + (company-distel . [(20180827 1344) ((distel-completion-lib (1 0 0))) "Erlang/distel completion backend for company-mode" single ((:commit . "acc4c0a5521904203d797fe96b08e5fae4233c7e") (:authors ("Sebastian Weddmark Olsson")) (:maintainer "Sebastian Weddmark Olsson") (:keywords "erlang" "distel" "company") (:url . "github.com/sebastiw/distel-completion"))]) + (company-emacs-eclim . [(20180911 1121) ((eclim (0 3)) (company (0 7)) (cl-lib (0 5))) "Eclim company backend" single ((:commit . "222ddd48fcf0ee01592dec77c58e0cf3f2ea1100"))]) + (company-emoji . [(20210427 2151) ((cl-lib (0 5)) (company (0 8 0))) "company-mode backend for emoji" tar ((:commit . "90594eb58b20fb937cfd4e946efcc446ee630e6f") (:authors ("Alex Dunn" . "dunn.alex@gmail.com")) (:maintainer "Alex Dunn" . "dunn.alex@gmail.com") (:keywords "emoji" "company") (:url . "https://github.com/dunn/company-emoji.git"))]) + (company-emojify . [(20210718 424) ((emacs (26 1)) (company (0 8 0)) (emojify (1 2 1)) (ht (2 0))) "Company completion for Emojify" single ((:commit . "6f095b419468b0443e1dcd8537ef4b84092f155c") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/company-emojify"))]) + (company-erlang . [(20170123 538) ((emacs (24 4)) (ivy-erlang-complete (0 1)) (company (0 9 2))) "company backend based on ivy-erlang-complete" single ((:commit . "bc0524a16f17b66c7397690e4ca0e004f09ea6c5") (:authors ("Sergey Kostyaev" . "feo.me@ya.ru")) (:maintainer "Sergey Kostyaev" . "feo.me@ya.ru") (:keywords "tools"))]) + (company-flow . [(20180225 2159) ((company (0 8 0)) (dash (2 13 0))) "Flow backend for company-mode" single ((:commit . "76ef585c70d2a3206c2eadf24ba61e59124c3a16") (:authors ("Aaron Jensen" . "aaronjensen@gmail.com")) (:maintainer "Aaron Jensen" . "aaronjensen@gmail.com") (:url . "https://github.com/aaronjensen/company-flow"))]) + (company-flx . [(20180103 518) ((emacs (24)) (company (0 8 12)) (flx (0 5))) "flx based fuzzy matching for company" single ((:commit . "16ca0d2f84e8e768bf2db8c5cfe421230a00bded") (:authors ("PythonNut" . "pythonnut@pythonnut.com")) (:maintainer "PythonNut" . "pythonnut@pythonnut.com") (:keywords "convenience" "company" "fuzzy" "flx") (:url . "https://github.com/PythonNut/company-flx"))]) + (company-fuzzy . [(20220409 1753) ((emacs (26 1)) (company (0 8 12)) (s (1 12 0)) (ht (2 0))) "Fuzzy matching for `company-mode'" single ((:commit . "e2e8a39976506cbf149f9c62a69c7a438be09579") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/company-fuzzy"))]) + (company-ghci . [(20190707 311) ((company (0 8 11)) (haskell-mode (13))) "company backend which uses the current ghci process." single ((:commit . "a1d25652583ab4666c5a78cac18cd8039776b50d") (:authors ("Hector Orellana" . "hofm92@gmail.com")) (:maintainer "Hector Orellana" . "hofm92@gmail.com"))]) + (company-glsl . [(20210109 1403) ((company (0 9 4)) (glsl-mode (2 4)) (emacs (24 4))) "Support glsl in company-mode" single ((:commit . "3a40501ba831a30a7fd3e8529b20d1305d0454aa") (:authors ("Guido Schmidt" . "git@guidoschmidt.cc")) (:maintainer "Guido Schmidt" . "git@guidoschmidt.cc") (:url . "https://github.com/guidoschmidt/company-glsl"))]) + (company-go . [(20170825 1643) ((company (0 8 0)) (go-mode (1 0 0))) "company-mode backend for Go (using gocode)" single ((:commit . "31948b463f2fc18f8801e5a8fe511fef300eb3dd") (:authors ("nsf" . "no.smile.face@gmail.com")) (:maintainer "nsf" . "no.smile.face@gmail.com") (:keywords "languages"))]) + (company-inf-ruby . [(20140805 2054) ((company (0 6 10)) (inf-ruby (2 2 7)) (emacs (24 1))) "company-mode completion back-end for inf-ruby" single ((:commit . "fe3e4863bc971fbb81edad447efad5795ead1b17") (:authors ("Dmitry Gutov" . "dgutov@yandex.ru")) (:maintainer "Dmitry Gutov" . "dgutov@yandex.ru") (:url . "https://github.com/company-mode/company-inf-ruby"))]) + (company-ipa . [(20210307 1838) ((emacs (24 3)) (company (0 8 12))) "IPA backend for company" single ((:commit . "8634021cac885f53f3274ef6dcce7eab19321046") (:authors ("Matías Guzmán Naranjo" . "mguzmann89@gmail.com")) (:maintainer "Matías Guzmán Naranjo" . "mguzmann89@gmail.com") (:keywords "convenience" "company" "ipa") (:url . "https://github.com/mguzmann/company-ipa"))]) + (company-irony . [(20190124 2346) ((emacs (24 1)) (company (0 8 0)) (irony (1 1 0)) (cl-lib (0 5))) "company-mode completion back-end for irony-mode" single ((:commit . "b44711dfce445610c1ffaec4951c6ff3882b216a") (:authors ("Guillaume Papin" . "guillaume.papin@epitech.eu")) (:maintainer "Guillaume Papin" . "guillaume.papin@epitech.eu") (:keywords "convenience") (:url . "https://github.com/Sarcasm/company-irony/"))]) + (company-irony-c-headers . [(20151018 909) ((cl-lib (0 5)) (company (0 9 0)) (irony (0 2 0))) "Company mode backend for C/C++ header files with Irony" single ((:commit . "72c386aeb079fb261d9ec02e39211272f76bbd97") (:authors ("Yutian Li" . "hotpxless@gmail.com")) (:maintainer "Yutian Li" . "hotpxless@gmail.com") (:keywords "c" "company") (:url . "https://github.com/hotpxl/company-irony-c-headers"))]) + (company-jedi . [(20200324 25) ((emacs (24)) (cl-lib (0 5)) (company (0 8 11)) (jedi-core (0 2 7))) "Company-mode completion back-end for Python JEDI" single ((:commit . "ea22b1f7a980c49aaf2c5e840e4536577f6602f6") (:authors ("Boy" . "boyw165@gmail.com")) (:maintainer "Neil Okamoto" . "neil.okamoto+melpa@gmail.com") (:url . "https://github.com/emacsorphanage/company-jedi"))]) + (company-lean . [(20210305 1705) ((emacs (24 3)) (dash (2 18 0)) (s (1 10 0)) (f (0 19 0)) (company (0 9 3)) (lean-mode (3 3 0))) "A company backend for lean-mode" single ((:commit . "362bc6fa3efb1874c525ed6b4b6f24f76af22596") (:authors ("Leonardo de Moura" . "leonardo@microsoft.com") ("Soonho Kong " . "soonhok@cs.cmu.edu") ("Gabriel Ebner " . "gebner@gebner.org") ("Sebastian Ullrich" . "sebasti@nullri.ch")) (:maintainer "Sebastian Ullrich" . "sebasti@nullri.ch") (:keywords "languages") (:url . "https://github.com/leanprover/lean-mode"))]) + (company-ledger . [(20210910 250) ((emacs (24 3)) (company (0 8 0))) "Fuzzy auto-completion for Ledger & friends" single ((:commit . "c6911b7e39b29c0d5f2541392ff485b0f53fd366") (:authors ("Debanjum Singh Solanky ")) (:maintainer "Debanjum Singh Solanky ") (:keywords "abbrev" "matching" "auto-complete" "beancount" "ledger" "company") (:url . "https://github.com/debanjum/company-ledger"))]) + (company-lua . [(20171108 2306) ((company (0 8 12)) (s (1 10 0)) (f (0 17 0)) (lua-mode (20151025))) "Company backend for Lua" tar ((:commit . "29f6819de4d691e5fd0b62893a9f4fbc1c6fcb52") (:authors ("Peter Vasil" . "mail@petervasil.net")) (:maintainer "Peter Vasil" . "mail@petervasil.net"))]) + (company-manually . [(20200709 913) ((emacs (24 3)) (company (0 9 0)) (ivy (0 13 0))) "A company backend that lets you manually build candidates" single ((:commit . "44c7a655e5f2a462835a96d1f0ed2ce434848416") (:authors ("Yanghao Xie")) (:maintainer "Yanghao Xie" . "yhaoxie@gmail.com") (:keywords "convenience" "company-mode" "manually build candidates") (:url . "https://github.com/yanghaoxie/company-manually"))]) + (company-math . [(20210731 2019) ((company (0 8 0)) (math-symbol-lists (1 3))) "Completion backends for unicode math symbols and latex tags" single ((:commit . "45778f5731c97a21a83e3b965cbde42018709afd") (:authors ("Vitalie Spinu" . "spinuvit@gmail.com")) (:maintainer "Vitalie Spinu" . "spinuvit@gmail.com") (:keywords "unicode" "symbols" "completion") (:url . "https://github.com/vspinu/company-math"))]) + (company-maxima . [(20210520 2034) ((emacs (25 1)) (maxima (0 6 1)) (seq (2 20)) (company (0 9 13))) "Maxima company integration" single ((:commit . "ce5fd160c193e387d9e2bacdba4065c4b4262cb1") (:authors ("Fermin Munoz")) (:maintainer "Fermin Munoz" . "fmfs@posteo.net") (:keywords "languages" "tools" "convenience") (:url . "https://gitlab.com/sasanidas/maxima"))]) + (company-nand2tetris . [(20171201 1813) ((nand2tetris (1 1 0)) (company (0 5)) (cl-lib (0 5 0))) "Company backend for nand2tetris major mode" single ((:commit . "33acee34d24b1c6a87db833b7d23449cf858f64f") (:authors ("Diego Berrocal" . "cestdiego@gmail.com")) (:maintainer "Diego Berrocal" . "cestdiego@gmail.com") (:keywords "nand2tetris" "hdl" "company") (:url . "http://www.github.com/CestDiego/nand2tetris.el/"))]) + (company-native-complete . [(20220103 1622) ((emacs (26 1)) (company (0 9 0)) (native-complete (0 1 0))) "Company completion using native-complete" single ((:commit . "01d8a2048e13f29dd3aa06281ac8cb466caddb64") (:authors ("Troy Hinckley" . "troy.hinckley@gmail.com")) (:maintainer "Troy Hinckley" . "troy.hinckley@gmail.com") (:url . "https://github.com/CeleritasCelery/emacs-native-shell-complete"))]) + (company-nginx . [(20220210 1411) ((emacs (24)) (cl-lib (0)) (company (0))) "company-mode keywords support for nginx-mode" single ((:commit . "8a9f1a5653fe2d9a5042bfb9377d54f37fcc64c8") (:keywords "company" "nginx") (:url . "https://repo.or.cz/company-nginx.git"))]) + (company-ngram . [(20170129 1913) ((cl-lib (0 5)) (company (0 8 0))) "N-gram based completion" tar ((:commit . "09a68b802e64799e95f205b438d469bbd78cd2e6") (:authors ("kshramt")) (:maintainer "kshramt") (:url . "https://github.com/kshramt/company-ngram"))]) + (company-nixos-options . [(20160215 857) ((company (0 8 0)) (nixos-options (0 0 1)) (cl-lib (0 5 0))) "Company Backend for nixos-options" single ((:commit . "053a2d5110ce05b7f99bcc2ac4804b70cbe87916") (:authors ("Diego Berrocal" . "cestdiego@gmail.com") ("Travis B. Hartwell" . "nafai@travishartwell.net")) (:maintainer "Diego Berrocal" . "cestdiego@gmail.com") (:keywords "unix") (:url . "http://www.github.com/travisbhartwell/nix-emacs/"))]) + (company-org-block . [(20210825 2107) ((emacs (25 1)) (company (0 8 0)) (org (9 2 0))) "Org blocks company backend" single ((:commit . "115af0a3625f4669358eca568466d468cacc78bd") (:authors ("Alvaro Ramirez")) (:maintainer "Alvaro Ramirez") (:url . "https://github.com/xenodium/company-org-block"))]) + (company-php . [(20211204 558) ((cl-lib (0 5)) (ac-php-core (2 0)) (company (0 9))) "A company back-end for PHP." single ((:commit . "f34e09783b77d1158ea139b7b3d8034bc52b0b9f") (:authors ("jim" . "xcwenn@qq.com")) (:maintainer "jim") (:keywords "completion" "convenience" "intellisense") (:url . "https://github.com/xcwen/ac-php"))]) + (company-phpactor . [(20200121 1218) ((emacs (24 3)) (company (0 9 6)) (phpactor (0 1 0))) "company-mode backend for Phpactor" single ((:commit . "34195f1533209e2ffd0f898a69c7db2bffd1eabe") (:authors ("Martin Tang" . "martin.tang365@gmail.com") ("Mikael Kermorgant" . "mikael@kgtech.fi")) (:maintainer "Martin Tang" . "martin.tang365@gmail.com") (:keywords "tools" "php") (:url . "https://github.com/emacs-php/phpactor.el"))]) + (company-plisp . [(20200531 1927) ((emacs (25)) (s (1 2 0)) (company (0 8 12)) (dash (2 12 0)) (cl-lib (0 5))) "Company mode backend for PicoLisp language" tar ((:commit . "fc0b56d2a711340ca3e63119bfe692bb3e8620fb") (:authors ("Fermin MF" . "fmfs@posteo.net")) (:maintainer "Fermin MF" . "fmfs@posteo.net") (:keywords "company" "plisp" "convenience" "auto-completion") (:url . "https://gitlab.com/sasanidas/company-plisp"))]) + (company-plsense . [(20180118 58) ((company (0 9 3)) (cl-lib (0 5 0)) (dash (2 12 0)) (s (1 12)) (emacs (24))) "Company backend for Perl" single ((:commit . "b48e3181e08ec597269621d621aa06636f02d883") (:authors ("Troy Hinckley" . "troy.hinckley@gmail.com")) (:maintainer "Troy Hinckley" . "troy.hinckley@gmail.com") (:url . "https://github.com/CeleritasCelery/company-plsense"))]) + (company-pollen . [(20160812 1510) ((company (0 9 0)) (pollen-mode (1 0))) "company-mode completion backend for pollen" single ((:commit . "09a9dc48c468dcd385982b9629f325e70d569faf") (:authors ("Junsong Li ")) (:maintainer "Junsong Li") (:keywords "languages" "pollen" "pollenpub" "company") (:url . "https://github.com/lijunsong/pollen-mode"))]) + (company-posframe . [(20220331 2141) ((emacs (26 0)) (company (0 9 0)) (posframe (0 9 0))) "Use a posframe as company candidate menu" single ((:commit . "df0e34f69dc8e9aaa1a6c5e88783898f4ae3f2df") (:authors ("Clément Pit-Claudel, Feng Shu, Lars Andersen" . "expez@expez.com")) (:maintainer "Feng Shu" . "tumashu@163.com") (:keywords "abbrev" "convenience" "matching") (:url . "https://github.com/tumashu/company-posframe"))]) + (company-prescient . [(20220509 2300) ((emacs (25 1)) (prescient (5 2)) (company (0 9 6))) "prescient.el + Company" single ((:commit . "c05f8a43c6ff07a8b5a3ba8df7a2ec35677b7484") (:authors ("Radian LLC" . "contact+prescient@radian.codes")) (:maintainer "Radian LLC" . "contact+prescient@radian.codes") (:keywords "extensions") (:url . "https://github.com/raxod502/prescient.el"))]) + (company-qml . [(20170428 1708) ((qml-mode (0 1)) (company (0 8 12))) "Company backend for QML files" tar ((:commit . "4af4f32a7ad86d86bb9293fb0b675aec513b5736") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions"))]) + (company-quickhelp . [(20211115 1335) ((emacs (24 3)) (company (0 8 9)) (pos-tip (0 4 6))) "Popup documentation for completion candidates" single ((:commit . "3ca2708b4e5190205aca01d65fe1b391963a53f9") (:authors ("Lars Andersen" . "expez@expez.com")) (:maintainer "Lars Andersen" . "expez@expez.com") (:keywords "company" "popup" "documentation" "quickhelp") (:url . "https://www.github.com/expez/company-quickhelp"))]) + (company-quickhelp-terminal . [(20210715 1010) ((emacs (24 4)) (company-quickhelp (2 2 0)) (popup (0 5 3))) "Terminal support for `company-quickhelp'" single ((:commit . "75a2f5c7669833646fc653cabd531737b52fb469") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/company-quickhelp-terminal"))]) + (company-racer . [(20171205 310) ((emacs (24 4)) (cl-lib (0 5)) (company (0 8 0)) (deferred (0 3 1))) "Company integration for racer" single ((:commit . "a00381c9d416f375f783fcb6ae8d40669ce1f567") (:authors ("Mario Rodas" . "marsam@users.noreply.github.com")) (:maintainer "Mario Rodas" . "marsam@users.noreply.github.com") (:keywords "convenience") (:url . "https://github.com/emacs-pe/company-racer"))]) + (company-reftex . [(20210418 1316) ((emacs (25 1)) (s (1 12)) (company (0 8))) "Company backend based on RefTeX." single ((:commit . "42eb98c6504e65989635d95ab81b65b9d5798e76") (:authors ("Eivind Fonn" . "evfonn@gmail.com")) (:maintainer "Eivind Fonn" . "evfonn@gmail.com") (:keywords "bib" "tex" "company" "latex" "reftex" "references" "labels" "citations") (:url . "https://github.com/TheBB/company-reftex"))]) + (company-restclient . [(20190426 1312) ((cl-lib (0 5)) (company (0 8 0)) (emacs (24)) (know-your-http-well (0 2 0)) (restclient (0 0 0))) "company-mode completion back-end for restclient-mode" single ((:commit . "e5a3ec54edb44776738c13e13e34c85b3085277b") (:authors ("Iku Iwasa" . "iku.iwasa@gmail.com")) (:maintainer "Iku Iwasa" . "iku.iwasa@gmail.com") (:url . "https://github.com/iquiw/company-restclient"))]) + (company-rtags . [(20191222 920) ((emacs (24 3)) (company (0 8 1)) (rtags (2 10))) "RTags back-end for company" single ((:commit . "db39790fda5c2443bc790b8971ac140914f7e9c2") (:authors ("Jan Erik Hanssen" . "jhanssen@gmail.com") ("Anders Bakken" . "agbakken@gmail.com")) (:maintainer "Jan Erik Hanssen" . "jhanssen@gmail.com") (:url . "https://github.com/Andersbakken/rtags"))]) + (company-shell . [(20211013 1725) ((emacs (24 4)) (company (0 8 12)) (dash (2 12 0)) (cl-lib (0 5))) "Company mode backend for shell functions" single ((:commit . "a77f4de75912aa87314cde92c603b831d5050246") (:authors ("Alexander Miller" . "alexanderm@web.de")) (:maintainer "Alexander Miller" . "alexanderm@web.de") (:keywords "company" "shell" "auto-completion") (:url . "https://github.com/Alexander-Miller/company-shell"))]) + (company-solidity . [(20181117 1518) ((company (0 9 0)) (cl-lib (0 5 0)) (solidity-mode (0 1 9))) "Company-mode back-end for solidity-mode" single ((:commit . "20fb77e089e10187b37ae1a94153017b82ed2a0a") (:authors ("Samuel Smolkin" . "sam@future-precedent.org")) (:maintainer "Samuel Smolkin" . "sam@future-precedent.org") (:keywords "solidity" "completion" "company") (:url . "https://github.com/ethereum/emacs-solidity"))]) + (company-sourcekit . [(20210430 2155) ((emacs (24 3)) (company (0 8 12)) (dash (2 18 0)) (sourcekit (0 2 0))) "company-mode completion backend for SourceKit" single ((:commit . "a1860ad4dd3a542acd2fa0dfac2a388cbdf4af0c") (:authors ("Nathan Kot" . "nk@nathankot.com")) (:maintainer "Nathan Kot" . "nk@nathankot.com") (:keywords "abbrev") (:url . "https://github.com/nathankot/company-sourcekit"))]) + (company-stan . [(20211129 2051) ((emacs (24 3)) (company (0 9 10)) (stan-mode (10 3 0))) "A company-mode completion backend for stan" single ((:commit . "150bbbe5fd3ad2b5a3dbfba9d291e66eeea1a581") (:authors ("Kazuki Yoshida" . "kazukiyoshida@mail.harvard.edu")) (:maintainer "Kazuki Yoshida" . "kazukiyoshida@mail.harvard.edu") (:keywords "languages") (:url . "https://github.com/stan-dev/stan-mode/tree/master/company-stan"))]) + (company-statistics . [(20170210 1933) ((emacs (24 3)) (company (0 8 5))) "Sort candidates using completion history" single ((:commit . "e62157d43b2c874d2edbd547c3bdfb05d0a7ae5c") (:authors ("Ingo Lohmar" . "i.lohmar@gmail.com")) (:maintainer "Ingo Lohmar" . "i.lohmar@gmail.com") (:keywords "abbrev" "convenience" "matching") (:url . "https://github.com/company-mode/company-statistics"))]) + (company-suggest . [(20200911 1845) ((company (0 9 0)) (emacs (25 1))) "Company-mode back-end for search engine suggests" single ((:commit . "1c89c9de3852f07ce28b0bedf1fbf56fe6eedcdc") (:authors ("Jürgen Hötzel" . "juergen@archlinux.org")) (:maintainer "Jürgen Hötzel" . "juergen@archlinux.org") (:keywords "completion" "convenience") (:url . "https://github.com/juergenhoetzel/company-suggest"))]) + (company-tabnine . [(20210310 2247) ((emacs (25)) (company (0 9 3)) (cl-lib (0 5)) (dash (2 16 0)) (s (1 12 0)) (unicode-escape (1 1))) "A company-mode backend for TabNine" single ((:commit . "98e9e8b38b6ca289fbe265b0a7b62c7fe38ed0e2") (:authors ("Tommy Xiang" . "tommyx058@gmail.com")) (:maintainer "Tommy Xiang" . "tommyx058@gmail.com") (:keywords "convenience") (:url . "https://github.com/TommyX12/company-tabnine/"))]) + (company-terraform . [(20220509 1759) ((emacs (24 4)) (company (0 8 12)) (terraform-mode (0 6))) "A company backend for terraform" tar ((:commit . "8d5a16d1bbeeb18ca49a8fd57b5d8cd30c8b8dc7") (:authors ("Rafał Cieślak" . "rafalcieslak256@gmail.com")) (:maintainer "Rafał Cieślak" . "rafalcieslak256@gmail.com") (:keywords "abbrev" "convenience" "terraform" "company") (:url . "https://github.com/rafalcieslak/emacs-company-terraform"))]) + (company-try-hard . [(20200417 1603) ((emacs (24 3)) (company (0 8 0)) (dash (2 0))) "get all completions from company backends" single ((:commit . "2b41136b5ed6e02032d99bcdb0599ecf00394fa5") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk") (:keywords "matching") (:url . "https://github.com/Wilfred/company-try-hard"))]) + (company-web . [(20220115 2146) ((company (0 8 0)) (dash (2 8 0)) (cl-lib (0 5 0)) (web-completion-data (0 1 0))) "Company version of ac-html, complete for web,html,emmet,jade,slim modes" tar ((:commit . "863fb84b81ed283474e50330cd8d27b1ca0d74f1") (:authors ("Olexandr Sydorchuk" . "olexandr.syd@gmail.com")) (:maintainer "Olexandr Sydorchuk" . "olexandr.syd@gmail.com") (:keywords "html" "company") (:url . "https://github.com/osv/company-web"))]) + (company-wordfreq . [(20220405 2000) ((emacs (27 1)) (company (0 9))) "Company backend for human language texts" single ((:commit . "83569cf346c2320ef22f6a858e3424f771c4324e") (:authors ("Johannes Mueller" . "github@johannes-mueller.org")) (:maintainer "Johannes Mueller" . "github@johannes-mueller.org") (:keywords "company" "convenience" "matching") (:url . "https://github.com/johannes-mueller/company-wordfreq.el"))]) + (company-ycm . [(20140904 1817) ((ycm (0 1))) "company-ycm" single ((:commit . "4da8a14abcd0f4fa3235042ade2e12b5068c0601") (:authors ("Ajay Gopinathan" . "ajay@gopinathan.net")) (:maintainer "Ajay Gopinathan" . "ajay@gopinathan.net") (:keywords "abbrev"))]) + (company-ycmd . [(20180520 1053) ((ycmd (1 3)) (company (0 9 3)) (deferred (0 5 1)) (s (1 11 0)) (dash (2 13 0)) (let-alist (1 0 5)) (f (0 19 0))) "company-mode backend for ycmd" single ((:commit . "c17ff9e0250a9b39d23af37015a2b300e2f36fed") (:url . "https://github.com/abingham/emacs-ycmd"))]) + (compdef . [(20200304 611) ((emacs (24 4))) "A local completion definer" single ((:commit . "30fb5846ed851efee641ce8c5d8879ad36cd7ac6") (:authors ("Uros Perisic")) (:maintainer "Uros Perisic") (:keywords "convenience") (:url . "https://gitlab.com/jjzmajic/compdef"))]) + (competitive-programming-snippets . [(20201115 1702) ((emacs (26)) (yasnippet (0 8 0))) "Competitive Programming snippets for yasnippet" tar ((:commit . "3b43c1aeaa6676d1d3d0c47e78790db9bee150b6") (:authors ("Seong Yong-ju" . "sei40kr@gmail.com")) (:maintainer "Seong Yong-ju" . "sei40kr@gmail.com") (:keywords "tools") (:url . "https://github.com/sei40kr/competitive-programming-snippets"))]) + (compiler-explorer . [(20210916 1316) ((emacs (26 1)) (request (0 3 0))) "Compiler explorer client (godbolt.org)" single ((:commit . "9ea0cc78ac40f667dfaf9277758a22b9058ca434") (:authors ("Michał Krzywkowski" . "k.michal@zoho.com")) (:maintainer "Michał Krzywkowski" . "k.michal@zoho.com") (:keywords "c" "tools") (:url . "https://github.com/mkcms/compiler-explorer.el"))]) + (completions-frame . [(20210430 640) ((emacs (26 1))) "Show completions in child frame" single ((:commit . "860e5b97730df7ef5c34584ad164bc69c561db84") (:authors ("Andrii Kolomoiets" . "andreyk.mad@gmail.com")) (:maintainer "Andrii Kolomoiets" . "andreyk.mad@gmail.com") (:keywords "frames") (:url . "https://github.com/muffinmad/emacs-completions-frame"))]) + (composable . [(20201024 1458) ((emacs (24 4))) "composable editing" tar ((:commit . "6f2efaa7018feb854720cc2518e4274ad708f793") (:authors ("Simon Friis Vindum" . "simon@vindum.io")) (:maintainer "Simon Friis Vindum" . "simon@vindum.io") (:keywords "lisp"))]) + (composer . [(20200616 1717) ((emacs (24 3)) (s (1 9 0)) (f (0 17)) (seq (1 9)) (php-runtime (0 1 0))) "Interface to PHP Composer" single ((:commit . "7c7f89df226cac69664d7eca5e913b544dc475c5") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "tools" "php" "dependency" "manager") (:url . "https://github.com/zonuexe/composer.el"))]) + (comware-router-mode . [(20220108 2111) ((dash (2 16 0)) (emacs (24 3))) "Major mode for editing Comware configuration files" single ((:commit . "cd8c74653c0e221e3dd1ca540496c4b4c7ee4617") (:authors ("Davide Restivo" . "davide.restivo@yahoo.it")) (:maintainer "Davide Restivo" . "davide.restivo@yahoo.it") (:keywords "convenience" "faces") (:url . "https://github.com/daviderestivo/comware-router-mode"))]) + (concurrent . [(20161229 330) ((emacs (24 3)) (deferred (0 5 0))) "Concurrent utility functions for emacs lisp" single ((:commit . "2239671d94b38d92e9b28d4e12fd79814cfb9c16") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "deferred" "async" "concurrent") (:url . "https://github.com/kiwanami/emacs-deferred/blob/master/README-concurrent.markdown"))]) + (conda . [(20220315 1533) ((emacs (24 4)) (pythonic (0 1 0)) (dash (2 13 0)) (s (1 11 0)) (f (0 18 2))) "Work with your conda environments" single ((:commit . "9c28d7a853b4b4bd00215cf7f07856c1563f2ad7") (:authors ("Rami Chowdhury" . "rami.chowdhury@gmail.com")) (:maintainer "Rami Chowdhury" . "rami.chowdhury@gmail.com") (:keywords "python" "environment" "conda") (:url . "http://github.com/necaris/conda.el"))]) + (config-general-mode . [(20171024 1840) nil "Config::General config file mode" single ((:commit . "b4a8e6ba0bb027a77e4a0f701409f3e57bb2e4c0") (:authors ("T.v.Dein" . "tlinden@cpan.org")) (:maintainer "T.v.Dein" . "tlinden@cpan.org") (:keywords "files") (:url . "https://github.com/tlinden/config-general-mode"))]) + (config-parser . [(20160426 1219) ((emacs (24 4))) "a library for parsing config file" single ((:commit . "85d559e7889d8f5b98b8794b79426ae25ec3caa5") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "convenience" "config") (:url . "https://github.com/lujun9972/el-config-parser"))]) + (conkeror-minor-mode . [(20150114 1604) nil "Mode for editing conkeror javascript files." single ((:commit . "476e81c27b056e21c192391fe674a2bf875466b0") (:authors ("Artur Malabarba" . "bruce.connor.am@gmail.com>")) (:maintainer "Artur Malabarba" . "bruce.connor.am@gmail.com>") (:keywords "programming" "tools") (:url . "http://github.com/Bruce-Connor/conkeror-minor-mode"))]) + (conllu-mode . [(20200501 2328) ((emacs (25)) (cl-lib (0 5)) (flycheck (30)) (hydra (0 13 0)) (s (1 0))) "editing mode for CoNLL-U files" tar ((:commit . "0db3063572b0de08874822e20570bb153747e6ed") (:authors ("bruno cuconato" . "bcclaro+emacs@gmail.com")) (:maintainer "bruno cuconato" . "bcclaro+emacs@gmail.com") (:keywords "extensions") (:url . "https://github.com/odanoburu/conllu-mode"))]) + (connection . [(20191111 446) nil "TCP-based client connection" single ((:commit . "bdf0aa7761d1c1a3bc0652b2fdc4a54b3acdb06a") (:authors ("Torsten Hilbrich" . "torsten.hilbrich@gmx.net")) (:maintainer "Torsten Hilbrich" . "torsten.hilbrich@gmx.net") (:keywords "network"))]) + (constant-theme . [(20180921 1012) ((emacs (24 1))) "A calm, dark, almost monochrome color theme." tar ((:commit . "23543a09729569b566175abe1efbe774048d3fa8") (:authors ("Jannis Pohlmann" . "contact@jannispohlmann.de")) (:maintainer "Jannis Pohlmann" . "contact@jannispohlmann.de") (:keywords "themes") (:url . "https://github.com/jannis/emacs-constant-theme"))]) + (consult . [(20220508 928) ((emacs (27 1)) (compat (28 1))) "Consulting completing-read" tar ((:commit . "1dfdf55f3d941f08089e5d0e611cd9daa8a44b19") (:authors ("Daniel Mendler and Consult contributors")) (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") (:url . "https://github.com/minad/consult"))]) + (consult-ag . [(20220419 1721) ((emacs (27 1)) (consult (0 16))) "The silver searcher integration using Consult" single ((:commit . "2460ae6829e86c9f1186a852304d919526838cb8") (:authors ("Kanon Kakuno" . "yadex205@outlook.jp")) (:maintainer "Kanon Kakuno" . "yadex205@outlook.jp") (:url . "https://github.com/yadex205/consult-ag"))]) + (consult-company . [(20211021 1152) ((emacs (27 1)) (company (0 9)) (consult (0 9))) "Consult frontend for company" single ((:commit . "ef1c553b4a72b23297b55708bf6f6dd1b27cc68e") (:authors ("mohsin kaleem" . "mohkale@kisara.moe")) (:maintainer "mohsin kaleem" . "mohkale@kisara.moe") (:url . "https://github.com/mohkale/consult-company"))]) + (consult-dir . [(20220505 1037) ((emacs (26 1)) (consult (0 9)) (project (0 6 0))) "Insert paths into the minibuffer prompt" single ((:commit . "d397ca6ea67af4d3c59a330a778affd825f0efd9") (:authors ("Karthik Chikmagalur")) (:maintainer "Karthik Chikmagalur" . "karthik.chikmagalur@gmail.com") (:keywords "convenience") (:url . "https://github.com/karthink/consult-dir"))]) + (consult-eglot . [(20220409 1238) ((emacs (27 1)) (eglot (1 7)) (consult (0 16)) (project (0 3 0))) "A consulting-read interface for eglot" single ((:commit . "0da8801dd8435160ce1f62ad8066bd52e38f5cbd") (:authors ("mohsin kaleem" . "mohkale@kisara.moe")) (:maintainer "Mohsin Kaleem") (:keywords "tools" "completion" "lsp") (:url . "https://github.com/mohkale/consult-eglot"))]) + (consult-flycheck . [(20220403 1810) ((consult (0 16)) (flycheck (31)) (emacs (27 1))) "Provides the command `consult-flycheck'" single ((:commit . "9b40f136c017fadf6239d7602d16bf73b4ad5198") (:authors ("Daniel Mendler and Consult contributors")) (:maintainer "Daniel Mendler" . "mail@daniel-mendler.de") (:url . "https://github.com/minad/consult"))]) + (consult-flyspell . [(20220419 2044) ((emacs (25 1)) (consult (0 12))) "Consult integration for flyspell" single ((:commit . "396def174495cc77413e2065ef79658a02490dad") (:authors ("Marco Pawłowski")) (:maintainer "Marco Pawłowski") (:keywords "convenience") (:url . "https://gitlab.com/OlMon/consult-flyspell"))]) + (consult-ghq . [(20210606 2047) ((emacs (26 1)) (consult (0 8)) (affe (0 1))) "Ghq interface using consult" single ((:commit . "c8619d66bd8f8728e43ed15096078b89eb4d2083") (:authors ("Tomoya Otake" . "tomoya.ton@gmail.com")) (:maintainer "Tomoya Otake" . "tomoya.ton@gmail.com") (:keywords "convenience" "usability" "consult" "ghq") (:url . "https://github.com/tomoya/consult-ghq"))]) + (consult-ls-git . [(20220501 1823) ((emacs (27 1)) (consult (0 16))) "Consult integration for git" single ((:commit . "f2398b354994e583ad22af324a129cf94d06009e") (:authors ("Robin Joy")) (:maintainer "Robin Joy") (:keywords "convenience") (:url . "https://github.com/rcj/consult-ls-git"))]) + (consult-lsp . [(20220507 856) ((emacs (27 1)) (lsp-mode (5 0)) (consult (0 16)) (f (0 20 0))) "LSP-mode Consult integration" single ((:commit . "19606a03cf854e1b0930c4526ed92c4560dccdc2") (:authors ("Gerry Agbobada")) (:maintainer "Gerry Agbobada") (:keywords "tools" "completion" "lsp") (:url . "https://github.com/gagbo/consult-lsp"))]) + (consult-notmuch . [(20220421 717) ((emacs (26 1)) (consult (0 9)) (notmuch (0 31))) "Notmuch search using consult" single ((:commit . "16eb2c100ca144140f07014c32e99487c6a73e18") (:authors ("Jose A Ortega Ruiz" . "jao@gnu.org")) (:maintainer "Jose A Ortega Ruiz") (:keywords "mail") (:url . "https://codeberg.org/jao/consult-notmuch"))]) + (consult-org-roam . [(20220508 1232) ((emacs (27 1)) (org-roam (2 2 0)) (consult (0 16))) "Consult integration for org-roam" single ((:commit . "05cec288f931a1f3cd5984b88a79f1339110e4b9") (:authors ("jgru ")) (:maintainer "jgru ") (:url . "https://github.com/jgru/consult-org-roam"))]) + (consult-project-extra . [(20220424 1815) ((emacs (27 1)) (consult (0 17)) (project (0 8 1))) "Consult integration for project.el" single ((:commit . "fa882a0bf9b697ebb59d0dfa2ffd81ea6daabf41") (:authors ("Enrique Kessler Martínez")) (:maintainer "Enrique Kessler Martínez") (:keywords "convenience" "project" "management") (:url . "https://github.com/Qkessler/consult-project-extra"))]) + (consult-projectile . [(20220505 1139) ((emacs (25 1)) (consult (0 12)) (projectile (2 5 0))) "Consult integration for projectile" single ((:commit . "8e618bc62405e345cc59e891f82d8ee45691010a") (:authors ("Marco Pawłowski")) (:maintainer "Marco Pawłowski") (:keywords "convenience") (:url . "https://gitlab.com/OlMon/consult-projectile"))]) + (consult-recoll . [(20220227 2050) ((emacs (26 1)) (consult (0 9))) "Recoll queries using consult" single ((:commit . "228306eeda8c57db45609ca068f60ee433367c17") (:authors ("Jose A Ortega Ruiz" . "jao@gnu.org")) (:maintainer "Jose A Ortega Ruiz") (:keywords "docs" "convenience") (:url . "https://codeberg.org/jao/consult-recoll"))]) + (consult-spotify . [(20211114 2258) ((emacs (26 1)) (consult (0 8)) (espotify (0 1))) "Spotify queries using consult" single ((:commit . "ea6d6021e5acc550560325db2f09198839ee702f") (:authors ("Jose A Ortega Ruiz" . "jao@gnu.org")) (:maintainer "Jose A Ortega Ruiz") (:keywords "multimedia") (:url . "https://codeberg.org/jao/espotify"))]) + (consult-yasnippet . [(20220409 1209) ((emacs (27 1)) (yasnippet (0 14)) (consult (0 16))) "A consulting-read interface for yasnippet" single ((:commit . "cdb256d2c50e4f8473c6052e1009441b65b8f8ab") (:authors ("mohsin kaleem" . "mohkale@kisara.moe")) (:maintainer "mohsin kaleem" . "mohkale@kisara.moe") (:url . "https://github.com/mohkale/consult-yasnippet"))]) + (contextual . [(20180726 800) ((emacs (24)) (dash (2 12 1)) (cl-lib (0 5))) "Contextual profile management system" single ((:commit . "e3c0de4a2e06757a0e8407c3c6e75930026191e3") (:authors ("Alexander Kahl" . "ak@sodosopa.io")) (:maintainer "Alexander Kahl" . "ak@sodosopa.io") (:keywords "convenience" "tools") (:url . "https://github.com/lshift-de/contextual"))]) + (contextual-menubar . [(20180205 709) nil "display the menubar only on a graphical display" single ((:commit . "f76f55232ac07df76ef9a334a0c527dfab97c40b") (:authors ("Aaron Jensen" . "aaronjensen@gmail.com")) (:maintainer "Aaron Jensen" . "aaronjensen@gmail.com") (:url . "https://github.com/aaronjensen/contextual-menubar"))]) + (contrast-color . [(20160903 1807) ((emacs (24 3)) (cl-lib (0 5))) "Pick best contrast color for you" single ((:commit . "c5fb77a211ebbef3185ada37bea7420534c33f94") (:authors ("Yuta Yamada ")) (:maintainer "Yuta Yamada ") (:keywords "color" "convenience") (:url . "https://github.com/yuutayamada/contrast-color-el"))]) + (control-mode . [(20160624 1710) nil "A \"control\" mode, similar to vim's \"normal\" mode" single ((:commit . "72d6179b60adc438aada74083b2bf4264b575de3") (:authors ("Stephen Marsh" . "stephen.david.marsh@gmail.com")) (:maintainer "Stephen Marsh" . "stephen.david.marsh@gmail.com") (:keywords "convenience" "emulations") (:url . "https://github.com/stephendavidmarsh/control-mode"))]) + (conventional-changelog . [(20211212 1158) ((emacs (27)) (transient (0 3 6))) "Conventional Changelog Generator" single ((:commit . "40c2ee58364422b776e81dc153918205bfbeda86") (:authors ("liuyinz" . "liuyinz95@gmail.com")) (:maintainer "liuyinz" . "liuyinz95@gmail.com") (:keywords "tools") (:url . "https://github.com/liuyinz/emacs-conventional-changelog"))]) + (copy-as-format . [(20190523 258) ((cl-lib (0 5))) "Copy buffer locations as GitHub/Slack/JIRA etc... formatted code" single ((:commit . "a0962b670e26b723ce304b14e3397da453aef84e") (:authors ("Skye Shaw" . "skye.shaw@gmail.com")) (:maintainer "Skye Shaw" . "skye.shaw@gmail.com") (:keywords "github" "slack" "jira" "hipchat" "gitlab" "bitbucket" "org-mode" "pod" "rst" "asciidoc" "tools" "convenience") (:url . "https://github.com/sshaw/copy-as-format"))]) + (copy-file-on-save . [(20200616 518) ((emacs (24 3)) (cl-lib (0 5)) (f (0 17)) (s (1 7 0))) "Copy file on save, automatic deployment it." single ((:commit . "811c8fe638c5616b6471525421e61a4470be3b52") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "files" "comm" "deploy") (:url . "https://github.com/emacs-php/emacs-auto-deployment"))]) + (copyit . [(20190919 1258) ((emacs (24 3)) (s (1 9 0))) "Copy it, yank anything!" single ((:commit . "c4f2c28e5b6270e8e3364341619f1154bb4e682e") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "convenience" "yank" "clipboard") (:url . "https://github.com/zonuexe/emacs-copyit"))]) + (copyit-pandoc . [(20190919 1258) ((emacs (24 3)) (copyit (0 1 0)) (pandoc (0 0 1))) "Copy it, yank anything!" single ((:commit . "c4f2c28e5b6270e8e3364341619f1154bb4e682e") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "convenience" "yank" "clipboard") (:url . "https://github.com/zonuexe/emacs-copyit"))]) + (coq-commenter . [(20170822 2309) ((dash (2 13 0)) (s (1 11 0)) (cl-lib (0 5))) "Coq commenting minor mode for proof" single ((:commit . "7fe9a2cc0ebdb0b1e54a24eb7971d757fb588ac3") (:authors ("Junyoung Clare Jang" . "jjc9310@gmail.com")) (:maintainer "Junyoung Clare Jang" . "jjc9310@gmail.com") (:keywords "comment" "coq" "proof") (:url . "http://github.com/ailrun/coq-commenter"))]) + (corfu-doc . [(20220429 1348) ((emacs (26 0)) (corfu (0 16 0))) "Documentation popup for Corfu" single ((:commit . "5a6f4f879de6dc2ca6e22789878d416e88e85905") (:authors ("Yuwei Tian" . "ibluefocus@NOSPAM.gmail.com")) (:maintainer "Yuwei Tian" . "ibluefocus@NOSPAM.gmail.com") (:keywords "corfu" "popup" "documentation" "convenience") (:url . "https://github.com/galeo/corfu-doc"))]) + (corral . [(20160502 701) nil "Quickly surround text with delimiters" single ((:commit . "e7ab6aa118e46b93d4933d1364bc273f57cd6911") (:authors ("Kevin Liu" . "mail@nivekuil.com")) (:maintainer "Kevin Liu" . "mail@nivekuil.com") (:url . "http://github.com/nivekuil/corral"))]) + (cort . [(20211020 18) ((emacs (24 1)) (ansi (0 4)) (cl-lib (0 6))) "Simplify extended unit test framework" single ((:commit . "3f64a7b03a4c5b768ec21fd5987acd0d62d16c7b") (:authors ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "Naoya Yamashita" . "conao3@gmail.com") (:keywords "test" "lisp") (:url . "https://github.com/conao3/cort.el"))]) + (cosmo . [(20170922 744) ((emacs (24 4))) "Cosmological Calculator" single ((:commit . "dd83b09a49a2843606b28279b674b2207040b36b") (:authors ("Francesco Montanari" . "fmnt@fmnt.info")) (:maintainer "Francesco Montanari" . "fmnt@fmnt.info") (:keywords "tools") (:url . "https://gitlab.com/montanari/cosmo-el"))]) + (counsel . [(20220402 953) ((emacs (24 5)) (ivy (0 13 4)) (swiper (0 13 4))) "Various completion functions using Ivy" single ((:commit . "8bf8027e4bd8c093bddb76a813952d2a0dcbf21d") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "convenience" "matching" "tools") (:url . "https://github.com/abo-abo/swiper"))]) + (counsel-ag-popup . [(20210121 805) ((emacs (26 1)) (counsel (0 13 0)) (transient (0 3 0))) "Interactive search with counsel-ag" single ((:commit . "41d85fe36edd72da68f5009ad9cf9013cd19960d") (:authors ("Eder Elorriaga" . "gexplorer8@gmail.com")) (:maintainer "Eder Elorriaga" . "gexplorer8@gmail.com") (:keywords "convenience" "matching" "tools") (:url . "https://github.com/gexplorer/counsel-ag-popup"))]) + (counsel-at-point . [(20220507 1118) ((emacs (26 2)) (counsel (0 13 0))) "Context sensitive project search" single ((:commit . "f618411fc8f607e4c93b5efa98584fd461c53ac6") (:authors ("Campbell Barton" . "ideasman42@gmail.com")) (:maintainer "Campbell Barton" . "ideasman42@gmail.com") (:keywords "convenience") (:url . "https://codeberg.com/ideasman42/emacs-counsel-at-point"))]) + (counsel-bbdb . [(20181128 1320) ((ivy (0 8 0)) (emacs (24 3))) "Quick search&input email from BBDB based on ivy" single ((:commit . "df2890deb73b09f8055243bd91942ea887d9b7a1") (:authors ("Chen Bin ")) (:maintainer "Chen Bin ") (:keywords "mail" "abbrev" "convenience" "matching") (:url . "https://github.com/redguard/counsel-bbdb"))]) + (counsel-chrome-bm . [(20211022 1427) ((emacs (25 1)) (counsel (0 13 0))) "Browse Chrom(e/ium) bookmarks with Ivy" single ((:commit . "72b31889581f20f4037c0361f5259ff3633bc128") (:authors ("BlueBoxWare" . "BlueBoxWare@users.noreply.github.com")) (:maintainer "BlueBoxWare" . "BlueBoxWare@users.noreply.github.com") (:keywords "hypermedia") (:url . "https://github.com/BlueBoxWare/counsel-chrome-bm"))]) + (counsel-codesearch . [(20180925 803) ((codesearch (1)) (counsel (0 10 0)) (emacs (24)) (ivy (0 10 0))) "Counsel interface for codesearch.el" single ((:commit . "b7989fad3e06f301c31d5e896c42b6cc549a0e0c") (:authors ("Austin Bingham" . "austin.bingham@gmail.com")) (:maintainer "Austin Bingham" . "austin.bingham@gmail.com") (:keywords "tools") (:url . "https://github.com/abingham/emacs-counsel-codesearch"))]) + (counsel-css . [(20211115 1755) ((emacs (24 4)) (counsel (0 7 0)) (cl-lib (0 5))) "stylesheet-selector-aware swiper" single ((:commit . "8e9c0515fc952452eee786d8ebb43d48ea86c9f8") (:authors ("Henrik Lissner ")) (:maintainer "Henrik Lissner" . "contact@henrik.io") (:keywords "convenience" "tools" "counsel" "swiper" "selector" "css" "less" "scss") (:url . "https://github.com/hlissner/emacs-counsel-css"))]) + (counsel-dash . [(20200103 1411) ((emacs (24 4)) (dash-docs (1 4 0)) (counsel (0 8 0)) (cl-lib (0 5))) "Browse dash docsets using Ivy" single ((:commit . "370d5f6f14b5294d0eb717f7b2a6a8e93df1ed24") (:authors ("Nathan Kot" . "nk@nathankot.com")) (:maintainer "Nathan Kot" . "nk@nathankot.com") (:keywords "dash" "ivy" "counsel") (:url . "https://github.com/nathankot/counsel-dash"))]) + (counsel-edit-mode . [(20210824 1504) ((emacs (26 1)) (ht (2 3)) (s (1 12 0)) (counsel (0 10 0))) "Edit results of counsel commands in-place" single ((:commit . "378803ac0040c04762ff001ab1aca7d4325ecf22") (:authors ("Tyler Dodge")) (:maintainer "Tyler Dodge") (:keywords "convenience" "matching") (:url . "https://github.com/tyler-dodge/counsel-edit-mode"))]) + (counsel-etags . [(20220405 510) ((emacs (25 1)) (counsel (0 13 4))) "Fast and complete Ctags/Etags solution using ivy" single ((:commit . "c74ae94297c4a2dc0b6878c2e9460a4f386158d4") (:authors ("Chen Bin ")) (:maintainer "Chen Bin ") (:keywords "tools" "convenience") (:url . "http://github.com/redguardtoo/counsel-etags"))]) + (counsel-fd . [(20210606 1724) ((counsel (0 12 0))) "counsel interface for fd" single ((:commit . "e9513a3c7f6cdbdf038f951e828e631c0455e7d4") (:keywords "tools") (:url . "https://github.com/CsBigDataHub/counsel-fd"))]) + (counsel-ffdata . [(20191017 1237) ((emacs (25 1)) (counsel (0 11 0)) (emacsql (3 0 0))) "Use ivy to access firefox data" single ((:commit . "88c2348c4039d9e562bd3d9a364708b01037c283") (:authors ("Zhu Zihao" . "all_but_last@163.com")) (:maintainer "Zhu Zihao" . "all_but_last@163.com") (:keywords "convenience" "tools" "matching") (:url . "https://github.com/cireu/counsel-ffdata"))]) + (counsel-gtags . [(20210222 1803) ((emacs (25 1)) (counsel (0 8 0)) (seq (1 0))) "ivy for GNU global" single ((:commit . "1d52eaeffeb60266434d4f7416a108ca058fde91") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com") ("Felipe Lema" . "felipelema@mortemale.org") ("Jimmy Aguilar Mena" . "spacibba@aol.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/FelipeLema/emacs-counsel-gtags"))]) + (counsel-jq . [(20210329 749) ((swiper (0 12 0)) (ivy (0 12 0)) (emacs (24 1))) "Live preview of \"jq\" queries using counsel" single ((:commit . "8cadd2e96470402ede4881b4e955872976443689") (:authors ("Alain M. Lafon" . "alain@200ok.ch")) (:maintainer "Alain M. Lafon" . "alain@200ok.ch") (:keywords "convenience" "data" "matching") (:url . "https://github.com/200ok-ch/counsel-jq"))]) + (counsel-mairix . [(20210422 649) ((emacs (26 3)) (ivy (0 13 1))) "Counsel interface for Mairix" single ((:commit . "39fa2ad10a5f899cb3f3275f9a6ebd166c51216a") (:authors ("Antoine Kalmbach" . "ane@iki.fi")) (:maintainer "Antoine Kalmbach" . "ane@iki.fi") (:keywords "mail") (:url . "https://sr.ht/~ane/counsel-mairix"))]) + (counsel-notmuch . [(20181203 935) ((emacs (24)) (ivy (0 10 0)) (notmuch (0 21)) (s (1 12 0))) "Search emails in Notmuch asynchronously with Ivy" single ((:commit . "a4a1562935e4180c42524c51609d1283e9be0688") (:authors ("Alexander Fu Xi" . "fuxialexander@gmail.com")) (:maintainer "Alexander Fu Xi" . "fuxialexander@gmail.com") (:keywords "mail") (:url . "https://github.com/fuxialexander/counsel-notmuch"))]) + (counsel-org-capture-string . [(20200810 1114) ((emacs (25 1)) (ivy (0 13))) "Counsel for org-capture-string" single ((:commit . "dbb7d95f99d7910d76ffc2d024580088a34ec444") (:authors ("Akira Komamura" . "akira.komamura@gmail.com")) (:maintainer "Akira Komamura" . "akira.komamura@gmail.com") (:keywords "outlines") (:url . "https://github.com/akirak/counsel-org-capture-string"))]) + (counsel-org-clock . [(20200810 1109) ((emacs (25 1)) (ivy (0 10 0)) (dash (2 0))) "Counsel commands for org-clock" single ((:commit . "0f790def6ac2b5a84d01eed47a7ee53619a8f5b9") (:authors ("Akira Komamura" . "akira.komamura@gmail.com")) (:maintainer "Akira Komamura" . "akira.komamura@gmail.com") (:url . "https://github.com/akirak/counsel-org-clock"))]) + (counsel-osx-app . [(20160821 809) ((ivy (0 8 0)) (emacs (24 3))) "launch osx applications via ivy interface" single ((:commit . "b1c54cbc033c4939966910d85ce035503079e108") (:authors ("Boris Buliga" . "d12frosted@gmail.com")) (:maintainer "Boris Buliga" . "d12frosted@gmail.com") (:url . "https://github.com/d12frosted/counsel-osx-app"))]) + (counsel-projectile . [(20211004 2003) ((counsel (0 13 4)) (projectile (2 5 0))) "Ivy integration for Projectile" single ((:commit . "40d1e1d4bb70acb00fddd6f4df9778bf2c52734b") (:authors ("Eric Danan")) (:maintainer "Eric Danan") (:keywords "project" "convenience") (:url . "https://github.com/ericdanan/counsel-projectile"))]) + (counsel-pydoc . [(20171018 2042) ((emacs (24 3)) (ivy (0 9 1))) "run pydoc with counsel" single ((:commit . "1d8ff8ca3b9d69453cde423b1887fbb490a95c9e") (:authors (nil . "Hao Deng(denghao8888@gmail.com)")) (:maintainer nil . "Hao Deng(denghao8888@gmail.com)") (:keywords "completion" "matching") (:url . "https://github.com/co-dh/pydoc_utils"))]) + (counsel-spotify . [(20200818 2055) ((emacs (25 1)) (ivy (0 13 0))) "Control Spotify search and select music with Ivy" tar ((:commit . "2743ad52a9def53534fd505397fbe1ac49e53015") (:authors ("Lautaro García ")) (:maintainer "Lautaro García ") (:url . "https://github.com/Lautaro-Garcia/counsel-spotify"))]) + (counsel-test . [(20190819 1920) ((emacs (25 1)) (ivy (0 11 0)) (s (1 12 0))) "Browse and execute tests with ivy" tar ((:commit . "7fc4e5d0d65c53edbcb4c25917bcf7faaea36ec7") (:keywords "tools" "ivy" "counsel" "testing" "ctest" "pytest") (:url . "http://github.com/xmagpie/counsel-test"))]) + (counsel-tramp . [(20210518 1153) ((emacs (24 3)) (counsel (0 10))) "Tramp ivy interface for ssh, docker, vagrant" single ((:commit . "76719eebb791920272c69e75e234f05a815bb5c2") (:authors ("Masashı Mıyaura")) (:maintainer "Masashı Mıyaura") (:url . "https://github.com/masasam/emacs-counsel-tramp"))]) + (counsel-web . [(20210609 2156) ((emacs (25 1)) (counsel (0 13 0)) (request (0 3 0))) "Search the Web using Ivy" single ((:commit . "1359b3b204fcdac7a3d6664c7d540a88b5acecfd") (:authors ("Matthew Sojourner Newton" . "matt@mnewton.com")) (:maintainer "Matthew Sojourner Newton" . "matt@mnewton.com") (:keywords "convenience" "hypermedia") (:url . "https://github.com/mnewt/counsel-web"))]) + (counsel-world-clock . [(20190709 2211) ((ivy (0 9 0)) (s (1 12 0))) "Display world clock using Ivy." single ((:commit . "674e4c6b82a92ea765af97cc5f017b357284c7dc") (:authors ("Kuang Chen ")) (:maintainer "Kuang Chen ") (:url . "https://github.com/kchenphy/counsel-world-clock"))]) + (countdown . [(20190626 244) ((emacs (25 1)) (stream (2 2 4))) "Countdown using big LCD-like digits" single ((:commit . "139dea91fc818d65944aca5f16c9626abbdfbf04") (:authors ("Xu Chunyang" . "mail@xuchunyang.me")) (:maintainer "Xu Chunyang" . "mail@xuchunyang.me") (:keywords "tools") (:url . "https://github.com/xuchunyang/countdown.el"))]) + (cov . [(20220410 2247) ((emacs (24 4)) (f (0 18 2)) (s (1 11 0)) (elquery (0))) "Show coverage stats in the fringe." single ((:commit . "8396fa82a84965cd88fa23f5b361ab80ff28e231") (:authors ("Adam Niederer")) (:maintainer "Adam Niederer") (:keywords "coverage" "gcov" "c") (:url . "https://github.com/AdamNiederer/cov"))]) + (coverage . [(20191113 1958) ((ov (1 0)) (cl-lib (0 5))) "Code coverage line highlighting" single ((:commit . "6e3c6f2dcb759a76086adeeb1fdfe83e4f082482") (:authors ("Kieran Trezona-le Comte" . "trezona.lecomte@gmail.com")) (:maintainer "Kieran Trezona-le Comte" . "trezona.lecomte@gmail.com") (:keywords "coverage" "metrics" "simplecov" "ruby" "rspec") (:url . "https://github.com/trezona-lecomte/coverage"))]) + (coverlay . [(20190414 940) ((emacs (24 1)) (cl-lib (0 5))) "Test coverage overlays" single ((:commit . "0beae208d0e7d746a94385428bd61aa5cd7ea828") (:authors ("Takuto Wada ")) (:maintainer "Takuto Wada ") (:keywords "coverage" "overlay") (:url . "https://github.com/twada/coverlay.el"))]) + (cowsay . [(20210510 1540) ((emacs (24 5))) "Poorly drawn ASCII cartoons saying things" single ((:commit . "683c23afa2a37272be54de822ad19f4e11dd86ba") (:authors ("Lassi Kortela" . "lassi@lassi.io")) (:maintainer "Lassi Kortela" . "lassi@lassi.io") (:keywords "games") (:url . "https://github.com/lassik/emacs-cowsay"))]) + (cp5022x . [(20120323 2335) nil "cp50220, cp50221, cp50222 coding system" single ((:commit . "ea7327dd75e54539576916f592ae1be98179ae35") (:authors ("ARISAWA Akihiro" . "ari@mbf.ocn.ne.jp")) (:maintainer "ARISAWA Akihiro" . "ari@mbf.ocn.ne.jp") (:keywords "languages" "cp50220" "cp50221" "cp50222" "cp51932" "cp932"))]) + (cpanfile-mode . [(20161001 710) ((emacs (24 4))) "Major mode for cpanfiles" single ((:commit . "eda675703525198df1f76ddf250bffa40217ec5d") (:authors ("Zak B. Elep" . "zakame@zakame.net")) (:maintainer "Zak B. Elep" . "zakame@zakame.net") (:keywords "perl") (:url . "https://github.com/zakame/cpanfile-mode"))]) + (cpp-auto-include . [(20210318 2217) ((cl-lib (0 5))) "Insert and delete C++ header files automatically" single ((:commit . "0ce829f27d466c083e78b9fe210dcfa61fb417f4") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/emacsorphanage/cpp-auto-include"))]) + (cpputils-cmake . [(20181006 328) nil "Easy realtime C++ syntax check and IntelliSense with CMake." single ((:commit . "64b2b05eff5398b4cd522e66efaf14553ab18ff4") (:authors ("Chen Bin" . "chenbin.sh@gmail.com")) (:maintainer "Chen Bin" . "chenbin.sh@gmail.com") (:keywords "cmake" "intellisense" "flymake" "flycheck") (:url . "http://github.com/redguardtoo/cpputils-cmake"))]) + (cpu-sos . [(20200409 2356) ((emacs (25 1))) "S.O.S. from a CPU in distress" single ((:commit . "1594b76d4ad3a6e3c471d82da366226d156e6226") (:authors ("Bruno Félix Rezende Ribeiro" . "oitofelix@gnu.org")) (:maintainer "Bruno Félix Rezende Ribeiro" . "oitofelix@gnu.org") (:keywords "processes") (:url . "https://github.com/oitofelix/cpu-sos"))]) + (cql-mode . [(20190315 225) ((emacs (24))) "Major mode for editting CQLs" single ((:commit . "d400c046850d3cf404778b2c47d6be4ff84ca04b") (:authors ("Yuki Inoue ")) (:maintainer "Yuki Inoue ") (:keywords "cql" "cassandra") (:url . "https://github.com/Yuki-Inoue/cql-mode"))]) + (cquery . [(20190118 542) ((emacs (25 1)) (lsp-mode (3 4)) (dash (0 13))) "cquery client for lsp-mode" tar ((:commit . "555e50984ebda177421fdcdc8c76cb29235d9694") (:authors ("Tobias Pisani")) (:maintainer "Tobias Pisani") (:keywords "languages" "lsp" "c++") (:url . "https://github.com/jacobdufault/cquery"))]) + (crappy-jsp-mode . [(20140311 931) nil "A pretty crappy major-mode for jsp." single ((:commit . "6c45ab92b452411cc0fab9bcee2f456276b4fc40") (:keywords "jsp" "major" "mode"))]) + (creamsody-theme . [(20170222 1058) ((autothemer (0 2))) "Straight from the soda fountain." single ((:commit . "32fa3f4e461da92700523b1b20e7b28974c19a26") (:url . "http://github.com/emacsfodder/emacs-theme-creamsody"))]) + (create-link . [(20211014 1617) ((emacs (25 1))) "Smart format link generator" single ((:commit . "e765b1067ced891a90ba0478af7fe675cff9b713") (:authors ("Kijima Daigo" . "norimaking777@gmail.com")) (:maintainer "Kijima Daigo" . "norimaking777@gmail.com") (:keywords "link" "format" "browser" "convenience") (:url . "https://github.com/kijimaD/create-link"))]) + (creds . [(20140510 1706) ((s (1 9 0)) (dash (2 5 0))) "A parser credentials file library (not limited to credentials entries)" tar ((:commit . "b059397a7d59481f05fbb1bb9c8d3c2c69226482") (:authors ("Antoine R. Dumont ")) (:maintainer "Antoine R. Dumont ") (:keywords "credentials") (:url . "https://github.com/ardumont/emacs-creds"))]) + (creole . [(20140924 1500) ((noflet (0 0 3)) (kv (0 0 17))) "A parser for the Creole Wiki language" single ((:commit . "7d5cffe93857f6c75ca09ac79c0e47b8d4410e53") (:authors ("Nic Ferrier" . "nferrier@ferrier.me.uk")) (:maintainer "Nic Ferrier" . "nferrier@ferrier.me.uk") (:keywords "lisp" "creole" "wiki"))]) + (creole-mode . [(20130722 50) nil "a markup mode for creole" single ((:commit . "b5e79b2ec5f19fb5aacf689b5febc3e0b61515c4") (:authors ("Nic Ferrier" . "nferrier@ferrier.me.uk")) (:maintainer "Nic Ferrier" . "nferrier@ferrier.me.uk") (:keywords "hypermedia" "wp") (:url . "https://github.com/nicferrier/creole-mode"))]) + (cricbuzz . [(20180804 2254) ((enlive (0 0 1)) (f (0 19 0)) (dash (2 13 0)) (s (1 11 0))) "Cricket scores from cricbuzz in emacs" single ((:commit . "0b95d45991bbcd2fa58d96ce921f6a57ba42c153") (:authors ("Abhinav Tushar" . "abhinav.tushar.vs@gmail.com")) (:maintainer "Abhinav Tushar" . "abhinav.tushar.vs@gmail.com") (:keywords "cricket" "score") (:url . "https://github.com/lepisma/cricbuzz.el"))]) + (crm-custom . [(20160117 6) ((cl-lib (0 5))) "Alternate `completing-read-multiple' that uses `completing-read'" single ((:commit . "f1aaccf64306a5f99d9bf7ba815d7ea41c15518d") (:authors ("Ryan C. Thompson" . "rct@thompsonclan.org")) (:maintainer "Ryan C. Thompson" . "rct@thompsonclan.org") (:keywords "completion" "minibuffer" "multiple elements") (:url . "https://github.com/DarwinAwardWinner/crm-custom"))]) + (crontab-mode . [(20210715 133) ((emacs (24 3))) "Major mode for crontab(5)" single ((:commit . "7412f3df0958812bfcacd5875a409fa795fa8ecc") (:authors ("Mario Rodas" . "marsam@users.noreply.github.com")) (:maintainer "Mario Rodas" . "marsam@users.noreply.github.com") (:keywords "languages") (:url . "https://github.com/emacs-pe/crontab-mode"))]) + (crossword . [(20210614 633) ((emacs (26 1))) "Download and play crossword puzzles" single ((:commit . "a8594b6e13f5e276aa9bc810ac74a8032bb1f678") (:keywords "games") (:url . "https://github.com/Boruch-Baum/emacs-crossword"))]) + (crux . [(20210811 436) ((seq (1 11))) "A Collection of Ridiculously Useful eXtensions" single ((:commit . "6bfd212a7f7ae32e455802fde1f9e3f4fba932a0") (:authors ("Bozhidar Batsov" . "bozhidar@batsov.dev")) (:maintainer "Bozhidar Batsov" . "bozhidar@batsov.dev") (:keywords "convenience") (:url . "https://github.com/bbatsov/crux"))]) + (cryptol-mode . [(20190531 2051) nil "Cryptol major mode for Emacs" single ((:commit . "81ebbde83f7cb75b2dfaefc09de6a1703068c769") (:authors (nil . "Austin Seipp ")) (:maintainer nil . "Austin Seipp ") (:keywords "cryptol" "cryptography") (:url . "http://github.com/thoughtpolice/cryptol-mode"))]) + (crystal-mode . [(20220104 2146) ((emacs (24 4))) "Major mode for editing Crystal files" single ((:commit . "96a8058205b24b513d0b9307db32f05e30f9570b") (:keywords "languages" "crystal") (:url . "https://github.com/crystal-lang-tools/emacs-crystal-mode"))]) + (crystal-playground . [(20180830 501) ((emacs (25)) (crystal-mode (0 1 2))) "Local crystal playground for short code snippets." single ((:commit . "fb3691b1281207b459c5be50015a626f356dc40d") (:authors ("Jason Howell")) (:maintainer "Jason Howell") (:keywords "tools" "crystal") (:url . "https://github.com/jasonrobot/crystal-playground"))]) + (csgo-conf-mode . [(20161209 1619) nil "CS:GO Configuration files syntax highlighting" single ((:commit . "57e7224f87a3ccc76b5564cc95fa0ff43bb6807c") (:authors ("Guillermo Robles" . "guillerobles1995@gmail.com")) (:maintainer "Guillermo Robles" . "guillerobles1995@gmail.com") (:keywords "languages") (:url . "https://github.com/wynro/emacs-csgo-conf-mode"))]) + (csharp-mode . [(20211124 1105) ((emacs (26 1))) "C# mode derived mode" tar ((:commit . "fa06dfa206812476217ada6c4178de34ff1efc42") (:authors ("Theodor Thornhill" . "theo@thornhill.no")) (:maintainer "Jostein Kjønigsen" . "jostein@gmail.com") (:keywords "c#" "languages" "oop" "mode") (:url . "https://github.com/emacs-csharp/csharp-mode"))]) + (csound-mode . [(20211215 1925) ((emacs (25)) (shut-up (0 3 2)) (multi (2 0 1)) (dash (2 16 0)) (highlight (0))) "A major mode for interacting and coding Csound" tar ((:commit . "44c49e5a9262ede4b4477bafb13b42b1ba047b9c") (:authors ("Hlöðver Sigurðsson" . "hlolli@gmail.com")) (:maintainer "Hlöðver Sigurðsson" . "hlolli@gmail.com") (:url . "https://github.com/hlolli/csound-mode"))]) + (csproj-mode . [(20200801 1732) ((emacs (24))) "Work with .NET project files (csproj, vbproj)" tar ((:commit . "a7f0f4610c976a28c41b9b8299892f88b5d0336c") (:authors ("Omair Majid" . "omair.majid@gmail.com")) (:maintainer "Omair Majid" . "omair.majid@gmail.com") (:keywords "languages" "tools") (:url . "https://github.com/omajid/csproj-mode"))]) + (css-autoprefixer . [(20180311 1600) ((emacs (24))) "Adds autoprefix to CSS" single ((:commit . "386a5defc8543a3b87820f1761c075c7d1d93b38") (:authors (nil . "Kyung Mo Kweon and contributors")) (:maintainer nil . "Kyung Mo Kweon and contributors") (:keywords "convenience" "usability" "css") (:url . "https://github.com/kkweon/emacs-css-autoprefixer"))]) + (css-comb . [(20160416 559) nil "Sort CSS properties in a particular order using CSS Comb" single ((:commit . "6fa45e5af8a8bd3af6c1154cde3540e32c4206ee") (:authors ("Charanjit Singh" . "ckhabra@gmail.com")) (:maintainer "Charanjit Singh" . "ckhabra@gmail.com") (:url . "https://github.com/channikhabra/css-comb.el"))]) + (css-eldoc . [(20220415 1629) nil "an eldoc-mode plugin for CSS source code" tar ((:commit . "73ebf9757a043b56b7d3b5befec5a38e6754b9e5") (:authors ("Zeno Zeng" . "zenoes@qq.com")) (:maintainer "Zeno Zeng" . "zenoes@qq.com"))]) + (cssh . [(20150810 1709) nil "clusterssh implementation for emacs" single ((:commit . "2fe2754235225a59b63f08b130cfd4352e2e1c3f") (:authors ("Dimitri Fontaine" . "dim@tapoueh.org")) (:maintainer "Dimitri Fontaine" . "dim@tapoueh.org") (:keywords "clusterssh" "ssh" "cssh") (:url . "http://tapoueh.org/emacs/cssh.html"))]) + (csv . [(20161113 1510) nil "Functions for reading and parsing CSV files." single ((:commit . "aa1dfa1263565d5fac3879c21d8ddf5f8915e411") (:authors ("Ulf Jasper" . "ulf.jasper@web.de")) (:maintainer "Ulf Jasper" . "ulf.jasper@web.de") (:keywords "extensions" "data" "csv"))]) + (ct . [(20210219 1344) ((emacs (26 1)) (dash (2 18 0)) (hsluv (1 0 0))) "Color Tools - a color api" single ((:commit . "c302ee94feee0c5efc511e8f9fd8cb2f6dfe3490") (:authors ("neeasade")) (:maintainer "neeasade") (:keywords "convenience" "color" "theming" "rgb" "hsv" "hsl" "cie-lab" "background") (:url . "https://github.com/neeasade/ct.el"))]) + (ctable . [(20210128 629) ((emacs (24 3)) (cl-lib (0 5))) "Table component for Emacs Lisp" single ((:commit . "48b73742757a3ae5736d825fe49e00034cc453b5") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "table") (:url . "https://github.com/kiwanami/emacs-ctable"))]) + (ctags-update . [(20190609 613) nil "(auto) update TAGS in parent directory using exuberant-ctags" single ((:commit . "67faf248b92388442958a069263c62a345425a1b") (:authors (nil . "Joseph(纪秀峰) jixiuf@gmail.com")) (:maintainer nil . "Joseph(纪秀峰) jixiuf@gmail.com") (:keywords "exuberant-ctags" "etags") (:url . "https://github.com/jixiuf/ctags-update"))]) + (ctl-mode . [(20151202 1006) nil "Major mode for editing GrADS script files" single ((:commit . "1a13051db21b999c7682a015b33a03096ff9d891") (:authors ("Joe Wielgosz" . "joew@cola.iges.org")) (:maintainer "Joe Wielgosz" . "joew@cola.iges.org") (:keywords "grads" "script" "major-mode"))]) + (ctrlf . [(20220509 2344) ((emacs (25 1))) "Emacs finally learns how to ctrl+F" single ((:commit . "d37d7a997e1e3ef5e2223aeecbbef92f369b0760") (:authors ("Radian LLC" . "contact+ctrlf@radian.codes")) (:maintainer "Radian LLC" . "contact+ctrlf@radian.codes") (:keywords "extensions") (:url . "https://github.com/radian-software/ctrlf"))]) + (ctrlxo . [(20201021 701) ((emacs (25 1))) "Switch to the most recently used window" single ((:commit . "8ad95a81bd1ece06ebe40e2a83490775db64b419") (:authors ("Andrii Kolomoiets" . "andreyk.mad@gmail.com")) (:maintainer "Andrii Kolomoiets" . "andreyk.mad@gmail.com") (:keywords "frames") (:url . "https://github.com/muffinmad/emacs-ctrlxo"))]) + (ctune . [(20210205 1428) ((emacs (26 1))) "Tune out CC Mode Noise Macros" tar ((:commit . "3f7abc6e74d4e5954b476ba9a1dc652f96b10c05") (:authors ("Mauro Aranda" . "maurooaranda@gmail.com")) (:maintainer "Mauro Aranda" . "maurooaranda@gmail.com") (:keywords "c" "convenience") (:url . "https://github.com/maurooaranda/ctune"))]) + (ctxmenu . [(20140303 2142) ((popup (20140205 103)) (log4e (0 2 0)) (yaxception (0 1))) "Provide a context menu like right-click." tar ((:commit . "5c2376859562b98c07c985d2b483658e4c0e888e") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "popup") (:url . "https://github.com/aki2o/emacs-ctxmenu"))]) + (cubicaltt . [(20171108 1402) ((emacs (24 1)) (cl-lib (0 5))) "Mode for cubical type theory" single ((:commit . "a5c6f94bfc0da84e214641e0b87aa9649ea114ea") (:keywords "languages") (:url . "https://github.com/mortberg/cubicaltt"))]) + (cubicle-mode . [(20171009 1957) nil "Major mode for the Cubicle model checker" single ((:commit . "00f09bb2d4bb496549775e770d7ada08bc1e4866") (:authors ("Alain Mebsout")) (:maintainer "Alain Mebsout"))]) + (cucumber-goto-step . [(20131210 519) ((pcre2el (1 5))) "Jump to cucumber step definition" single ((:commit . "f2713ffb26ebe1b757d1f2ea80e900b55e5895aa") (:authors ("Glen Stampoultzis" . "gstamp@gmail.com")) (:maintainer "Glen Stampoultzis" . "gstamp@gmail.com") (:url . "http://orthogonal.me"))]) + (cuda-mode . [(20201013 2230) nil "NVIDIA CUDA Major Mode" single ((:commit . "7f593518fd135fc6af994024bcb47986dfa502d2") (:authors ("Jack Morrison" . "jackmorrison1@gmail.com")) (:maintainer "Jack Morrison" . "jackmorrison1@gmail.com") (:keywords "c" "languages"))]) + (cue-mode . [(20220507 1728) ((emacs (25 1))) "Major mode for CUE language files" single ((:commit . "598c9b33b888e067e7472710a5f159cee98a0307") (:authors ("Russell Sim" . "russell.sim@gmail.com")) (:maintainer "Russell Sim" . "russell.sim@gmail.com") (:keywords "data" "languages") (:url . "https://github.com/russell/cue-mode"))]) + (curl-to-elisp . [(20201124 1012) ((emacs (25 1))) "Convert cURL command to Emacs Lisp code" single ((:commit . "63d8d9c6d5efb8af8aa88042bfc0690ba699ef64") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:keywords "lisp") (:url . "https://github.com/xuchunyang/curl-to-elisp"))]) + (currency-convert . [(20210427 2032) ((emacs (24 4))) "Currency converter" single ((:commit . "12805ea66aa8421de5eedda39d23f709de634460") (:authors ("Lassi Kortela" . "lassi@lassi.io")) (:maintainer "Lassi Kortela" . "lassi@lassi.io") (:keywords "comm" "convenience" "i18n") (:url . "https://github.com/lassik/emacs-currency-convert"))]) + (current-word-highlight . [(20210323 1401) nil "Highlight the current word minor mode" single ((:commit . "d860f4e170ffa4cef840da93647f458cc409d554") (:authors ("Kijima Daigo" . "norimaking777@gmail.com")) (:maintainer "Kijima Daigo" . "norimaking777@gmail.com") (:keywords "highlight" "face" "convenience" "word") (:url . "https://github.com/kijimaD/current-word-highlight"))]) + (curry-on-theme . [(20210322 1717) ((emacs (24 1))) "A low contrast color theme" single ((:commit . "b53a61d443cc75906d9f97e19f19be71f1e19bc4") (:authors ("Martín Varela" . "martin@varela.fi")) (:maintainer "Martín Varela" . "martin@varela.fi") (:url . "https://github.com/mvarela/Curry-On-Theme"))]) + (cursor-flash . [(20210722 445) ((emacs (24 3))) "Highlight the cursor on buffer/window-switch" single ((:commit . "6bb54a1e2e1bf9df80926718b1b8b9ee49080484") (:keywords "convenience" "faces" "maint") (:url . "https://github.com/Boruch-Baum/emacs-cursor-flash"))]) + (cursor-test . [(20131207 1732) ((emacs (24))) "testing library for cursor position in emacs." single ((:commit . "e09956e048b88fd2ee8dd90b5678baed8b04d31b") (:authors ("ainame")) (:maintainer "ainame") (:url . "https://github.com/ainame/cursor-test.el"))]) + (cwl-mode . [(20210510 1150) ((yaml-mode (0 0 13)) (emacs (24 4))) "A major mode for editing CWL" single ((:commit . "23a333119efaac78453cba95d316109805bd6aec") (:authors ("Tomoya Tanjo" . "ttanjo@gmail.com")) (:maintainer "Tomoya Tanjo" . "ttanjo@gmail.com") (:keywords "languages" "cwl" "common workflow language") (:url . "https://github.com/tom-tan/cwl-mode"))]) + (cyberpunk-2019-theme . [(20191008 1133) ((emacs (24 1))) "A retina-scorching cyberpunk theme" single ((:commit . "7e40c37210c363b2819fd9bb98a73101d7a3c206") (:authors ("Alex Lynham" . "alex@lynh.am")) (:maintainer "Alex Lynham" . "alex@lynh.am") (:keywords "cyberpunk" "theme" "themes") (:url . "https://github.com/the-frey/cyberpunk-2019"))]) + (cyberpunk-theme . [(20200601 1632) nil "Cyberpunk Color Theme" single ((:commit . "cbd0d7193e69ff9e98262eb06aee3d27667ff5f5") (:authors ("Nicholas M. Van Horn" . "nvanhorn@protonmail.com")) (:maintainer "Nicholas M. Van Horn" . "nvanhorn@protonmail.com") (:keywords "color" "theme" "cyberpunk") (:url . "https://github.com/n3mo/cyberpunk-theme.el"))]) + (cycbuf . [(20131203 2037) nil "Cycle buffers, inspired by swbuff.el, swbuff-x.el, and bs.el" single ((:commit . "1079b41c3eb27d65b66d4399959bb6253f84858e") (:authors ("Martin Pohlack martinp (at) gmx.de")) (:maintainer "Martin Pohlack martinp (at) gmx.de") (:keywords "files" "convenience" "buffer switching") (:url . "https://github.com/martinp26/cycbuf"))]) + (cycle-at-point . [(20220507 1118) ((emacs (28 1)) (recomplete (0 2))) "Cycle (rotate) the thing under the cursor" tar ((:commit . "85750fa695797b95608b331b64ea49d81f7c8a36") (:authors ("Campbell Barton")) (:maintainer "Campbell Barton") (:keywords "convenience") (:url . "https://codeberg.com/ideasman42/emacs-cycle-at-point"))]) + (cycle-resize . [(20160521 1557) nil "Cycle resize the current window horizontally or vertically" single ((:commit . "7d255d6fe85f12c967a0f7fcfcf18633be194c88") (:authors ("Pierre Lecocq")) (:maintainer "Pierre Lecocq") (:url . "https://github.com/pierre-lecocq/cycle-resize"))]) + (cycle-themes . [(20150403 309) ((cl-lib (0 5))) "A global minor mode to make switching themes easier" single ((:commit . "6e125d11fdbc6b78fc9f219eb2609a5e29815898") (:keywords "themes" "utility" "global minor mode") (:url . "http://github.com/toroidal-code/cycle-themes.el"))]) + (cyphejor . [(20210816 1607) ((emacs (24 4))) "Shorten major mode names using user-defined rules" single ((:commit . "576d237a46be79449a22e3a7912a3464d7b0c233") (:authors ("Mark Karpov" . "markkarpov92@gmail.com")) (:maintainer "Mark Karpov" . "markkarpov92@gmail.com") (:keywords "mode-line" "major-mode") (:url . "https://github.com/mrkkrp/cyphejor"))]) + (cypher-mode . [(20151110 1142) nil "major mode for editing cypher scripts" single ((:commit . "ce8543d7877c736c574a17b49874c9dcdc7a06d6") (:authors ("François-Xavier Bois ")) (:maintainer "François-Xavier Bois") (:keywords "cypher" "graph") (:url . "http://github.com/fxbois/cypher-mode"))]) + (cython-mode . [(20211111 1407) nil "Major mode for editing Cython files" single ((:commit . "812585935131125f8988c38417bb73bfd5a81c05"))]) + (czech-holidays . [(20160113 1752) nil "Adds a list of Czech public holidays to Emacs calendar" single ((:commit . "d136fa09a152b3cd80db6d55c7b4ddfe07b90fbf") (:authors ("David Chkhikvadze" . "david.chk@outlook.com")) (:maintainer "David Chkhikvadze" . "david.chk@outlook.com") (:keywords "calendar"))]) + (d-mode . [(20210119 1853) ((emacs (25 1))) "D Programming Language major mode for (X)Emacs" single ((:commit . "199743df55c6bfce3cdb08405bd8519768c8dfa9") (:authors ("William Baxter")) (:maintainer "Russel Winder" . "russel@winder.org.uk") (:keywords "d" "programming" "language" "emacs" "cc-mode"))]) + (dactyl-mode . [(20140906 1725) nil "Major mode for editing Pentadactyl config files" single ((:commit . "cc55fe6b987271d9647492b8df4c812d884f661f") (:keywords "languages" "vim") (:url . "https://github.com/luxbock/dactyl-mode"))]) + (dad-joke . [(20170928 658) ((emacs (24))) "Get/display dad jokes" single ((:commit . "bee47e7b746b403228fa7d7361cb095de19ac9ba") (:authors ("Dave Pearson" . "davep@davep.org")) (:maintainer "Dave Pearson" . "davep@davep.org") (:keywords "games") (:url . "https://github.com/davep/dad-joke.el"))]) + (daemons . [(20211214 1251) ((emacs (25 1))) "UI for managing init system daemons (services)" tar ((:commit . "e18e84ccc13101f1609c213029cf011ae0ad1178") (:authors ("Chris Bowdon")) (:maintainer "Chris Bowdon") (:keywords "unix" "convenience") (:url . "https://github.com/cbowdon/daemons.el"))]) + (dakrone-light-theme . [(20170808 2140) nil "dakrone's custom light theme" single ((:commit . "06f198dc8b4ca7421990b30a23d89c8e0b8c5de4") (:authors ("Lee Hinman ")) (:maintainer "Lee Hinman ") (:keywords "color" "themes" "faces") (:url . "https://github.com/dakrone/dakrone-light-theme"))]) + (dakrone-theme . [(20170801 1933) nil "dakrone's custom dark theme" single ((:commit . "232ad1be5f3572dcbdf528f1655109aa355a6937") (:authors ("Lee Hinman ")) (:maintainer "Lee Hinman ") (:keywords "color" "themes") (:url . "https://github.com/dakrone/dakrone-theme"))]) + (danneskjold-theme . [(20220316 1101) nil "Beautiful high-contrast Emacs theme." tar ((:commit . "054c0b9bc9cefb53a4065096e66707d20885c461") (:authors ("Dmitry Akatov" . "akatovda@yandex.com")) (:maintainer "Dmitry Akatov" . "akatovda@yandex.com") (:url . "https://github.com/rails-to-cosmos/"))]) + (dante . [(20220429 1454) ((dash (2 12 0)) (emacs (25 1)) (f (0 19 0)) (flycheck (0 30)) (company (0 9)) (haskell-mode (13 14)) (s (1 11 0)) (lcr (1 0))) "Development mode for Haskell" single ((:commit . "b81081c2eb8dcbd7e67e05cf5e1991df6cf3e57c") (:authors ("Jean-Philippe Bernardy" . "jeanphilippe.bernardy@gmail.com")) (:maintainer "Jean-Philippe Bernardy" . "jeanphilippe.bernardy@gmail.com") (:keywords "haskell" "tools") (:url . "https://github.com/jyp/dante"))]) + (dap-mode . [(20220509 1638) ((emacs (26 1)) (dash (2 18 0)) (lsp-mode (6 0)) (bui (1 1 0)) (f (0 20 0)) (s (1 12 0)) (lsp-treemacs (0 1)) (posframe (0 7 0)) (ht (2 3))) "Debug Adapter Protocol mode" tar ((:commit . "61b5938d9a61882c2e76c58ca7f70e9337ddba00") (:authors ("Ivan Yonchovski" . "yyoncho@gmail.com")) (:maintainer "Ivan Yonchovski" . "yyoncho@gmail.com") (:keywords "languages" "debug") (:url . "https://github.com/emacs-lsp/dap-mode"))]) + (darcsum . [(20190316 2215) nil "a pcl-cvs like interface for managing darcs patches" single ((:commit . "6a8b690539d133c5e3d17cb23fe4365fbb6fb493") (:authors ("John Wiegley" . "johnw@gnu.org")) (:maintainer "John Wiegley" . "johnw@gnu.org") (:keywords "completion" "convenience" "tools" "vc"))]) + (darcula-theme . [(20171227 1845) nil "Inspired by IntelliJ's Darcula theme" single ((:commit . "d9b82b58ded9014985be6658f4ab17e26ed9e93e") (:authors ("Sam Halliday" . "Sam.Halliday@gmail.com")) (:maintainer "Sam Halliday" . "Sam.Halliday@gmail.com") (:keywords "faces") (:url . "https://gitlab.com/fommil/emacs-darcula-theme"))]) + (dark-krystal-theme . [(20170808 1300) ((emacs (24 0))) "an Emacs 24 theme based on Dark Krystal (tmTheme)" single ((:commit . "79084b99665dc9ffb0ec62cc092349a5ecebebbc") (:authors ("Jason Milkins")) (:maintainer "Jason Milkins") (:url . "https://github.com/emacsfodder/tmtheme-to-deftheme"))]) + (dark-mint-theme . [(20160302 642) nil "dark & minty fresh theme" single ((:commit . "95c30a26de31549cd341184ba9ab2be8fdc67eba"))]) + (dark-souls . [(20140314 1128) nil "Prepare to die" single ((:commit . "94122b1215423e58dcf18584a2bd022029d54d4b") (:authors ("Tom Jakubowski" . "tom@crystae.net")) (:maintainer "Tom Jakubowski" . "tom@crystae.net") (:keywords "games") (:url . "http://github.com/tomjakubowski/dark-souls.el"))]) + (darkburn-theme . [(20170423 1652) nil "A not-so-low contrast color theme for Emacs." single ((:commit . "0af794ff7fac19778ac8a7efb92455c6f6c2158f") (:authors ("Jonas Gorauskas" . "jgorauskas@gmail.com")) (:maintainer "Jonas Gorauskas" . "jgorauskas@gmail.com") (:url . "http://github.com/gorauskas/darkburn-theme"))]) + (darkmine-theme . [(20160406 624) nil "Yet another emacs dark color theme." single ((:commit . "7f7e82ca03bcad52911fa41fb3e204e32d6ee63e") (:authors ("Pierre Lecocq" . "pierre.lecocq@gmail.com")) (:maintainer "Pierre Lecocq" . "pierre.lecocq@gmail.com") (:url . "https://github.com/pierre-lecocq/darkmine-theme"))]) + (darkokai-theme . [(20200614 1452) nil "A darker variant on Monokai." single ((:commit . "5820aeddfc8c869ba840cc534eba776936656a66") (:url . "http://github.com/sjrmanning/darkokai"))]) + (darktooth-theme . [(20201215 822) ((autothemer (0 2))) "From the darkness... it watches" single ((:commit . "ec03b30ee7f43f89ca4c382bb3fe4ee560c028a8") (:url . "http://github.com/emacsfodder/emacs-theme-darktooth"))]) + (dart-mode . [(20220401 0) ((emacs (24 3))) "Major mode for editing Dart files" single ((:commit . "9c846769abd37f7fdc7ba8388d1f3a2b844b75e3") (:authors ("https://github.com/bradyt/dart-mode/issues")) (:maintainer "https://github.com/bradyt/dart-mode/issues") (:keywords "languages") (:url . "https://github.com/bradyt/dart-mode"))]) + (dart-server . [(20210501 1445) ((emacs (24 5)) (cl-lib (0 5)) (dash (2 10 0)) (flycheck (0 23)) (s (1 10))) "Minor mode for editing Dart files" single ((:commit . "75562baf9a89b7e314bc2f795f6ecdc5d1f2cc8c") (:authors ("Natalie Weizenbaum") ("Brady Trainor" . "mail@bradyt.com")) (:maintainer "Brady Trainor" . "mail@bradyt.com") (:keywords "languages") (:url . "https://github.com/bradyt/dart-server"))]) + (dash . [(20220417 2250) ((emacs (24))) "A modern list library for Emacs" tar ((:commit . "7fd71338dce041b352f84e7939f6966f4d379459") (:authors ("Magnar Sveen" . "magnars@gmail.com")) (:maintainer "Magnar Sveen" . "magnars@gmail.com") (:keywords "extensions" "lisp") (:url . "https://github.com/magnars/dash.el"))]) + (dash-alfred . [(20191024 450) ((emacs (25 1))) "Search Dash documentation via Dash-Alfred-Workflow" single ((:commit . "fcd21bd6c7eb5cd31377be970406ff3d2454bd5c") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:keywords "docs") (:url . "https://github.com/xuchunyang/dash-alfred.el"))]) + (dash-at-point . [(20211023 104) nil "Search the word at point with Dash" single ((:commit . "fba1a6f42ea51d05110e12c62bdced664059eb55") (:authors ("Shinji Tanaka" . "shinji.tanaka@gmail.com")) (:maintainer "Shinji Tanaka" . "shinji.tanaka@gmail.com") (:url . "https://github.com/stanaka/dash-at-point"))]) + (dash-docs . [(20210830 926) ((emacs (24 4)) (cl-lib (0 5)) (async (1 9 3))) "Offline documentation browser using Dash docsets." tar ((:commit . "29848b6b347ac520f7646c200ed2ec36cea3feda") (:authors ("Raimon Grau" . "raimonster@gmail.com") ("Toni Reina " . "areina0@gmail.com") ("Bryan Gilbert" . "bryan@bryan.sh")) (:maintainer "Raimon Grau" . "raimonster@gmail.com") (:keywords "docs") (:url . "http://github.com/areina/helm-dash"))]) + (dash-functional . [(20210210 1449) ((dash (2 18 0))) "Collection of useful combinators for Emacs Lisp" single ((:commit . "7fd71338dce041b352f84e7939f6966f4d379459") (:authors ("Matus Goljer" . "matus.goljer@gmail.com") ("Magnar Sveen" . "magnars@gmail.com")) (:maintainer "Matus Goljer" . "matus.goljer@gmail.com") (:keywords "extensions" "lisp") (:url . "https://github.com/magnars/dash.el"))]) + (dashboard . [(20220409 620) ((emacs (26 1))) "A startup screen extracted from Spacemacs" tar ((:commit . "0a86c0eabe6bb5e188e6ae915d971103248a3d26") (:authors ("Rakan Al-Hneiti" . "rakan.alhneiti@gmail.com")) (:maintainer "Jesús Martínez" . "jesusmartinez93@gmail.com") (:keywords "startup" "screen" "tools" "dashboard") (:url . "https://github.com/emacs-dashboard/emacs-dashboard"))]) + (dashboard-hackernews . [(20190109 205) ((emacs (24)) (dashboard (1 2 5)) (request (0 3 0))) "Display Hacker News on dashboard" single ((:commit . "b71814716d8f78181b9d1990f06072460de0797e") (:authors ("Hayato KAJIYAMA" . "kaji1216@gmail.com")) (:maintainer "Hayato KAJIYAMA" . "kaji1216@gmail.com") (:url . "https://github.com/hyakt/emacs-dashboard-hackernews"))]) + (dashboard-ls . [(20220326 628) ((emacs (24 3)) (dashboard (1 2 5))) "Display files/directories in current directory on Dashboard" single ((:commit . "f9e199a20c654c3d1d8f405fdec9acb294afc004") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/emacs-dashboard/dashboard-ls"))]) + (dashboard-project-status . [(20190202 1354) ((emacs (24)) (git (0 1 1)) (dashboard (1 2 5))) "Display a git project status in a dashboard widget." single ((:commit . "7675c138e9df8fe2c626e7ba9bbb8b6717671a41") (:authors ("Jason Duncan" . "jasond496@msn.com")) (:maintainer "Jason Duncan" . "jasond496@msn.com") (:url . "https://github.com/functionreturnfunction/dashboard-project-status"))]) + (date-at-point . [(20150308 1243) nil "Add `date' to `thing-at-point' function" single ((:commit . "38df823d05df08ec0748a4185113fae5f99090e9") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "convenience") (:url . "https://github.com/alezost/date-at-point.el"))]) + (date-field . [(20141129 105) ((dash (2 9 0)) (log4e (0 2 0)) (yaxception (0 3 2))) "Date widget" single ((:commit . "11c9170d1f7b343233f7716d4c0a62be024c1654") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "widgets") (:url . "https://github.com/aki2o/emacs-date-field"))]) + (date2name . [(20190630 933) ((emacs (24 4))) "Package to prepend ISO Timestamps to files" single ((:commit . "386dbe73678705d6107cd5c9bdeb4f7c97632360") (:authors ("Max Beutelspacher")) (:maintainer "Max Beutelspacher") (:keywords "files" "convenience") (:url . "https://github.com/DerBeutlin/date2name.el"))]) + (datetime . [(20211016 1656) ((emacs (24 4)) (extmap (1 1 1))) "Parsing, formatting and matching timestamps" tar ((:commit . "77dc214d9ae853c7206ae95cc92d720445c1eeb4") (:authors ("Paul Pogonyshev" . "pogonyshev@gmail.com")) (:maintainer "Paul Pogonyshev" . "pogonyshev@gmail.com") (:keywords "lisp" "i18n") (:url . "https://github.com/doublep/datetime"))]) + (datetime-format . [(20160612 1715) nil "Datetime functions" single ((:commit . "e6427538b547cbe02e1bd6ed4b765c73620bdae8") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "datetime" "calendar") (:url . "https://github.com/zonuexe/emacs-datetime"))]) + (datomic-snippets . [(20180817 1045) ((s (1 4 0)) (dash (1 2 0)) (yasnippet (0 6 1))) "Yasnippets for Datomic" tar ((:commit . "4a14228840d5252e13d2bf6209670f26345bbb84") (:authors ("Magnar Sveen" . "magnars@gmail.com")) (:maintainer "Magnar Sveen" . "magnars@gmail.com") (:keywords "snippets"))]) + (dayone . [(20160105 1240) ((uuid (0 0 3)) (mustache (0 22)) (ht (1 5))) "Utility script for Day One" tar ((:commit . "ab628274f0806451f23bce16f62a6a11cbf91a2b") (:authors ("mori-dev" . "mori.dev.asdf@gmail.com")) (:maintainer "mori-dev" . "mori.dev.asdf@gmail.com") (:keywords "day one" "tools" "convenience") (:url . "https://github.com/mori-dev/emacs-dayone"))]) + (db . [(20140421 2111) ((kv (0 0 11))) "A database for EmacsLisp" single ((:commit . "b3a423fb8e72f9013009cbe033d654df2ce31438") (:authors ("Nic Ferrier" . "nferrier@ferrier.me.uk")) (:maintainer "Nic Ferrier" . "nferrier@ferrier.me.uk") (:keywords "data" "lisp"))]) + (db-pg . [(20130131 1902) ((pg (0 12)) (db (0 0 6))) "A PostgreSQL adapter for emacs-db" single ((:commit . "7d5ab86b74b05fe003b3b434d4835f37f3f3eded") (:authors ("Nic Ferrier" . "nic@ferrier.me.uk")) (:maintainer "Nic Ferrier" . "nic@ferrier.me.uk") (:keywords "data" "comm" "database" "postgresql"))]) + (dbc . [(20201001 1452) ((emacs (24 4)) (cl-lib (0 5)) (ht (2 3))) "Control how to open buffers" single ((:commit . "6728e72f72347d098b7d75ac4c29a7d687cc9ed3") (:authors ("Matsievskiy S.V.")) (:maintainer "Matsievskiy S.V.") (:keywords "convenience") (:url . "https://gitlab.com/matsievskiysv/display-buffer-control"))]) + (ddskk . [(20220501 2005) ((ccc (1 43)) (cdb (20141201 754))) "Simple Kana to Kanji conversion program." tar ((:commit . "c664b26d0861621ac86b5b5f47835dd84f06dc93"))]) + (ddskk-posframe . [(20200812 917) ((emacs (26 1)) (posframe (0 4 3)) (ddskk (16 2 50))) "Show Henkan tooltip for ddskk via posframe" single ((:commit . "299493dd951e5a0b43b8213321e3dc0bac10f762") (:authors ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "Naoya Yamashita" . "conao3@gmail.com") (:keywords "tooltip" "convenience" "posframe") (:url . "https://github.com/conao3/ddskk-posframe.el"))]) + (deadgrep . [(20220507 1755) ((emacs (25 1)) (dash (2 12 0)) (s (1 11 0)) (spinner (1 7 3))) "fast, friendly searching with ripgrep" single ((:commit . "ae333e4069e296e98bf9631088c8198f50891d55") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk") (:keywords "tools") (:url . "https://github.com/Wilfred/deadgrep"))]) + (debian-el . [(20211006 1939) nil "Emacs helpers specific to Debian users" tar ((:commit . "a3ef20c269b9192710567571b20718f572942bc4"))]) + (debpaste . [(20160113 2347) ((xml-rpc (1 6 7))) "Interface for getting/posting/deleting pastes from paste.debian.net" single ((:commit . "6f2a400665062468ebd03a2ce1de2a73d9084958") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "paste") (:url . "http://github.com/alezost/debpaste.el"))]) + (debug-print . [(20140126 19) ((emacs (24))) "A nice printf debugging environment by the way Gauche do" single ((:commit . "d817fd9ea2d3f8d2c1ace4d8af155684f3a99dc5") (:authors ("Ken Okada" . "keno.ss57@gmail.com")) (:maintainer "Ken Okada" . "keno.ss57@gmail.com") (:keywords "extensions" "lisp" "tools" "maint") (:url . "https://github.com/kenoss/debug-print"))]) + (decide . [(20220319 1927) nil "rolling dice and other random things" single ((:commit . "b4feee9d5ad32c7b73ab3e1da5cfcdab532754c2") (:authors ("Pelle Nilsson" . "perni@lysator.liu.se")) (:maintainer "Pelle Nilsson" . "perni@lysator.liu.se"))]) + (decl . [(20220102 1310) ((dash (2 5 0)) (emacs (24 3)) (cl-lib (0 3))) "Library for organizing code declaratively" single ((:commit . "9e6e2395e1f739e390697c35a9af99452642869e") (:authors ("Preetpal S. Sohal")) (:maintainer "Preetpal S. Sohal") (:url . "https://github.com/preetpalS/decl.el"))]) + (declutter . [(20220310 2101) ((emacs (25 1))) "Read html content and (some) paywall sites without clutter" single ((:commit . "8ac50a64dc3a12440d98bc1556b5c7727fdf51ed") (:authors ("Sanel Zukan" . "sanelz@gmail.com")) (:maintainer "Sanel Zukan" . "sanelz@gmail.com") (:keywords "html" "hypermedia" "terminals") (:url . "http://www.github.com/sanel/declutter"))]) + (dedicated . [(20151202 110) nil "A very simple minor mode for dedicated buffers" single ((:commit . "f47b504c0c56fa5ab9d1028417ca1f65a713a2f0") (:authors ("Eric Crampton" . "eric@atdesk.com")) (:maintainer "Eric Crampton" . "eric@atdesk.com") (:keywords "dedicated" "buffer"))]) + (dedukti-mode . [(20171103 1212) nil "Major mode for Dedukti files" single ((:commit . "d7c3505a1046187de3c3aeb144455078d514594e") (:authors ("Raphaël Cauderlier")) (:maintainer "Raphaël Cauderlier") (:keywords "languages" "dedukti") (:url . "https://github.com/rafoo/dedukti-mode"))]) + (default-font-presets . [(20220507 1118) ((emacs (26 1))) "Support selecting fonts from a list of presets" single ((:commit . "7117ddadafcf0264c19b7a6bb912d52efe5553f9") (:authors ("Campbell Barton" . "ideasman42@gmail.com")) (:maintainer "Campbell Barton" . "ideasman42@gmail.com") (:url . "https://codeberg.com/ideasman42/emacs-default-font-presets"))]) + (default-text-scale . [(20191226 2234) ((emacs (24))) "Easily adjust the font size in all frames" single ((:commit . "bfc0987c37e93742255d3b23d86c17096fda8e7e") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "frames" "faces") (:url . "https://github.com/purcell/default-text-scale"))]) + (deferred . [(20170901 1330) ((emacs (24 4))) "Simple asynchronous functions for emacs lisp" single ((:commit . "2239671d94b38d92e9b28d4e12fd79814cfb9c16") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "deferred" "async") (:url . "https://github.com/kiwanami/emacs-deferred"))]) + (define-it . [(20220414 932) ((emacs (25 1)) (s (1 12 0)) (request (0 3 0)) (popup (0 5 3)) (pos-tip (0 4 6)) (posframe (1 1 7)) (google-translate (0 11 18)) (wiki-summary (0 1))) "Define, translate, wiki the word" single ((:commit . "51fd884c52faf61339aef3a3429fe91672b3e6a8") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/define-it"))]) + (define-word . [(20220104 1848) ((emacs (24 3))) "display the definition of word at point." single ((:commit . "31a8c67405afa99d0e25e7c86a4ee7ef84a808fe") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "dictionary" "convenience") (:url . "https://github.com/abo-abo/define-word"))]) + (defproject . [(20151201 2219) ((emacs (24))) "Manager dir-locals and project specific variables" single ((:commit . "674d48a5e34cb4bba76faa38ee901322ec649086") (:authors (nil . "")) (:maintainer nil . "") (:keywords "convenience") (:url . "https://github.com/kotfic/defproject"))]) + (defrepeater . [(20180830 410) ((emacs (25 2)) (s (1 12 0))) "Easily make commands repeatable" single ((:commit . "9c027a2561fe141dcfb79f75fcaee36cd0386ec1") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "convenience") (:url . "http://github.com/alphapapa/defrepeater.el"))]) + (deft . [(20210707 1633) nil "quickly browse, filter, and edit plain text notes" single ((:commit . "28be94d89bff2e1c7edef7244d7c5ba0636b1296") (:authors ("Jason R. Blevins" . "jrblevin@xbeta.org")) (:maintainer "Jason R. Blevins" . "jrblevin@xbeta.org") (:keywords "plain text" "notes" "simplenote" "notational velocity") (:url . "https://jblevins.org/projects/deft/"))]) + (delim-kill . [(20100517 620) nil "Kill text between delimiters." single ((:commit . "1dbe47344f2d2cbc8c54beedf0cf0bf10fd203c1") (:authors ("Thomas Kappler" . "tkappler@gmail.com")) (:maintainer "Thomas Kappler" . "tkappler@gmail.com") (:keywords "convenience" "languages") (:url . "http://github.com/thomas11/delim-kill/tree/master"))]) + (demangle-mode . [(20210822 2210) ((cl-lib (0 1)) (emacs (24 3))) "Automatically demangle C++, D, and Rust symbols" single ((:commit . "04f545adab066708d6151f13da65aaf519f8ac4e") (:authors ("Ben Liblit" . "liblit@acm.org")) (:maintainer "Ben Liblit" . "liblit@acm.org") (:keywords "c" "tools") (:url . "https://github.com/liblit/demangle-mode"))]) + (demap . [(20220322 2309) ((emacs (25 1))) "Detachable minimap package" tar ((:commit . "c42ec4752544f80ca7c172ff65e705a56089bc96") (:authors ("Sawyer Gardner ")) (:maintainer "Sawyer Gardner ") (:keywords "lisp" "tools" "convenience") (:url . "https://gitlab.com/sawyerjgardner/demap.el"))]) + (demo-it . [(20211221 2152) nil "Create demonstrations" tar ((:commit . "e399fd7ceb73caeae7cb50b247359bafcaee2a3f") (:authors ("Howard Abrams" . "howard.abrams@gmail.com")) (:maintainer "Howard Abrams" . "howard.abrams@gmail.com") (:keywords "demonstration" "presentation" "test"))]) + (deno-fmt . [(20200520 1838) ((emacs (24))) "Minor mode for using deno fmt on save" single ((:commit . "3b193eef576e2c14fdcf350495955e6e8546dddd") (:authors ("Russell Clarey ")) (:maintainer "Russell Clarey ") (:url . "https://github.com/russell/deno-emacs"))]) + (describe-hash . [(20200718 1556) nil "Help function for examining a hash map" single ((:commit . "18e69a932d5495c8439571ba8f2d2ee123d434b1") (:url . "https://github.com/Junker/describe-hash"))]) + (describe-number . [(20151101 55) ((yabin (1 1))) "Describe arbitrarily large number at point." single ((:commit . "40618345a37831804b29589849a785ef5aa5ac24") (:authors ("Morten Slot Kristensen ")) (:maintainer "Morten Slot Kristensen ") (:keywords "describe" "value" "help") (:url . "https://github.com/netromdk/describe-number"))]) + (desktop+ . [(20170107 2132) ((emacs (24 4)) (dash (2 11 0)) (f (0 17 2))) "Handle special buffers when saving & restoring sessions" single ((:commit . "88055cee526a000056201898499cebbd35e3ea76") (:authors ("François Févotte" . "fevotte@gmail.com")) (:maintainer "François Févotte" . "fevotte@gmail.com") (:url . "https://github.com/ffevotte/desktop-plus"))]) + (desktop-environment . [(20220425 1834) ((emacs (25 1))) "Helps you control your GNU/Linux computer" single ((:commit . "2863dc3d66aed9052c8af39cc8c8c264be300560") (:authors ("Damien Cassou , Nicolas Petton" . "nicolas@petton.fr")) (:maintainer "Damien Cassou , Nicolas Petton" . "nicolas@petton.fr") (:url . "https://gitlab.petton.fr/DamienCassou/desktop-environment"))]) + (desktop-mail-user-agent . [(20210519 1008) ((emacs (24 3))) "Call OS default mail program to compose mail" single ((:commit . "caac672ef7e4ddced960fa31cef3a6ba5d7ab451") (:authors ("Lassi Kortela" . "lassi@lassi.io")) (:maintainer "Lassi Kortela" . "lassi@lassi.io") (:keywords "mail") (:url . "https://github.com/lassik/emacs-desktop-mail-user-agent"))]) + (desktop-registry . [(20140119 2143) nil "Keep a central registry of desktop files" single ((:commit . "244c2e7f9f0a1050aa8a47ad0b38f4e4584682dd") (:authors ("Tom Willemse" . "tom@ryuslash.org")) (:maintainer "Tom Willemse" . "tom@ryuslash.org") (:keywords "convenience") (:url . "http://projects.ryuslash.org/desktop-registry/"))]) + (detour . [(20181122 2138) ((emacs (24 4))) "Take a quick detour and return" single ((:commit . "1ff23c236e18971ed1077840daf047cde79a45ee") (:authors ("Stefan Kamphausen ")) (:maintainer "Stefan Kamphausen ") (:keywords "convenience" "abbrev") (:url . "https://github.com/ska2342/detour/"))]) + (devdocs . [(20220410 1627) ((emacs (27 1))) "Emacs viewer for DevDocs" single ((:commit . "4257e59dafbffb2616d240f84c5c25770ee28cac") (:authors ("Augusto Stoffel" . "arstoffel@gmail.com")) (:maintainer "Augusto Stoffel" . "arstoffel@gmail.com") (:keywords "help") (:url . "https://github.com/astoff/devdocs.el"))]) + (devdocs-browser . [(20211218 949) ((emacs (27 1))) "Browse devdocs.io documents using EWW" single ((:commit . "a46a2cdb83ed27869befe56fea04914a33252b3a") (:authors ("blahgeek" . "i@blahgeek.com")) (:maintainer "blahgeek" . "i@blahgeek.com") (:keywords "docs" "help" "tools") (:url . "https://github.com/blahgeek/emacs-devdocs-browser"))]) + (dfmt . [(20170728 1023) nil "Emacs Interface to D indenting/formatting tool dfmt." single ((:commit . "21b9094e907b7ac53f5ecb4ff4539613a9d12434") (:authors ("Per Nordlöw")) (:maintainer "Kirill Babikhin ") (:keywords "tools" "convenience" "languages" "dlang") (:url . "https://github.com/qsimpleq/elisp-dfmt"))]) + (dhall-mode . [(20200822 258) ((emacs (24 4)) (reformatter (0 3))) "Major mode for the dhall configuration language" single ((:commit . "ad259c8a2292fb398dff1ce7d25c686edb02945d") (:authors ("Sibi Prabakaran" . "sibi@psibi.in")) (:maintainer "Sibi Prabakaran" . "sibi@psibi.in") (:keywords "languages") (:url . "https://github.com/psibi/dhall-mode"))]) + (dianyou . [(20210525 1517) ((emacs (24 4))) "Search and analyze mails in Gnus" single ((:commit . "f77d9e76be5d8022fa6ee5426144f13f38dd09f2") (:authors ("Chen Bin ")) (:maintainer "Chen Bin ") (:keywords "mail") (:url . "http://github.com/redguardtoo/dianyou"))]) + (diary-manager . [(20220508 128) ((emacs (25))) "Simple personal diary" single ((:commit . "c538504e606208fa902d040e54188072df6193d0") (:authors ("Radian LLC" . "contact+diary-manager@radian.codes")) (:maintainer "Radian LLC" . "contact+diary-manager@radian.codes") (:keywords "extensions") (:url . "https://github.com/radian-software/diary-manager"))]) + (dic-lookup-w3m . [(20180526 1621) ((w3m (20120723 324)) (stem (20120826))) "look up dictionaries on the Internet" tar ((:commit . "3254ab10cbf0078c7162557dd1f68dac28459cf9") (:authors ("mcprvmec")) (:maintainer "mcprvmec") (:keywords "emacs-w3m" "w3m" "dictionary"))]) + (dictcc . [(20220219 1302) ((emacs (24 4)) (cl-lib (0 5)) (ivy (0 10 0))) "Look up translations on dict.cc" single ((:commit . "8ecb954fcf193cba138191f8947c8b0b60a1c6c5") (:authors ("Marten Lienen" . "marten.lienen@gmail.com")) (:maintainer "Marten Lienen" . "marten.lienen@gmail.com") (:keywords "convenience"))]) + (dictionary . [(20201001 1727) ((connection (1 11)) (link (1 11))) "Client for rfc2229 dictionary servers" single ((:commit . "bdf0aa7761d1c1a3bc0652b2fdc4a54b3acdb06a") (:authors ("Torsten Hilbrich" . "torsten.hilbrich@gmx.net")) (:maintainer "Torsten Hilbrich" . "torsten.hilbrich@gmx.net") (:keywords "interface" "dictionary"))]) + (didyoumean . [(20200905 1843) ((emacs (24 4))) "Did you mean to open another file?" single ((:commit . "ce5edcce160b86e7f6480f0381be785d43f97e19") (:keywords "convenience") (:url . "https://gitlab.com/kisaragi-hiu/didyoumean.el"))]) + (diff-ansi . [(20220507 1118) ((emacs (27 1))) "Display diff's using alternative diffing tools" single ((:commit . "bfcce7f609a95b4b5e11c384c75fef8c7c972b95") (:authors ("Campbell Barton" . "ideasman42@gmail.com")) (:maintainer "Campbell Barton" . "ideasman42@gmail.com") (:url . "https://codeberg.com/ideasman42/emacs-diff-ansi"))]) + (diff-at-point . [(20220507 1118) ((emacs (26 2))) "Diff navigation" single ((:commit . "aabb96b2b59f0e0d94d7b6889fa30016927ea03d") (:authors ("Campbell Barton" . "ideasman42@gmail.com")) (:maintainer "Campbell Barton" . "ideasman42@gmail.com") (:url . "https://codeberg.com/ideasman42/emacs-diff-at-point"))]) + (diff-hl . [(20220506 2102) ((cl-lib (0 2)) (emacs (25 1))) "Highlight uncommitted changes using VC" tar ((:commit . "14f2db367e8023ab0027713315a38ecd703afdbf") (:authors ("Dmitry Gutov" . "dgutov@yandex.ru")) (:maintainer "Dmitry Gutov" . "dgutov@yandex.ru") (:keywords "vc" "diff") (:url . "https://github.com/dgutov/diff-hl"))]) + (difflib . [(20210224 2242) ((emacs (24 4)) (cl-generic (0 3)) (ht (2 2)) (s (1 12 0))) "Helpers for computing deltas between sequences." single ((:commit . "646fc4388274fe765bbf4661e17a24e4d081250c") (:authors ("Diego A. Mundo" . "dieggsy@pm.me")) (:maintainer "Diego A. Mundo" . "dieggsy@pm.me") (:keywords "matching" "tools" "string") (:url . "http://github.com/dieggsy/difflib.el"))]) + (diffpdf . [(20210626 1447) ((emacs (25 1)) (transient (0 3 0))) "Transient diffpdf" single ((:commit . "a5b203b549e373cb9b0ef3f00c0010bd34dd644a") (:authors ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainer "Shuguang Sun" . "shuguang79@qq.com") (:keywords "tools") (:url . "https://github.com/ShuguangSun/diffpdf.el"))]) + (diffscuss-mode . [(20141014 2357) nil "Major mode for diffscuss files." single ((:commit . "53f2d001bd3a5cb80c6ada16b4e570afd1989a09") (:authors ("Edmund Jorgensen" . "edmund@hut8labs.com")) (:maintainer "Edmund Jorgensen" . "edmund@hut8labs.com") (:keywords "tools"))]) + (diffsync . [(20220502 1513) ((emacs (25 1))) "Use diff to allow syncing of directories" single ((:commit . "3f8540ef0a677ea8c2b57aaf4a07937512bb148c") (:authors ("Bernhard Rotter" . "bernhard@b-rotter.de")) (:maintainer "Bernhard Rotter" . "bernhard@b-rotter.de") (:keywords "tools") (:url . "https://github.com/ber-ro/diffsync"))]) + (diffview . [(20220322 2334) nil "View diffs in side-by-side format" single ((:commit . "af2251a01f532efa819d236802cb3d942befe5a1") (:authors ("Mitchel Humpherys" . "mitch.special@gmail.com")) (:maintainer "Mitchel Humpherys" . "mitch.special@gmail.com") (:keywords "convenience" "diff") (:url . "https://github.com/mgalgs/diffview-mode"))]) + (digistar-mode . [(20210129 1719) nil "major mode for Digistar scripts" single ((:commit . "e12b128023b7696a23545f812877e8c6531d261c") (:authors ("John Foerch" . "jjfoerch@gmail.com")) (:maintainer "John Foerch" . "jjfoerch@gmail.com") (:keywords "languages"))]) + (digit-groups . [(20200506 37) ((dash (2 11 0))) "Highlight place-value positions in numbers" single ((:commit . "7b81930cad19b8b7913b7eedbcb498964bfdcbdb") (:authors ("Michael D. Adams ")) (:maintainer "Michael D. Adams ") (:url . "https://github.com/adamsmd/digit-groups/"))]) + (digitalocean . [(20190607 726) ((request (2 5)) (emacs (24 4))) "Create and manipulate digitalocean droplets" single ((:commit . "6c32d3593286e2a62d9afab0057c829407b0d1e8") (:authors ("Oliver Marks" . "oly@digitaloctave.com")) (:maintainer "Oliver Marks" . "oly@digitaloctave.com") (:keywords "processes" "tools") (:url . "https://github.com/olymk2/emacs-digitalocean"))]) + (digitalocean-helm . [(20180610 746) ((emacs (24 3)) (helm (2 5)) (digitalocean (0 1))) "Create and manipulate digitalocean droplets" single ((:commit . "b125c9882eded7d73ec109d152b26625f333440b") (:authors ("Oliver Marks" . "oly@digitaloctave.com")) (:maintainer "Oliver Marks" . "oly@digitaloctave.com") (:keywords "processes" "tools") (:url . "https://gitlab.com/olymk2/digitalocean-api"))]) + (dilbert . [(20211118 1512) ((emacs (26 1)) (enlive (0 0 1)) (dash (2 19 1))) "View Dilbert comics" single ((:commit . "3e9a39717490be4d5c14211a47fcd8588ef668af") (:authors ("Daniils Petrovs" . "thedanpetrov@gmail.com")) (:maintainer "Daniils Petrovs" . "thedanpetrov@gmail.com") (:keywords "multimedia" "news") (:url . "https://github.com/DaniruKun/dilbert-el"))]) + (dim . [(20160818 949) ((emacs (24 4))) "Change mode-line names of major/minor modes" single ((:commit . "5515f2e8657ef14adcc34aa5b05383a2684328ae") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "convenience") (:url . "https://github.com/alezost/dim.el"))]) + (dim-autoload . [(20220422 1601) ((emacs (25 1)) (compat (28 1 1 0))) "Dim or hide autoload cookie lines" single ((:commit . "81c94b0707d5ddd9a3b9962ee441206db1d25967") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "convenience") (:url . "https://github.com/tarsius/dim-autoload"))]) + (dime . [(20210329 604) ((emacs (25 1)) (dylan (3 0))) "Dylan interaction mode" tar ((:commit . "9d2891e3e06405b75072d296f385fa795aeb9835") (:url . "https://opendylan.org/"))]) + (diminish . [(20220104 1539) ((emacs (24 3))) "Diminished modes are minor modes with no modeline display" single ((:commit . "6b7e837b0cf0129e9d7d6abae48093cf599bb9e8") (:authors ("Will Mengarini" . "seldon@eskimo.com")) (:maintainer "Martin Yrjölä" . "martin.yrjola@gmail.com") (:keywords "extensions" "diminish" "minor" "codeprose") (:url . "https://github.com/myrjola/diminish.el"))]) + (diminish-buffer . [(20220218 1541) ((emacs (24 4))) "Diminish (hide) buffers from buffer-menu" single ((:commit . "3b3b24eb231af889b0eea50e6e0a20c2bca9c439") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/diminish-buffer"))]) + (dimmer . [(20211123 1536) ((emacs (25 1))) "Visually highlight the selected buffer" single ((:commit . "2f915b100044e09dd647b22085e1696249c4b115") (:authors ("Neil Okamoto")) (:maintainer "Neil Okamoto") (:keywords "faces" "editing") (:url . "https://github.com/gonewest818/dimmer.el"))]) + (dionysos . [(20160810 1056) ((libmpdee (2 1 0)) (alert (1 2)) (s (1 11 0)) (dash (2 12 1)) (pkg-info (0 5 0)) (cl-lib (0 5))) "Dionysos, a music player for Emacs" tar ((:commit . "0aac21caadabc5a7f09e18a9dcb02f3dec26588b") (:authors ("Nicolas Lamirault" . "nicolas.lamirault@gmail.com")) (:maintainer "Nicolas Lamirault" . "nicolas.lamirault@gmail.com") (:keywords "music") (:url . "https://github.com/nlamirault/dionysos"))]) + (dir-treeview . [(20220505 27) ((emacs (24 4)) (treeview (1 1 0))) "A directory tree browser and simple file manager" tar ((:commit . "fa0b795b36740755ec37f5b41c3a734ad702e5a1") (:authors ("Tilman Rassy" . "tilman.rassy@googlemail.com")) (:maintainer "Tilman Rassy" . "tilman.rassy@googlemail.com") (:keywords "tools" "convenience" "files") (:url . "https://github.com/tilmanrassy/emacs-dir-treeview"))]) + (dircmp . [(20141204 1756) nil "Compare and sync directories." tar ((:commit . "558ee0b601c2de9d247612085aafe2926f56a09f") (:authors ("Matt McClure -- http://matthewlmcclure.com")) (:maintainer "Matt McClure -- http://matthewlmcclure.com") (:keywords "unix" "tools") (:url . "https://github.com/matthewlmcclure/dircmp-mode"))]) + (dired-atool . [(20210719 404) ((emacs (24))) "Pack/unpack files with atool on dired." single ((:commit . "01416fd5961b901c50686c91cb59b3833adc831b") (:authors ("Hiroki YAMAKAWA" . "s06139@gmail.com")) (:maintainer "Hiroki YAMAKAWA" . "s06139@gmail.com") (:keywords "files") (:url . "https://github.com/HKey/dired-atool"))]) + (dired-avfs . [(20161012 1104) ((dash (2 5 0)) (dired-hacks-utils (0 0 1))) "AVFS support for dired" single ((:commit . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") (:authors ("Matus Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matus Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (dired-collapse . [(20210403 1230) ((dash (2 10 0)) (f (0 19 0)) (dired-hacks-utils (0 0 1))) "Collapse unique nested paths in dired listing" single ((:commit . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (dired-dups . [(20130527 2125) nil "Find duplicate files and display them in a dired buffer" single ((:commit . "694ad128c822c59348ced16c4a0c1356d43da47a") (:authors ("Joe Bloggs" . "vapniks@yahoo.com")) (:maintainer "Joe Bloggs" . "vapniks@yahoo.com") (:keywords "unix") (:url . "https://github.com/vapniks/dired-dups"))]) + (dired-efap . [(20220421 1535) nil "Edit Filename At Point in a dired buffer" single ((:commit . "360b369cb19998c6730ee1debfbec3edb7f349a9") (:authors ("Juan-Leon Lahoz" . "juanleon1@gmail.com")) (:maintainer "Juan-Leon Lahoz" . "juanleon1@gmail.com") (:keywords "dired" "environment" "files" "renaming") (:url . "https://github.com/juan-leon/dired-efap"))]) + (dired-explorer . [(20180607 221) ((cl-lib (0 5))) "minor-mode provides Explorer like select file at dired." single ((:commit . "3ade0a31b5340271d05e9bf443f2504960f6c6dd") (:maintainer "jidaikobo-shibata") (:keywords "dired" "explorer"))]) + (dired-fdclone . [(20220119 717) nil "dired functions and settings to mimic FDclone" single ((:commit . "66e337012e72cebd2485f1efca0b2f78dc9c6252") (:authors ("Akinori MUSHA" . "knu@iDaemons.org")) (:maintainer "Akinori MUSHA" . "knu@iDaemons.org") (:keywords "unix" "directories" "dired") (:url . "https://github.com/knu/dired-fdclone.el"))]) + (dired-filetype-face . [(20180907 1339) nil "Set different faces for different filetypes in dired" single ((:commit . "7ade7f7e8c2d7518c65f3f0343a10c272da0f47e") (:authors ("纪秀峰 ")) (:maintainer "纪秀峰 ") (:keywords "dired" "filetype" "face") (:url . "https://github.com/jixiuf/dired-filetype-face"))]) + (dired-filter . [(20191105 1404) ((dash (2 10 0)) (dired-hacks-utils (0 0 1)) (f (0 17 0)) (cl-lib (0 3))) "Ibuffer-like filtering for dired" single ((:commit . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (dired-git . [(20200527 732) ((emacs (26 1)) (async-await (1 0)) (async (1 9 4)) (all-the-icons (2 2 0)) (ppp (1 0 0))) "Git integration for dired" single ((:commit . "82c93bdb2fe392b122f79d2e425c632f1c69ede3") (:authors ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "Naoya Yamashita" . "conao3@gmail.com") (:keywords "tools") (:url . "https://github.com/conao3/dired-git.el"))]) + (dired-hacks-utils . [(20201005 2318) ((dash (2 5 0))) "Utilities and helpers for dired-hacks collection" single ((:commit . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (dired-hide-dotfiles . [(20210222 1919) ((emacs (25 1))) "Hide dotfiles in dired" single ((:commit . "6a379f23f64045f5950d229254ce6f32dbbf5364") (:authors ("Mattias Bengtsson" . "mattias.jc.bengtsson@gmail.com")) (:maintainer "Mattias Bengtsson" . "mattias.jc.bengtsson@gmail.com") (:keywords "files") (:url . "https://github.com/mattiasb/dired-hide-dotfiles"))]) + (dired-icon . [(20170223 526) ((emacs (24 3))) "A minor mode to display a list of associated icons in dired buffers." tar ((:commit . "f60e10757a5011235b519231ad35974ff25963ed") (:authors ("Hong Xu" . "hong@topbug.net")) (:maintainer "Hong Xu" . "hong@topbug.net") (:keywords "dired" "files") (:url . "https://gitlab.com/xuhdev/dired-icon"))]) + (dired-imenu . [(20140109 1610) nil "imenu binding for dired mode" single ((:commit . "610e21fe0988c85931d34894d3eee2442c79ab0a") (:authors ("Damien Cassou" . "damien.cassou@gmail.com")) (:maintainer "Damien Cassou" . "damien.cassou@gmail.com") (:keywords "dired" "imenu") (:url . "https://github.com/DamienCassou/dired-imenu"))]) + (dired-k . [(20211002 2358) ((emacs (24 3))) "Highlight dired by size, date, git status" tar ((:commit . "1ddd8e0ea06f0e25cd5dedb2370cfa0cacfa8c9d") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Neil Okamoto" . "neil.okamoto+melpa@gmail.com") (:url . "https://github.com/emacsorphanage/dired-k"))]) + (dired-launch . [(20220317 1839) nil "Use dired as a launcher" single ((:commit . "72ebbe2b3d2e04dbfda636fa114d4f47835ce044") (:authors ("David Thompson")) (:maintainer "David Thompson") (:keywords "dired" "launch") (:url . "https://github.com/thomp/dired-launch"))]) + (dired-lsi . [(20200812 929) ((emacs (26 1))) "Add memo to directory and show it in dired" single ((:commit . "0f4038c8b47f6cfc70f82062800700c14c9912c2") (:authors ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "Naoya Yamashita" . "conao3@gmail.com") (:keywords "convenience") (:url . "https://github.com/conao3/dired-lsi.el"))]) + (dired-narrow . [(20181114 1723) ((dash (2 7 0)) (dired-hacks-utils (0 0 1))) "Live-narrowing of search results for dired" single ((:commit . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (dired-open . [(20180922 1113) ((dash (2 5 0)) (dired-hacks-utils (0 0 1))) "Open files from dired using using custom actions" single ((:commit . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (dired-posframe . [(20200817 420) ((emacs (26 1)) (posframe (0 7))) "Peep dired items using posframe" single ((:commit . "1a21eb9ad956a0371dd3c9e1bec53407d685f705") (:authors ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "Naoya Yamashita" . "conao3@gmail.com") (:keywords "convenience") (:url . "https://github.com/conao3/dired-posframe.el"))]) + (dired-quick-sort . [(20201221 403) ((hydra (0 13 0)) (emacs (24))) "Persistent quick sorting of dired buffers in various ways." single ((:commit . "69b06f306a5fc2b38e707bae3ff1e35db2b39b6b") (:authors ("Hong Xu" . "hong@topbug.net")) (:maintainer "Hong Xu" . "hong@topbug.net") (:keywords "convenience" "files") (:url . "https://gitlab.com/xuhdev/dired-quick-sort#dired-quick-sort"))]) + (dired-rainbow . [(20190722 1109) ((dash (2 5 0)) (dired-hacks-utils (0 0 1))) "Extended file highlighting according to its type" single ((:commit . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") (:authors ("Matus Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matus Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (dired-ranger . [(20180401 2206) ((dash (2 7 0)) (dired-hacks-utils (0 0 1))) "Implementation of useful ranger features for dired" single ((:commit . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (dired-recent . [(20211004 1924) ((emacs (24))) "Dired visited paths history" single ((:commit . "a376f53e42fdca80c3286e8111578c65c64b0711") (:authors ("Wojciech Siewierski ")) (:maintainer "Wojciech Siewierski ") (:keywords "files") (:url . "https://github.com/vifon/dired-recent.el"))]) + (dired-rifle . [(20210316 1452) nil "Call rifle(1) from dired" single ((:commit . "cc1af692bbac651f5e5111d9ab1c0805989d65e5") (:authors ("Wojciech Siewierski ")) (:maintainer "Wojciech Siewierski ") (:keywords "files" "convenience") (:url . "https://github.com/vifon/dired-rifle.el"))]) + (dired-rmjunk . [(20191007 1232) nil "A home directory cleanup utility for Dired." single ((:commit . "92af5fcc2bd0bc3826f4ce238a850e9a362533a4") (:authors ("Jakob L. Kreuze" . "zerodaysfordays@sdf.lonestar.org")) (:maintainer "Jakob L. Kreuze" . "zerodaysfordays@sdf.lonestar.org") (:keywords "files" "matching") (:url . "https://git.sr.ht/~jakob/dired-rmjunk"))]) + (dired-rsync . [(20220313 1533) ((s (1 12 0)) (dash (2 0 0)) (emacs (24))) "Allow rsync from dired buffers" tar ((:commit . "b327971d197e95e9b78e7ef92539bd4196a12797") (:authors ("Alex Bennée" . "alex@bennee.com")) (:maintainer "Alex Bennée" . "alex@bennee.com") (:url . "https://github.com/stsquad/dired-rsync"))]) + (dired-sidebar . [(20220413 753) ((emacs (25 1)) (dired-subtree (0 0 1))) "Tree browser leveraging dired" single ((:commit . "0521cdc53e4a7ae7ea4728e5ac9f69287528dc56") (:authors ("James Nguyen" . "james@jojojames.com")) (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "dired" "files" "tools") (:url . "https://github.com/jojojames/dired-sidebar"))]) + (dired-single . [(20211101 2319) nil "Reuse the current dired buffer to visit a directory" single ((:commit . "b254f9b7bfc96a5eab5760a56811f2872d2c590a") (:keywords "dired" "reuse" "buffer") (:url . "https://github.com/crocket/dired-single"))]) + (dired-subtree . [(20210105 1127) ((dash (2 5 0)) (dired-hacks-utils (0 0 1))) "Insert subdirectories in a tree-like fashion" single ((:commit . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "files"))]) + (dired-toggle . [(20190616 303) nil "Show dired as sidebar and will not create new buffers when changing dir" single ((:commit . "7fe5fe35c63d1b0da14d6d6d52bdf6b2a5410ba7") (:authors ("Xu FaSheng ")) (:maintainer "Xu FaSheng") (:keywords "dired" "sidebar") (:url . "https://github.com/fasheng/dired-toggle"))]) + (dired-toggle-sudo . [(20211216 102) nil "Browse directory with sudo privileges." single ((:commit . "9f86cdf858225b15c20affb97ed105e4109047bf") (:authors ("Sebastien Gross ")) (:maintainer "Sebastien Gross ") (:keywords "emacs" "dired"))]) + (dired-view-data . [(20220129 339) ((emacs (26 1)) (ess (18 10 1)) (ess-view-data (1 0))) "View data from dired via ESS and R" single ((:commit . "96d4cb6569fd2be90a516dedd98263374bbc6ead") (:authors ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainer "Shuguang Sun" . "shuguang79@qq.com") (:keywords "tools") (:url . "https://github.com/ShuguangSun/dired-view-data"))]) + (diredc . [(20220113 332) ((emacs (26 1)) (key-assist (1 0))) "Extensions for dired" single ((:commit . "7ee68f6b1c87f8ab86cf23416472747e88860717") (:keywords "files") (:url . "https://github.com/Boruch-Baum/emacs-diredc"))]) + (diredfl . [(20220508 805) ((emacs (24))) "Extra font lock rules for a more colourful dired" single ((:commit . "62b559e1d6b69834a56a57eb1832ac6ad4d2e5d0") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "faces") (:url . "https://github.com/purcell/diredfl"))]) + (diredful . [(20160529 2017) nil "colorful file names in dired buffers" single ((:commit . "ad328a15c5deffc1021af9b3f19a745dcd8f4415") (:authors ("Thamer Mahmoud" . "thamer.mahmoud@gmail.com")) (:maintainer "Thamer Mahmoud" . "thamer.mahmoud@gmail.com") (:keywords "dired" "colors" "extension" "widget") (:url . "https://github.com/thamer/diredful"))]) + (direnv . [(20220103 1342) ((emacs (25 1)) (dash (2 12 0))) "direnv integration" single ((:commit . "d71ceb415732c3b76a2948147fa3559622aceba2") (:authors ("wouter bolsterlee" . "wouter@bolsterl.ee")) (:maintainer "wouter bolsterlee" . "wouter@bolsterl.ee") (:keywords "direnv" "environment" "processes" "unix" "tools") (:url . "https://github.com/wbolster/emacs-direnv"))]) + (direx . [(20170422 1327) nil "Simple Directory Explorer" tar ((:commit . "a79bfdb5980cf6ed7bfb3b41ddc471a7b6c0ede4") (:authors ("Tomohiro Matsuyama" . "m2ym.pub@gmail.com")) (:maintainer "Tomohiro Matsuyama" . "m2ym.pub@gmail.com") (:keywords "convenience"))]) + (direx-grep . [(20140515 1506) ((direx (0 1 -3))) "Grep node of direx.el using incremental search like anything.el/helm.el" single ((:commit . "1109a512a80b2673a70b18b8568514049017faad") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "convenience") (:url . "https://github.com/aki2o/direx-grep"))]) + (dirtree . [(20140129 832) ((tree-mode (1 1 1 1)) (windata (0))) "Directory tree views" single ((:commit . "ba55f1e716e386fdd37cb8e7f48616e405dc7251") (:authors ("Ye Wenbin" . "wenbinye@gmail.com")) (:maintainer "Ye Wenbin" . "wenbinye@gmail.com"))]) + (dirtree-prosjekt . [(20140129 904) ((prosjekt (0 3)) (dirtree (0 1))) "dirtree integration for prosjekt." single ((:commit . "a864a8be5842223043702395f311e3350c28e9db") (:authors ("Austin Bingham" . "austin.bingham@gmail.com")) (:maintainer "Austin Bingham" . "austin.bingham@gmail.com") (:url . "https://github.com/abingham/prosjekt"))]) + (dirvish . [(20220508 1705) ((emacs (27 1))) "A modern file manager based on dired mode" tar ((:commit . "75d5abb62670dac0dce3e43e8dbe2e42b7abe6ab") (:authors ("Alex Lu ")) (:maintainer "Alex Lu ") (:keywords "files" "convenience") (:url . "https://github.com/alexluigit/dirvish"))]) + (disable-mouse . [(20210512 2114) ((emacs (24 1))) "Disable mouse commands globally" single ((:commit . "cae3be9dd012727b40ad3b511731191f79cebe42") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "mouse") (:url . "https://github.com/purcell/disable-mouse"))]) + (disaster . [(20171016 2152) nil "Disassemble C/C++ code under cursor in Emacs" single ((:commit . "10a785facc60d89d78e0d5177985ab1af1741bb4") (:authors ("Justine Tunney" . "jtunney@gmail.com")) (:maintainer "Justine Tunney" . "jtunney@gmail.com") (:keywords "tools") (:url . "https://github.com/jart/disaster"))]) + (discourse . [(20160911 819) ((cl-lib (0 5)) (request (0 2)) (s (1 11 0))) "discourse api" single ((:commit . "a86c7e608851e186fe12e892a573994f08c8e65e") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "lisp" "discourse") (:url . "https://github.com/lujun9972/discourse-api"))]) + (discover . [(20140103 2139) ((makey (0 3))) "discover more of Emacs" single ((:commit . "7b0044bbb3b3bd5d811fdfb0f5ac6ec8de1239df") (:authors ("Mickey Petersen" . "mickey@fyeah.org")) (:maintainer "Mickey Petersen" . "mickey@fyeah.org"))]) + (discover-clj-refactor . [(20150328 1459) ((clj-refactor (0 14 0)) (discover (0 3))) "Adds discover context menu for clj-refactor" single ((:commit . "3fbd5c1162739e606d7cf5d4f5d7426547d99647") (:authors ("Marian Schubert" . "marian.schubert@gmail.com")) (:maintainer "Marian Schubert" . "marian.schubert@gmail.com") (:keywords "clj-refactor" "discover" "convenience"))]) + (discover-js2-refactor . [(20140129 1552) ((js2-refactor (20131221 501)) (discover (20140103 1339))) "Adds discover context menu for js2-refactor" single ((:commit . "3812abf61f39f3e73a9f3daefa6fed4f21a429ba") (:authors ("Nicolas Petton" . "petton.nicolas@gmail.com")) (:maintainer "Nicolas Petton" . "petton.nicolas@gmail.com") (:keywords "js2-refactor" "discover"))]) + (discover-my-major . [(20180606 511) ((makey (0 2))) "Discover key bindings and their meaning for the current Emacs major mode" single ((:commit . "c592e5e67454f0d1b68669ac0c270073164b16b3") (:authors ("steckerhalter")) (:maintainer "steckerhalter") (:keywords "discover" "help" "major-mode" "keys") (:url . "https://framagit.org/steckerhalter/discover-my-major"))]) + (disk . [(20171116 731) nil "simplified find-file, revert-file, save-buffer interface" single ((:commit . "283e54e3be7d08f959076240b2ab324e25632137") (:authors ("Alex Schroeder" . "alex@gnu.org") ("Peter Barabas" . "peter.barabas+disk@gmail.com")) (:maintainer "Alex Schroeder" . "alex@gnu.org") (:keywords "convenience") (:url . "http://www.emacswiki.org/emacs/DiskKey"))]) + (dispass . [(20140202 1531) ((dash (1 0 0))) "Emacs wrapper for DisPass" single ((:commit . "b6e8f89040ebaaf0e7609b04bc27a8979f0ae861") (:authors ("Tom Willemsen" . "tom@ryuslash.org")) (:maintainer "Tom Willemsen" . "tom@ryuslash.org") (:keywords "processes") (:url . "http://projects.ryuslash.org/dispass.el/"))]) + (display-theme . [(20140115 1556) ((emacs (24))) "display current theme(s) at mode-line" single ((:commit . "b180b3be7a74ae4799a14e7e4bc2fe10e3ff7a15") (:authors ("KAWABATA, Taichi ")) (:maintainer "KAWABATA, Taichi ") (:keywords "tools") (:url . "https://github.com/kawabata/emacs-display-theme/"))]) + (display-wttr . [(20220316 213) ((emacs (27 1))) "Display wttr(weather) in the mode line" single ((:commit . "2cb36df32b0ecf381185126a969b7282af5a0e01") (:authors ("Jose G Perez Taveras" . "josegpt27@gmail.com")) (:maintainer "Jose G Perez Taveras" . "josegpt27@gmail.com") (:url . "https://github.com/josegpt/display-wttr"))]) + (dispwatch . [(20210305 342) ((emacs (24 4))) "Watch displays for configuration changes" single ((:commit . "03abbac89a9f625aaa1a808dd49ae4906f466421") (:authors ("Mitchell Perilstein" . "mitchell.perilstein@gmail.com")) (:maintainer "Mitchell Perilstein" . "mitchell.perilstein@gmail.com") (:keywords "frames") (:url . "https://github.com/mnp/dispwatch"))]) + (dist-file-mode . [(20180830 418) ((emacs (24)) (cl-lib (0 5)) (s (1 9 0))) "Dispatch major mode for *.dist files" single ((:commit . "e1ce8f592bc5d4d86d2f09e334728ac0d524c761") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "files" "convenience") (:url . "https://github.com/emacs-php/dist-file-mode.el"))]) + (distel-completion-lib . [(20180827 1344) nil "Completion library for Erlang/Distel" single ((:commit . "acc4c0a5521904203d797fe96b08e5fae4233c7e") (:authors ("Sebastian Weddmark Olsson")) (:maintainer "Sebastian Weddmark Olsson") (:keywords "erlang" "distel" "completion") (:url . "github.com/sebastiw/distel-completion"))]) + (distinguished-theme . [(20151216 2015) nil "A dark and elegant theme for emacs." single ((:commit . "9b1d25ac59465a5016d187ea84b7614c95a29b3b") (:authors ("Kim Silkebækken" . "kim.silkebaekken@gmail.com")) (:maintainer "Kim Silkebækken" . "kim.silkebaekken@gmail.com") (:url . "https://github.com/Lokaltog/distinguished-theme"))]) + (ditz-mode . [(20150729 940) nil "Emacs interface to Ditz issue tracking system" single ((:commit . "74b6b93b097d595a001c019e3b762abfc60f821a") (:authors ("Glenn Hutchings" . "zondo42@gmail.com")) (:maintainer "Glenn Hutchings" . "zondo42@gmail.com") (:keywords "tools"))]) + (dix . [(20220323 1046) ((cl-lib (0 5)) (emacs (26 2))) "Apertium XML editing minor mode" tar ((:commit . "5230c18456ab034f2fb69acdbef62c1abae6a8cf") (:authors ("Kevin Brubeck Unhammer" . "unhammer@fsfe.org")) (:maintainer "Kevin Brubeck Unhammer" . "unhammer@fsfe.org") (:keywords "languages") (:url . "http://wiki.apertium.org/wiki/Emacs"))]) + (dix-evil . [(20170105 1423) ((dix (0 3 0)) (evil (1 0 7))) "optional evil-integration with dix.el" single ((:commit . "5230c18456ab034f2fb69acdbef62c1abae6a8cf") (:authors ("Kevin Brubeck Unhammer" . "unhammer@fsfe.org")) (:maintainer "Kevin Brubeck Unhammer" . "unhammer@fsfe.org") (:keywords "languages") (:url . "http://wiki.apertium.org/wiki/Emacs"))]) + (dizzee . [(20171201 916) nil "A more pleasant way to manage your project's subprocesses in Emacs." tar ((:commit . "e3cf1c2ea5d0fc00747524b6f3c5b905d0a8c8e1") (:authors ("David Miller" . "david@deadpansincerity.com")) (:maintainer "David Miller" . "david@deadpansincerity.com") (:keywords "emacs" "processes") (:url . "https://github.com/davidmiller/dizzee"))]) + (django-commands . [(20220314 1545) ((emacs (25 1))) "Run django commands" single ((:commit . "7510c0f068bf214ad012c203d68e03ff4262efdf") (:authors ("Andrii Kolomoiets" . "andreyk.mad@gmail.com")) (:maintainer "Andrii Kolomoiets" . "andreyk.mad@gmail.com") (:keywords "tools") (:url . "https://github.com/muffinmad/emacs-django-commands"))]) + (django-manage . [(20160819 212) ((hydra (0 13 2))) "Django minor mode for commanding manage.py" single ((:commit . "876fb2cb627d465adfdc905841279784bcdd7ee8") (:authors ("Daniel Gopar" . "gopardaniel@yahoo.com")) (:maintainer "Daniel Gopar" . "gopardaniel@yahoo.com") (:keywords "languages"))]) + (django-mode . [(20170522 714) ((projectile (0)) (s (0)) (helm-make (0))) "Major mode for Django web framework." tar ((:commit . "a71b8dd984e7f724b8321246e5c353a4ae5c986e") (:authors ("Greg V" . "floatboth@me.com")) (:maintainer "Greg V" . "floatboth@me.com") (:keywords "languages"))]) + (django-snippets . [(20131229 1611) ((yasnippet (0 8 0))) "Yasnippets for django" tar ((:commit . "a71b8dd984e7f724b8321246e5c353a4ae5c986e") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:url . "https://github.com/myfreeweb/django-mode"))]) + (django-theme . [(20131022 902) nil "Custom face theme for Emacs" single ((:commit . "86c8142b3eb1addd94a43aa6f1d98dab06401af0") (:authors ("Andrzej Sliwa")) (:maintainer "Andrzej Sliwa") (:url . "http://github/anrzejsliwa/django-theme"))]) + (djangonaut . [(20200503 921) ((emacs (25 2)) (magit-popup (2 6 0)) (pythonic (0 1 0)) (f (0 20 0)) (s (1 12 0))) "Minor mode to interact with Django projects" single ((:commit . "75f642114e3997308a1e7e67c3025738cecee0fe") (:authors ("Artem Malyshev" . "proofit404@gmail.com")) (:maintainer "Artem Malyshev" . "proofit404@gmail.com") (:url . "https://github.com/proofit404/djangonaut"))]) + (djinni-mode . [(20190303 139) ((emacs (24 4))) "Major-mode for editing Djinni files." single ((:commit . "6f84bc60d078725cc8b922a259ec5f4c7de83681") (:authors ("Daniel Martín" . "mardani29@yahoo.es")) (:maintainer "Daniel Martín" . "mardani29@yahoo.es") (:keywords "languages") (:url . "https://github.com/danielmartin/djinni-mode"))]) + (dkdo . [(20131110 1119) ((dkmisc (0 50)) (emacs (24 1))) "Do List major mode based on org-mode." tar ((:commit . "fd6bb105e8331fafb6385c5238c988c4c5bbe2da") (:authors ("David Keegan" . "dksw@eircom.net")) (:maintainer "David Keegan" . "dksw@eircom.net") (:keywords "dolist" "task" "productivity") (:url . "https://github.com/davidkeegan/dkdo"))]) + (dkl . [(20161005 7) nil "Display keyboard layout." tar ((:commit . "6b4584f86037bda3383960c678d51f340229fb91") (:authors ("Alexis" . "flexibeast@gmail.com")) (:maintainer "Alexis" . "flexibeast@gmail.com") (:keywords "input" "keyboard" "layout") (:url . "https://github.com/flexibeast/dkl"))]) + (dklrt . [(20131110 1341) ((dkmisc (0 50)) (ledger-mode (20130908 1357)) (emacs (24 1))) "Ledger Recurring Transactions." tar ((:commit . "5d6c99f8018335256ab934b4c1049708ae2d48ba") (:authors ("David Keegan" . "dksw@eircom.net")) (:maintainer "David Keegan" . "dksw@eircom.net") (:keywords "ledger" "ledger-cli" "recurring" "periodic" "automatic") (:url . "https://github.com/davidkeegan/dklrt"))]) + (dkmisc . [(20131110 1115) ((emacs (24 1))) "Miscellaneous functions required by dk* packages." tar ((:commit . "fe3d49c6f8322b6f89466361acd97585bdfe0608") (:authors ("David Keegan" . "dksw@eircom.net")) (:maintainer "David Keegan" . "dksw@eircom.net") (:keywords "utility" "time" "date" "file") (:url . "https://github.com/davidkeegan/dkmisc"))]) + (dmacro . [(20200803 633) ((emacs (24 1)) (cl-lib (0 6))) "Repeated detection and execution of key operation" single ((:commit . "3480b97aaad9e65fa03c6a9d1a0a8111be1179f8") (:authors ("Toshiyuki Masui" . "masui@ptiecan.com") ("Makoto Owada") ("Eiji Obata") ("Nobuyuki Mine")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "convenience") (:url . "https://github.com/emacs-jp/dmacro"))]) + (dmenu . [(20190908 44) ((cl-lib (0 5))) "simulate the dmenu command line program" single ((:commit . "e8cc9b27c79d3ecc252267c082ab8e9c82eab264") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "convenience" "usability"))]) + (dna-mode . [(20191001 2108) nil "a major mode for editing dna sequences" tar ((:commit . "7a48393fcf0015eed2368fcb89b3091c9d029dc4") (:authors ("Harley Gorrell" . "harley@panix.com")) (:maintainer "Harley Gorrell" . "harley@panix.com") (:keywords "dna" "emacs" "editing") (:url . "http://www.mahalito.net/~harley/elisp/dna-mode.el"))]) + (doc-show-inline . [(20220507 1118) ((emacs (26 2))) "Show doc-strings found in external files" single ((:commit . "0cceb39df31fd578cfc95d756f667874e6321001") (:authors ("Campbell Barton" . "ideasman42@gmail.com")) (:maintainer "Campbell Barton" . "ideasman42@gmail.com") (:keywords "convenience") (:url . "https://codeberg.com/ideasman42/emacs-doc-show-inline"))]) + (docbook-snippets . [(20150714 1625) ((yasnippet (0 8 0))) "Yasnippets for DocBook" tar ((:commit . "b06297fdec039a541aaa6312cb328a11062cfab4") (:authors ("Jaromir Hradilek" . "jhradilek@gmail.com")) (:maintainer "Jaromir Hradilek" . "jhradilek@gmail.com") (:keywords "snippets" "docbook") (:url . "https://github.com/jhradilek/emacs-docbook-snippets"))]) + (docean . [(20180605 1744) ((emacs (24)) (cl-lib (0 5)) (request (0 2 0))) "Interact with DigitalOcean from Emacs." single ((:commit . "bbe2298fd21f7876fc2d5c52a69b931ff59df979") (:authors ("Mario Rodas" . "marsam@users.noreply.github.com")) (:maintainer "Mario Rodas" . "marsam@users.noreply.github.com") (:keywords "convenience") (:url . "https://github.com/emacs-pe/docean.el"))]) + (docker . [(20220409 1157) ((aio (1 0)) (dash (2 19 1)) (docker-tramp (0 1)) (emacs (26 1)) (json-mode (1 8 0)) (s (1 12 0)) (tablist (1 0)) (transient (0 3 7))) "Interface to Docker" tar ((:commit . "cf137f5b8af7cbda17ef1d09c626db35e0e84078") (:authors ("Philippe Vaucher" . "philippe.vaucher@gmail.com")) (:maintainer "Philippe Vaucher" . "philippe.vaucher@gmail.com") (:keywords "filename" "convenience") (:url . "https://github.com/Silex/docker.el"))]) + (docker-api . [(20160525 720) ((dash (2 12 1)) (request (0 2 0)) (s (1 11 0))) "Emacs interface to the Docker API" tar ((:commit . "206144346b7fa4165223349cfeb64a75d47ddd1b") (:authors ("Philippe Vaucher" . "philippe.vaucher@gmail.com")) (:maintainer "Philippe Vaucher" . "philippe.vaucher@gmail.com") (:url . "https://github.com/Silex/docker-api.el"))]) + (docker-cli . [(20190524 1624) nil "Running various commands in docker containers" single ((:commit . "c4b02894466d8642ad3d49df4c4a80e023a672aa") (:authors ("Boško Ivanišević" . "bosko.ivanisevic@gmail.com")) (:maintainer "Boško Ivanišević" . "bosko.ivanisevic@gmail.com") (:keywords "processes") (:url . "https://github.com/bosko/docker-cli"))]) + (docker-compose-mode . [(20200830 1336) ((emacs (24 3)) (dash (2 12 0)) (yaml-mode (0 0 12))) "Major mode for editing docker-compose files" single ((:commit . "abaa4f3aeb5c62d7d16e186dd7d77f4e846e126a") (:authors ("Ricardo Martins")) (:maintainer "Ricardo Martins") (:keywords "convenience") (:url . "https://github.com/meqif/docker-compose-mode"))]) + (docker-tramp . [(20220219 420) ((emacs (24)) (cl-lib (0 5))) "TRAMP integration for docker containers" tar ((:commit . "930d7b46c180d8a13240a028c1b40af84f2a3219") (:authors ("Mario Rodas" . "marsam@users.noreply.github.com")) (:maintainer "Mario Rodas" . "marsam@users.noreply.github.com") (:keywords "docker" "convenience") (:url . "https://github.com/emacs-pe/docker-tramp.el"))]) + (dockerfile-mode . [(20220220 1439) ((emacs (24))) "Major mode for editing Docker's Dockerfiles" single ((:commit . "b63a3d12b7dea0cb9efc7f78d7ad5672ceab2a3f") (:keywords "docker") (:url . "https://github.com/spotify/dockerfile-mode"))]) + (docopt . [(20220319 1912) ((emacs (26 3)) (dash (2 17 0)) (emacs (26 1)) (f (0 20 0)) (parsec (0 1 3)) (s (1 12 0)) (transient (0 3 0))) "A Docopt implementation in Elisp" tar ((:commit . "a7f5b4a8b1a43552067ce27bce6080a509c92cff") (:authors ("r0man" . "roman@burningswell.com")) (:maintainer "r0man" . "roman@burningswell.com") (:keywords "docopt" "tools" "processes") (:url . "https://github.com/r0man/docopt.el"))]) + (docstr . [(20220214 1539) ((emacs (24 4)) (s (1 9 0))) "A document string minor mode" tar ((:commit . "bb7485d24a4fb147fc7fc7fcd1e1c7ddd3ff64b5") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/docstr"))]) + (doct . [(20220227 205) ((emacs (25 1))) "DOCT: Declarative Org capture templates" single ((:commit . "4033a8fd8681d3989550f7a2532d6b4e3c45bfe8") (:authors ("Nicholas Vollmer" . "progfolio@protonmail.com")) (:maintainer "Nicholas Vollmer" . "progfolio@protonmail.com") (:keywords "org" "convenience") (:url . "https://github.com/progfolio/doct"))]) + (dogears . [(20210913 1259) ((emacs (26 3)) (map (2 1))) "Never lose your place again" single ((:commit . "c05b69e504a538c9e00fbb0ea86934fafe191d0c") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "convenience") (:url . "https://github.com/alphapapa/dogears.el"))]) + (dokuwiki . [(20180102 59) ((emacs (24 3)) (xml-rpc (1 6 8))) "Edit Remote DokuWiki Pages Using XML-RPC" single ((:commit . "594c4d4904dcc2796bbbd2c0845d9e7c09ccf6f7") (:authors ("Juan Karlo Licudine" . "accidentalrebel@gmail.com")) (:maintainer "Juan Karlo Licudine" . "accidentalrebel@gmail.com") (:keywords "convenience") (:url . "http://www.github.com/accidentalrebel/emacs-dokuwiki"))]) + (dokuwiki-mode . [(20170223 1301) nil "Major mode for DokuWiki document" single ((:commit . "e4e116f6fcc373e3f5937c1a7daa5c2c9c6d3fa1") (:authors ("Tsunenobu Kai" . "kai2nenobu@gmail.com")) (:maintainer "Tsunenobu Kai" . "kai2nenobu@gmail.com") (:keywords "hypermedia" "text" "dokuwiki") (:url . "https://github.com/kai2nenobu/emacs-dokuwiki-mode"))]) + (dollaro . [(20151123 1302) ((s (1 6 0))) "simple text templates" single ((:commit . "500127f0172ac7a1eec627e026b59136580a74ac") (:authors ("Alessandro Piras" . "laynor@gmail.com")) (:maintainer "Alessandro Piras" . "laynor@gmail.com") (:keywords "tools" "convenience"))]) + (doneburn-theme . [(20181110 1857) nil "A light theme based on Bozhidar Batsov's Zenburn" single ((:commit . "da4fa915a2a659001eea04498d790cdd8cac1fce") (:authors ("Manuel Uberti" . "manuel.uberti@inventati.org")) (:maintainer "Manuel Uberti" . "manuel.uberti@inventati.org") (:keywords "faces" "themes") (:url . "http://github.com/manuel-uberti/doneburn-emacs"))]) + (doom . [(20180301 2308) ((cl-lib (0 5))) "DOM implementation and manipulation library" single ((:commit . "e59040aefc92dd9b3134eb623624307fb9e4327b") (:authors ("Alex Schroeder" . "alex@gnu.org") ("Henrik.Motakef" . "elisp@henrik-motakef.de") ("Katherine Whitlock" . "toroidal-code@gmail.com") ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Alex Schroeder") (:keywords "xml" "dom") (:url . "http://www.github.com/kensanata/doom.el/"))]) + (doom-modeline . [(20220412 853) ((emacs (25 1)) (all-the-icons (2 2 0)) (shrink-path (0 2 0)) (dash (2 11 0))) "A minimal and modern mode-line" tar ((:commit . "85bdd9ed8674710f6b9815e9a1c41ad4b5a45ace") (:authors ("Vincent Zhang" . "seagle0128@gmail.com")) (:maintainer "Vincent Zhang" . "seagle0128@gmail.com") (:keywords "faces" "mode-line") (:url . "https://github.com/seagle0128/doom-modeline"))]) + (doom-modeline-now-playing . [(20210831 1442) ((emacs (24 4)) (doom-modeline (3 0 0)) (async (1 9 3))) "Segment for Doom Modeline to show playerctl information" single ((:commit . "ef9158dfdf32e8eb789b69e7394d0bddaa68f42c") (:authors ("Ellis Kenyő" . "me@elken.dev")) (:maintainer "Ellis Kenyő" . "me@elken.dev") (:url . "https://github.com/elken/doom-modeline-now-playing"))]) + (doom-themes . [(20220504 1557) ((emacs (25 1)) (cl-lib (0 5))) "an opinionated pack of modern color-themes" tar ((:commit . "e9bdd137116fa2037ed60037b8421cf68c64888d") (:authors ("Henrik Lissner" . "contact@henrik.io")) (:maintainer "Henrik Lissner" . "contact@henrik.io") (:keywords "themes" "faces") (:url . "https://github.com/doomemacs/themes"))]) + (dot-mode . [(20180312 2300) ((emacs (24 3))) "minor mode to repeat typing or commands" single ((:commit . "6ca22b73bcdae2363ee9641b822a60685df16a3e") (:authors ("Robert Wyrick" . "rob@wyrick.org")) (:maintainer "Robert Wyrick" . "rob@wyrick.org") (:keywords "convenience") (:url . "https://github.com/wyrickre/dot-mode"))]) + (dotenv-mode . [(20191027 2129) ((emacs (24 3))) "Major mode for .env files" single ((:commit . "e3701bf739bde44f6484eb7753deadaf691b73fb") (:authors ("Preetpal S. Sohal")) (:maintainer "Preetpal S. Sohal") (:url . "https://github.com/preetpalS/emacs-dotenv-mode"))]) + (dotnet . [(20200803 1032) nil "Interact with dotnet CLI tool" single ((:commit . "83ba1305d7895b03f3dffb2d3458b7ec75e6909f") (:authors ("Julien BLANCHARD" . "julien@sideburns.eu")) (:maintainer "Julien BLANCHARD" . "julien@sideburns.eu") (:keywords ".net" "tools") (:url . "https://github.com/julienXX/dotnet.el"))]) + (double-saber . [(20190325 1917) ((emacs (24 4))) "Narrow and delete in search buffers." single ((:commit . "93d9b1ec833a871bde2fd0f78abc269872808048") (:authors ("Daniel Ting" . "deep.paren.12@gmail.com")) (:maintainer "Daniel Ting" . "deep.paren.12@gmail.com") (:keywords "double-saber" "narrow" "delete" "sort" "tools" "convenience" "matching") (:url . "https://github.com/dp12/double-saber.git"))]) + (download-region . [(20210306 415) ((cl-lib (0 3))) "Simple in-buffer download manager" single ((:commit . "e0a721858a22896fa1d7f1d5689dd0878dbc58fa") (:authors ("zk_phi")) (:maintainer "zk_phi") (:url . "http://zk-phi.github.io/"))]) + (downplay-mode . [(20151125 2009) nil "focus attention on a region of the buffer" single ((:commit . "4a2c3addc73c8ca3816345c3c11c08af265baedb") (:authors ("Toby Crawley" . "toby@tcrawley.org")) (:maintainer "Toby Crawley" . "toby@tcrawley.org") (:url . "https://github.com/tobias/downplay-mode/"))]) + (doxy-graph-mode . [(20210604 723) ((emacs (26 3))) "Links source code editing with doxygen call graphs" single ((:commit . "88af6ef4bc9c8918b66c7774f0a115b2addc310e") (:authors ("Gustavo Puche" . "gustavo.puche@gmail.com")) (:maintainer "Gustavo Puche" . "gustavo.puche@gmail.com") (:keywords "languages" "all") (:url . "https://github.com/gustavopuche/doxy-graph-mode"))]) + (dpaste . [(20160303 2112) nil "Emacs integration for dpaste.com" single ((:commit . "5ebabb466a6ae70882549855b6b2194fc32189f8") (:authors ("Greg Newman" . "greg@gregnewman.org") ("Guilherme Gondim" . "semente@taurinus.org")) (:maintainer "Greg Newman" . "greg@gregnewman.org") (:keywords "paste" "pastie" "pastebin" "dpaste" "python"))]) + (dpaste_de . [(20131015 1225) ((web (0 3 7))) "Emacs mode to paste to dpaste.de" single ((:commit . "f0c39e8864299f735642f7d9fa490689398ce39d") (:authors ("Thejaswi Puthraya" . "thejaswi.puthraya@gmail.com")) (:maintainer "Thejaswi Puthraya" . "thejaswi.puthraya@gmail.com") (:keywords "pastebin"))]) + (dpkg-dev-el . [(20190824 2314) ((debian-el (37))) "Emacs modes for debian packaging" tar ((:commit . "458f5230d02b15c94e94eca1af4eabaec30f45db") (:authors ("Peter S Galbraith" . "psg@debian.org")) (:maintainer "Peter S Galbraith" . "psg@debian.org"))]) + (dr-racket-like-unicode . [(20200513 1642) ((emacs (24 1))) "DrRacket-style unicode input" single ((:commit . "70bc1caea6b277e49e1cb29e1926a7b0c83c5ebc") (:authors ("David Christiansen" . "david@davidchristiansen.dk")) (:maintainer "David Christiansen" . "david@davidchristiansen.dk") (:keywords "i18n" "tools"))]) + (dracula-theme . [(20220209 724) ((emacs (24 3))) "Dracula Theme" single ((:commit . "e725c9e790c9e9cdaccdb35faaae9d5cb16ddb89") (:authors ("film42")) (:maintainer "Étienne Deparis" . "etienne@depar.is") (:url . "https://github.com/dracula/emacs"))]) + (draft-mode . [(20140609 1456) nil "Rough drafting for Emacs." single ((:commit . "4779fb32daf53746459da2def7e08004492d4f18") (:authors ("Eeli Reilin" . "gaudecker@fea.st")) (:maintainer "Eeli Reilin" . "gaudecker@fea.st") (:keywords "draft" "drafting") (:url . "https://github.com/gaudecker/draft-mode"))]) + (drag-stuff . [(20161108 749) nil "Drag stuff (lines, words, region, etc...) around" tar ((:commit . "6d06d846cd37c052d79acd0f372c13006aa7e7c8") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "speed" "convenience") (:url . "http://github.com/rejeep/drag-stuff"))]) + (drawille . [(20160418 1838) ((cl-lib (0 5))) "Drawille implementation in elisp" tar ((:commit . "d914845725719d8293e2f0dea3c9c7e0a1e0e62a") (:authors ("Josuah Demangeon" . "josuah.demangeon@gmail.com")) (:maintainer "Josuah Demangeon" . "josuah.demangeon@gmail.com") (:keywords "graphics") (:url . "https://github.com/sshbio/elisp-drawille"))]) + (dream-theme . [(20210419 605) ((emacs (26 1))) "Maximalist Nordic/Zenburn-inspired color theme" single ((:commit . "0c27f05544b90e41338f79ea923044b358a323c6") (:authors ("Dirk-Jan C. Binnema" . "djcb@djcbsoftware.nl")) (:maintainer "Dirk-Jan C. Binnema" . "djcb@djcbsoftware.nl") (:keywords "faces" "theme") (:url . "https://github.com/djcb/dream-theme"))]) + (drill-instructor-AZIK-force . [(20151123 514) ((popup (0 5))) "Support AZIK input" tar ((:commit . "008cea202dc31d7d6fb1e7d8e6334d516403b7a5") (:authors ("Yuhei Maeda ")) (:maintainer "Yuhei Maeda") (:keywords "convenience") (:url . "https://github.com/myuhe/drill-instructor-AZIK-force.el"))]) + (drone . [(20161106 918) nil "Launch your drone test suite if drone.yml is present" single ((:commit . "1d4ee037ad3208847a4235426edf0c4a3e7b1899") (:authors ("Oliver Marks" . "oly@digitaloctave.com")) (:maintainer "Oliver Marks" . "oly@digitaloctave.com") (:keywords "drone" "tests" "ci") (:url . "https://github.com/olymk2/emacs-drone"))]) + (dropbox . [(20220314 1638) ((request (0 3 0)) (json (1 2)) (oauth (1 0 3))) "Emacs backend for dropbox" single ((:commit . "c048faad0be24e8fa31974f08b710a87cf5b668c") (:authors ("Pavel Panchekha" . "me@pavpanchekha.com")) (:maintainer "Pavel Panchekha" . "me@pavpanchekha.com") (:keywords "dropbox"))]) + (drupal-mode . [(20220125 1044) ((php-mode (1 5 0))) "Advanced minor mode for Drupal development" tar ((:commit . "17927723adc5921e8058f7c29e5e50e88b975639") (:authors ("Arne Jørgensen" . "arne@arnested.dk")) (:maintainer "Arne Jørgensen" . "arne@arnested.dk") (:keywords "programming" "php" "drupal") (:url . "https://github.com/arnested/drupal-mode"))]) + (drupal-spell . [(20130520 1655) nil "Aspell extra dictionary for Drupal" tar ((:commit . "4087c28c89a884ee050961c57166e6b09085f59d") (:authors ("Arne Jørgensen" . "arne@arnested.dk")) (:maintainer "Arne Jørgensen" . "arne@arnested.dk") (:keywords "wp") (:url . "https://github.com/arnested/drupal-spell"))]) + (dsvn . [(20190316 2201) nil "Subversion interface" single ((:commit . "c37d2412ba92aad647bcf5aeb151e620e8069f8d") (:authors ("David Kågedal" . "davidk@lysator.liu.se") (" Mattias Engdegård" . "mattiase@acm.org")) (:maintainer "Mattias Engdegård" . "mattiase@acm.org") (:keywords "docs"))]) + (dtache . [(20220501 931) ((emacs (27 1))) "Run and interact with detached shell commands" tar ((:commit . "9becf3a921a0fde3a6e5d6f30379cf3d9826d565") (:authors ("Niklas Eklund" . "niklas.eklund@posteo.net")) (:maintainer "Niklas Eklund" . "niklas.eklund@posteo.net") (:keywords "convenience" "processes") (:url . "https://www.gitlab.com/niklaseklund/dtache.git"))]) + (dtb-mode . [(20210105 1132) ((emacs (25))) "Show device tree souce in dtbs" single ((:commit . "7f66de945a0be2be5a26b4619cae097288fb55cd") (:authors ("Schspa Shi" . "schspa@gmail.com")) (:maintainer "Schspa Shi" . "schspa@gmail.com") (:keywords "dtb" "dts" "convenience") (:url . "https://github.com/schspa/dtb-mode"))]) + (dtk . [(20220309 759) ((emacs (24 4)) (cl-lib (0 6 1)) (dash (2 12 0)) (seq (1 9)) (s (1 9))) "access SWORD content via diatheke" single ((:commit . "56b339bc76926defa775c406113e306ec6d31b36") (:authors ("David Thompson")) (:maintainer "David Thompson") (:keywords "hypermedia") (:url . "https://github.com/dtk01/dtk.el"))]) + (dtrace-script-mode . [(20150214 623) nil "DTrace code editing commands for Emacs" single ((:commit . "801af1ef16075d31a19830ebb8404bbf3a322f10"))]) + (dtrt-indent . [(20220226 1354) nil "Adapt to foreign indentation offsets" tar ((:commit . "66fc30af02901db023e464a24d2b5fb3ff472794") (:authors ("Julian Scheid" . "julians37@googlemail.com")) (:maintainer "Reuben Thomas" . "rrt@sc3d.org") (:keywords "convenience" "files" "languages" "c"))]) + (dts-mode . [(20211202 18) nil "Major mode for Devicetree source code" single ((:commit . "32517e7eeeccc785b7c669fd5e93c5df45597ef1") (:authors ("Ben Gamari" . "ben@smart-cactus.org")) (:maintainer "Ben Gamari" . "ben@smart-cactus.org") (:keywords "languages"))]) + (ducpel . [(20140702 1154) ((cl-lib (0 5))) "Logic game with sokoban elements" tar ((:commit . "b53b935ab95c02b82ccf38f63c89e39e99477a55") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "games") (:url . "https://github.com/alezost/ducpel"))]) + (dumb-diff . [(20171211 2122) ((emacs (24 3))) "fast arbitrary diffs" single ((:commit . "1a2331d283049b71a07c1b06b1e0627a950d55f4") (:authors ("jack angers")) (:maintainer "jack angers") (:keywords "programming" "diff"))]) + (dumb-jump . [(20211018 1545) ((emacs (24 3)) (s (1 11 0)) (dash (2 9 0)) (popup (0 5 3))) "Jump to definition for 50+ languages without configuration" single ((:commit . "dbb915441a2b66f2fbb954ff5de2723c5a4771d4") (:authors ("jack angers and contributors")) (:maintainer "jack angers and contributors") (:keywords "programming") (:url . "https://github.com/jacktasia/dumb-jump"))]) + (dummyparens . [(20141009 1024) nil "parenthesis auto-pairing and wrapping" single ((:commit . "9798ef1d0eaa24e4fe66f8aa6022a8c62714cc89") (:authors ("Sergei Nosov ")) (:maintainer "Sergei Nosov ") (:keywords "dummyparens" "auto-pair" "wrapping") (:url . "https://github.com/snosov1/dummyparens"))]) + (dune . [(20210909 1010) nil "Integration with the dune build system" tar ((:commit . "4633b71e64abe3e8a737a45e181daef43f7db48d") (:url . "https://github.com/ocaml/dune"))]) + (dune-format . [(20210505 108) ((reformatter (0 6)) (emacs (24 1))) "Reformat OCaml's dune files automatically" single ((:commit . "196f16a01f4c855de7becddbc4cfed2f6788693a") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "languages") (:url . "https://github.com/purcell/emacs-dune-format"))]) + (duplicate-thing . [(20181031 1500) nil "Duplicate current line & selection" single ((:commit . "9d8fd05e3e5caa35d3f2a0c0032c92f0c0908e21") (:authors ("ongaeshi")) (:maintainer "ongaeshi") (:keywords "convenience" "command" "duplicate" "line" "selection") (:url . "https://github.com/ongaeshi/duplicate-thing"))]) + (dut-mode . [(20170729 2111) ((emacs (24))) "Major mode for the Dut programming language" single ((:commit . "9235c7acaa6690942e9de8b7acd1e4be0c859dc1") (:authors ("The dut-mode Authors")) (:maintainer "The dut-mode Authors") (:keywords "languages" "gut") (:url . "https://github.com/dut-lang/dut-mode"))]) + (dw . [(20210331 2246) ((emacs (25 1))) "Diceware passphrase generation commands" single ((:commit . "61c5718ba64ace4c9e29de18aa2690ecc3f0f258") (:authors ("D. Williams" . "d.williams@posteo.net")) (:maintainer "D. Williams" . "d.williams@posteo.net") (:keywords "convenience" "games") (:url . "https://github.com/integral-dw/dw-passphrase-generator"))]) + (dyalog-mode . [(20210413 810) ((cl-lib (0 2)) (emacs (24 3))) "Major mode for editing Dyalog APL source code" tar ((:commit . "697a84194766708d2607e8ba48a552e383c6523e") (:authors ("Joakim Hårsman" . "joakim.harsman@gmail.com")) (:maintainer "Joakim Hårsman" . "joakim.harsman@gmail.com") (:keywords "languages") (:url . "https://github.com/harsman/dyalog-mode.git"))]) + (dylan . [(20220115 1804) ((emacs (25 1))) "Dylan editing modes" tar ((:commit . "9d2891e3e06405b75072d296f385fa795aeb9835") (:url . "https://opendylan.org/"))]) + (dynamic-fonts . [(20140731 1226) ((font-utils (0 7 0)) (persistent-soft (0 8 8)) (pcache (0 2 3))) "Set faces based on available fonts" single ((:commit . "ab0c65accbdb59acaed5b263327e22ec019b3e82") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "faces" "frames") (:url . "http://github.com/rolandwalker/dynamic-fonts"))]) + (dynamic-graphs . [(20210908 2010) ((emacs (26 1))) "Manipulation with graphviz graphs" single ((:commit . "64ca58dffecdecb636f7fe61c0c86e9c3c64d4dd") (:authors ("Tomas Zellerin" . "tomas@zellerin.cz")) (:maintainer "Tomas Zellerin" . "tomas@zellerin.cz") (:keywords "tools") (:url . "https://github.com/zellerin/dynamic-graphs"))]) + (dynamic-ruler . [(20160602 808) nil "Displays a dynamic ruler at point." single ((:commit . "c9c0de6fe5721f06b50e01d9b4684b519c71b367") (:authors ("Francesc Rocher" . "francesc.rocher@gmail.com")) (:maintainer "Francesc Rocher" . "francesc.rocher@gmail.com") (:keywords "ruler" "tools" "convenience") (:url . "http://rocher.github.io/dynamic-ruler"))]) + (dynamic-spaces . [(20171027 1851) nil "When editing, don't move text separated by spaces" single ((:commit . "97ae8480c257ba573ca3d06dbf602f9b23c41d38") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "convenience") (:url . "https://github.com/Lindydancer/dynamic-spaces"))]) + (dynaring . [(20210924 2026) ((emacs (25 1))) "A dynamically sized ring structure" single ((:commit . "dc9013117bdcdc1b12feebcc58eaf129a6ad3a73") (:authors ("Mike Mattie" . "codermattie@gmail.com") ("Sid Kasivajhula" . "sid@countvajhula.com")) (:maintainer "Sid Kasivajhula" . "sid@countvajhula.com") (:url . "https://github.com/countvajhula/dynaring"))]) + (dyncloze . [(20210712 145) ((emacs (25 1)) (dash (2 18))) "Language alternatives self-testing" tar ((:commit . "aafc5adc25c7f714b619109bccf92e475d6c84ef") (:authors ("Andrew Hyatt" . "ahyatt@gmail.com")) (:maintainer "Andrew Hyatt" . "ahyatt@gmail.com") (:url . "https://github.com/ahyatt/emacs-dyncloze"))]) + (e2ansi . [(20190517 1902) ((face-explorer (0 0 4))) "Syntax highlighting support for `less', powered by Emacs." tar ((:commit . "6e1bb4e4e27885d1786db08b091cfa13b184fb54") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "faces" "languages") (:url . "https://github.com/Lindydancer/e2ansi"))]) + (e2wm . [(20170215 36) ((window-layout (1 4))) "simple window manager for emacs" tar ((:commit . "4353d3394c77a49f8f0291c239858c8c5e877549") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "tools" "window manager"))]) + (e2wm-R . [(20151230 926) ((e2wm (1 3)) (inlineR (1 0)) (ess (15 3))) "some e2wm plugin and perspective for GNU R" single ((:commit . "4350601ee1a96bf89777b3f09f1b79b88e2e6e4d") (:authors ("myuhe ")) (:maintainer "myuhe") (:keywords "convenience" "e2wm") (:url . "https://github.com/myuhe/e2wm-R.el"))]) + (e2wm-bookmark . [(20151123 521) ((e2wm (1 2))) "Bookmark plugin for e2wm.el" single ((:commit . "bad816b6d8049984d69bcd277b7d325fb84d55eb") (:authors ("Yuhei Maeda ")) (:maintainer "Yuhei Maeda ") (:keywords "convenience"))]) + (e2wm-direx . [(20200805 1414) ((e2wm (1 2)) (direx (0 1 -3))) "Plugin of e2wm.el for direx.el" single ((:commit . "5672bc44d8e5cea6bc3b84c3b58e522050ffae0e") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "tools" "window manager" "convenience") (:url . "https://github.com/aki2o/e2wm-direx"))]) + (e2wm-pkgex4pl . [(20140525 1047) ((e2wm (1 2)) (plsense-direx (0 2 0))) "Plugin of e2wm.el for package explorer of Perl" single ((:commit . "7ea994450727190c4f3cb46cb429ba41b692ecc0") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "tools" "window manager" "perl") (:url . "https://github.com/aki2o/e2wm-pkgex4pl"))]) + (e2wm-svg-clock . [(20150106 1306) ((e2wm (20130225 1602)) (svg-clock (0 4))) "e2wm plugin for svg-clock" single ((:commit . "d425925e3afffcbe2ff74edc80b714e4319d4c94") (:authors ("Yuhei Maeda ")) (:maintainer "Yuhei Maeda") (:keywords "convenience" "e2wm") (:url . "https://github.com/myuhe/e2wm-svg-clock.el"))]) + (e2wm-sww . [(20200805 1339) ((e2wm (1 2))) "Plugin of e2wm.el to switch plugin quickly" single ((:commit . "8926d0c70be05c7b4ef821e22e411e8813973687") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "tools" "window manager") (:url . "https://github.com/aki2o/e2wm-sww"))]) + (e2wm-term . [(20200322 729) ((e2wm (1 2)) (log4e (0 2 0)) (yaxception (0 3 2))) "Perspective of e2wm.el for work in terminal" single ((:commit . "74362d6271e736272df32ea807c5a22e4df54a50") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "tools" "window manager") (:url . "https://github.com/aki2o/e2wm-term"))]) + (eacl . [(20220101 1517) ((emacs (25 1))) "Auto-complete lines by grepping project" single ((:commit . "4d9d42fa05e550dbac71a2c93e1da71c48af9449") (:authors ("Chen Bin ")) (:maintainer "Chen Bin ") (:keywords "abbrev" "convenience" "matching") (:url . "http://github.com/redguardtoo/eacl"))]) + (earthfile-mode . [(20210903 230) ((emacs (26))) "Major mode for editing Earthly file" single ((:commit . "0f24876223a358d2718383e9e4975a26cee55f9d") (:authors ("Thanabodee Charoenpiriyakij" . "wingyminus@gmail.com")) (:maintainer "Thanabodee Charoenpiriyakij" . "wingyminus@gmail.com") (:url . "https://github.com/earthly/earthly-mode"))]) + (easy-after-load . [(20170817 1231) nil "eval-after-load for all files in a directory" single ((:commit . "29e20145da49ac9ea40463c552130777408040de") (:authors ("Kyle Hargraves")) (:maintainer "Kyle Hargraves") (:url . "https://github.com/pd/easy-after-load"))]) + (easy-escape . [(20210917 1254) nil "Improve readability of escape characters in regular expressions" single ((:commit . "938497a21e65ba6b3ff8ec90e93a6d0ab18dc9b4") (:authors ("Clément Pit-Claudel" . "clement.pitclaudel@live.com")) (:maintainer "Clément Pit-Claudel" . "clement.pitclaudel@live.com") (:keywords "convenience" "lisp" "tools") (:url . "https://github.com/cpitclaudel/easy-escape"))]) + (easy-hugo . [(20211017 1248) ((emacs (25 1)) (popup (0 5 3)) (request (0 3 0)) (transient (0 3 6))) "Write blogs made with hugo by markdown or org-mode" tar ((:commit . "baead14d7f2fa86e108269932a94bf376de9c2e5") (:authors ("Masashi Miyaura")) (:maintainer "Masashi Miyaura") (:url . "https://github.com/masasam/emacs-easy-hugo"))]) + (easy-jekyll . [(20211217 2311) ((emacs (25 1)) (request (0 3 0))) "Major mode managing jekyll blogs" single ((:commit . "7f19af310162464956f2bc4c38c6b7e95cb20321") (:authors ("Masashi Miyaura")) (:maintainer "Masashi Miyaura") (:url . "https://github.com/masasam/emacs-easy-jekyll"))]) + (easy-kill . [(20220311 1506) ((emacs (25)) (cl-lib (0 5))) "kill & mark things easily" single ((:commit . "f9b450a87c41e5ef616df565ed158cb236aa5189") (:authors ("Leo Liu" . "sdl.web@gmail.com")) (:maintainer "Leo Liu" . "sdl.web@gmail.com") (:keywords "killing" "convenience") (:url . "https://github.com/leoliu/easy-kill"))]) + (easy-kill-extras . [(20210529 945) ((easy-kill (0 9 4))) "Extra functions for easy-kill." tar ((:commit . "74e9d0fcafc38d5f24e6209671a552bc1ba5a867") (:authors ("Akinori MUSHA" . "knu@iDaemons.org")) (:maintainer "Akinori MUSHA" . "knu@iDaemons.org") (:keywords "killing" "convenience") (:url . "https://github.com/knu/easy-kill-extras.el"))]) + (easy-repeat . [(20150516 848) ((emacs (24 4))) "Repeat easily" single ((:commit . "060f0e6801c82c40c06961dc0528a00e18947a8c") (:authors ("Chunyang Xu" . "xuchunyang56@gmail.com")) (:maintainer "Chunyang Xu" . "xuchunyang56@gmail.com") (:keywords "repeat" "convenience") (:url . "https://github.com/xuchunyang/easy-repeat.el"))]) + (ebf . [(20210225 1211) ((dash (2 18 0)) (cl-lib (0 5))) "brainfuck language transpiler to Emacs Lisp" tar ((:commit . "6cbeb4d62416f4cfd5be8906667342af8ecc44a6") (:authors ("Alexey Kutepov" . "reximkut@gmail.com")) (:maintainer "Alexey Kutepov" . "reximkut@gmail.com") (:url . "http://github.com/rexim/ebf"))]) + (ebib . [(20220430 2219) ((parsebib (2 3)) (emacs (26 1))) "a BibTeX database manager" tar ((:commit . "0e243a78f435038dda31953c5b48cbddf2a89e27") (:authors ("Joost Kremers" . "joostkremers@fastmail.fm")) (:maintainer "Joost Kremers" . "joostkremers@fastmail.fm") (:keywords "text" "bibtex") (:url . "http://joostkremers.github.io/ebib/"))]) + (ebuku . [(20220106 902) ((emacs (25 1))) "Interface to the buku Web bookmark manager" single ((:commit . "5004d377f8c89436c28d4a7ffbef407a2b28861e") (:authors ("Alexis , Erik Sjöstrand" . "sjostrand.erik@gmail.com")) (:maintainer "Alexis" . "flexibeast@gmail.com") (:keywords "bookmarks" "buku" "data" "web" "www") (:url . "https://github.com/flexibeast/ebuku"))]) + (ecb . [(20170728 1921) nil "a code browser for Emacs" tar ((:commit . "1330a44cf3c171781083b0b926ab7622f64e6e81") (:authors ("Jesper Nordenberg" . "mayhem@home.se") ("Klaus Berndl" . "klaus.berndl@sdm.de") ("Kevin A. Burton" . "burton@openprivacy.org")) (:maintainer "Klaus Berndl" . "klaus.berndl@sdm.de") (:keywords "browser" "code" "programming" "tools"))]) + (echo-bar . [(20220222 214) nil "Turn the echo area into a custom status bar" single ((:commit . "06cc8ef88f3b054f676b76815879bd6c71107591") (:authors ("Adam Tillou" . "qaiviq@gmail.com")) (:maintainer "Adam Tillou" . "qaiviq@gmail.com") (:keywords "convenience" "tools") (:url . "https://github.com/qaiviq/echo-bar.el"))]) + (eclim . [(20181108 1134) ((dash (2 11 0)) (json (1 2)) (popup (0 5 2)) (s (1 9 0)) (cl-lib (0 5)) (yasnippet (0 10 0))) "An interface to the Eclipse IDE." tar ((:commit . "222ddd48fcf0ee01592dec77c58e0cf3f2ea1100"))]) + (eclipse-theme . [(20191113 1518) nil "Theme based on Eclipse circa 2010" single ((:commit . "dcf97865512ed450f9d5137c1a05e12edb5b7f80") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "themes") (:url . "https://github.com/abo-abo/eclipse-theme"))]) + (ecukes . [(20210202 1241) ((commander (0 6 1)) (espuds (0 2 2)) (ansi (0 3 0)) (dash (2 2 0)) (s (1 8 0)) (f (0 11 0))) "Cucumber for Emacs." tar ((:commit . "d173cdf487bc2c62305e2232db96290bc021950f"))]) + (edbi . [(20160225 141) ((concurrent (0 3 1)) (ctable (0 1 2)) (epc (0 1 1))) "Emacs Database Interface" tar ((:commit . "6f50aaf4bde75255221f2292c7a4ad3fa9d918c0") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "database" "epc") (:url . "https://github.com/kiwanami/emacs-edbi"))]) + (ede-compdb . [(20150920 2033) ((ede (1 2)) (semantic (2 2)) (cl-lib (0 4))) "Support for compilation database projects in EDE" single ((:commit . "d6d8466cd62876fc90adeff5875a1a584fd846cd") (:authors ("Alastair Rankine" . "alastair@girtby.net")) (:maintainer "Alastair Rankine" . "alastair@girtby.net") (:keywords "development" "ninja" "build" "cedet" "ede"))]) + (ede-php-autoload . [(20180901 1255) nil "Simple EDE PHP Project" tar ((:commit . "8a4eeeaa93b8d87b65a107c4ebcbeb14528d9449") (:authors ("Steven Rémot" . "steven.remot@gmail.com") ("original code for C++ by Eric M. Ludlam" . "eric@siege-engine.com")) (:maintainer "Steven Rémot" . "steven.remot@gmail.com") (:keywords "php" "project" "ede") (:url . "https://github.com/emacs-php/ede-php-autoload"))]) + (ede-php-autoload-composer-installers . [(20170221 2026) ((ede-php-autoload (1 0 0)) (f (0 19 0)) (s (1 7 0))) "Composer installers support for ede-php-autoload" single ((:commit . "7840439802c7d11ee086bbf465657f3da12f9f66") (:authors ("Thomas Fini Hansen" . "xen@xen.dk")) (:maintainer "Thomas Fini Hansen" . "xen@xen.dk") (:keywords "programming" "php") (:url . "https://github.com/xendk/ede-php-autoload-composer-installers"))]) + (ede-php-autoload-drupal . [(20170316 2158) ((ede-php-autoload (1 0 0)) (f (0 19 0)) (s (1 7 0))) "Drupal support for ede-php-autoload" single ((:commit . "54a04241d94fabc4f4d16ae4dc8ba4f0c6e3b435") (:authors ("Thomas Fini Hansen" . "xen@xen.dk")) (:maintainer "Thomas Fini Hansen" . "xen@xen.dk") (:keywords "programming" "php" "drupal"))]) + (edebug-inline-result . [(20220210 1357) ((emacs (25 1))) "Show Edebug result inline" single ((:commit . "9fb3c48434da24f800833a5ee3419452d5fb83cb") (:keywords "extensions" "lisp" "tools") (:url . "https://repo.or.cz/edebug-inline-result.git"))]) + (edebug-x . [(20130616 625) nil "Extensions for Edebug" single ((:commit . "a2c2c42553d3bcbd5ac11898554865acbed1bc46") (:authors ("Scott Barnett" . "scott.n.barnett@gmail.com")) (:maintainer "Scott Barnett" . "scott.n.barnett@gmail.com") (:keywords "extensions") (:url . "https://github.com/ScottyB/edebug-x"))]) + (edit-as-format . [(20220221 1312) ((emacs (26 1)) (edit-indirect (0 1 5))) "Edit document as other format" tar ((:commit . "59c6f439683846d994a7a2110b9b00cc16c08c40") (:authors ("Xiaobing Jing" . "jingxiaobing@gmail.com")) (:maintainer "Xiaobing Jing" . "jingxiaobing@gmail.com") (:keywords "files" "outlines" "convenience") (:url . "https://github.com/etern/edit-as-format"))]) + (edit-at-point . [(20191013 1218) nil "edit(copy,cut..) current things(word,symbol..) under cursor" single ((:commit . "28c85a65c9c61f2aff50bc5e93f61cde26a5d9c0") (:authors (nil . "")) (:maintainer nil . "") (:url . "http://github.com/enoson/edit-at-point.el"))]) + (edit-chrome-textarea . [(20200324 1513) ((emacs (25 1)) (websocket (1 4))) "Edit Chrome Textarea" single ((:commit . "e9ef6a72bdc6b58f932c51aa161869cee11b4bc9") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:keywords "tools") (:url . "https://github.com/xuchunyang/edit-chrome-textarea.el"))]) + (edit-color-stamp . [(20130529 1733) ((es-lib (0 2)) (cl-lib (1 0))) "Edit a hex color stamp, using a QT or the internal color picker" tar ((:commit . "32dc1ca5bcf3dcf83fad5e39b55dc5b77becb3d3") (:authors ("sabof")) (:maintainer "sabof") (:url . "https://github.com/sabof/edit-color-stamp"))]) + (edit-indirect . [(20220216 1812) ((emacs (24 3))) "Edit regions in separate buffers" single ((:commit . "e3d86416bcf8ddca951d7d112e57ad30c5f9a081") (:authors ("Fanael Linithien" . "fanael4@gmail.com")) (:maintainer "Fanael Linithien" . "fanael4@gmail.com") (:url . "https://github.com/Fanael/edit-indirect"))]) + (edit-indirect-region-latex . [(20161129 645) ((emacs (24 3)) (ht (2 2)) (edit-indirect (0 1 4))) "Edit LaTeX regions in separate buffers, e.g. for English grammar checks" single ((:commit . "05043f2c0c9838947d3ca4b51b695deb7c47612e") (:authors ("Hirotaka Niitsuma" . "hirotaka.niitsuma@gmail.com")) (:maintainer "Hirotaka Niitsuma" . "hirotaka.niitsuma@gmail.com") (:url . "https://github.com/niitsuma/edit-indirect-region-latex"))]) + (edit-list . [(20100930 1443) nil "edit a single list" single ((:commit . "f460d3f9e208a4e606fe6ded307f1b011916ca71") (:authors ("Michael Olson" . "mwolson@gnu.org")) (:maintainer "Michael Olson" . "mwolson@gnu.org") (:url . "http://mwolson.org/static/dist/elisp/edit-list.el"))]) + (edit-server . [(20181016 1125) nil "server that responds to edit requests from Chrome" single ((:commit . "65a8e434547dcbe1df89dc3fd7aee075f8b06366") (:authors ("Alex Bennée" . "alex@bennee.com")) (:maintainer "Alex Bennée" . "alex@bennee.com") (:url . "https://github.com/stsquad/emacs_chrome"))]) + (edit-server-htmlize . [(20130329 2248) ((edit-server (1 9))) "(de)HTMLization hooks for edit-server.el" single ((:commit . "e7f8dadfabe869c77ca241cd6fbd4c52bd908392") (:authors ("Roland McGrath" . "roland@hack.frob.com")) (:maintainer "Roland McGrath" . "roland@hack.frob.com") (:url . "https://github.com/frobtech/edit-server-htmlize"))]) + (editorconfig . [(20220301 332) ((cl-lib (0 5)) (nadvice (0 3)) (emacs (24))) "EditorConfig Emacs Plugin" tar ((:commit . "1f6f16c24fd0030322d59c2853067a6dccc9e736") (:authors ("EditorConfig Team" . "editorconfig@googlegroups.com")) (:maintainer "EditorConfig Team" . "editorconfig@googlegroups.com") (:url . "https://github.com/editorconfig/editorconfig-emacs#readme"))]) + (editorconfig-charset-extras . [(20180223 457) ((editorconfig (0 6 0))) "Extra EditorConfig Charset Support" single ((:commit . "4f75e175ad15ce2038f926fe4f0e5a0c1d0cbc46") (:authors ("10sr" . "8.slashes@gmail.com")) (:maintainer "10sr" . "8.slashes@gmail.com") (:keywords "tools") (:url . "https://github.com/10sr/editorconfig-charset-extras-el"))]) + (editorconfig-custom-majormode . [(20180816 244) ((editorconfig (0 6 0))) "Decide major-mode and mmm-mode from EditorConfig" single ((:commit . "13ad1c83f847bedd4b3a19f9df7fd925853b19de") (:authors ("10sr <8slashes+el [at] gmail [dot] com>")) (:maintainer "10sr <8slashes+el [at] gmail [dot] com>") (:keywords "editorconfig" "util") (:url . "https://github.com/10sr/editorconfig-custom-majormode-el"))]) + (editorconfig-domain-specific . [(20180505 924) ((cl-lib (0 5)) (editorconfig (0 6 0))) "Apply brace style and other \"domain-specific\" EditorConfig properties" single ((:commit . "e9824160fb2e466afa755240ee3ab7cc5657fb04") (:authors ("Lassi Kortela" . "lassi@lassi.io")) (:maintainer "Lassi Kortela" . "lassi@lassi.io") (:keywords "editorconfig" "util") (:url . "https://github.com/lassik/editorconfig-emacs-domain-specific"))]) + (editorconfig-generate . [(20190513 433) ((emacs (24))) "Generate .editorconfig" single ((:commit . "47a31f928f46d2a0188db8e2cffa5d6354a81573") (:authors ("10sr" . "8.slashes@gmail.com")) (:maintainer "10sr" . "8.slashes@gmail.com") (:keywords "tools") (:url . "https://github.com/10sr/editorconfig-generate-el"))]) + (edn . [(20160215 1219) ((cl-lib (0 3)) (emacs (24 1)) (peg (0 6))) "Support for reading and writing the edn data format from elisp" single ((:commit . "21e120a6914ee9a694be0a051f9f2af34ef055e4") (:authors ("Lars Andersen" . "expez@expez.com")) (:maintainer "Lars Andersen" . "expez@expez.com") (:keywords "edn" "clojure") (:url . "https://www.github.com/expez/edn.el"))]) + (ednc . [(20220404 2105) ((emacs (26 1))) "Emacs Desktop Notification Center" single ((:commit . "d1a3c37235dd87e0bce6ffc75f5568218d6d83b4") (:authors ("Simon Nicolussi" . "sinic@sinic.name")) (:maintainer "Simon Nicolussi" . "sinic@sinic.name") (:keywords "unix") (:url . "https://github.com/sinic/ednc"))]) + (edts . [(20220415 1722) ((auto-complete (20201213 1255)) (auto-highlight-symbol (20211106 638)) (dash (20210609 1330)) (emacs (24 3)) (erlang (20210315 1640)) (f (20191110 1357)) (popup (20210317 138)) (s (20210603 736))) "Erlang Development Tool Suite" tar ((:commit . "5c096ecdf9462b125f2eb4092899ff63636cfc40"))]) + (edwina . [(20200113 1714) ((emacs (25))) "Dynamic window manager" tar ((:commit . "c5368716a504c93407fd8cb4ef925a8d8eb62698") (:authors ("Alex Griffin" . "a@ajgrf.com")) (:maintainer "Alex Griffin" . "a@ajgrf.com") (:keywords "convenience") (:url . "https://github.com/ajgrf/edwina"))]) + (efar . [(20211122 1943) ((emacs (26 1))) "FAR-like file manager" single ((:commit . "49dc9b89a8b9bf2523c202ac8830d1245768f3f4") (:authors ("\"Vladimir Suntsov\"" . "vladimir@suntsov.online")) (:maintainer nil . "vladimir@suntsov.online") (:keywords "files") (:url . "https://github.com/suntsov/efar"))]) + (efire . [(20151009 2031) ((circe (1 2))) "Use campfire from Emacs" single ((:commit . "91a644662afb352475efad0b377713656f131e5c") (:authors ("João Távora" . "joaotavora@gmail.com")) (:maintainer "João Távora" . "joaotavora@gmail.com") (:keywords "convenience" "tools") (:url . "https://github.com/capitaomorte/efire"))]) + (eg . [(20170830 815) ((cl-lib (0 5)) (emacs (24 3))) "Norton Guide reader" single ((:commit . "1c7f1613d2aaae728ef540305f6ba030616f86bd") (:authors ("Dave Pearson" . "davep@davep.org")) (:maintainer "Dave Pearson" . "davep@davep.org") (:keywords "docs") (:url . "https://github.com/davep/eg.el"))]) + (egalgo . [(20211105 1657) ((emacs (24 3))) "Genetic algorithm" single ((:commit . "a56a86591351d53ca2add7c651757bfb0064fb22") (:authors ("ROCKTAKEY" . "rocktakey@gmail.com")) (:maintainer "ROCKTAKEY" . "rocktakey@gmail.com") (:keywords "data") (:url . "https://github.com/ROCKTAKEY/egalgo"))]) + (egg . [(20181126 500) nil "Emacs Got Git - Emacs interface to Git" tar ((:commit . "00e768a78ac3d25f457eed667d02cac568480bf9") (:authors ("Bogolisk" . "bogolisk@gmail.com")) (:maintainer "Bogolisk" . "bogolisk@gmail.com") (:keywords "git" "version control" "release management"))]) + (egg-timer . [(20200217 1650) ((emacs (25 1))) "Commonly used intervals for setting timers while working" single ((:commit . "e3542aeb80905956b94373a222a9cbac04e6497e") (:authors ("William Carroll" . "wpcarro@gmail.com")) (:maintainer "William Carroll" . "wpcarro@gmail.com") (:url . "https://github.com/wpcarro/egg-timer.el"))]) + (egison-mode . [(20200107 2333) nil "Egison editing mode" tar ((:commit . "dbb395b41a4e4eb69f3f045cbfbe95a1575ac45b") (:authors ("Satoshi Egi" . "egisatoshi@gmail.com")) (:maintainer "Satoshi Egi" . "egisatoshi@gmail.com") (:url . "https://github.com/egisatoshi/egison3/blob/master/elisp/egison-mode.el"))]) + (eglot . [(20220509 1904) ((emacs (26 1)) (jsonrpc (1 0 14)) (flymake (1 2 1)) (project (0 3 0)) (xref (1 0 1)) (eldoc (1 11 0)) (seq (2 23))) "Client for Language Server Protocol (LSP) servers" single ((:commit . "ba618d2cee55c8c339d46621b7e721957cc30a72") (:authors ("João Távora" . "joaotavora@gmail.com")) (:maintainer "João Távora" . "joaotavora@gmail.com") (:keywords "convenience" "languages") (:url . "https://github.com/joaotavora/eglot"))]) + (eglot-fsharp . [(20220409 1811) ((emacs (27 1)) (eglot (1 4)) (fsharp-mode (1 10)) (jsonrpc (1 0 14))) "fsharp-mode eglot integration" single ((:commit . "5208b54098c7534f4768b87c5f4c8a01b638737b") (:authors ("Jürgen Hötzel" . "juergen@archlinux.org")) (:maintainer "Jürgen Hötzel" . "juergen@archlinux.org") (:keywords "languages") (:url . "https://github.com/fsharp/emacs-fsharp-mode"))]) + (eglot-java . [(20220403 1815) ((emacs (26 1)) (eglot (1 0)) (jsonrpc (1 0 0))) "Java extension for the eglot LSP client" single ((:commit . "da76eb69b3f86992d62302649a987f157b7b7371") (:authors ("Yves Zoundi" . "yves_zoundi@hotmail.com")) (:maintainer "Yves Zoundi" . "yves_zoundi@hotmail.com") (:keywords "convenience" "languages") (:url . "https://github.com/yveszoundi/eglot-java"))]) + (eglot-jl . [(20211208 359) ((emacs (25 1)) (eglot (1 4)) (julia-mode (0 3))) "Julia support for eglot" tar ((:commit . "2e35cf9768d97a0429a72deddbe30d6d7722d454") (:authors ("Adam Beckmeyer" . "adam_git@thebeckmeyers.xyz")) (:maintainer "Adam Beckmeyer" . "adam_git@thebeckmeyers.xyz") (:keywords "convenience" "languages") (:url . "https://github.com/non-Jedi/eglot-jl"))]) + (ego . [(20200803 1101) ((emacs (24 5)) (ht (1 5)) (mustache (0 22)) (htmlize (1 47)) (org (8 0)) (dash (2 0 0))) "a static site generator based on org mode, forked from org-page." tar ((:commit . "211c4cb2af2582849d9df984fb2346deecaf79be") (:authors ("Feng Shu ") ("Kelvin Hu ") ("Kuangdash ")) (:maintainer "Feng Shu ") (:keywords "org-mode" "convenience" "beautify") (:url . "https://github.com/emacs-china/EGO"))]) + (eide . [(20220316 619) nil "IDE interface" tar ((:commit . "23c78f4850f44d18eef66c694e7e05882d841ba6") (:authors ("Cédric Marie" . "cedric@hjuvi.fr.eu.org")) (:maintainer "Cédric Marie" . "cedric@hjuvi.fr.eu.org") (:url . "https://forge.chapril.org/hjuvi/eide"))]) + (eimp . [(20120826 2039) nil "Emacs Image Manipulation Package" single ((:commit . "2e7536fe6d8f7faf1bad7a8ae37faba0162c3b4f") (:authors ("Matthew P. Hodges" . "MPHodges@member.fsf.org")) (:maintainer "Nic Ferrier" . "nferrier@ferrier.me.uk") (:keywords "files" "frames"))]) + (ein . [(20220419 735) ((emacs (25)) (websocket (1 12)) (anaphora (1 0 4)) (request (0 3 3)) (deferred (0 5)) (polymode (0 2 2)) (dash (2 13 0)) (with-editor (0 -1))) "Emacs IPython Notebook" tar ((:commit . "388c8f753cfb99b4f82acbdff26bbe27189d2299") (:keywords "jupyter" "literate programming" "reproducible research") (:url . "https://github.com/dickmao/emacs-ipython-notebook"))]) + (eink-theme . [(20190219 858) nil "E Ink color theme" single ((:commit . "326b07523dcb076d6209cdbc7fdbb73df296dbdb") (:authors ("Marian Schubert" . "marian.schubert@gmail.com")) (:maintainer "Marian Schubert" . "marian.schubert@gmail.com") (:url . "http://github.com/maio/eink-emacs"))]) + (ejc-sql . [(20220414 1329) ((emacs (26 3)) (clomacs (0 0 5)) (dash (2 16 0)) (spinner (1 7 3)) (direx (1 0 0))) "Emacs SQL client uses Clojure JDBC." tar ((:commit . "5c6341c751da9c7dbed43eafc8e99f456c1de0d2") (:authors ("Kostafey" . "kostafey@gmail.com")) (:maintainer "Kostafey" . "kostafey@gmail.com") (:keywords "sql" "jdbc") (:url . "https://github.com/kostafey/ejc-sql"))]) + (ejson-mode . [(20190720 2138) ((emacs (25))) "Major mode for editing ejson files." single ((:commit . "9630dfac9549779711dbe89e621f516bb4b3a354") (:authors ("Dante Catalfamo")) (:maintainer "Dante Catalfamo") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/dantecatalfamo/ejson-mode"))]) + (el-autoyas . [(20120918 1317) nil "Automatically create Emacs-Lisp Yasnippets" tar ((:commit . "bde0251ecb504f585dfa27c205c8e312655310cc") (:authors ("Matthew L. Fidler")) (:maintainer "Matthew L. Fidler") (:keywords "emacs" "lisp" "mode" "yasnippet") (:url . "https://github.com/mlf176f2/el-autoyas.el"))]) + (el-fetch . [(20220509 1439) ((emacs (25 1))) "Show system information in Neofetch-like style (eg CPU, RAM)" single ((:commit . "7fdb153ea2a40955ae3a9551da63d173fb59cb39") (:authors ("Maciej Barć" . "xgqt@riseup.net")) (:maintainer "Maciej Barć" . "xgqt@riseup.net") (:url . "https://gitlab.com/xgqt/emacs-el-fetch"))]) + (el-fly-indent-mode . [(20180422 243) ((emacs (25))) "Indent Emacs Lisp on the fly" single ((:commit . "39738c88c01a3a035edffe63400d434edb1e3003") (:authors ("Jiahao Li" . "jiahaowork@gmail.com")) (:maintainer "Jiahao Li" . "jiahaowork@gmail.com") (:keywords "lisp" "languages") (:url . "https://github.com/jiahaowork/el-fly-indent-mode.el"))]) + (el-get . [(20211224 959) nil "Manage the external elisp bits and pieces you depend upon" tar ((:commit . "9353309744e4f8a7c9b1adf22ec99536fb2146b0") (:authors ("Dimitri Fontaine" . "dim@tapoueh.org")) (:maintainer "Dimitri Fontaine" . "dim@tapoueh.org") (:keywords "emacs" "package" "elisp" "install" "elpa" "git" "git-svn" "bzr" "cvs" "svn" "darcs" "hg" "apt-get" "fink" "pacman" "http" "http-tar" "emacswiki") (:url . "http://www.emacswiki.org/emacs/el-get"))]) + (el-init . [(20150728 920) ((emacs (24)) (cl-lib (0 5)) (anaphora (1 0 0))) "A loader inspired by init-loader" single ((:commit . "7538e1511ff7ceea2ba65ed4783c57e2f9176ee6") (:authors ("Hiroki YAMAKAWA" . "s06139@gmail.com")) (:maintainer "Hiroki YAMAKAWA" . "s06139@gmail.com") (:url . "https://github.com/HKey/el-init"))]) + (el-init-viewer . [(20150303 828) ((emacs (24)) (cl-lib (0 5)) (ctable (0 1 2)) (dash (2 10 0)) (anaphora (1 0 0)) (el-init (0 1 4))) "Record viewer for el-init" single ((:commit . "7c0169d356d6c007317e253e5776e1e48a60d6ad") (:authors ("Hiroki YAMAKAWA" . "s06139@gmail.com")) (:maintainer "Hiroki YAMAKAWA" . "s06139@gmail.com") (:url . "https://github.com/HKey/el-init-viewer"))]) + (el-mock . [(20170824 1954) nil "Tiny Mock and Stub framework in Emacs Lisp" single ((:commit . "6ebfe64410d54b4cf76f655e416d49935d5e2ceb") (:authors ("rubikitch" . "rubikitch@ruby-lang.org")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "lisp" "testing" "unittest") (:url . "http://github.com/rejeep/el-mock.el"))]) + (el-patch . [(20220509 2253) ((emacs (26))) "Future-proof your Elisp" tar ((:commit . "156c61b72c1c9c61bd886b5931b8a382153f52fa") (:authors ("Radian LLC" . "contact+el-patch@radian.codes")) (:maintainer "Radian LLC" . "contact+el-patch@radian.codes") (:keywords "extensions") (:url . "https://github.com/radian-software/el-patch"))]) + (el-secretario . [(20220422 2005) ((emacs (27 1)) (org-ql (0 6 -1)) (hercules (0 3))) "Unify all your inboxes with the Emacs secretary" tar ((:commit . "c28a4f42829ed1f96a17abb63a8616216db913a5") (:authors ("Leo Okawa Ericson ")) (:maintainer "Leo" . "github@relevant-information.com") (:keywords "convenience") (:url . "https://git.sr.ht/~zetagon/el-secretario"))]) + (el-secretario-elfeed . [(20211214 1851) ((emacs (27 1)) (el-secretario (0 0 1)) (elfeed (3 4 1))) "Add notmuch email inboxes to el-secretario" single ((:commit . "c28a4f42829ed1f96a17abb63a8616216db913a5") (:authors ("Leo Okawa Ericson ")) (:maintainer "Leo" . "github@relevant-information.com") (:keywords "convenience") (:url . "https://git.sr.ht/~zetagon/el-secretario"))]) + (el-secretario-mu4e . [(20220422 2006) ((emacs (27 1)) (org-ql (0 6 -1)) (el-secretario (0 0 1))) "Add mu4e inboxes to el-secretario" single ((:commit . "c28a4f42829ed1f96a17abb63a8616216db913a5") (:authors ("Leo Okawa Ericson ")) (:maintainer "Leo" . "github@relevant-information.com") (:keywords "convenience" "mail") (:url . "https://git.sr.ht/~zetagon/el-secretario"))]) + (el-secretario-notmuch . [(20220426 1905) ((emacs (27 1)) (el-secretario (0 0 1)) (notmuch (0 3 1))) "Add notmuch inboxes to el-secretario" single ((:commit . "c28a4f42829ed1f96a17abb63a8616216db913a5") (:authors ("Leo Okawa Ericson ")) (:maintainer "Leo" . "github@relevant-information.com") (:keywords "convenience" "mail") (:url . "https://git.sr.ht/~zetagon/el-secretario"))]) + (el-secretario-org . [(20220411 1419) ((emacs (27 1)) (org-ql (0 6 -1)) (dash (2 18 1)) (el-secretario (0 0 1))) "Create inboxes out of org-mode files for el-secretario" single ((:commit . "c28a4f42829ed1f96a17abb63a8616216db913a5") (:authors ("Leo Okawa Ericson ")) (:maintainer "Leo" . "github@relevant-information.com") (:keywords "convenience") (:url . "https://git.sr.ht/~zetagon/el-secretario"))]) + (el-spec . [(20121018 704) nil "ruby's rspec like syntax test frame work" single ((:commit . "1dbc465401d4aea5560318c4f13ff30920a0718d") (:authors ("Yuuki Arisawa" . "yuuki.ari@gmail.com")) (:maintainer "Yuuki Arisawa" . "yuuki.ari@gmail.com") (:keywords "test") (:url . "https://github.com/uk-ar/el-spec"))]) + (el-spice . [(20201013 1729) nil "Extra spice for emacs lisp programming" tar ((:commit . "a1adde201ee10881b522e67aa2c605378943a28d") (:authors ("Vedang Manerikar" . "vedang.manerikar@gmail.com")) (:maintainer "Vedang Manerikar" . "vedang.manerikar@gmail.com") (:keywords "languages" "extensions") (:url . "https://github.com/vedang/el-spice"))]) + (el-sprunge . [(20200312 1212) ((web-server (20140105 2246)) (htmlize (20130207 1202)) (emacs (24 3))) "Command line paste server with Emacs highlighting" tar ((:commit . "e4365ea0bdf60969817619376bdcc98003fec33d") (:authors ("Eric Schulte" . "schulte.eric@gmail.com")) (:maintainer "Eric Schulte" . "schulte.eric@gmail.com") (:keywords "http" "html" "server" "sprunge" "paste"))]) + (el-spy . [(20131226 2008) nil "Mocking framework for Emacs lisp. It also support spy, proxy." single ((:commit . "b1dead9d1877660856ada22d906ac4e54695aec7") (:authors ("Yuuki Arisawa" . "yuuki.ari@gmail.com")) (:maintainer "Yuuki Arisawa" . "yuuki.ari@gmail.com") (:keywords "test") (:url . "https://github.com/uk-ar/el-spy"))]) + (el2markdown . [(20170630 1858) nil "Convert commentary section of elisp files to markdown." single ((:commit . "368d99313683cd943c99feaffca356be60bdb636") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:url . "https://github.com/Lindydancer/el2markdown"))]) + (el2org . [(20200408 146) ((emacs (25 1))) "Convert elisp file to org file" single ((:commit . "7db77fdd73f378d4e60e34c11bbdf00677adc32c") (:authors ("Feng Shu " . "tumashu@163.com")) (:maintainer "Feng Shu " . "tumashu@163.com") (:keywords "convenience") (:url . "https://github.com/tumashu/el2org"))]) + (elbank . [(20180316 1343) ((emacs (25)) (seq (2 16))) "Personal finances reporting application" tar ((:commit . "fa9bc7dec0a8fd489e90b9f178719344cc8d315a") (:authors ("Nicolas Petton" . "nicolas@petton.fr")) (:maintainer "Nicolas Petton" . "nicolas@petton.fr") (:keywords "tools" "personal-finances"))]) + (elcontext . [(20210109 1238) ((ht (2 3)) (hydra (0 14 0)) (emacs (24 3)) (f (0 20 0)) (osx-location (0 4)) (uuidgen (0 3))) "Create context specific actions" tar ((:commit . "2efd3dd8c5176c4f071bb048be6cb069b05d6e9e") (:authors ("Thomas Sojka")) (:maintainer "Thomas Sojka") (:keywords "calendar" "convenience") (:url . "https://github.com/rollacaster/elcontext"))]) + (elcord . [(20220305 1234) ((emacs (25 1))) "Allows you to integrate Rich Presence from Discord" tar ((:commit . "70fd716e673b724b30b921f4cfa0033f9c02d0f2") (:authors ("heatingdevice") ("Wilfredo Velázquez-Rodríguez" . "zulu.inuoe@gmail.com")) (:maintainer "heatingdevice") (:keywords "games") (:url . "https://github.com/Mstrodl/elcord"))]) + (elcouch . [(20201108 955) ((emacs (25 1)) (json-mode (1 0 0)) (libelcouch (0 11 0)) (navigel (0 3 0))) "View and manipulate CouchDB databases" single ((:commit . "3d162dda14411349e12509029d2b621c5d1edea2") (:authors ("Damien Cassou" . "damien@cassou.me")) (:maintainer "Damien Cassou" . "damien@cassou.me") (:keywords "data" "tools") (:url . "https://gitlab.petton.fr/DamienCassou/elcouch"))]) + (eldev . [(20220501 1128) ((emacs (24 4))) "Elisp Development Tool" tar ((:commit . "7275089749779599d87bee878e5103921ea919f9") (:authors ("Paul Pogonyshev" . "pogonyshev@gmail.com")) (:maintainer "Paul Pogonyshev" . "pogonyshev@gmail.com") (:keywords "maint" "tools") (:url . "https://github.com/doublep/eldev"))]) + (eldoc-box . [(20220506 28) ((emacs (27 1))) "Display documentation in childframe" single ((:commit . "8d523f4fddbd8986340cf76f349ab18c0b3d5581") (:authors ("Sebastien Chapuis" . "sebastien@chapu.is")) (:maintainer "Yuan Fu" . "casouri@gmail.com") (:url . "https://github.com/casouri/eldoc-box"))]) + (eldoc-cmake . [(20190419 2244) ((emacs (25 1))) "Eldoc support for CMake" single ((:commit . "4453c03b5c95ff32842f13db2fc317fb0fe2f79e") (:authors ("Kirill Ignatiev")) (:maintainer "Kirill Ignatiev") (:url . "https://github.com/ikirill/eldoc-cmake"))]) + (eldoc-eval . [(20220106 1951) nil "Enable eldoc support when minibuffer is in use." single ((:commit . "e91800503c90cb75dc70abe42f1d6ae499346cc1") (:authors ("Thierry Volpiatto" . "thievol@posteo.net")) (:maintainer "Thierry Volpiatto" . "thievol@posteo.net"))]) + (eldoc-overlay . [(20220210 1358) ((emacs (24 3)) (inline-docs (1 0 1)) (quick-peek (1 0))) "Display eldoc with contextual documentation overlay." single ((:commit . "b96f5864a47407ec608c807e0d890f62b891ee03") (:authors ("stardiviner" . "numbchild@gmail.com")) (:maintainer "stardiviner" . "numbchild@gmail.com") (:keywords "documentation" "eldoc" "overlay") (:url . "https://repo.or.cz/eldoc-overlay.git"))]) + (eldoc-stan . [(20211129 2051) ((emacs (25)) (stan-mode (10 3 0))) "Eldoc support for stan functions" tar ((:commit . "150bbbe5fd3ad2b5a3dbfba9d291e66eeea1a581") (:authors ("Kazuki Yoshida" . "kazukiyoshida@mail.harvard.edu")) (:maintainer "Kazuki Yoshida" . "kazukiyoshida@mail.harvard.edu") (:keywords "help" "tools") (:url . "https://github.com/stan-dev/stan-mode/tree/master/eldoc-stan"))]) + (eldoc-toml . [(20211026 1122) ((emacs (24 4))) "TOML table name at point for ElDoc" single ((:commit . "61106be3c3f3a5b293c3f285eec8c6f400142b6d") (:authors ("Maor Kadosh" . "git@avocadosh.xyz")) (:maintainer "Maor Kadosh" . "git@avocadosh.xyz") (:keywords "data") (:url . "https://github.com/it-is-wednesday/eldoc-toml"))]) + (electric-case . [(20150417 1112) nil "insert camelCase, snake_case words without \"Shift\"ing" single ((:commit . "bac64e772107e3dc721a9819f63b9ebdc28a81f7") (:authors ("zk_phi")) (:maintainer "zk_phi") (:url . "http://hins11.yu-yake.com/"))]) + (electric-cursor . [(20220108 2052) ((emacs (25 1))) "Change cursor automatically depending on mode" single ((:commit . "92f77b05fec80c5440a8b800b33345dabca13872") (:authors ("Case Duckworth" . "acdw@acdw.net")) (:maintainer "Case Duckworth" . "acdw@acdw.net") (:keywords "terminals" "frames") (:url . "https://github.com/duckwork/electric-cursor"))]) + (electric-operator . [(20220417 809) ((dash (2 10 0)) (emacs (24 4))) "Automatically add spaces around operators" tar ((:commit . "f567f03da4a55d6eafa0e6e148ca4884d5370498") (:authors ("David Shepherd" . "davidshepherd7@gmail.com")) (:maintainer "David Shepherd" . "davidshepherd7@gmail.com") (:keywords "electric") (:url . "https://github.com/davidshepherd7/electric-operator"))]) + (electric-spacing . [(20220220 1540) nil "Insert operators with surrounding spaces smartly" tar ((:commit . "c37b2502512dd49a8311d7c34e9bfd1af3d4dbcd") (:authors ("William Xu" . "william.xwl@gmail.com")) (:maintainer "William Xu" . "william.xwl@gmail.com"))]) + (elegant-agenda-mode . [(20210115 353) ((emacs (26 1))) "An elegant theme for your org-agenda" single ((:commit . "5cbc688584ba103ea3be7d7b30e5d94e52f59eb6") (:authors ("Justin Barclay" . "justinbarclay@gmail.com")) (:maintainer "Justin Barclay" . "justinbarclay@gmail.com") (:keywords "faces") (:url . "https://github.com/justinbarclay/elegant-agenda-mode"))]) + (elein . [(20120120 1116) nil "running leiningen commands from emacs" single ((:commit . "d4c0c0491dbb7c90e953d7a16172107c37103605") (:authors ("R.W. van 't Veer")) (:maintainer "R.W. van 't Veer") (:keywords "tools" "processes") (:url . "https://github.com/remvee/elein"))]) + (elescope . [(20210312 1147) ((emacs (25 1)) (ivy (0 10)) (request (0 3)) (seq (2 0))) "Seach and clone projects from the minibuffer" single ((:commit . "36566c8c1f5f993f67eadc85d18539ff375c0f98") (:authors ("Stéphane Maniaci" . "stephane.maniaci@gmail.com")) (:maintainer "Stéphane Maniaci" . "stephane.maniaci@gmail.com") (:keywords "vc") (:url . "https://github.com/freesteph/elescope"))]) + (elf-mode . [(20161009 748) ((emacs (24 3))) "Show symbols in binaries" single ((:commit . "cd280d683cd3341d8bb31af6db7e3b74a133e6ab") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "matching") (:url . "https://github.com/abo-abo/elf-mode"))]) + (elfeed . [(20210822 2129) ((emacs (24 3))) "an Emacs Atom/RSS feed reader" tar ((:commit . "162d7d545ed41c27967d108c04aa31f5a61c8e16") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/elfeed"))]) + (elfeed-autotag . [(20210607 637) ((emacs (27 1)) (elfeed (3 4 1)) (elfeed-protocol (0 8 0)) (org (8 2 7)) (dash (2 10 0)) (s (1 9 0))) "Easy auto-tagging for elfeed" single ((:commit . "bc62c37fb79b720ff8b6d67f04f2268841306dcd") (:authors ("Paul Elms ")) (:maintainer "Paul Elms" . "paul@elms.pro") (:keywords "news") (:url . "https://github.com/paulelms/elfeed-autotag"))]) + (elfeed-dashboard . [(20210727 603) ((emacs (25 1)) (elfeed (3 3 0))) "An extensible frontend for elfeed using org-mode" single ((:commit . "26ff3573efce3cb66c8814854a2983a69683af09") (:authors ("Manoj Kumar Manikchand" . "manojm321@protonmail.com")) (:maintainer "Manoj Kumar Manikchand" . "manojm321@protonmail.com") (:keywords "convenience") (:url . "https://github.com/Manoj321/elfeed-dashboard"))]) + (elfeed-goodies . [(20220306 2253) ((popwin (1 0 0)) (powerline (2 2)) (elfeed (2 0 0)) (cl-lib (0 5)) (link-hint (0 1))) "Elfeed goodies" tar ((:commit . "6711de66c22360f80fcfd9730293e5f3d419f787") (:authors ("Gergely Nagy")) (:maintainer "Gergely Nagy") (:url . "https://github.com/algernon/elfeed-goodies"))]) + (elfeed-org . [(20220420 1234) ((elfeed (1 1 1)) (org (8 2 7)) (dash (2 10 0)) (s (1 9 0)) (cl-lib (0 5))) "Configure elfeed with one or more org-mode files" single ((:commit . "e6bf4268485703907a97896fb1080f59977c9e3d") (:authors ("Remy Honig" . "remyhonig@gmail.com")) (:maintainer "Remy Honig" . "remyhonig@gmail.com") (:keywords "news") (:url . "https://github.com/remyhonig/elfeed-org"))]) + (elfeed-protocol . [(20220419 1358) ((emacs (24 4)) (elfeed (2 1 1)) (cl-lib (0 5))) "Provide fever/newsblur/owncloud/ttrss protocols for elfeed" tar ((:commit . "eaf1329ff221098eb6d4709245010d070c89b173") (:authors ("Xu Fasheng ")) (:maintainer "Xu Fasheng ") (:keywords "news") (:url . "https://github.com/fasheng/elfeed-protocol"))]) + (elfeed-score . [(20220428 123) ((emacs (26 1)) (elfeed (3 3 0))) "Gnus-style scoring for Elfeed" tar ((:commit . "419de17d681d75789271b8457509fa3f942eab54") (:authors ("Michael Herstine" . "sp1ff@pobox.com")) (:maintainer "Michael Herstine" . "sp1ff@pobox.com") (:keywords "news") (:url . "https://github.com/sp1ff/elfeed-score"))]) + (elfeed-summary . [(20220506 720) ((emacs (27 1)) (magit-section (3 3 0)) (elfeed (3 4 1))) "Feed summary interface for elfeed" single ((:commit . "641a453cfd03e098b5e6376e035eafd080b08781") (:authors ("Korytov Pavel" . "thexcloud@gmail.com")) (:maintainer "Korytov Pavel" . "thexcloud@gmail.com") (:url . "https://github.com/SqrtMinusOne/elfeed-summary.el"))]) + (elfeed-web . [(20210226 258) ((simple-httpd (1 5 1)) (elfeed (3 2 0)) (emacs (24 3))) "web interface to Elfeed" tar ((:commit . "162d7d545ed41c27967d108c04aa31f5a61c8e16") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/elfeed"))]) + (elforth . [(20210522 928) ((emacs (26 1))) "Do you have what it takes to hack Emacs Lisp in Forth?" single ((:commit . "2d8540434a28e7edaa04a992c3c362832b2fd61e") (:authors ("Lassi Kortela" . "lassi@lassi.io")) (:maintainer "Lassi Kortela" . "lassi@lassi.io") (:keywords "games") (:url . "https://github.com/lassik/elforth"))]) + (elgrep . [(20211221 852) ((emacs (26 2)) (async (1 5))) "Searching files for regular expressions" single ((:commit . "f8124c699b6a4abfb471269bc26afbcc8136f476") (:authors ("Tobias Zawada" . "i@tn-home.de")) (:maintainer "Tobias Zawada" . "i@tn-home.de") (:keywords "tools" "matching" "files" "unix") (:url . "https://github.com/TobiasZawada/elgrep"))]) + (elhome . [(20161025 2042) ((initsplit (20120630))) "A framework for a \"home\" Emacs configuration" tar ((:commit . "e789e806469af3e9705f72298683c21f6c3a516d") (:authors ("Dave Abrahams" . "dave@boostpro.com")) (:maintainer "Demyan Rogozhin" . "demyan.rogozhin@gmail.com") (:keywords "lisp") (:url . "http://github.com/demyanrogozhin/elhome"))]) + (elisp-def . [(20210126 750) ((dash (2 12 0)) (f (0 19 0)) (s (1 11 0)) (emacs (24 3))) "macro-aware go-to-definition for elisp" single ((:commit . "dfca043ec0cbead67bd9c526cb009daf771d0fa2") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk") (:keywords "lisp"))]) + (elisp-demos . [(20210312 542) ((emacs (24 4))) "Elisp API Demos" tar ((:commit . "924b07d28e4f5b82f0e1377bcde800068f0a6d9d") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:keywords "lisp" "docs") (:url . "https://github.com/xuchunyang/elisp-demos"))]) + (elisp-depend . [(20190325 1114) nil "Parse depend libraries of elisp file." single ((:commit . "6679da9a6be5a845bb4804224c8394a9bc62168f"))]) + (elisp-depmap . [(20220223 1131) ((emacs (26 1)) (dash (2 17 0))) "Generate an elisp dependency map in graphviz" tar ((:commit . "15909462e3f7daf445d3cecf402ee16c7e3263ed") (:authors ("Mehmet Tekman")) (:maintainer "Mehmet Tekman") (:keywords "outlines") (:url . "https://gitlab.com/mtekman/elisp-depmap.el"))]) + (elisp-docstring-mode . [(20170304 1615) nil "Major mode for editing elisp docstrings." single ((:commit . "f512e509dd690f65133e55563ebbfd2dede5034f") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "languages"))]) + (elisp-format . [(20160508 952) nil "Format elisp code" single ((:commit . "03cc293eb2f78ec58fc1d84279af06816a04b979") (:authors (nil . "Andy Stewart lazycat.manatee@gmail.com")) (:maintainer "Yuki Inoue inouetakahiroki _at_ gmail.com") (:url . "https://github.com/Yuki-Inoue/elisp-format"))]) + (elisp-lint . [(20220419 252) ((emacs (24 4)) (dash (2 15 0)) (package-lint (0 11))) "Basic linting for Emacs Lisp" single ((:commit . "c5765abf75fd1ad22505b349ae1e6be5303426c2") (:authors ("Nikolaj Schumacher ,")) (:maintainer "Neil Okamoto" . "neil.okamoto+melpa@gmail.com") (:keywords "lisp" "maint" "tools") (:url . "http://github.com/gonewest818/elisp-lint/"))]) + (elisp-refs . [(20220220 2305) ((dash (2 12 0)) (s (1 11 0))) "find callers of elisp functions or macros" single ((:commit . "8f84280997d8b233d66fb9958a34b46078c58b03") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk") (:keywords "lisp"))]) + (elisp-sandbox . [(20131116 1842) nil "Evaluate EmacsLisp expressions in a sandbox" single ((:commit . "d894d68934ef09c42f72ac4e1173a0bedc23f139") (:authors ("Joel McCracken , D. Goel" . "deego@gnufans.org")) (:maintainer "Joel McCracken , D. Goel" . "deego@gnufans.org") (:keywords "lisp") (:url . "https://github.com/joelmccracken/elisp-sandbox"))]) + (elisp-slime-nav . [(20210510 528) ((emacs (24 1)) (cl-lib (0 2))) "Make M-. and M-, work in elisp like they do in slime" single ((:commit . "8588d80d414aee1fafce5b9da0e913612ee0bcdd") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "languages" "navigation" "slime" "elisp" "emacs-lisp") (:url . "https://github.com/purcell/elisp-slime-nav"))]) + (elixir-mode . [(20220314 1302) ((emacs (25))) "Major mode for editing Elixir files" tar ((:commit . "e0d0466d83ec80ddb412bb1473908a21baad1ec3") (:keywords "languages" "elixir") (:url . "https://github.com/elixir-editors/emacs-elixir"))]) + (elixir-yasnippets . [(20150417 1239) ((yasnippet (0 8 0))) "Yasnippets for Elixir" tar ((:commit . "980ca7626c14ef0573bec0035ec7942796062783") (:authors ("Yinghai Zhao" . "zyinghai@gmail.com")) (:maintainer "Yinghai Zhao" . "zyinghai@gmail.com") (:keywords "snippets"))]) + (ellocate . [(20200112 1931) ((emacs (25 1)) (s (1 12 0)) (f (0 20 0))) "The locate command reimplemented in Emacs Lisp" single ((:commit . "81405082f68f0577c9f176d3d4f034a7142aba59") (:authors ("Sebastian Wålinder" . "s.walinder@gmail.com")) (:maintainer "Sebastian Wålinder" . "s.walinder@gmail.com") (:keywords "matching") (:url . "https://github.com/walseb/ellocate"))]) + (elm-mode . [(20220227 931) ((f (0 17)) (s (1 7 0)) (emacs (25 1)) (seq (2 23)) (reformatter (0 3))) "Major mode for Elm" tar ((:commit . "1e277684d8a6681a2410cce2dd589ee30a998369") (:authors ("Joseph Collard")) (:maintainer "Joseph Collard") (:url . "https://github.com/jcollard/elm-mode"))]) + (elm-test-runner . [(20190105 1923) ((emacs (24 4))) "Enhanced support for running elm-test" single ((:commit . "a31d567a64d86d36e3675347abd696824a731e0c") (:authors ("Juan Edi")) (:maintainer "Juan Edi") (:url . "https://github.com/juanedi/elm-test-runner"))]) + (elm-yasnippets . [(20160401 524) ((yasnippet (0 8 0))) "Yasnippets for Elm" tar ((:commit . "45a11a0cef0c36633fb3477d3dc4167e82779ba4") (:authors ("Austin Bingham" . "austin.bingham@gmail.com")) (:maintainer "Austin Bingham" . "austin.bingham@gmail.com") (:keywords "snippets"))]) + (elmacro . [(20210716 639) ((s (1 11 0)) (dash (2 13 0))) "Convert keyboard macros to emacs lisp" single ((:commit . "d2e05012cee4f54fab6d8d8d6aced6e5eeef4f31") (:authors ("Philippe Vaucher" . "philippe.vaucher@gmail.com")) (:maintainer "Philippe Vaucher" . "philippe.vaucher@gmail.com") (:keywords "macro" "elisp" "convenience") (:url . "https://github.com/Silex/elmacro"))]) + (elmine . [(20200520 1237) ((s (1 10 0))) "Redmine API access via elisp." single ((:commit . "c78cc8705c2dffbf649b858f02b5028225943482") (:authors ("Arthur Andersen" . "leoc.git@gmail.com")) (:maintainer "Arthur Andersen" . "leoc.git@gmail.com") (:keywords "tools") (:url . "http://github.com/leoc/elmine"))]) + (elmpd . [(20210904 7) ((emacs (25 1))) "A tight, ergonomic, async client library for mpd" single ((:commit . "c9e413fcb6c526c86e1a64d45c7ea94aceca4e6e") (:authors ("Michael Herstine" . "sp1ff@pobox.com")) (:maintainer "Michael Herstine" . "sp1ff@pobox.com") (:keywords "comm") (:url . "https://github.com/sp1ff/elmpd"))]) + (elnode . [(20190702 1509) ((web (0 1 4)) (dash (1 1 0)) (noflet (0 0 7)) (s (1 5 0)) (creole (0 8 14)) (fakir (0 1 6)) (db (0 0 5)) (kv (0 0 17))) "The Emacs webserver." tar ((:commit . "29ef0f51a65a24fca7fdcdb4140d2e4556e4bb29") (:authors ("Nic Ferrier" . "nferrier@ferrier.me.uk")) (:maintainer "GitHub user \"Jcaw\"") (:keywords "lisp" "http" "hypermedia"))]) + (elog . [(20160724 2255) ((eieio (1 3))) "logging library extended from logito" single ((:commit . "a67237d9813c7591614d95e2ef31cc5e5ed3f31b") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "lisp" "tool" "log"))]) + (elogcat . [(20151121 41) ((s (1 9 0)) (dash (2 10 0))) "logcat interface" single ((:commit . "4f311b7a07565b0d060334bc68edb36f2bff703f") (:authors ("Youngjoo Lee" . "youngker@gmail.com")) (:maintainer "Youngjoo Lee" . "youngker@gmail.com") (:keywords "tools"))]) + (eloud . [(20190706 1707) ((emacs (24 4))) "A lightweight, interactive screen reader" single ((:commit . "b8f4af1f652268d73281de91fb333b5984970847") (:authors ("Patrick Smyth" . "patricksmyth01@gmail.com")) (:maintainer "Patrick Smyth" . "patricksmyth01@gmail.com") (:keywords "extensions") (:url . "https://github.com/smythp/eloud"))]) + (elpa-audit . [(20141023 1331) nil "Handy functions for inspecting and comparing package archives" single ((:commit . "727da50e626977351aff2675b6540a36818bbbe6") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "maint") (:url . "https://github.com/purcell/elpa-audit"))]) + (elpa-clone . [(20211205 1237) ((emacs (24 4))) "Clone ELPA archive" single ((:commit . "03d8e2af55dfb34ab9da1f9385079a995383b2ea") (:authors ("ZHANG Weiyi" . "dochang@gmail.com")) (:maintainer "ZHANG Weiyi" . "dochang@gmail.com") (:keywords "comm" "elpa" "clone" "mirror") (:url . "https://github.com/dochang/elpa-clone"))]) + (elpa-deploy . [(20191022 718) ((emacs (24 4)) (f (0 0))) "ELPA deployment library" single ((:commit . "f5126a2da1e0e52981fad9c12028814be80328c2") (:authors ("Bruno Félix Rezende Ribeiro" . "oitofelix@gnu.org")) (:maintainer "Bruno Félix Rezende Ribeiro" . "oitofelix@gnu.org") (:keywords "tools") (:url . "https://github.com/oitofelix/elpa-deploy"))]) + (elpa-mirror . [(20220123 1237) ((emacs (25 1))) "Create local package repository from installed packages" single ((:commit . "3e0fe0f91d1c5798752c255b89950617f88b8d9e") (:authors ("Chen Bin" . "chenbin.sh@gmail.com")) (:maintainer "Chen Bin" . "chenbin.sh@gmail.com") (:keywords "tools") (:url . "http://github.com/redguardtoo/elpa-mirror"))]) + (elpher . [(20220503 833) ((emacs (27 1))) "A friendly gopher and gemini client" tar ((:commit . "bf0dd36eb2f5b339c6b561dbe3ee9693565b484b") (:authors ("Tim Vaughan" . "plugd@thelambdalab.xyz")) (:maintainer "Tim Vaughan" . "plugd@thelambdalab.xyz") (:keywords "comm" "gopher") (:url . "https://thelambdalab.xyz/elpher"))]) + (elpl . [(20220314 1353) ((emacs (24 4))) "Emacs Lisp REPL" single ((:commit . "32eaec0fc7d20b8acbd4d459bfb8f8b72d75bb66") (:authors ("Gong Qijian" . "gongqijian@gmail.com")) (:maintainer "Gong Qijian" . "gongqijian@gmail.com") (:keywords "lisp" "tool") (:url . "https://github.com/twlz0ne/elpl"))]) + (elpy . [(20220322 41) ((company (0 9 2)) (emacs (24 4)) (highlight-indentation (0 5 0)) (pyvenv (1 3)) (yasnippet (0 8 0)) (s (1 11 0))) "Emacs Python Development Environment" tar ((:commit . "1746e7009000b7635c0ea6f1559018143aa61642") (:authors ("Jorgen Schaefer , Gaby Launay" . "gaby.launay@protonmail.com")) (:maintainer "Jorgen Schaefer , Gaby Launay" . "gaby.launay@protonmail.com") (:keywords "python" "ide" "languages" "tools") (:url . "https://github.com/jorgenschaefer/elpy"))]) + (elpygen . [(20171225 1736) ((emacs (25)) (yasnippet (0 8 0))) "Generate a Python function/method using a symbol under point" single ((:commit . "21929c997a05968f9eefe52b85a76ceaab3b0d81") (:authors ("Vladimir Kazanov" . "vkazanov@inbox.ru")) (:maintainer "Vladimir Kazanov" . "vkazanov@inbox.ru") (:keywords "python" "languages" "tools") (:url . "https://github.com/vkazanov/elpygen"))]) + (elquery . [(20220331 143) ((emacs (25 1)) (dash (2 13 0))) "The HTML library for elisp" tar ((:commit . "38f3bd41096cb270919b06095da0b9ac1add4598") (:authors ("Adam Niederer")) (:maintainer "Adam Niederer") (:keywords "html" "hypermedia" "tools" "webscale") (:url . "https://github.com/AdamNiederer/elquery"))]) + (elsa . [(20220223 2021) ((trinary (1 0 0)) (emacs (25 1)) (seq (0)) (f (0)) (dash (2 14)) (cl-lib (0 3))) "Emacs Lisp Static Analyser" tar ((:commit . "21ed4f46e2d02ffb48b3ae377b0c93732ccf3f4f") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "languages" "lisp"))]) + (elscreen . [(20181009 451) ((emacs (24))) "Emacs window session manager" tar ((:commit . "cc58337faf5ba1eae7e87f75f6ff3758675688f2") (:authors ("Naoto Morishima" . "naoto@morishima.net")) (:maintainer "Akinori MUSHA" . "knu@iDaemons.org") (:keywords "window" "convenience") (:url . "https://github.com/knu/elscreen"))]) + (elscreen-buffer-group . [(20200109 2338) ((emacs (24 4)) (elscreen (0)) (cl-lib (0 5))) "elscreen buffer group" single ((:commit . "b48e71d4782adfeb2958f227d78c04164d26e4bd") (:authors ("Jeff Gran" . "jeff@jeffgran.com") ("Author: Ryan C. Thompson")) (:maintainer "Jeff Gran" . "jeff@jeffgran.com") (:keywords "buffer") (:url . "https://github.com/jeffgran/elscreen-buffer-group"))]) + (elscreen-fr . [(20160920 953) ((elscreen (0)) (seq (1 11))) "Use frame title as screen tab" single ((:commit . "6dc77e1d3f17b3f76da5ccf92b715572aa55fb85") (:authors ("Francesc Rocher" . "francesc.rocher@gmail.com")) (:maintainer "Francesc Rocher" . "francesc.rocher@gmail.com") (:url . "http://github.com/rocher/elscreen-fr"))]) + (elscreen-mew . [(20160504 1835) ((elscreen (20120413 807))) "ElScreen Add-On for Mew" single ((:commit . "c90a23441d836da14a1cb12788432308ba58e2b6") (:authors ("Takashi Masuda" . "masutaka.net@gmail.com")) (:maintainer "Takashi Masuda" . "masutaka.net@gmail.com") (:url . "https://github.com/masutaka/elscreen-mew"))]) + (elscreen-multi-term . [(20200417 821) ((emacs (24 4)) (elscreen (1 4 6)) (multi-term (1 3))) "Multi term for elscreen" single ((:commit . "4ea89bae0444d9d4377515929f76cb3e98140f1f") (:authors ("wamei" . "wamei.cho@gmail.com")) (:maintainer "wamei" . "wamei.cho@gmail.com") (:keywords "elscreen" "multi term"))]) + (elscreen-separate-buffer-list . [(20200807 1324) ((emacs (24 4)) (elscreen (1 4 6))) "Separate buffer list manager for elscreen" single ((:commit . "88d8850108947949431425a2d938a09d941454e8") (:authors ("wamei" . "wamei.cho@gmail.com")) (:maintainer "wamei" . "wamei.cho@gmail.com") (:keywords "elscreen"))]) + (elscreen-tab . [(20201229 1428) ((emacs (26)) (elscreen (20180321)) (dash (2 14 1))) "minor mode to display tabs of elscreen in a dedicated buffer" tar ((:commit . "5d7a740e47a56365413d75f4f0553de74f5ca198") (:authors ("Aki Syunsuke" . "sunny.day.dev@gmail.com")) (:maintainer "Aki Syunsuke" . "sunny.day.dev@gmail.com") (:keywords "tools" "extensions") (:url . "https://github.com/aki-s/elscreen-tab"))]) + (elvish-mode . [(20180809 1612) ((emacs (24 3))) "Defines a major mode for Elvish" single ((:commit . "a13fcaf209d803e2e450ca2bf80dea94b40a0141") (:authors ("Adam Schwalm" . "adamschwalm@gmail.com")) (:maintainer "Adam Schwalm" . "adamschwalm@gmail.com") (:url . "https://github.com/ALSchwalm/elvish-mode"))]) + (elwm . [(20150817 1007) ((dash (1 1 0))) "Minimalistic window manager for emacs" single ((:commit . "c33b183f006ad476c3a44dab316f580f8b369930") (:authors ("Matus Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matus Goljer" . "matus.goljer@gmail.com") (:keywords "docs") (:url . "https://github.com/Fuco1/elwm"))]) + (elx . [(20220331 2252) ((emacs (25 1))) "extract information from Emacs Lisp libraries" single ((:commit . "ea0b10340b22e8dd0454fe37ba84ff2157fada4f") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "docs" "libraries" "packages") (:url . "https://github.com/emacscollective/elx"))]) + (emacs-everywhere . [(20220407 329) ((emacs (26 3))) "System-wide popup windows for quick edits" single ((:commit . "54b9ba1ac0d7f8b644354fd6d27c9e3aff111dcc") (:authors ("TEC ")) (:maintainer "TEC" . "tec@tecosaur.com") (:keywords "conenience" "frames") (:url . "https://github.com/tecosaur/emacs-everywhere"))]) + (emacsc . [(20220420 1042) nil "helper for emacsc(1)" tar ((:commit . "199c08147ebe98da1004c478c92ba8866950b637") (:authors ("Akinori MUSHA" . "knu@iDaemons.org")) (:maintainer "Akinori MUSHA" . "knu@iDaemons.org") (:keywords "tools") (:url . "https://github.com/knu/emacsc"))]) + (emacsist-view . [(20160426 1223) nil "Mode for viewing emacsist.com" single ((:commit . "f67761259ed779a9bc95c9a4e0474522990c5c6b") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "convenience" "usability") (:url . "https://github.com/lujun9972/emacsist-view"))]) + (emacsql . [(20220408 1614) ((emacs (25 1))) "high-level SQL database front-end" tar ((:commit . "373975cbccf7776af771e23f86043b236a330702") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/emacsql"))]) + (emacsql-mysql . [(20171219 227) ((emacs (25 1)) (emacsql (2 0 0))) "EmacSQL back-end for MySQL" single ((:commit . "373975cbccf7776af771e23f86043b236a330702") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/emacsql"))]) + (emacsql-psql . [(20220101 1820) ((emacs (25 1)) (emacsql (2 0 0))) "EmacSQL back-end for PostgreSQL via psql" tar ((:commit . "373975cbccf7776af771e23f86043b236a330702") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/emacsql"))]) + (emacsql-sqlite . [(20220218 1543) ((emacs (25 1)) (emacsql (2 0 0))) "EmacSQL back-end for SQLite" tar ((:commit . "373975cbccf7776af771e23f86043b236a330702") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/emacsql"))]) + (emacsql-sqlite-builtin . [(20220422 1605) ((emacs (29)) (emacsql (3 0 0)) (emacsql-sqlite (3 0 0))) "EmacSQL back-end for SQLite using builtin support" single ((:commit . "3e820c66fdaa9937f9e612900954dcd6c7d01943") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "data") (:url . "https://github.com/emacscollective/emacsql-sqlite-builtin"))]) + (emacsql-sqlite-module . [(20220422 1605) ((emacs (25)) (emacsql (3 0 0)) (emacsql-sqlite (3 0 0)) (sqlite3 (0 15))) "EmacSQL back-end for SQLite using a module" single ((:commit . "3e820c66fdaa9937f9e612900954dcd6c7d01943") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "data") (:url . "https://github.com/emacscollective/emacsql-sqlite-builtin"))]) + (emacsql-sqlite3 . [(20220304 1014) ((emacs (26 1)) (emacsql (3 0 0))) "Yet another EmacSQL backend for SQLite" single ((:commit . "2113618732665f2112cb932a66c0e89c404d8777") (:authors ("Zhu Zihao" . "all_but_last@163.com")) (:maintainer "Zhu Zihao" . "all_but_last@163.com") (:keywords "extensions") (:url . "https://github.com/cireu/emacsql-sqlite3"))]) + (emacsshot . [(20191206 944) ((emacs (24 4))) "Snapshot a frame or window from within" tar ((:commit . "fe958b11056f3c671ebdd604d5aa574323284ca5") (:authors ("Marco Wahl" . "marcowahlsoft@gmail.com")) (:maintainer "Marco Wahl") (:keywords "convenience") (:url . "https://gitlab.com/marcowahl/emacsshot"))]) + (emamux . [(20200315 1220) ((emacs (24 3))) "Interact with tmux" single ((:commit . "6172131d78038f0b1490e24bac60534bf4ad3b30") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-emamux"))]) + (emamux-ruby-test . [(20130812 1639) ((emamux (0 1)) (projectile (0 9 1))) "Ruby test with emamux" single ((:commit . "23b73c650573b340351a919da3da416acfc2ac84") (:url . "https://github.com/syohex/emamux-ruby-test"))]) + (emaps . [(20200508 1759) ((dash (2 17 0)) (emacs (24))) "Utilities for working with keymaps" single ((:commit . "7c561f3ded2015ed3774e5784059d6601082743e") (:authors ("Ben Moon" . "software@guiltydolphin.com")) (:maintainer "Ben Moon" . "software@guiltydolphin.com") (:keywords "convenience" "keyboard" "keymap" "utility") (:url . "https://github.com/GuiltyDolphin/emaps"))]) + (embark . [(20220509 2259) ((emacs (26 1))) "Conveniently act on minibuffer completions" tar ((:commit . "81c7f751be1de33dee9f7523fd3429ee3fe9a0d1") (:authors ("Omar Antolín Camarena" . "omar@matem.unam.mx")) (:maintainer "Omar Antolín Camarena" . "omar@matem.unam.mx") (:keywords "convenience") (:url . "https://github.com/oantolin/embark"))]) + (embark-consult . [(20220507 143) ((emacs (27 1)) (embark (0 12)) (consult (0 10))) "Consult integration for Embark" single ((:commit . "81c7f751be1de33dee9f7523fd3429ee3fe9a0d1") (:authors ("Omar Antolín Camarena" . "omar@matem.unam.mx")) (:maintainer "Omar Antolín Camarena" . "omar@matem.unam.mx") (:keywords "convenience") (:url . "https://github.com/oantolin/embark"))]) + (ember-mode . [(20200208 1423) ((cl-lib (0 5))) "Ember navigation mode for emacs" single ((:commit . "a587c423041b2fcb065fd5b6a03b2899b764e462") (:authors ("Aad Versteden" . "madnificent@gmail.com")) (:maintainer "Aad Versteden" . "madnificent@gmail.com") (:keywords "ember" "ember.js" "emberjs"))]) + (ember-yasnippets . [(20160526 1658) ((yasnippet (0 8 0))) "Snippets for Ember.js development" tar ((:commit . "3b5bd01569646237bf1b540d097e12f9118b67f4") (:authors ("Ron White" . "ronco@costite.com")) (:maintainer "Ron White" . "ronco@costite.com") (:keywords "tools" "abbrev" "languages"))]) + (embrace . [(20171031 1833) ((cl-lib (0 5)) (expand-region (0 10 0))) "Add/Change/Delete pairs based on `expand-region'" single ((:commit . "dd5da196e5bcc5e6d87e1937eca0c21da4334ef2") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions"))]) + (emidje . [(20190209 1726) ((emacs (25)) (cider (0 17 0)) (seq (2 16)) (magit-popup (2 4 0))) "Test runner and report viewer for Midje" single ((:commit . "7e92f053964d925c97dc8cca8d4d70a3030021db") (:authors ("Alan Ghelardi" . "alan.ghelardi@nubank.com.br")) (:maintainer "Alan Ghelardi" . "alan.ghelardi@nubank.com.br") (:keywords "tools") (:url . "https://github.com/nubank/emidje"))]) + (emmet-mode . [(20210820 1124) nil "Unofficial Emmet's support for emacs" single ((:commit . "6b2e554f7fd27f732810f4b14ea01e3c54b7b3da") (:authors ("Shin Aoyama" . "smihica@gmail.com")) (:maintainer "Shin Aoyama" . "smihica@gmail.com") (:keywords "convenience") (:url . "https://github.com/smihica/emmet-mode"))]) + (emms . [(20220422 1318) ((cl-lib (0 5)) (nadvice (0 3)) (seq (0))) "The Emacs Multimedia System" tar ((:commit . "22f3d9e5359c565b33f55715f90fbde35e4f675e") (:authors ("Jorgen Schäfer" . "forcer@forcix.cx")) (:maintainer "Yoni Rabkin" . "yrk@gnu.org") (:keywords "emms" "mp3" "ogg" "flac" "music" "mpeg" "video" "multimedia") (:url . "https://www.gnu.org/software/emms/"))]) + (emms-bilibili . [(20180103 418) ((emacs (25)) (cl-lib (0 5))) "Play Bilibili in EMMS." single ((:commit . "294bca3dfc42fe3a55fb326ab39bc0fcfc8c5090") (:keywords "emms" "bilibili") (:url . "https://github.com/stardiviner/emms-bilibili"))]) + (emms-info-mediainfo . [(20131223 1300) ((emms (0))) "Info-method for EMMS using medianfo" single ((:commit . "bce16eae9eacd38719fea62a9755225a888da59d") (:authors ("Fabián Ezequiel Gallina" . "fgallina@gnu.org")) (:maintainer "Fabián Ezequiel Gallina" . "fgallina@gnu.org") (:keywords "multimedia" "processes"))]) + (emms-mark-ext . [(20130529 327) ((emms (3 0))) "Extra functions for emms-mark-mode and emms-tag-edit-mode" single ((:commit . "ec68129e3e9e469e5bf160c6a1b7030e322f3541") (:authors ("Joe Bloggs" . "vapniks@yahoo.com")) (:maintainer "Joe Bloggs" . "vapniks@yahoo.com") (:keywords "convenience" "multimedia") (:url . "https://github.com/vapniks/emms-mark-ext"))]) + (emms-mode-line-cycle . [(20160221 1120) ((emacs (24)) (emms (4 0))) "Display the emms mode line as a ticker" single ((:commit . "2c2f395e484a1d345050ddd61ff5fab71a92a6bc") (:authors ("momomo5717")) (:maintainer "momomo5717") (:keywords "emms" "mode-line") (:url . "https://github.com/momomo5717/emms-mode-line-cycle"))]) + (emms-player-mpv-jp-radios . [(20180325 1117) ((emacs (24)) (cl-lib (0 5)) (emms (4 0)) (emms-player-simple-mpv (0 1 7))) "EMMS players and stream lists of Japan radio stations" tar ((:commit . "f6b37f5878c741124d5fca43c5b80af873541edd") (:keywords "emms" "mpv" "radio") (:url . "https://github.com/momomo5717/emms-player-mpv-jp-radios"))]) + (emms-player-simple-mpv . [(20180316 1549) ((emacs (24)) (cl-lib (0 5)) (emms (4 0))) "An extension of emms-player-simple.el for mpv JSON IPC" tar ((:commit . "101d120ccdee1c2c213fd2f0423c858b21649c00") (:authors ("momomo5717")) (:maintainer "momomo5717") (:keywords "emms" "mpv") (:url . "https://github.com/momomo5717/emms-player-simple-mpv"))]) + (emms-soundcloud . [(20131221 1145) ((emms (20131016)) (json (1 2))) "EMMS source for Soundcloud audio sharing platform" single ((:commit . "87e5cbf9609d1f26c24dc834fdeb78b33d453c2b") (:authors ("Ozan Sener" . "ozan@ozansener.com")) (:maintainer "Ozan Sener" . "ozan@ozansener.com") (:keywords "emms" "soundcloud") (:url . "http://github.com/osener/emms-soundcloud"))]) + (emms-state . [(20211023 1942) ((emms (0))) "Display track description and playing time in the mode line" single ((:commit . "cdb3ee85369758727b3c082e4ade1ae2b559b334") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "emms") (:url . "https://github.com/alezost/emms-state.el"))]) + (emoji-cheat-sheet-plus . [(20200202 1404) ((emacs (24)) (helm (1 6 4))) "emoji-cheat-sheet for emacs" tar ((:commit . "ffcc84d7060dfa000148e7f8be4fd6701593a74f") (:authors ("Sylvain Benner (based on the work of Shingo Fukuyama)")) (:maintainer "Sylvain Benner (based on the work of Shingo Fukuyama)") (:keywords "emacs" "emoji") (:url . "https://github.com/syl20bnr/emacs-emoji-cheat-sheet-plus"))]) + (emoji-display . [(20140117 1013) nil "emoji displaying module" single ((:commit . "bb4217f6400151a9cfa6d4524b8427f01feb5193") (:authors ("Kazuhiro Ito" . "kzhr@d1.dion.ne.jp")) (:maintainer "Kazuhiro Ito" . "kzhr@d1.dion.ne.jp") (:keywords "emoji") (:url . "https://github.com/ikazuhiro/emoji-display"))]) + (emoji-fontset . [(20160726 1924) nil "Set font face for Emoji." single ((:commit . "8f159e8073b9b57a07a54b549df687424eeb98ee") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "emoji" "font" "config"))]) + (emoji-github . [(20200825 425) ((emacs (24 4)) (emojify (1 0)) (request (0 3 0))) "Display list of GitHub's emoji. (cheat sheet)" single ((:commit . "434ccc9df8eb884f248d5934e7d465348bb203a4") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/emoji-github"))]) + (emoji-recall . [(20160723 2208) ((emacs (24))) "How many emoji can you recall from memory?" tar ((:commit . "d9122f8fb1467309260109a1985cd14f18fdf631") (:authors ("DarkSun" . "lujun9972@gmail.com")) (:maintainer "DarkSun" . "lujun9972@gmail.com") (:keywords "game") (:url . "https://github.com/lujun9972/emoji-recall.el"))]) + (emojify . [(20210108 1111) ((seq (1 11)) (ht (2 0)) (emacs (24 3))) "Display emojis in Emacs" tar ((:commit . "1b726412f19896abf5e4857d4c32220e33400b55") (:authors ("Iqbal Ansari" . "iqbalansari02@yahoo.com")) (:maintainer "Iqbal Ansari" . "iqbalansari02@yahoo.com") (:keywords "multimedia" "convenience") (:url . "https://github.com/iqbalansari/emacs-emojify"))]) + (emojify-logos . [(20180814 917) ((emojify (0 4))) "Add logos to emojify" tar ((:commit . "a3e78bcbdf863092d4c9b026ac08bf7d1c7c0e8b") (:authors ("mxgoldstein" . "m_goldstein@gmx.net")) (:maintainer "mxgoldstein" . "m_goldstein@gmx.net") (:url . "https://github.com/mxgoldstein/emojify-logos"))]) + (empos . [(20151011 1916) nil "Locate bibtex citations from within emacs" single ((:commit . "7b99ad30e56937adb7e6349777e5a2045597d564") (:authors ("Dimitris Alikaniotis ")) (:maintainer "Dimitris Alikaniotis ") (:keywords "citations" "reference" "bibtex" "reftex") (:url . "http://github.com/dimalik/empos/"))]) + (emr . [(20220108 548) ((s (1 3 1)) (dash (1 2 0)) (cl-lib (0 2)) (popup (0 5 0)) (emacs (24 1)) (list-utils (0 3 0)) (paredit (24 0 0)) (projectile (0 9 1)) (clang-format (0 0 1)) (iedit (0 97))) "Emacs refactoring system." tar ((:commit . "cac1b52932926f56d7f6d2923732d20bbd20670d") (:authors ("Chris Barrett" . "chris.d.barrett@me.com")) (:maintainer "Chris Barrett" . "chris.d.barrett@me.com") (:keywords "tools" "convenience" "refactoring") (:url . "https://github.com/Wilfred/emacs-refactor"))]) + (enclose . [(20121008 1614) nil "Enclose cursor within punctuation pairs." tar ((:commit . "2747653e84af39017f503064bc66ed1812a77259") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "speed" "convenience") (:url . "http://github.com/rejeep/enclose"))]) + (encourage-mode . [(20151128 905) ((emacs (24 4))) "Encourages you in your work. :D" single ((:commit . "99edacf2d94d168d3da0609860dc7253db7c9815") (:authors ("Patrick Mosby" . "patrick@schreiblogade.de")) (:maintainer "Patrick Mosby" . "patrick@schreiblogade.de") (:keywords "fun") (:url . "https://github.com/halbtuerke/encourage-mode.el"))]) + (engine-mode . [(20200611 1825) ((cl-lib (0 5))) "Define and query search engines from within Emacs." single ((:commit . "e0910f141f2d37c28936c51c3c8bb8a9ca0c01d1") (:authors ("Harry R. Schwartz" . "hello@harryrschwartz.com")) (:maintainer "Harry R. Schwartz" . "hello@harryrschwartz.com") (:url . "https://github.com/hrs/engine-mode"))]) + (enh-ruby-mode . [(20220426 1750) ((emacs (24 3))) "Major mode for editing Ruby files" tar ((:commit . "f240ac00ccbbd0916b5e3d272c0064a26f527ef8") (:authors ("Geoff Jacobsen")) (:maintainer "Ryan Davis") (:keywords "languages" "elisp" "ruby") (:url . "http://github.com/zenspider/Enhanced-Ruby-Mode"))]) + (enlightened-theme . [(20210220 2327) nil "A theme based on enlightened" single ((:commit . "1bfebd8f47e8a8357c9e557cf6e95d7027861e6d") (:url . "https://hg.sr.ht/~slondr/enlightened"))]) + (enlive . [(20170725 1417) nil "query html document with css selectors" single ((:commit . "604a8ca272b6889f114e2b5a13adb5b1dc4bae86") (:authors ("ZHOU Feng" . "zf.pascal@gmail.com")) (:maintainer "ZHOU Feng" . "zf.pascal@gmail.com") (:keywords "css" "selector" "query") (:url . "http://github.com/zweifisch/enlive"))]) + (eno . [(20191013 1239) ((dash (2 12 1)) (edit-at-point (1 0))) "Goto/copy/cut any word/symbol/line in view, similar to ace-jump/easymotion" single ((:commit . "c5c6193687c0bede1ddf507c430cf8b0a6d272d9") (:authors (nil . "")) (:maintainer nil . "") (:url . "http://github.com/enoson/eno.el"))]) + (enotify . [(20130407 1348) nil "A networked notification system for emacs" tar ((:commit . "7fd2f48ef4ff32c8f013c634ea2dd6b1d1409f80") (:authors ("Alessandro Piras" . "laynor@gmail.com")) (:maintainer "Alessandro Piras" . "laynor@gmail.com") (:keywords "tools"))]) + (envrc . [(20220218 1627) ((seq (2)) (emacs (24 4)) (inheritenv (0 1))) "Support for `direnv' that operates buffer-locally" single ((:commit . "4730b31ff1479b6d822ccc7517251dcb52de45b3") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "processes" "tools") (:url . "https://github.com/purcell/envrc"))]) + (eopengrok . [(20200205 624) ((s (1 9 0)) (dash (2 10 0)) (magit (2 1 0)) (cl-lib (0 5))) "opengrok interface for emacs" single ((:commit . "6fa16c4ccaaebaef64dca0d3d29904c45fd6597d") (:authors ("Youngjoo Lee" . "youngker@gmail.com")) (:maintainer "Youngjoo Lee" . "youngker@gmail.com") (:keywords "tools"))]) + (epc . [(20140610 534) ((concurrent (0 3 1)) (ctable (0 1 2))) "A RPC stack for the Emacs Lisp" tar ((:commit . "e1bfa5ca163273859336e3cc89b4b6460f7f8cda") (:authors ("SAKURAI Masashi ")) (:maintainer "SAKURAI Masashi ") (:keywords "lisp" "rpc") (:url . "https://github.com/kiwanami/emacs-epc"))]) + (epic . [(20170210 23) ((htmlize (1 47))) "Evernote Picker for Cocoa Emacs" single ((:commit . "a41826c330eb0ea061d58a08cc861b0c4ac8ec4e") (:authors ("Yoshinari Nomura" . "nom@quickhack.net")) (:maintainer "Yoshinari Nomura" . "nom@quickhack.net") (:keywords "evernote" "applescript") (:url . "https://github.com/yoshinari-nomura/epic"))]) + (eping . [(20201027 2149) ((emacs (25 1))) "Ping websites to check internet connectivity" tar ((:commit . "99d3a4b6973d5b09864e0af7425a61f99c19b90a") (:authors ("Sean Hutchings" . "seanhut@yandex.com")) (:maintainer "Sean Hutchings" . "seanhut@yandex.com") (:keywords "comm" "processes" "terminals" "unix") (:url . "https://github.com/sean-hut/eping"))]) + (epkg . [(20220503 1115) ((emacs (25 1)) (compat (28 1 1 0)) (closql (20210927))) "Browse the Emacsmirror package database" tar ((:commit . "fb86b5edd910b2571fc21477d0dac90be97a8f61") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "tools") (:url . "https://github.com/emacscollective/epkg"))]) + (epkg-marginalia . [(20220424 2211) ((emacs (26)) (compat (28 1 1 0)) (epkg (3 3 1)) (marginalia (0 12))) "Show Epkg information in completion annotations" single ((:commit . "ac43d5797300ac478e8dc862ec572b67ae4d5d86") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "tools") (:url . "https://github.com/emacscollective/epkg-marginalia"))]) + (epl . [(20180205 2049) ((cl-lib (0 3))) "Emacs Package Library" single ((:commit . "78ab7a85c08222cd15582a298a364774e3282ce6") (:authors ("Sebastian Wiesner" . "swiesner@lunaryorn.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "convenience") (:url . "http://github.com/cask/epl"))]) + (epm . [(20190509 443) ((emacs (24 3)) (epl (0 8))) "Emacs Package Manager" tar ((:commit . "6375ddbf93c5f25647f6ebb25b54045b3c93a5be") (:authors ("Chunyang Xu" . "xuchunyang.me@gmail.com")) (:maintainer "Chunyang Xu" . "xuchunyang.me@gmail.com") (:url . "https://github.com/xuchunyang/epm"))]) + (epresent . [(20160411 201) ((org (8)) (cl-lib (0 5))) "Simple presentation mode for Emacs Org-mode" single ((:commit . "6c8abedcf46ff08091fa2bba52eb905c6290057d") (:keywords "gui") (:url . "https://github.com/dakrone/epresent"))]) + (eproject . [(20180312 1642) ((helm (1 6 4))) "assign files to projects, programatically" tar ((:commit . "068218d2cf2138cb2e8fc29b57e773a0097a7e8b") (:authors ("Jonathan Rockway" . "jon@jrock.us")) (:maintainer "Jonathan Rockway" . "jon@jrock.us") (:keywords "programming" "projects"))]) + (equake . [(20220424 350) ((emacs (26 1)) (dash (2 14 1))) "Drop-down console for (e)shell & terminal emulation" single ((:commit . "ea5c0570f58b8e62249e001ed434a1056a50abe7") (:authors ("Benjamin Slade" . "slade@lambda-y.net")) (:maintainer "Benjamin Slade" . "slade@lambda-y.net") (:keywords "convenience" "frames" "terminals" "tools" "window-system") (:url . "https://gitlab.com/emacsomancer/equake"))]) + (eradio . [(20210327 1000) ((emacs (24 1))) "A simple Internet radio player" single ((:commit . "47769986c79def84307921f0277e9bb2714756c2") (:authors ("Olav Fosse" . "mail@olavfosse.no")) (:maintainer "Olav Fosse" . "mail@olavfosse.no") (:url . "https://github.com/fossegrim/eradio"))]) + (erblint . [(20200622 5) ((emacs (24))) "An interface for checking HTML ERB files using Erblint" single ((:commit . "89af42f776d8dc656104322edaace2ede7499932") (:authors ("Leonardo Santos")) (:maintainer "Leonardo Santos") (:keywords "project" "convenience") (:url . "https://github.com/leodcs/erblint-emacs"))]) + (erc-colorize . [(20170107 1339) nil "Per user colorization of whole message" single ((:commit . "d026a016dcb9d63d9ac66d30627a92a8f1681bbd") (:authors ("Sylvain Rousseau ")) (:maintainer "Sylvain Rousseau ") (:keywords "erc" "convenience") (:url . "https://github.com/thisirs/erc-colorize.git"))]) + (erc-crypt . [(20200516 2054) ((cl-lib (0 5))) "Symmetric Encryption for ERC" single ((:commit . "be87248435509f83c56a7f08ac9bcbbd3b20d780") (:authors ("xristos" . "xristos@sdf.org")) (:maintainer "xristos" . "xristos@sdf.org") (:keywords "comm") (:url . "https://github.com/atomontage/erc-crypt"))]) + (erc-hl-nicks . [(20200317 16) nil "ERC nick highlighter that ignores uniquifying chars when colorizing" single ((:commit . "a67fe361c8f2aa20fc235447fbb898f424b51439") (:authors ("David Leatherman" . "leathekd@gmail.com")) (:maintainer "David Leatherman" . "leathekd@gmail.com") (:url . "http://www.github.com/leathekd/erc-hl-nicks"))]) + (erc-image . [(20210604 753) nil "Show received image urls in the ERC buffer" single ((:commit . "883084f0801d46a5ccf183e51ae9a734755bbb97") (:authors ("Jon de Andrés Frías" . "jondeandres@gmail.com") ("Raimon Grau Cuscó" . "raimonster@gmail.com")) (:maintainer "Jon de Andrés Frías" . "jondeandres@gmail.com") (:keywords "multimedia"))]) + (erc-matterircd . [(20210804 504) ((emacs (27 1))) "Integrate matterircd with ERC" single ((:commit . "e3a59267c044474f9ca066d36517e9a3d872759c") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/erc-matterircd"))]) + (erc-scrolltoplace . [(20180608 606) ((emacs (24 0)) (switch-buffer-functions (0 0 1))) "An Erc module to scrolltobottom better with keep-place" single ((:commit . "38cfd0c2e2f5f6533b217189c3afaf6640b5602e") (:authors ("Jay Kamat" . "jaygkamat@gmail.com")) (:maintainer "Jay Kamat" . "jaygkamat@gmail.com") (:keywords "erc" "module" "comm" "scrolltobottom" "keep-place") (:url . "http://gitlab.com/jgkamat/erc-scrolltoplace"))]) + (erc-social-graph . [(20150508 1204) nil "A social network graph module for ERC." single ((:commit . "e6ef3416a1c5064054bf054d9f0c1c7bf54a9cd0") (:authors ("Vibhav Pant" . "vibhavp@gmail.com")) (:maintainer "Vibhav Pant" . "vibhavp@gmail.com") (:keywords "erc" "graph") (:url . "https://github.com/vibhavp/erc-social-graph"))]) + (erc-terminal-notifier . [(20140115 1024) nil "OSX notifications via the terminal-notifier gem for Emacs ERC." single ((:commit . "a3dacb935845e4a20031212bbd82b2170f68d2a8") (:authors ("Julien Blanchard" . "julien@sideburns.eu")) (:maintainer "Julien Blanchard" . "julien@sideburns.eu") (:keywords "erc" "terminal-notifier" "nick") (:url . "http://github.com/julienXX/"))]) + (erc-track-score . [(20130328 1215) nil "Add score support to tracked channel buffers" single ((:commit . "5b27531ea6b1a4c4b703b270dfa9128cb5bfdaa3") (:authors ("Julien Danjou" . "julien@danjou.info")) (:maintainer "Julien Danjou" . "julien@danjou.info") (:url . "http://julien.danjou.info/erc-track-score.html"))]) + (erc-tweet . [(20150920 1258) nil "shows text of a tweet when an url is posted in erc buffers" single ((:commit . "91fed61e139fa788d66a7358f0d50acc896414b8") (:authors ("Raimon Grau" . "raimonster@gmail.com")) (:maintainer "Raimon Grau" . "raimonster@gmail.com") (:keywords "extensions"))]) + (erc-twitch . [(20170427 606) ((json (1 3)) (erc (5 0))) "Support for Twitch emotes for ERC." single ((:commit . "53c6af0cb72e56d897d30a40e7e5066668d6b5ec") (:authors ("Vibhav Pant" . "vibhavp@gmail.com")) (:maintainer "Vibhav Pant" . "vibhavp@gmail.com") (:keywords "twitch" "erc" "emotes") (:url . "https://github.com/vibhavp/erc-twitch"))]) + (erc-view-log . [(20140227 2039) nil "Major mode for viewing ERC logs" single ((:commit . "c5a25f0cbca84ed2e4f72068c02b66bd0ea3b266") (:authors ("Antoine Levitt") ("Thomas Riccardi" . "riccardi.thomas@gmail.com")) (:maintainer "Antoine Levitt") (:keywords "erc" "viewer" "logs" "colors") (:url . "http://github.com/Niluge-KiWi/erc-view-log/raw/master/erc-view-log.el"))]) + (erc-yank . [(20210220 1815) nil "Automagically create a Gist if pasting more than 5 lines" single ((:commit . "55d96f18c5df9d8fce51fa073d7a12c47a46ac80") (:authors ("John Wiegley" . "jwiegley@gmail.com")) (:maintainer "John Wiegley" . "jwiegley@gmail.com") (:keywords "comm" "erc" "chat" "irc" "yank" "gist") (:url . "https://github.com/jwiegley/erc-yank"))]) + (erc-youtube . [(20150603 2136) nil "Show info about a YouTube URL in an ERC buffer." single ((:commit . "97054ba8475b442e2aa81e5a291f668b7f28697f") (:authors ("Raimon Grau Cuscó" . "raimonster@gmail.com")) (:maintainer "Raimon Grau Cuscó" . "raimonster@gmail.com") (:keywords "multimedia"))]) + (erc-yt . [(20150426 1249) ((dash (2 10 0))) "An erc module to display youtube links nicely" single ((:commit . "43e7d49325b17a3217a6ffb4a9daf75c5ff4e6f8") (:authors ("William Stevenson" . "yhvh2000@gmail.com")) (:maintainer "William Stevenson" . "yhvh2000@gmail.com") (:keywords "multimedia"))]) + (ercn . [(20150523 1503) nil "Flexible ERC notifications" single ((:commit . "79a4df5609046ae2e2e3375998287be6dda80615") (:authors ("David Leatherman" . "leathekd@gmail.com")) (:maintainer "David Leatherman" . "leathekd@gmail.com") (:url . "http://www.github.com/leathekd/ercn"))]) + (ereader . [(20170810 501) ((emacs (24 4)) (dash (2 12 1)) (s (1 10 0)) (xml+ (0 0 0))) "Major mode for reading ebooks with org-mode integration" tar ((:commit . "f3bbd3f13195f8fba3e3c880aab0e4c60430dcf3") (:authors ("Ben Dean" . "bendean837@gmail.com")) (:maintainer "Ben Dean" . "bendean837@gmail.com") (:keywords "epub" "ebook") (:url . "https://github.com/bddean/emacs-ereader"))]) + (eredis . [(20181119 131) ((dash (0))) "eredis, a Redis client in emacs lisp" single ((:commit . "bc86b9f63a3e7a5eb263875030d0e15d6f5f6e37") (:authors ("Justin Heyes-Jones" . "justinhj@gmail.com")) (:maintainer "Justin Heyes-Jones" . "justinhj@gmail.com") (:keywords "redis" "api" "tools" "org") (:url . "http://github.com/justinhj/eredis/"))]) + (erefactor . [(20200513 1252) ((cl-lib (0 3))) "Emacs-Lisp refactoring utilities" single ((:commit . "bfe27a1b8c7cac0fe054e76113e941efa3775fe8") (:authors ("Masahiro Hayashi" . "mhayashi1120@gmail.com")) (:maintainer "Masahiro Hayashi" . "mhayashi1120@gmail.com") (:keywords "extensions" "tools" "maint") (:url . "https://github.com/mhayashi1120/Emacs-erefactor"))]) + (ergoemacs-mode . [(20220411 338) ((emacs (24 1)) (cl-lib (0 5))) "Emacs mode based on common modern interface and ergonomics." tar ((:commit . "9cd89eef490f6c9f4af273bb3dd2c68d5ed2de61") (:authors ("Xah Lee" . "xah@xahlee.org") ("David Capello" . "davidcapello@gmail.com") ("Matthew L. Fidler" . "matthew.fidler@gmail.com") ("Kim F. Storm" . "storm@cua.dk")) (:maintainer "Matthew L. Fidler" . "matthew.fidler@gmail.com") (:keywords "convenience") (:url . "https://github.com/ergoemacs/ergoemacs-mode"))]) + (ergoemacs-status . [(20160318 538) ((powerline (2 3)) (mode-icons (0 1 0))) "Adaptive Status Bar / Mode Line" single ((:commit . "d952cc2361adf6eb4d6af60950ad4ab699c81320") (:authors ("Matthew Fidler")) (:maintainer "Matthew Fidler"))]) + (eri . [(20200914 644) nil "Enhanced relative indentation (eri)" single ((:commit . "9a5f2b4a8cd14edbde9d16dcdfcb8db2a91be0d8") (:url . "https://github.com/agda/agda"))]) + (erlang . [(20220215 1844) ((emacs (24 1))) "Erlang major mode" tar ((:commit . "9962287133b7107c34931f91d11aea6bea8fa4d1") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "erlang" "languages" "processes"))]) + (erlstack-mode . [(20210419 1917) ((emacs (25 1)) (dash (2 12 0))) "Minor mode for analysing Erlang stacktraces" single ((:commit . "ca264bca24cdaa8b2bac57882716f03f633e42b0") (:authors ("k32")) (:maintainer "k32") (:keywords "tools" "erlang") (:url . "https://github.com/k32/erlstack-mode"))]) + (eros . [(20180415 618) ((emacs (24 4))) "Evaluation Result OverlayS for Emacs Lisp" single ((:commit . "dd8910279226259e100dab798b073a52f9b4233a") (:authors ("Tianxiang Xiong" . "tianxiang.xiong@gmail.com")) (:maintainer "Tianxiang Xiong" . "tianxiang.xiong@gmail.com") (:keywords "convenience" "lisp") (:url . "https://github.com/xiongtx/eros"))]) + (ert-async . [(20200105 1031) ((emacs (24 1))) "Async support for ERT" single ((:commit . "948cf2faa10e085bda3739034ca5ea1912893433") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "lisp" "test") (:url . "http://github.com/rejeep/ert-async.el"))]) + (ert-expectations . [(20121009 734) nil "The simplest unit test framework in the world" single ((:commit . "aed70e002c4305b66aed7f6d0d48e9addd2dc1e6") (:authors ("rubikitch" . "rubikitch@ruby-lang.org")) (:maintainer "rubikitch" . "rubikitch@ruby-lang.org") (:keywords "test" "unittest" "ert" "expectations") (:url . "http://www.emacswiki.org/emacs/download/ert-expectations.el"))]) + (ert-junit . [(20190802 2232) ((ert (0)) (emacs (23 4))) "JUnit XML reports from ert results" single ((:commit . "65f91c35b088b87943dbbbe7e1ce354bc9bc0992") (:authors ("Ola Nilsson" . "ola.nilsson@gmail.com")) (:maintainer "Ola Nilsson" . "ola.nilsson@gmail.com") (:keywords "tools" "test" "unittest" "ert") (:url . "http://bitbucket.org/olanilsson/ert-junit"))]) + (ert-modeline . [(20140115 1015) ((s (1 3 1)) (dash (1 2 0)) (emacs (24 1)) (projectile (0 9 1))) "displays ert test results in the modeline." single ((:commit . "e7be2b81191afb437b70368a819770f8f750e4af") (:authors ("Chris Barrett" . "chris.d.barrett@me.com")) (:maintainer "Chris Barrett" . "chris.d.barrett@me.com") (:keywords "tools" "tests" "convenience"))]) + (ert-runner . [(20201005 2336) ((s (1 6 1)) (dash (1 8 0)) (f (0 10 0)) (commander (0 2 0)) (ansi (0 1 0)) (shut-up (0 1 0))) "Opinionated Ert testing workflow" tar ((:commit . "80cf4f60ec8c1f04f58054ed8ad2dcfacc17d8b5") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "test") (:url . "http://github.com/rejeep/ert-runner.el"))]) + (es-lib . [(20141111 1830) ((cl-lib (0 3))) "A collection of emacs utilities" tar ((:commit . "753b27363e39c10edc9e4e452bdbbbe4d190df4a") (:authors ("sabof")) (:maintainer "sabof") (:url . "https://github.com/sabof/es-lib"))]) + (es-mode . [(20201125 2059) ((dash (2 11 0)) (cl-lib (0 5)) (spark (1 0)) (s (1 11 0)) (request (0 3 0))) "A major mode for editing and executing Elasticsearch queries" tar ((:commit . "cde5cafcbbbd57db6d38ae7452de626305bba68d") (:authors ("Lee Hinman" . "lee@writequit.org")) (:maintainer "Lee Hinman" . "lee@writequit.org") (:keywords "elasticsearch") (:url . "http://www.github.com/dakrone/es-mode"))]) + (es-windows . [(20140211 904) ((cl-lib (0 3)) (emacs (24))) "Window-management utilities" single ((:commit . "239e30408cb1adb4bc8bd63e2df34711fa910b4f") (:authors ("sabof")) (:maintainer "sabof") (:url . "https://github.com/sabof/es-windows"))]) + (esa . [(20180403 1525) ((cl-lib (0 5))) "Interface to esa.io" single ((:commit . "417e0ac55abe9b17e0b7165d0df26bc018aff42e") (:authors ("Nab Inno" . "nab@blahfe.com")) (:maintainer "Nab Inno" . "nab@blahfe.com") (:keywords "tools" "esa") (:url . "https://github.com/nabinno/esa.el"))]) + (esh-autosuggest . [(20210906 1446) ((emacs (24 4)) (company (0 9 4))) "History autosuggestions for eshell" single ((:commit . "bf676b137d35553debe32ff134dbec25f3978ae7") (:authors ("Diego A. Mundo" . "dieggsy@pm.me")) (:maintainer "Diego A. Mundo" . "dieggsy@pm.me") (:keywords "completion" "company" "matching" "convenience" "abbrev") (:url . "http://github.com/dieggsy/esh-autosuggest"))]) + (esh-buf-stack . [(20140107 1018) nil "Add a buffer stack feature to Eshell" single ((:commit . "ce0ea5aadca3150eaa9d2e6ec20296add4e99176") (:authors ("Tomoya Tanjo" . "ttanjo@gmail.com")) (:maintainer "Tomoya Tanjo" . "ttanjo@gmail.com") (:keywords "eshell" "extensions"))]) + (esh-help . [(20190905 22) ((dash (1 4 0))) "Add some help functions and support for Eshell" single ((:commit . "417673ed18a983930a66a6692dbfb288a995cb80") (:authors ("Tomoya Tanjo" . "ttanjo@gmail.com")) (:maintainer "Tomoya Tanjo" . "ttanjo@gmail.com") (:keywords "eshell" "extensions") (:url . "https://github.com/tom-tan/esh-help/"))]) + (eshell-autojump . [(20201117 235) nil "autojump command for Eshell" single ((:commit . "c1056bfc6b46646ae1e606247689fef9aee621af") (:authors ("Alex Schroeder")) (:maintainer "Yen-Chin, Lee" . "coldnew.tw@gmail.com") (:url . "http://github.com/coldnew/eshell-autojump"))]) + (eshell-bookmark . [(20170922 1514) ((emacs (24 3))) "Integrate bookmarks with eshell." single ((:commit . "99a491c77e27ecc4626bdd4ad453ac71aa2654d4") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "convenience" "files") (:url . "https://github.com/Fuco1/eshell-bookmark"))]) + (eshell-did-you-mean . [(20211104 237) ((emacs (24 1)) (cl-lib (0 5))) "command not found (\"did you mean…\" feature) in Eshell" single ((:commit . "80cd8c4b186a2fb29621cf634bcf2bcd914f1e3d") (:authors ("Chunyang Xu" . "xuchunyang56@gmail.com")) (:maintainer "Chunyang Xu" . "xuchunyang56@gmail.com") (:keywords "eshell") (:url . "https://github.com/xuchunyang/eshell-did-you-mean"))]) + (eshell-fixed-prompt . [(20220104 1535) ((emacs (25)) (s (1 11 0))) "Restrict eshell to a single fixed prompt" single ((:commit . "302c241b42764bd6b4ed6d3c6ea360b5a2292fbc") (:authors ("Tijs Mallaerts" . "tijs.mallaerts@gmail.com")) (:maintainer "Tijs Mallaerts" . "tijs.mallaerts@gmail.com"))]) + (eshell-fringe-status . [(20170117 2316) nil "Show last status in fringe" single ((:commit . "adc6997c68e39c0d52a2af1b2fd5cf2057783797") (:authors ("Tom Willemse" . "tom@ryuslash.org")) (:maintainer "Tom Willemse" . "tom@ryuslash.org") (:url . "http://projects.ryuslash.org/eshell-fringe-status/"))]) + (eshell-git-prompt . [(20220206 458) ((emacs (24 1)) (cl-lib (0 5)) (dash (2 11 0))) "Some Eshell prompt for Git users" single ((:commit . "1eb1fd56649f291cac482fbf06dd43ef867873bc") (:authors ("Chunyang Xu" . "mail@xuchunyang.me")) (:maintainer "Chunyang Xu" . "mail@xuchunyang.me") (:keywords "eshell" "git") (:url . "https://github.com/xuchunyang/eshell-git-prompt"))]) + (eshell-info-banner . [(20220402 1721) ((emacs (25 1)) (s (1))) "System information as your Eshell banner" single ((:commit . "53fc69b8712b9869cee49468a6e418d64d2c3ab9") (:authors ("Lucien Cartier-Tilet" . "lucien@phundrak.com")) (:maintainer "Lucien Cartier-Tilet" . "lucien@phundrak.com") (:url . "https://github.com/Phundrak/eshell-info-banner.el"))]) + (eshell-outline . [(20201121 620) ((emacs (25 1))) "Enhanced outline-mode for Eshell" single ((:commit . "6f917afa5b3d36764d76d7864589094647d8c3b4") (:authors ("Jamie Beardslee" . "jdb@jamzattack.xyz")) (:maintainer "Jamie Beardslee" . "jdb@jamzattack.xyz") (:keywords "unix" "eshell" "outline" "convenience") (:url . "https://git.jamzattack.xyz/eshell-outline"))]) + (eshell-prompt-extras . [(20210925 110) ((emacs (25))) "Display extra information for your eshell prompt." single ((:commit . "c2078093323206b91a1b1f5786d79faa00b76be7") (:authors ("zwild" . "judezhao@outlook.com")) (:maintainer "Chunyang Xu" . "mail@xuchunyang.me") (:keywords "eshell" "prompt") (:url . "https://github.com/zwild/eshell-prompt-extras"))]) + (eshell-syntax-highlighting . [(20210429 413) ((emacs (25 1))) "Highlight eshell commands" single ((:commit . "8e3a685fc6d97af79e1046e5b24385786d8e92f6") (:authors ("Alex Kreisher" . "akreisher18@gmail.com")) (:maintainer "Alex Kreisher" . "akreisher18@gmail.com") (:keywords "convenience") (:url . "https://github.com/akreisher/eshell-syntax-highlighting"))]) + (eshell-toggle . [(20210407 2039) ((emacs (25 1)) (dash (2 11 0))) "Show/hide eshell under active window." single ((:commit . "7160518ca56444fead841b8acff59aeffc7cebb3") (:authors ("Dmitry Cherkassov" . "dcherkassov@gmail.com")) (:maintainer "Dmitry Cherkassov" . "dcherkassov@gmail.com") (:keywords "processes") (:url . "https://github.com/4da/eshell-toggle"))]) + (eshell-up . [(20170425 1737) ((emacs (24))) "Quickly go to a specific parent directory in eshell" single ((:commit . "ff84e6069b98f2ed00857a0f78bff19d96e4955c") (:authors ("Peter W. V. Tran-Jørgensen" . "peter.w.v.jorgensen@gmail.com")) (:maintainer "Peter W. V. Tran-Jørgensen" . "peter.w.v.jorgensen@gmail.com") (:keywords "eshell") (:url . "https://github.com/peterwvj/eshell-up"))]) + (eshell-vterm . [(20220506 1212) ((emacs (27 1)) (vterm (0 0 1))) "Vterm for visual commands in eshell" single ((:commit . "4e8589fcaf6243011a76b4816e7689d913927aab") (:authors ("Illia Ostapyshyn" . "ilya.ostapyshyn@gmail.com")) (:maintainer "Illia Ostapyshyn" . "ilya.ostapyshyn@gmail.com") (:keywords "eshell" "vterm" "terminals" "shell" "visual" "tools" "processes") (:url . "https://github.com/iostapyshyn/eshell-vterm"))]) + (eshell-z . [(20191116 333) ((cl-lib (0 5))) "cd to frequent directory in eshell" single ((:commit . "337cb241e17bd472bd3677ff166a0800f684213c") (:authors ("Chunyang Xu" . "mail@xuchunyang.me")) (:maintainer "Chunyang Xu" . "mail@xuchunyang.me") (:keywords "convenience") (:url . "https://github.com/xuchunyang/eshell-z"))]) + (eslint-disable-rule . [(20220328 354) ((emacs (27 2))) "Commands to add JS comments disabling eslint rules" tar ((:commit . "7d4cc05d336fbc465f91a87b38bf360efaf76fcf") (:url . "https://github.com/DamienCassou/eslint-disable-rule"))]) + (eslint-fix . [(20211005 221) nil "Fix JavaScript files using ESLint" single ((:commit . "0435d8e2864bb4f1be59ae548d0068c69fa31c7a") (:authors ("Neri Marschik" . "marschik_neri@cyberagent.co.jp")) (:maintainer "Neri Marschik" . "marschik_neri@cyberagent.co.jp") (:keywords "tools" "javascript" "eslint" "lint" "formatting" "style") (:url . "https://github.com/codesuki/eslint-fix"))]) + (eslint-rc . [(20220328 800) ((emacs (24 3)) (eslint-fix (0 1 0))) "Use local rc rules with ESLint" single ((:commit . "eb6f3e715792952bc957d5dc8ab1a607f3dbbd55") (:authors ("Joel Bryan Juliano ")) (:maintainer "Joel Bryan Juliano ") (:keywords "convenience" "edit" "js" "ts" "rc" "eslintrc" "eslint-rc" "eslint" "eslint-fix") (:url . "https://github.com/jjuliano/eslint-rc-emacs"))]) + (eslintd-fix . [(20210731 1649) ((dash (2 12 0)) (emacs (26 3))) "use eslint_d to automatically fix js files" single ((:commit . "3897d8a679a6e98e3f5054aaefe07f6b55f8f128") (:authors ("Aaron Jensen" . "aaronjensen@gmail.com")) (:maintainer "Aaron Jensen" . "aaronjensen@gmail.com") (:url . "https://github.com/aaronjensen/eslintd-fix"))]) + (esonify . [(20190110 1621) ((deferred (0 3 1)) (cl-lib (0 5))) "Sonify your code" tar ((:commit . "bdc79d4ab2e3c449b5bef46e5cabc552beeed5c6") (:authors ("Oliver Flatt" . "oflatt@gmail.com")) (:maintainer "Oliver Flatt" . "oflatt@gmail.com") (:url . "https://github.com/oflatt/esonify"))]) + (espotify . [(20220121 2057) ((emacs (26 1))) "Spotify access library" single ((:commit . "ea6d6021e5acc550560325db2f09198839ee702f") (:authors ("Jose A Ortega Ruiz" . "jao@gnu.org")) (:maintainer "Jose A Ortega Ruiz") (:keywords "multimedia") (:url . "https://codeberg.org/jao/espotify"))]) + (espresso-theme . [(20210505 1957) nil "Espresso Tutti Colori port for Emacs" single ((:commit . "580f673729f02aa07070c5300bedf24733d56e74") (:authors ("Martin Kühl ")) (:maintainer "Martin Kühl ") (:url . "https://github.com/dgutov/espresso-theme"))]) + (espuds . [(20160905 1300) ((s (1 7 0)) (dash (2 2 0)) (f (0 12 1))) "Ecukes step definitions" single ((:commit . "78fc53feaf77a98d63894cd410faee2a18107b00") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "test") (:url . "http://github.com/ecukes/espuds"))]) + (espy . [(20200317 2333) ((emacs (24))) "Emacs Simple Password Yielder" single ((:commit . "2c01be937a5e5bde62921684a0b27300705fb4e0") (:authors ("Sebastian Wålinder" . "s.walinder@gmail.com")) (:maintainer "Sebastian Wålinder" . "s.walinder@gmail.com") (:keywords "convenience") (:url . "https://github.com/walseb/espy"))]) + (esqlite . [(20151206 1206) ((pcsv (1 3 3))) "Manipulate sqlite file from Emacs" single ((:commit . "08a779a821f8d32c1a1985d8d9eb6cf21646ce2e") (:authors ("Masahiro Hayashi" . "mhayashi1120@gmail.com")) (:maintainer "Masahiro Hayashi" . "mhayashi1120@gmail.com") (:keywords "data") (:url . "https://github.com/mhayashi1120/Emacs-esqlite"))]) + (esqlite-helm . [(20151116 850) ((esqlite (0 2 0)) (helm (20131207 845))) "Define helm source for sqlite database" single ((:commit . "08a779a821f8d32c1a1985d8d9eb6cf21646ce2e") (:authors ("Masahiro Hayashi" . "mhayashi1120@gmail.com")) (:maintainer "Masahiro Hayashi" . "mhayashi1120@gmail.com") (:keywords "data") (:url . "https://github.com/mhayashi1120/Emacs-esqlite"))]) + (ess . [(20220225 1523) ((emacs (25 1))) "Emacs Speaks Statistics" tar ((:commit . "39eba283000a7b0220303d7c5a4f3ee05efc1e9c") (:authors ("David Smith" . "dsmith@stats.adelaide.edu.au") ("A.J. Rossini" . "blindglobe@gmail.com") ("Richard M. Heiberger" . "rmh@temple.edu") ("Kurt Hornik" . "Kurt.Hornik@R-project.org") ("Martin Maechler" . "maechler@stat.math.ethz.ch") ("Rodney A. Sparapani" . "rsparapa@mcw.edu") ("Stephen Eglen" . "stephen@gnu.org") ("Sebastian P. Luque" . "spluque@gmail.com") ("Henning Redestig" . "henning.red@googlemail.com") ("Vitalie Spinu" . "spinuvit@gmail.com") ("Lionel Henry" . "lionel.hry@gmail.com") ("J. Alexander Branham" . "alex.branham@gmail.com")) (:maintainer "ESS Core Team" . "ESS-core@r-project.org") (:url . "https://ess.r-project.org/"))]) + (ess-R-data-view . [(20130509 1158) ((ctable (20130313 1743)) (popup (20130324 1305)) (ess (20130225 1754))) "Data viewer for GNU R" single ((:commit . "d6e98d3ae1e2a2ea39a56eebcdb73e99d29562e9") (:authors ("myuhe ")) (:maintainer "myuhe") (:keywords "convenience") (:url . "https://github.com/myuhe/ess-R-data-view.el"))]) + (ess-r-insert-obj . [(20211209 812) ((emacs (26 1)) (ess (18 10 1))) "Insert objects in ESS-R" single ((:commit . "dd367cb918c90ec6d3824da869f7a75bb1ca49b6") (:authors ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainer "Shuguang Sun" . "shuguang79@qq.com") (:keywords "tools") (:url . "https://github.com/ShuguangSun/ess-r-insert-obj"))]) + (ess-smart-equals . [(20210411 1333) ((emacs (25 1)) (ess (18 10))) "flexible, context-sensitive assignment key for R/S" single ((:commit . "fea9eea4b59c3e9559b379508e3500076ca99ef1") (:authors ("Christopher R. Genovese" . "genovese@cmu.edu")) (:maintainer "Christopher R. Genovese" . "genovese@cmu.edu") (:keywords "r" "s" "ess" "convenience") (:url . "https://github.com/genovese/ess-smart-equals"))]) + (ess-smart-underscore . [(20190309 101) ((ess (0))) "Ess Smart Underscore" tar ((:commit . "aa871c5b0448515db439ea9bed6a8574e82ddb47") (:authors ("Matthew L. Fidler")) (:maintainer "Matthew Fidler") (:keywords "ess" "underscore") (:url . "http://github.com/mlf176f2/ess-smart-underscore.el"))]) + (ess-view . [(20181001 1730) ((ess (15)) (s (1 8 0)) (f (0 16 0))) "View R dataframes in a spreadsheet software" single ((:commit . "925cafd876e2cc37bc756bb7fcf3f34534b457e2") (:authors ("Bocci Gionata" . "boccigionata@gmail.com")) (:maintainer "Bocci Gionata" . "boccigionata@gmail.com") (:keywords "extensions" "ess") (:url . "https://github.com/GioBo/ess-view"))]) + (ess-view-data . [(20220124 1430) ((emacs (26 1)) (ess (18 10 1)) (csv-mode (1 12))) "View Data" single ((:commit . "6277684e06d5c3a2cbd340f656b7ffca4046e45b") (:authors ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainer "Shuguang Sun" . "shuguang79@qq.com") (:keywords "tools") (:url . "https://github.com/ShuguangSun/ess-view-data"))]) + (esup . [(20220202 2335) ((cl-lib (0 5)) (s (1 2)) (emacs (25 1))) "The Emacs StartUp Profiler (ESUP)" tar ((:commit . "4b49c8d599d4cc0fbf994e9e54a9c78e5ab62a5f") (:authors ("Joe Schafer" . "joe@jschaf.com")) (:maintainer "Serghei Iakovlev" . "egrep@protonmail.ch") (:keywords "convenience" "processes") (:url . "https://github.com/jschaf/esup"))]) + (esxml . [(20220506 759) ((emacs (24 1)) (kv (0 0 5)) (cl-lib (0 5))) "Library for working with xml via esxml and sxml" tar ((:commit . "7ac1fec0e45f12836b301fd9b8e7297434db2f70") (:authors ("Evan Izaksonas-Smith ")) (:maintainer "Evan Izaksonas-Smith") (:keywords "tools" "lisp" "comm") (:url . "https://github.com/tali713/esxml"))]) + (eta . [(20210115 1655) ((emacs (25 1)) (ht (2 2)) (dash (2 17))) "standard and multi dispatch key bind" single ((:commit . "c7540ac50163f368fec1918dfc334304d9b36c51") (:authors ("Chris Zheng")) (:maintainer "Chris Zheng") (:keywords "convenience" "usability") (:url . "https://www.github.com/zcaudate/eta"))]) + (etable . [(20161028 2009) ((dash (2 9 0)) (interval-list (0 1)) (emacs (24 4))) "Implementation of javax.swing.JTable for Emacs." tar ((:commit . "d502141f0c69bf95256ba5cb9cd15350c7e942d2") (:authors ("Matus Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matus Goljer" . "matus.goljer@gmail.com") (:keywords "convenience") (:url . "https://github.com/Fuco1/ETable"))]) + (etc-sudoers-mode . [(20201102 1707) ((sudo-edit (0)) (with-editor (0))) "Edit Sudo security policies" single ((:commit . "74c66c58c9578a0d841206d5dec04d81e7b3d741") (:authors ("Peter Oliver" . "git@mavit.org.uk")) (:maintainer "Peter Oliver" . "git@mavit.org.uk") (:keywords "languages") (:url . "https://gitlab.com/mavit/etc-sudoers-mode/"))]) + (eterm-256color . [(20210224 2241) ((emacs (24 4)) (xterm-color (1 7)) (f (0 19 0))) "Customizable 256 colors for term." tar ((:commit . "c9cfccef03e730f7ab2b407aada3df15ace1fe32") (:authors ("Diego A. Mundo" . "dieggsy@pm.me")) (:maintainer "Diego A. Mundo" . "dieggsy@pm.me") (:keywords "faces") (:url . "http://github.com/dieggsy/eterm-256color"))]) + (eterm-fn . [(20191010 2331) ((term (0))) "Function keys (F1--F12) for term." tar ((:commit . "66f3b2f6308fa2ac4d8a32be5a7e35a96e08a9ee") (:authors ("Bruno Félix Rezende Ribeiro" . "oitofelix@gnu.org")) (:maintainer "Bruno Félix Rezende Ribeiro" . "oitofelix@gnu.org") (:keywords "terminals") (:url . "https://github.com/oitofelix/eterm-fn"))]) + (ethan-wspace . [(20201106 2059) nil "whitespace customizations for emacs" single ((:commit . "035c7d698c99e3891a522d6e6f8fde23c6267c15") (:authors ("Ethan Glasser-Camp" . "ethan@betacantrips.com")) (:maintainer "Ethan Glasser-Camp" . "ethan@betacantrips.com") (:keywords "whitespace" "tab" "newline" "trailing" "clean"))]) + (etherpad . [(20211128 106) ((emacs (26 3)) (request (0 3)) (let-alist (0 0)) (websocket (1 12)) (parsec (0 1)) (0xc (0 1))) "Interface to the Etherpad API" tar ((:commit . "1fae6a03084e0794e09ac036838b53aaae1dbd63") (:authors ("nik gaffney" . "nik@fo.am")) (:maintainer "nik gaffney" . "nik@fo.am") (:keywords "comm" "etherpad" "collaborative editing") (:url . "https://github.com/zzkt/ethermacs"))]) + (euslisp-mode . [(20170830 1929) ((emacs (24 3)) (s (1 9)) (exec-path-from-shell (0)) (helm-ag (0 58))) "Major mode for Euslisp-formatted text" single ((:commit . "db62a2d148482317794727982576494596365a55") (:authors ("iory" . "ab.ioryz@gmail.com")) (:maintainer "iory" . "ab.ioryz@gmail.com") (:keywords "euslisp" "euslisp" "github") (:url . "https://github.com/iory/euslisp-mode"))]) + (eval-expr . [(20120619 647) nil "enhanced eval-expression command" single ((:commit . "a0e69e83de41df8dbccefc1962ab4f02206a3328") (:authors ("Noah Friedman" . "friedman@splode.com")) (:maintainer nil . "friedman@splode.com") (:keywords "lisp" "extensions"))]) + (eval-in-repl . [(20201121 1341) ((dash (0 0 0)) (paredit (0 0 0)) (ace-window (0 0 0))) "Consistent ESS-like eval interface for various REPLs" tar ((:commit . "2abb9ccf6f08ae3a5ab504f0b3fd81ce0345b766") (:authors ("Kazuki YOSHIDA" . "kazukiyoshida@mail.harvard.edu")) (:maintainer "Kazuki YOSHIDA" . "kazukiyoshida@mail.harvard.edu") (:keywords "tools" "convenience") (:url . "https://github.com/kaz-yos/eval-in-repl"))]) + (eval-sexp-fu . [(20191128 825) ((cl-lib (0))) "Tiny functionality enhancements for evaluating sexps." single ((:commit . "36d2fe3bcf602e15ca10a7f487da103515ef391a") (:authors ("Takeshi Banse" . "takebi@laafc.net")) (:maintainer "Takeshi Banse" . "takebi@laafc.net") (:keywords "lisp" "highlight" "convenience"))]) + (evalator . [(20160213 128) ((helm-core (1 9 1))) "Package for interactive transformation of data with helm" tar ((:commit . "f30da4da48c0b3f3cfa1fc1c7cfdb53ffe79df36") (:authors ("Sean Irby")) (:maintainer "Sean Irby" . "sean.t.irby@gmail.com") (:keywords "languages" "elisp" "helm") (:url . "http://www.github.com/seanirby/evalator"))]) + (evalator-clojure . [(20160208 2148) ((cider (0 10 0)) (evalator (1 0 0))) "Clojure evaluation context for evalator via CIDER." tar ((:commit . "caa4e0a137bdfada86593128a654e16aa617ad50") (:authors ("Sean Irby")) (:maintainer "Sean Irby" . "sean.t.irby@gmail.com") (:keywords "languages" "clojure" "cider" "helm") (:url . "http://www.github.com/seanirby/evalator-clojure"))]) + (eve-mode . [(20170822 2231) ((emacs (25)) (polymode (1 0)) (markdown-mode (2 0))) "Major mode for editing Eve documents." single ((:commit . "a4661114d9c18725691b76321d72167ca5a9070a") (:authors ("Joshua Cole" . "joshuafcole@gmail.com")) (:maintainer "Joshua Cole" . "joshuafcole@gmail.com") (:keywords "languages" "wp" "tools") (:url . "https://github.com/witheve/emacs-eve-mode"))]) + (everlasting-scratch . [(20220412 921) ((emacs (25 1))) "The *scratch* that lasts forever" single ((:commit . "8706c55f3b7c267c15b8f10170ecec9998b3cc3d") (:authors ("Huming Chen" . "chenhuming@gmail.com")) (:maintainer "Huming Chen" . "chenhuming@gmail.com") (:keywords "convenience" "tool") (:url . "https://github.com/beacoder/everlasting-scratch"))]) + (evil . [(20220509 2023) ((emacs (24 1)) (goto-chg (1 6)) (cl-lib (0 5))) "Extensible Vi layer for Emacs." tar ((:commit . "b32e00179538af9685ab7c31d46eea6dc40595d4") (:maintainer "Tom Dalziel" . "tom.dalziel@gmail.com") (:keywords "emulation" "vim") (:url . "https://github.com/emacs-evil/evil"))]) + (evil-anzu . [(20200514 1902) ((evil (1 0 0)) (anzu (0 46))) "anzu for evil-mode" single ((:commit . "d3f6ed4773b48767bd5f4708c7f083336a8a8a86") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com") ("Fredrik Bergroth" . "fbergroth@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-evil-anzu"))]) + (evil-args . [(20220125 1626) ((evil (1 0 8))) "Motions and text objects for delimited arguments in Evil." single ((:commit . "2671071a4a57eaee7cc8c27b9e4b6fc60fd2ccd3") (:authors ("Connor Smith" . "wconnorsmith@gmail.com")) (:maintainer "Connor Smith" . "wconnorsmith@gmail.com") (:keywords "evil" "vim-emulation") (:url . "http://github.com/wcsmith/evil-args"))]) + (evil-avy . [(20150908 748) ((emacs (24 1)) (cl-lib (0 5)) (avy (0 3 0)) (evil (1 2 3))) "set-based completion" single ((:commit . "2dd955cc3ecaa7ddeb67b295298abdc6d16dd3a5") (:authors ("Yufan Lou" . "loganlyf@gmail.com")) (:maintainer "Yufan Lou" . "loganlyf@gmail.com") (:keywords "point" "location" "evil" "vim") (:url . "https://github.com/louy2/evil-avy"))]) + (evil-better-visual-line . [(20200123 2045) ((evil (1 2 13))) "gj and gk visual line mode fix" single ((:commit . "4373f930ab1a8d3a2a90e68540967702313b2ce9") (:authors ("")) (:maintainer "") (:keywords "evil" "vim" "motion") (:url . "https://github.com/yourfin/evil-better-visual-line"))]) + (evil-cleverparens . [(20170718 413) ((evil (1 0)) (paredit (1)) (smartparens (1 6 1)) (emacs (24 4)) (dash (2 12 0))) "Evil friendly minor-mode for editing lisp." tar ((:commit . "8c45879d49bfa6d4e414b6c1df700a4a51cbb869") (:authors ("Olli Piepponen" . "opieppo@gmail.com")) (:maintainer "Olli Piepponen" . "opieppo@gmail.com") (:keywords "cleverparens" "parentheses" "evil" "paredit" "smartparens") (:url . "https://github.com/luxbock/evil-cleverparens"))]) + (evil-colemak-basics . [(20220222 1856) ((emacs (24 3)) (evil (1 2 12)) (evil-snipe (2 0 3))) "Basic Colemak key bindings for evil-mode" single ((:commit . "66648de206a7368013f28c0d053b1b32c3efe6c6") (:authors ("Wouter Bolsterlee" . "wouter@bolsterl.ee")) (:maintainer "Wouter Bolsterlee" . "wouter@bolsterl.ee") (:keywords "convenience" "emulations" "colemak" "evil") (:url . "https://github.com/wbolster/evil-colemak-basics"))]) + (evil-colemak-minimal . [(20171006 1317) ((emacs (24)) (evil (1 2 12))) "Minimal Colemak key bindings for evil-mode" single ((:commit . "6d98b6da60f414524a0d718f76024c26dce742b3") (:authors ("Bryan Allred" . "bryan@revolvingcow.com")) (:maintainer "Bryan Allred" . "bryan@revolvingcow.com") (:keywords "colemak" "evil") (:url . "https://github.com/bmallred/evil-colemak-minimal"))]) + (evil-collection . [(20220505 619) ((emacs (25 1)) (evil (1 2 13)) (annalist (1 0))) "A set of keybindings for Evil mode" tar ((:commit . "9707efcae4fc76fa204b1c29565aae35b99b865a") (:authors ("James Nguyen" . "james@jojojames.com")) (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "evil" "tools") (:url . "https://github.com/emacs-evil/evil-collection"))]) + (evil-commentary . [(20210210 1702) ((evil (1 0 0))) "Comment stuff out. A port of vim-commentary." tar ((:commit . "2dab6ac34d1617971768ad219d73af48f7473fec") (:authors ("Quang Linh LE" . "linktohack@gmail.com")) (:maintainer "Quang Linh LE" . "linktohack@gmail.com") (:keywords "evil" "comment" "commentary" "evil-commentary") (:url . "http://github.com/linktohack/evil-commentary"))]) + (evil-dvorak . [(20160416 1841) ((evil (1 0 8))) "evil keybindings for that work with dvorak mode" tar ((:commit . "824f7c56980d72a0ff04c662223540cd66f13754") (:authors ("Joshua Branson")) (:maintainer "Joshua Branson") (:keywords "dvorak" "evil" "vim"))]) + (evil-easymotion . [(20200424 135) ((emacs (24)) (avy (0 3 0)) (cl-lib (0 5))) "A port of vim's easymotion to emacs" single ((:commit . "f96c2ed38ddc07908db7c3c11bcd6285a3e8c2e9") (:authors ("PythonNut" . "pythonnut@pythonnut.com")) (:maintainer "PythonNut" . "pythonnut@pythonnut.com") (:keywords "convenience" "evil") (:url . "https://github.com/pythonnut/evil-easymotion"))]) + (evil-ediff . [(20170724 1923) ((evil (1 2 3))) "Make ediff a little evil" single ((:commit . "50d26cb0654fca8f8fd7227410e5cbf0b8f681cf") (:authors ("Justin Burkett" . "justin@burkett.cc")) (:maintainer "Justin Burkett" . "justin@burkett.cc") (:url . "https://github.com/justbur/evil-ediff"))]) + (evil-embrace . [(20220211 606) ((emacs (24 4)) (embrace (0 1 0)) (evil-surround (0))) "Evil integration of embrace.el" single ((:commit . "7b5a539cfe7db238d860122c793a0cb2d329cc6e") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions"))]) + (evil-escape . [(20180910 1234) ((emacs (24)) (evil (1 0 9)) (cl-lib (0 5))) "No description available." single ((:commit . "f4e9116bfbaac8c9d210c17ad488e0982291245f") (:authors ("Sylvain Benner" . "sylvain.benner@gmail.com")) (:maintainer "Sylvain Benner" . "sylvain.benner@gmail.com") (:keywords "convenience" "editing" "evil") (:url . "https://github.com/syl20bnr/evil-escape"))]) + (evil-ex-fasd . [(20180903 612) ((emacs (24 4)) (evil (1 1 0)) (fasd (0))) "using fasd right from evil-ex" single ((:commit . "ed8fbbe23a8a268d9dcbf1a6132e928ba2c655c5") (:authors ("Rashawn Zhang" . "namy.19@gmail.com")) (:maintainer "Rashawn Zhang" . "namy.19@gmail.com") (:keywords "tools" "fasd" "evil" "navigation") (:url . "https://github.com/yqrashawn/evil-ex-fasd"))]) + (evil-ex-shell-command . [(20181226 226) ((emacs (24 4)) (evil (1 1 0))) "invoke shell-command right from evil-ex" single ((:commit . "a6ca6d27c07f6a0807abfb5b8f8865f1d17f54aa") (:authors ("Rashawn Zhang" . "namy.19@gmail.com")) (:maintainer "Rashawn Zhang" . "namy.19@gmail.com") (:keywords "tools" "shell-command" "evil") (:url . "https://github.com/yqrashawn/evil-ex-shell-command"))]) + (evil-exchange . [(20200118 252) ((evil (1 2 8)) (cl-lib (0 3))) "Exchange text more easily within Evil" single ((:commit . "5f0a2d41434c17c6fb02e4f744043775de1c63a2") (:authors ("Dewdrops" . "v_v_4474@126.com")) (:maintainer "Dewdrops" . "v_v_4474@126.com") (:keywords "evil" "plugin") (:url . "http://github.com/Dewdrops/evil-exchange"))]) + (evil-expat . [(20190521 714) ((emacs (24 3)) (evil (1 0 0))) "Evil ex commands" single ((:commit . "f4fcd0aa3edc359adb5c986b5dd9188d220d84e2") (:authors ("edkolev" . "evgenysw@gmail.com")) (:maintainer "edkolev" . "evgenysw@gmail.com") (:keywords "emulations" "evil" "vim") (:url . "http://github.com/edkolev/evil-expat"))]) + (evil-extra-operator . [(20210225 1239) ((evil (1 0 7))) "Evil operator for evaluating codes, taking notes, searching via google, etc." single ((:commit . "fb249889acacc3e28869491195391fa6f617ae56") (:authors ("Dewdrops" . "v_v_4474@126.com")) (:maintainer "Dewdrops" . "v_v_4474@126.com") (:keywords "evil" "plugin") (:url . "http://github.com/Dewdrops/evil-extra-operator"))]) + (evil-find-char-pinyin . [(20160514 2041) ((evil (1 2 12)) (pinyinlib (0 1 0))) "Evil's f/F/t/T/evil-snipe commands with Pinyin support" single ((:commit . "04e277946d658f1a73c68dcbbadea9c21097a31c") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions"))]) + (evil-fringe-mark . [(20190320 453) ((emacs (24 3)) (evil (1 0 0)) (fringe-helper (0 1 1)) (goto-chg (1 6))) "Display evil-mode marks in the fringe" tar ((:commit . "a1689fddb7ee79aaa720a77aada1208b8afd5c20") (:authors ("Andrew Smith" . "andy.bill.smith@gmail.com")) (:maintainer "Andrew Smith" . "andy.bill.smith@gmail.com") (:url . "https://github.com/Andrew-William-Smith/evil-fringe-mark"))]) + (evil-god-state . [(20141117 255) ((evil (1 0 8)) (god-mode (2 12 0))) "use god-mode keybindings in evil-mode" single ((:commit . "3d44197dc0a1fb40e7b7ff8717f8a8c339ce1d40") (:authors ("Eric Seidel")) (:maintainer "Eric Seidel") (:keywords "evil" "leader" "god-mode") (:url . "https://github.com/gridaphobe/evil-god-state"))]) + (evil-goggles . [(20220112 1302) ((emacs (24 4)) (evil (1 0 0))) "Add a visual hint to evil operations" single ((:commit . "8f20a16e74016f37ad76dc4f2230d9b00c6df3c2") (:authors ("edkolev" . "evgenysw@gmail.com")) (:maintainer "edkolev" . "evgenysw@gmail.com") (:keywords "emulations" "evil" "vim" "visual") (:url . "http://github.com/edkolev/evil-goggles"))]) + (evil-iedit-state . [(20220219 1432) ((evil (1 0 9)) (iedit (0 9 9 9))) "Evil states to interface iedit mode." single ((:commit . "6f7b502447ba35676375169d7707372ebad2791f") (:authors ("Sylvain Benner" . "sylvain.benner@gmail.com")) (:maintainer "Sylvain Benner" . "sylvain.benner@gmail.com") (:keywords "convenience" "editing" "evil" "iedit" "mnemonic") (:url . "https://github.com/syl20bnr/evil-iedit-state"))]) + (evil-indent-plus . [(20220106 931) ((evil (0)) (cl-lib (0 5))) "Evil textobjects based on indentation" single ((:commit . "b4dacbfdb57f474f798bfbf5026d434d549eb65c") (:authors ("Eivind Fonn" . "evfonn@gmail.com")) (:maintainer "Eivind Fonn" . "evfonn@gmail.com") (:keywords "convenience" "evil") (:url . "http://github.com/TheBB/evil-indent-plus"))]) + (evil-indent-textobject . [(20130831 2219) ((evil (0))) "evil textobjects based on indentation" single ((:commit . "70a1154a531b7cfdbb9a31d6922482791e20a3a7") (:authors ("Michael Markert" . "markert.michael@gmail.com")) (:maintainer "Michael Markert" . "markert.michael@gmail.com") (:keywords "convenience" "evil") (:url . "http://github.com/cofi/evil-indent-textobject"))]) + (evil-leader . [(20140606 1243) ((evil (0))) "let there be " single ((:commit . "39f7014bcf8b36463e0c7512c638bda4bac6c2cf") (:authors ("Michael Markert" . "markert.michael@googlemail.com")) (:maintainer "Michael Markert" . "markert.michael@googlemail.com") (:keywords "evil" "vim-emulation" "leader") (:url . "http://github.com/cofi/evil-leader"))]) + (evil-ledger . [(20180802 1612) ((emacs (24 4)) (evil (1 2 12)) (ledger-mode (0))) "Make `ledger-mode' more `evil'." single ((:commit . "7a9f9f5d39c42fffdba8004f8982642351f2b233") (:authors ("Aaron Jacobs" . "atheriel@gmail.com")) (:maintainer "Aaron Jacobs" . "atheriel@gmail.com") (:keywords "convenience" "evil" "languages" "ledger" "vim-emulation") (:url . "https://github.com/atheriel/evil-ledger"))]) + (evil-lion . [(20220317 1030) ((emacs (24 3)) (evil (1 0 0))) "Evil align operator, port of vim-lion" single ((:commit . "4da660e124731ed65e7aaa6c067c30e876619429") (:authors ("edkolev" . "evgenysw@gmail.com")) (:maintainer "edkolev" . "evgenysw@gmail.com") (:keywords "emulations" "evil" "vim") (:url . "http://github.com/edkolev/evil-lion"))]) + (evil-lisp-state . [(20160404 248) ((evil (1 0 9)) (bind-map (0)) (smartparens (1 6 1))) "An evil state to edit Lisp code" single ((:commit . "3c65fecd9917a41eaf6460f22187e2323821f3ce") (:authors ("Sylvain Benner" . "sylvain.benner@gmail.com")) (:maintainer "Sylvain Benner" . "sylvain.benner@gmail.com") (:keywords "convenience" "editing" "evil" "smartparens" "lisp" "mnemonic") (:url . "https://github.com/syl20bnr/evil-lisp-state"))]) + (evil-lispy . [(20190502 739) ((lispy (0 26 0)) (evil (1 2 12)) (hydra (0 13 5))) "precision Lisp editing with Evil and Lispy" tar ((:commit . "ed317f7fccbdbeea8aa04a91b1b1f48a0e2ddc4e") (:authors ("Brandon Carrell , Mika Vilpas" . "mika.vilpas@gmail.com")) (:maintainer "Brandon Carrell , Mika Vilpas" . "mika.vilpas@gmail.com") (:keywords "lisp") (:url . "https://github.com/sp3ctum/evil-lispy"))]) + (evil-mark-replace . [(20200630 940) ((evil (1 14 0))) "replace the thing in marked area" single ((:commit . "d4fec7b10e93cca149163324cd2b2b2dcc211047") (:authors ("Chen Bin ")) (:maintainer "Chen Bin ") (:keywords "convenience") (:url . "http://github.com/redguardtoo/evil-mark-replace"))]) + (evil-matchit . [(20220414 1316) ((evil (1 14 0)) (emacs (25 1))) "Vim matchit ported to Evil" tar ((:commit . "b314e816bacfc01bb7df9b19a06b18638af5cdbe") (:authors ("Chen Bin" . "chenbin.sh@gmail.com")) (:maintainer "Chen Bin" . "chenbin.sh@gmail.com") (:keywords "matchit" "vim" "evil") (:url . "http://github.com/redguardtoo/evil-matchit"))]) + (evil-mc . [(20220118 122) ((emacs (24 3)) (evil (1 2 14)) (cl-lib (0 5))) "Multiple cursors for evil-mode" tar ((:commit . "63fd2fe0c213a4cc31c464d246f92931c4cb720f") (:authors ("Gabriel Adomnicai" . "gabesoft@gmail.com")) (:maintainer "Gabriel Adomnicai" . "gabesoft@gmail.com") (:keywords "evil" "editing" "multiple-cursors" "vim" "evil-multiple-cursors" "evil-mc" "evil-mc") (:url . "https://github.com/gabesoft/evil-mc"))]) + (evil-mc-extras . [(20170202 1649) ((emacs (24 3)) (evil (1 2 12)) (cl-lib (0 5)) (evil-mc (0 0 2)) (evil-numbers (0 4))) "Extra functionality for evil-mc" tar ((:commit . "8c1af3232dd1e15b2ea38360b8cd1e857e11c416") (:authors ("Gabriel Adomnicai" . "gabesoft@gmail.com")) (:maintainer "Gabriel Adomnicai" . "gabesoft@gmail.com") (:keywords "evil" "editing" "multiple-cursors" "vim" "evil-multiple-cursors" "evil-mc" "evil-mc-extras") (:url . "https://github.com/gabesoft/evil-mc-extras"))]) + (evil-mu4e . [(20180613 1039) ((emacs (24 4)) (evil (1 2 10))) "evil-based key bindings for mu4e" single ((:commit . "5b22c1e30246318f233264506272d770f63897ca") (:authors ("Joris Engbers" . "info@jorisengbers.nl")) (:maintainer "Joris Engbers" . "info@jorisengbers.nl") (:url . "https://github.com/JorisE/evil-mu4e"))]) + (evil-multiedit . [(20211121 1650) ((emacs (25 1)) (evil (1 14 0)) (iedit (0 9 9)) (cl-lib (0 5))) "multiple cursors for evil-mode" single ((:commit . "23b53bc8743fb82a8854ba907b1d277374c93a79") (:authors ("Henrik Lissner ")) (:maintainer "Henrik Lissner" . "contact@henrik.io") (:keywords "multiple cursors" "editing" "iedit") (:url . "https://github.com/hlissner/evil-multiedit"))]) + (evil-nerd-commenter . [(20220414 1201) ((emacs (25 1))) "Comment/uncomment lines efficiently. Like Nerd Commenter in Vim" tar ((:commit . "95ed1ad2448e7f49f1ee417061b61edbb69a0749") (:authors ("Chen Bin" . "chenbin.sh@gmail.com")) (:maintainer "Chen Bin" . "chenbin.sh@gmail.com") (:keywords "convenience" "evil") (:url . "http://github.com/redguardtoo/evil-nerd-commenter"))]) + (evil-nl-break-undo . [(20181125 2054) nil "Break evil's undo sequence on CR" single ((:commit . "4a8f2bf99c978a109eeb92965a72a17bedb68762") (:authors ("VanLaser" . "Gabriel.Lazar@com.utcluj.ro")) (:maintainer "VanLaser" . "Gabriel.Lazar@com.utcluj.ro") (:url . "https://github.com/VanLaser/evil-nl-break-undo"))]) + (evil-numbers . [(20211011 103) ((emacs (24 1)) (evil (1 2 0))) "Increment/decrement numbers like in VIM" single ((:commit . "08f0c1ee93b8a563770eaefaf21ab9087fca7bdb") (:authors ("Michael Markert" . "markert.michael@googlemail.com")) (:maintainer "Julia Path" . "julia@jpath.de") (:keywords "convenience" "tools") (:url . "http://github.com/juliapath/evil-numbers"))]) + (evil-opener . [(20161207 1810) ((evil (1 2 12)) (opener (0 2 2))) "opening urls as buffers in evil" tar ((:commit . "c384f67278046fdcd220275fdd212ab85672cbeb") (:authors ("Tim Reddehase" . "tr@rightsrestricted.com")) (:maintainer "Tim Reddehase" . "tr@rightsrestricted.com") (:keywords "url" "http" "files") (:url . "https://github.com/0robustus1/opener.el"))]) + (evil-org . [(20220227 1024) ((emacs (24 4)) (evil (1 0))) "evil keybindings for org-mode" tar ((:commit . "0d10ff7bb9a3a93d25cd91018b17f0a052b335f3") (:maintainer "Somelauw") (:keywords "evil" "vim-emulation" "org-mode" "key-bindings" "presets") (:url . "https://github.com/Somelauw/evil-org-mode.git"))]) + (evil-owl . [(20210416 1700) ((emacs (25 1)) (evil (1 2 13))) "Preview evil registers and marks before using them" single ((:commit . "a41a6d28e26052b25f3d21da37ccf1d8fde1e6aa") (:authors ("Daniel Phan" . "daniel.phan36@gmail.com")) (:maintainer "Daniel Phan" . "daniel.phan36@gmail.com") (:keywords "emulations" "evil" "visual") (:url . "https://github.com/mamapanda/evil-owl"))]) + (evil-paredit . [(20150413 2048) ((evil (1 0 9)) (paredit (25 -2))) "Paredit support for evil keybindings" single ((:commit . "e058fbdcf9dbf7ad6cc77f0172d7517ef233d55f") (:authors ("Roman Gonzalez" . "romanandreg@gmail.com")) (:maintainer "Roman Gonzalez" . "romanandreg@gmail.com") (:keywords "paredit" "evil") (:url . "https://github.com/roman/evil-paredit"))]) + (evil-pinyin . [(20200927 849) ((emacs (25)) (names (0 5)) (evil (1))) "Evil search Chinese characters by pinyin" tar ((:commit . "3e9e501ded86f88e01a4edec5d526ab0fab879d7") (:keywords "extensions") (:url . "https://github.com/laishulu/evil-pinyin"))]) + (evil-python-movement . [(20180724 1420) ((emacs (25 1)) (cl-lib (0 5)) (dash (2 13 0)) (evil (1 0)) (s (1 12 0))) "Port Neovim's python movement to Evil" single ((:commit . "9936b3b7f8d96415d517c1f3604637889484a637") (:authors ("Felipe Lema ")) (:maintainer "Felipe Lema ") (:url . "https://bitbucket.org/FelipeLema/evil-python-movement.el/"))]) + (evil-quickscope . [(20160202 1924) ((evil (0))) "Highlight unique characters in words for f,F,t,T navigation" single ((:commit . "37a20e4c56c6058abf186ad4013c155e695e876f") (:authors ("Michael Chen" . "blorbx@gmail.com")) (:maintainer "Michael Chen" . "blorbx@gmail.com") (:keywords "faces" "emulation" "vim" "evil") (:url . "http://github.com/blorbx/evil-quickscope"))]) + (evil-rails . [(20190512 1517) ((evil (1 0)) (projectile-rails (1 0))) "Rails support for Evil Mode" single ((:commit . "b0f1c5de6720714febeb76c4b569b71bb891938c") (:authors ("Antono Vasiljev" . "antono.vasiljev@gmail.com")) (:maintainer "Antono Vasiljev" . "antono.vasiljev@gmail.com") (:keywords "ruby" "rails" "vim" "project" "convenience" "web" "evil" "projectile") (:url . "https://github.com/antono/evil-rails"))]) + (evil-replace-with-char . [(20180324 2206) ((evil (1 2 13)) (emacs (24))) "replace chars of a text object with a char" single ((:commit . "ed4a12d5bff11163eb03ad2826c52fd30f51a8d3") (:authors ("Filipe Silva" . "filipe.silva@gmail.com")) (:maintainer "Filipe Silva" . "filipe.silva@gmail.com") (:url . "https://github.com/ninrod/evil-replace-with-char"))]) + (evil-replace-with-register . [(20170713 925) ((evil (1 0 8))) "Port of vim plugin ReplaceWithRegister" single ((:commit . "91cc7bf21a94703c441cc9212214075b226b7f67") (:authors ("Dewdrops" . "v_v_4474@126.com")) (:maintainer "Dewdrops" . "v_v_4474@126.com") (:keywords "evil" "plugin") (:url . "https://github.com/Dewdrops/evil-ReplaceWithRegister"))]) + (evil-rsi . [(20160221 2104) ((evil (1 0 0))) "Use emacs motion keys in evil, inspired by vim-rsi" single ((:commit . "65ae60866be494e4622fe383e23975e04d2a42a3") (:authors ("Quang Linh LE" . "linktohack@gmail.com")) (:maintainer "Quang Linh LE" . "linktohack@gmail.com") (:keywords "evil" "rsi" "evil-rsi") (:url . "http://github.com/linktohack/evil-rsi"))]) + (evil-ruby-text-objects . [(20200323 1552) ((emacs (25 1)) (evil (1 2 0))) "Evil text objects for Ruby code" single ((:commit . "32983d91be83ed903b6ef9655e00f69beed2572c") (:authors ("Sergio Gil" . "sgilperez@gmail.com")) (:maintainer "Sergio Gil" . "sgilperez@gmail.com") (:keywords "languages") (:url . "https://github.com/porras/evil-ruby-text-objects"))]) + (evil-search-highlight-persist . [(20170523 334) ((highlight (0))) "Persistent highlights after search" single ((:commit . "979d2dec58d3b9c5ca5fdf4bb802a0209913794e") (:authors ("Juanjo Alvarez" . "juanjo@juanjoalvarez.net")) (:maintainer "Juanjo Alvarez" . "juanjo@juanjoalvarez.net"))]) + (evil-smartparens . [(20171210 1513) ((evil (1 0)) (emacs (24 4)) (smartparens (1 10 1))) "Evil support for smartparens" single ((:commit . "026d4a3cfce415a4dfae1457f871b385386e61d3") (:authors ("Lars Andersen" . "expez@expez.com")) (:maintainer "Lars Andersen" . "expez@expez.com") (:keywords "evil" "smartparens") (:url . "https://www.github.com/expez/evil-smartparens"))]) + (evil-snipe . [(20220428 1432) ((emacs (24 4)) (evil (1 2 12)) (cl-lib (0 5))) "emulate vim-sneak & vim-seek" single ((:commit . "c07788c35cf8cd8e652a494322fdc0643e30a89f") (:authors ("Henrik Lissner ")) (:maintainer "Henrik Lissner" . "contact@henrik.io") (:keywords "emulation" "vim" "evil" "sneak" "seek") (:url . "https://github.com/hlissner/evil-snipe"))]) + (evil-space . [(20151208 1228) ((evil (1 0 0))) "Repeat motion in Evil. Correct the behaviour of what SPC should do." single ((:commit . "a9c07284d308425deee134c9d88a2d538dd229e6") (:authors ("Quang Linh LE" . "linktohack@gmail.com")) (:maintainer "Quang Linh LE" . "linktohack@gmail.com") (:keywords "space" "repeat" "motion") (:url . "http://github.com/linktohack/evil-space"))]) + (evil-string-inflection . [(20180313 1755) ((emacs (24)) (evil (1 2 13)) (string-inflection (1 0 6))) "snake_case -> CamelCase -> etc. for text objects" single ((:commit . "d22a90ab807afa7f27f3815b5b5ea47d52d05218") (:authors ("Filipe Silva" . "filipe.silva@gmail.com")) (:maintainer "Filipe Silva" . "filipe.silva@gmail.com") (:url . "https://github.com/ninrod/evil-string-inflection"))]) + (evil-surround . [(20220504 802) ((evil (1 2 12))) "emulate surround.vim from Vim" single ((:commit . "c9e1449bf3f740b5e9b99e7820df4eca7fc7cf02") (:authors ("Tim Harper ") ("Vegard Øye ")) (:maintainer "Tim Harper ") (:keywords "emulation" "vi" "evil"))]) + (evil-swap-keys . [(20191105 1426) ((emacs (24 4))) "Intelligently swap keys on text input with evil" single ((:commit . "b5ef105499f998b5667da40da30c073229a213ea") (:authors ("Wouter Bolsterlee" . "wouter@bolsterl.ee")) (:maintainer "Wouter Bolsterlee" . "wouter@bolsterl.ee") (:keywords "convenience" "data" "languages" "tools") (:url . "https://github.com/wbolster/evil-swap-keys"))]) + (evil-tabs . [(20160217 1520) ((evil (0 0 0)) (elscreen (0 0 0))) "Integrating Vim-style tabs for Evil mode users." single ((:commit . "53d3314a810017b6056ab6796aef671f5ea1c063") (:authors ("Kris Jenkins" . "krisajenkins@gmail.com")) (:maintainer "Kris Jenkins" . "krisajenkins@gmail.com") (:keywords "evil" "tab" "tabs" "vim") (:url . "https://github.com/krisajenkins/evil-tabs"))]) + (evil-terminal-cursor-changer . [(20220422 255) ((evil (1 0 8))) "Change cursor shape and color by evil state in terminal" single ((:commit . "69d562932f9ab9869ab1ed923e9789cbfa0ff14c") (:authors ("7696122")) (:maintainer "7696122") (:keywords "evil" "terminal" "cursor") (:url . "https://github.com/7696122/evil-terminal-cursor-changer"))]) + (evil-test-helpers . [(20220425 2132) ((evil (1 15 0))) "unit test helpers for Evil" single ((:commit . "b32e00179538af9685ab7c31d46eea6dc40595d4") (:authors ("Vegard Øye ")) (:maintainer "Vegard Øye "))]) + (evil-tex . [(20220415 842) ((emacs (26 1)) (evil (1 0)) (auctex (11 88))) "Useful features for editing LaTeX in evil-mode" single ((:commit . "26035ec9a09f8b38ce0d495ff788e83ec8b195d5") (:keywords "tex" "emulation" "vi" "evil" "wp") (:url . "https://github.com/iyefrat/evil-tex"))]) + (evil-text-object-python . [(20191010 1328) ((emacs (25)) (evil (1 2 14)) (dash (2 16 0))) "Python specific evil text objects" single ((:commit . "39d22fc524f0413763f291267eaab7f4e7984318") (:authors ("Wouter Bolsterlee" . "wouter@bolsterl.ee")) (:maintainer "Wouter Bolsterlee" . "wouter@bolsterl.ee") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/wbolster/evil-text-object-python"))]) + (evil-textobj-anyblock . [(20170905 1907) ((cl-lib (0 5)) (evil (1 1 0))) "Textobject for the closest user-defined blocks." single ((:commit . "ff00980f0634f95bf2ad9956b615a155ea8743be") (:authors ("Fox Kiester" . "noct@openmailbox.org")) (:maintainer "Fox Kiester" . "noct@openmailbox.org") (:keywords "evil") (:url . "https://github.com/noctuid/evil-textobj-anyblock"))]) + (evil-textobj-column . [(20170905 1905) ((names (0 5)) (emacs (24)) (evil (0))) "Provides column text objects." single ((:commit . "835d7036d0bc9a6e44fc9b7c54ccf2a7c01428cd") (:authors ("Fox Kiester" . "noct@openmailbox.org")) (:maintainer "Fox Kiester" . "noct@openmailbox.org") (:keywords "evil" "column" "text-object") (:url . "https://github.com/noctuid/evil-textobj-column"))]) + (evil-textobj-entire . [(20150422 1254) ((emacs (24)) (evil (1 0 0))) "text object for entire lines of buffer for evil" single ((:commit . "5b3a98f3a69edc3a788f539f6ffef4a0ef5e853d") (:authors ("supermomonga")) (:maintainer "supermomonga") (:keywords "convenience" "emulations") (:url . "https://github.com/supermomonga/evil-textobj-entire"))]) + (evil-textobj-line . [(20211101 1429) ((evil (1 0 0))) "Line text object for Evil" single ((:commit . "9eaf9a5485c2b5c05e16552b34632ca520cd681d") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com"))]) + (evil-textobj-syntax . [(20181210 1213) ((names (0 5)) (emacs (24)) (evil (0))) "Provides syntax text objects." single ((:commit . "2d9ba8c75c754b409aea7469f46a5cfa52a872f3") (:keywords "evil" "syntax" "highlight" "text-object") (:url . "https://github.com/laishulu/evil-textobj-syntax"))]) + (evil-textobj-tree-sitter . [(20220423 947) ((emacs (25 1)) (evil (1 0 0)) (tree-sitter (0 15 0))) "Provides evil textobjects using tree-sitter" tar ((:commit . "bfdef5a292f7dde36967bb86eb2f7009b03631b1") (:keywords "evil" "tree-sitter" "text-object" "convenience") (:url . "https://github.com/meain/evil-textobj-tree-sitter"))]) + (evil-traces . [(20191214 558) ((emacs (25 1)) (evil (1 2 13))) "Visual hints for `evil-ex'" single ((:commit . "290b5323542c46af364ec485c8ec9000040acf90") (:authors ("Daniel Phan" . "daniel.phan36@gmail.com")) (:maintainer "Daniel Phan" . "daniel.phan36@gmail.com") (:keywords "emulations" "evil" "visual") (:url . "https://github.com/mamapanda/evil-traces"))]) + (evil-tree-edit . [(20220425 2355) ((emacs (27 1)) (tree-edit (0 1 0)) (tree-sitter (0 15 0)) (evil (1 0 0)) (avy (0 5 0)) (s (0 0 0))) "Evil structural editing for any language!" tar ((:commit . "eafee31ca4f532a9dbee326d3ec3bdd1e997223b") (:authors ("Ethan Leba" . "ethanleba5@gmail.com")) (:maintainer "Ethan Leba" . "ethanleba5@gmail.com") (:url . "https://github.com/ethan-leba/tree-edit"))]) + (evil-tutor . [(20150103 650) ((evil (1 0 9))) "Vimtutor adapted to Evil and wrapped in a major-mode" tar ((:commit . "4e124cd3911dc0d1b6817ad2c9e59b4753638f28") (:authors ("Sylvain Benner" . "sylvain.benner@gmail.com")) (:maintainer "Sylvain Benner" . "sylvain.benner@gmail.com") (:keywords "convenience" "editing" "evil") (:url . "https://github.com/syl20bnr/evil-tutor"))]) + (evil-tutor-ja . [(20160917 132) ((evil (1 0 9)) (evil-tutor (0 1))) "Japanese Vimtutor adapted to Evil and wrapped in a major-mode" tar ((:commit . "99af7d82e02ce3bcdfaff47c5c80b57327a7ea8d") (:authors ("Kenji Miyazaki" . "kenjizmyzk@gmail.com")) (:maintainer "Kenji Miyazaki" . "kenjizmyzk@gmail.com") (:keywords "convenience" "editing" "evil" "japanese") (:url . "https://github.com/kenjimyzk/evil-tutor-ja"))]) + (evil-vimish-fold . [(20200122 117) ((emacs (24 4)) (evil (1 0 0)) (vimish-fold (0 2 0))) "Integrate vimish-fold with evil" single ((:commit . "b6e0e6b91b8cd047e80debef1a536d9d49eef31a") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/evil-vimish-fold"))]) + (evil-visual-mark-mode . [(20190116 1557) ((evil (1 0 9)) (dash (2 10))) "Display evil marks on buffer" single ((:commit . "ac5997971972a9251f140b5542d82790ca4a43b4") (:authors ("Roman Gonzalez" . "romanandreg@gmail.com")) (:maintainer "Roman Gonzalez" . "romanandreg@gmail.com") (:keywords "evil"))]) + (evil-visual-replace . [(20171016 613) ((evil (1 0 0))) "search/replace commands for evil visual state, inc. blocks" single ((:commit . "163fc827a1ffc106475da470c37fb26f4cc9b008") (:authors ("Troy Pracy")) (:maintainer "Troy Pracy") (:keywords "evil" "search" "replace" "regexp" "block" "rectangular" "region" "visual") (:url . "https://github.com/troyp/evil-visual-replace"))]) + (evil-visualstar . [(20160223 48) ((evil (0))) "Starts a * or # search from the visual selection" single ((:commit . "06c053d8f7381f91c53311b1234872ca96ced752") (:authors ("Bailey Ling")) (:maintainer "Bailey Ling") (:keywords "evil" "vim" "visualstar") (:url . "https://github.com/bling/evil-visualstar"))]) + (evm . [(20141007 1156) ((dash (2 3 0)) (f (0 13 0))) "Emacs Version Manager" single ((:commit . "d0623b2355436a5fd9f7238b419782080c79196b") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:url . "http://github.com/rejeep/evm"))]) + (evm-mode . [(20220503 1106) nil "Major mode for editing Ethereum EVM bytecode" single ((:commit . "2b326751c9421842521e851d969b9c269c79f8b3") (:authors ("Ta Quang Trung")) (:maintainer "Ta Quang Trung") (:keywords "languages") (:url . "https://github.com/taquangtrung/emacs-evm-mode"))]) + (ewal . [(20200305 230) ((emacs (25 1))) "A pywal-based theme generator" tar ((:commit . "e2a04f5c97b7d5e087af26e646c0b45a24522e56") (:authors ("Uros Perisic")) (:maintainer "Uros Perisic") (:keywords "faces") (:url . "https://gitlab.com/jjzmajic/ewal"))]) + (ewal-doom-themes . [(20200922 325) ((emacs (25)) (ewal (0 1)) (doom-themes (0 1))) "Dread the colors of darkness" tar ((:commit . "e2a04f5c97b7d5e087af26e646c0b45a24522e56") (:authors ("Uros Perisic")) (:maintainer "Uros Perisic") (:keywords "faces") (:url . "https://gitlab.com/jjzmajic/ewal"))]) + (ewal-evil-cursors . [(20190911 1315) ((emacs (25)) (ewal (0 1))) "`ewal'-colored evil cursor for Emacs and Spacemacs" single ((:commit . "e2a04f5c97b7d5e087af26e646c0b45a24522e56") (:authors ("Uros Perisic")) (:maintainer "Uros Perisic") (:keywords "faces") (:url . "https://gitlab.com/jjzmajic/ewal"))]) + (ewal-spacemacs-themes . [(20190911 1305) ((emacs (25)) (ewal (0 1)) (spacemacs-theme (0 1))) "Ride the rainbow spaceship" tar ((:commit . "e2a04f5c97b7d5e087af26e646c0b45a24522e56") (:authors ("Uros Perisic")) (:maintainer "Uros Perisic") (:keywords "faces") (:url . "https://gitlab.com/jjzmajic/ewal"))]) + (ewmctrl . [(20170922 217) nil "Use `wmctrl' to manage desktop windows via EWMH/NetWM." single ((:commit . "3d0217c4d6cdb5c308b6cb4293574f470d4faacf") (:authors ("Alexis" . "flexibeast@gmail.com") ("Adam Plaice" . "plaice.adam@gmail.com")) (:maintainer "Alexis" . "flexibeast@gmail.com") (:keywords "desktop" "windows" "ewmh" "netwm") (:url . "https://github.com/flexibeast/ewmctrl"))]) + (eww-lnum . [(20150102 1512) nil "Conkeror-like functionality for eww" single ((:commit . "4b0ecec769919ecb05ca4fb15ec51911ba589929") (:authors ("Andrey Kotlarski" . "m00naticus@gmail.com")) (:maintainer "Andrey Kotlarski" . "m00naticus@gmail.com") (:keywords "eww" "browse" "conkeror") (:url . "https://github.com/m00natic/eww-lnum"))]) + (exato . [(20180305 1042) ((evil (1 2 13)) (emacs (24))) "EXATO: Evil XML/HTML Attributes Text Object" single ((:commit . "aee7af7b7a0e7551478f453d1de7d5b9cb2e06c4") (:authors ("Filipe Silva" . "filipe.silva@gmail.com")) (:maintainer "Filipe Silva" . "filipe.silva@gmail.com") (:url . "https://github.com/ninrod/exato"))]) + (exec-path-from-shell . [(20210914 1247) ((emacs (24 1)) (cl-lib (0 6))) "Get environment variables such as $PATH from the shell" single ((:commit . "6336db9be13d46e2d4bc3b50bc37a3fbf30fdc9e") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "unix" "environment") (:url . "https://github.com/purcell/exec-path-from-shell"))]) + (execline . [(20190711 2010) ((emacs (26 1)) (s (1 6 0))) "Major mode for editing execline scripts" single ((:commit . "c75dd9b2c54d8e59fc35fd4bd98d8e213948a3f5") (:authors ("Dmitry Bogatov" . "KAction@debian.org")) (:maintainer "Dmitry Bogatov" . "KAction@debian.org") (:keywords "tools" "unix" "languages") (:url . "https://gitlab.com/KAction/emacs-execline"))]) + (exiftool . [(20190520 1106) ((emacs (25))) "Elisp wrapper around ExifTool" single ((:commit . "fc6713e753380f3034d8df55b7af3a737ea52ab4") (:authors ("Arun I" . "arunisaac@systemreboot.net")) (:maintainer "Arun I" . "arunisaac@systemreboot.net") (:keywords "data") (:url . "https://git.systemreboot.net/exiftool.el"))]) + (exotica-theme . [(20180212 2329) ((emacs (24))) "A dark theme with vibrant colors" single ((:commit . "ff3ef4f6fa38c93b99becad977c7810c990a4d2f") (:authors ("Bharat Joshi" . "jbharat@outlook.com")) (:maintainer "Bharat Joshi" . "jbharat@outlook.com") (:keywords "faces" "theme" "dark" "vibrant colors") (:url . "https://github.com/jbharat/exotica-theme"))]) + (expand-line . [(20151006 207) nil "Expand selection by line" single ((:commit . "75a5d0241f35dd0748ab8ecb4ff16891535be372") (:authors ("Kai Yu" . "yeannylam@gmail.com")) (:maintainer "Kai Yu" . "yeannylam@gmail.com"))]) + (expand-region . [(20210708 1952) nil "Increase selected region by semantic units." tar ((:commit . "7e5bbe2763c12bae3e77fe0c49bcad05ff91dbfe") (:authors ("Magnar Sveen" . "magnars@gmail.com")) (:maintainer "Magnar Sveen" . "magnars@gmail.com") (:keywords "marking" "region"))]) + (expenses . [(20220318 842) ((emacs (26 1)) (dash (2 19 1)) (ht (2 3))) "Record and view expenses" tar ((:commit . "e668666770858e92de83d8217c7e384de3ba1e34") (:authors ("Md Arif Shaikh" . "arifshaikh.astro@gmail.com")) (:maintainer "Md Arif Shaikh" . "arifshaikh.astro@gmail.com") (:keywords "expense tracking" "convenience") (:url . "https://github.com/md-arif-shaikh/expenses"))]) + (express . [(20140508 2041) ((string-utils (0 3 2))) "Alternatives to `message'" single ((:commit . "93dae7377eace4a5413ba99aecb6f26f90798725") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "extensions" "message" "interface") (:url . "http://github.com/rolandwalker/express"))]) + (exsqlaim-mode . [(20170607 1003) ((s (1 10 0))) "Use variables inside sql queries" single ((:commit . "a2e0a62ec8b87193d8eaa695774bfd689324b06c") (:authors ("Ahmad Nazir Raja" . "ahmadnazir@gmail.com")) (:maintainer "Ahmad Nazir Raja" . "ahmadnazir@gmail.com") (:url . "https://github.com/ahmadnazir/exsqlaim-mode"))]) + (extempore-mode . [(20210512 2350) ((emacs (24 4))) "Emacs major mode for Extempore source files" single ((:commit . "eb2dee8860f3d761e949d7c2ee8e2e469ac1cf51") (:authors ("Ben Swift" . "ben@benswift.me")) (:maintainer "Ben Swift" . "ben@benswift.me") (:keywords "extempore") (:url . "http://github.com/extemporelang/extempore-emacs-mode"))]) + (extend-dnd . [(20151122 1850) nil "R drag and Drop" tar ((:commit . "80c966c93b82c9bb5c6225a432557c39144fc602") (:authors ("Matthew L. Fidler")) (:maintainer "Matthew L. Fidler") (:keywords "extend" "drag and drop") (:url . "https://github.com/mlf176f2/extend-dnd"))]) + (extmap . [(20211023 1904) ((emacs (24 1))) "Externally-stored constant mapping for Elisp" single ((:commit . "5875a4ab27831eb81af6246b12a174c765d52a78") (:authors ("Paul Pogonyshev" . "pogonyshev@gmail.com")) (:maintainer "Paul Pogonyshev" . "pogonyshev@gmail.com") (:keywords "lisp") (:url . "https://github.com/doublep/extmap"))]) + (exunit . [(20211209 1012) ((s (1 11 0)) (emacs (24 3)) (f (0 20 0)) (transient (0 3 6))) "ExUnit test runner" single ((:commit . "0715c2dc2dca0b56c61330eda0690f90cca5f98b") (:authors ("Anantha kumaran" . "ananthakumaran@gmail.com")) (:maintainer "Anantha kumaran" . "ananthakumaran@gmail.com") (:keywords "processes" "elixir" "exunit") (:url . "http://github.com/ananthakumaran/exunit.el"))]) + (exwm-edit . [(20220414 106) ((emacs (25 1))) "Edit mode for EXWM" single ((:commit . "b5b7e950f57e30befd68d51df34540b70e6ac28f") (:authors ("Ag Ibragimov")) (:maintainer "Ag Ibragimov") (:keywords "convenience") (:url . "https://github.com/agzam/exwm-edit"))]) + (exwm-firefox-core . [(20190812 2110) ((emacs (24 4)) (exwm (0 16))) "Firefox hotkeys to functions" single ((:commit . "e2fe2a895e8f973307ef52f8c9976b26e701cbd0") (:authors ("Sebastian Wålinder" . "s.walinder@gmail.com")) (:maintainer "Sebastian Wålinder" . "s.walinder@gmail.com") (:keywords "extensions") (:url . "https://github.com/walseb/exwm-firefox-core"))]) + (exwm-firefox-evil . [(20220318 1958) ((emacs (24 4)) (exwm (0 16)) (evil (1 0 0)) (exwm-firefox-core (1 0))) "evil-mode implementation of exwm-firefox-core" single ((:commit . "a377326e2e4ac386a0abb3fc9b1b356a0d955b61") (:authors ("Sebastian Wålinder" . "s.walinder@gmail.com")) (:maintainer "Sebastian Wålinder" . "s.walinder@gmail.com") (:keywords "extensions") (:url . "https://github.com/walseb/exwm-firefox-evil"))]) + (exwm-float . [(20210207 2035) ((emacs (25 1)) (xelb (0 18)) (exwm (0 24)) (popwin (1 0 2))) "Convenient modes and bindings for floating EXWM frames" single ((:commit . "eb1b60b4a65e1ca5e323ef68a284ec6af72e637a") (:authors ("Mehmet Tekman")) (:maintainer "Mehmet Tekman") (:keywords "outlines") (:url . "https://gitlab.com/mtekman/exwm-float.el"))]) + (exwm-mff . [(20210603 1723) ((emacs (25 1))) "Mouse Follows Focus" single ((:commit . "89206f2e3189f589c27c56bd2b6203e906ee7100") (:authors ("Ian Eure" . "public@lowbar.fyi")) (:maintainer "Ian Eure" . "public@lowbar.fyi") (:keywords "unix") (:url . "https://github.com/ieure/exwm-mff"))]) + (exwm-modeline . [(20220131 1520) ((emacs (27 1)) (exwm (0 26))) "A modeline segment for EXWM workspaces" single ((:commit . "3225ec1803c3da9aee3f53562278c3558c179c26") (:authors ("Korytov Pavel" . "thexcloud@gmail.com")) (:maintainer "Korytov Pavel" . "thexcloud@gmail.com") (:url . "https://github.com/SqrtMinusOne/exwm-modeline"))]) + (exwm-surf . [(20171204 1140) ((emacs (24 4)) (exwm (0 16))) "Interface for Surf (surf.suckless.org) under exwm" single ((:commit . "6c17e2c1597fe4b7b454a1dac23b9127ac951e94") (:authors ("Peter" . "craven@gmx.net")) (:maintainer "Peter" . "craven@gmx.net") (:keywords "extensions") (:url . "https://github.com/ecraven/exwm-surf"))]) + (exwm-x . [(20210419 950) ((cl-lib (0 5)) (async (1 6)) (exwm (0 22))) "A derivative wm based on EXWM (emacs x window manager)" tar ((:commit . "2ab026f407b011a8e8380c889990e85e69cb3a4e") (:authors ("Feng Shu" . "tumashu@163.com")) (:maintainer "Feng Shu" . "tumashu@163.com") (:keywords "window-manager" "exwm") (:url . "https://github.com/tumashu/exwm-x"))]) + (eyebrowse . [(20201107 955) ((dash (2 7 0)) (emacs (24 3 1))) "Easy window config switching" single ((:commit . "f7e129b84183367f54f0d0d3c9db8540f754bd8d") (:authors ("Vasilij Schneidermann" . "mail@vasilij.de")) (:maintainer "Vasilij Schneidermann" . "mail@vasilij.de") (:keywords "convenience") (:url . "https://depp.brause.cc/eyebrowse"))]) + (eyuml . [(20141028 2227) ((request (0 2 0)) (s (1 8 0))) "Write textual uml diagram from emacs using yuml.me" single ((:commit . "eb29c37316e44a14741f16e894fbcfcb7537dc80") (:authors ("Anthony HAMON" . "hamon.anth@gmail.com")) (:maintainer "Anthony HAMON" . "hamon.anth@gmail.com") (:keywords "uml") (:url . "http://github.com/antham/eyuml"))]) + (ez-query-replace . [(20210724 2247) ((dash (1 2 0)) (s (1 11 0))) "a smarter context-sensitive query-replace that can be reapplied" single ((:commit . "2b68472f4007a73908c3b242e83ac5a7587967ff") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk"))]) + (eziam-theme . [(20200327 1810) nil "A mostly monochrome theme, inspired by Tao and Leuven, with dark and light versions." tar ((:commit . "d7e517f8e626035df3b63ec6fc07b85d48a996c5"))]) + (f . [(20220405 1534) ((s (1 7 0)) (dash (2 2 0))) "Modern API for working with files and directories" single ((:commit . "b5cb884b3b4372a6f3d1d4428cf092ca1e5c8044") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "files" "directories") (:url . "http://github.com/rejeep/f.el"))]) + (f3 . [(20180130 1158) ((emacs (24 3)) (helm (2 8 8)) (cl-lib (0 5))) "a helm interface to find" tar ((:commit . "000009ce4adf7a57eae80512f29c4ec2a1391ce5") (:authors ("Danny McClanahan")) (:maintainer "Danny McClanahan") (:keywords "find" "file" "files" "helm" "fast" "finder") (:url . "https://github.com/cosmicexplorer/f3"))]) + (fabric . [(20171116 656) nil "Launch Fabric using Emacs" tar ((:commit . "df79be341d0b34ed23850f9894136092fa5fea8c") (:authors ("Nicolas Lamirault" . "nicolas.lamirault@chmouel.com")) (:maintainer "Nicolas Lamirault" . "nicolas.lamirault@chmouel.com") (:keywords "python" "fabric") (:url . "https://github.com/nlamirault/fabric.el"))]) + (face-explorer . [(20190517 1857) nil "Library and tools for faces and text properties" single ((:commit . "ad1300e13e5643e4c246cabfd91f833d39113052") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "faces") (:url . "https://github.com/Lindydancer/face-explorer"))]) + (face-shift . [(20210725 2146) ((emacs (24 1))) "Shift the colour of certain faces" single ((:commit . "14dce79fc42116c49eb4c8a4ab7ca3c4bd7cbf6f") (:authors ("Philip Kaludercic" . "philipk@posteo.net")) (:maintainer "Philip Kaludercic" . "philipk@posteo.net") (:keywords "faces") (:url . "https://git.sr.ht/~pkal/face-shift"))]) + (faceup . [(20170925 1946) nil "Markup language for faces and font-lock regression testing" single ((:commit . "6c92dad56a133e14e7b27831e1bcf9b3a71ff154") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "faces" "languages") (:url . "https://github.com/Lindydancer/faceup"))]) + (factlog . [(20130210 140) ((deferred (0 3 1))) "File activity logger" single ((:commit . "6503d77ea882c995b051d22e72db336fb28770fc") (:authors ("Takafumi Arakaki ")) (:maintainer "Takafumi Arakaki ") (:url . "https://github.com/tkf/factlog"))]) + (faff-theme . [(20220407 145) nil "Light Emacs color theme on cornsilk3 background" single ((:commit . "f824c3f55ea42d65e0b632879c6948d3eb43b2f3") (:authors ("James Ferguson <(concat \"wjcferguson\" at-sign \"gmail.com\")>")) (:maintainer "James Ferguson <(concat \"wjcferguson\" at-sign \"gmail.com\")>") (:keywords "color" "theme") (:url . "https://github.com/WJCFerguson/emacs-faff-theme"))]) + (fakir . [(20140729 1652) ((noflet (0 0 8)) (dash (1 3 2)) (kv (0 0 19))) "fakeing bits of Emacs" single ((:commit . "1fca406ad7de80fece6319ff75d4230b648534b0") (:authors ("Nic Ferrier" . "nferrier@ferrier.me.uk")) (:maintainer "Nic Ferrier" . "nferrier@ferrier.me.uk") (:keywords "lisp" "tools") (:url . "http://github.com/nicferrier/emacs-fakir"))]) + (fancy-battery . [(20150101 1204) ((emacs (24 1))) "Fancy battery display" single ((:commit . "9b88ae77a01aa3edc529840338bcb2db7f445822") (:authors ("Sebastian Wiesner" . "swiesner@lunaryorn.com")) (:maintainer "Sebastian Wiesner" . "swiesner@lunaryorn.com") (:keywords "convenience" "tools" "hardware") (:url . "https://github.com/lunaryorn/fancy-battery.el"))]) + (fancy-dabbrev . [(20220211 633) ((emacs (25 1)) (popup (0 5 3))) "Like dabbrev-expand with preview and popup menu" single ((:commit . "cf4a2f7e3e43e07ab9aa9db16532a21010e9fc8c") (:authors ("Joel Rosdahl" . "joel@rosdahl.net")) (:maintainer "Joel Rosdahl" . "joel@rosdahl.net") (:url . "https://github.com/jrosdahl/fancy-dabbrev"))]) + (fancy-narrow . [(20171031 16) nil "narrow-to-region with more eye candy." single ((:commit . "c9b3363752c09045b8ce7a2635afae42d2ae63c7") (:authors ("Artur Malabarba" . "bruce.connor.am@gmail.com")) (:maintainer "Artur Malabarba" . "bruce.connor.am@gmail.com") (:keywords "faces" "convenience") (:url . "http://github.com/Bruce-Connor/fancy-narrow"))]) + (fantom-theme . [(20200328 604) ((emacs (24 1))) "Dark theme based on Phantom Code for VSCode" single ((:commit . "2c1c7fd53086c2ff86ee0961642c3b58e2343c08") (:authors ("Adam Svanberg")) (:maintainer "Adam Svanberg") (:url . "https://github.com/adsva/fantom-emacs-theme"))]) + (fanyi . [(20220310 358) ((emacs (27 1)) (s (1 12 0))) "Not only English-Chinese translator" tar ((:commit . "b01cb24209d223ae0e7281c279daab87800ee7f4") (:authors ("Zhiwei Chen" . "condy0919@gmail.com")) (:maintainer "Zhiwei Chen" . "condy0919@gmail.com") (:keywords "convenience" "tools") (:url . "https://github.com/condy0919/fanyi.el"))]) + (farmhouse-theme . [(20160713 2244) nil "Farmhouse Theme, Emacs edition" tar ((:commit . "7ddc1ff13b4a3d5466bd0d33ecb86100352e83a7"))]) + (fasd . [(20210104 738) nil "Emacs integration for the command-line productivity booster `fasd'" single ((:commit . "c1d92553f33ebb018135c698db1a6d7f86731a26") (:authors ("steckerhalter")) (:maintainer "steckerhalter") (:keywords "cli" "bash" "zsh" "autojump") (:url . "https://framagit.org/steckerhalter/emacs-fasd"))]) + (fast-scroll . [(20191016 327) ((emacs (25 1)) (cl-lib (0 6 1))) "Some utilities for faster scrolling over large buffers." single ((:commit . "3f6ca0d5556fe9795b74714304564f2295dcfa24") (:authors ("Matthew Carter" . "m@ahungry.com")) (:maintainer "Matthew Carter" . "m@ahungry.com") (:keywords "ahungry" "convenience" "fast" "scroll" "scrolling") (:url . "https://github.com/ahungry/fast-scroll"))]) + (fastdef . [(20160713 1329) ((ivy (0 7 0)) (w3m (0 0))) "Insert terminology from Google top search results" single ((:commit . "0696f41dc150d35ce31fe8d2ea74f4173818bb55") (:authors ("Chen Bin ")) (:maintainer "Chen Bin ") (:keywords "terminology" "org-mode" "markdown") (:url . "http://github.com/redguardtoo/fastdef"))]) + (fastnav . [(20120211 1457) nil "Fast navigation and editing routines." single ((:commit . "1019ba2b61d1a070204099b23da347278a61bc89") (:authors ("Zsolt Terek" . "zsolt@google.com")) (:maintainer "Zsolt Terek" . "zsolt@google.com") (:keywords "nav" "fast" "fastnav" "navigation"))]) + (faust-mode . [(20201004 1353) nil "Faust syntax colorizer for Emacs." single ((:commit . "2a56cda14b152d5471f21a5d82f23c141dc7134c") (:authors ("rukano" . "rukano@gmail.com")) (:maintainer "Yassin Philip" . "xaccrocheur@gmail.com") (:keywords "languages" "faust") (:url . "https://github.com/rukano/emacs-faust-mode"))]) + (faustine . [(20171122 1202) ((emacs (24 3)) (faust-mode (0 3))) "Edit, visualize, build and run Faust code" single ((:commit . "07a38963111518f86123802f9d477be0d4689a3f") (:authors ("Yassin Philip" . "xaccrocheur@gmail.com")) (:maintainer "Yassin Philip" . "xaccrocheur@gmail.com") (:keywords "languages" "faust") (:url . "https://bitbucket.org/yphil/faustine"))]) + (fb2-reader . [(20211214 954) ((emacs (26 2)) (f (0 17)) (s (1 11 0)) (dash (2 12 0)) (visual-fill-column (2 2)) (async (1 9 4))) "Read FB2 and FB2.ZIP documents" single ((:commit . "9dcc0801a7dd302ee0620781ea17868895d3f082") (:authors ("Dmitriy Pshonko" . "jumper047@gmail.com")) (:maintainer "Dmitriy Pshonko" . "jumper047@gmail.com") (:keywords "multimedia" "ebook" "fb2") (:url . "https://github.com/jumper047/fb2-reader"))]) + (fcitx . [(20190806 1923) nil "Make fcitx better in Emacs" single ((:commit . "12dc2638ddd15c8f6cfaecb20e1f428ab2bb5624") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions") (:url . "https://github.com/cute-jumper/fcitx.el"))]) + (fcopy . [(20150304 1403) nil "Funny Copy, set past point HERE then search copy text" single ((:commit . "e355f6ec889d8ecbdb096019c2dc660b1cec4941") (:authors ("Masayuki Ataka" . "masayuki.ataka@gmail.com")) (:maintainer "Masayuki Ataka" . "masayuki.ataka@gmail.com") (:keywords "convenience") (:url . "https://github.com/ataka/fcopy"))]) + (fd-dired . [(20210723 549) ((emacs (25))) "find-dired alternative using fd" single ((:commit . "458464771bb220b6eb87ccfd4c985c436e57dc7e") (:authors ("Rashawn Zhang" . "namy.19@gmail.com")) (:maintainer "Rashawn Zhang" . "namy.19@gmail.com") (:keywords "tools" "fd" "find" "dired") (:url . "https://github.com/yqrashawn/fd-dired"))]) + (feather . [(20200321 1237) ((emacs (26 3)) (async (1 9)) (async-await (1 0)) (ppp (1 0)) (page-break-lines (0 1))) "Parallel thread modern package manager" tar ((:commit . "3f19293dada8bf368e9f86f783610e7ca0a51ecb") (:authors ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "Naoya Yamashita" . "conao3@gmail.com") (:keywords "convenience" "package") (:url . "https://github.com/conao3/feather.el"))]) + (feature-mode . [(20220418 848) nil "Major mode for editing Gherkin (i.e. Cucumber) user stories" tar ((:commit . "e204d9e204b767cf95d6a051ff283f05dc51e9d3") (:authors ("Michael Klishin")) (:maintainer "Michael Klishin") (:url . "https://github.com/michaelklishin/cucumber.el"))]) + (feebleline . [(20190822 1401) nil "Replace modeline with a slimmer proxy" single ((:commit . "b2f2db25cac77817bf0c49ea2cea6383556faea0") (:authors ("Benjamin Lindqvist" . "benjamin.lindqvist@gmail.com")) (:maintainer "Benjamin Lindqvist" . "benjamin.lindqvist@gmail.com") (:url . "https://github.com/tautologyclub/feebleline"))]) + (feed-discovery . [(20200714 1118) ((emacs (25 1)) (dash (2 16 0))) "Discover feed url by RSS/Atom autodiscovery" single ((:commit . "12fcd1a28fe7c8c46c74e32f395ec631d45ec739") (:authors ("Hiroki YAMAKAWA" . "s06139@gmail.com")) (:maintainer "Hiroki YAMAKAWA" . "s06139@gmail.com") (:url . "https://github.com/HKey/feed-discovery"))]) + (fennel-mode . [(20220510 748) ((emacs (26 1))) "A major-mode for editing Fennel code" tar ((:commit . "0e9ed013a163d91993a2883ad5c37c02694c2b92") (:authors ("Phil Hagelberg")) (:maintainer "Phil Hagelberg") (:keywords "languages" "tools") (:url . "https://git.sr.ht/~technomancy/fennel-mode"))]) + (fetch . [(20131201 730) nil "Fetch and unpack resources" single ((:commit . "3f2793afcbbc32f320e572453166f9354ecc6d06") (:authors ("Christian 'crshd' Brassat" . "christian.brassat@gmail.com")) (:maintainer "Christian 'crshd' Brassat" . "christian.brassat@gmail.com") (:url . "https://github.com/crshd/fetch.el"))]) + (ffmpeg-player . [(20200720 1028) ((emacs (24 4)) (s (1 12 0)) (f (0 20 0))) "Play video using ffmpeg" single ((:commit . "d81983cf389dd5d2ec6cf9d702ff28ffd1be676b") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/ffmpeg-player"))]) + (fic-mode . [(20180603 2035) nil "Show FIXME/TODO/BUG(...) in special face only in comments and strings" single ((:commit . "a05fc36ed54ba0c6dc22ac216a6a72cf191ca13d") (:url . "https://github.com/lewang/fic-mode"))]) + (fifo-class . [(20160425 558) nil "First in first out abstract class" single ((:commit . "8fe4cf690727f4ac7b67f29c55f845df023c3f21") (:authors ("Mola-T" . "Mola@molamola.xyz")) (:maintainer "Mola-T" . "Mola@molamola.xyz") (:keywords "lisp") (:url . "https://github.com/mola-T/fifo-class"))]) + (figlet . [(20160218 2237) nil "Annoy people with big, ascii art text" single ((:commit . "19a38783a90e151faf047ff233a21a729db0cea9") (:authors ("Philip Jackson" . "phil@shellarchive.co.uk")) (:maintainer "Philip Jackson" . "phil@shellarchive.co.uk"))]) + (filelock . [(20180524 2215) ((emacs (24)) (cl-lib (0)) (f (0))) "Functions for manipulating file locks" single ((:commit . "17a5ca6e0dee14d2e7d92c84be91143bca9d9663") (:authors ("Ryan C. Thompson")) (:maintainer "Ryan C. Thompson") (:keywords "extensions" "files" "tools") (:url . "https://github.com/DarwinAwardWinner/emacs-filelock"))]) + (filetags . [(20190706 804) ((emacs (24 4))) "Package to manage filetags in filename" single ((:commit . "01e6a919507a832ee001a2a0fc257657f8b04b72") (:authors ("Max Beutelspacher")) (:maintainer "Max Beutelspacher") (:keywords "convenience" "files") (:url . "https://github.com/DerBeutlin/filetags.el"))]) + (filetree . [(20220312 1650) ((dash (2 12 0)) (helm (3 7 0)) (seq (2 23)) (transient (0 3 6))) "File tree view/manipulatation package" single ((:commit . "9125e5b7ebbb99b8c007018fcfd5034e7ac6630d") (:authors ("Ketan Patel" . "knpatel401@gmail.com")) (:maintainer "Ketan Patel" . "knpatel401@gmail.com") (:url . "https://github.com/knpatel401/filetree"))]) + (fill-column-indicator . [(20200806 2239) nil "Graphically indicate the fill column" single ((:commit . "c35f9de072c241699b57bcb46da84bed5af29cfe") (:authors ("Alp Aker" . "alp.tekin.aker@gmail.com")) (:maintainer "Alp Aker" . "alp.tekin.aker@gmail.com") (:keywords "convenience"))]) + (fill-function-arguments . [(20201223 819) ((emacs (24 4))) "Convert function arguments to/from single line" single ((:commit . "a0a2f8538c80ac08e497dea784fcb90c93ab465b") (:authors ("David Shepherd" . "davidshepherd7@gmail.com")) (:maintainer "David Shepherd" . "davidshepherd7@gmail.com") (:keywords "convenience") (:url . "https://github.com/davidshepherd7/fill-function-arguments"))]) + (fill-page . [(20210707 354) ((emacs (24 4))) "Fill buffer so you don't see empty lines at the end" single ((:commit . "02ab2b3854df5515245ca2a924f89bf830f9c4de") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/fill-page"))]) + (fillcode . [(20200524 2226) nil "Fill (wrap) function calls and expressions in source code" single ((:commit . "501468082e46bd0975ef4d8765363fd564338099") (:authors ("Ryan Barrett" . "fillcode@ryanb.org")) (:maintainer "Ryan Barrett" . "fillcode@ryanb.org") (:url . "https://snarfed.org/fillcode"))]) + (filldent . [(20220423 2216) ((emacs (24 1))) "Fill or indent" single ((:commit . "2f32e0cf5e27c613f962fa41bf3427bbdc04e6c0") (:authors ("Case Duckworth" . "acdw@acdw.net")) (:maintainer "Case Duckworth" . "acdw@acdw.net") (:url . "https://github.com/duckwork/filldent.el"))]) + (finalize . [(20170418 1945) ((emacs (24 1)) (cl-generic (0 3)) (cl-lib (0 3)) (eieio (1 4))) "finalizers for Emacs Lisp" tar ((:commit . "846731531e7d1d80451787992e07bfe7dedbe9ff") (:authors ("Christopher Wellons" . "wellons@nullprogram.com")) (:maintainer "Christopher Wellons" . "wellons@nullprogram.com") (:url . "https://github.com/skeeto/elisp-finalize"))]) + (find-by-pinyin-dired . [(20180210 218) ((pinyinlib (0 1 0))) "Find file by first PinYin character of Chinese Hanzi" single ((:commit . "3b4781148dddc84a701ad76c0934ed991ecd59d5") (:authors ("Chen Bin" . "chenbin.sh@gmail.com")) (:maintainer "Chen Bin" . "chenbin.sh@gmail.com") (:keywords "hanzi" "chinese" "dired" "find" "file" "pinyin") (:url . "http://github.com/redguardtoo/find-by-pinyin-dired"))]) + (find-dupes-dired . [(20210426 835) ((emacs (26 1))) "Find dupes and handle in dired" single ((:commit . "904225a3f89bbd3b44ea097a282ec6ca7945f7f1") (:authors ("Shuguang Sun" . "shuguang79@qq.com")) (:maintainer "Shuguang Sun" . "shuguang79@qq.com") (:keywords "tools") (:url . "https://github.com/ShuguangSun/find-dupes-dired"))]) + (find-file-in-project . [(20220430 107) ((emacs (25 1))) "Find file/directory and review Diff/Patch/Commit efficiently" single ((:commit . "116b976b526680c038109882d5cd2d9f218b62a5") (:authors ("Phil Hagelberg, Doug Alcorn, and Will Farrington")) (:maintainer "Chen Bin" . "chenbin.sh@gmail.com") (:keywords "project" "convenience") (:url . "https://github.com/redguardtoo/find-file-in-project"))]) + (find-file-in-repository . [(20210301 2202) nil "Quickly find files in a git, mercurial or other repository" single ((:commit . "10f5bd919ce35691addc5ce0d281597a46813a79") (:authors ("Samuel Hoffstaetter" . "samuel@hoffstaetter.com")) (:maintainer "Samuel Hoffstaetter" . "samuel@hoffstaetter.com") (:keywords "files" "convenience" "repository" "project" "source control") (:url . "https://github.com/hoffstaetter/find-file-in-repository"))]) + (find-file-rg . [(20220314 1540) ((emacs (25 1))) "Find file in project using ripgrep" single ((:commit . "404b1cc97c2f700d3dc1c66b640f96ed5a268dc3") (:authors ("Andrii Kolomoiets" . "andreyk.mad@gmail.com")) (:maintainer "Andrii Kolomoiets" . "andreyk.mad@gmail.com") (:keywords "tools") (:url . "https://github.com/muffinmad/emacs-find-file-rg"))]) + (find-temp-file . [(20200117 2254) nil "Open quickly a temporary file" single ((:commit . "2bfcdba0d6a8a0e6faa080cb04ff0f7ed06491ba") (:authors ("Sylvain Rousseau ")) (:maintainer "Sylvain Rousseau ") (:keywords "convenience") (:url . "https://github.com/thisirs/find-temp-file.git"))]) + (find-things-fast . [(20150519 2226) nil "Find things fast, leveraging the power of git" single ((:commit . "efc7c189019ed65430e2f9e910e8e0a5ca9d2d03") (:authors ("Elvio Toccalino and Elliot Glaysher and Phil Hagelberg and Doug Alcorn")) (:maintainer "Elvio Toccalino and Elliot Glaysher and Phil Hagelberg and Doug Alcorn") (:keywords "project" "convenience"))]) + (findr . [(20130127 2032) nil "Breadth-first file-finding facility for (X)Emacs" single ((:commit . "1ddbc0464bb05dcda392b62666ad17239a2152d3") (:authors ("David Bakhash" . "cadet@bu.edu")) (:maintainer "David Bakhash" . "cadet@bu.edu") (:keywords "files"))]) + (fingers . [(20160817 829) nil "Modal editing with universal text manipulation helpers." tar ((:commit . "fed0f742afb1d72eaef29d8da394467550a030fa") (:authors ("Felix Geller" . "fgeller@gmail.com")) (:maintainer "Felix Geller" . "fgeller@gmail.com") (:keywords "fingers" "modal" "editing" "workman") (:url . "http://github.com/fgeller/fingers.el"))]) + (finito . [(20220427 1932) ((emacs (27 1)) (dash (2 17 0)) (request (0 3 2)) (f (0 2 0)) (s (1 12 0)) (transient (0 3 0)) (graphql (0 1 1)) (async (1 9 3))) "View and collect books" tar ((:commit . "a0fe025086046aecf5490c993afe9e716324f7e5") (:authors ("Laurence Warne")) (:maintainer "Laurence Warne") (:keywords "outlines") (:url . "https://github.com/LaurenceWarne/finito.el"))]) + (fiplr . [(20140724 645) ((grizzl (0 1 0)) (cl-lib (0 1))) "Fuzzy Search for Files in Projects" tar ((:commit . "3f50159fd42125440d5b0eb9d6398560461f030b") (:authors ("Chris Corbyn" . "chris@w3style.co.uk")) (:maintainer "Chris Corbyn" . "chris@w3style.co.uk") (:keywords "convenience" "usability" "project") (:url . "https://github.com/d11wtq/fiplr"))]) + (fira-code-mode . [(20210702 1631) ((emacs (24 4))) "Minor mode for Fira Code ligatures using prettify-symbols" single ((:commit . "eaff81f867d9c84e25891368f3d0cac7513984e8") (:authors ("Jonathan Ming" . "jming422@gmail.com")) (:maintainer "Jonathan Ming" . "jming422@gmail.com") (:keywords "faces" "ligatures" "fonts" "programming-ligatures") (:url . "https://github.com/jming422/fira-code-mode"))]) + (firecode-theme . [(20170808 1311) ((emacs (24 0))) "an Emacs 24 theme based on FireCode (tmTheme)" single ((:commit . "8b7b03ecdd41e70dab145b98906017e1392eaef4") (:authors ("Jason Milkins")) (:maintainer "Jason Milkins") (:url . "https://github.com/emacsfodder/tmtheme-to-deftheme"))]) + (fireplace . [(20200402 2206) nil "A cozy fireplace for emacs" single ((:commit . "f6c23e259349922aae25cf2898ba815a7d8f2527") (:authors ("Johan Sivertsen" . "johanvts@gmail.com")) (:maintainer "Johan Sivertsen" . "johanvts@gmail.com") (:keywords "games") (:url . "https://github.com/johanvts/emacs-fireplace"))]) + (firestarter . [(20210508 1626) ((emacs (24 1))) "Execute (shell) commands on save" single ((:commit . "76070c9074aa363350abe6ad06143e90b3e12ab1") (:authors ("Vasilij Schneidermann" . "mail@vasilij.de")) (:maintainer "Vasilij Schneidermann" . "mail@vasilij.de") (:keywords "convenience") (:url . "https://depp.brause.cc/firestarter"))]) + (firrtl-mode . [(20200329 2002) ((emacs (24 3))) "mode for working with FIRRTL files" single ((:commit . "fa40141411a876ce7a1a9d6d3fe47134bc1fa954") (:authors ("Schuyler Eldridge" . "schuyler.eldridge@ibm.com")) (:maintainer "Schuyler Eldridge" . "schuyler.eldridge@ibm.com") (:keywords "languages" "firrtl") (:url . "https://github.com/ibm/firrtl-mode"))]) + (fish-completion . [(20191103 1210) ((emacs (25 1))) "Fish completion for pcomplete (shell and Eshell)" single ((:commit . "10384881817b5ae38cf6197a077a663420090d2c") (:authors ("Pierre Neidhardt" . "mail@ambrevar.xyz")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:url . "https://gitlab.com/Ambrevar/emacs-fish-completion"))]) + (fish-mode . [(20220505 1111) ((emacs (24))) "Major mode for fish shell scripts" single ((:commit . "d04478c0aba018cb789d77d591bfe315cb25132a") (:authors ("Tony Wang" . "wwwjfy@gmail.com")) (:maintainer "Tony Wang" . "wwwjfy@gmail.com") (:keywords "fish" "shell"))]) + (fit-text-scale . [(20211230 2002) ((emacs (25 1))) "Fit text by scaling" single ((:commit . "c53c8ce606380088643463848a9ee3502b0c64f4") (:authors ("Marco Wahl" . "marcowahlsoft@gmail.com")) (:maintainer "Marco Wahl" . "marcowahlsoft@gmail.com") (:keywords "convenience") (:url . "https://gitlab.com/marcowahl/fit-text-scale"))]) + (fix-input . [(20210320 1244) ((emacs (24 4))) "Make input methods play nicely with alternative keyboard layout on OS level" single ((:commit . "b611a8b269d28d226ed1e78fcc7a3120df20f74c") (:authors ("Mark Karpov" . "markkarpov92@gmail.com")) (:maintainer "Mark Karpov" . "markkarpov92@gmail.com") (:keywords "input" "method") (:url . "https://github.com/mrkkrp/fix-input"))]) + (fix-muscle-memory . [(20210702 1755) nil "Simple hacks to fix muscle memory problems" single ((:commit . "b8d4b8025d758762f4459c70c3a7a209ead865ed") (:authors ("Jonathan Arkell" . "jonnay@jonnay.net")) (:maintainer "Jonathan Arkell" . "jonnay@jonnay.net") (:keywords "spelling" "typing"))]) + (fix-word . [(20210319 1414) ((emacs (24 1)) (cl-lib (0 5))) "Convenient word transformation" single ((:commit . "e967dd4ac98d777deeede8b497d6337634c06df4") (:authors ("Mark Karpov" . "markkarpov92@gmail.com")) (:maintainer "Mark Karpov" . "markkarpov92@gmail.com") (:keywords "word" "convenience") (:url . "https://github.com/mrkkrp/fix-word"))]) + (fixmee . [(20150223 1355) ((button-lock (1 0 2)) (nav-flash (1 0 0)) (back-button (0 6 0)) (smartrep (0 0 3)) (string-utils (0 3 2)) (tabulated-list (0))) "Quickly navigate to FIXME notices in code" single ((:commit . "5cddb64e0d52635e9a1529d80cb5cefa6f829341") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "navigation" "convenience") (:url . "http://github.com/rolandwalker/fixmee"))]) + (flame . [(20180303 2016) ((emacs (24))) "automatic generation of flamage, as if we needed more." single ((:commit . "a749b2a77b87e505572d0f1f5d59fac76348bb73") (:authors ("Ian G. Batten" . "batten@uk.ac.bham.multics") ("Noah Friedman" . "friedman@splode.com")) (:maintainer "Noah Friedman" . "friedman@splode.com") (:keywords "games") (:url . "https://github.com/mschuldt/flame"))]) + (flames-of-freedom . [(20191202 1637) ((emacs (25 1))) "The flames of freedom" single ((:commit . "5e47ff27cfa2f7c06081be2ffefe91a731efd012") (:authors ("Stéphane Champailler" . "schampailler@skynet.be")) (:maintainer "Stéphane Champailler" . "schampailler@skynet.be") (:keywords "multimedia") (:url . "https://github.com/wiz21b/FlamesOfFreedom"))]) + (flappymacs . [(20171023 1004) nil "flappybird clone for emacs" single ((:commit . "27f3e21acb22f786606481e3f4e5dc1edbaaaed4") (:authors ("Takayuki Sato")) (:maintainer "Takayuki Sato") (:keywords "games") (:url . "https://github.com/taksatou/flappymacs"))]) + (flash-region . [(20130923 1817) nil "Flash a region" single ((:commit . "261b3597b23cdd40e5c14262a5687bcc6c1d0901") (:authors ("Matus Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matus Goljer" . "matus.goljer@gmail.com") (:keywords "utility"))]) + (flatbuffers-mode . [(20210710 1004) ((emacs (24 3))) "Major mode for editing flatbuffers" single ((:commit . "8e7783db45a64c9456130fd0c108ac12d45a7789") (:authors ("Asal Mirzaieva" . "asalle.kim@gmail.com")) (:maintainer "Asal Mirzaieva" . "asalle.kim@gmail.com") (:keywords "flatbuffers" "languages") (:url . "https://github.com/Asalle/flatbuffers-mode"))]) + (flatfluc-theme . [(20210908 1423) ((emacs (26 1))) "Custom merge of flucui and flatui themes" single ((:commit . "33726cd072ad83c6943e1c3b83db2fff60f324ce") (:authors ("Sébastien Le Maguer" . "lemagues@tcd.ie")) (:maintainer "Sébastien Le Maguer" . "lemagues@tcd.ie") (:keywords "lisp") (:url . "https://github.com/seblemaguer/flatfluc-theme"))]) + (flatland-black-theme . [(20170808 1312) ((emacs (24 0))) "an Emacs 24 theme based on Flatland Black (tmTheme)" single ((:commit . "348c5d5fe615e6ea13cadc17f046e506e789ce07") (:authors ("Jason Milkins")) (:maintainer "Jason Milkins") (:url . "https://github.com/emacsfodder/flatland-black-theme"))]) + (flatland-theme . [(20171113 1521) nil "A simple theme for Emacs based on the Flatland theme for Sublime Text" single ((:commit . "a98a6f19ad4dff0fa3fad1ea487b7d0ef634a19a") (:authors ("Greg Chapple" . "info@gregchapple.com")) (:maintainer "Greg Chapple" . "info@gregchapple.com") (:url . "http://github.com/gregchapple/flatland-emacs"))]) + (flatui-dark-theme . [(20170513 1422) ((emacs (24))) "Dark color theme with colors from https://flatuicolors.com/" single ((:commit . "5b959a9f743f891e4660b1b432086417947872ea") (:authors ("Andrew Phillips" . "theasp@gmail.com")) (:maintainer "Andrew Phillips" . "theasp@gmail.com") (:keywords "color" "theme" "dark" "flatui" "faces") (:url . "https://github.com/theasp/flatui-dark-theme"))]) + (flatui-theme . [(20160619 127) nil "A color theme for Emacs based on flatuicolors.com" single ((:commit . "9c15db5526c15c8dba55023f5698372b19c2a780") (:authors ("John Louis Del Rosario" . "john2x@gmail.com")) (:maintainer "John Louis Del Rosario" . "john2x@gmail.com") (:url . "https://github.com/john2x/flatui-theme.el"))]) + (flex-autopair . [(20120809 1218) nil "Automatically insert pair braces and quotes, insertion conditions & actions are highly customizable." single ((:commit . "4bb757f2556a4a51828e2fed8fb81e31e83052cb") (:authors ("Yuuki Arisawa" . "yuuki.ari@gmail.com")) (:maintainer "Yuuki Arisawa" . "yuuki.ari@gmail.com") (:keywords "keyboard" "input") (:url . "https://github.com/uk-ar/flex-autopair.el"))]) + (flex-compile . [(20220205 205) ((emacs (26 1)) (dash (2 17 0)) (buffer-manage (1 1))) "Run, evaluate and compile across many languages" tar ((:commit . "2da0e5e791896810747c710276ff3a1d0465d843") (:authors ("Paul Landes")) (:maintainer "Paul Landes") (:keywords "compilation" "integration" "processes") (:url . "https://github.com/plandes/flex-compile"))]) + (flex-isearch . [(20170308 2010) nil "Flex matching (like ido) in isearch." single ((:commit . "b1f7e04de762282c276343cc2709af9ff4abc9d2") (:authors ("Jonathan Kotta" . "jpkotta@gmail.com")) (:maintainer "Jonathan Kotta" . "jpkotta@gmail.com") (:keywords "convenience" "search") (:url . "https://bitbucket.org/jpkotta/flex-isearch"))]) + (flim . [(20220503 1442) ((emacs (24 5)) (apel (10 8)) (oauth2 (0 11))) "A library to provide basic features about message representation or encoding." tar ((:commit . "289e5bbd66f6f14306a6e0b922ee8f26267e2470"))]) + (flimenu . [(20200810 1510) ((emacs (24 4))) "Flatten imenu automatically" single ((:commit . "4c0ff37cf3bd6c836bd136b5f6c450560a6c92b9") (:authors ("Ivan Malison" . "IvanMalison@gmail.com")) (:maintainer "Ivan Malison" . "IvanMalison@gmail.com") (:keywords "imenu" "browse" "structure" "hook" "mode" "matching" "tools" "convenience" "files") (:url . "https://github.com/IvanMalison/flimenu"))]) + (fliptext . [(20171124 2056) nil "Input method for flipping characters upside down" single ((:commit . "fd821f645ffebae6ae3894afa7ba7fc06f91afc6") (:authors ("André Riemann" . "andre.riemann@web.de")) (:maintainer "André Riemann" . "andre.riemann@web.de") (:keywords "games" "i18n"))]) + (floobits . [(20211018 550) ((json (1 2)) (highlight (0))) "Floobits plugin for real-time collaborative editing" tar ((:commit . "93b3317fb6c842efe165e54c8a32bf51d436837d") (:authors ("Matt Kaniaris") ("Geoff Greer")) (:maintainer "Matt Kaniaris") (:keywords "comm" "tools") (:url . "http://github.com/Floobits/floobits-emacs"))]) + (flow-js2-mode . [(20191213 1004) ((flow-minor-mode (0)) (js2-mode (0)) (emacs (25 1))) "Support for flow annotations in js2-mode" single ((:commit . "7520bdda70287e8d57b3f41033b1e0ca59a3be95") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "languages" "extensions"))]) + (flow-minor-mode . [(20200905 1730) ((emacs (25 1))) "Flow type mode based on web-mode." single ((:commit . "804217a15a28f6918fba93c91d495ed7d50b0495") (:url . "https://github.com/an-sh/flow-minor-mode"))]) + (flower . [(20220416 1744) ((emacs (24 4)) (clomacs (0 0 4))) "Emacs task tracker client." tar ((:commit . "047846409867b2dd0ba4e2047a414b498680cd9c") (:authors ("Sergey Sobko" . "flower@tpg.am")) (:maintainer "Sergey Sobko" . "flower@tpg.am") (:keywords "hypermedia" "outlines" "tools" "vc") (:url . "https://github.com/FlowerAutomation/flower"))]) + (flucui-themes . [(20200815 2103) ((emacs (24))) "Custom theme inspired by the Flat UI palette" tar ((:commit . "6591b5093e6e8f0e720e3995a16a91835b2e7a48") (:authors ("MetroWind" . "chris.corsair@gmail.com")) (:maintainer "MetroWind" . "chris.corsair@gmail.com") (:keywords "lisp") (:url . "https://github.com/MetroWind/flucui-theme"))]) + (flutter . [(20220502 50) ((emacs (25 1))) "Tools for working with Flutter SDK" tar ((:commit . "e49cbcb70235fa39a7d243521e03ad874451a39a") (:authors ("Aaron Madlon-Kay")) (:maintainer "Aaron Madlon-Kay") (:keywords "languages") (:url . "https://github.com/amake/flutter.el"))]) + (flutter-l10n-flycheck . [(20220502 50) ((emacs (25 1)) (flycheck (30)) (flutter (0 1 0))) "Flycheck checker for intl_translation" single ((:commit . "e49cbcb70235fa39a7d243521e03ad874451a39a") (:authors ("Aaron Madlon-Kay")) (:maintainer "Aaron Madlon-Kay") (:keywords "languages") (:url . "https://github.com/amake/flutter.el"))]) + (fluxus-mode . [(20210715 58) ((osc (0 1)) (emacs (24 4))) "Major mode for interfacing with Fluxus" single ((:commit . "a14578640c578a4fd09cb7e25da1e87d637719ae") (:authors ("modula t." . "defaultxr@gmail.com")) (:maintainer "modula t." . "defaultxr@gmail.com") (:keywords "languages") (:url . "https://github.com/defaultxr/fluxus-mode"))]) + (flx . [(20211101 146) ((cl-lib (0 3))) "fuzzy matching with good sorting" single ((:commit . "e3b3f0533e44c5250ce73d728b59a7e96c692b5d") (:authors ("Le Wang")) (:maintainer "Le Wang") (:url . "https://github.com/lewang/flx"))]) + (flx-ido . [(20180117 1519) ((flx (0 1)) (cl-lib (0 3))) "flx integration for ido" single ((:commit . "e3b3f0533e44c5250ce73d728b59a7e96c692b5d") (:authors ("Le Wang")) (:maintainer "Le Wang") (:url . "https://github.com/lewang/flx"))]) + (flx-isearch . [(20191119 515) ((emacs (24)) (flx (20140821)) (cl-lib (0 5))) "Fuzzy incremental searching for emacs" single ((:commit . "a44097fb8f539a193c2f09a37ea52a68f2c51839") (:authors ("PythonNut" . "pythonnut@pythonnut.com")) (:maintainer "PythonNut" . "pythonnut@pythonnut.com") (:keywords "convenience" "search" "flx") (:url . "https://github.com/pythonnut/flx-isearch"))]) + (flycheck . [(20220504 830) ((dash (2 12 1)) (pkg-info (0 4)) (let-alist (1 0 4)) (seq (1 11)) (emacs (24 3))) "On-the-fly syntax checking" tar ((:commit . "1d7c1b20782ccbaa6f97e37f5e1d0cee3d5eda8a") (:authors ("Sebastian Wiesner" . "swiesner@lunaryorn.com")) (:maintainer "Clément Pit-Claudel" . "clement.pitclaudel@live.com") (:keywords "convenience" "languages" "tools") (:url . "http://www.flycheck.org"))]) + (flycheck-ameba . [(20191226 1011) ((emacs (24 4)) (flycheck (30))) "Add support for Ameba to Flycheck" single ((:commit . "0c4925ae0e998818326adcb47ed27ddf9761c7dc") (:keywords "tools" "crystal" "ameba") (:url . "https://github.com/crystal-ameba/ameba.el"))]) + (flycheck-apertium . [(20181211 1038) ((flycheck (0 25))) "Apertium checkers in flycheck" tar ((:commit . "22b60a17836477ac1edd15dc85b14f88ca871ba9") (:authors ("Kevin Brubeck Unhammer" . "unhammer+apertium@mm.st")) (:maintainer "Kevin Brubeck Unhammer" . "unhammer+apertium@mm.st") (:keywords "convenience" "tools" "xml") (:url . "http://wiki.apertium.org/wiki/Emacs"))]) + (flycheck-aspell . [(20220411 826) ((flycheck (28 0)) (emacs (25 1))) "Aspell checker for flycheck" single ((:commit . "dcf7e6543e4d94d58375e00e4a10db615ef06941") (:authors ("Leo Gaskin" . "leo.gaskin@le0.gs")) (:maintainer "Leo Gaskin" . "leo.gaskin@le0.gs") (:keywords "wp" "flycheck" "spell" "aspell") (:url . "https://github.com/leotaku/flycheck-aspell"))]) + (flycheck-ats2 . [(20170225 1636) ((emacs (24 1)) (flycheck (0 22))) "Flycheck: ATS2 support" single ((:commit . "9f77add8408462af35bdddf87e37a661880255e3") (:authors ("Mark Laws" . "mdl@60hz.org")) (:maintainer "Mark Laws" . "mdl@60hz.org") (:keywords "convenience" "tools" "languages") (:url . "http://github.com/drvink/flycheck-ats2"))]) + (flycheck-bashate . [(20200625 642) ((flycheck (0 24)) (emacs (24 4))) "Integrate bashate with flycheck" single ((:commit . "5e673c591d017329d0a07a61dc1223fa98639ee2") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/flycheck-bashate"))]) + (flycheck-cask . [(20200926 1502) ((emacs (24 3)) (flycheck (0 14)) (dash (2 4 0))) "Cask support in Flycheck" single ((:commit . "4b2ede6362ded4a45678dfbef1876faa42edbd58") (:authors ("Sebastian Wiesner" . "swiesner@lunaryorn.com")) (:maintainer "Sebastian Wiesner" . "swiesner@lunaryorn.com") (:keywords "tools" "convenience") (:url . "https://github.com/flycheck/flycheck-cask"))]) + (flycheck-cfn . [(20220221 1029) ((emacs (26 1)) (flycheck (31))) "Flycheck backend for AWS cloudformation" single ((:commit . "4cf56affe3035fda364109836e26499431095185") (:authors ("William Orr" . "will@worrbase.com")) (:maintainer "William Orr" . "will@worrbase.com") (:keywords "convenience") (:url . "https://gitlab.com/worr/cfn-mode"))]) + (flycheck-checkbashisms . [(20190403 218) ((emacs (24)) (flycheck (0 25))) "checkbashisms checker for flycheck" single ((:commit . "53598158fa8b74d2e7efea6210edb274e1f0273c") (:authors ("Cuong Le" . "cuong.manhle.vn@gmail.com")) (:maintainer "Cuong Le" . "cuong.manhle.vn@gmail.com") (:keywords "convenience" "tools" "sh" "unix") (:url . "https://github.com/cuonglm/flycheck-checkbashisms"))]) + (flycheck-checkpatch . [(20170217 1025) ((emacs (25)) (flycheck (30))) "Flycheck support for checkpatch.pl tool" single ((:commit . "6461fc7b0d493eb9863814055f8bce5fa35739de") (:authors ("Alexander Yarygin" . "yarygin.alexander@gmail.com")) (:maintainer "Alexander Yarygin" . "yarygin.alexander@gmail.com") (:url . "https://github.com/zpp0/flycheck-checkpatch"))]) + (flycheck-clang-analyzer . [(20211214 648) ((flycheck (0 24)) (emacs (24 4))) "Integrate Clang Analyzer with flycheck" single ((:commit . "646d9f3a80046ab231a07526778695d5decad92d") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/flycheck-clang-analyzer"))]) + (flycheck-clang-tidy . [(20201115 1232) ((flycheck (0 30))) "Flycheck syntax checker using clang-tidy" single ((:commit . "f9ae7306bd6ca08b689b36c1e8f6f6b91d61db5f") (:authors (nil . "Sebastian Nagel")) (:maintainer "tastytea" . "tastytea@tastytea.de") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/ch1bo/flycheck-clang-tidy"))]) + (flycheck-clangcheck . [(20150712 710) ((cl-lib (0 5)) (seq (1 7)) (flycheck (0 17))) "A Flycheck checker difinition for ClangCheck." single ((:commit . "24a9424c484420073a24443a829fd5779752362b") (:authors ("kumar8600" . "kumar8600@gmail.com")) (:maintainer "kumar8600" . "kumar8600@gmail.com") (:url . "https://github.com/kumar8600/flycheck-clangcheck"))]) + (flycheck-clj-kondo . [(20211227 2226) ((emacs (24 3)) (flycheck (0 18))) "Add clj-kondo linter to flycheck" single ((:commit . "35daaccc75b0367844b249a8cb05bf73bcebd52a") (:authors ("Michiel Borkent" . "michielborkent@gmail.com")) (:maintainer "Michiel Borkent" . "michielborkent@gmail.com") (:url . "https://github.com/borkdude/flycheck-clj-kondo"))]) + (flycheck-clojure . [(20191215 2227) ((cider (0 22 0)) (flycheck (32 -4)) (let-alist (1 0 1)) (emacs (25))) "Flycheck: Clojure support" single ((:commit . "592c4f89efb5112784cbf94c9ea6fdd045771b62") (:authors ("Peter Fraenkel" . "pnf@podsnap.com") ("Sebastian Wiesner" . "swiesner@lunaryorn.com")) (:maintainer "Peter Fraenkel" . "pnf@podsnap.com") (:url . "https://github.com/clojure-emacs/squiggly-clojure"))]) + (flycheck-clolyze . [(20190422 2134) ((flycheck (0 25)) (emacs (24))) "Add Clolyze to to flycheck" single ((:commit . "c8b27602dd505aeae6486feb6f584754079baf51") (:authors ("Daniel Laps" . "daniel.laps@hhu.de")) (:maintainer "Daniel Laps" . "daniel.laps@hhu.de") (:url . "https://github.com/DLaps/flycheck-clolyze"))]) + (flycheck-color-mode-line . [(20200528 416) ((flycheck (0 15)) (dash (1 2)) (emacs (24 3))) "Change mode line color with Flycheck status" single ((:commit . "575b604cfe21f65fb07c134392c382c163c87739") (:authors ("Sylvain Benner" . "sylvain.benner@gmail.com")) (:maintainer "Sylvain Benner" . "sylvain.benner@gmail.com") (:keywords "convenience" "language" "tools") (:url . "https://github.com/flycheck/flycheck-color-mode-line"))]) + (flycheck-coverity . [(20170704 59) ((flycheck (0 24)) (dash (2 12 0)) (emacs (24 4))) "Integrate Coverity with flycheck" single ((:commit . "cb211e3dd50413a5042eb20175be518214591c9d") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/flycheck-coverity"))]) + (flycheck-credo . [(20170526 1545) ((flycheck (29))) "flycheck checker for elixir credo" single ((:commit . "e88f11ead53805c361ec7706e44c3dfee1daa19f") (:authors ("Aaron Jensen" . "aaronjensen@gmail.com")) (:maintainer "Aaron Jensen" . "aaronjensen@gmail.com") (:url . "https://github.com/aaronjensen/flycheck-credo"))]) + (flycheck-crystal . [(20200805 2344) ((flycheck (30))) "Add support for Crystal to Flycheck" single ((:commit . "96a8058205b24b513d0b9307db32f05e30f9570b") (:keywords "tools" "crystal") (:url . "https://github.com/crystal-lang-tools/emacs-crystal-mode"))]) + (flycheck-css-colorguard . [(20161031 1122) ((flycheck (0 22)) (emacs (24))) "Detect similar colors in CSS" single ((:commit . "ae94fa0396acd99f9ec36d9572459df793f37fe8") (:authors ("Saša Jovanić" . "info@simplify.ba")) (:maintainer "Saša Jovanić" . "info@simplify.ba") (:keywords "flycheck" "css" "colorguard") (:url . "https://github.com/Simplify/flycheck-css-colorguard/"))]) + (flycheck-cstyle . [(20160905 2341) ((flycheck (0 24)) (emacs (24 4))) "Integrate cstyle with flycheck" single ((:commit . "207285140a353d08cf1fc450cacab158bc98ba82") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/flycheck-cstyle"))]) + (flycheck-cython . [(20170724 958) ((flycheck (0 25))) "Support Cython in flycheck" single ((:commit . "ecc4454d35ab5317ab66a04406f36f0c1dbc0b76") (:authors ("Lorenzo Bolla" . "lbolla@gmail.com")) (:maintainer "Lorenzo Bolla" . "lbolla@gmail.com"))]) + (flycheck-d-unittest . [(20160522 417) ((flycheck (0 21 -4 1)) (dash (1 4 0))) "Add D unittest support to flycheck" single ((:commit . "3e614f23cb4a5566fd7988dbcaaf254af81c7718") (:authors ("Tomoya Tanjo" . "ttanjo@gmail.com")) (:maintainer "Tomoya Tanjo" . "ttanjo@gmail.com") (:keywords "flycheck" "d") (:url . "https://github.com/tom-tan/flycheck-d-unittest/"))]) + (flycheck-dedukti . [(20171103 1212) ((flycheck (0 19)) (dedukti-mode (0 1))) "Flycheck integration of Dedukti" single ((:commit . "3dbff5646355f39d57a3ec514f560a6b0082a1cd") (:authors ("Raphaël Cauderlier")) (:maintainer "Raphaël Cauderlier") (:keywords "convenience" "languages" "tools" "flycheck" "dedukti") (:url . "https://github.com/rafoo/flycheck-dedukti"))]) + (flycheck-dialyxir . [(20170515 1525) ((flycheck (29))) "flycheck checker for elixir dialyxir" single ((:commit . "adfb73374cb2bee75724822972f405f2ec371199") (:authors ("Aaron Jensen" . "aaronjensen@gmail.com")) (:maintainer "Aaron Jensen" . "aaronjensen@gmail.com") (:url . "https://github.com/aaronjensen/flycheck-dialyxir"))]) + (flycheck-dialyzer . [(20160326 1430) ((flycheck (0 18))) "Support dialyzer in flycheck" single ((:commit . "a5df0db95ac69f397b5f85d325a6d88cf8974f64") (:authors ("Lorenzo Bolla" . "lbolla@gmail.com")) (:maintainer "Lorenzo Bolla" . "lbolla@gmail.com"))]) + (flycheck-dmd-dub . [(20210412 1608) ((flycheck (0 24)) (f (0 18 2))) "Sets flycheck-dmd-include-paths from dub package information" single ((:commit . "818bfed45ac8597b6ad568c71eb9428138a125c8") (:authors ("Atila Neves" . "atila.neves@gmail.com")) (:maintainer "Atila Neves" . "atila.neves@gmail.com") (:keywords "languages") (:url . "http://github.com/atilaneves/flycheck-dmd-dub"))]) + (flycheck-dogma . [(20170125 721) ((flycheck (29))) "flycheck checker for elixir dogma" single ((:commit . "eea1844a81e87e2488b05e703a93272d0fc3bc74") (:authors ("Aaron Jensen" . "aaronjensen@gmail.com")) (:maintainer "Aaron Jensen" . "aaronjensen@gmail.com") (:url . "https://github.com/aaronjensen/flycheck-dogma"))]) + (flycheck-drstring . [(20200210 1903) ((emacs (25 1)) (flycheck (0 25)) (swift-mode (8 0))) "Doc linting for Swift using DrString" single ((:commit . "d8d5a560e792a6657ef5ac69934c74f1ed51372d") (:authors ("Daniel Martín" . "mardani29@yahoo.es")) (:maintainer "Daniel Martín" . "mardani29@yahoo.es") (:keywords "tools" "flycheck") (:url . "https://github.com/danielmartin/flycheck-drstring"))]) + (flycheck-dtrace . [(20180903 1630) ((emacs (25 1)) (flycheck (0 22))) "Flycheck: DTrace support" single ((:commit . "951fab3a15c11d92b9fac1ea4791a80dfe034a00") (:authors ("Jürgen Hötzel" . "juergen@hoetzel.info")) (:maintainer "Jürgen Hötzel" . "juergen@hoetzel.info") (:keywords "languages" "convenience" "tools"))]) + (flycheck-eldev . [(20210305 2231) ((flycheck (32)) (dash (2 17)) (emacs (24 4))) "Eldev support in Flycheck" single ((:commit . "2ed17db874da51fba3d2991a1e05cf375fca9619") (:authors ("Paul Pogonyshev" . "pogonyshev@gmail.com")) (:maintainer "Paul Pogonyshev" . "pogonyshev@gmail.com") (:keywords "tools" "convenience") (:url . "https://github.com/flycheck/flycheck-eldev"))]) + (flycheck-elixir . [(20210413 612) ((flycheck (0 25))) "Support Elixir in flycheck" single ((:commit . "b57a77a21d6cf9621b3387831cba34135c4fa35d") (:authors ("Lorenzo Bolla" . "lbolla@gmail.com")) (:maintainer "Lorenzo Bolla" . "lbolla@gmail.com"))]) + (flycheck-elm . [(20181107 146) ((flycheck (0 29 -4)) (emacs (24 4)) (let-alist (1 0 5)) (seq (2 20))) "Flycheck support for the elm language" single ((:commit . "1b60050efd4729bfba548f3e5adbcb58436667cb") (:authors ("Brian Sermons")) (:maintainer "Brian Sermons") (:url . "https://github.com/bsermons/flycheck-elm"))]) + (flycheck-elsa . [(20200203 1758) ((emacs (25)) (seq (2 0))) "Flycheck for Elsa." tar ((:commit . "911ffb3498e411c538eebce20c6b20b39d725af6") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "convenience") (:url . "https://github.com/emacs-elsa/flycheck-elsa"))]) + (flycheck-flawfinder . [(20211214 647) ((flycheck (0 24)) (emacs (24 4))) "Integrate flawfinder with flycheck" single ((:commit . "85701b849ea1ed8438ed4b7ae236e99d0f5528c7") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/flycheck-flawfinder"))]) + (flycheck-flow . [(20190304 1459) ((flycheck (0 18)) (json (1 4))) "Support Flow in flycheck" single ((:commit . "9e8e52cfc98af6a23fd906f9cb5d5d470d8cf82d") (:authors ("Lorenzo Bolla" . "lbolla@gmail.com")) (:maintainer "Lorenzo Bolla" . "lbolla@gmail.com"))]) + (flycheck-ghcmod . [(20150114 632) ((flycheck (0 21 -4 1)) (dash (2 0))) "A flycheck checker for Haskell using ghcmod" single ((:commit . "6bb7b7d879f05bbae54e99eb04806c877adf3ccc") (:authors ("Shen Chao" . "scturtle@gmail.com")) (:maintainer "Shen Chao" . "scturtle@gmail.com") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/scturtle/flycheck-ghcmod"))]) + (flycheck-golangci-lint . [(20190330 1412) ((emacs (24)) (flycheck (0 22))) "Flycheck checker for golangci-lint" single ((:commit . "8e446c68311048f0b87febf8ef0379e29d358851") (:authors ("Wei Jian Gan" . "weijiangan@outlook.com")) (:maintainer "Wei Jian Gan" . "weijiangan@outlook.com") (:keywords "convenience" "tools" "go") (:url . "https://github.com/weijiangan/flycheck-golangci-lint"))]) + (flycheck-gometalinter . [(20180424 941) ((emacs (24)) (flycheck (0 22))) "flycheck checker for gometalinter" single ((:commit . "1e3eede14da405b914a7d8b00300846e4393cb83") (:authors ("Diep Pham" . "me@favadi.com")) (:maintainer "Diep Pham" . "me@favadi.com") (:keywords "convenience" "tools" "go") (:url . "https://github.com/favadi/flycheck-gometalinter"))]) + (flycheck-google-cpplint . [(20210210 300) ((flycheck (0 20 -4 1))) "Help to comply with the Google C++ Style Guide" single ((:commit . "c52ba814f299f62a2a339bae679f3d6d04566854") (:authors ("Akiha Senda" . "senda.akiha@gmail.com")) (:maintainer "Jen-Chieh Shen" . "jcs090218@gmail.com") (:keywords "flycheck" "c" "c++") (:url . "https://github.com/flycheck/flycheck-google-cpplint/"))]) + (flycheck-gradle . [(20190315 234) ((emacs (25 1)) (flycheck (0 25))) "Flycheck extension for Gradle." single ((:commit . "1ca08bbc343362a923cbdc2010f66e41655e92ab") (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "languages" "gradle") (:url . "https://github.com/jojojames/flycheck-gradle"))]) + (flycheck-grammalecte . [(20210705 1656) ((emacs (26 1)) (flycheck (26))) "Integrate Grammalecte with Flycheck" tar ((:commit . "59b37e09923290da1c8458e507da43f403f555d2") (:authors ("Guilhem Doulcier" . "guilhem.doulcier@espci.fr") ("Étienne Deparis" . "etienne@depar.is")) (:maintainer "Étienne Deparis" . "etienne@depar.is") (:keywords "i18n" "text") (:url . "https://git.umaneti.net/flycheck-grammalecte/"))]) + (flycheck-grammarly . [(20220228 731) ((emacs (25 1)) (flycheck (0 14)) (grammarly (0 3 0)) (s (1 12 0))) "Grammarly support for Flycheck" single ((:commit . "abc66e71d542f65a90c394058cdd3a7b2002c6a6") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/emacs-grammarly/flycheck-grammarly"))]) + (flycheck-guile . [(20201202 509) ((emacs (24 1)) (flycheck (0 22)) (geiser (0 11))) "A Flycheck checker for GNU Guile" single ((:commit . "e46d6e5453dd7471309fae6549445c48e6d8f340") (:authors ("Ricardo Wurmus" . "rekado@elephly.net")) (:maintainer "Andrew Whatson" . "whatson@gmail.com") (:url . "https://github.com/flatwhatson/flycheck-guile"))]) + (flycheck-haskell . [(20220426 2358) ((emacs (24 3)) (flycheck (0 25)) (haskell-mode (13 7)) (dash (2 4 0)) (seq (1 11)) (let-alist (1 0 1))) "Flycheck: Automatic Haskell configuration" tar ((:commit . "d92dea78fb8638f7c27a3eb925d84c669fb257dd") (:authors ("Sebastian Wiesner" . "swiesner@lunaryorn.com")) (:maintainer "Sebastian Wiesner" . "swiesner@lunaryorn.com") (:keywords "tools" "convenience") (:url . "https://github.com/flycheck/flycheck-haskell"))]) + (flycheck-hdevtools . [(20160926 702) ((flycheck (0 21 -4 1)) (dash (2 0))) "A flycheck checker for Haskell using hdevtools" single ((:commit . "8248ebaf8376ee5e37ff47c814a291550a7bdcf2") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/flycheck/flycheck-hdevtools"))]) + (flycheck-hledger . [(20220323 726) ((emacs (27 1)) (flycheck (31))) "Flycheck module to check hledger journals" single ((:commit . "87b275b9b3d476b5f458e85e760f3f7fa3e66775") (:authors ("Damien Cassou" . "damien@cassou.me")) (:maintainer "Damien Cassou" . "damien@cassou.me") (:url . "https://github.com/DamienCassou/flycheck-hledger/"))]) + (flycheck-indent . [(20200129 2046) ((emacs (25 1)) (indent-lint (1 0 0)) (flycheck (31))) "Indent-lint frontend for flycheck" single ((:commit . "c55f4ded11e8e50a96f43675a071354a8fb501c3") (:authors ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "Naoya Yamashita" . "conao3@gmail.com") (:keywords "tools") (:url . "https://github.com/conao3/indent-lint.el"))]) + (flycheck-indicator . [(20200331 1142) ((flycheck (0 15))) "A fancy mode line indicator for `flycheck-mode'" single ((:commit . "e00d9a20cbc21d6814c27cc9206296da394478e8") (:authors ("Eder Elorriaga" . "gexplorer8@gmail.com")) (:maintainer "Eder Elorriaga" . "gexplorer8@gmail.com") (:keywords "convenience" "language" "tools") (:url . "https://github.com/gexplorer/flycheck-indicator"))]) + (flycheck-ini-pyinilint . [(20190312 1931) ((flycheck (31))) "Flycheck integration for PyINILint" single ((:commit . "7febbea9ed407eccc4bfd24ae0d3afd1c19394f7") (:authors ("Daniel J. R. May" . "daniel.may@danieljrmay.com")) (:maintainer "Daniel J. R. May" . "daniel.may@danieljrmay.com") (:keywords "convenience" "files" "tools") (:url . "https://gitlab.com/danieljrmay/flycheck-ini-pyinilint"))]) + (flycheck-inline . [(20200808 1019) ((emacs (25 1)) (flycheck (32))) "Display Flycheck errors inline" single ((:commit . "8e00b4c5951a9515a450a14aefe92e9f6ddcfbde") (:authors ("fmdkdd")) (:maintainer "fmdkdd") (:keywords "tools" "convenience") (:url . "https://github.com/flycheck/flycheck-inline"))]) + (flycheck-irony . [(20180604 2152) ((emacs (24 1)) (flycheck (0 22)) (irony (0 2 0))) "Flycheck: C/C++ support via Irony" single ((:commit . "42dbecd4a865cabeb301193bb4d660e26ae3befe") (:authors ("Guillaume Papin" . "guillaume.papin@epitech.eu")) (:maintainer "Guillaume Papin" . "guillaume.papin@epitech.eu") (:keywords "convenience" "tools" "c") (:url . "https://github.com/Sarcasm/flycheck-irony/"))]) + (flycheck-jest . [(20180411 328) ((emacs (25 1)) (flycheck (0 25))) "Flycheck extension for Jest." single ((:commit . "08f27c5ed97c83c445f99fab58f0b6c826f14449") (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "languages" "jest") (:url . "https://github.com/jojojames/flycheck-jest"))]) + (flycheck-joker . [(20200412 2346) ((flycheck (0 18))) "Add Clojure syntax checker (via Joker) to flycheck" single ((:commit . "93576295fef7a749bf779eeece5edd85e21868e2") (:authors ("Roman Bataev" . "roman.bataev@gmail.com")) (:maintainer "Roman Bataev" . "roman.bataev@gmail.com"))]) + (flycheck-julia . [(20170729 2141) ((emacs (24)) (flycheck (0 22))) "Julia support for Flycheck" single ((:commit . "213b60a5a9a1cb7887260e1d159b5bb27167cbb6") (:authors ("Guido Kraemer" . "guido.kraemer@gmx.de")) (:maintainer "Guido Kraemer" . "guido.kraemer@gmx.de") (:keywords "convenience" "tools" "languages") (:url . "https://github.com/gdkrmr/flycheck-julia"))]) + (flycheck-keg . [(20200726 218) ((emacs (24 3)) (keg (0 1)) (flycheck (0 1))) "Flycheck for Keg projects" single ((:commit . "944e36144d92a798e1fd0f3d83fc6347d57a976e") (:authors ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "Naoya Yamashita" . "conao3@gmail.com") (:keywords "convenience") (:url . "https://github.com/conao3/keg.el"))]) + (flycheck-kotlin . [(20210406 1148) ((flycheck (0 20))) "Support kotlin in flycheck" single ((:commit . "bf1b398bdde128806a0a7479ebbe369bbaa40dae") (:authors ("Elric Milon" . "whirm_REMOVETHIS__@gmx.com")) (:maintainer "Elric Milon" . "whirm_REMOVETHIS__@gmx.com"))]) + (flycheck-languagetool . [(20220402 1703) ((emacs (25 1)) (flycheck (0 14))) "Flycheck support for LanguageTool" single ((:commit . "63674d8b928377d763df40317e15f4ca257f77d6") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com") ("Peter Oliver" . "git@mavit.org.uk")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/emacs-languagetool/flycheck-languagetool"))]) + (flycheck-ledger . [(20200304 2204) ((emacs (24 1)) (flycheck (0 15))) "Flycheck integration for ledger files" single ((:commit . "628e25ba66604946085571652a94a54f4d1ad96f") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/purcell/flycheck-ledger"))]) + (flycheck-lilypond . [(20211006 2102) ((emacs (24 3)) (flycheck (0 22))) "LilyPond support in Flycheck" single ((:commit . "78f8c16cd67f9f6d3f1806e1fd403222723ba400") (:authors ("Hinrik Örn Sigurðsson" . "hinrik.sig@gmail.com")) (:maintainer "Hinrik Örn Sigurðsson" . "hinrik.sig@gmail.com") (:keywords "tools" "convenience") (:url . "https://github.com/hinrik/flycheck-lilypond"))]) + (flycheck-liquidhs . [(20170412 2326) ((flycheck (0 15))) "A flycheck checker for Haskell using liquid (i.e. liquidhaskell)" single ((:commit . "c27252ac24d77f4b6eec76a4ba9cd61761a3fba9") (:authors ("Ranjit Jhala" . "jhala@cs.ucsd.edu")) (:maintainer "Ranjit Jhala" . "jhala@cs.ucsd.edu") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/ucsd-progsys/liquidhaskell/flycheck-liquid.el"))]) + (flycheck-mercury . [(20181118 1952) ((flycheck (0 22)) (s (1 9 0)) (dash (2 4 0))) "Mercury support in Flycheck" single ((:commit . "b6807a8db70981e21a91a93324c31e49de85c89f") (:authors ("Matthias Güdemann" . "matthias.gudemann@gmail.com")) (:maintainer "Matthias Güdemann" . "matthias.gudemann@gmail.com") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/flycheck/flycheck-mercury"))]) + (flycheck-mmark . [(20190713 1323) ((emacs (24 4)) (flycheck (0 29))) "Flycheck checker for the MMark markdown processor" single ((:commit . "67d6216229337c9c020a8aecd6ae2417de29b5e8") (:authors ("Mark Karpov" . "markkarpov92@gmail.com")) (:maintainer "Mark Karpov" . "markkarpov92@gmail.com") (:keywords "convenience" "text") (:url . "https://github.com/mmark-md/flycheck-mmark"))]) + (flycheck-mypy . [(20200113 1336) ((flycheck (0 18))) "Support mypy in flycheck" single ((:commit . "5b4e14ab0cbce2ff35fee7e69b5b95eafd609c80") (:authors ("Lorenzo Bolla" . "lbolla@gmail.com")) (:maintainer "Lorenzo Bolla" . "lbolla@gmail.com"))]) + (flycheck-nim . [(20190927 1514) ((dash (2 4 0)) (flycheck (0 20))) "Defines a flycheck syntax checker for nim" single ((:commit . "ddfade51001571c2399f78bcc509e0aa8eb752a4") (:authors ("Adam Schwalm" . "adamschwalm@gmail.com")) (:maintainer "Adam Schwalm" . "adamschwalm@gmail.com") (:url . "https://github.com/ALSchwalm/flycheck-nim"))]) + (flycheck-nimsuggest . [(20171027 2208) ((flycheck (0 23)) (emacs (24 3))) "flycheck backend for Nim using nimsuggest" single ((:commit . "dc9a5de1cb3ee05db5794d824610959a1f603bc9") (:authors ("Yuta Yamada ")) (:maintainer "Yuta Yamada ") (:url . "https://github.com/yuutayamada/flycheck-nimsuggest"))]) + (flycheck-objc-clang . [(20210911 1023) ((emacs (24 4)) (flycheck (26))) "Flycheck: Objective-C support using Clang" single ((:commit . "0a86156fad0d6f02e8e6b4c5594f7173c96d6481") (:authors ("Goichi Hirakawa" . "gooichi@gyazsquare.com")) (:maintainer "Goichi Hirakawa" . "gooichi@gyazsquare.com") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/GyazSquare/flycheck-objc-clang"))]) + (flycheck-ocaml . [(20170730 2153) ((emacs (24 1)) (flycheck (0 22)) (merlin (3 0 1)) (let-alist (1 0 3))) "Flycheck: OCaml support" single ((:commit . "8707a7bf545a8639a6a5c600a98d9a2ea1487dc9") (:authors ("Sebastian Wiesner" . "swiesner@lunaryorn.com")) (:maintainer "Sebastian Wiesner" . "swiesner@lunaryorn.com") (:keywords "convenience" "tools" "languages") (:url . "https://github.com/flycheck/flycheck-ocaml"))]) + (flycheck-package . [(20210509 2323) ((emacs (24 1)) (flycheck (0 22)) (package-lint (0 2))) "A Flycheck checker for elisp package authors" single ((:commit . "615c1ed8c6fb7c73abec6aaa73d3fef498d231bc") (:authors ("Steve Purcell" . "steve@sanityinc.com") ("Fanael Linithien" . "fanael4@gmail.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "lisp") (:url . "https://github.com/purcell/flycheck-package"))]) + (flycheck-pact . [(20180920 2052) ((emacs (24 3)) (flycheck (0 25)) (pact-mode (0 0 4))) "Flycheck support for pact-mode" single ((:commit . "0e10045064ef89ec8b6f5a473073d47b976a2ca3") (:authors ("Stuart Popejoy")) (:maintainer "Stuart Popejoy" . "stuart@kadena.io") (:keywords "pact" "lisp" "languages" "blockchain" "smartcontracts" "tools" "linting") (:url . "http://github.com/kadena-io/flycheck-pact"))]) + (flycheck-pest . [(20200317 1503) ((emacs (26 3)) (flycheck (31)) (pest-mode (0 1))) "Flycheck integration for Pest -" single ((:commit . "43447a2c70f98edd1139005e32f437d3f142442b") (:authors ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "Naoya Yamashita" . "conao3@gmail.com") (:keywords "convenience" "flycheck") (:url . "https://github.com/ksqsf/pest-mode"))]) + (flycheck-php-noverify . [(20211005 401) ((flycheck (0 22))) "Flycheck checker for PHP Noverify linter" single ((:commit . "3c5cfa5b790bb7f0a8da7f3caee8e4782b67f8ac") (:url . "https://github.com/Junker/flycheck-php-noverify"))]) + (flycheck-phpstan . [(20210714 1805) ((emacs (24 3)) (flycheck (26)) (phpstan (0 5 0))) "Flycheck integration for PHPStan" single ((:commit . "0869b152f82a76138daa53e953285936b9d558bd") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "tools" "php") (:url . "https://github.com/emacs-php/phpstan.el"))]) + (flycheck-pkg-config . [(20200409 501) ((dash (2 8 0)) (s (1 9 0)) (flycheck (29))) "configure flycheck using pkg-config" single ((:commit . "b76b24ea1f4800f5fb96ce9c6c4788e0e63133d3") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk") (:keywords "flycheck"))]) + (flycheck-plantuml . [(20171018 111) ((flycheck (0 24)) (emacs (24 4)) (plantuml-mode (1 2 2))) "Integrate plantuml with flycheck" single ((:commit . "183be89e1dbba0b38237dd198dff600e0790309d") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/flycheck-plantuml"))]) + (flycheck-pony . [(20210118 1326) ((flycheck (0 25 1))) "Pony support in Flycheck" single ((:commit . "2d5b72903e69e1e5eec2d03b9006a62fbbf75233") (:keywords "tools" "convenience") (:url . "https://github.com/seantallen/flycheck-pony"))]) + (flycheck-popup-tip . [(20170812 2351) ((flycheck (0 22)) (popup (0 5)) (emacs (24))) "Display Flycheck error messages using popup.el" single ((:commit . "ef86aad907f27ca076859d8d9416f4f7727619c6") (:authors ("Saša Jovanić" . "sasa@simplify.ba")) (:maintainer "Saša Jovanić" . "sasa@simplify.ba") (:keywords "convenience" "tools" "flycheck" "tooltip") (:url . "https://github.com/flycheck/flycheck-popup-tip/"))]) + (flycheck-pos-tip . [(20200516 1600) ((emacs (24 1)) (flycheck (0 22)) (pos-tip (0 4 6))) "Display Flycheck errors in GUI tooltips" single ((:commit . "dc57beac0e59669926ad720c7af38b27c3a30467") (:authors ("Akiha Senda" . "senda.akiha@gmail.com") ("Sebastian Wiesner" . "swiesner@lunaryorn.com")) (:maintainer "Sebastian Wiesner" . "swiesner@lunaryorn.com") (:keywords "tools" "convenience") (:url . "https://github.com/flycheck/flycheck-pos-tip"))]) + (flycheck-posframe . [(20210316 618) ((flycheck (0 24)) (emacs (26)) (posframe (0 7 0))) "Show flycheck error messages using posframe.el" single ((:commit . "8f60c9bf124ab9597d681504a73fdf116a0bde12") (:authors ("Alex Murray" . "murray.alex@gmail.com")) (:maintainer "Alex Murray" . "murray.alex@gmail.com") (:url . "https://github.com/alexmurray/flycheck-posframe"))]) + (flycheck-projectile . [(20201031 1952) ((emacs (25 1)) (flycheck (31)) (projectile (2 2))) "Project-wide errors" single ((:commit . "ce6e9e8793a55dace13d5fa13badab2dca3b5ddb") (:authors ("Nikita Bloshchanevich" . "nikblos@outlook.com")) (:maintainer "Nikita Bloshchanevich" . "nikblos@outlook.com") (:url . "https://github.com/nbfalcon/flycheck-projectile"))]) + (flycheck-prospector . [(20180524 450) ((flycheck (0 22))) "Support prospector in flycheck" single ((:commit . "92f2680573290ba4a69a2d6e140f44680efce6a8") (:authors ("Carlos Coelho" . "carlospecter@gmail.com")) (:maintainer "Carlos Coelho" . "carlospecter@gmail.com") (:url . "https://github.com/chocoelho/flycheck-prospector"))]) + (flycheck-psalm . [(20211002 1555) ((emacs (24 3)) (flycheck (26)) (psalm (0 6 0))) "Flycheck integration for Psalm" single ((:commit . "28d546a79cb865a78b94cd7e929d66d720505faa") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "tools" "php") (:url . "https://github.com/emacs-php/psalm.el"))]) + (flycheck-pycheckers . [(20211122 235) ((flycheck (0 18))) "multiple syntax checker for Python, using Flycheck" tar ((:commit . "56965c0ef5d45bcef90093360718c6967ce4ef39") (:keywords "convenience" "tools" "languages") (:url . "https://github.com/msherry/flycheck-pycheckers"))]) + (flycheck-pyflakes . [(20170330 2311) ((flycheck (0 18))) "Support pyflakes in flycheck" single ((:commit . "61b045939e3743b2162b7e4e73249c66fc2b8f65") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk"))]) + (flycheck-pyre . [(20190215 1222) ((emacs (24)) (flycheck (29)) (cl-lib (0 6))) "Support Pyre in flycheck" tar ((:commit . "0560122caae207d99d8af1ac2b4e5d6f6a1ce444") (:authors ("Vyacheslav Linnik" . "vyacheslav.linnik@gmail.com")) (:maintainer "Vyacheslav Linnik" . "vyacheslav.linnik@gmail.com") (:url . "https://github.com/linnik/flycheck-pyre"))]) + (flycheck-raku . [(20220420 732) ((emacs (26 3)) (flycheck (0 22))) "Raku support in Flycheck" single ((:commit . "4da1970a75396aff1957b07f7579c1de6b817e6b") (:authors ("Hinrik Örn Sigurðsson" . "hinrik.sig@gmail.com") ("Johnathon Weare" . "jrweare@gmail.com") ("Siavash Askari Nasr" . "siavash.askari.nasr@gmail.com")) (:maintainer "Hinrik Örn Sigurðsson" . "hinrik.sig@gmail.com") (:keywords "tools" "convenience") (:url . "https://github.com/Raku/flycheck-raku"))]) + (flycheck-relint . [(20200721 2217) ((emacs (26 1)) (flycheck (0 22)) (relint (1 15))) "A Flycheck checker for elisp regular expressions" single ((:commit . "c66d0c8d2e3a8abb6a3dfda597801e460b2eeb6f") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "lisp") (:url . "https://github.com/purcell/flycheck-relint"))]) + (flycheck-rtags . [(20191222 920) ((emacs (24)) (flycheck (0 23)) (rtags (2 10))) "RTags Flycheck integration" single ((:commit . "db39790fda5c2443bc790b8971ac140914f7e9c2") (:authors ("Christian Schwarzgruber" . "c.schwarzgruber.cs@gmail.com")) (:maintainer "Christian Schwarzgruber" . "c.schwarzgruber.cs@gmail.com") (:url . "https://github.com/Andersbakken/rtags"))]) + (flycheck-rust . [(20190319 1546) ((emacs (24 1)) (flycheck (28)) (dash (2 13 0)) (seq (2 3)) (let-alist (1 0 4))) "Flycheck: Rust additions and Cargo support" single ((:commit . "a139cd53c5062697e9ed94ad80b803c37d999600") (:authors ("Sebastian Wiesner" . "swiesner@lunaryorn.com")) (:maintainer "Sebastian Wiesner" . "swiesner@lunaryorn.com") (:keywords "tools" "convenience") (:url . "https://github.com/flycheck/flycheck-rust"))]) + (flycheck-stan . [(20211129 2051) ((emacs (25 1)) (flycheck (0 16 0)) (stan-mode (10 3 0))) "Add Stan support for Flycheck" tar ((:commit . "150bbbe5fd3ad2b5a3dbfba9d291e66eeea1a581") (:authors ("Jeffrey Arnold" . "jeffrey.arnold@gmail.com") ("Kazuki Yoshida" . "kazukiyoshida@mail.harvard.edu")) (:maintainer "Kazuki Yoshida" . "kazukiyoshida@mail.harvard.edu") (:keywords "c" "languages") (:url . "https://github.com/stan-dev/stan-mode/tree/master/flycheck-stan"))]) + (flycheck-status-emoji . [(20180330 2325) ((cl-lib (0 1)) (emacs (24)) (flycheck (0 20)) (let-alist (1 0))) "Show flycheck status using cute, compact emoji" single ((:commit . "4bd113ab42dec9544b66e0a27ed9008ce8148433") (:authors ("Ben Liblit" . "liblit@acm.org")) (:maintainer "Ben Liblit" . "liblit@acm.org") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/liblit/flycheck-status-emoji"))]) + (flycheck-swift . [(20170129 549) ((emacs (24 4)) (flycheck (0 25))) "Flycheck extension for Apple's Swift." single ((:commit . "4c5ad401252400a78da395fd56a71e67ff8c2761") (:keywords "languages" "swift"))]) + (flycheck-swift3 . [(20210910 1244) ((emacs (24 4)) (flycheck (26))) "Flycheck: Swift support for Apple swift-mode" single ((:commit . "54193175c87a4c0bbf7ed16a3e76d6daff35c76f") (:authors ("Goichi Hirakawa" . "gooichi@gyazsquare.com")) (:maintainer "Goichi Hirakawa" . "gooichi@gyazsquare.com") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/GyazSquare/flycheck-swift3"))]) + (flycheck-swiftlint . [(20180830 340) ((emacs (25 1)) (flycheck (0 25))) "Flycheck extension for Swiftlint." single ((:commit . "8861ddbd9c1c2a951630d9ea29162ad0916580cb") (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "languages" "swiftlint" "swift" "emacs") (:url . "https://github.com/jojojames/flycheck-swiftlint"))]) + (flycheck-swiftx . [(20200814 845) ((emacs (26 1)) (flycheck (26)) (xcode-project (1 0))) "Flycheck: Swift backend" single ((:commit . "84f42393dea362d3bdfc9253a205a17ec7a12a76") (:authors ("John Buckley" . "john@olivetoast.com")) (:maintainer "John Buckley" . "john@olivetoast.com") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/nhojb/flycheck-swiftx"))]) + (flycheck-tcl . [(20180327 1259) ((emacs (24 4)) (flycheck (0 22))) "A flycheck checker for Tcl using tclchecker" single ((:commit . "7ca23f4673e178b9f5dcc8a82b86cf05b15d7236") (:authors ("Niels Widger" . "niels.widger@gmail.com")) (:maintainer "Niels Widger" . "niels.widger@gmail.com") (:url . "https://github.com/nwidger/flycheck-tcl"))]) + (flycheck-tip . [(20171020 1048) ((flycheck (29)) (emacs (24 1)) (popup (0 5 0))) "Show flycheck/flymake errors by tooltip" tar ((:commit . "9b0072d92e6b4a52834bf5a34120a0f5e1c8c2fd") (:authors ("Yuta Yamada ")) (:maintainer "Yuta Yamada ") (:keywords "flycheck") (:url . "https://github.com/yuutayamada/flycheck-tip"))]) + (flycheck-title . [(20210321 558) ((flycheck (30)) (emacs (24))) "show flycheck errors in the frame title" single ((:commit . "74e4375f372f7b9ce0fdfa34dc74a048376679ae") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk"))]) + (flycheck-vale . [(20190609 1533) ((emacs (24 4)) (flycheck (0 22)) (let-alist (1 0 4))) "flycheck integration for vale" single ((:commit . "f08249535348d046d0974b9c20fe1b7dd3cd2660") (:authors ("Austin Bingham" . "austin.bingham@gmail.com")) (:maintainer "Austin Bingham" . "austin.bingham@gmail.com") (:url . "https://github.com/abingham/flycheck-vale"))]) + (flycheck-vdm . [(20190304 839) ((emacs (24)) (flycheck (32 -4)) (vdm-mode (0 0 4))) "Syntax checking for vdm-mode" single ((:commit . "56336930555df91787f196acac15680498d17d5e") (:authors ("Peter W. V. Tran-Jørgensen" . "peter.w.v.jorgensen@gmail.com")) (:maintainer "Peter W. V. Tran-Jørgensen" . "peter.w.v.jorgensen@gmail.com") (:keywords "languages") (:url . "https://github.com/peterwvj/vdm-mode"))]) + (flycheck-xcode . [(20180122 651) ((emacs (25 1)) (flycheck (0 25))) "Flycheck extension for Apple's Xcode." single ((:commit . "b76f872c8985801951a095b8b3c1572b94189f9e") (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "languages" "xcode") (:url . "https://github.com/jojojames/flycheck-xcode"))]) + (flycheck-yamllint . [(20170325 1735) ((flycheck (30))) "Flycheck integration for YAMLLint" single ((:commit . "1e9fe3b2d3e42d551b94473816a8eeee637b446c") (:authors ("Krzysztof Magosa" . "krzysztof@magosa.pl")) (:maintainer "Krzysztof Magosa" . "krzysztof@magosa.pl") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/krzysztof-magosa/flycheck-yamllint"))]) + (flycheck-yang . [(20180312 1831) ((yang-mode (0 9 4)) (flycheck (0 18))) "YANG flycheck checker" single ((:commit . "47881fc42ef0163c47064b72b5d6dbef4f83d778") (:authors (nil . "Andrew Fort (@andaru)")) (:maintainer nil . "Andrew Fort (@andaru)"))]) + (flycheck-ycmd . [(20181016 618) ((emacs (24)) (dash (2 13 0)) (flycheck (0 22)) (ycmd (1 2)) (let-alist (1 0 5))) "flycheck integration for ycmd" single ((:commit . "c17ff9e0250a9b39d23af37015a2b300e2f36fed") (:authors ("Austin Bingham" . "austin.bingham@gmail.com")) (:maintainer "Austin Bingham" . "austin.bingham@gmail.com") (:url . "https://github.com/abingham/emacs-ycmd"))]) + (flymake-aspell . [(20220411 826) ((emacs (26 1))) "Aspell checker for flymake" single ((:commit . "dcf7e6543e4d94d58375e00e4a10db615ef06941") (:authors ("Leo Gaskin" . "leo.gaskin@le0.gs")) (:maintainer "Leo Gaskin" . "leo.gaskin@le0.gs") (:keywords "wp" "flymake" "spell" "aspell") (:url . "https://github.com/leotaku/flycheck-aspell"))]) + (flymake-coffee . [(20170723 146) ((flymake-easy (0 1))) "A flymake handler for coffee script" single ((:commit . "dee295acf30820ed15fe0de17137d50bc27fc80c") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-coffee"))]) + (flymake-collection . [(20220410 1343) ((emacs (28 1)) (let-alist (1 0)) (flymake (1 2 1))) "Collection of checkers for flymake, bringing flymake to the level of flycheck" tar ((:commit . "8f36fed9eef834cf94931fc8b813f9ac8db6d2a4") (:authors ("Mohsin Kaleem" . "mohkale@kisara.moe")) (:maintainer "Mohsin Kaleem" . "mohkale@kisara.moe") (:keywords "language" "tools") (:url . "https://github.com/mohkale/flymake-collection"))]) + (flymake-css . [(20170723 146) ((flymake-easy (0 1))) "Flymake support for css using csslint" single ((:commit . "de090163ba289910ceeb61b13368ce42d0f2dfd8") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-css"))]) + (flymake-cursor . [(20220506 1458) ((flymake (0 3))) "Show flymake messages in the minibuffer after delay" single ((:commit . "6ce75c17bc02ae9755deda50d5ac366785c94091") (:authors ("Unknown Original Author") ("Dino Chiesa" . "dpchiesa@hotmail.com") ("Sam Graham ")) (:maintainer "Sam Graham ") (:keywords "languages" "mode" "flymake") (:url . "https://github.com/flymake/emacs-flymake-cursor"))]) + (flymake-diagnostic-at-point . [(20180815 1004) ((emacs (26 1)) (popup (0 5 3))) "Display flymake diagnostics at point" single ((:commit . "379616b1c6f5ebeaf08fbe54ae765008a78b3be7") (:authors ("Ricardo Martins" . "ricardo@scarybox.net")) (:maintainer "Ricardo Martins" . "ricardo@scarybox.net") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/meqif/flymake-diagnostic-at-point"))]) + (flymake-easy . [(20140818 755) nil "Helpers for easily building flymake checkers" single ((:commit . "de41ea49503f71f997e5c359a2ad08df696c0147") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "convenience" "internal") (:url . "https://github.com/purcell/flymake-easy"))]) + (flymake-elixir . [(20130810 1417) nil "A flymake handler for elixir-mode .ex files." single ((:commit . "3810566cffe35d04cc3f01e27fe397d68d52f802") (:authors ("Sylvain Benner" . "syl20bnr@gmail.com")) (:maintainer "Sylvain Benner" . "syl20bnr@gmail.com"))]) + (flymake-eslint . [(20220318 152) ((emacs (26 0))) "A Flymake backend for Javascript using eslint" single ((:commit . "bfcf28259c7d774b259a6ed122f1f0936a5b96b9") (:authors ("Dan Orzechowski")) (:maintainer "Dan Orzechowski") (:url . "https://github.com/orzechowskid/flymake-eslint"))]) + (flymake-flycheck . [(20220313 924) ((flycheck (31)) (emacs (26 1))) "Use flycheck checkers as flymake backends" single ((:commit . "9040be3763b8f9952dccd9a04be25ac20a0f8745") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "convenience" "languages" "tools") (:url . "https://github.com/purcell/flymake-flycheck"))]) + (flymake-gjshint . [(20130327 1232) nil "A flymake handler for javascript using both jshint and gjslint" single ((:commit . "dc957c14cb060819585de8aedb330e24efa4b784") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "flymake" "javascript" "jshint" "gjslint"))]) + (flymake-go . [(20150714 733) nil "A flymake handler for go-mode files" single ((:commit . "ae83761aa908c1a50ff34af04f00dcc46bca2ce9") (:authors ("Michael Fellinger" . "michael@iron.io") ("Robert Zaremba" . "robert.marek.zaremba@wp.eu")) (:maintainer "Michael Fellinger" . "michael@iron.io") (:keywords "go" "flymake") (:url . "https://github.com/robert-zaremba/flymake-go"))]) + (flymake-go-staticcheck . [(20190708 1325) ((emacs (25))) "Go staticcheck linter for flymake" single ((:commit . "130079fcd29c3e2a72f8325f3041042bcc6286f1") (:authors ("Sergey Kostyaev" . "feo.me@ya.ru")) (:maintainer "Sergey Kostyaev" . "feo.me@ya.ru") (:keywords "languages" "tools") (:url . "https://github.com/s-kostyaev/flymake-go-staticcheck"))]) + (flymake-golangci . [(20191028 1927) ((flymake-easy (0 1)) (emacs (24))) "A flymake handler for go-mode files using Golang CI lint" single ((:commit . "dfc31a1a6ae3f087b49fe6f5f21b3866780aa91c") (:authors ("Jorge Javier Araya Navarro" . "jorgejavieran@yahoo.com.mx")) (:maintainer "Jorge Javier Araya Navarro" . "jorgejavieran@yahoo.com.mx") (:url . "https://gitlab.com/shackra/flymake-golangci"))]) + (flymake-gradle . [(20190315 233) ((emacs (26 1))) "Flymake extension for Gradle." single ((:commit . "dbedd29b78d4828ef57d4de20867be5df3eaab99") (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "languages" "gradle") (:url . "https://github.com/jojojames/flymake-gradle"))]) + (flymake-grammarly . [(20220222 638) ((emacs (26 1)) (grammarly (0 3 0)) (s (1 12 0))) "Flymake support for Grammarly" single ((:commit . "74ab6bb817205dbf1cd77a161be76904c1e17b75") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/emacs-grammarly/flymake-grammarly"))]) + (flymake-hadolint . [(20220328 823) ((emacs (26 1))) "Flymake backend for hadolint, a Dockerfile linter" single ((:commit . "82a6df7f6cc95e1ab95c5d28f2edcd8c1d4c7382") (:authors ("Taiki Sugawara" . "buzz.taiki@gmail.com")) (:maintainer "Taiki Sugawara" . "buzz.taiki@gmail.com") (:keywords "convenience" "processes" "docker" "flymake") (:url . "https://github.com/buzztaiki/flymake-hadolint"))]) + (flymake-haml . [(20170723 146) ((flymake-easy (0 1))) "A flymake handler for haml files" single ((:commit . "22a81e8484734552d461e7ae7305664dc244447e") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-haml"))]) + (flymake-haskell-multi . [(20170723 146) ((flymake-easy (0 1))) "Syntax-check haskell-mode using both ghc and hlint" tar ((:commit . "b564a94312259885b1380272eb867bf52a164020") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-haskell-multi"))]) + (flymake-hlint . [(20170723 146) ((flymake-easy (0 1))) "A flymake handler for haskell-mode files using hlint" single ((:commit . "f910736b26784efc9a2fa29503f45c1f1dd0aa38") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-hlint"))]) + (flymake-joker . [(20200315 1429) ((emacs (26 1)) (flymake-quickdef (0 1 1))) "Add Clojure syntax checker (via Joker) to flymake" single ((:commit . "fc132beedac9e6f415b72e578e77318fd13af9ee") (:authors ("Mateusz Probachta" . "mateusz.probachta@gmail.com")) (:maintainer "Mateusz Probachta" . "mateusz.probachta@gmail.com") (:url . "https://github.com/beetleman/flymake-joker"))]) + (flymake-jshint . [(20140319 2200) ((flymake-easy (0 8))) "making flymake work with JSHint" single ((:commit . "79dd554c227883c487db38ac111306c8d5382c95") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk") (:keywords "flymake" "jshint" "javascript"))]) + (flymake-jslint . [(20170723 146) ((flymake-easy (0 1))) "A flymake handler for javascript using jslint" single ((:commit . "8edb82be605542b0ef62d38d818adcdde335eecb") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-jslint"))]) + (flymake-json . [(20180511 911) ((flymake-easy (0 1))) "A flymake handler for json using jsonlint" single ((:commit . "03b4e5e7ad11938781257a783e717ab95fe65952") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-json"))]) + (flymake-kondor . [(20211026 501) ((emacs (26 1))) "Linter with clj-kondo" single ((:commit . "784e57f36812a37e323409b90b935ef3c6920a22") (:authors ("https://turbocafe.keybase.pub")) (:maintainer "https://turbocafe.keybase.pub") (:url . "https://github.com/turbo-cafe/flymake-kondor"))]) + (flymake-ktlint . [(20180831 346) ((emacs (26 1))) "Flymake extension for Ktlint." single ((:commit . "56aab6f2d22061999050783dbc3166cdb456d0bb") (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "languages" "ktlint") (:url . "https://github.com/jojojames/flymake-ktlint"))]) + (flymake-languagetool . [(20220414 429) ((emacs (27 1)) (s (1 9 0))) "Flymake support for LanguageTool" single ((:commit . "a61bafdda1c9bb684a98216598df95a33cbb9549") (:url . "https://github.com/emacs-languagetool/flymake-languagetool"))]) + (flymake-less . [(20151111 738) ((less-css-mode (0 15)) (flymake-easy (0 1))) "Flymake handler for LESS stylesheets (lesscss.org)" single ((:commit . "32d3c28a9a5c52b82d1741ff9d715013b6498421") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:keywords "languages"))]) + (flymake-lua . [(20170129 154) nil "Flymake for Lua" single ((:commit . "84589f20066921a5b79cf3a1f914a223a2552d2a") (:authors (nil . "Sébastien Roccaserra (format \"<%s%s@%s.%s>\" \"s\" \"roccaserra\" \"yahoo\" \"com\")")) (:maintainer nil . "Sébastien Roccaserra (format \"<%s%s@%s.%s>\" \"s\" \"roccaserra\" \"yahoo\" \"com\")") (:keywords "lua"))]) + (flymake-markdownlint . [(20220320 1208) ((emacs (27 1))) "Markdown linter with markdownlint" single ((:commit . "59e3520668d9394c573e07b7980a2d48d9f6086c") (:authors ("Martin Kjær Jørgensen" . "mkj@gotu.dk")) (:maintainer "Martin Kjær Jørgensen" . "mkj@gotu.dk") (:url . "https://github.com/shaohme/flymake-markdownlint"))]) + (flymake-nasm . [(20210310 1540) ((flymake-quickdef (1 0 0)) (emacs (26 1))) "A flymake handler for asm-mode files using nasm" single ((:commit . "27e58d7f3a48ca6fc12238fe6c888a3fdffc3f75") (:authors ("Jürgen Hötzel" . "juergen@hoetzel.info")) (:maintainer "Jürgen Hötzel") (:keywords "tools" "languages") (:url . "http://github.com/juergenhoetzel/flymake-nasm"))]) + (flymake-perlcritic . [(20120328 814) ((flymake (0 3))) "Flymake handler for Perl to invoke Perl::Critic" tar ((:commit . "06d819c6d1292f8c87ebc0681c83c9fb48620bbe") (:authors ("Sam Graham ")) (:maintainer "Sam Graham ") (:url . "https://github.com/illusori/emacs-flymake-perlcritic"))]) + (flymake-pest . [(20200317 1503) ((emacs (26 3)) (pest-mode (0 1))) "A flymake handler for Pest files" single ((:commit . "43447a2c70f98edd1139005e32f437d3f142442b") (:authors ("ksqsf" . "i@ksqsf.moe") ("Naoya Yamashita" . "conao3@gmail.com")) (:maintainer "ksqsf" . "i@ksqsf.moe") (:keywords "languages" "flymake") (:url . "https://github.com/ksqsf/pest-mode"))]) + (flymake-php . [(20170723 146) ((flymake-easy (0 1))) "A flymake handler for php-mode files" single ((:commit . "c045d01e002ba5e09b05f40e25bf5068d02126bc") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-php"))]) + (flymake-phpcs . [(20140713 631) ((flymake-easy (0 9))) "making flymake work with PHP CodeSniffer" single ((:commit . "10d3e7e1c31c104e3da694b2b52cd34df61efa5e") (:authors ("Akiha Senda")) (:maintainer "Akiha Senda") (:keywords "flymake" "phpcs" "php") (:url . "https://github.com/senda-akiha/flymake-phpcs/"))]) + (flymake-phpstan . [(20210714 1805) ((emacs (26 1)) (phpstan (0 5 0))) "Flymake backend for PHP using PHPStan" single ((:commit . "0869b152f82a76138daa53e953285936b9d558bd") (:authors ("USAMI Kenta" . "tadsan@zonu.me")) (:maintainer "USAMI Kenta" . "tadsan@zonu.me") (:keywords "tools" "php") (:url . "https://github.com/emacs-php/phpstan.el"))]) + (flymake-puppet . [(20170801 554) ((flymake-easy (0 9))) "Flymake handler using puppet-lint" single ((:commit . "8a772395f4ccc59d883712ab53a92a17c1d9a429") (:authors ("Ben Prew")) (:maintainer "Ben Prew") (:url . "https://github.com/benprew/flymake-puppet"))]) + (flymake-python-pyflakes . [(20170723 146) ((flymake-easy (0 8))) "A flymake handler for python-mode files using pyflakes (or flake8)" single ((:commit . "1d65c26bf65a5dcbd29fcd967e2feb90e1e7a33d") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-python-pyflakes"))]) + (flymake-quickdef . [(20200308 2342) ((emacs (26 1))) "Quickly define a new Flymake backend" single ((:commit . "150c5839768a3d32f988f9dc08052978a68f2ad7") (:authors ("Karl Otness")) (:maintainer "Karl Otness") (:keywords "languages" "tools" "convenience" "lisp") (:url . "https://github.com/karlotness/flymake-quickdef"))]) + (flymake-racket . [(20210105 606) ((emacs (26 1))) "Flymake extension for Racket." single ((:commit . "3d3e5f2a9ab696670f9e52baa4dde7b84b7542df") (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "languages" "racket" "scheme") (:url . "https://github.com/jojojames/flymake-racket"))]) + (flymake-rakudo . [(20220424 637) ((emacs (28 1)) (flymake-collection (2 0 0)) (let-alist (1 0))) "Flymake syntax checker for Rakudo" single ((:commit . "f8e3d03a7207876cd891174702efd572d74f2e49") (:authors ("Siavash Askari Nasr" . "ciavash@proton.me")) (:maintainer "Siavash Askari Nasr" . "ciavash@proton.me") (:keywords "language" "tools" "convenience") (:url . "https://github.com/Raku/flymake-rakudo"))]) + (flymake-ruby . [(20170723 146) ((flymake-easy (0 1))) "A flymake handler for ruby-mode files" single ((:commit . "6c320c6fb686c5223bf975cc35178ad6b195e073") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-ruby"))]) + (flymake-sass . [(20170723 146) ((flymake-easy (0 1))) "Flymake handler for sass and scss files" single ((:commit . "2de28148e92deb93bff3d55fe14e7c67ac476056") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-sass"))]) + (flymake-shell . [(20170723 146) ((flymake-easy (0 1))) "A flymake syntax-checker for shell scripts" single ((:commit . "a16cf453056b9849cc7c912bb127fb0b08fc6dab") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/flymake-shell"))]) + (flymake-shellcheck . [(20220308 2218) ((emacs (26))) "A bash/sh Flymake backend powered by ShellCheck" single ((:commit . "688638177b4e23ecc192975e3062274ca904ada1") (:authors ("Federico Tedin" . "federicotedin@gmail.com")) (:maintainer "Federico Tedin" . "federicotedin@gmail.com") (:url . "https://github.com/federicotdn/flymake-shellcheck"))]) + (flymake-solidity . [(20170805 644) ((flymake-easy (0 10))) "A flymake handler for solidity using solc" single ((:commit . "48bfe9525f764d8a68cc0270905dbf45bfd00bb8") (:authors ("Pascal van Kooten" . "kootenpv@gmail.com")) (:maintainer "Pascal van Kooten" . "kootenpv@gmail.com") (:url . "https://github.com/kootenvp/flymake-solidity"))]) + (flymake-swi-prolog . [(20220404 950) ((emacs (26 1))) "A Flymake backend for SWI-Prolog" single ((:commit . "ae0e4b706a40b71c007ed6cb0ec5425d49bea4c3") (:authors ("Eshel Yaron")) (:maintainer "Eshel Yaron") (:keywords "languages") (:url . "https://git.sr.ht/~eshel/flymake-swi-prolog"))]) + (flymake-vala . [(20150326 531) ((flymake-easy (0 1))) "A flymake handler for vala-mode files" single ((:commit . "c3674f461fc84fb0300cd3a562fb903a59782745") (:authors ("Daniel Lawrence" . "dannyla@linux.com")) (:maintainer "Daniel Lawrence" . "dannyla@linux.com") (:keywords "convenience" "vala") (:url . "https://github.com/daniellawrence/flymake-vala"))]) + (flymake-vnu . [(20181128 216) ((emacs (26 1))) "Flymake extension for the v.Nu HTML validator." single ((:commit . "7c4ab9d12611756ad5a80d866890b2f9b73fb611") (:maintainer "Stefan Kuznetsov" . "skuznetsov@posteo.net") (:keywords "languages") (:url . "https://github.com/theneosloth/flymake-vnu"))]) + (flymake-yaml . [(20130423 1548) ((flymake-easy (0 1))) "A flymake handler for YAML" single ((:commit . "24cb5b744a1796e554e6dbfc6eeb237d06a00b10") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "yaml") (:url . "https://github.com/yasuyk/flymake-yaml"))]) + (flymake-yamllint . [(20220311 636) ((emacs (26 1))) "YAML linter with yamllint" single ((:commit . "a93bf9a6697566f0e29fb51a87c5cc7b2a972d2d") (:authors ("Martin Kjær Jørgensen" . "mkj@gotu.dk")) (:maintainer "Martin Kjær Jørgensen" . "mkj@gotu.dk") (:url . "https://github.com/shaohme/flymake-yamllint"))]) + (flymd . [(20160617 1214) ((cl-lib (0 5))) "On the fly markdown preview" tar ((:commit . "84d5a68bcfed4a295952c33ffcd11e880978d9d7") (:authors ("Mola-T" . "Mola@molamola.xyz")) (:maintainer "Mola-T" . "Mola@molamola.xyz") (:keywords "markdown" "convenience") (:url . "https://github.com/mola-T/flymd"))]) + (flyparens . [(20140723 1846) nil "Check for unbalanced parens on the fly" tar ((:commit . "af9b8cfd647d0e5f97684d613dc2eea7cfc19398") (:authors ("Jisang Yoo")) (:maintainer "Jisang Yoo") (:keywords "faces" "convenience" "lisp" "matching" "parentheses" "parens"))]) + (flyspell-correct . [(20220131 834) ((emacs (24))) "Correcting words with flyspell via custom interface" tar ((:commit . "e8027a412262bc04056a5b5440efdb7f370c3320") (:authors ("Boris Buliga" . "boris@d12frosted.io")) (:maintainer "Boris Buliga" . "boris@d12frosted.io") (:url . "https://github.com/d12frosted/flyspell-correct"))]) + (flyspell-correct-avy-menu . [(20210124 1143) ((flyspell-correct (0 6 1)) (avy-menu (0 1 1)) (emacs (24))) "Correcting words with flyspell via avy-menu interface" single ((:commit . "e8027a412262bc04056a5b5440efdb7f370c3320") (:authors ("Boris Buliga" . "boris@d12frosted.io") ("Clemens Radermacher" . "clemera@posteo.net")) (:maintainer "Boris Buliga" . "boris@d12frosted.io") (:url . "https://github.com/d12frosted/flyspell-correct"))]) + (flyspell-correct-helm . [(20210124 1143) ((flyspell-correct (0 6 1)) (helm (1 9 0)) (emacs (24))) "Correcting words with flyspell via helm interface" single ((:commit . "e8027a412262bc04056a5b5440efdb7f370c3320") (:authors ("Boris Buliga" . "boris@d12frosted.io")) (:maintainer "Boris Buliga" . "boris@d12frosted.io") (:url . "https://github.com/d12frosted/flyspell-correct"))]) + (flyspell-correct-ivy . [(20210124 1143) ((flyspell-correct (0 6 1)) (ivy (0 8 0)) (emacs (24 4))) "Correcting words with flyspell via ivy interface" single ((:commit . "e8027a412262bc04056a5b5440efdb7f370c3320") (:authors ("Boris Buliga" . "boris@d12frosted.io")) (:maintainer "Boris Buliga" . "boris@d12frosted.io") (:url . "https://github.com/d12frosted/flyspell-correct"))]) + (flyspell-correct-popup . [(20210124 1143) ((flyspell-correct (0 6 1)) (popup (0 5 3)) (emacs (24))) "Correcting words with flyspell via popup interface" single ((:commit . "e8027a412262bc04056a5b5440efdb7f370c3320") (:authors ("Boris Buliga" . "boris@d12frosted.io")) (:maintainer "Boris Buliga" . "boris@d12frosted.io") (:url . "https://github.com/d12frosted/flyspell-correct"))]) + (flyspell-lazy . [(20210308 1253) nil "Improve flyspell responsiveness using idle timers" single ((:commit . "0fc5996bcee20b46cbd227ae948d343c3bef7339") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "spelling") (:url . "http://github.com/rolandwalker/flyspell-lazy"))]) + (flyspell-popup . [(20170529 815) ((popup (0 5 0))) "Correcting words with Flyspell in popup menus" single ((:commit . "29311849bfd253b9b689bf331860b4c4d3bd4dde") (:authors ("Chunyang Xu" . "mail@xuchunyang.me")) (:maintainer "Chunyang Xu" . "mail@xuchunyang.me") (:keywords "convenience") (:url . "https://github.com/xuchunyang/flyspell-popup"))]) + (fm-bookmarks . [(20170104 1716) ((emacs (24 3)) (cl-lib (0 5))) "Use file manager bookmarks (eg Dolphin, Nautilus, PCManFM) in Dired" single ((:commit . "11dacfd16a926bfecba96a94c6b13e162c7717f7") (:authors ("Ono Hiroko" . "azazabc123@gmail.com")) (:maintainer "Ono Hiroko" . "azazabc123@gmail.com") (:keywords "files" "convenience") (:url . "http://github.com/kuanyui/fm-bookmarks.el"))]) + (fn . [(20210304 1812) ((emacs (24)) (cl-lib (0 5)) (dash (2 18 0))) "Concise anonymous functions for Emacs Lisp" single ((:commit . "98e3fe1b4785e162d9aca978a2db106baa79260f") (:authors ("Troy Pracy")) (:maintainer "Troy Pracy") (:keywords "functional"))]) + (focus . [(20191209 2210) ((emacs (24 3)) (cl-lib (0 5))) "Dim the font color of text in surrounding sections" single ((:commit . "5f3f20e7f22fb9fd7c48abce8bd38061d97e4bc0") (:authors ("Lars Tveito" . "larstvei@ifi.uio.no")) (:maintainer "Lars Tveito" . "larstvei@ifi.uio.no") (:url . "http://github.com/larstvei/Focus"))]) + (focus-autosave-mode . [(20160519 2116) ((emacs (24 4))) "Automatically save files in focus-out-hook." single ((:commit . "2e0844fabb6f0dc9e0f31928e4785febf38b9e35") (:authors ("Wojciech Siewierski" . "wojciech.siewierski@onet.pl")) (:maintainer "Wojciech Siewierski" . "wojciech.siewierski@onet.pl") (:keywords "convenience" "files" "frames" "mouse"))]) + (foggy-night-theme . [(20190123 1614) ((emacs (24))) "Dark low contrast theme with soft and muted colors." single ((:commit . "14894e06ee5c6e14db36f2cb07387ee971c1736f") (:authors ("Martin Haesler")) (:maintainer "Martin Haesler"))]) + (fold-dwim . [(20140208 1637) nil "Unified user interface for Emacs folding modes" single ((:commit . "c46f4bb2ce91b4e307136320e72c28dd50b6cd8b") (:authors ("Peter Heslin" . "p.j.heslin@dur.ac.uk")) (:maintainer "Peter Heslin" . "p.j.heslin@dur.ac.uk") (:url . "http://www.dur.ac.uk/p.j.heslin/Software/Emacs"))]) + (fold-dwim-org . [(20131203 1351) ((fold-dwim (1 2))) "Fold DWIM bound to org key-strokes." single ((:commit . "c09bb2b46d65afbd1d0febc6fded7495be7a3037") (:authors ("Matthew L. Fidler & Shane Celis")) (:maintainer "Matthew L. Fidler") (:keywords "folding" "emacs" "org-mode") (:url . "https://github.com/mlf176f2/fold-dwim-org"))]) + (fold-this . [(20191107 1816) nil "Just fold this region please" single ((:commit . "c3912c738cf0515f65162479c55999e2992afce5") (:authors ("Magnar Sveen" . "magnars@gmail.com")) (:maintainer "Magnar Sveen" . "magnars@gmail.com") (:keywords "convenience") (:url . "https://github.com/magnars/fold-this.el"))]) + (folding . [(20220110 1718) nil "A folding-editor-like minor mode." tar ((:commit . "1ce338b991c69358a607c37bfb16ffb7de7e91c4") (:maintainer "Jari Aalto ") (:keywords "tools"))]) + (font-lock-profiler . [(20170208 2008) ((emacs (24 3))) "Coverage and timing tool for font-lock keywords." single ((:commit . "6e096458416888a4f63cca0d6bc5965a052753c8") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "faces" "tools") (:url . "https://github.com/Lindydancer/font-lock-profiler"))]) + (font-lock-studio . [(20170127 2051) ((emacs (24 3))) "interactive debugger for Font Lock keywords." single ((:commit . "12c35967b31233e06946c70627aa3152dacfe261") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "faces" "tools") (:url . "https://github.com/Lindydancer/font-lock-studio"))]) + (font-utils . [(20210405 1149) ((persistent-soft (0 8 8)) (pcache (0 2 3))) "Utility functions for working with fonts" single ((:commit . "abc572eb0dc30a26584c0058c3fe6c7273a10003") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "extensions") (:url . "http://github.com/rolandwalker/font-utils"))]) + (fontawesome . [(20170305 1356) ((emacs (24 4))) "fontawesome utility" tar ((:commit . "a5fafe89d4032fd1f0c21b7b04708ef2cce2517b") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-fontawesome"))]) + (fontify-face . [(20210503 1956) ((emacs (24))) "Fontify symbols representing faces with that face." single ((:commit . "d1386c88ccc77ccfb40b888ff90d6181325d14f8") (:authors ("Matúš Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matúš Goljer" . "matus.goljer@gmail.com") (:keywords "faces") (:url . "https://github.com/Fuco1/fontify-face"))]) + (fontsloth . [(20211118 2018) ((f (0 20 0)) (logito (0 1)) (pcache (0 5)) (stream (2 2 5)) (emacs (28 0))) "Elisp otf/ttf font loader/renderer" tar ((:commit . "5572a44e14d6c00a628f58cc695c735ef64e0ebd") (:authors ("Jo Gay" . "jo.gay@mailfence.com")) (:maintainer "Jo Gay" . "jo.gay@mailfence.com") (:keywords "data" "font" "rasterization" "ttf" "otf") (:url . "https://github.com/jollm/fontsloth"))]) + (forecast . [(20191004 1850) ((emacs (24 4))) "Weather forecasts" single ((:commit . "350af0e5d53307c900e4f8b2617f3852f51a74d2") (:authors ("Göktuğ Kayaalp" . "self@gkayaalp.com")) (:maintainer "Göktuğ Kayaalp" . "self@gkayaalp.com") (:keywords "weather" "forecast") (:url . "https://dev.gkayaalp.com/elisp/index.html#forecast-el"))]) + (foreign-regexp . [(20200325 50) nil "search and replace by foreign regexp." tar ((:commit . "e2dd47f2160cadc194eb156e7c76c3c869e6706e") (:authors ("K-talo Miyazaki ")) (:maintainer "K-talo Miyazaki ") (:keywords "convenience" "emulations" "matching" "tools" "unix" "wp"))]) + (foreman-mode . [(20170725 1422) ((s (1 9 0)) (dash (2 10 0)) (dash-functional (1 2 0)) (f (0 17 2)) (emacs (24))) "View and manage Procfile-based applications" single ((:commit . "22b3bb13134b617870ed1e888af739f4818be929") (:authors ("ZHOU Feng" . "zf.pascal@gmail.com")) (:maintainer "ZHOU Feng" . "zf.pascal@gmail.com") (:keywords "foreman") (:url . "http://github.com/zweifisch/foreman-mode"))]) + (forest-blue-theme . [(20160627 842) ((emacs (24))) "Emacs theme with a dark background." single ((:commit . "58096ce1a25615d2bae806c3775bae3e2775019d") (:authors ("olkinn")) (:maintainer "olkinn"))]) + (forge . [(20220506 420) ((emacs (25 1)) (compat (28 1 1 0)) (closql (1 2 0)) (dash (2 19 1)) (emacsql-sqlite (3 0 0)) (ghub (3 5 4)) (let-alist (1 0 6)) (magit (3 3 0)) (markdown-mode (2 4)) (transient (0 3 6)) (yaml (0 3 4))) "Access Git forges from Magit." tar ((:commit . "05babf69068de7a982bd2e8ad888f37dc7319003") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "git" "tools" "vc") (:url . "https://github.com/magit/forge"))]) + (form-feed . [(20210508 1627) ((emacs (24 1))) "Display ^L glyphs as horizontal lines" single ((:commit . "ac1f0ef30a11979f5dfe12d8c05a666739e486ff") (:authors ("Vasilij Schneidermann" . "mail@vasilij.de")) (:maintainer "Vasilij Schneidermann" . "mail@vasilij.de") (:keywords "faces") (:url . "https://depp.brause.cc/form-feed"))]) + (format-all . [(20220412 1141) ((emacs (24 4)) (inheritenv (0 1)) (language-id (0 19))) "Auto-format C, C++, JS, Python, Ruby and 50 other languages" single ((:commit . "a07bf109ce8e27458a40420508943f53856549fc") (:authors ("Lassi Kortela" . "lassi@lassi.io")) (:maintainer "Lassi Kortela" . "lassi@lassi.io") (:keywords "languages" "util") (:url . "https://github.com/lassik/emacs-format-all-the-code"))]) + (format-sql . [(20150422 1333) nil "Use format-sql to make your SQL readable in directly Emacs." single ((:commit . "97f475c245cd6c81a72a265678e2087cee66ac7b") (:authors ("Friedrich Paetzke" . "paetzke@fastmail.fm")) (:maintainer "Friedrich Paetzke" . "paetzke@fastmail.fm") (:url . "https://github.com/paetzke/format-sql.el"))]) + (format-table . [(20181223 1616) ((emacs (25)) (dash (2 14 1))) "Parse and reformat tabular data." single ((:commit . "dfcae3a867e574577fc09a43b045889ff155b58f") (:authors ("Jason Duncan" . "jasond496@msn.com")) (:maintainer "Jason Duncan" . "jasond496@msn.com") (:keywords "data") (:url . "https://github.com/functionreturnfunction/format-table"))]) + (forth-mode . [(20220402 2103) nil "Programming language mode for Forth" tar ((:commit . "122a9916c1ad1f1e3f4888951e1ad92a2fc10804") (:authors ("Lars Brinkhoff" . "lars@nocrew.org")) (:maintainer "Lars Brinkhoff" . "lars@nocrew.org") (:keywords "languages" "forth") (:url . "http://github.com/larsbrinkhoff/forth-mode"))]) + (fortpy . [(20150715 2032) ((epc (0 1 0)) (auto-complete (1 4)) (python-environment (0 0 2)) (pos-tip (0 4 5))) "a Fortran auto-completion for Emacs" tar ((:commit . "c614517e9396ef7a78be3b8786fbf303879cf43b") (:authors ("Conrad Rosenbrock ")) (:maintainer "Conrad Rosenbrock "))]) + (fortune-cookie . [(20181223 842) nil "Print a fortune in your scratch buffer." single ((:commit . "6c1c08f5be83822c0b762872ab25e3dbee96f333") (:authors ("Andrew Schwartzmeyer" . "andrew@schwartzmeyer.com")) (:maintainer "Andrew Schwartzmeyer" . "andrew@schwartzmeyer.com") (:keywords "fortune" "cowsay" "scratch" "startup") (:url . "https://github.com/andschwa/fortune-cookie"))]) + (fountain-mode . [(20211223 405) ((emacs (24 4)) (seq (2 20))) "Major mode for screenwriting in Fountain markup" tar ((:commit . "fba17c2b316122e26292ba995f1c62191b7b3eb0") (:authors ("Paul W. Rankin" . "pwr@bydasein.com")) (:maintainer "Paul W. Rankin" . "pwr@bydasein.com") (:keywords "wp" "text") (:url . "https://github.com/rnkn/fountain-mode"))]) + (fraktur-mode . [(20160815 227) ((cl-lib (0 5))) "Easily insert Unicode mathematical Fraktur characters" single ((:commit . "514baf5546aed12a0d9fa0fe66e87cdcc7843b08") (:authors ("Grant Rettke" . "gcr@wisdomandwonder.com")) (:maintainer nil . "") (:keywords "unicode" "fraktur" "math" "mathematical") (:url . "https://github.com/grettke/fraktur-mode"))]) + (frame-local . [(20180330 940) ((emacs (25 1))) "Variables local to a frame" single ((:commit . "7ee1106c3bcd4022f48421f8cb1ef4f995da816e") (:authors ("Sebastien Chapuis" . "sebastien@chapu.is")) (:maintainer "Sebastien Chapuis" . "sebastien@chapu.is") (:keywords "frames" "tools" "local" "lisp") (:url . "https://github.com/sebastiencs/frame-local"))]) + (frame-mode . [(20190710 2030) ((s (1 9 0)) (emacs (24 4))) "Use frames instead of windows" single ((:commit . "ae2366969927c9f89ea07c999bef382b0b47cac1") (:authors ("Ivan Malison" . "IvanMalison@gmail.com")) (:maintainer "Ivan Malison" . "IvanMalison@gmail.com") (:keywords "frames") (:url . "https://github.com/IvanMalison/frame-mode"))]) + (frame-purpose . [(20211011 1518) ((emacs (25 1)) (dash (2 18))) "Purpose-specific frames" single ((:commit . "7d498147445cc0afb87b922a8225d2e163e5ed5a") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "buffers" "convenience" "frames") (:url . "http://github.com/alphapapa/frame-purpose.el"))]) + (frame-tag . [(20170111 6) ((cl-lib (0 5))) "Minor mode that assigns a unique number to each frame for easy switching" single ((:commit . "73d6163568c7d32952175e663318b872f995a4e5") (:authors ("Wong Liang Zan" . "zan@liangzan.net")) (:maintainer "Wong Liang Zan" . "zan@liangzan.net") (:keywords "frame" "movement") (:url . "http://github.com/liangzan/frame-tag.el"))]) + (frames-only-mode . [(20210107 918) ((emacs (24 4)) (dash (2 13 0)) (s (1 11 0))) "Use frames instead of Emacs windows" single ((:commit . "d3f6647c484656ddabdac5d18546599a03823cd4") (:authors ("David Shepherd" . "davidshepherd7@gmail.com")) (:maintainer "David Shepherd" . "davidshepherd7@gmail.com") (:keywords "frames" "windows") (:url . "https://github.com/davidshepherd7/frames-only-mode"))]) + (frameshot . [(20220509 2010) ((emacs (25 3)) (compat (28 1 1 0))) "Take screenshots of a frame" single ((:commit . "ea57484dbba917a437ad3a20ea956aa2275bdc9a") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "multimedia") (:url . "https://github.com/tarsius/frameshot"))]) + (framesize . [(20131017 2132) ((key-chord (0 5 20080915))) "change the size of frames in Emacs" single ((:commit . "f2dbf5d2513b2bc45f2085370a55c1754b6025da") (:authors ("Nic Ferrier" . "nferrier@ferrier.me.uk")) (:maintainer "Nic Ferrier" . "nferrier@ferrier.me.uk") (:keywords "frames") (:url . "http://github.com/nicferrier/emacs-framesize"))]) + (frecency . [(20170909 631) ((emacs (25 1)) (a (0 1)) (dash (2 13 0))) "Library for sorting items by frequency and recency of access" single ((:commit . "6d57aee131d96315aedf6cb7d6e5d6d09bf71503") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "libraries" "recency" "recent" "frequency" "frequent") (:url . "http://github.com/alphapapa/frecency.el"))]) + (frecentf . [(20210330 1521) ((emacs (26 1)) (frecency (0 1 -1)) (persist (0 4)) (async (1 9 4))) "Pervasive recentf using frecency" single ((:commit . "19e2c48a8b8c8ee8cae5c93b58b57a0aa81a8c46") (:authors ("Felipe Lema" . "felipel@mortemale.org")) (:maintainer "Felipe Lema" . "felipel@mortemale.org") (:keywords "files" "maint") (:url . "https://launchpad.net/frecentf.el"))]) + (free-keys . [(20211116 1501) ((cl-lib (0 3))) "Show free keybindings for modkeys or prefixes" single ((:commit . "7348ce68192871b8a69b687ec124d9f816d493ca") (:authors ("Matus Goljer" . "matus.goljer@gmail.com")) (:maintainer "Matus Goljer" . "matus.goljer@gmail.com") (:keywords "convenience") (:url . "https://github.com/Fuco1/free-keys"))]) + (freeradius-mode . [(20190401 1743) ((emacs (24 4))) "major mode for FreeRadius server config files" single ((:commit . "cf8bf0359cf6c77848facbd24b764b3e111b4c2d") (:url . "https://github.com/VersBinarii/freeradius-mode"))]) + (freeze-it . [(20220301 148) ((emacs (24 4))) "Minor mode to make your previous writing read-only" single ((:commit . "ad92e33a7ebd860905da60d194833516bf61cbf5") (:authors ("Paul W. Rankin" . "pwr@bydasein.com")) (:maintainer "Paul W. Rankin" . "pwr@bydasein.com") (:keywords "wp" "text") (:url . "https://github.com/rnkn/freeze-it"))]) + (friendly-remote-shell . [(20200527 830) ((emacs (24 1)) (cl-lib (0 6 1)) (with-shell-interpreter (0 2 3)) (friendly-tramp-path (0 1 0)) (friendly-shell (0 2 0))) "Human-friendly remote interactive shells" single ((:commit . "e530e359848e8bdad09d26529f17eb25e5558b3e") (:keywords "processes" "terminals") (:url . "https://github.com/p3r7/friendly-shell"))]) + (friendly-shell . [(20220309 1711) ((emacs (24 1)) (cl-lib (0 6 1)) (dash (2 17 0)) (with-shell-interpreter (0 2 4))) "Better shell-mode API" single ((:commit . "e530e359848e8bdad09d26529f17eb25e5558b3e") (:keywords "processes" "terminals") (:url . "https://github.com/p3r7/friendly-shell"))]) + (friendly-shell-command . [(20200527 830) ((emacs (24 1)) (cl-lib (0 6 1)) (dash (2 17 0)) (with-shell-interpreter (0 2 3))) "Better shell-command API" single ((:commit . "e530e359848e8bdad09d26529f17eb25e5558b3e") (:keywords "processes" "terminals") (:url . "https://github.com/p3r7/friendly-shell"))]) + (friendly-tramp-path . [(20200502 1032) ((cl-lib (0 6 1))) "Human-friendly TRAMP path construction" single ((:commit . "be572b8953b9e5a3a35c30bb64c2936d3e9802ba") (:url . "https://github.com/p3r7/prf-tramp"))]) + (fringe-current-line . [(20140111 411) nil "show current line on the fringe." single ((:commit . "0ef000bac76abae30601222e6f06c7d133ab4942") (:authors ("Kouhei Yanagita" . "yanagi@shakenbu.org")) (:maintainer "Kouhei Yanagita" . "yanagi@shakenbu.org") (:url . "http://github.com/kyanagi/fringe-current-line/raw/master/fringe-current-line.el"))]) + (fringe-helper . [(20140620 2109) nil "helper functions for fringe bitmaps" single ((:commit . "ef4a9c023bae18ec1ddd7265f1f2d6d2e775efdd") (:authors ("Nikolaj Schumacher ")) (:maintainer "Nikolaj Schumacher ") (:keywords "lisp") (:url . "http://nschum.de/src/emacs/fringe-helper/"))]) + (frog-jump-buffer . [(20220414 1935) ((emacs (24)) (avy (0 4 0)) (dash (2 4 0)) (frog-menu (0 2 8))) "The fastest buffer-jumping Emacs lisp package around." single ((:commit . "ff0cfe9cb4a60d855f0754b741a9417ee413dee0") (:authors ("Justin Talbott")) (:maintainer "Justin Talbott") (:keywords "convenience" "tools") (:url . "https://github.com/waymondo/frog-jump-buffer"))]) + (frontside-javascript . [(20220315 1057) ((emacs (25 1)) (add-node-modules-path (1 2 0)) (company (0 9 2)) (flycheck (20201228 2104)) (js2-mode (20201220)) (js2-refactor (0 9 0)) (rjsx-mode (0 5 0)) (tide (4 0 2)) (web-mode (17)) (lsp-mode (20220124))) "JS development that just work™️" tar ((:commit . "18816534a977fbd28848389b58c22b6538cfdeec") (:authors ("Frontside Engineering" . "engineering@frontside.com")) (:maintainer "Frontside Engineering" . "engineering@frontside.com") (:keywords "files" "tools") (:url . "https://github.com/thefrontside/frontmacs"))]) + (fsbot-data-browser . [(20160921 1533) nil "browse the fsbot database using tabulated-list-mode" single ((:commit . "6bca4f7de63e31839d2542f6c678b79931dec344") (:authors ("Benaiah Mischenko")) (:maintainer "Benaiah Mischenko") (:keywords "fsbot" "irc" "tabulated-list-mode") (:url . "http://github.com/benaiah/fsbot-data-browser"))]) + (fsharp-mode . [(20220429 1847) ((emacs (25))) "Support for the F# programming language" tar ((:commit . "5208b54098c7534f4768b87c5f4c8a01b638737b") (:authors ("1993-1997 Xavier Leroy, Jacques Garrigue and Ian T Zimmerman") ("2010-2011 Laurent Le Brun" . "laurent@le-brun.eu") ("2012-2014 Robin Neatherway" . "robin.neatherway@gmail.com") ("2017-2022 Jürgen Hötzel")) (:maintainer "Jürgen Hötzel") (:keywords "languages"))]) + (fstar-mode . [(20220106 2256) ((emacs (24 3)) (dash (2 11)) (company (0 8 12)) (quick-peek (1 0)) (yasnippet (0 11 0)) (flycheck (30 0)) (company-quickhelp (2 2 0))) "Support for F* programming" tar ((:commit . "c95c2a61a6c42a1fa8bab9a8eb812a41be3e6f69") (:authors ("Clément Pit-Claudel" . "clement.pitclaudel@live.com")) (:maintainer "Clément Pit-Claudel" . "clement.pitclaudel@live.com") (:keywords "convenience" "languages") (:url . "https://github.com/FStarLang/fstar-mode.el"))]) + (fuel . [(20211221 2127) ((cl-lib (0 2)) (emacs (24 2))) "Major mode for the Factor programming language." tar ((:commit . "b90d529eacb643421991f94288151e72ed573b55"))]) + (fuff . [(20170202 1503) ((seq (2 3))) "Find files with findutils, recursively" single ((:commit . "278e849913df87bd8756c59382282d87474802c3") (:authors ("Joel Moberg")) (:maintainer "Joel Moberg") (:keywords "files" "project" "convenience") (:url . "https://github.com/joelmo/fuff"))]) + (full-ack . [(20140223 1732) nil "a front-end for ack" single ((:commit . "761d846e105b150f8e6d13d7a8983f0248313a45") (:authors ("Nikolaj Schumacher ")) (:maintainer "Nikolaj Schumacher ") (:keywords "tools" "matching") (:url . "http://nschum.de/src/emacs/full-ack/"))]) + (fullframe . [(20210226 1057) ((cl-lib (0 5))) "Generalized automatic execution in a single frame" single ((:commit . "886b831c001b44ec95aec4ff36e8bc1b3003c786") (:authors ("Tom Regner" . "tom@goochesa.de")) (:maintainer "Tom Regner" . "tom@goochesa.de") (:keywords "fullscreen"))]) + (function-args . [(20211231 1150) ((ivy (0 9 1))) "C++ completion for GNU Emacs" tar ((:commit . "503e78fad9e7741ef4b8f5c24ff70c8909240db2") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:url . "https://github.com/abo-abo/function-args"))]) + (fuo . [(20190812 927) ((emacs (24 4))) "feeluown client." single ((:commit . "0e4122f94a336a50c02bc96652d25ac3d74bedeb") (:authors ("cosven" . "yinshaowen241@gmail.com")) (:maintainer "cosven" . "yinshaowen241@gmail.com") (:keywords "feeluown" "multimedia" "unix") (:url . "http://github.com/cosven/emacs-fuo"))]) + (furl . [(20150509 316) nil "Friendly URL retrieval" single ((:commit . "014438271e0ef27333dfcd599cb247f12a20d870") (:authors ("Natalie Weizenbaum" . "nweiz@google.com")) (:maintainer "Natalie Weizenbaum" . "nweiz@google.com"))]) + (futhark-mode . [(20220425 1144) ((emacs (24 3)) (cl-lib (0 5))) "major mode for editing Futhark source files" tar ((:commit . "7fd0a3c6c96ed8afd0249ab0734d9b63d4fd1cb1") (:keywords "languages") (:url . "https://github.com/diku-dk/futhark-mode"))]) + (fuz . [(20200104 524) ((emacs (25 1))) "Fast and precise fuzzy scoring/matching utils" tar ((:commit . "fee874aa35d2ee6b12b836290b5c8eaa44175a28") (:authors ("Zhu Zihao" . "all_but_last@163.com")) (:maintainer "Zhu Zihao" . "all_but_last@163.com") (:keywords "lisp") (:url . "https://github.com/cireu/fuz.el"))]) + (fuzzy . [(20211231 1837) ((emacs (24 3))) "Fuzzy Matching" single ((:commit . "7691a73a85f014a34cc161650e989801f2aba5a3") (:authors ("Tomohiro Matsuyama" . "m2ym.pub@gmail.com")) (:maintainer "Tomohiro Matsuyama" . "m2ym.pub@gmail.com") (:keywords "convenience") (:url . "https://github.com/auto-complete/fuzzy-el"))]) + (fuzzy-finder . [(20210906 217) ((emacs (24 4))) "Fuzzy Finder App Integration" single ((:commit . "915a281fc8e50df84dcc205f9357e8314d60fa54") (:authors ("10sr" . "8.slashes@gmail.com")) (:maintainer "10sr" . "8.slashes@gmail.com") (:keywords "matching") (:url . "https://github.com/10sr/fuzzy-finder-el"))]) + (fvwm-mode . [(20160411 1138) nil "A major mode for editing Fvwm configuration files" single ((:commit . "6832a1c1f68bf6249c3fd6672ea8e27dc7a5c79e") (:authors ("Bert Geens" . "bert@lair.be")) (:maintainer "Bert Geens" . "bert@lair.be") (:keywords "files") (:url . "https://github.com/theBlackDragon/fvwm-mode"))]) + (fwb-cmds . [(20220422 1610) ((emacs (25 1)) (compat (28 1 1 0))) "misc frame, window and buffer commands" single ((:commit . "e6eeac7552b61d4f7abd51aff6ce72394133663e") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "convenience") (:url . "https://github.com/tarsius/fwb-cmds"))]) + (fxrd-mode . [(20170728 1801) ((s (1 2))) "Major mode for editing fixed field width files" tar ((:commit . "18a603474abb5a786a8d9f20c283d5f7beed3540") (:authors ("Marc Sherry" . "msherry@gmail.com")) (:maintainer "Marc Sherry" . "msherry@gmail.com") (:keywords "convenience") (:url . "https://github.com/msherry/fxrd-mode"))]) + (fyure . [(20130216 1314) nil "An interface to fix Japanese hyoki-yure" tar ((:commit . "b6977f1eb148e8b63259f7233b55bb050e44d9b8") (:authors ("Masafumi Oyamada" . "stillpedant@gmail.com")) (:maintainer "Masafumi Oyamada" . "stillpedant@gmail.com") (:keywords "languages"))]) + (fzf . [(20211228 2005) ((emacs (24 4))) "A front-end for fzf." single ((:commit . "d61cecbdb60b0f10cecd50ff2ae115aeb77f9fdc") (:authors ("Bailey Ling")) (:maintainer "Bailey Ling") (:keywords "fzf" "fuzzy" "search") (:url . "https://github.com/bling/fzf.el"))]) + (gameoflife . [(20200614 1814) nil "Screensaver running Conway's Game of Life" single ((:commit . "2483f3d98dbcf7f1633f551cc3691f5659b4b942") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "games") (:url . "https://github.com/Lindydancer/gameoflife"))]) + (gams-ac . [(20180423 926) ((emacs (24)) (auto-complete (1 0)) (gams-mode (4 0))) "auto-complete source file for GAMS mode" single ((:commit . "66d04ff36033f54205c19bc1d893e926d4dbf02e") (:authors ("Shiro Takeda")) (:maintainer "Shiro Takeda") (:keywords "languages" "tools" "gams-mode" "auto-complete") (:url . "https://github.com/ShiroTakeda/gams-ac"))]) + (gams-mode . [(20220501 1507) ((emacs (24 3))) "Major mode for General Algebraic Modeling System (GAMS)" tar ((:commit . "1964d9a52693f3aa9279eed8864bc317ee5c6dc4") (:authors ("Shiro Takeda")) (:maintainer "Shiro Takeda") (:keywords "languages" "tools" "gams") (:url . "http://shirotakeda.org/en/gams/gams-mode/"))]) + (gandalf-theme . [(20130809 947) nil "Gandalf color theme" single ((:commit . "4e472fc851431458537d458d09c1f5895e338536") (:authors ("Peter Vasil" . "mail@petervasil.net")) (:maintainer "Peter Vasil" . "mail@petervasil.net") (:keywords "color" "theme"))]) + (gap-mode . [(20220503 1555) nil "Major mode for editing files in the GAP programing language." tar ((:commit . "99237f714c28981142674e8cfeb155863c834858") (:authors ("Michael Smith" . "smith@pell.anu.edu.au") ("Gary Zablackis") ("Goetz Pfeiffer") ("Ivan Andrus" . "darthandrus@gmail.com")) (:maintainer "Ivan Andrus" . "darthandrus@gmail.com") (:keywords "gap") (:url . "https://gitlab.com/gvol/gap-mode"))]) + (gather . [(20141230 1338) nil "Gather string in buffer." single ((:commit . "50809fbc22d70a1c724c2dd99ac5a1f818ffeb6b") (:authors ("Masahiro Hayashi" . "mhayashi1120@gmail.com")) (:maintainer "Masahiro Hayashi" . "mhayashi1120@gmail.com") (:keywords "matching" "convenience" "tools") (:url . "https://github.com/mhayashi1120/Emacs-gather/raw/master/gather.el"))]) + (gcmh . [(20201116 2251) ((emacs (24))) "the Garbage Collector Magic Hack" single ((:commit . "0089f9c3a6d4e9a310d0791cf6fa8f35642ecfd9") (:authors ("Andrea Corallo" . "akrl@sdf.org")) (:maintainer nil . "akrl@sdf.org") (:keywords "internal") (:url . "https://gitlab.com/koral/gcmh"))]) + (gcode-mode . [(20210522 1025) ((emacs (24 4))) "Simple G-Code major mode" tar ((:commit . "1f83845af4102efc5e5856b55bd5ad165b2f0cdd") (:authors ("Yuri D'Elia" . "wavexx@thregr.org")) (:maintainer "Yuri D'Elia" . "wavexx@thregr.org") (:keywords "gcode" "languages" "highlight" "syntax") (:url . "https://gitlab.com/wavexx/gcode-mode.el"))]) + (gdscript-mode . [(20210328 2037) ((emacs (26 3))) "Major mode for Godot's GDScript language" tar ((:commit . "4badcf6a0c951daba4d7259db3913b78254c0423") (:authors ("Nathan Lovato , Fabián E. Gallina" . "fgallina@gnu.org")) (:maintainer nil . "nathan@gdquest.com") (:keywords "languages") (:url . "https://github.com/godotengine/emacs-gdscript-mode/"))]) + (geben . [(20210830 422) ((emacs (24 3)) (cl-lib (0 5))) "DBGp protocol frontend, a script debugger" tar ((:commit . "d3706387ed25b3037338572f3968b4cc2d8825a0") (:authors ("Matthew Carter" . "m@ahungry.com")) (:maintainer "Matthew Carter" . "m@ahungry.com") (:keywords "c" "comm" "tools") (:url . "https://github.com/ahungry/geben"))]) + (geben-helm-projectile . [(20160611 59) ((emacs (24)) (geben (0 26)) (helm-projectile (0 13 0))) "Integrate helm-projectile with geben" single ((:commit . "31ce0faca5dcc71924884f03fd5a7a25d00ccd9b") (:authors ("Matthew Carter" . "m@ahungry.com")) (:maintainer "Matthew Carter" . "m@ahungry.com") (:keywords "ahungry" "emacs" "geben" "helm" "projectile" "debug") (:url . "https://github.com/ahungry/geben-helm-projectile"))]) + (geeknote . [(20220213 612) ((emacs (24))) "Use Evernote in Emacs through geeknote" single ((:commit . "ce2738aebeeda35f9d31027e9b7bad0813b975c3") (:authors ("Evan Dale Aromin")) (:maintainer "Evan Dale Aromin") (:keywords "evernote" "geeknote" "note" "emacs-evernote" "evernote-mode") (:url . "http://github.com/avendael/emacs-geeknote"))]) + (geiser . [(20220507 34) ((emacs (25 1)) (transient (0 3)) (project (0 8 1))) "GNU Emacs and Scheme talk to each other" tar ((:commit . "d28d19b582347bffebbf0ca905297e744842a5f2") (:authors ("Jose Antonio Ortega Ruiz" . "jao@gnu.org")) (:maintainer "Jose Antonio Ortega Ruiz" . "jao@gnu.org") (:keywords "languages" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/"))]) + (geiser-chez . [(20211216 2332) ((emacs (26 1)) (geiser (0 19))) "Chez Scheme's implementation of the geiser protocols" tar ((:commit . "48427d4aecc6fed751d266673f1ce2ad57ddbcfc") (:authors ("Peter" . "craven@gmx.net")) (:maintainer "Jose A Ortega Ruiz" . "jao@gnu.org") (:keywords "languages" "chez" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/chez"))]) + (geiser-chibi . [(20211204 1938) ((emacs (24 4)) (geiser (0 18))) "Chibi Scheme's implementation of the geiser protocols" tar ((:commit . "5a6a5a580ea45cd4974df21629a8d50cbe3d6e99") (:authors ("Peter" . "craven@gmx.net")) (:maintainer "Jose A Ortega Ruiz" . "jao@gnu.org") (:keywords "languages" "chibi" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/chibi"))]) + (geiser-chicken . [(20211204 2049) ((emacs (24 4)) (geiser (0 19))) "Chicken's implementation of the geiser protocols" tar ((:commit . "79a9ac78f4df7c9ec1f918313c543c116dbb8b70") (:authors ("Daniel Leslie")) (:maintainer "Daniel Leslie") (:keywords "languages" "chicken" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/chicken"))]) + (geiser-gambit . [(20220208 1356) ((emacs (26 1)) (geiser (0 18))) "Gambit's implementation of the geiser protocols" tar ((:commit . "381d74ca5059b44fe3d8b5daf42214019c6d1a88") (:authors ("Daniel Leslie")) (:maintainer "Jose A Ortega Ruiz" . "jao@gnu.org") (:keywords "languages" "gambit" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/gambit"))]) + (geiser-gauche . [(20220503 1700) ((emacs (26 1)) (geiser (0 11 2))) "Gauche scheme support for Geiser" tar ((:commit . "8ff743f6416f00751e24aef8b9791501a40f5421") (:authors ("András Simonyi" . "andras.simonyi@gmail.com")) (:maintainer "András Simonyi" . "andras.simonyi@gmail.com") (:keywords "languages" "gauche" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/gauche"))]) + (geiser-guile . [(20220323 2352) ((emacs (25 1)) (geiser (0 23 2))) "Guile's implementation of the geiser protocols" tar ((:commit . "c641fcc50b6b86ca95743122b5206cdcd475f96e") (:authors ("Jose Antonio Ortega Ruiz" . "jao@gnu.org")) (:maintainer "Jose Antonio Ortega Ruiz" . "jao@gnu.org") (:keywords "languages" "guile" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/guile"))]) + (geiser-kawa . [(20210920 1607) ((emacs (26 1)) (geiser (0 16))) "Kawa scheme support for Geiser" tar ((:commit . "5896b19642923f74f718eb68d447560b2d26d797") (:authors ("spellcard199" . "spellcard199@protonmail.com")) (:maintainer "spellcard199" . "spellcard199@protonmail.com") (:keywords "languages" "kawa" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/kawa"))]) + (geiser-mit . [(20211204 1935) ((emacs (24 4)) (geiser (0 18))) "MIT/GNU Scheme's implementation of the geiser protocols" tar ((:commit . "4e90e9ae815e89f3540fb9644e6016c663ef5765") (:authors ("Peter" . "craven@gmx.net")) (:maintainer "Jose A Ortega Ruiz" . "jao@gnu.org") (:keywords "languages" "mit" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/mit"))]) + (geiser-racket . [(20210421 125) ((emacs (26 1)) (geiser (0 16))) "Support for Racket in Geiser" tar ((:commit . "22e56ce80389544d3872cf4beb4008fb514b2218") (:authors ("Jose Antonio Ortega Ruiz" . "jao@gnu.org")) (:maintainer "Jose Antonio Ortega Ruiz" . "jao@gnu.org") (:keywords "languages" "racket" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/racket"))]) + (geiser-stklos . [(20211117 2114) ((emacs (24 4)) (geiser (0 16))) "STklos Scheme implementation of the geiser protocols" single ((:commit . "9db60a7e751c97e30dd528e2a96ff19575b618d2") (:authors ("Jeronimo Pellegrini" . "j_p@aleph0.info")) (:maintainer "Jeronimo Pellegrini" . "j_p@aleph0.info") (:keywords "languages" "stklos" "scheme" "geiser") (:url . "https://gitlab.com/emacs-geiser/stklos"))]) + (gemini-mode . [(20210909 1442) ((emacs (24 4))) "A simple highlighting package for text/gemini" single ((:commit . "60bd07b3a1e532c950c132673777ceb635c9960d") (:authors ("Jason McBrayer , tastytea , Étienne Deparis" . "etienne@depar.is")) (:maintainer "Jason McBrayer , tastytea , Étienne Deparis" . "etienne@depar.is") (:keywords "languages") (:url . "https://git.carcosa.net/jmcbray/gemini.el"))]) + (gemini-write . [(20211114 1032) ((emacs (26)) (elpher (2 8 0)) (gemini-mode (1 0 0))) "Elpher for Titan" single ((:commit . "2a7d07d0ce4c5b8750f3ff1182ad94ee616734c8") (:authors ("Alex Schroeder" . "alex@gnu.org")) (:maintainer "Alex Schroeder" . "alex@gnu.org") (:keywords "comm" "gemini") (:url . "https://alexschroeder.ch/cgit/gemini-write"))]) + (general . [(20211203 120) ((emacs (24 4)) (cl-lib (0 5))) "Convenience wrappers for keybindings." tar ((:commit . "9651024e7f40a8ac5c3f31f8675d3ebe2b667344") (:authors ("Fox Kiester" . "noct@posteo.net")) (:maintainer "Fox Kiester" . "noct@posteo.net") (:keywords "vim" "evil" "leader" "keybindings" "keys") (:url . "https://github.com/noctuid/general.el"))]) + (genrnc . [(20140612 1237) ((deferred (0 3 1)) (concurrent (0 3)) (log4e (0 2 0)) (yaxception (0 1))) "generate RELAX NG Compact Schema from RELAX NG Schema, XML Schema and DTD." tar ((:commit . "da75b1966a73ad215ec2ced4522c25f4d0bf1f9a") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "xml") (:url . "https://github.com/aki2o/emacs-genrnc"))]) + (geoip . [(20200310 911) ((emacs (25 1))) "Find out where an IP address is located via GeoIP2" single ((:commit . "25eb1278788b942c38405c233d3614a1de92ddea") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:keywords "tools") (:url . "https://github.com/xuchunyang/geoip.el"))]) + (geolocation . [(20200317 1559) ((request-deferred (0 3 2)) (deferred (0 5 1)) (emacs (25 1))) "Get your location on Earth" single ((:commit . "bc7848832eb0352e3a71f4b9d89d917fe12d18be") (:authors ("Neil Okamoto" . "neil.okamoto+melpa@gmail.com")) (:maintainer "Neil Okamoto" . "neil.okamoto+melpa@gmail.com") (:keywords "hardware") (:url . "https://github.com/gonewest818/geolocation.el"))]) + (german-holidays . [(20181213 644) nil "German holidays for Emacs calendar" single ((:commit . "a8462dffccaf2b665f2032e646b5370e993a386a") (:authors ("Sebastian Christ" . "rudolfo.christ@gmail.com")) (:maintainer "Sebastian Christ" . "rudolfo.christ@gmail.com") (:url . "https://github.com/rudolfochrist/german-holidays"))]) + (germanium . [(20220116 1634) ((emacs (26 1))) "Generate image from source code using germanium" single ((:commit . "54c9a56da1e86941f2580d4838fbb6097f22f349") (:authors ("Masaya Watanabe")) (:maintainer "Masaya Watanabe") (:keywords "convenience") (:url . "https://github.com/matsuyoshi30/germanium-el"))]) + (gerrit . [(20220508 704) ((emacs (25 1)) (magit (2 13 1)) (s (1 12 0)) (dash (0 2 15))) "Gerrit client" tar ((:commit . "2ca9cf999534a94c9aa93b393f30ed373eb2ed86") (:authors ("Thomas Hisch" . "t.hisch@gmail.com")) (:maintainer "Thomas Hisch" . "t.hisch@gmail.com") (:keywords "extensions") (:url . "https://github.com/thisch/gerrit.el"))]) + (gerrit-download . [(20150714 1408) ((emacs (24 0)) (magit (2 1 0))) "Show gerrit reviews in a diff buffer." single ((:commit . "d568acc7c5935188c9bc19ba72719a6092d9f6fd") (:authors ("Chmouel Boudjnah" . "chmouel@chmouel.com")) (:maintainer "Chmouel Boudjnah" . "chmouel@chmouel.com") (:keywords "tools" "gerrit" "git") (:url . "https://github.com/chmouel/gerrit-download.el"))]) + (gf . [(20181028 1542) ((s (1 0)) (ht (2 0))) "Major mode for editing GF code" single ((:commit . "30b3127f229e0db522c7752f6957ca01b2ea2821") (:authors ("Johan Bockgård" . "bojohan+mail@dd.chalmers.se")) (:maintainer "bruno cuconato" . "bcclaro+emacs@gmail.com") (:keywords "languages") (:url . "https://github.com/GrammaticalFramework/gf-emacs-mode"))]) + (ggo-mode . [(20210310 1345) nil "Gengetopt major mode" single ((:commit . "6a7617b5af3d13029e4d680a375e8107c40d0fac") (:authors ("Matthew K. Junker" . "junker@alum.mit.edu")) (:maintainer "Matthew K. Junker" . "junker@alum.mit.edu") (:keywords "extensions" "convenience" "local"))]) + (ggtags . [(20220420 1610) ((emacs (25))) "emacs frontend to GNU Global source code tagging system" single ((:commit . "22d3a3a951cb605d29138f1acee191ef674a4518") (:authors ("Leo Liu" . "sdl.web@gmail.com")) (:maintainer "Leo Liu" . "sdl.web@gmail.com") (:keywords "tools" "convenience") (:url . "https://github.com/leoliu/ggtags"))]) + (gh . [(20220302 549) ((emacs (25 1)) (pcache (0 4 2)) (logito (0 1)) (marshal (0 9 0)) (cl-lib (0 3))) "A GitHub library for Emacs" tar ((:commit . "27ccc892e94f7e747e5b879eec71119965d9ed6e") (:authors ("Yann Hodique" . "yhodique@gmail.com")) (:maintainer "Yann Hodique" . "yhodique@gmail.com") (:url . "https://github.com/sigma/gh.el"))]) + (gh-md . [(20220316 1432) ((emacs (24 3))) "Render markdown using the Github api" single ((:commit . "e721fd5e41e682f47f2dd4ce26ef2ba28c7fa0b5") (:authors ("Mario Rodas" . "marsam@users.noreply.github.com")) (:maintainer "Mario Rodas" . "marsam@users.noreply.github.com") (:keywords "convenience") (:url . "https://github.com/emacs-pe/gh-md.el"))]) + (gh-notify . [(20211126 638) ((emacs (27 1)) (magit (3 0 0)) (forge (0 2 0))) "A veneer for Magit/Forge GitHub notifications" single ((:commit . "aa4d8bc0c56366d437e7c126e7eedc5938109342") (:authors ("Bas Alberts" . "bas@anti.computer") ("xristos" . "xristos@sdf.org")) (:maintainer "Bas Alberts" . "bas@anti.computer") (:keywords "comm") (:url . "https://github.com/anticomputer/gh-notify"))]) + (ghc-imported-from . [(20141124 1932) ((emacs (24 1))) "Haskell documentation lookup with ghc-imported-from" single ((:commit . "fcff08628a19f5d26151564659218cc677779b79") (:authors ("David Raymond Christiansen" . "david@davidchristiansen.dk")) (:maintainer "David Raymond Christiansen" . "david@davidchristiansen.dk") (:keywords "languages"))]) + (ghci-completion . [(20151125 1257) ((emacs (24 1)) (cl-lib (0 5))) "Completion for GHCi commands in inferior-haskell buffers" single ((:commit . "c47e23d585d2a3c7b13aac163693fdc4f2bb90e5") (:authors ("Oleksandr Manzyuk" . "manzyuk@gmail.com")) (:maintainer "Oleksandr Manzyuk" . "manzyuk@gmail.com") (:keywords "convenience"))]) + (gherkin-mode . [(20171224 1353) nil "An emacs major mode for editing gherkin files." single ((:commit . "0313492e7da152f0aa73ddf96c0287ded8f51253") (:authors ("Craig Andera")) (:maintainer "Craig Andera") (:keywords "languages"))]) + (ghost-blog . [(20171023 742) ((markdown-mode (1 0))) "A package to manage Ghost blog" single ((:commit . "71b358643cc9a2db1bf752281ff94aba9b59e4cc") (:authors ("Javier Aguirre" . "hello@javaguirre.net")) (:maintainer "Javier Aguirre" . "hello@javaguirre.net") (:keywords "ghost" "blog") (:url . "https://github.com/javaguirre/ghost-blog"))]) + (ghq . [(20210504 902) nil "Ghq interface for emacs" single ((:commit . "582bd6daa505d04c7cc06d6c82ed8aee0624bfbe") (:authors ("Roman Coedo" . "romancoedo@gmail.com")) (:maintainer "Roman Coedo" . "romancoedo@gmail.com") (:keywords "ghq"))]) + (ghub . [(20220429 1708) ((emacs (25 1)) (compat (28 1 1 0)) (let-alist (1 0 6)) (treepy (0 1 1))) "Client libraries for Git forge APIs." tar ((:commit . "f14c1bc84135fe149c42348dce6eaa23ba610224") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "tools") (:url . "https://github.com/magit/ghub"))]) + (ghub+ . [(20191229 1748) ((emacs (25)) (ghub (2 0)) (apiwrap (0 5))) "a thick GitHub API client built on ghub" single ((:commit . "b1adef2402d7599911d4dd447a987a0cea04e6fe") (:authors ("Sean Allred" . "code@seanallred.com")) (:maintainer "Sean Allred" . "code@seanallred.com") (:keywords "extensions" "multimedia" "tools") (:url . "https://github.com/vermiculus/ghub-plus"))]) + (gif-screencast . [(20210401 656) ((emacs (25 1))) "One-frame-per-action GIF recording" single ((:commit . "5517a557a17d8016c9e26b0acb74197550f829b9") (:authors ("Pierre Neidhardt" . "mail@ambrevar.xyz")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:keywords "multimedia" "screencast") (:url . "https://gitlab.com/ambrevar/emacs-gif-screencast"))]) + (gift-mode . [(20210528 1459) nil "major mode for editing GIFT format quizzes" single ((:commit . "c93354e8fe1173b22f398f17b127875807f15b87") (:authors ("Christophe Rhodes" . "christophe@rhodes.io")) (:maintainer "Christophe Rhodes" . "christophe@rhodes.io") (:url . "https://github.com/csrhodes/gift-mode"))]) + (gildas-mode . [(20181022 649) ((polymode (0 1 5)) (emacs (25))) "Major mode for Gildas" single ((:commit . "d0c9e997e2aa0bcd9b8b7db082d69100448cb1b2") (:authors ("Sébastien Maret" . "sebastien.maret@icloud.com")) (:maintainer "Sébastien Maret" . "sebastien.maret@icloud.com") (:keywords "languages" "gildas") (:url . "https://github.com/smaret/gildas-mode"))]) + (gist . [(20171128 406) ((emacs (24 1)) (gh (0 10 0))) "Emacs integration for gist.github.com" single ((:commit . "314fe6ab80fae35b95f0734eceb82f72813b6f41") (:authors ("Yann Hodique" . "yann.hodique@gmail.com")) (:maintainer "Yann Hodique" . "yann.hodique@gmail.com") (:keywords "tools") (:url . "https://github.com/defunkt/gist.el"))]) + (git . [(20140128 1041) ((s (1 7 0)) (dash (2 2 0)) (f (0 10 0))) "An Elisp API for programmatically using Git" single ((:commit . "a3396a7027a7d986598c6a2d6d5599bac918f3da") (:authors ("Johan Andersson" . "johan.rejeep@gmail.com")) (:maintainer "Johan Andersson" . "johan.rejeep@gmail.com") (:keywords "git") (:url . "http://github.com/rejeep/git.el"))]) + (git-annex . [(20190625 2118) nil "Mode for easy editing of git-annex'd files" single ((:commit . "1324d3f23c534fe79391a2c256bb8803054e383b") (:authors ("John Wiegley" . "jwiegley@gmail.com")) (:maintainer "John Wiegley" . "jwiegley@gmail.com") (:keywords "files" "data" "git" "annex") (:url . "https://github.com/jwiegley/git-annex-el"))]) + (git-assembler-mode . [(20210207 1545) ((emacs (24 4))) "git-assembler major mode" single ((:commit . "1243bdc1a9cdc79802ece05c90731ee14e4f92c9") (:authors ("Yuri D'Elia" . "wavexx@thregr.org")) (:maintainer "Yuri D'Elia" . "wavexx@thregr.org") (:keywords "git" "git-assembler" "languages" "highlight" "syntax") (:url . "https://gitlab.com/wavexx/git-assembler-mode.el"))]) + (git-attr . [(20180925 2003) ((emacs (24 3))) "Git attributes of buffer file" tar ((:commit . "50df0630eba2a931146f676d349b29bde6b6b37b") (:authors ("Arne Jørgensen" . "arne@arnested.dk")) (:maintainer "Arne Jørgensen" . "arne@arnested.dk") (:keywords "vc") (:url . "https://github.com/arnested/emacs-git-attr"))]) + (git-auto-commit-mode . [(20200828 653) nil "Emacs Minor mode to automatically commit and push" single ((:commit . "a6b6e0fa183be381463e2b44ef128db1b6c4234b") (:authors ("Tom Willemse" . "tom@ryuslash.org")) (:maintainer "Tom Willemse" . "tom@ryuslash.org") (:keywords "vc") (:url . "https://github.com/ryuslash/git-auto-commit-mode"))]) + (git-backup . [(20191209 2144) ((emacs (24 3)) (s (1 8 0))) "Backup each file change using git" single ((:commit . "67e38c659c918e98642171ba3f385a15182347f4") (:authors ("Anthony HAMON" . "hamon.anth@gmail.com")) (:maintainer "Anthony HAMON" . "hamon.anth@gmail.com") (:keywords "backup" "files" "tools" "git") (:url . "http://github.com/antham/git-backup"))]) + (git-backup-ivy . [(20220412 1914) ((ivy (0 12 0)) (git-backup (0 0 1)) (emacs (25 1))) "An ivy interface to git-backup" single ((:commit . "c53e1bc800963c0d826226c37c22e36f2353c70d") (:authors ("Sebastian Wålinder" . "s.walinder@gmail.com")) (:maintainer "Sebastian Wålinder" . "s.walinder@gmail.com") (:keywords "backup" "convenience" "files" "tools" "vc") (:url . "https://github.com/walseb/git-backup-ivy"))]) + (git-blamed . [(20161028 1926) nil "Minor mode for incremental blame for Git" single ((:commit . "cef196abf398e2dd11f775d1e6cd8690567408aa") (:keywords "git" "version control" "release management"))]) + (git-command . [(20191028 333) ((term-run (0 1 4)) (with-editor (2 3 1))) "A Git Command-Line interface" single ((:commit . "a773d40da39dfb1c6ecf2b0758aa370ddea8f06d") (:authors ("10sr <8slashes+el [at] gmail [dot] com>")) (:maintainer "10sr <8slashes+el [at] gmail [dot] com>") (:keywords "utility" "git") (:url . "https://github.com/10sr/git-command-el"))]) + (git-commit . [(20220506 1936) ((emacs (25 1)) (compat (28 1 1 0)) (transient (20210920)) (with-editor (20211001))) "Edit Git commit messages." tar ((:commit . "125a8d5e417dda4438ce41d71a821d8a936fa5ea") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li") ("Sebastian Wiesner" . "lunaryorn@gmail.com") ("Florian Ragwitz" . "rafl@debian.org") ("Marius Vollmer" . "marius.vollmer@gmail.com")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "git" "tools" "vc") (:url . "https://github.com/magit/magit"))]) + (git-commit-insert-issue . [(20210107 2018) ((emacs (25)) (projectile (0)) (s (0)) (ghub (0)) (bitbucket (0))) "Get issues list when typing \"Fixes #\"" single ((:commit . "6cfb8b4b5b23ae881cf3d005da4d7f60d91cd2cd") (:authors ("Vindarel")) (:maintainer "Vindarel") (:keywords "tools" "vc" "github" "gitlab" "bitbucket" "commit" "issues") (:url . "https://gitlab.com/emacs-stuff/git-commit-insert-issue/"))]) + (git-dwim . [(20170126 1214) nil "Context-aware git commands such as branch handling" single ((:commit . "485c732130686c2f28a026e385366006435394b9") (:authors ("rubikitch" . "rubikitch@ruby-lang.org")) (:maintainer "rubikitch" . "rubikitch@ruby-lang.org") (:keywords "git" "tools" "convenience") (:url . "http://www.emacswiki.org/cgi-bin/wiki/download/git-dwim.el"))]) + (git-grep . [(20200920 1751) ((projectile (0 10 0))) "Search tools using git grep" single ((:commit . "12ff6045e9b6aa42f98abd4ddc44d670268a0849") (:authors ("Sam Kleinman")) (:maintainer "tychoish" . "garen@tychoish.com") (:keywords "matching" "files" "grep" "search" "using" "git-grep") (:url . "https://github.com/tychoish/git-grep.el"))]) + (git-gutter . [(20220423 1704) ((emacs (25 1))) "Port of Sublime Text plugin GitGutter" single ((:commit . "a50672b62a678922b8c0cab95225d520f493439b") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Neil Okamoto" . "neil.okamoto+melpa@gmail.com") (:url . "https://github.com/emacsorphanage/git-gutter"))]) + (git-gutter+ . [(20151204 1723) ((git-commit (0)) (dash (0))) "Manage Git hunks straight from the buffer" single ((:commit . "b7726997806d9a2da9fe84ff00ecf21d62b6f975") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:keywords "git" "vc") (:url . "https://github.com/nonsequitur/git-gutter-plus"))]) + (git-gutter-fringe . [(20211003 2228) ((git-gutter (0 88)) (fringe-helper (0 1 1)) (cl-lib (0 5)) (emacs (24))) "Fringe version of git-gutter.el" single ((:commit . "648cb5b57faec55711803cdc9434e55a733c3eba") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Neil Okamoto" . "neil.okamoto+melpa@gmail.com") (:url . "https://github.com/emacsorphanage/git-gutter-fringe"))]) + (git-gutter-fringe+ . [(20140729 1103) ((git-gutter+ (0 1)) (fringe-helper (1 0 1))) "Fringe version of git-gutter+.el" single ((:commit . "7a2f49d2455a3a872e90e5f7dd4e6b27f1d96cfc") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/nonsequitur/git-gutter-fringe-plus"))]) + (git-identity . [(20220402 708) ((emacs (25 1)) (dash (2 10)) (hydra (0 14)) (f (0 20))) "Identity management for (ma)git" single ((:commit . "e7da2b3e3a5a790311431e3263b00df41d335136") (:authors ("Akira Komamura" . "akira.komamura@gmail.com")) (:maintainer "Akira Komamura" . "akira.komamura@gmail.com") (:keywords "git" "vc" "convenience") (:url . "https://github.com/akirak/git-identity.el"))]) + (git-io . [(20180317 1752) ((emacs (24 4))) "git.io integration" single ((:commit . "48753acba73b48b997bb678fb5e2a938ae63b5d6") (:authors ("Tejas Bubane" . "tejasbubane@gmail.com")) (:maintainer "Tejas Bubane" . "tejasbubane@gmail.com") (:keywords "convenience" "files") (:url . "https://github.com/tejasbubane/emacs-git-io"))]) + (git-lens . [(20190319 1342) ((emacs (24 4))) "Show new, deleted or modified files in branch" single ((:commit . "f6cc0a37c9c5c422c49c32650e70bc4721707985") (:authors ("Peter Stiernström" . "peter@stiernstrom.se")) (:maintainer "Peter Stiernström" . "peter@stiernstrom.se") (:keywords "vc" "convenience") (:url . "https://github.com/pidu/git-lens"))]) + (git-link . [(20220406 2328) ((emacs (24 3))) "Get the GitHub/Bitbucket/GitLab URL for a buffer location" single ((:commit . "0197c9812417e18df2c7b5cd5c0084271c2f3286") (:authors ("Skye Shaw" . "skye.shaw@gmail.com")) (:maintainer "Skye Shaw" . "skye.shaw@gmail.com") (:keywords "git" "vc" "github" "bitbucket" "gitlab" "sourcehut" "aws" "azure" "convenience") (:url . "http://github.com/sshaw/git-link"))]) + (git-messenger . [(20201202 1637) ((emacs (24 3)) (popup (0 5 3))) "Popup last commit of current line" single ((:commit . "eade986ef529aa2dac6944ad61b18de55cee0b76") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Neil Okamoto") (:url . "https://github.com/emacsorphanage/git-messenger"))]) + (git-modes . [(20220422 1611) ((emacs (25 1))) "Major modes for editing Git configuration files" tar ((:commit . "eca3bb42ea8abed9ef8549b2ac91bbea445c5bb5") (:authors ("Sebastian Wiesner" . "lunaryorn@gmail.com") ("Rüdiger Sonderfeld" . "ruediger@c-plusplus.net") ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "convenience" "vc" "git") (:url . "https://github.com/magit/git-modes"))]) + (git-msg-prefix . [(20191031 1304) ((emacs (24)) (s (1 10 0)) (dash (2 9 0))) "Insert commit message prefix (issue number)" single ((:commit . "43f6b31c1090371260a2f15b2117a7666920bee7") (:authors ("Raimon Grau" . "raimonster@gmail.com")) (:maintainer "Raimon Grau" . "raimonster@gmail.com") (:keywords "vc" "tools") (:url . "http://github.com/kidd/git-msg-prefix.el"))]) + (git-ps1-mode . [(20200113 704) nil "Global minor-mode to print __git_ps1 in mode-line" single ((:commit . "6762a309bd593d26258dfbf43e7bc21254a70fbf") (:authors ("10sr <8slashes+el [at] gmail [dot] com>")) (:maintainer "10sr <8slashes+el [at] gmail [dot] com>") (:keywords "utility" "mode-line" "git") (:url . "https://github.com/10sr/git-ps1-mode-el"))]) + (git-time-metric . [(20181116 2011) nil "Provide function to record time with gtm ( git time metric )" single ((:commit . "287108ed1d6885dc795eb3bad4476aa08c626186") (:authors ("Anton Sivolapov" . "anton.sivolapov@gmail.com")) (:maintainer "Anton Sivolapov" . "anton.sivolapov@gmail.com") (:keywords "tools" "gtm" "productivity" "time") (:url . "https://github.com/c301/gtm-emacs-plugin"))]) + (git-timemachine . [(20220324 1057) ((emacs (24 3)) (transient (0 1 0))) "Walk through git revisions of a file" single ((:commit . "ca09684e94767cc0b2339b77b778b4de4f9d104f") (:authors ("Peter Stiernström" . "peter@stiernstrom.se")) (:maintainer "Peter Stiernström" . "peter@stiernstrom.se") (:keywords "vc") (:url . "https://gitlab.com/pidu/git-timemachine"))]) + (git-walktree . [(20191101 302) ((emacs (26 1)) (git (0 1 1)) (cl-lib (0 5))) "Browse Git tree and blob objects" tar ((:commit . "162d9073286c256502df4baa9845790b9f4c2f05") (:authors ("10sr <8.slashes [at] gmail [dot] com>")) (:maintainer "10sr <8.slashes [at] gmail [dot] com>") (:keywords "vc" "utility" "git") (:url . "https://github.com/10sr/git-walktree-el"))]) + (git-wip-timemachine . [(20150408 1006) ((s (1 9 0))) "Walk through git-wip revisions of a file" single ((:commit . "ed4c7931a5f5233bf3e358b1e81647d063526460") (:authors ("Tim Krones" . "t.krones@gmx.net")) (:maintainer "Tim Krones" . "t.krones@gmx.net") (:keywords "git") (:url . "https://github.com/itsjeyd/git-wip-timemachine"))]) + (gitconfig . [(20130718 935) nil "Emacs lisp interface to work with git-config variables" single ((:commit . "7612a37ca14009cac8fb8d6b6f54adad739a5741") (:authors ("Samuel Tonini")) (:maintainer "Samuel Tonini") (:keywords "git" "gitconfig" "git-config"))]) + (github-browse-file . [(20160205 1427) ((cl-lib (0 5))) "View the file you're editing on GitHub" single ((:commit . "9742a5183af853788c6ecb83fb7ee0b00d1675ac") (:authors ("Ozan Sener" . "ozan@ozansener.com")) (:maintainer "Ozan Sener" . "ozan@ozansener.com") (:keywords "convenience" "vc" "git" "github") (:url . "https://github.com/osener/github-browse-file"))]) + (github-clone . [(20210108 1920) ((gh (1 0 1)) (magit (3 0 0)) (emacs (25 1))) "Fork and clone github repos" single ((:commit . "9e40d6d3c6128407d7456bf71c95ad1fbb473b2a") (:authors ("Charles L.G. Comstock" . "dgtized@gmail.com")) (:maintainer "Charles L.G. Comstock" . "dgtized@gmail.com") (:keywords "vc" "tools") (:url . "https://github.com/dgtized/github-clone.el"))]) + (github-dark-vscode-theme . [(20220313 2033) ((emacs (24 1))) "The GitHub Dark Theme from Visual Studio Code" single ((:commit . "785d2192d7cd30fb7d9c6cd660133a4002f598cc") (:authors ("Justintime50")) (:maintainer "Justintime50") (:keywords "faces") (:url . "https://github.com/justintime50/github-dark-vscode-emacs-theme"))]) + (github-elpa . [(20200129 417) ((package-build (1 0)) (commander (0 7 0)) (git (0 1 1))) "Build and publish ELPA repositories with GitHub Pages" tar ((:commit . "04a55c723ffcd84dd35e5438e7e2b9f1cce08d42") (:authors (nil . "10sr<8slashes+el@gmail.com>")) (:maintainer nil . "10sr<8slashes+el@gmail.com>") (:url . "https://github.com/10sr/github-elpa"))]) + (github-explorer . [(20220305 1450) ((emacs (25)) (graphql (0))) "Explore a GitHub repository on the fly" single ((:commit . "49e5c350169b556deaabdcb67e9440bd4d5b4f8b") (:authors ("Giap Tran" . "txgvnn@gmail.com")) (:maintainer "Giap Tran" . "txgvnn@gmail.com") (:keywords "comm") (:url . "https://github.com/TxGVNN/github-explorer"))]) + (github-linguist . [(20220418 22) ((emacs (27 1)) (project (0 8)) (async (1 9)) (map (3))) "Run GitHub Linguist on projects to collect information" single ((:commit . "e1055cba19d82620a735e8e40d094b538e1f4d94") (:authors ("Akira Komamura" . "akira.komamura@gmail.com")) (:maintainer "Akira Komamura" . "akira.komamura@gmail.com") (:keywords "processes") (:url . "https://github.com/akirak/github-linguist.el"))]) + (github-modern-theme . [(20171109 1251) nil "The GitHub color theme for Emacs." single ((:commit . "a7e7b8e5e9c122138e79e837caf9b7299e748d44") (:authors ("Philip Arvidsson" . "philip@philiparvidsson.com")) (:maintainer "Philip Arvidsson" . "philip@philiparvidsson.com") (:url . "https://github.com/philiparvidsson/GitHub-Theme-for-Emacs"))]) + (github-notifier . [(20180421 316) ((emacs (24))) "Displays your GitHub notifications unread count in mode-line" single ((:commit . "274f3812926ea371346f639fcee98066f6e8c96f") (:authors ("Chunyang Xu" . "mail@xuchunyang.me")) (:maintainer "Chunyang Xu" . "mail@xuchunyang.me") (:keywords "github" "mode-line") (:url . "https://github.com/xuchunyang/github-notifier.el"))]) + (github-pullrequest . [(20170116 616) ((emacs (24 4)) (request (0 2 0)) (dash (2 11 0)) (magit (2 10 0))) "Create and fetch Github Pull requests with ease" single ((:commit . "6ae5c38b0fc15b638b5ba4490112d9822ce5e267") (:authors ("Jakob Lind" . "karl.jakob.lind@gmail.com")) (:maintainer "Jakob Lind" . "karl.jakob.lind@gmail.com") (:keywords "tools") (:url . "https://github.com/jakoblind/github-pullrequest"))]) + (github-review . [(20211029 243) ((emacs (25 1)) (s (1 12 0)) (ghub (2 0)) (dash (2 11 0)) (deferred (0 5 1)) (a (0 1 1))) "GitHub based code review" single ((:commit . "725fbc7b385228f53a7ddc46a92c1276bab4aea8") (:authors ("Laurent Charignon" . "l.charignon@gmail.com")) (:maintainer "Laurent Charignon" . "l.charignon@gmail.com") (:keywords "git" "tools" "vc" "github") (:url . "https://github.com/charignon/github-review"))]) + (github-search . [(20190624 436) ((magit (0 8 1)) (gh (1 0 0))) "Clone repositories by searching github" single ((:commit . "b73efaf19491010522b09db35bb0f1bad1620e63") (:authors ("Ivan Malison" . "IvanMalison@gmail.com")) (:maintainer "Ivan Malison" . "IvanMalison@gmail.com") (:keywords "github" "search" "clone" "api" "gh" "magit" "vc" "tools") (:url . "https://github.com/IvanMalison/github-search"))]) + (github-stars . [(20190517 1319) ((emacs (25 1)) (ghub (2 0 0))) "Browse your Github Stars" single ((:commit . "a9f25ab2487c886f5d50d26693d49856bd51383b") (:authors ("Xu Chunyang" . "mail@xuchunyang.me")) (:maintainer "Xu Chunyang" . "mail@xuchunyang.me") (:keywords "tools") (:url . "https://github.com/xuchunyang/github-stars.el"))]) + (github-theme . [(20170630 2201) nil "The GitHub color theme for Emacs." single ((:commit . "29f00a51d949a248a5f6355a97131e216747c797") (:authors ("Philip Arvidsson" . "philip@philiparvidsson.com")) (:maintainer "Philip Arvidsson" . "philip@philiparvidsson.com") (:url . "https://github.com/philiparvidsson/GitHub-Theme-for-Emacs"))]) + (gitignore-snippets . [(20201118 1551) ((emacs (26)) (yasnippet (0 8 0))) "Gitignore.io templates for Yasnippet" tar ((:commit . "0de6945ff0fc6943eebcf92d1cbb66b6a1d8fa60") (:authors ("Seong Yong-ju" . "sei40kr@gmail.com")) (:maintainer "Seong Yong-ju" . "sei40kr@gmail.com") (:keywords "tools") (:url . "https://github.com/sei40kr/gitignore-snippets"))]) + (gitignore-templates . [(20210814 144) ((emacs (24 3))) "Create .gitignore using GitHub or gitignore.io API" single ((:commit . "d28cd1cec00242b688861648d36d086818b06099") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:keywords "tools") (:url . "https://github.com/xuchunyang/gitignore-templates.el"))]) + (gitlab . [(20180312 1647) ((s (1 9 0)) (dash (2 9 0)) (pkg-info (0 5 0)) (request (0 1 0))) "Emacs client for Gitlab" tar ((:commit . "8c2324c02119500f094c2f92dfaba4c9977ce1ba") (:authors ("Nicolas Lamirault" . "nicolas.lamirault@gmail.com")) (:maintainer "Nicolas Lamirault" . "nicolas.lamirault@gmail.com") (:keywords "gitlab") (:url . "https://github.com/nlamirault/emacs-gitlab"))]) + (gitlab-ci-mode . [(20191022 2017) ((emacs (25 1)) (yaml-mode (0 0 12))) "Mode for editing GitLab CI files" single ((:commit . "c861dc5fa17d380d5c3aca99dc3bbec5eee623bc") (:authors ("Joe Wreschnig")) (:maintainer "Joe Wreschnig") (:keywords "tools" "vc") (:url . "https://gitlab.com/joewreschnig/gitlab-ci-mode/"))]) + (gitlab-ci-mode-flycheck . [(20190323 1829) ((emacs (25)) (flycheck (31)) (gitlab-ci-mode (1))) "Flycheck support for ‘gitlab-ci-mode’" single ((:commit . "eba81cfb7224fd1fa4e4da90d11729cc7ea12f72") (:authors ("Joe Wreschnig")) (:maintainer "Joe Wreschnig") (:keywords "tools" "vc" "convenience") (:url . "https://gitlab.com/joewreschnig/gitlab-ci-mode-flycheck/"))]) + (gitlab-pipeline . [(20210601 1339) ((emacs (25 1)) (ghub (3 3 0))) "Get infomation about Gitlab pipelines" single ((:commit . "2404f9cf0a064aabea975adada250895c385e057") (:authors ("Giap Tran" . "txgvnn@gmail.com")) (:maintainer "Giap Tran" . "txgvnn@gmail.com") (:keywords "comm" "tools" "git") (:url . "https://github.com/TxGVNN/gitlab-pipeline"))]) + (gitlab-snip-helm . [(20200427 2014) ((emacs (25)) (dash (2 12 0)) (helm (3 2))) "Gitlab snippets api helm package" single ((:commit . "782df679e33646db29e07508311bc8e8624b484e") (:authors ("Fermin MF" . "fmfs@posteo.net")) (:maintainer "Fermin MF" . "fmfs@posteo.net") (:keywords "tools" "files" "convenience") (:url . "https://gitlab.com/sasanidas/gitlab-snip-helm"))]) + (gitolite-clone . [(20160609 2355) ((dash (2 10 0)) (s (1 9 0)) (pcache (0 3 1)) (emacs (24))) "Clone gitolite repositories from a completing list" single ((:commit . "d8a4c2875c984e51137c980b5773f42703602721") (:authors ("Ivan Malison" . "IvanMalison@gmail.com")) (:maintainer "Ivan Malison" . "IvanMalison@gmail.com") (:keywords "gitolite" "clone" "git") (:url . "https://github.com/IvanMalison/gitolite-clone"))]) + (gitpatch . [(20170722 410) ((emacs (24 3))) "Git-format patch toolkit" single ((:commit . "577d5adf65c8133caa325c10e89e1e2fc323c907") (:authors ("Feng Shu" . "tumashu@163.com")) (:maintainer "Feng Shu" . "tumashu@163.com") (:keywords "convenience") (:url . "https://github.com/tumashu/gitpatch"))]) + (gitter . [(20220316 138) ((emacs (24 4)) (let-alist (1 0 4))) "An Emacs Gitter client" single ((:commit . "49327c91eb50cfea633af8fd32b0643691d75cb7") (:authors ("Chunyang Xu" . "mail@xuchunyang.me")) (:maintainer "Chunyang Xu" . "mail@xuchunyang.me") (:keywords "gitter" "chat" "client" "internet") (:url . "https://github.com/xuchunyang/gitter.el"))]) + (gkroam . [(20220326 521) ((emacs (26 3)) (db (0 0 6)) (company (0 9 10))) "A lightweight org-mode Roam Research replica" single ((:commit . "38f517ac2894b16e6cf983b93ee96762fffa152a") (:authors ("Kinney Zhang" . "kinneyzhang666@gmail.com")) (:maintainer "Kinney Zhang" . "kinneyzhang666@gmail.com") (:keywords "org" "convenience") (:url . "https://github.com/Kinneyzhang/gkroam"))]) + (gl-conf-mode . [(20170714 1310) ((emacs (24 3))) "Mode for editing gitolite config files" single ((:commit . "9136a9b737e0a5b6471a91571d104c487c43f35b") (:authors ("Luis Lloret")) (:maintainer "Luis Lloret") (:keywords "git" "gitolite" "languages") (:url . "https://github.com/llloret/gitolite-emacs"))]) + (global-tags . [(20211120 347) ((emacs (26 1)) (async (1 9 4)) (project (0 5 2)) (ht (2 3))) "Elisp API and editor integration for GNU global" single ((:commit . "aaa37da4c538f35a90149ef4ad3d8b0922af54ab") (:authors ("Felipe Lema" . "felipelema@mortemale.org")) (:maintainer "Felipe Lema" . "felipelema@mortemale.org") (:keywords "convenience" "matching" "tools") (:url . "https://launchpad.net/global-tags.el"))]) + (glsl-mode . [(20210808 1945) nil "major mode for Open GLSL shader files" single ((:commit . "9b2e5f28e489a1f73c4aed734105618ac0dc0c43") (:keywords "languages" "opengl" "gpu" "spir-v" "vulkan") (:url . "https://github.com/jimhourihan/glsl-mode"))]) + (gmail-message-mode . [(20160627 1847) ((ham-mode (1 0))) "A major-mode for editing gmail messages using markdown syntax." single ((:commit . "ec36672a9dc93c09ebe2f77597b498d11883d008") (:authors ("Artur Malabarba" . "bruce.connor.am@gmail.com")) (:maintainer "Artur Malabarba" . "bruce.connor.am@gmail.com") (:keywords "mail" "convenience" "emulation") (:url . "http://github.com/Bruce-Connor/gmail-message-mode"))]) + (gmail2bbdb . [(20170423 1144) nil "import email and name into bbdb from vcard." single ((:commit . "a84fa385cfaec7fc5f1518c368e52722da139f99") (:authors ("Chen Bin" . "chenbin.sh@gmail.com")) (:maintainer "Chen Bin" . "chenbin.sh@gmail.com") (:keywords "vcard" "bbdb" "email" "contact" "gmail") (:url . "http://github.com/redguardtoo/gmail2bbdb"))]) + (gmpl-mode . [(20220121 631) ((emacs (24))) "Major mode for editing GMPL(MathProg) files" single ((:commit . "97b103eea8b18f7e27b0f0be6cb4809a4156c032") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions"))]) + (gmsh-mode . [(20211204 826) ((emacs (26 1))) "Highlight GMSH mesh generator script syntax" single ((:commit . "2b7c573f378f7e9210400115d4d9dfd879f8a4ad") (:authors ("Matsievskiy S.V.")) (:maintainer "Matsievskiy S.V.") (:keywords "languages") (:url . "https://gitlab.com/matsievskiysv/gmsh-mode"))]) + (gn-mode . [(20190428 1812) ((emacs (24)) (cl-lib (0 5))) "major mode for editing GN (generate ninja) files" single ((:commit . "fcf8e1e500d953364e97e7ebc5708a2c00fa3cd2") (:authors ("Emily Backes" . "lucca@accela.net")) (:maintainer "Emily Backes" . "lucca@accela.net") (:keywords "data") (:url . "http://github.com/lashtear/gn-mode"))]) + (gnome-calendar . [(20161110 1256) nil "Integration with the GNOME Shell calendar" single ((:commit . "489f9f15f7bb35696b1cc19db75b554ae8328df2") (:authors ("Nicolas Petton" . "nicolas@petton.fr")) (:maintainer "Nicolas Petton" . "nicolas@petton.fr") (:keywords "gnome" "calendar"))]) + (gnome-screencast . [(20210125 2001) ((emacs (25))) "Use Gnome screen recording functionality using elisp" single ((:commit . "6450ee470e84ff14a15c5c3c0489c79ff593f165") (:authors ("Jürgen Hötzel" . "juergen@hoetzel.info")) (:maintainer "Jürgen Hötzel" . "juergen@hoetzel.info") (:keywords "tools" "multimedia") (:url . "https://github.com/juergenhoetzel/emacs-gnome-screencast"))]) + (gnomenm . [(20150316 1918) ((s (1 9 0)) (dash (2 3 0)) (kv (0 0 19))) "Emacs interface to Gnome nmcli command" single ((:commit . "9065cda44ffc9e06239b8189a0154d31314c3b4d") (:authors ("Nic Ferrier" . "nferrier@ferrier.me.uk")) (:maintainer "Nic Ferrier" . "nferrier@ferrier.me.uk") (:keywords "processes" "hardware") (:url . "http://github.com/nicferrier/emacs-nm"))]) + (gntp . [(20141025 250) nil "Growl Notification Protocol for Emacs" single ((:commit . "767571135e2c0985944017dc59b0be79af222ef5") (:authors ("Engelke Eschner" . "tekai@gmx.li")) (:maintainer "Engelke Eschner" . "tekai@gmx.li"))]) + (gnu-apl-mode . [(20220404 341) ((emacs (27))) "Integrate GNU APL with Emacs" tar ((:commit . "c8695b0d55b5167263a843252ffd21a589018427") (:authors ("Elias Mårtenson" . "lokedhs@gmail.com")) (:maintainer "Elias Mårtenson" . "lokedhs@gmail.com") (:keywords "languages") (:url . "http://www.gnu.org/software/apl/"))]) + (gnu-indent . [(20220330 422) ((emacs (27 2))) "Indent your code with GNU Indent" single ((:commit . "cd5dc79ac65c24e9e775bd2582ad620e316f2182") (:authors ("Akib Azmain Turja" . "akib@disroot.org")) (:maintainer "Akib Azmain Turja" . "akib@disroot.org") (:keywords "tools" "c") (:url . "https://codeberg.org/akib/emacs-gnu-indent"))]) + (gnuplot . [(20220102 1637) ((emacs (24 3))) "Major-mode and interactive frontend for gnuplot" tar ((:commit . "57be3c7addec31e226a5a27aa553e996f9c684e3") (:authors ("Jon Oddie") ("Bruce Ravel") ("Phil Type")) (:maintainer "Bruce Ravel" . "bruceravel1@gmail.com") (:keywords "data" "gnuplot" "plotting") (:url . "https://github.com/emacsorphanage/gnuplot"))]) + (gnuplot-mode . [(20171013 1616) nil "Major mode for editing gnuplot scripts" single ((:commit . "601f6392986f0cba332c87678d31ae0d0a496ce7") (:keywords "gnuplot" "plotting") (:url . "https://github.com/mkmcc/gnuplot-mode"))]) + (gnus-alias . [(20150316 42) nil "an alternative to gnus-posting-styles" single ((:commit . "9447d3ccb4c0e75d0468899cccff7aa249657bac") (:authors ("Joe Casadonte" . "emacs@northbound-train.com")) (:maintainer "Mark A. Hershberger" . "mah@everybody.org") (:keywords "personality" "identity" "news" "mail" "gnus"))]) + (gnus-desktop-notify . [(20180623 1538) ((gnus (1 0))) "Gnus Desktop Notification global minor mode" single ((:commit . "b438feb59136621a8ab979f0e2784f7002398d06") (:authors ("Yuri D'Elia ")) (:maintainer "Yuri D'Elia ") (:url . "http://www.thregr.org/~wavexx/software/gnus-desktop-notify.el/"))]) + (gnus-notes . [(20210207 1010) ((emacs (27 1)) (bbdb (3 1)) (helm (3 1)) (hydra (0 13 0)) (org (8 3)) (s (0 0)) (lv (0 0)) (async (1 9 1))) "Keep handy notes of read Gnus articles with helm and org" tar ((:commit . "1457bba34b40d5197aa14dbf0856925f83025ae1") (:authors ("Deus Max" . "deusmax@gmx.com")) (:maintainer "Deus Max" . "deusmax@gmx.com") (:keywords "convenience" "mail" "bbdb" "gnus" "helm" "org" "hydra") (:url . "https://github.com/deusmax/gnus-notes"))]) + (gnus-recent . [(20220324 2011) ((emacs (25 3 2))) "Article breadcrumbs for Gnus" single ((:commit . "a0ace8ea6e62a6b79a18149fbd560c6948a8103b") (:authors ("Kevin Brubeck Unhammer" . "unhammer@fsfe.org")) (:maintainer "Kevin Brubeck Unhammer" . "unhammer@fsfe.org") (:keywords "convenience" "mail") (:url . "https://github.com/unhammer/gnus-recent"))]) + (gnus-select-account . [(20170722 511) nil "Select an account before writing a mail in gnus" single ((:commit . "ddc8c135eeaf90f5b6692a033af2badae36e68ce") (:authors ("Feng Shu " . "tumashu@163.com")) (:maintainer "Feng Shu " . "tumashu@163.com") (:keywords "convenience") (:url . "https://github.com/tumashu/gnus-select-account"))]) + (gnus-summary-ext . [(20180113 1316) nil "Extra limit and process mark commands for the gnus summary buffer" single ((:commit . "025fd853fe9280ae696a89ec2c2cac9befd010aa") (:authors ("Joe Bloggs" . "vapniks@yahoo.com")) (:maintainer "Joe Bloggs" . "vapniks@yahoo.com") (:keywords "comm") (:url . "https://github.com/vapniks/gnus-summary-ext"))]) + (gnus-summary-repo . [(20190617 1419) ((emacs (25))) "Import and export files between IMAP and local by using GNUS" single ((:commit . "1341b68dfda952a95f5d9b4cb7d427716dafa310") (:authors ("Giap Tran" . "txgvnn@gmail.com")) (:maintainer "Giap Tran" . "txgvnn@gmail.com") (:keywords "gnus" "repository") (:url . "https://github.com/TxGVNN/gnus-summary-repo"))]) + (gnus-x-gm-raw . [(20140610 731) ((log4e (0 2 0)) (yaxception (0 1))) "Search mail of Gmail using X-GM-RAW as web interface" single ((:commit . "978bdfcecc8844465b71641c2e909fcdc66b22be") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "gnus") (:url . "https://github.com/aki2o/gnus-x-gm-raw"))]) + (go . [(20220414 1956) ((emacs (24))) "Play GO, translate and transfer between GO back ends" tar ((:commit . "79690579496b0df85a1c94199aca968371b58b3c") (:authors ("Eric Schulte" . "schulte.eric@gmail.com")) (:maintainer "Eric Schulte" . "schulte.eric@gmail.com") (:keywords "game" "go" "sgf") (:url . "http://eschulte.github.io/el-go/"))]) + (go-add-tags . [(20161123 1227) ((emacs (24 3)) (s (1 11 0))) "Add field tags for struct fields" single ((:commit . "54879945e46a0884c5f93d7fd6c866a9cdf401ac") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-go-add-tags"))]) + (go-autocomplete . [(20170626 1023) ((auto-complete (1 4 0))) "auto-complete-mode backend for go-mode" single ((:commit . "5327738ec1be51061a3f31010c89bdd4924ca496") (:authors ("Mikhail" . "tensai@cirno.in")) (:maintainer "Mikhail" . "tensai@cirno.in") (:keywords "languages"))]) + (go-complete . [(20190409 516) ((go-mode (0)) (cl-lib (0 5))) "Native code completion for Go" single ((:commit . "056294014f37a1004958ec17ebd6748deed63502") (:authors ("Vibhav Pant" . "vibhavp@gmail.com")) (:maintainer "Vibhav Pant" . "vibhavp@gmail.com") (:keywords "go" "golang" "completion") (:url . "https://github.com/vibhavp/go-complete"))]) + (go-direx . [(20150316 143) ((direx (1 0 0)) (cl-lib (0 5))) "Tree style source code viewer for Go language" single ((:commit . "8f2206469328ee932c7f1892f5e1fb02dec98432") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-go-direx"))]) + (go-dlv . [(20220126 1436) ((go-mode (1 3 1))) "Go Delve - Debug Go programs interactively with the GUD." single ((:commit . "0a296bc3b7b4dcf0c140a78c5ca3e1a8c6b7ea1a") (:authors ("Marko Bencun" . "mbencun@gmail.com")) (:maintainer "Marko Bencun" . "mbencun@gmail.com") (:keywords "go" "debug" "debugger" "delve" "interactive" "gud") (:url . "https://github.com/benma/go-dlv.el/"))]) + (go-eldoc . [(20170305 1427) ((emacs (24 3)) (go-mode (1 0 0))) "eldoc for go-mode" single ((:commit . "cbbd2ea1e94a36004432a9ac61414cb5a95a39bd") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-go-eldoc"))]) + (go-errcheck . [(20160723 43) nil "errcheck integration for go-mode" single ((:commit . "9db21eccecedc2490793f176246094167164af31") (:authors ("Dominik Honnef" . "dominikh@fork-bomb.org")) (:maintainer "Dominik Honnef" . "dominikh@fork-bomb.org"))]) + (go-expr-completion . [(20200817 1750) ((emacs (24 1))) "Complement the return values for Go" single ((:commit . "66bba78f52a732b978848e3a4c99fa2afeb6c25f") (:authors ("Ryo Fujimoto" . "fujimisakri@gmail.com")) (:maintainer "Ryo Fujimoto" . "fujimisakri@gmail.com") (:url . "https://github.com/fujimisakari/emacs-go-expr-completion"))]) + (go-fill-struct . [(20171225 331) ((emacs (24))) "Fill struct for golang." single ((:commit . "a613d0b378473eef39e8fd5724abe790aea84321") (:authors ("Sergey Kostyaev" . "feo.me@ya.ru")) (:maintainer "Sergey Kostyaev" . "feo.me@ya.ru") (:keywords "tools") (:url . "https://github.com/s-kostyaev/go-fill-struct"))]) + (go-gen-test . [(20210816 1215) ((emacs (24 3)) (s (1 12))) "Generate tests for go code with gotests" single ((:commit . "35df36dcd555233ee1a618c0f6a58ce6db4154d9") (:authors ("Sergey Kostyaev" . "feo.me@ya.ru")) (:maintainer "Sergey Kostyaev" . "feo.me@ya.ru") (:keywords "languages") (:url . "https://github.com/s-kostyaev/go-gen-test"))]) + (go-gopath . [(20160705 1034) ((cl-lib (0 5))) "Will guess GOPATH using gb and projectile." single ((:commit . "5172fc53f21edbf9347d5ee7d1d745da1ec88a15") (:authors ("Andrew Kirilenko" . "andrew.kirilenko.main@gmail.com")) (:maintainer "Andrew Kirilenko" . "andrew.kirilenko.main@gmail.com") (:url . "http://github.com/iced/go-gopath/"))]) + (go-guru . [(20181012 330) ((go-mode (1 3 1)) (cl-lib (0 5))) "Integration of the Go 'guru' analysis tool into Emacs." single ((:commit . "fa2693278637f56759480d2bf203bb8aad107230") (:keywords "tools"))]) + (go-imenu . [(20181029 1029) ((emacs (24 3))) "Enhance imenu for go language" single ((:commit . "4f3f334ed0b6f6afaca6b9775636a52ad3843053") (:authors ("Brantou" . "brantou89@gmail.com")) (:maintainer "Brantou" . "brantou89@gmail.com") (:keywords "tools") (:url . "https://github.com/brantou/go-imenu.el"))]) + (go-impl . [(20210621 743) ((emacs (24 3)) (go-mode (1 3 0))) "impl integration for go-mode" single ((:commit . "1eebba6ccd02d11a5a82ad4540a8d562797bc3b3") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-go-impl"))]) + (go-imports . [(20190715 1647) nil "Insert go import statement given package name" tar ((:commit . "55681e815da93b6f927213c4aa352ae33db97c37") (:authors ("Yaz Saito")) (:maintainer "Yaz Saito") (:keywords "tools" "go" "import") (:url . "https://github.com/yasushi-saito/go-imports"))]) + (go-mode . [(20220114 2239) ((emacs (26 1))) "Major mode for the Go programming language" single ((:commit . "fa2693278637f56759480d2bf203bb8aad107230") (:authors ("The go-mode Authors")) (:maintainer "The go-mode Authors") (:keywords "languages" "go") (:url . "https://github.com/dominikh/go-mode.el"))]) + (go-noisegate . [(20200502 703) ((emacs (24 4))) "Run Golang tests with Noise Gate" single ((:commit . "e3fc198c234131c94f7d307b7f7c6ef623fb93b7") (:authors ("The Noise Gate Authors")) (:maintainer "The Noise Gate Authors") (:keywords "languages" "go" "test") (:url . "https://github.com/go-noisegate/go-noisegate.el"))]) + (go-playground . [(20220106 1618) ((emacs (24)) (go-mode (1 4 0)) (gotest (0 13 0))) "Local Golang playground for short snippets." single ((:commit . "9ee7dcc7f78be67cc391f13efa6570c2baac0204") (:authors ("Alexander I.Grafov" . "grafov@gmail.com")) (:maintainer "Alexander I.Grafov" . "grafov@gmail.com") (:keywords "tools" "golang") (:url . "https://github.com/grafov/go-playground"))]) + (go-playground-cli . [(20160503 914) ((emacs (24)) (request (0 2 0)) (deferred (0 3 2)) (names (20151201 404)) (s (1 10 0)) (f (0 17 2)) (let-alist (1 0 4)) (cl-lib (0 5))) "Go Playground client tool" single ((:commit . "60beebd98e3930641d41cee0189c579626f223bc") (:authors ("KOBAYASHI Shigeru (kosh)" . "shigeru.kb@gmail.com")) (:maintainer "KOBAYASHI Shigeru (kosh)" . "shigeru.kb@gmail.com") (:url . "https://github.com/kosh04/go-playground-cli"))]) + (go-projectile . [(20200609 131) ((projectile (0 10 0)) (go-mode (0)) (go-eldoc (0 16)) (go-rename (0)) (go-guru (0)) (dash (2 17 0))) "Go add-ons for Projectile" single ((:commit . "ad4ca3b5695a0e31e95e3cc4ccab498f87d68303") (:authors ("Doug MacEachern" . "dougm@vmware.com")) (:maintainer "Doug MacEachern" . "dougm@vmware.com") (:keywords "project" "convenience") (:url . "https://github.com/dougm/go-projectile"))]) + (go-rename . [(20190805 2101) ((go-mode (1 3 1))) "Integration of the 'gorename' tool into Emacs." single ((:commit . "fa2693278637f56759480d2bf203bb8aad107230") (:keywords "tools"))]) + (go-scratch . [(20150810 440) ((go-mode (1 3 1)) (emacs (24))) "*scratch* buffer for Go" single ((:commit . "3f68cbcce04f59eb8e83af109164731ec0454be0") (:authors ("Emanuel Evans" . "mail@emanuel.industries")) (:maintainer "Emanuel Evans" . "mail@emanuel.industries") (:keywords "languages" "go"))]) + (go-snippets . [(20180113 611) ((yasnippet (0 8 0))) "Yasnippets for go" tar ((:commit . "d437df148879566ffe7f2e503a3cf2602aa9fb28") (:keywords "snippets"))]) + (go-stacktracer . [(20150430 2142) nil "parse Go stack traces" single ((:commit . "a2ac6d801b389f80ca4e2fcc1ab44513a9e55976") (:authors ("Samer Masterson" . "samer@samertm.com")) (:maintainer "Samer Masterson" . "samer@samertm.com") (:keywords "tools") (:url . "https://github.com/samertm/go-stacktracer.el"))]) + (go-tag . [(20180227 411) ((emacs (24 0)) (go-mode (1 5 0))) "Edit Golang struct field tag" single ((:commit . "59b243f2fa079d9de9d56f6e2d94397e9560310a") (:authors ("Brantou" . "brantou89@gmail.com")) (:maintainer "Brantou" . "brantou89@gmail.com") (:keywords "tools") (:url . "https://github.com/brantou/emacs-go-tag"))]) + (go-translate . [(20220404 1240) ((emacs (27 1))) "Translation framework supports multiple engines such as Google/Bing/DeepL" tar ((:commit . "b0898e6cd647e38e6f70e6cd121b789610573237") (:authors ("lorniu" . "lorniu@gmail.com")) (:maintainer "lorniu" . "lorniu@gmail.com") (:keywords "convenience") (:url . "https://github.com/lorniu/go-translate"))]) + (gobgen . [(20161020 1523) ((emacs (24 4))) "Generate GObject descendants using a detailed form" single ((:commit . "ed2c2b0d217deae293096f3cf14aa492791ddd4f") (:authors ("Gergely Polonkai" . "gergely@polonkai.eu")) (:maintainer "Gergely Polonkai" . "gergely@polonkai.eu") (:keywords "gobject" "glib" "gtk" "helper" "utilities"))]) + (god-mode . [(20210102 515) ((emacs (25 1))) "Minor mode for God-like command entering" tar ((:commit . "fac7d26ecde1be5b0bf6bd6e0ec5b4895be13906") (:authors ("Chris Done" . "chrisdone@gmail.com")) (:maintainer "Chris Done" . "chrisdone@gmail.com") (:url . "https://github.com/emacsorphanage/god-mode"))]) + (godoctor . [(20180710 2152) nil "Frontend for godoctor" single ((:commit . "4b45ff3d0572f0e84056e4c3ba91fcc178199859") (:authors ("Sangho Na" . "microamp@protonmail.com")) (:maintainer "Sangho Na" . "microamp@protonmail.com") (:keywords "go" "golang" "refactoring") (:url . "https://github.com/microamp/godoctor.el"))]) + (goggles . [(20220403 1812) ((emacs (27 1))) "Pulse modified regions" single ((:commit . "6941fd5bc19c0a2789dda38334d2be582ed34e5a") (:authors ("Daniel Mendler")) (:maintainer "Daniel Mendler") (:url . "https://github.com/minad/goggles"))]) + (gold-mode . [(20140607 206) ((sws-mode (0))) "Major mode for editing .gold files" single ((:commit . "6d3aa59602b1b835495271c8c9741ac344c2eab1") (:authors ("Yuta Yamada ")) (:maintainer "Yuta Yamada ") (:keywords "golang" "template" "gold") (:url . "https://github.com/yuutayamada/gold-mode-el"))]) + (golden-ratio . [(20191028 1732) nil "Automatic resizing of Emacs windows to the golden ratio" single ((:commit . "007911d8a431b72670f5fe5f0e5b4380c2777a31") (:authors ("Roman Gonzalez" . "romanandreg@gmail.com")) (:maintainer "Roman Gonzalez" . "romanandreg@gmail.com") (:keywords "window" "resizing"))]) + (golden-ratio-scroll-screen . [(20200419 451) nil "Scroll half screen down or up, and highlight current line" single ((:commit . "1b6ff0e3e8822423335d3f7d88c1fcb4cf43ce42") (:authors ("纪秀峰 ")) (:maintainer "纪秀峰 ") (:keywords "scroll" "screen" "highlight") (:url . "https://github.com/jixiuf/golden-ratio-scroll-screen"))]) + (goldendict . [(20220210 1401) ((emacs (24 4)) (cl-lib (0 5))) "query word smartly with goldendict.el" single ((:commit . "f3fbe658a8d31dc1bd0ca69e4d2ebaab59e92791") (:keywords "dict" "goldendict") (:url . "https://repo.or.cz/goldendict.el.git"))]) + (golint . [(20180221 2015) nil "lint for the Go source code" single ((:commit . "6edffad5e6160f5949cdefc81710b2706fbcd4f6") (:url . "https://github.com/golang/lint"))]) + (gom-mode . [(20131008 253) nil "Major mode for Gomfile" single ((:commit . "972e33df1d38ff323bc97de87477305826013701") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-gom-mode"))]) + (gomacro-mode . [(20200326 1103) ((emacs (24 4)) (go-mode (1 5 0))) "Gomacro mode and Go REPL integration" single ((:commit . "3112e56d2d5e645a3e0fd877f3e810dbccbf989f") (:authors ("Petter Storvik")) (:maintainer "Petter Storvik") (:keywords "gomacro" "repl" "languages" "tools" "processes") (:url . "https://github.com/storvik/gomacro-mode"))]) + (good-scroll . [(20211101 942) ((emacs (27 1))) "Good pixel line scrolling" tar ((:commit . "a7ffd5c0e5935cebd545a0570f64949077f71ee3") (:authors ("Benjamin Levy" . "blevy@protonmail.com")) (:maintainer "Benjamin Levy" . "blevy@protonmail.com") (:url . "https://github.com/io12/good-scroll.el"))]) + (google . [(20140416 1748) nil "Emacs interface to the Google API" single ((:commit . "3b3189a8b201c8d36fed6e61496274e530dd40bd") (:authors ("Edward O'Connor" . "ted@oconnor.cx")) (:maintainer "Edward O'Connor" . "ted@oconnor.cx") (:keywords "comm" "processes" "tools"))]) + (google-c-style . [(20220210 1659) nil "Google's C/C++ style for c-mode" single ((:commit . "1faa779a126c3564e74d6254d596da8dd2b4bf56") (:keywords "c" "tools"))]) + (google-contacts . [(20201012 1056) ((oauth2 (0 10)) (cl-lib (0 5))) "Support for Google Contacts in Emacs" tar ((:commit . "8923c238fe0906184d2254b33ba72792ed12cd47") (:authors ("Julien Danjou" . "julien@danjou.info")) (:maintainer "Julien Danjou" . "julien@danjou.info") (:keywords "comm") (:url . "https://github.com/jd/google-contacts.el"))]) + (google-maps . [(20181121 1532) ((emacs (24 3))) "Access Google Maps from Emacs" tar ((:commit . "2eb16ff609f5a9f8d02c15238a111fbb7db6c146") (:authors ("Julien Danjou" . "julien@danjou.info")) (:maintainer "Julien Danjou" . "julien@danjou.info") (:keywords "comm") (:url . "https://julien.danjou.info/projects/emacs-packages#google-maps"))]) + (google-this . [(20170810 1215) ((emacs (24 1))) "A set of functions and bindings to google under point." single ((:commit . "8a2e3ca5da6a8c89bfe99a21486c6c7db125dc84") (:authors ("Artur Malabarba" . "bruce.connor.am@gmail.com")) (:maintainer "Artur Malabarba" . "bruce.connor.am@gmail.com") (:keywords "convenience" "hypermedia") (:url . "http://github.com/Malabarba/emacs-google-this"))]) + (google-translate . [(20210406 1138) nil "Emacs interface to Google Translate." tar ((:commit . "0f7f48a09bca064999ecea03102a7c96f52cbd1b") (:authors ("Oleksandr Manzyuk" . "manzyuk@gmail.com")) (:maintainer "Andrey Tykhonov" . "atykhonov@gmail.com") (:keywords "convenience") (:url . "https://github.com/atykhonov/google-translate"))]) + (goose-theme . [(20160828 1245) ((emacs (24 1))) "A gray color theme" single ((:commit . "acd017b50ab25a75fd1331eb3de66467e2042e9c") (:authors ("Stephen Whipple" . "shw@wicdmedia.org")) (:maintainer "Stephen Whipple" . "shw@wicdmedia.org") (:url . "https://github.com/thwg/goose-theme"))]) + (gore-mode . [(20151123 1927) ((go-mode (1 0 0))) "Simple mode for gore, a command-line evaluator for golang." single ((:commit . "94d7f3e99104e06167967c98fdc201049c433c2d") (:authors ("Sergey Pashaev" . "sergey.pashaev@gmail.com")) (:maintainer "Sergey Pashaev" . "sergey.pashaev@gmail.com") (:keywords "go" "repl"))]) + (gorepl-mode . [(20170905 945) ((emacs (24)) (s (1 11 0)) (f (0 19 0)) (hydra (0 13 0))) "Go REPL Interactive Development in top of Gore" single ((:commit . "6a73bf352e8d893f89cad36c958c4db2b5e35e07") (:authors ("Manuel Alonso" . "manuteali@gmail.com")) (:maintainer "Manuel Alonso" . "manuteali@gmail.com") (:keywords "languages" "go" "golang" "gorepl") (:url . "http://www.github.com/manute/gorepl-mode"))]) + (gotest . [(20220209 1739) ((emacs (24 3)) (s (1 11 0)) (f (0 19 0)) (go-mode (1 5 0))) "Launch GO unit tests" single ((:commit . "78be56c0f210224b1e3a7d58239e2a32f8f84bf4") (:authors ("Nicolas Lamirault" . "nicolas.lamirault@gmail.com")) (:maintainer "Nicolas Lamirault" . "nicolas.lamirault@gmail.com") (:keywords "languages" "go" "tests") (:url . "https://github.com/nlamirault/gotest.el"))]) + (gotham-theme . [(20220107 1730) ((emacs (24 1))) "A very dark Emacs color theme" single ((:commit . "4b8214df0851bb69b44c3e864568b7e0030a95d2") (:authors ("Vasilij Schneidermann" . "mail@vasilij.de")) (:maintainer "Vasilij Schneidermann" . "mail@vasilij.de") (:url . "https://depp.brause.cc/gotham-theme"))]) + (goto-char-preview . [(20210323 332) ((emacs (24 3))) "Preview character when executing `goto-char` command" single ((:commit . "ea845966423ce90526d717bb27d0022101c75796") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/goto-char-preview"))]) + (goto-chg . [(20220107 1733) ((emacs (24 1))) "Go to last change" single ((:commit . "278cd3e6d5107693aa2bb33189ca503f22f227d0") (:authors ("David Andersson ")) (:maintainer "Vasilij Schneidermann" . "mail@vasilij.de") (:keywords "convenience" "matching") (:url . "https://github.com/emacs-evil/goto-chg"))]) + (goto-last-change . [(20150109 1823) nil "Move point through buffer-undo-list positions" single ((:commit . "58b0928bc255b47aad318cd183a5dce8f62199cc") (:authors ("Kevin Rodgers" . "ihs_4664@yahoo.com")) (:maintainer "Kevin Rodgers" . "ihs_4664@yahoo.com") (:keywords "convenience") (:url . "https://github.com/camdez/goto-last-change.el"))]) + (goto-last-point . [(20190525 1855) ((emacs (24 3))) "Record and jump to the last point in the buffer." single ((:commit . "7ea191df18ff4774cf1dc568e1726143dd54ea02") (:authors ("Manuel Uberti" . "manuel.uberti@inventati.org")) (:maintainer "Manuel Uberti" . "manuel.uberti@inventati.org") (:keywords "convenience") (:url . "https://github.com/manuel-uberti/goto-last-point"))]) + (goto-line-preview . [(20210323 422) ((emacs (25))) "Preview line when executing `goto-line` command" single ((:commit . "d4db955860de830ebc067b065cba16a776717e76") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/goto-line-preview"))]) + (govc . [(20220509 1455) ((emacs (24 3)) (dash (1 5 0)) (s (1 9 0)) (magit-popup (2 0 50)) (json-mode (1 6 0))) "Interface to govc for managing VMware ESXi and vCenter" single ((:commit . "72c2000c01b73c884f1f94df52765762e187b1de") (:authors ("The govc developers")) (:maintainer "The govc developers") (:keywords "convenience") (:url . "https://github.com/vmware/govmomi/tree/master/govc/emacs"))]) + (govet . [(20170808 1724) nil "linter/problem finder for the Go source code" single ((:commit . "1c05817cf8b96589076c7ac4e52ee58a860a0cbf") (:url . "https://godoc.org/golang.org/x/tools/cmd/vet"))]) + (gpastel . [(20181229 1404) ((emacs (25 1))) "Integrates GPaste with the kill-ring" single ((:commit . "d5fc55bc825203f998537c5834718e665bb87c29") (:authors ("Damien Cassou" . "damien@cassou.me")) (:maintainer "Damien Cassou" . "damien@cassou.me") (:keywords "tools") (:url . "https://gitlab.petton.fr/DamienCassou/desktop-environment"))]) + (grab-mac-link . [(20210511 1303) ((emacs (24))) "Grab link from Mac Apps and insert it into Emacs" single ((:commit . "2c722016ca01bd4265d57c4a7d55712c94cf4ea5") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:keywords "mac" "hyperlink") (:url . "https://github.com/xuchunyang/grab-mac-link.el"))]) + (grab-x-link . [(20191113 848) ((emacs (24)) (cl-lib (0 5))) "Grab links from X11 apps and insert into Emacs" single ((:commit . "d898db46e4864118359fdedfe915e180de3fe290") (:authors ("Xu Chunyang" . "mail@xuchunyang.me")) (:maintainer "Xu Chunyang" . "mail@xuchunyang.me") (:keywords "hyperlink") (:url . "https://github.com/xuchunyang/grab-x-link"))]) + (gradle-mode . [(20150313 1905) ((s (1 8 0))) "Gradle integration with Emacs' compile" single ((:commit . "e4d665d5784ecda7ddfba015f07c69be3cfc45f2") (:authors ("Daniel Mijares" . "daniel.j.mijares@gmail.com")) (:maintainer "Daniel Mijares" . "daniel.j.mijares@gmail.com") (:keywords "gradle") (:url . "http://github.com/jacobono/emacs-gradle-mode"))]) + (grails . [(20220407 1847) ((emacs (24))) "Minor mode for Grails projects" single ((:commit . "350869ecc4f429fc4e26f826d6050d068e724c5d") (:url . "https://github.com/lifeisfoo/emacs-grails"))]) + (grails-mode . [(20220407 1954) nil "minor-mode that adds some Grails project management to a grails project" single ((:commit . "29210e5a969c02169b68e04f2e28e3bf2fc13363") (:authors ("Jim Morris" . "morris@wolfman.com")) (:maintainer "Russel Winder" . "russel@winder.org.uk") (:keywords "languages") (:url . "http://blog.wolfman.com"))]) + (grails-projectile-mode . [(20160327 1324) ((projectile (0 10 0)) (emacs (24)) (cl-lib (0 5))) "Grails mode with Projectile for projects management." tar ((:commit . "8efca50ce92b556fe9d467b157d7aec635bcc017") (:authors ("Yves Zoundi" . "rimerosolutions@gmail.com")) (:maintainer "Yves Zoundi") (:keywords "grails" "projectile") (:url . "https://github.com/yveszoundi/grails-projectile-mode"))]) + (grammarly . [(20220509 1937) ((emacs (26 1)) (s (1 12 0)) (request (0 3 0)) (websocket (1 6))) "Grammarly API interface" single ((:commit . "3e14e53b87465ca35b08b5355061e380afb87b31") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/emacs-grammarly/grammarly"))]) + (grandshell-theme . [(20180606 517) nil "Dark color theme for Emacs > 24 with intensive colors." tar ((:commit . "0ed8e4273607dd4fcaa742b4097259233b09eda6") (:authors ("steckerhalter")) (:maintainer "steckerhalter") (:keywords "color" "theme" "grand" "shell" "faces") (:url . "https://framagit.org/steckerhalter/grandshell-theme"))]) + (graphene . [(20180529 1112) ((dash (2 10 0)) (exec-path-from-shell (1 9)) (ppd-sr-speedbar (0 0 6)) (sr-speedbar (20140505)) (ido-completing-read+ (4 3)) (smex (3 0)) (web-mode (11 2)) (smartparens (1 8 0)) (graphene-meta-theme (0 0 2)) (flycheck (0 23)) (company (0 8 12))) "Friendly Emacs defaults" tar ((:commit . "cc8477fcfb7771ea4e5bbaf3c01f9e679234c1c1") (:authors ("Robert Dallas Gray" . "mail@robertdallasgray.com")) (:maintainer "Robert Dallas Gray" . "mail@robertdallasgray.com") (:keywords "defaults") (:url . "https://github.com/rdallasgray/graphene"))]) + (graphene-meta-theme . [(20161204 1607) nil "Integrated theming for common packages" single ((:commit . "62cc73fee31f1bd9474027b83a249feee050271e") (:authors ("Robert Dallas Gray" . "mail@robertdallasgray.com")) (:maintainer "Robert Dallas Gray" . "mail@robertdallasgray.com") (:keywords "defaults") (:url . "https://github.com/rdallasgray/graphene"))]) + (graphql . [(20180912 31) ((emacs (25))) "GraphQL utilities" single ((:commit . "5ca5f50b5e6f3883f1138453a356d59a1c002120") (:authors ("Sean Allred" . "code@seanallred.com")) (:maintainer "Sean Allred" . "code@seanallred.com") (:keywords "hypermedia" "tools" "lisp") (:url . "https://github.com/vermiculus/graphql.el"))]) + (graphql-doc . [(20210808 8) ((emacs (26 1)) (request (0 3 2)) (promise (1 1))) "GraphQL Documentation Explorer" single ((:commit . "6ba7961fc9c5c9818bd60abce6ba9dfef2dad452") (:authors ("Ian Fitzpatrick")) (:maintainer "Ian Fitzpatrick") (:url . "https://github.com/ifitzpatrick/graphql-doc.el"))]) + (graphql-mode . [(20211127 1023) ((emacs (24 3))) "Major mode for editing GraphQL schemas" single ((:commit . "9740e4027bd9313697d5cac5caaa5b15626ab1da") (:authors ("David Vazquez Pua" . "davazp@gmail.com")) (:maintainer "David Vazquez Pua" . "davazp@gmail.com") (:keywords "languages") (:url . "https://github.com/davazp/graphql-mode"))]) + (graphviz-dot-mode . [(20220309 1336) ((emacs (25 0))) "Mode for the dot-language used by graphviz (att)." tar ((:commit . "6e96a89762760935a7dff6b18393396f6498f976") (:maintainer "Pieter Pareit" . "pieter.pareit@gmail.com") (:keywords "mode" "dot" "dot-language" "dotlanguage" "graphviz" "graphs" "att") (:url . "https://ppareit.github.io/graphviz-dot-mode/"))]) + (grapnel . [(20131001 1534) nil "HTTP request lib with flexible callback dispatch" single ((:commit . "fbd0f9a51139973d35e4014855964fa435e8ecaf") (:authors ("David Leatherman" . "leathekd@gmail.com")) (:maintainer "David Leatherman" . "leathekd@gmail.com") (:url . "http://www.github.com/leathekd/grapnel"))]) + (grass-mode . [(20170503 1500) ((cl-lib (0 2)) (dash (2 8 0))) "Provides Emacs modes for interacting with the GRASS GIS program" single ((:commit . "8a7e9dcb2295eef1ec25d886b05e09c876bd8398") (:authors ("Tyler Smith" . "tyler@plantarum.ca")) (:maintainer "Tyler Smith" . "tyler@plantarum.ca") (:keywords "grass" "gis"))]) + (grayscale-theme . [(20171005 802) nil "A simple grayscale theme" single ((:commit . "53ad50e10e68f2f076ebfc96e10ecef7a932d38d") (:authors ("Kaleb Elwert" . "belak@coded.io")) (:maintainer "Kaleb Elwert" . "belak@coded.io") (:keywords "lisp") (:url . "https://github.com/belak/emacs-grayscale-theme"))]) + (greek-polytonic . [(20190303 1358) ((emacs (24))) "Quail package for inputting polytonic Greek" single ((:commit . "114cba0f57cc077871693c799b807df2292341ec") (:authors ("Johannes Choo" . "jhanschoo@gmail.com")) (:maintainer "Johannes Choo" . "jhanschoo@gmail.com") (:keywords "i18n" "multilingual" "input method" "greek") (:url . "https://github.com/jhanschoo/greek-polytonic"))]) + (green-is-the-new-black-theme . [(20210203 1511) nil "A cool and minimalist green blackened theme engine" single ((:commit . "09f6908064dd1854379a072d7cdd706959256299") (:authors ("Fred Campos" . "fred.tecnologia@gmail.com")) (:maintainer "Fred Campos" . "fred.tecnologia@gmail.com") (:keywords "faces" "themes") (:url . "https://github.com/fredcamps/green-is-the-new-black-emacs"))]) + (green-phosphor-theme . [(20150515 1447) nil "A light color theme with muted, autumnal colors." single ((:commit . "fa42f598626adfdc5450e5c380fa2d5df6110f28") (:authors ("Adam Alpern" . "adam.alpern@gmail.com")) (:maintainer "Adam Alpern" . "adam.alpern@gmail.com") (:keywords "color" "theme") (:url . "http://github.com/aalpern/emacs-color-theme-green-phosphor"))]) + (green-screen-theme . [(20180816 1502) nil "A nice color theme for those who miss green CRTs" single ((:commit . "774e8f6c033786406267f71ec07319d906a30b75") (:authors ("Ricardo Banffy" . "rbanffy@gmail.com")) (:maintainer "Ricardo Banffy" . "rbanffy@gmail.com") (:keywords "faces" "theme") (:url . "https://github.com/rbanffy/green-screen-emacs"))]) + (gregorio-mode . [(20170705 1451) nil "Gregorio Mode for .gabc files" single ((:commit . "736fd3d05fb67f707cca1a7ce24e3ee7ca5e9567") (:authors ("Fr. John Jenkins" . "jenkins@sspx.ng")) (:maintainer "Fr. John Jenkins" . "jenkins@sspx.ng") (:keywords "gregorio" "chant") (:url . "https://jsrjenkins.github.io/gregorio-mode/"))]) + (grep-a-lot . [(20210618 1420) nil "manages multiple search results buffers for grep.el" single ((:commit . "223819dbea049bdeb5f97f9849fce139a5f16a75") (:authors ("Avi Rozen" . "avi.rozen@gmail.com")) (:maintainer "Avi Rozen" . "avi.rozen@gmail.com") (:keywords "tools" "convenience" "search") (:url . "https://github.com/ZungBang/emacs-grep-a-lot"))]) + (greymatters-theme . [(20150621 1123) ((emacs (24))) "Emacs 24 theme with a light background." single ((:commit . "a7220a8c6cf18ccae2b76946b6f01188a7c9d5d1") (:authors ("Martin Haesler")) (:maintainer "Martin Haesler"))]) + (grip-mode . [(20220430 1545) ((emacs (24 4))) "Instant GitHub-flavored Markdown/Org preview using grip." single ((:commit . "7fa9e9e6b650f7a6c026b7e24c2af171e8818667") (:authors ("Vincent Zhang" . "seagle0128@gmail.com")) (:maintainer "Vincent Zhang" . "seagle0128@gmail.com") (:keywords "convenience" "markdown" "preview") (:url . "https://github.com/seagle0128/grip-mode"))]) + (grizzl . [(20160818 737) ((cl-lib (0 5)) (emacs (24 3))) "Fast fuzzy search index for Emacs." single ((:commit . "1e917253ce2b846f0272b8356fad3dbff9cd513a") (:authors ("Chris Corbyn" . "chris@w3style.co.uk")) (:maintainer "Bozhidar Batsov" . "bozhidar@batsov.com") (:keywords "convenience" "usability") (:url . "https://github.com/grizzl/grizzl"))]) + (groovy-imports . [(20210505 1807) ((emacs (24 4)) (s (1 10 0)) (pcache (0 3 2))) "Code for dealing with Groovy imports" single ((:commit . "a60c3202973e3185091db623d960f71840a22205") (:authors ("Miro Bezjak")) (:maintainer "Miro Bezjak") (:keywords "groovy") (:url . "http://www.github.com/mbezjak/emacs-groovy-imports"))]) + (groovy-mode . [(20220212 646) ((s (1 12 0)) (emacs (24 3)) (dash (2 13 0))) "Major mode for Groovy source files" tar ((:commit . "29210e5a969c02169b68e04f2e28e3bf2fc13363") (:authors ("Russel Winder" . "russel@winder.org.uk") ("Jim Morris" . "morris@wolfman.com") ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Russel Winder" . "russel@winder.org.uk") (:keywords "languages"))]) + (gruber-darker-theme . [(20220107 1815) nil "Gruber Darker color theme for Emacs 24." single ((:commit . "72278089c440d45c00fb8afcd53af82fd30f451b") (:authors ("Alexey Kutepov" . "reximkut@gmail.com")) (:maintainer "Alexey Kutepov" . "reximkut@gmail.com") (:url . "http://github.com/rexim/gruber-darker-theme"))]) + (grugru . [(20211119 815) ((emacs (24 4))) "Rotate text at point" tar ((:commit . "ac92a8d54efe000557564a9b01a426f34cc01dfa") (:authors ("ROCKTAKEY" . "rocktakey@gmail.com")) (:maintainer "ROCKTAKEY" . "rocktakey@gmail.com") (:keywords "convenience" "abbrev" "tools") (:url . "https://github.com/ROCKTAKEY/grugru"))]) + (grunt . [(20160316 1528) ((dash (2 9 0)) (ansi-color (3 4 2)) (emacs (24 3))) "Some glue to stick Emacs and Gruntfiles together" single ((:commit . "4c269e2738658643ec2ed9ef61a2a3d71b08d304") (:authors ("Daniel Gempesaw" . "dgempesaw@sharecare.com")) (:maintainer "Daniel Gempesaw" . "dgempesaw@sharecare.com") (:keywords "convenience" "grunt") (:url . "https://github.com/gempesaw/grunt.el"))]) + (gruvbox-theme . [(20220101 1208) ((autothemer (0 2))) "A retro-groove colour theme for Emacs" tar ((:commit . "921bfd7a2f5174b68682b04e6010b156bbfe6c70") (:authors ("Jason Milkins" . "jasonm23@gmail.com")) (:maintainer "Jason Milkins" . "jasonm23@gmail.com") (:url . "http://github.com/greduan/emacs-theme-gruvbox"))]) + (gs-mode . [(20151202 1006) nil "Major mode for editing GrADS script files" single ((:commit . "1a13051db21b999c7682a015b33a03096ff9d891") (:authors ("Joe Wielgosz" . "joew@cola.iges.org")) (:maintainer "Joe Wielgosz" . "joew@cola.iges.org") (:keywords "grads" "script" "major-mode"))]) + (gscholar-bibtex . [(20190130 555) nil "Retrieve BibTeX from Google Scholar and other online sources(ACM, IEEE, DBLP)" single ((:commit . "3b651e3de116860eb1f1aef9b547a561784871fe") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions"))]) + (gsettings . [(20210407 2045) ((emacs (24 3)) (dash (2 16 0)) (gvariant (1 0 0)) (s (1 12 0))) "GSettings (Gnome) helpers" single ((:commit . "9f9fb1fe946bbba46307c26355f355225ea7262a") (:authors ("wouter bolsterlee" . "wouter@bolsterl.ee")) (:maintainer "wouter bolsterlee" . "wouter@bolsterl.ee") (:keywords "languages") (:url . "https://github.com/wbolster/emacs-gsettings"))]) + (gsnip . [(20220206 1526) ((emacs (26)) (aio (1 0)) (log4e (0 3 3))) "A gitlab snippet client" single ((:commit . "4d473b726b3f3b6bb7d1b5f66a9d368588ce0f86") (:authors ("Wang Kai" . "kaiwkx@gmail.com")) (:maintainer "Wang Kai" . "kaiwkx@gmail.com") (:keywords "extensions" "tools") (:url . "https://github.com/kaiwk/gitlab-snippet"))]) + (gtk-pomodoro-indicator . [(20191007 1500) nil "A pomodoro indicator for the GTK tray" tar ((:commit . "338e6dca6d749cfc85195907bba593f9f6855715") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "convenience" "pomodoro") (:url . "https://github.com/abo-abo/gtk-pomodoro-indicator"))]) + (gtk-variant . [(20200416 2136) ((emacs (25 1))) "Set the GTK theme variant (titlebar color)" single ((:commit . "e0653e4a654b7800dc15f7e1a06a956b77d2aabe") (:authors ("Paul Oppenheimer")) (:maintainer "Paul Oppenheimer") (:keywords "frames" "gtk" "titlebar") (:url . "https://github.com/bepvte/gtk-variant.el"))]) + (guess-language . [(20220408 1545) ((cl-lib (0 5)) (emacs (24))) "Robust automatic language detection" tar ((:commit . "b1fc363ca2c30b8a8ddaf2e366bca7770c8cfbec") (:authors ("Titus von der Malsburg" . "malsburg@posteo.de")) (:maintainer "Titus von der Malsburg" . "malsburg@posteo.de") (:keywords "wp") (:url . "https://github.com/tmalsburg/guess-language.el"))]) + (guide-key . [(20150108 635) ((dash (2 10 0)) (popwin (0 3 0)) (s (1 9 0))) "Guide the following key bindings automatically and dynamically" single ((:commit . "8f8b839f42edd53af13d588254f07727108ae312") (:authors ("Tsunenobu Kai" . "kai2nenobu@gmail.com")) (:maintainer "Tsunenobu Kai" . "kai2nenobu@gmail.com") (:keywords "help" "convenience") (:url . "https://github.com/kai2nenobu/guide-key"))]) + (guide-key-tip . [(20161011 823) ((guide-key (1 2 3)) (pos-tip (0 4 5))) "Show guide-key.el hints using pos-tip.el" single ((:commit . "02c5d4b0b65f3e91be5a47f0ff1ae5e86e00c64e") (:authors ("Hiroaki Otsu" . "ootsuhiroaki@gmail.com")) (:maintainer "Hiroaki Otsu" . "ootsuhiroaki@gmail.com") (:keywords "help" "convenience" "tooltip") (:url . "https://github.com/aki2o/guide-key-tip"))]) + (guix . [(20210608 1653) ((emacs (24 3)) (dash (2 11 0)) (geiser (0 8)) (bui (1 2 0)) (magit-popup (2 1 0)) (edit-indirect (0 1 4))) "Interface for GNU Guix" tar ((:commit . "c9aef52121b458297e70bb50f49f7276b4a8d759") (:authors ("Alex Kost" . "alezost@gmail.com")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "tools") (:url . "https://emacs-guix.gitlab.io/website/"))]) + (gulp-task-runner . [(20170718 2041) nil "Gulp task runner" single ((:commit . "877990e956b1d71e2d9c7c3e5a129ad199b9debb") (:authors ("Nicolas Petton" . "nicolas@petton.fr")) (:maintainer "Nicolas Petton" . "nicolas@petton.fr") (:keywords "convenience" "javascript"))]) + (gumshoe . [(20211229 152) ((emacs (25 1))) "Scoped spatial and temporal POINT movement tracking" tar ((:commit . "2366f1c65cdcf09c6b98ca466110842cd88c9db3") (:authors ("overdr0ne")) (:maintainer "overdr0ne") (:keywords "tools") (:url . "https://github.com/Overdr0ne/gumshoe"))]) + (guru-mode . [(20211025 1157) nil "Become an Emacs guru" single ((:commit . "a3370e547eab260d24774cd50ccbe865373c8631") (:authors ("Bozhidar Batsov" . "bozhidar@batsov.dev")) (:maintainer "Bozhidar Batsov" . "bozhidar@batsov.dev") (:keywords "convenience") (:url . "https://github.com/bbatsov/guru-mode"))]) + (gvariant . [(20210507 1310) ((emacs (24)) (parsec (0 1 4))) "GVariant (GLib) helpers" single ((:commit . "f2e87076845800cbaaeed67f175ad4e4a9c01e37") (:authors ("wouter bolsterlee" . "wouter@bolsterl.ee")) (:maintainer "wouter bolsterlee" . "wouter@bolsterl.ee") (:keywords "languages") (:url . "https://github.com/wbolster/emacs-gvariant"))]) + (gvpr-mode . [(20201007 2054) nil "A major mode offering basic syntax coloring for gvpr scripts." single ((:commit . "ef6ec2d4a4c9de68078c94a0e43b05bf77ec4674") (:authors ("Rod Waldhoff" . "r.waldhoff@gmail.com")) (:maintainer "Rod Waldhoff" . "r.waldhoff@gmail.com") (:keywords "graphviz" "gv" "dot" "gvpr" "graph") (:url . "https://raw.github.com/rodw/gvpr-lib/master/extra/gvpr-mode.el"))]) + (gxref . [(20170411 1753) ((emacs (25))) "xref backend using GNU Global." single ((:commit . "380b02c3c3c2586c828456716eef6a6392bb043b") (:authors ("Dedi Hirschfeld")) (:maintainer "Dedi Hirschfeld") (:keywords "xref" "global" "tools") (:url . "https://github.com/dedi/gxref"))]) + (habamax-theme . [(20181001 850) ((emacs (24))) "Boring white background color that gets the job done." single ((:commit . "6e86a1b23b6e2aaf40d4374b5673da00a28be447") (:authors ("Maxim Kim" . "habamax@gmail.com")) (:maintainer "Maxim Kim" . "habamax@gmail.com") (:url . "https://github.com/habamax/habamax-theme"))]) + (habitica . [(20220215 1758) ((org (8 3 5)) (emacs (24 3))) "Interface for habitica.com" single ((:commit . "9e1fde7f359f7f6a6976b857fbbdbc8dd4fd3327") (:authors ("Adrien Brochard")) (:maintainer "Adrien Brochard") (:keywords "habitica" "todo") (:url . "https://github.com/abrochard/emacs-habitica"))]) + (hack-mode . [(20211224 19) ((emacs (25 1)) (s (1 11 0))) "Major mode for the Hack programming language" single ((:commit . "a522f61c088ee2a13ab17f289a3131329e59badf") (:authors ("John Allen , Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "John Allen , Wilfred Hughes" . "me@wilfred.me.uk") (:url . "https://github.com/hhvm/hack-mode"))]) + (hacker-typer . [(20170206 1520) ((emacs (24))) "Pretend to write code like a pro" tar ((:commit . "d5a23714a4ccc5071580622f278597d5973f40bd") (:authors ("Diego A. Mundo" . "diegoamundo@gmail.com")) (:maintainer "Diego A. Mundo" . "diegoamundo@gmail.com") (:keywords "hacker" "typer" "multimedia" "games") (:url . "http://github.com/therockmandolinist/emacs-hacker-typer"))]) + (hackernews . [(20210226 1226) nil "Hacker News Client for Emacs" single ((:commit . "ccfa75c0b3d67201cdf0f2324f311544ade498db") (:authors ("Lincoln de Sousa" . "lincoln@comum.org")) (:maintainer "Basil L. Contovounesios" . "contovob@tcd.ie") (:keywords "comm" "hypermedia" "news") (:url . "https://github.com/clarete/hackernews.el"))]) + (hal-mode . [(20160704 1746) nil "Major mode for editing HAL files" single ((:commit . "cd2f66f219ee520198d4586fb6b169cef7ad3f21") (:authors ("Alexander Rössler")) (:maintainer "Alexander Rössler") (:keywords "language") (:url . "https://github.com/strahlex/hal-mode/"))]) + (ham-mode . [(20150811 1306) ((html-to-markdown (1 2)) (markdown-mode (2 0))) "Html As Markdown. Transparently edit an html file using markdown" single ((:commit . "3a141986a21c2aa6eefb428983352abb8b7907d2") (:authors ("Artur Malabarba" . "bruce.connor.am@gmail.com")) (:maintainer "Artur Malabarba" . "bruce.connor.am@gmail.com") (:keywords "convenience" "emulation" "wp") (:url . "http://github.com/Bruce-Connor/ham-mode"))]) + (hamburg-theme . [(20160123 740) ((emacs (24))) "Color Theme with a dark blue background." single ((:commit . "aacefdf1501d97a5afc0e63c8ead4b2463323028") (:authors ("Martin Haesler")) (:maintainer "Martin Haesler"))]) + (hamburger-menu . [(20220509 1341) ((emacs (28 1))) "Mode line hamburger menu" single ((:commit . "06bc9d6872007a31226d7410d497a0acd98b272b") (:authors ("Iain Nicol")) (:maintainer "Iain Nicol") (:keywords "hamburger" "menu") (:url . "https://gitlab.com/iain/hamburger-menu-mode"))]) + (haml-mode . [(20190219 2102) ((emacs (24)) (cl-lib (0 5))) "Major mode for editing Haml files" single ((:commit . "bf5b6c11b1206759d2b28af48765e04882dd1fc4") (:authors ("Natalie Weizenbaum")) (:maintainer "Natalie Weizenbaum") (:keywords "markup" "languages" "html") (:url . "https://github.com/nex3/haml-mode"))]) + (hamlet-mode . [(20131208 724) ((cl-lib (0 3)) (dash (2 3 0)) (s (1 7 0))) "Hamlet editing mode" single ((:commit . "7362b955e556a3d007fa06945a27e5b99349527d") (:authors (nil . "Kata =v1.4)") ("2003 Dave Love" . "fx@gnu.org") ("2016 Arthur Fayzrakhmanov")) (:maintainer "1992 Simon Marlow") (:keywords "faces" "files" "haskell") (:url . "https://github.com/haskell/haskell-mode"))]) + (haskell-snippets . [(20210228 344) ((cl-lib (0 5)) (yasnippet (0 8 0))) "Yasnippets for Haskell" tar ((:commit . "1c29c4a68ce89848b8d371c6510d1de3b586c8b3") (:authors ("Luke Hoersten" . "luke@hoersten.org")) (:maintainer "Luke Hoersten" . "luke@hoersten.org") (:keywords "snippets" "haskell") (:url . "https://github.com/haskell/haskell-snippets"))]) + (haskell-tab-indent . [(20200513 1950) nil "tab-based indentation for haskell-mode" single ((:commit . "3239e814d6999f31ad845cc58df53395ad299059") (:authors ("Sean Whitton" . "spwhitton@spwhitton.name")) (:maintainer "Sean Whitton" . "spwhitton@spwhitton.name") (:keywords "indentation" "haskell") (:url . "https://spwhitton.name/tech/code/haskell-tab-indent/"))]) + (hasklig-mode . [(20211017 1730) ((emacs (25))) "Hasklig ligatures" single ((:commit . "d708937592f9e2d28ae5622086b9c24d60cd8ac2") (:authors ("Daniel Mendler")) (:maintainer "Daniel Mendler") (:url . "https://github.com/minad/hasklig-mode"))]) + (hass . [(20220402 1326) ((emacs (25 1)) (request (0 3 3))) "Interact with Home Assistant" tar ((:commit . "c6bded14ae4b68194bd9e35428e9973ca144569b") (:authors ("Ben Whitley")) (:maintainer "Ben Whitley") (:url . "https://github.com/purplg/hass"))]) + (haste . [(20141030 2034) ((json (1 2))) "Emacs client for hastebin (http://hastebin.com/about.md)" single ((:commit . "22d05aacc3296ab50a7361222ab139fb4d447c25") (:authors ("Ric Lister")) (:maintainer "Ric Lister") (:url . "http://github.com/rlister/emacs-haste-client"))]) + (haxe-imports . [(20170330 2304) ((emacs (24 4)) (s (1 10 0)) (pcache (0 3 1))) "Code for dealing with Haxe imports" single ((:commit . "f104a641f3dfe698359d9aca1f28d9383cf43e04") (:authors ("Juan Karlo Licudine" . "karlo@accidentalrebel.com")) (:maintainer "Juan Karlo Licudine" . "karlo@accidentalrebel.com") (:keywords "haxe") (:url . "http://www.github.com/accidentalrebel/emacs-haxe-imports"))]) + (haxe-mode . [(20210108 1835) nil "Major mode for editing Haxe files" single ((:commit . "6641a0d7c00ce633887baf3f8c594d9a8a504e9b") (:authors ("Jens Peter Secher (original)")) (:maintainer "Jen-Chieh Shen" . "jcs090218@gmail.com") (:url . "https://github.com/emacsorphanage/haxe-mode"))]) + (haxor-mode . [(20160618 1129) ((emacs (24 0))) "Major mode for editing Haxor Assembly Files" single ((:commit . "6fa25a8e6b6a59481bc0354c2fe1e0ed53cbdc91") (:authors ("Krzysztof Magosa" . "krzysztof@magosa.pl")) (:maintainer "Krzysztof Magosa" . "krzysztof@magosa.pl") (:keywords "haxor") (:url . "https://github.com/krzysztof-magosa/haxor-mode"))]) + (hayoo . [(20140831 1221) ((emacs (24)) (json (1 3))) "Query hayoo and show results in a tabulated buffer." single ((:commit . "3ca2fb0c4d5f337d0410c21b2702dd147014e984") (:authors ("Marko Bencun" . "mbencun@gmail.com")) (:maintainer "Marko Bencun" . "mbencun@gmail.com") (:keywords "hayoo" "haskell") (:url . "https://github.com/benma/hayoo.el/"))]) + (hc-zenburn-theme . [(20150928 1633) nil "An higher contrast version of the Zenburn theme." single ((:commit . "fd0024a5191cdce204d91c8f1db99ba31640f6e9") (:authors ("Nantas Nardelli" . "nantas.nardelli@gmail.com")) (:maintainer "Nantas Nardelli" . "nantas.nardelli@gmail.com") (:url . "https:github.com/edran/hc-zenburn-emacs"))]) + (hcl-mode . [(20200315 2129) ((emacs (24 3))) "Major mode for Hashicorp" single ((:commit . "e4d9eef631e8a386341ae8f94f7c2579586e65b5") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/emacs-hcl-mode"))]) + (headlong . [(20150417 1526) nil "reckless completion" single ((:commit . "f6830f87f236eee88263cb6976125f72422abe72") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "completion") (:url . "https://github.com/abo-abo/headlong"))]) + (heaven-and-hell . [(20190713 1830) ((emacs (24 4))) "easy toggle light/dark themes" single ((:commit . "e1febfd60d060c110a1e43c5f093cd8537251308") (:authors ("Valentin Ignatev" . "valentignatev@gmail.com")) (:maintainer "Valentin Ignatev" . "valentignatev@gmail.com") (:keywords "faces") (:url . "https://github.com/valignatev/heaven-and-hell"))]) + (helm . [(20220509 1011) ((helm-core (3 8 4)) (popup (0 5 3))) "Helm is an Emacs incremental and narrowing framework" tar ((:commit . "ec76b7d0ffaa77bae47be5b9ee9069601a463d5b") (:authors ("Thierry Volpiatto" . "thierry.volpiatto@gmail.com")) (:maintainer "Thierry Volpiatto" . "thierry.volpiatto@gmail.com") (:url . "https://emacs-helm.github.io/helm/"))]) + (helm-R . [(20120820 14) ((helm (20120517)) (ess (20120509))) "helm-sources and some utilities for GNU R." single ((:commit . "b0eb9d5f6a483a9dbe6eb6cf1f2024d4f5938bc2") (:authors ("myuhe ")) (:maintainer "myuhe") (:keywords "convenience") (:url . "https://github.com/myuhe/helm-R.el"))]) + (helm-ack . [(20141030 1226) ((helm (1 0)) (cl-lib (0 5))) "Ack command with helm interface" single ((:commit . "889bc225318d14c6e3be80e73b1d9d6fb30e48c3") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-helm-ack"))]) + (helm-ad . [(20151209 1015) ((dash (2 8 0)) (helm (1 6 2))) "helm source for Active Directory" single ((:commit . "8ac044705d8620ee354a9cfa8cc1b865e83c0d55") (:authors ("Takahiro Noda" . "takahiro.noda+github@gmail.com")) (:maintainer "Takahiro Noda" . "takahiro.noda+github@gmail.com") (:keywords "comm"))]) + (helm-ag . [(20210702 845) ((emacs (25 1)) (helm (2 0))) "The silver searcher with helm interface" single ((:commit . "9820ba1893c8a7e31e756c891f9b4cf0eff1e50b") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-helm-ag"))]) + (helm-ag-r . [(20131123 1531) ((helm (1 0))) "Search something by ag and display by helm" single ((:commit . "67de4ebafe9b088db950eefa5ef590a6d78b4ac8") (:authors ("Yuta Yamada ")) (:maintainer "Yuta Yamada ") (:keywords "searching") (:url . "https://github.com/yuutayamada/helm-ag-r"))]) + (helm-apt . [(20210324 1929) ((helm (3 6)) (emacs (25 1))) "Helm interface for Debian/Ubuntu packages (apt-*)" single ((:commit . "c952b5dc26015bc9c947973df99246212d276b63") (:authors ("Thierry Volpiatto" . "thierry.volpiatto@gmail.com")) (:maintainer "Thierry Volpiatto" . "thierry.volpiatto@gmail.com") (:url . "https://github.com/emacs-helm/helm-apt"))]) + (helm-atoms . [(20201013 1723) ((emacs (25 1)) (helm (2 0))) "Reverse variable lookup using Helm" single ((:commit . "7e6f91a16f556c96ae1b0d1f965ea56861bb6372") (:authors ("Dante Catalfamo")) (:maintainer "Dante Catalfamo") (:keywords "help" "lisp" "maint" "helm" "tools" "matching") (:url . "https://github.com/dantecatalfamo/helm-atoms"))]) + (helm-aws . [(20180514 1032) ((helm (1 5 3)) (cl-lib (0 5)) (s (1 9 0))) "Manage AWS EC2 server instances directly from Emacs" single ((:commit . "b36c744b3f00f458635a91d1f5158fccbb5baef6") (:authors ("istib")) (:maintainer "istib") (:url . "https://github.com/istib/helm-aws"))]) + (helm-backup . [(20180911 614) ((helm (1 5 5)) (s (1 8 0)) (cl-lib (0))) "Backup each file change using git" single ((:commit . "691fe542f38fc7c8cca409997f6a0ff5d76ad6c2") (:authors ("Anthony HAMON" . "hamon.anth@gmail.com")) (:maintainer "Anthony HAMON" . "hamon.anth@gmail.com") (:keywords "backup" "convenience" "files" "tools" "vc") (:url . "http://github.com/antham/helm-backup"))]) + (helm-bbdb . [(20190728 1325) ((emacs (24 3)) (helm (1 5)) (bbdb (3 1 2))) "Helm interface for bbdb" single ((:commit . "db69114ff1af8bf48b5a222242e3a8dd6e101e67") (:url . "https://github.com/emacs-helm/helm-bbdb"))]) + (helm-bibtex . [(20210725 1510) ((bibtex-completion (1 0 0)) (helm (1 5 5)) (cl-lib (0 5)) (emacs (24 1))) "A bibliography manager based on Helm" single ((:commit . "ce8c17690ddad73d01531084b282f221f8eb6669") (:authors ("Titus von der Malsburg" . "malsburg@posteo.de")) (:maintainer "Titus von der Malsburg" . "malsburg@posteo.de") (:url . "https://github.com/tmalsburg/helm-bibtex"))]) + (helm-bibtexkey . [(20140214 1504) ((helm (1 5 8))) "Bibtexkey source for helm" tar ((:commit . "aa1637ea5c8c5f1817e480fc2a3750cafab3d99f") (:authors ("TAKAGI Kentaro ")) (:maintainer "TAKAGI Kentaro ") (:keywords "bib" "tex") (:url . "https://github.com/kenbeese/helm-bibtexkey"))]) + (helm-bind-key . [(20141109 515) ((bind-key (1 0)) (helm (1 6 4))) "helm-source for for bind-key." single ((:commit . "9da6ad8b7530e72fb4ac67be8c6a482898dddc25") (:authors ("Yuhei Maeda ")) (:maintainer "myuhe") (:keywords "convenience" "emulation"))]) + (helm-bitbucket . [(20190422 1102) ((emacs (24)) (helm-core (3 0))) "Search Bitbucket with Helm" single ((:commit . "c722016622ad019202419cca60c3be3c53e56130") (:authors ("Peter Urbak" . "tolowercase@gmail.com")) (:maintainer "Peter Urbak" . "tolowercase@gmail.com") (:keywords "matching") (:url . "https://github.com/dragonwasrobot/helm-bitbucket"))]) + (helm-bm . [(20160321 1331) ((bm (1 0)) (cl-lib (0 5)) (helm (1 9 3)) (s (1 11 0))) "helm sources for bm.el" single ((:commit . "d66341f5646c23178d4d8bffb6cfebe3fb73f1d7") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "helm" "bookmark") (:url . "https://github.com/yasuyk/helm-bm"))]) + (helm-books . [(20170325 631) ((helm (1 7 7))) "Helm interface for searching books" single ((:commit . "625aadec1541a5ca36951e4ce1301f4b6fe2bf3f") (:authors ("grugrut" . "grugruglut+github@gmail.com")) (:maintainer "grugrut" . "grugruglut+github@gmail.com") (:url . "https://github.com/grugrut/helm-books"))]) + (helm-bufler . [(20210708 2217) ((emacs (26 3)) (bufler (0 2 -1)) (helm (1 9 4))) "Helm source for Bufler" single ((:commit . "a68e0eb2719c67ab8a3ad56c4036364061d06004") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "convenience") (:url . "https://github.com/alphapapa/bufler.el"))]) + (helm-bundle-show . [(20190526 1401) ((emacs (24)) (helm (1 8 0))) "Bundle show with helm interface" single ((:commit . "70f1ca7d1847c7d5cd5a3e488562cd4a295b809f") (:authors ("Takashi Masuda" . "masutaka.net@gmail.com")) (:maintainer "Takashi Masuda" . "masutaka.net@gmail.com") (:url . "https://github.com/masutaka/emacs-helm-bundle-show"))]) + (helm-c-moccur . [(20151230 924) ((helm (20120811)) (color-moccur (2 71))) "helm source for color-moccur.el" single ((:commit . "b0a906f85fa352db091f88b91a9c510de607dfe9") (:authors ("Kenji.I (Kenji Imakado)" . "ken.imakaado@gmail.com")) (:maintainer "Kenji.I (Kenji Imakado)" . "ken.imakaado@gmail.com") (:keywords "convenience" "emulation"))]) + (helm-c-yasnippet . [(20210330 16) ((emacs (25 1)) (helm (1 7 7)) (yasnippet (0 8 0))) "helm source for yasnippet.el" single ((:commit . "e214eec8b2875d8a7cd09006dfb6a8e15e9e4079") (:authors ("Kenji.I (Kenji Imakado)" . "ken.imakaado@gmail.com")) (:maintainer "Kenji.I (Kenji Imakado)" . "ken.imakaado@gmail.com") (:keywords "convenience" "emulation"))]) + (helm-catkin . [(20190425 1520) ((emacs (24 3)) (helm (0)) (xterm-color (0))) "Package for compile ROS workspaces with catkin-tools" single ((:commit . "d33c71cecd35616dfa7c3b81d8f51c128405977f") (:authors ("Thore Goll" . "thoregoll@googlemail.com")) (:maintainer "Thore Goll" . "thoregoll@googlemail.com") (:keywords "catkin" "helm" "build" "tools" "ros") (:url . "https://github.com/gollth/helm-catkin"))]) + (helm-charinfo . [(20170810 1231) ((emacs (24)) (helm (1 7 0)) (cl-lib (0 5))) "A helm source for character information" single ((:commit . "91798a49dc115342a7e01e48b264e9a0bf5ea414") (:authors ("Christian Wittern" . "cwittern@gmail.com")) (:maintainer "Christian Wittern" . "cwittern@gmail.com") (:keywords "convenience") (:url . "https://github.com/cwittern/helm-charinfo"))]) + (helm-chrome . [(20160719 520) ((helm (1 5)) (cl-lib (0 3)) (emacs (24))) "Helm interface for Chrome bookmarks" single ((:commit . "fd630ace4b4b4f33355a973743bbfe0c90ce4830") (:authors ("KAWABATA, Taichi ")) (:maintainer "KAWABATA, Taichi ") (:keywords "tools") (:url . "https://github.com/kawabata/helm-chrome"))]) + (helm-chrome-control . [(20190707 1807) ((emacs (25 1)) (helm-core (3 0))) "Control Chrome tabs with Helm (macOS only)" tar ((:commit . "e6758763099959e961e218bb1122526323f7ee5e") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:url . "https://github.com/xuchunyang/helm-chrome-control"))]) + (helm-chrome-history . [(20191031 1233) ((emacs (25 1)) (helm-core (3 0))) "Browse Chrome History with Helm" single ((:commit . "f9002d4c12df65a99830376b126dbbeae3ef2148") (:authors ("Xu Chunyang" . "mail@xuchunyang.me")) (:maintainer "Xu Chunyang" . "mail@xuchunyang.me") (:keywords "tools") (:url . "https://github.com/xuchunyang/helm-chrome-history"))]) + (helm-chronos . [(20150528 2036) ((chronos (1 2)) (helm (1 7 1))) "helm interface for chronos timers" tar ((:commit . "a14fc3d65dd96ce6616234b3f7b8b08b4c1817ef") (:authors ("David Knight" . "dxknight@opmbx.org")) (:maintainer "David Knight" . "dxknight@opmbx.org") (:keywords "calendar") (:url . "http://github.com/dxknight/helm-chronos"))]) + (helm-cider . [(20220102 1626) ((emacs (26)) (cider (1 0)) (helm-core (2 8))) "Helm interface to CIDER" tar ((:commit . "00809e45de919c82753f332f29358f0ddbf21936") (:authors ("Tianxiang Xiong" . "tianxiang.xiong@gmail.com")) (:maintainer "Tianxiang Xiong" . "tianxiang.xiong@gmail.com") (:keywords "cider" "clojure" "helm" "languages") (:url . "https://github.com/clojure-emacs/helm-cider"))]) + (helm-cider-history . [(20150719 2120) ((helm (1 4 0)) (cider (0 9 0))) "Helm interface for cider history" single ((:commit . "c391fcb2e162a02001605a0b9449783575a831fd") (:authors ("Andreas Klein" . "git@kungi.org")) (:maintainer "Andreas Klein" . "git@kungi.org") (:keywords "convenience") (:url . "https://github.com/Kungi/helm-cider-history"))]) + (helm-circe . [(20160207 652) ((emacs (24)) (helm (0 0)) (circe (0 0)) (cl-lib (0 5))) "helm circe buffer management." single ((:commit . "9091651d9fdd8d49d8ff6f9dcf3a2ae416c9f15a") (:authors ("Les Harris" . "les@lesharris.com")) (:maintainer "Les Harris" . "les@lesharris.com") (:keywords "helm" "circe") (:url . "https://github.com/lesharris/helm-circe"))]) + (helm-clojuredocs . [(20160405 723) ((edn (1 1 2)) (helm (1 5 7))) "search for help in clojuredocs.org" single ((:commit . "5a7f0f2cb401be0b09e73262a1c18265ab9a3cea") (:authors ("Michal Buczko" . "michal.buczko@gmail.com")) (:maintainer "Michal Buczko" . "michal.buczko@gmail.com") (:keywords "helm" "clojure") (:url . "https://github.com/mbuczko/helm-clojuredocs"))]) + (helm-cmd-t . [(20170125 1459) nil "cmd-t style completion" tar ((:commit . "7fa3d4a9f7271512e54c5de999079b27c9eec6bf") (:authors ("Le Wang")) (:maintainer "Le Wang") (:keywords "helm" "project-management" "completion" "convenience" "cmd-t" "textmate") (:url . "https://github.com/lewang/helm-cmd-t"))]) + (helm-codesearch . [(20190412 1153) ((emacs (25 1)) (s (1 11 0)) (dash (2 12 0)) (helm (1 7 7)) (cl-lib (0 5))) "helm interface for codesearch" single ((:commit . "72f1d1de746115ab7e861178b49fa3c0b6b58d90") (:authors ("Youngjoo Lee" . "youngker@gmail.com")) (:maintainer "Youngjoo Lee" . "youngker@gmail.com") (:keywords "tools"))]) + (helm-commandlinefu . [(20150611 545) ((emacs (24 1)) (helm (1 7 0)) (json (1 3)) (let-alist (1 0 3))) "Search and browse commandlinefu.com from helm" single ((:commit . "9ee7e018c5db23ae9c8d1c8fa969876f15b7280d") (:authors ("Chunyang Xu" . "xuchunyang56@gmail.com")) (:maintainer "Chunyang Xu" . "xuchunyang56@gmail.com") (:keywords "commandlinefu.com") (:url . "https://github.com/xuchunyang/helm-commandlinefu"))]) + (helm-company . [(20190812 1429) ((helm (1 5 9)) (company (0 6 13))) "Helm interface for company-mode" single ((:commit . "6eb5c2d730a60e394e005b47c1db018697094dde") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Daniel Ralston" . "Sodel-the-Vociferous@users.noreply.github.com") (:url . "https://github.com/Sodel-the-Vociferous/helm-company"))]) + (helm-core . [(20220503 622) ((emacs (25 1)) (async (1 9 4))) "Development files for Helm" tar ((:commit . "ec76b7d0ffaa77bae47be5b9ee9069601a463d5b") (:authors ("Thierry Volpiatto" . "thierry.volpiatto@gmail.com")) (:maintainer "Thierry Volpiatto" . "thierry.volpiatto@gmail.com") (:url . "https://emacs-helm.github.io/helm/"))]) + (helm-cscope . [(20190615 41) ((xcscope (1 0)) (helm (1 6 7)) (cl-lib (0 5)) (emacs (24 1))) "Helm interface for xcscope.el." single ((:commit . "af1d9e7f4460a88d7400b5a74d5da68084089ac1") (:authors ("alpha22jp" . "alpha22jp@gmail.com")) (:maintainer "alpha22jp" . "alpha22jp@gmail.com") (:keywords "cscope" "helm") (:url . "https://github.com/alpha22jp/helm-cscope.el"))]) + (helm-css-scss . [(20191230 1549) ((emacs (24 3)) (helm (1 0))) "CSS/SCSS/LESS Selectors with helm interface" single ((:commit . "48b996f73af1fef8d6e88a1c545d98f8c50b0cf3") (:authors ("Shingo Fukuyama - http://fukuyama.co")) (:maintainer "Shingo Fukuyama - http://fukuyama.co") (:keywords "convenience" "scss" "css" "less" "selector" "helm") (:url . "https://github.com/ShingoFukuyama/helm-css-scss"))]) + (helm-ctest . [(20191031 1435) ((s (1 9 0)) (dash (2 11 0)) (helm-core (1 7 4))) "Run ctest from within emacs" single ((:commit . "2a29cfb4ec583da247fa2ae7bac88790b1223e40") (:authors ("Dan LaManna" . "me@danlamanna.com")) (:maintainer "Dan LaManna" . "me@danlamanna.com") (:keywords "helm" "ctest"))]) + (helm-dash . [(20190527 1118) ((emacs (24 4)) (dash-docs (1 4 0)) (helm (1 9 2)) (cl-lib (0 5))) "Offline documentation browser for +150 APIs using Dash docsets." single ((:commit . "7f853bd34da666f0e9a883011c80f451b06f6c59") (:authors ("Raimon Grau" . "raimonster@gmail.com") ("Toni Reina " . "areina0@gmail.com") ("Bryan Gilbert" . "bryan@bryan.sh")) (:maintainer "Raimon Grau" . "raimonster@gmail.com") (:keywords "docs") (:url . "https://github.com/dash-docs-el/helm-dash"))]) + (helm-descbinds . [(20190501 935) ((helm (1 5))) "A convenient `describe-bindings' with `helm'" single ((:commit . "b72515982396b6e336ad7beb6767e95a80fca192") (:authors ("Taiki SUGAWARA" . "buzz.taiki@gmail.com")) (:maintainer "Taiki SUGAWARA" . "buzz.taiki@gmail.com") (:keywords "helm" "help") (:url . "https://github.com/emacs-helm/helm-descbinds"))]) + (helm-describe-modes . [(20160212 518) ((helm (1 9)) (cl-lib (0 5)) (emacs (24 1))) "Helm interface to major and minor modes." single ((:commit . "11fb36af119b784539d31c6160002de1957408aa") (:authors ("Tianxiang Xiong" . "tianxiang.xiong@gmail.com")) (:maintainer "Tianxiang Xiong" . "tianxiang.xiong@gmail.com") (:keywords "docs" "convenience") (:url . "https://github.com/emacs-helm/helm-describe-modes"))]) + (helm-dictionary . [(20220319 955) ((helm (1 5 5))) "Helm source for looking up dictionaries" single ((:commit . "69f1e5bf03d67c9e5cb0065e702e8c311ac9d3db") (:authors ("Titus von der Malsburg" . "malsburg@posteo.de") ("Michael Heerdegen" . "michael_heerdegen@web.de")) (:maintainer "Titus von der Malsburg" . "malsburg@posteo.de") (:url . "https://github.com/emacs-helm/helm-dictionary"))]) + (helm-directory . [(20170706 402) ((emacs (24 4)) (helm (2 0))) "selecting directory before select the file" single ((:commit . "51bd7cd6e40a84a7efda894283ec76a0107830ad") (:authors ("Masashı Mıyaura")) (:maintainer "Masashı Mıyaura") (:url . "https://github.com/masasam/emacs-helm-directory"))]) + (helm-dired-history . [(20170524 1046) ((helm (1 9 8)) (cl-lib (0 5))) "Show dired history with helm.el support." single ((:commit . "06654656d3ad502742056d9030dd59e0da984764") (:authors ("Joseph(纪秀峰)" . "jixiuf@gmail.com")) (:maintainer "Joseph(纪秀峰)" . "jixiuf@gmail.com") (:keywords "helm" "dired history") (:url . "https://github.com/jixiuf/helm-dired-history"))]) + (helm-dired-recent-dirs . [(20131228 1414) ((helm (1 0))) "Show recent dirs with helm.el support." single ((:commit . "3bcd125b44f5a707588ae3868777d91192351523") (:authors ("Akisute" . "akisute3@gmail.com")) (:maintainer "Akisute" . "akisute3@gmail.com") (:keywords "helm" "dired" "zsh"))]) + (helm-dirset . [(20151209 12) ((f (0 16 2)) (helm (1 6 1)) (s (1 9 0)) (cl-lib (0 5))) "helm sources for multi directories" single ((:commit . "eb30810cd26e1ee73d84a863e6b2667700e9aead") (:authors ("k1LoW (Kenichirou Oyama), ")) (:maintainer "k1LoW (Kenichirou Oyama), ") (:keywords "files" "directories") (:url . "http://101000lab.org"))]) + (helm-dogears . [(20210822 2106) ((emacs (26 3)) (dogears (0 1 -1)) (helm (3 6))) "Helm source for Dogears" single ((:commit . "c05b69e504a538c9e00fbb0ea86934fafe191d0c") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "convenience") (:url . "https://github.com/alphapapa/dogears.el"))]) + (helm-emmet . [(20160713 1231) ((helm (1 0)) (emmet-mode (1 0 2))) "helm sources for emmet-mode's snippets" single ((:commit . "f0364e736b10cf44232053a78de04133a88185ae") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "convenience" "helm" "emmet") (:url . "https://github.com/yasuyk/helm-emmet"))]) + (helm-emms . [(20220314 1633) ((helm (1 5)) (emms (6 0)) (cl-lib (0 5)) (emacs (24 1))) "Emms for Helm." single ((:commit . "aefa44ab77808626c4951be2df49a2eab7820805") (:authors ("Thierry Volpiatto" . "thierry.volpiatto@gmail.com")) (:maintainer "Thierry Volpiatto" . "thierry.volpiatto@gmail.com") (:keywords "multimedia" "emms") (:url . "https://github.com/emacs-helm/helm-emms"))]) + (helm-esa . [(20190721 1429) ((emacs (26 2)) (helm (3 2)) (request (0 3 0))) "Esa with helm interface" single ((:commit . "d93b4af404346870cb2cf9c257d055332ef3f577") (:authors ("Takashi Masuda" . "masutaka.net@gmail.com")) (:maintainer "Takashi Masuda" . "masutaka.net@gmail.com") (:url . "https://github.com/masutaka/emacs-helm-esa"))]) + (helm-etags-plus . [(20201003 1424) ((helm (1 7 8))) "Another Etags helm.el interface" single ((:commit . "52598fe69636add4b62cd9873041de5c6db9b7ac") (:authors ("纪秀峰(Joseph)" . "jixiuf@gmail.com")) (:maintainer "纪秀峰(Joseph)" . "jixiuf@gmail.com") (:keywords "helm" "etags") (:url . "https://github.com/jixiuf/helm-etags-plus"))]) + (helm-evil-markers . [(20200506 715) ((emacs (25 1)) (helm (2 0 0)) (evil (1 2 10))) "Show evil markers with helm" single ((:commit . "0245f0c268e0eaec85df51ab2deba7ac961f6770") (:authors ("Bill Xue")) (:maintainer "Bill Xue") (:keywords "extensions") (:url . "https://github.com/xueeinstein/helm-evil-markers"))]) + (helm-eww . [(20190315 907) ((emacs (24 4)) (helm (2 8 6)) (seq (1 8))) "Helm UI wrapper for EWW." single ((:commit . "76ba59fda8dd6f32a1bc7c6df0b43c6f76169911") (:authors ("Pierre Neidhardt" . "mail@ambrevar.xyz")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:keywords "helm" "packages") (:url . "https://github.com/emacs-helm/helm-eww"))]) + (helm-ext . [(20200722 107) ((emacs (24 4)) (helm (2 5 3))) "A few extensions to Helm" tar ((:commit . "c30f7772ec577a5ce1de3215f0507826e0725a69") (:authors ("Junpeng Qiu" . "qjpchmail@gmail.com")) (:maintainer "Junpeng Qiu" . "qjpchmail@gmail.com") (:keywords "extensions"))]) + (helm-exwm . [(20210215 858) ((emacs (25 2)) (helm (2 8 5)) (exwm (0 15))) "Helm for EXWM buffers" single ((:commit . "5b35a42ff10fbcbf673268987df700ea6b6288e8") (:authors ("Pierre Neidhardt" . "mail@ambrevar.xyz")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:keywords "helm" "exwm") (:url . "https://github.com/emacs-helm/helm-exwm"))]) + (helm-file-preview . [(20200927 528) ((emacs (25 1)) (helm (2 0))) "Preview the current helm file selection" single ((:commit . "f9ffd81c3b7fa3e5f79f511a6c2226b5e99b73e6") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/helm-file-preview"))]) + (helm-filesets . [(20140929 1835) ((helm (1 6 3)) (filesets+ (0))) "A helm source for emacs filesets" single ((:commit . "b352910af4c3099267a8aa0169c7f743b35bb1fa") (:authors ("Graham Clark" . "grclark@gmail.com")) (:maintainer "Graham Clark" . "grclark@gmail.com") (:keywords "filesets") (:url . "https://github.com/gcla/helm-filesets"))]) + (helm-firefox . [(20220420 1346) ((helm (1 5)) (cl-lib (0 5)) (emacs (24 1))) "Firefox bookmarks" single ((:commit . "571cf8dfcbe43d91f9890eebefc88d7572c62e75") (:url . "https://github.com/emacs-helm/helm-firefox"))]) + (helm-fish-completion . [(20200908 1504) ((emacs (25)) (helm (3)) (fish-completion (1 2))) "Helm interface for fish completion" single ((:commit . "2a2001b3a876da3c468ffec8935572509c485aac") (:authors ("Pierre Neidhardt" . "mail@ambrevar.xyz")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:url . "https://github.com/emacs-helm/helm-fish-completion"))]) + (helm-flx . [(20220402 21) ((emacs (24 4)) (helm (1 7 9)) (flx (0 5))) "Sort helm candidates by flx score" single ((:commit . "27dd9e3ce385a3ca15092150e65781de14b5b00b") (:authors ("Jonathan Hayase" . "jonathan.hayase@gmail.com")) (:maintainer "Jonathan Hayase" . "jonathan.hayase@gmail.com") (:keywords "convenience" "helm" "fuzzy" "flx") (:url . "https://github.com/PythonNut/helm-flx"))]) + (helm-flycheck . [(20160710 829) ((dash (2 12 1)) (flycheck (28)) (helm-core (1 9 8))) "Show flycheck errors with helm" single ((:commit . "3cf7d3bb194acacc6395f88360588013d92675d6") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "helm" "flycheck") (:url . "https://github.com/yasuyk/helm-flycheck"))]) + (helm-flymake . [(20160610 2) ((helm (1 0))) "helm interface for flymake" single ((:commit . "72cf18a1a1f843db9bb5d58301739ea9ccb1655b") (:authors ("Akira Tamamori" . "tamamori5917@gmail.com")) (:maintainer "Akira Tamamori" . "tamamori5917@gmail.com") (:url . "https://github.com/tam17aki"))]) + (helm-flyspell . [(20170210 1901) ((helm (1 6 5))) "Helm extension for correcting words with flyspell" single ((:commit . "8d4d947c687cb650cb149aa2271ad5201ea92594") (:authors ("Andrzej Pronobis")) (:maintainer "Andrzej Pronobis") (:keywords "convenience") (:url . "https://github.com/pronobis/helm-flyspell"))]) + (helm-frame . [(20180604 1005) ((emacs (24 4))) "open helm buffers in a dedicated frame" single ((:commit . "485e2a534b0de5e8dbeb144a9a60ceca00215a4a") (:authors ("chee" . "chee@snake.dog")) (:maintainer "chee" . "chee@snake.dog") (:keywords "lisp" "helm" "popup" "frame"))]) + (helm-fuz . [(20200812 1222) ((emacs (25 1)) (fuz (1 4 0)) (helm (3 6))) "Integrate Helm and Fuz" single ((:commit . "fee874aa35d2ee6b12b836290b5c8eaa44175a28") (:authors ("Zhu Zihao" . "all_but_last@163.com")) (:maintainer "Zhu Zihao" . "all_but_last@163.com") (:keywords "convenience") (:url . "https://github.com/cireu/fuz.el"))]) + (helm-fuzzier . [(20160605 2145) ((emacs (24 3)) (helm (1 7 0))) "Better fuzzy matching for Helm" single ((:commit . "8798dcf3583b863df5b9dea7fe3b0179ba1c35bc") (:authors ("Ephram Perdition")) (:maintainer "Ephram Perdition") (:keywords "convenience" "helm" "fuzzy") (:url . "http://github.com/EphramPerdition/helm-fuzzier"))]) + (helm-fuzzy . [(20200927 532) ((emacs (24 4)) (helm (1 7 9)) (flx (0 5))) "Fuzzy matching for helm source" single ((:commit . "dd092e8eea5257d49bbdf694df4fefd86252e54b") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/jcs-elpa/helm-fuzzy"))]) + (helm-fuzzy-find . [(20171106 400) ((emacs (24 1)) (helm (1 7 0))) "Find file using Fuzzy Search" single ((:commit . "de2abbf7ca13609587325bacd4a1ed4376b5c927") (:authors ("Chunyang Xu" . "xuchunyang56@gmail.com")) (:maintainer "Chunyang Xu" . "xuchunyang56@gmail.com") (:keywords "helm" "fuzzy" "find" "file") (:url . "https://github.com/xuchunyang/helm-fuzzy-find"))]) + (helm-ghq . [(20210724 744) ((emacs (24)) (helm (3 8 0))) "Ghq with helm interface" single ((:commit . "7b47ac91e42762f2ecbbceeaadc05b86c9fe5f14") (:authors ("Takashi Masuda" . "masutaka.net@gmail.com")) (:maintainer "Takashi Masuda" . "masutaka.net@gmail.com") (:url . "https://github.com/masutaka/emacs-helm-ghq"))]) + (helm-ghs . [(20170715 541) ((emacs (24)) (helm (2 2 0))) "ghs with helm interface" single ((:commit . "17a70bf16255d90d67c8350e88200ec8bfd47563") (:authors ("iory" . "ab.ioryz@gmail.com")) (:maintainer "iory" . "ab.ioryz@gmail.com") (:url . "https://github.com/iory/emacs-helm-ghs"))]) + (helm-git . [(20120630 2103) nil "Helm extension for Git." single ((:commit . "cb96a52b5aecadd3c27aba7749d14e43ab128d55") (:authors ("Marian Schubert" . "marian.schubert@gmail.com")) (:maintainer "Marian Schubert" . "marian.schubert@gmail.com") (:keywords "helm" "git") (:url . "https://github.com/maio/helm-git"))]) + (helm-git-files . [(20141212 1317) ((helm (1 5 9))) "helm for git files" single ((:commit . "43193960774069369ac6964bbf7c026900206fa8") (:authors ("INA Lintaro ") ("TAKAGI Kentaro ")) (:maintainer "INA Lintaro ") (:keywords "helm" "git"))]) + (helm-git-grep . [(20170614 1411) ((helm-core (2 2 0))) "helm for git grep, an incremental git-grep(1)" single ((:commit . "744cea07dba6e6a5effbdba83f1b786c78fd86d3") (:authors ("mechairoi")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:url . "https://github.com/yasuyk/helm-git-grep"))]) + (helm-github-stars . [(20190428 1047) ((helm (1 6 8)) (emacs (24 4))) "Helm interface for your github's stars" single ((:commit . "c891690218b0d8b957ea6cb45b1b6cffd15a6950") (:authors ("Sliim" . "sliim@mailoo.org") ("xuchunyang" . "xuchunyang56@gmail.com")) (:maintainer "Sliim" . "sliim@mailoo.org") (:keywords "helm" "github" "stars") (:url . "https://github.com/Sliim/helm-github-stars"))]) + (helm-gitignore . [(20170211 8) ((gitignore-mode (1 1 0)) (helm (1 7 0)) (request (0 1 0)) (cl-lib (0 5))) "Generate .gitignore files with gitignore.io." single ((:commit . "2a2e7da7855a6db0ab3bb6a6a087863d7abd4391") (:authors ("Juan Placencia")) (:maintainer "Juan Placencia") (:keywords "helm" "gitignore" "gitignore.io") (:url . "https://github.com/jupl/helm-gitignore"))]) + (helm-gitlab . [(20180312 1647) ((s (1 9 0)) (dash (2 9 0)) (helm (1 0)) (gitlab (0 8 0))) "Helm interface to Gitlab" single ((:commit . "8c2324c02119500f094c2f92dfaba4c9977ce1ba") (:authors ("Nicolas Lamirault" . "nicolas.lamirault@gmail.com")) (:maintainer "Nicolas Lamirault" . "nicolas.lamirault@gmail.com") (:keywords "gitlab" "helm") (:url . "https://github.com/nlamirault/emacs-gitlab"))]) + (helm-go-package . [(20161103 153) ((emacs (24 4)) (helm-core (2 2 1)) (go-mode (1 4 0)) (deferred (0 4 0))) "helm sources for Go programming language's package" single ((:commit . "e42c563936c205ceedb930a687c11b4bb56447bc") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:url . "https://github.com/yasuyk/helm-go-package"))]) + (helm-google . [(20210527 900) ((helm (0))) "Emacs Helm Interface for quick Google searches" single ((:commit . "27834161391c350ef790062391cb7eab1d59fb62") (:authors ("steckerhalter")) (:maintainer "steckerhalter") (:keywords "helm" "google" "search" "browse" "searx") (:url . "https://framagit.org/steckerhalter/helm-google"))]) + (helm-grepint . [(20200811 1616) ((helm (2 9 7)) (emacs (24 4))) "Generic helm interface to grep" single ((:commit . "9aec98428823b749eb14d2c8512b46b59ca9f8ca") (:authors ("Kalle Kankare" . "kalle.kankare@iki.fi")) (:maintainer "Kalle Kankare" . "kalle.kankare@iki.fi") (:keywords "grep" "grepping" "searching" "helm" "tools" "convenience") (:url . "https://github.com/kopoli/helm-grepint"))]) + (helm-growthforecast . [(20140120 344) ((helm (1 5 9))) "helm extensions for growthforecast." single ((:commit . "0f94ac090d6c354058ad89a86e5c18385c136d9b") (:authors ("Daichi Hirata" . "daichi.hirat@gmail.com")) (:maintainer "Daichi Hirata" . "daichi.hirat@gmail.com") (:url . "https://github.com/daic-h/helm-growthforecast"))]) + (helm-gtags . [(20200602 1610) ((emacs (24 4)) (helm (2 0))) "GNU GLOBAL helm interface" single ((:commit . "6285c083d885ea8e110868c6a5b9df69c3f3c4af") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-helm-gtags"))]) + (helm-hatena-bookmark . [(20210724 732) ((emacs (24)) (helm (2 8 2))) "Hatena::Bookmark with helm interface" single ((:commit . "a6a2b37370ac84ca2cae5ef65b2b144a010b1584") (:authors ("Takashi Masuda" . "masutaka.net@gmail.com")) (:maintainer "Takashi Masuda" . "masutaka.net@gmail.com") (:url . "https://github.com/masutaka/emacs-helm-hatena-bookmark"))]) + (helm-hayoo . [(20151014 651) ((helm (1 6 0)) (json (1 2)) (haskell-mode (13 7))) "Source and configured helm for searching hayoo" single ((:commit . "dd4c0c8c87521026edf1b808c4de01fa19b7c693") (:authors ("Markus Hauck" . "markus1189@gmail.com")) (:maintainer "Markus Hauck" . "markus1189@gmail.com") (:keywords "helm"))]) + (helm-helm-commands . [(20130902 1748) ((helm (1 5 4))) "List all helm commands with helm" single ((:commit . "3a05aa19c976501343ad9ae630a36810921a85f6") (:authors ("Joe Bloggs" . "vapniks@yahoo.com")) (:maintainer "Joe Bloggs" . "vapniks@yahoo.com") (:keywords "convenience") (:url . "https://github.com/vapniks/helm-helm-commands"))]) + (helm-hoogle . [(20161027 534) ((helm (1 6 2)) (emacs (24 4))) "Use helm to navigate query results from Hoogle" single ((:commit . "73969a9d46d2121a849a01a9f7ed3636d01f7bbc") (:authors ("John Wiegley" . "jwiegley@gmail.com")) (:maintainer "John Wiegley" . "jwiegley@gmail.com") (:keywords "haskell" "programming" "hoogle") (:url . "https://github.com/jwiegley/haskell-config"))]) + (helm-hunks . [(20171217 1933) ((emacs (24 4)) (helm (1 9 8))) "A helm interface for git hunks - browsing, staging, unstaging and killing" single ((:commit . "6392bf716f618eac23ce81140aceb0dfacb9c6d0") (:authors ("@torgeir")) (:maintainer "@torgeir") (:keywords "helm" "git" "hunks" "vc"))]) + (helm-icons . [(20210330 1216) ((emacs (25 1)) (dash (2 14 1)) (f (0 20 0)) (treemacs (2 7))) "Helm icons" single ((:commit . "8d2f5e705c8b78a390677cf242024739c932fc95") (:authors ("Ivan Yonchovski" . "yyoncho@gmail.com")) (:maintainer "Ivan Yonchovski" . "yyoncho@gmail.com") (:keywords "convenience") (:url . "https://github.com/yyoncho/helm-icons"))]) + (helm-idris . [(20141202 1757) ((helm (0 0 0)) (idris-mode (0 9 14))) "A Helm datasource for Idris documentation, queried from the compiler" single ((:commit . "a2f45d6817974f318b55ad9b7fd19d5df132d47e") (:authors ("David Raymond Christiansen" . "david@davidchristiansen.dk")) (:maintainer "David Raymond Christiansen" . "david@davidchristiansen.dk") (:keywords "languages" "helm"))]) + (helm-img . [(20151224 2321) ((helm (1 7 7)) (cl-lib (0 5))) "Utilities for making image sources for helm." tar ((:commit . "aa3f8a5dce8d0413bf07584f07153a39015c2bfc") (:authors ("Sho Matsumoto ")) (:maintainer "l3msh0") (:keywords "convenience") (:url . "https://github.com/l3msh0/helm-img"))]) + (helm-img-tiqav . [(20151224 2322) ((helm-img (0 0 1))) "An helm-source for joking." single ((:commit . "33a7e9508bc8f37d53320b56c92b53d321a57bb0") (:authors ("Sho Matsumoto ")) (:maintainer "l3msh0") (:keywords "convenience") (:url . "https://github.com/l3msh0/helm-img"))]) + (helm-ispell . [(20151231 853) ((helm-core (1 7 7))) "ispell-complete-word with helm interface" single ((:commit . "cb735695ab3a0e66c123c2f3f3e8911fb1c2d5fc") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-helm-ispell"))]) + (helm-itunes . [(20151013 648) ((helm (1 6 1))) "Play local iTunes and Spotify tracks" single ((:commit . "966de755a5aadbe02311a6cef77bd4790e84c263") (:authors ("Adam Schwartz" . "adam@adamschwartz.io")) (:maintainer "Adam Schwartz" . "adam@adamschwartz.io") (:url . "https://github.com/daschwa/helm-itunes"))]) + (helm-j-cheatsheet . [(20170217 829) ((helm (1 5 3))) "Quick J reference for Emacs" single ((:commit . "6c47e7162b9ba2de4b41221d01180146973d860b") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:url . "https://github.com/abo-abo/helm-j-cheatsheet"))]) + (helm-jira . [(20180802 815) ((emacs (25)) (cl-lib (0 5)) (helm (1 9 9))) "Helm bindings for JIRA/Bitbucket/stash" single ((:commit . "75d6ed5bd7a041fa8c1adb21cbbbe57b5a7c7cc7") (:authors ("Roman Decker ")) (:maintainer "Roman Decker ") (:keywords "tools" "helm" "jira" "bitbucket" "stash") (:url . "https://github.com/DeX3/helm-jira"))]) + (helm-js-codemod . [(20190921 942) ((emacs (24 4)) (helm-core (1 9 8)) (js-codemod (1 0 0))) "A helm interface for running js-codemods" single ((:commit . "29b1b3c441f0d7e450a3c65b5ff9e72023dc6314") (:authors (nil . "Torgeir Thoresen <@torgeir>")) (:maintainer nil . "Torgeir Thoresen <@torgeir>") (:keywords "helm" "js" "codemod" "region"))]) + (helm-jstack . [(20150603 422) ((emacs (24)) (helm (1 7 0)) (cl-lib (0 5))) "Helm interface to Jps & Jstack for Java/JVM processes" single ((:commit . "2064f7215dcf4ccbd6a7b8784223251507746da4") (:authors ("Raghav Kumar Gautam" . "rgautam@apache.com")) (:maintainer "Raghav Kumar Gautam" . "rgautam@apache.com") (:keywords "java" "jps" "jstack" "jvm" "emacs" "elisp" "helm"))]) + (helm-kythe . [(20170709 726) ((emacs (25)) (dash (2 12 0)) (helm (2 0))) "Google Kythe helm interface" single ((:commit . "eabbef4948f8ec7c7b2fac498e9145dfdb10ca82") (:authors ("Fangrui Song" . "i@maskray.me")) (:maintainer "Fangrui Song" . "i@maskray.me") (:url . "https://github.com/MaskRay/emacs-helm-kythe"))]) + (helm-lastpass . [(20180722 806) ((emacs (25 1)) (helm (2 0)) (csv (2 1))) "Helm interface of LastPass" single ((:commit . "82e1ffb6ae77d9d9e29c398eb013cd20ce963f77") (:authors ("Xu Chunyang" . "mail@xuchunyang.me")) (:maintainer "Xu Chunyang" . "mail@xuchunyang.me") (:url . "https://github.com/xuchunyang/helm-lastpass"))]) + (helm-lean . [(20210305 1705) ((emacs (24 3)) (dash (2 18 0)) (helm (2 8 0)) (lean-mode (3 3 0))) "Helm interfaces for lean-mode" single ((:commit . "362bc6fa3efb1874c525ed6b4b6f24f76af22596") (:authors ("Leonardo de Moura" . "leonardo@microsoft.com") ("Soonho Kong " . "soonhok@cs.cmu.edu") ("Gabriel Ebner " . "gebner@gebner.org") ("Sebastian Ullrich" . "sebasti@nullri.ch")) (:maintainer "Sebastian Ullrich" . "sebasti@nullri.ch") (:keywords "languages") (:url . "https://github.com/leanprover/lean-mode"))]) + (helm-lib-babel . [(20180510 1324) ((cl-lib (0 5)) (helm (1 9 2)) (emacs (24 4))) "helm insertion of babel function references" single ((:commit . "41bc0cdea8a604c6c8dc83ed5066644d33688fad") (:authors ("Derek Feichtinger" . "dfeich@gmail.com")) (:maintainer "Derek Feichtinger" . "dfeich@gmail.com") (:keywords "convenience") (:url . "https://github.com/dfeich/helm-lib-babel.el"))]) + (helm-lines . [(20220103 1909) ((emacs (24 4)) (helm (1 9 8))) "A helm interface for completing by lines" single ((:commit . "f5ad178818d223f32a0bf60d370b50c01df5f3da") (:authors ("@torgeir")) (:maintainer "@torgeir") (:keywords "files" "helm" "rg" "ag" "pt" "vc" "git" "lines" "complete" "tools" "languages") (:url . "https://github.com/torgeir/helm-lines.el/"))]) + (helm-lobsters . [(20150213 1546) ((helm (1 0)) (cl-lib (0 5))) "helm front-end for lobste.rs" single ((:commit . "53c5b42baf72776dcba891fc3d7cd7d47721e9b0") (:authors ("Julien BLANCHARD" . "julien@sideburns.eu")) (:maintainer "Julien BLANCHARD" . "julien@sideburns.eu") (:url . "https://github.com/julienXX/helm-lobste.rs"))]) + (helm-ls-git . [(20220418 657) ((helm (1 7 8))) "list git files." single ((:commit . "c6494a462e605d6fd16c9355e32685c3e0085589"))]) + (helm-ls-hg . [(20150909 543) ((helm (1 7 8))) "List hg files in hg project." single ((:commit . "61b91a22fcfb62d0fc56e361ec01ce96973c7165"))]) + (helm-ls-svn . [(20190316 2203) ((emacs (24 1)) (helm (1 7 0)) (cl-lib (0 5))) "helm extension to list svn files" single ((:commit . "a6043e1187282f649e2cb9f0e722a42daf41294b") (:authors ("Chunyang Xu" . "chunyang@macports.org")) (:maintainer "Chunyang Xu" . "chunyang@macports.org") (:keywords "helm" "svn") (:url . "https://svn.macports.org/repository/macports/users/chunyang/helm-ls-svn.el/helm-ls-svn.el"))]) + (helm-lsp . [(20210419 2014) ((emacs (25 1)) (dash (2 14 1)) (lsp-mode (5 0)) (helm (2 0))) "LSP helm integration" single ((:commit . "c2c6974dadfac459b1a69a1217441283874cea92") (:authors ("Ivan Yonchovski" . "yyoncho@gmail.com")) (:maintainer "Ivan Yonchovski" . "yyoncho@gmail.com") (:keywords "languages" "debug") (:url . "https://github.com/yyoncho/helm-lsp"))]) + (helm-lxc . [(20200323 816) ((emacs (25)) (cl-lib (0 5)) (helm (2 9 4)) (lxc-tramp (0 2 0))) "Helm interface to manage LXC containers" single ((:commit . "37fe2d7ed97967edf59a3b68b1434910516ae24f") (:authors ("montag451")) (:maintainer "montag451") (:keywords "helm" "lxc" "convenience") (:url . "https://github.com/montag451/helm-lxc"))]) + (helm-make . [(20200620 27) nil "Select a Makefile target with helm" single ((:commit . "ebd71e85046d59b37f6a96535e01993b6962c559") (:authors ("Oleh Krehel" . "ohwoeowho@gmail.com")) (:maintainer "Oleh Krehel" . "ohwoeowho@gmail.com") (:keywords "makefile") (:url . "https://github.com/abo-abo/helm-make"))]) + (helm-migemo . [(20151010 356) ((emacs (24 4)) (helm-core (1 7 8)) (migemo (1 9)) (cl-lib (0 5))) "Migemo plug-in for helm" single ((:commit . "66c6a19d07c6a385daefd2090d0709d26b608b4e") (:authors ("rubikitch" . "rubikitch@ruby-lang.org")) (:maintainer "Yuhei Maeda ") (:keywords "matching" "convenience" "tools" "i18n") (:url . "https://github.com/emacs-jp/helm-migemo"))]) + (helm-mode-manager . [(20210108 2330) ((helm (1 5 3))) "Select and toggle major and minor modes with helm" single ((:commit . "7df8ed3ddd46a0402838b748d317c01454346164") (:authors ("istib")) (:maintainer "istib") (:url . "https://github.com/istib/helm-mode-manager"))]) + (helm-mt . [(20160918 452) ((emacs (24)) (helm (0 0)) (multi-term (0 0)) (cl-lib (0 5))) "helm multi-term management" single ((:commit . "d2bff4100118483bc398c56d0ff095294209265b") (:authors ("Didier Deshommes" . "dfdeshom@gmail.com")) (:maintainer "Didier Deshommes" . "dfdeshom@gmail.com") (:keywords "helm" "multi-term") (:url . "https://github.com/dfdeshom/helm-mt"))]) + (helm-mu . [(20210816 913) ((helm (1 5 5))) "Helm sources for searching emails and contacts" single ((:commit . "b85019d01815a4b58d6016c3a30fefa60d8363f2") (:authors ("Titus von der Malsburg" . "malsburg@posteo.de")) (:maintainer "Titus von der Malsburg" . "malsburg@posteo.de") (:url . "https://github.com/emacs-helm/helm-mu"))]) + (helm-navi . [(20201220 1823) ((emacs (24 4)) (helm (1 9 4)) (helm-org (1 0)) (navi-mode (2 0)) (s (1 10 0))) "Helm for navi-mode" single ((:commit . "c5666cc171288d1fa892900ee66fba2a1c892c81") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "navigation" "outlines") (:url . "http://github.com/emacs-helm/helm-navi"))]) + (helm-nixos-options . [(20151013 2309) ((nixos-options (0 0 1)) (helm (1 5 6))) "Helm Interface for nixos-options" single ((:commit . "053a2d5110ce05b7f99bcc2ac4804b70cbe87916") (:authors ("Diego Berrocal" . "cestdiego@gmail.com") ("Travis B. Hartwell" . "nafai@travishartwell.net")) (:maintainer "Diego Berrocal" . "cestdiego@gmail.com") (:keywords "unix") (:url . "http://www.github.com/travisbhartwell/nix-emacs/"))]) + (helm-notmuch . [(20190320 1048) ((helm (1 9 3)) (notmuch (0 21))) "Search emails with Notmuch and Helm" single ((:commit . "97a01497e079a7b6505987e9feba6b603bbec288") (:authors ("Chunyang Xu" . "mail@xuchunyang.me")) (:maintainer "Chunyang Xu" . "mail@xuchunyang.me") (:keywords "mail") (:url . "https://github.com/emacs-helm/helm-notmuch"))]) + (helm-open-github . [(20170220 159) ((emacs (24 4)) (helm-core (1 7 7)) (gh (0 8 2))) "Utilities of Opening Github Page" single ((:commit . "2f03d97552a1233db7694116d5f80ecde7612756") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-helm-open-github"))]) + (helm-org . [(20210324 1927) ((helm (3 3)) (emacs (24 4))) "Helm for org headlines and keywords completion" single ((:commit . "d67186d3a64e610c03a5f3d583488f018fb032e4") (:authors ("Thierry Volpiatto" . "thierry.volpiatto@gmail.com")) (:maintainer "Thierry Volpiatto" . "thierry.volpiatto@gmail.com") (:url . "https://github.com/emacs-helm/helm-org"))]) + (helm-org-multi-wiki . [(20210228 1853) ((emacs (26 1)) (org (9 3)) (org-multi-wiki (0 4)) (org-ql (0 5)) (dash (2 18)) (helm-org-ql (0 5)) (helm (3 5))) "Helm interface to org-multi-wiki" single ((:commit . "bf8039aadddaf02569fab473f766071ef7e63563") (:authors ("Akira Komamura" . "akira.komamura@gmail.com")) (:maintainer "Akira Komamura" . "akira.komamura@gmail.com") (:keywords "org" "outlines") (:url . "https://github.com/akirak/org-multi-wiki"))]) + (helm-org-ql . [(20220318 1529) ((emacs (26 1)) (dash (2 18 1)) (s (1 12 0)) (helm-org (1 0)) (org-ql (0 6 -1))) "Helm support for org-ql" single ((:commit . "46f523d94a376b168176c75bbd0e3e0d00e61170") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:url . "https://github.com/alphapapa/org-ql"))]) + (helm-org-recent-headings . [(20211011 1519) ((emacs (26 1)) (org (9 0 5)) (dash (2 18 0)) (helm (1 9 4)) (org-recent-headings (0 2 -1)) (s (1 12 0))) "Helm source for org-recent-headings" single ((:commit . "97418d581ea030f0718794e50b005e9bae44582e") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "hypermedia" "outlines" "org") (:url . "http://github.com/alphapapa/org-recent-headings"))]) + (helm-org-rifle . [(20200512 1943) ((emacs (24 4)) (dash (2 12)) (f (0 18 1)) (helm (1 9 4)) (s (1 10 0))) "Rifle through your Org files" single ((:commit . "5e13a0e59606b40088927870dab116a8eab8e66c") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "hypermedia" "outlines") (:url . "http://github.com/alphapapa/helm-org-rifle"))]) + (helm-orgcard . [(20151001 1524) ((helm-core (1 7 7))) "browse the orgcard by helm" single ((:commit . "9655ac340d1ccc5f3d1c0f7c49be8dd3556d4d0d") (:authors ("Yuhei Maeda ")) (:maintainer "Yuhei Maeda") (:keywords "convenience" "helm" "org") (:url . "https://github.com/emacs-jp/helm-orgcard"))]) + (helm-osx-app . [(20190717 958) ((emacs (25 1)) (helm-core (3 0))) "Launch macOS apps with helm" single ((:commit . "634ed5d721a20af265825a018e9df3ee6640daee") (:authors ("Xu Chunyang")) (:maintainer "Xu Chunyang") (:url . "https://github.com/xuchunyang/helm-osx-app"))]) + (helm-pages . [(20161121 226) ((helm (1 6 5)) (emacs (24)) (cl-lib (0 5))) "Pages in current buffer as Helm datasource" single ((:commit . "51dcb9374d1df9feaae85e60cfb39b970554ecba") (:authors ("David Christiansen" . "david@davidchristiansen.dk")) (:maintainer "David Christiansen" . "david@davidchristiansen.dk") (:keywords "convenience" "helm" "outlines"))]) + (helm-pass . [(20210221 1655) ((emacs (25)) (helm (0)) (password-store (0)) (auth-source-pass (4 0 0))) "helm interface of pass, the standard Unix password manager" single ((:commit . "4ce46f1801f2e76e53482c65aa0619d427a3fbf9") (:authors ("J. Alexander Branham" . "branham@utexas.edu")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:url . "https://github.com/emacs-helm/helm-pass"))]) + (helm-perldoc . [(20200315 1716) ((helm-core (2 0)) (deferred (0 3 1)) (emacs (24 4))) "perldoc with helm interface" tar ((:commit . "6f3526f07f3df3059dbde779f8e681f5f1fee6ea") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-helm-perldoc"))]) + (helm-perspeen . [(20170228 1345) ((perspeen (0 1 0)) (helm (2 5 0))) "Helm interface for perspeen." single ((:commit . "7fe2922d85608bfa9e18269fc44181428b8849ff") (:authors ("Yoshinobu Fujimoto")) (:maintainer "Yoshinobu Fujimoto") (:keywords "projects" "lisp") (:url . "https://github.com/jimo1001/helm-perspeen"))]) + (helm-phpunit . [(20160513 853) ((helm (1 9 5)) (phpunit (0 7 0))) "Helm integration for phpunit.el" single ((:commit . "739f26204ad2ba76c25f45e8eab1e5216f7c3518") (:authors ("Eric Hansen" . "hansen.c.eric@gmail.com")) (:maintainer "Eric Hansen" . "hansen.c.eric@gmail.com") (:keywords "phpunit" "helm" "php") (:url . "https://github.com/eric-hansen/phpunit-helm"))]) + (helm-posframe . [(20211103 236) ((emacs (26 0)) (posframe (1 0 0)) (helm (0 1))) "Using posframe to show helm window" single ((:commit . "87461b52b6f3f378c63642a33f584d4a4ba28351") (:authors ("Feng Shu")) (:maintainer "Feng Shu" . "tumashu@163.com") (:keywords "abbrev" "convenience" "matching" "helm") (:url . "https://github.com/tumashu/helm-posframe"))]) + (helm-proc . [(20161006 305) ((helm (1 6 0))) "Helm interface for managing system processes" tar ((:commit . "576d31c2d74ba3897d56e2acd2b0993f52c2547c") (:authors ("Markus Hauck" . "markus1189@gmail.com")) (:maintainer "Markus Hauck" . "markus1189@gmail.com") (:keywords "helm"))]) + (helm-project-persist . [(20151210 1543) ((helm (1 5 2)) (project-persist (0 1 4))) "Helm integration for project-persist package" single ((:commit . "357950fbac18090985a750e40d5d8b10ee9dcd53") (:authors ("Sliim" . "sliim@mailoo.org")) (:maintainer "Sliim" . "sliim@mailoo.org") (:keywords "project-persist" "project" "helm"))]) + (helm-projectile . [(20201217 908) ((helm (1 9 9)) (projectile (2 2 0)) (cl-lib (0 3))) "Helm integration for Projectile" single ((:commit . "58123f14c392021714fc5d23b9f95c7f95ce07f1") (:authors ("Bozhidar Batsov")) (:maintainer "Bozhidar Batsov") (:keywords "project" "convenience") (:url . "https://github.com/bbatsov/helm-projectile"))]) + (helm-prosjekt . [(20140129 717) ((prosjekt (0 3)) (helm (1 5 9))) "Helm integration for prosjekt." single ((:commit . "a864a8be5842223043702395f311e3350c28e9db") (:authors ("Sohail Somani" . "sohail@taggedtype.net")) (:maintainer "Sohail Somani" . "sohail@taggedtype.net") (:url . "https://github.com/abingham/prosjekt"))]) + (helm-pt . [(20160214 2342) ((helm (1 5 6))) "Helm interface to the platinum searcher" tar ((:commit . "8acc52911dad1ed0c3975f134a468762afe0b76b") (:authors ("Rich Alesi")) (:maintainer "Rich Alesi") (:url . "https://github.com/ralesi/helm-pt"))]) + (helm-purpose . [(20170114 1636) ((emacs (24)) (helm (1 9 2)) (window-purpose (1 4))) "Helm Interface for Purpose" single ((:commit . "9ff4c21c1e9ebc7afb851b738f815df7343bb287") (:authors ("Bar Magal (2016)")) (:maintainer "Bar Magal (2016)") (:url . "https://github.com/bmag/helm-purpose"))]) + (helm-pydoc . [(20160918 542) ((helm-core (2 0)) (emacs (24 4))) "pydoc with helm interface" tar ((:commit . "85480a29b56dacde425655bc8f5a597c785afdf5") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-helm-pydoc"))]) + (helm-qiita . [(20190526 1359) ((emacs (24)) (helm (2 8 2))) "Qiita with helm interface" single ((:commit . "5f82010c595f8e122aa3f68148ba8d8ccb1333d8") (:authors ("Takashi Masuda" . "masutaka.net@gmail.com")) (:maintainer "Takashi Masuda" . "masutaka.net@gmail.com") (:url . "https://github.com/masutaka/emacs-helm-qiita"))]) + (helm-rage . [(20180118 1532) ((helm (1 9 8)) (emacs (24 4)) (dash (2 13 0)) (s (1 11 0))) "Helm command for rage characters." tar ((:commit . "5d0aefb53d859186181d4bdcfeff7d315339c7b8") (:keywords "helm" "rage" "meme") (:url . "https://github.com/bomgar/helm-rage"))]) + (helm-rails . [(20130424 1519) ((helm (1 5 1)) (inflections (1 1))) "Helm extension for Rails projects." single ((:commit . "506d9948d45dfbc575c9c4c0d102c1ad2f511e82") (:authors ("Adam Sokolnicki" . "adam.sokolnicki@gmail.com")) (:maintainer "Adam Sokolnicki" . "adam.sokolnicki@gmail.com") (:keywords "helm" "rails" "git") (:url . "https://github.com/asok/helm-rails"))]) + (helm-rb . [(20131123 1639) ((helm (1 0)) (helm-ag-r (20131123))) "Search Ruby's method by ag and display helm" tar ((:commit . "4949d646420a9849af234dacdd8eb34a77c662fd") (:authors ("Yuta Yamada ")) (:maintainer "Yuta Yamada ") (:keywords "searching" "ruby") (:url . "https://github.com/yuutayamada/helm-rb"))]) + (helm-rdefs . [(20161130 536) ((emacs (24)) (helm (1 6 4))) "rdefs with helm interface" single ((:commit . "cd3a6b3af3015ee58ef30cb7c81c79ebe5fc867b") (:authors ("Hiroshi Saito" . "monodie@gmail.com")) (:maintainer "Hiroshi Saito" . "monodie@gmail.com") (:keywords "matching" "tools") (:url . "https://github.com/saidie/helm-rdefs"))]) + (helm-recoll . [(20200805 1235) ((helm (3 3)) (emacs (24 4))) "helm interface for the recoll desktop search tool." single ((:commit . "c021a3b5e8c010bdad062cceb80fb49788f89e9f") (:authors ("Thierry Volpiatto ")) (:maintainer "Thierry Volpiatto ") (:keywords "convenience") (:url . "https://github.com/emacs-helm/helm-recoll"))]) + (helm-rg . [(20200721 725) ((emacs (25)) (cl-lib (0 5)) (dash (2 13 0)) (helm (2 8 8))) "a helm interface to ripgrep" single ((:commit . "ee0a3c09da0c843715344919400ab0a0190cc9dc") (:authors ("Danny McClanahan")) (:maintainer "Danny McClanahan") (:keywords "find" "file" "files" "helm" "fast" "rg" "ripgrep" "grep" "search" "match") (:url . "https://github.com/cosmicexplorer/helm-rg"))]) + (helm-rhythmbox . [(20160524 1158) ((helm (1 5 0)) (cl-lib (0 5))) "control Rhythmbox's play queue via Helm" single ((:commit . "c92e1ded34ddd4e62e7e9a558259c232e05193fa") (:authors ("Thomas Winant" . "dewinant@gmail.com")) (:maintainer "Thomas Winant" . "dewinant@gmail.com") (:url . "https://github.com/mrBliss/helm-rhythmbox"))]) + (helm-robe . [(20151209 355) ((helm (1 7 7))) "completing read function for robe" single ((:commit . "6e69543b4ee76c5f8f3f2510c76e6d9aed17a370") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-helm-robe"))]) + (helm-ros . [(20160812 1752) ((helm (1 9 9)) (xterm-color (1 0)) (cl-lib (0 5))) "Interfaces ROS with helm" single ((:commit . "92b0b215f6a017f0f57f1af15466cc0b2a5a0135") (:authors ("David Landry" . "davidlandry93@gmail.com")) (:maintainer "David Landry" . "davidlandry93@gmail.com") (:keywords "helm" "ros") (:url . "https://www.github.com/davidlandry93/helm-ros"))]) + (helm-rtags . [(20191222 920) ((helm (2 0)) (rtags (2 10))) "A front-end for rtags" single ((:commit . "db39790fda5c2443bc790b8971ac140914f7e9c2") (:authors ("Jan Erik Hanssen" . "jhanssen@gmail.com") ("Anders Bakken" . "agbakken@gmail.com")) (:maintainer "Jan Erik Hanssen" . "jhanssen@gmail.com") (:url . "https://github.com/Andersbakken/rtags"))]) + (helm-rubygems-local . [(20130712 111) ((helm (1 5 3))) "Installed local rubygems find-file for helm" single ((:commit . "289cb33d41c703af9791d6da46b55f070013c2e3") (:authors ("hadashiA" . "dev@hadashikick.jp")) (:maintainer "hadashiA" . "dev@hadashikick.jp") (:url . "https://github.com/f-kubotar/helm-rubygems-local"))]) + (helm-rubygems-org . [(20140826 1156) ((emacs (24)) (helm (1 6 3)) (cl-lib (0 5))) "Use helm to search rubygems.org" single ((:commit . "6aaed984f698cbdf9f9aceb0221404563e28764d") (:authors ("Chad Albers" . "calbers@neomantic.com")) (:maintainer "Chad Albers" . "calbers@neomantic.com") (:keywords "ruby" "rubygems" "gemfile" "helm") (:url . "https://github.com/neomantic/helm-rubygems-org"))]) + (helm-safari . [(20160404 324) ((helm (1 9 1)) (emacs (24))) "Browse your Safari bookmarks and history" single ((:commit . "664c7f4488829228eed7e90cd53002e14bec555b") (:authors ("Chunyang Xu" . "xuchunyang56@gmail.com")) (:maintainer "Chunyang Xu" . "xuchunyang56@gmail.com") (:keywords "tools") (:url . "https://github.com/xuchunyang/helm-safari"))]) + (helm-sage . [(20160514 745) ((cl-lib (0 5)) (helm (1 5 6)) (sage-shell-mode (0 1 0))) "A helm extension for sage-shell-mode." single ((:commit . "f14e9281d8f2162df7d8f9c2ad9ad1248a24803b") (:authors ("Sho Takemori" . "stakemorii@gmail.com")) (:maintainer "Sho Takemori" . "stakemorii@gmail.com") (:keywords "sage" "math" "helm") (:url . "https://github.com/stakemori/helm-sage"))]) + (helm-searcher . [(20210221 923) ((emacs (25 1)) (helm (2 0)) (searcher (0 1 8)) (s (1 12 0)) (f (0 20 0))) "Helm interface to use searcher" single ((:commit . "d0a3aa7c4a882c6563c053c3317600582043d71c") (:authors ("Shen, Jen-Chieh" . "jcs090218@gmail.com")) (:maintainer "Shen, Jen-Chieh" . "jcs090218@gmail.com") (:url . "https://github.com/emacs-helm/helm-searcher"))]) + (helm-selected . [(20171223 210) ((emacs (24 4)) (helm (2 8 6)) (selected (1 1))) "helm extension for selected.el" single ((:commit . "a9c769998bc56373d19f0ec9cbbbb4bd89a43c2d") (:authors ("Takaaki ISHIKAWA ")) (:maintainer "Takaaki ISHIKAWA ") (:keywords "extensions" "convenience") (:url . "https://github.com/takaxp/helm-selected"))]) + (helm-selector . [(20210125 857) ((emacs (26 1)) (helm (3))) "Helm buffer selector" tar ((:commit . "4da4711c4cfd14527abe20d66787beeb49171b26") (:authors ("Pierre Neidhardt" . "mail@ambrevar.xyz")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:url . "https://github.com/emacs-helm/helm-selector"))]) + (helm-sheet . [(20130630 1239) ((helm (1 0))) "helm sources for sheet" single ((:commit . "d360b68d0ddb09aa1854e7b2f3cb39caeee26463") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "helm" "sheet") (:url . "https://github.com/yasuyk/helm-sheet"))]) + (helm-shell-history . [(20210214 948) ((helm (3 7)) (emacs (24 3))) "Find shell history from helm" single ((:commit . "0c861f3db721e54053fc65f5651cf548cc1cb600") (:authors ("Yuta Yamada ")) (:maintainer "Yuta Yamada ") (:keywords "helm" "terminals" "shell") (:url . "https://github.com/yuutayamada/helm-shell-history"))]) + (helm-slime . [(20191016 1601) ((emacs (25)) (helm (3 2)) (slime (2 18)) (cl-lib (0 5))) "helm-sources and some utilities for SLIME." single ((:commit . "7886cc49906a87ebd73be3b71f5dd6b1433a9b7b") (:authors ("Takeshi Banse" . "takebi@laafc.net")) (:maintainer "Takeshi Banse" . "takebi@laafc.net") (:keywords "convenience" "helm" "slime") (:url . "https://github.com/emacs-helm/helm-slime"))]) + (helm-sly . [(20210205 1424) ((emacs (25 1)) (helm (3 2)) (cl-lib (0 5)) (sly (0 0))) "Helm sources and some utilities for SLY." single ((:commit . "3691626c80620e992a338c3222283d9149f1ecb5") (:authors ("Pierre Neidhardt" . "mail@ambrevar.xyz")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:keywords "convenience" "helm" "sly" "lisp") (:url . "https://github.com/emacs-helm/helm-sly"))]) + (helm-smex . [(20171004 2008) ((emacs (24)) (smex (3 0)) (helm (1 7 7))) "Helm interface for smex" single ((:commit . "2269375dfa452b88b5170d1a5d5849ebb2c1e413") (:authors ("Peter Vasil" . "mail@petervasil.net")) (:maintainer "Peter Vasil" . "mail@petervasil.net") (:keywords "convenience"))]) + (helm-spaces . [(20161001 1409) ((helm-core (2 2)) (spaces (0 1 0))) "helm sources for spaces" single ((:commit . "877e2b5178926308d6a7c2a37477bb12c33a96d4") (:authors ("Yasuyuki Oka" . "yasuyk@gmail.com")) (:maintainer "Yasuyuki Oka" . "yasuyk@gmail.com") (:keywords "helm" "frames" "convenience") (:url . "https://github.com/yasuyk/helm-spaces"))]) + (helm-spotify . [(20160905 2147) ((helm (0 0 0)) (multi (2 0 0))) "Control Spotify with Helm." single ((:commit . "f7a62d1ff88e3127de9be7cd3e818b0a92268ab3") (:authors ("Kris Jenkins" . "krisajenkins@gmail.com")) (:maintainer "Kris Jenkins" . "krisajenkins@gmail.com") (:keywords "helm" "spotify") (:url . "https://github.com/krisajenkins/helm-spotify"))]) + (helm-spotify-plus . [(20190913 2236) ((emacs (24 4)) (helm (2 0 0)) (multi (2 0 1))) "Control Spotify search and select music with Helm." single ((:commit . "c3922ec368250965e483876cde5880d88a40a71b") (:authors ("Wanderson Ferreira and Luis Moneda ")) (:maintainer "Wanderson Ferreira and Luis Moneda ") (:url . "https://github.com/wandersoncferreira/helm-spotify-plus"))]) + (helm-sql-connect . [(20170319 1251) ((helm (0 0 0))) "Choose a database to connect to via Helm." single ((:commit . "5aead55b6f8636140945714d8c332b287ab9ef10") (:authors ("Eric Hansen" . "hansen.c.eric@gmail.com")) (:maintainer "Eric Hansen" . "hansen.c.eric@gmail.com") (:keywords "tools" "convenience" "comm") (:url . "https://github.com/eric-hansen/helm-sql-connect"))]) + (helm-switch-shell . [(20210713 1440) ((emacs (25 1)) (helm (2 8 8))) "A Helm source for switching between shell buffers" single ((:commit . "8d7ba1d99ff12a8f1d6ce3b9684ae8aebf494cf3") (:authors ("James N. V. Cash" . "james.cash@occasionallycogent.com")) (:maintainer "James N. V. Cash" . "james.cash@occasionallycogent.com") (:keywords "matching" "processes" "terminals" "tools") (:url . "https://github.com/jamesnvc/helm-switch-shell"))]) + (helm-switch-to-repl . [(20210206 844) ((emacs (26 1)) (helm (3))) "Helm action to switch directory in REPLs" single ((:commit . "f0e732e7217fc0373b0805245fa15920cf676619") (:authors ("Pierre Neidhardt" . "mail@ambrevar.xyz")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:url . "https://github.com/emacs-helm/helm-switch-to-repl"))]) + (helm-swoop . [(20210426 547) ((emacs (25 1)) (helm (3 6))) "Efficiently hopping squeezed lines powered by helm interface" single ((:commit . "1b3285791f1dc1fde548fe67aec07214d698fd57") (:authors ("Shingo Fukuyama - http://fukuyama.co")) (:maintainer "Shingo Fukuyama - http://fukuyama.co") (:keywords "convenience" "helm" "swoop" "inner" "buffer" "search") (:url . "https://github.com/emacsorphanage/helm-swoop"))]) + (helm-system-packages . [(20210628 1727) ((emacs (24 4)) (helm (2 8 7)) (seq (1 8))) "Helm UI wrapper for system package managers." tar ((:commit . "a16bb1c3708416984106a98353700d456414b6a1") (:authors ("Pierre Neidhardt" . "mail@ambrevar.xyz")) (:maintainer "Pierre Neidhardt" . "mail@ambrevar.xyz") (:keywords "helm" "packages") (:url . "https://github.com/emacs-helm/helm-system-packages"))]) + (helm-systemd . [(20210105 542) ((emacs (24 4)) (helm (1 9 2)) (with-editor (2 5 0))) "helm's systemd interface" single ((:commit . "8b26ab2d3a5b08c1e03c9312818512d7492bbc9a") (:authors (nil . "")) (:maintainer nil . "") (:keywords "convenience"))]) + (helm-tail . [(20181124 439) ((emacs (25 1)) (helm (2 7 0))) "Read recent output from various sources" single ((:commit . "1f5a6355aa3bdb00b9b0bc93db29c17f0d6701e3") (:authors ("Akira Komamura" . "akira.komamura@gmail.com")) (:maintainer "Akira Komamura" . "akira.komamura@gmail.com") (:keywords "maint" "tools") (:url . "https://github.com/akirak/helm-tail"))]) + (helm-taskswitch . [(20190304 1414) ((emacs (24)) (helm (3 0))) "Use helm to switch windows and buffers" single ((:commit . "59f7cb99defa6e6bf6e7d599559fa8d5786cf8a9") (:authors ("Brian Caruso" . "briancaruso@gmail.com")) (:maintainer "Brian Caruso" . "briancaruso@gmail.com") (:keywords "frames") (:url . "https://github.com/bdc34/helm-taskswitch"))]) + (helm-themes . [(20200323 712) ((helm-core (2 0)) (emacs (24 4))) "Color theme selection with helm interface" single ((:commit . "b6bd3379b98d306935731e9632907387b078e000") (:authors ("Syohei YOSHIDA" . "syohex@gmail.com")) (:maintainer "Syohei YOSHIDA" . "syohex@gmail.com") (:url . "https://github.com/syohex/emacs-helm-themes"))]) + (helm-tramp . [(20190616 125) ((emacs (24 3)) (helm (2 0))) "Tramp helm interface for ssh, docker, vagrant" single ((:commit . "55e56975fe1456591a293bf60c183c3dda9f788f") (:authors ("Masashı Mıyaura")) (:maintainer "Masashı Mıyaura") (:url . "https://github.com/masasam/emacs-helm-tramp"))]) + (helm-tree-sitter . [(20220328 1345) ((emacs (25 1)) (helm (3 6 2)) (tree-sitter (0 16 1))) "Helm interface for tree-sitter" tar ((:commit . "ef5209bd1deb56d6cab7a26e6d55615161f2115a") (:authors ("Giedrius Jonikas" . "giedriusj1@gmail.com")) (:maintainer "Giedrius Jonikas" . "giedriusj1@gmail.com") (:url . "https://github.com/Giedriusj1/helm-tree-sitter"))]) + (helm-twitch . [(20220420 1625) ((dash (2 11 0)) (helm (1 5)) (emacs (24)) (twitch-api (20210809 1641)) (streamlink (20210811 1429))) "Navigate Twitch.tv via `helm'" single ((:commit . "27fbec24cc250d508cd2f4286da16262752908eb") (:authors ("Aaron Jacobs" . "atheriel@gmail.com")) (:maintainer "Aaron Jacobs" . "atheriel@gmail.com") (:keywords "helm" "twitch" "games") (:url . "https://github.com/BenediktBroich/helm-twitch"))]) + (helm-unicode . [(20180608 1407) ((helm (1 9 8)) (emacs (24 4))) "Helm command for unicode characters." single ((:commit . "fbeb0c5e741a6f462520884b744d43a9acbe1d34"))]) + (helm-w32-launcher . [(20141223 2014) ((emacs (24)) (helm (1 6 5)) (cl-lib (0 5))) "Start Menu entry launcher using Helm" tar ((:commit . "3e59ad62b89dd21d334af0203d445a83eb25dc5b") (:authors ("Fanael Linithien" . "fanael4@gmail.com")) (:maintainer "Fanael Linithien" . "fanael4@gmail.com") (:url . "https://github.com/Fanael/helm-w32-launcher"))]) + (helm-w3m . [(20210315 723) ((helm (1 5)) (w3m (0 0)) (cl-lib (0 5)) (emacs (24 1))) "W3m bookmark - helm interface." single ((:commit . "0a25a2b1df9bc660a90d633beb301b3815556e4e"))]) + (helm-wikipedia . [(20210525 717) ((helm (3 6)) (emacs (25 1))) "Wikipedia suggestions" single ((:commit . "c242c74efaeda2ffbafd281ee6bceae1a42507bb") (:url . "https://github.com/emacs-helm/helm-wikipedia"))]) + (helm-wordnet . [(20160128 1507) ((emacs (24)) (helm (1 7 0)) (cl-lib (0 5))) "Helm interface to local wordnet dictionary" single ((:commit . "a36dbc6fcb570b812870bc1e190f203e0a0042fc") (:authors ("Raghav Kumar Gautam" . "rgautam@apache.com")) (:maintainer "Raghav Kumar Gautam" . "rgautam@apache.com") (:keywords "dictionary" "wordnet" "emacs" "elisp" "helm") (:url . "https://github.com/raghavgautam/helm-wordnet"))]) + (helm-xcdoc . [(20160116 1018) ((helm (1 5)) (emacs (24 4))) "Search Xcode Document by docsetutil and eww with helm interface" single ((:commit . "a85612149a6d8e18ab309b3db2d222ce39c42049") (:authors ("Ryo Fujimoto" . "fujimisakri@gmail.com")) (:maintainer "Ryo Fujimoto" . "fujimisakri@gmail.com") (:url . "https://github.com/fujimisakari/emacs-helm-xcdoc"))]) + (helm-xref . [(20211017 1334) ((emacs (25 1)) (helm (1 9 4))) "Helm interface for xref results" single ((:commit . "ea0e4ed8a9baf236e4085cbc7178241f109a53fa") (:authors ("Fritz Stelzer" . "brotzeitmacher@gmail.com")) (:maintainer "Fritz Stelzer" . "brotzeitmacher@gmail.com") (:url . "https://github.com/brotzeit/helm-xref"))]) + (helm-youtube . [(20190101 1733) ((request (0 2 0)) (helm (2 3 1)) (cl-lib (0 5))) "Query YouTube and play videos in your browser" single ((:commit . "e7272f1648c7fa836ea5ac1a61770b4931ab4709") (:authors ("Maximilian Roquemore" . "maximus12793@gmail.com")) (:maintainer "Maximilian Roquemore" . "maximus12793@gmail.com") (:keywords "youtube" "multimedia") (:url . "https://github.com/maximus12793/helm-youtube"))]) + (helm-z . [(20171204 325) ((helm (1 0))) "Show z directory list with helm.el support." single ((:commit . "37212220bebea8b9c238cb1bbacd8332b7f26c03") (:authors ("yynozk" . "yynozk@gmail.com")) (:maintainer "yynozk" . "yynozk@gmail.com") (:url . "https://github.com/yynozk/helm-z"))]) + (helm-zhihu-daily . [(20160625 1145) ((helm (1 0)) (cl-lib (0 5)) (emacs (24 4))) "Helm interface for 知乎日报 (http://daily.zhihu.com)" single ((:commit . "be27dcc6be1eb97663b65581a9a5c0fc81cfaba7") (:authors ("Chunyang Xu" . "xuchunyang56@gmail.com")) (:maintainer "Chunyang Xu" . "xuchunyang56@gmail.com") (:url . "https://github.com/xuchunyang/helm-zhihu-daily"))]) + (help-find . [(20210826 928) ((emacs (25 2)) (dash (2 12))) "Additional help functions for working with keymaps" single ((:commit . "576d6505b9e42f50f121b1a6a675f17f03a04406") (:authors ("Duncan Burke" . "duncankburke@gmail.com")) (:maintainer "Duncan Burke" . "duncankburke@gmail.com") (:keywords "help") (:url . "https://github.com/duncanburke/help-find"))]) + (help-find-org-mode . [(20181204 234) ((emacs (24 4))) "Advise help to find org source over tangled code" single ((:commit . "aeda7f92c086dab9d8dfcd580fe80b332887a548") (:authors ("Eric Crosson" . "eric.s.crosson@utexas.com")) (:maintainer "Eric Crosson" . "eric.s.crosson@utexas.com") (:keywords "convenience") (:url . "https://github.com/EricCrosson/help-find-org-mode"))]) + (helpful . [(20220412 421) ((emacs (25)) (dash (2 18 0)) (s (1 11 0)) (f (0 20 0)) (elisp-refs (1 2))) "A better *help* buffer" single ((:commit . "c2729a236a84a1fbd3d184c163fbd10e0fd62077") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk") (:keywords "help" "lisp") (:url . "https://github.com/Wilfred/helpful"))]) + (hemera-theme . [(20180916 924) ((emacs (24))) "Light theme" single ((:commit . "b67c902b210b37b00cac68726822404543147ba8") (:authors ("Guido Schmidt")) (:maintainer "Guido Schmidt" . "guido.schmidt.2912@gmail.com") (:keywords "themes" "light-theme") (:url . "https://github.com/GuidoSchmidt/emacs-hemera-theme"))]) + (hemisu-theme . [(20130508 1844) nil "Hemisu for Emacs." tar ((:commit . "5c206561aa2c844ecdf3e3b672c3235e559ddd7f") (:authors ("Andrzej Sliwa")) (:maintainer "Andrzej Sliwa") (:url . "http://github/anrzejsliwa/django-theme"))]) + (hercules . [(20200420 747) ((emacs (24 4)) (which-key (3 3 2))) "An auto-magical, which-key-based hydra banisher." single ((:commit . "557da39878d0637395fdded91243b340c37eff7b") (:authors ("Uros Perisic")) (:maintainer "Uros Perisic") (:keywords "convenience") (:url . "https://gitlab.com/jjzmajic/hercules"))]) + (heroku-theme . [(20150523 219) nil "Heroku color theme" single ((:commit . "8083643fe92ec3a1c3eb82f1b8dc2236c9c9691d") (:authors ("Jonathan Chu" . "me@jonathanchu.is")) (:maintainer "Jonathan Chu" . "me@jonathanchu.is") (:url . "https://github.com/jonathanchu/color-theme-heroku"))]) + (hexo . [(20200416 1410) ((emacs (24 3))) "Major mode & tools for Hexo" single ((:commit . "d600b6c2d51959f1331c8abf3953365544322afa") (:authors ("Ono Hiroko (kuanyui)" . "azazabc123@gmail.com")) (:maintainer "Ono Hiroko (kuanyui)" . "azazabc123@gmail.com") (:keywords "tools" "hexo") (:url . "https://github.com/kuanyui/hexo.el"))]) + (hfst-mode . [(20160708 1202) nil "major mode for editing HFST files" single ((:commit . "ac1bb9dd92545d3e7fdc05c83996c227cc15c6b8") (:authors ("Kevin Brubeck Unhammer" . "unhammer@fsfe.org")) (:maintainer "Kevin Brubeck Unhammer" . "unhammer@fsfe.org") (:keywords "languages") (:url . "http://wiki.apertium.org/wiki/Emacs"))]) + (hg-histedit . [(20210302 2334) ((emacs (25 1)) (with-editor (2 8 3))) "Edit HG histedit files" single ((:commit . "a05149483b9c5f7848ece0ba6028c900595a6a25") (:authors ("James Nguyen" . "james@jojojames.com")) (:maintainer "James Nguyen" . "james@jojojames.com") (:keywords "mercurial" "hg" "emacs" "tools") (:url . "https://github.com/jojojames/hg-histedit"))]) + (hgignore-mode . [(20210314 431) nil "a major mode for editing hgignore files" single ((:commit . "2c5aa4c238848f5b4f2955afcfb5f21ea513653b") (:authors ("Omair Majid" . "omair.majid@gmail.com")) (:maintainer "Omair Majid" . "omair.majid@gmail.com") (:keywords "convenience" "vc" "hg") (:url . "http://github.com/omajid/hgignore-mode"))]) + (hgrc-mode . [(20150409 2043) nil "major mode for editing hgrc files" single ((:commit . "314e8320b82cc1ce74b1bd372f296252e7a23090") (:authors ("Omair Majid" . "omair.majid@gmail.com")) (:maintainer "Omair Majid" . "omair.majid@gmail.com") (:keywords "convenience" "vc" "hg") (:url . "http://github.com/omajid/hgrc-mode"))]) + (hi2 . [(20141005 1931) nil "indentation module for Haskell Mode" single ((:commit . "c9d199727b5cdcb9e36a972b38131ce4611fd6c8") (:authors ("Gergely Risko" . "gergely@risko.hu")) (:maintainer "Gergely Risko" . "gergely@risko.hu") (:keywords "indentation" "haskell") (:url . "https://github.com/errge/hi2"))]) + (hiccup-cli . [(20210208 652) ((emacs (26 1))) "Convert HTML to Hiccup syntax" single ((:commit . "b56ae0d5cd5ce3ef24ed13be5103e231c91ef4e2") (:authors ("Kevin W. van Rooijen")) (:maintainer "Kevin W. van Rooijen") (:keywords "tools") (:url . "https://github.com/kwrooijen/hiccup-cli"))]) + (hide-lines . [(20210513 1636) nil "Commands for hiding lines based on a regexp" single ((:commit . "f0828c15e50db5eddb905de783e7683b04d1eca3") (:authors ("Mark Hulme-Jones ")) (:maintainer "Joe Bloggs" . "vapniks@yahoo.com") (:keywords "convenience") (:url . "https://github.com/vapniks/hide-lines"))]) + (hide-mode-line . [(20211112 1400) ((emacs (24 4))) "minor mode that hides/masks your modeline" single ((:commit . "bc5d293576c5e08c29e694078b96a5ed85631942") (:authors ("Henrik Lissner ")) (:maintainer "Henrik Lissner" . "git@henrik.io") (:keywords "frames" "mode-line") (:url . "https://github.com/hlissner/emacs-hide-mode-line"))]) + (hidepw . [(20200326 112) nil "Minor mode to hide passwords" single ((:commit . "73f099da79d73fe4087472df3469d8b9b20a59f2") (:authors ("Chris Forno" . "jekor@jekor.com")) (:maintainer "Chris Forno" . "jekor@jekor.com") (:keywords "hide" "hidden" "password" "faces") (:url . "https://github.com/jekor/hidepw"))]) + (hideshow-org . [(20120223 2250) nil "Provides org-mode like hide and show for hideshow.el" single ((:commit . "16419e52e6cdd2f46f755144c0ab11ce00d1a626") (:authors ("Shane Celis ")) (:maintainer "Shane Celis ") (:keywords "c" "c++" "java" "lisp" "tools" "editing" "comments" "blocks" "hiding" "outlines" "org-mode"))]) + (hierarchy . [(20190425 842) ((emacs (25 1))) "Library to create and display hierarchy structures" single ((:commit . "fed505b8e71bf51772887c8a94bb57f5b8838b63") (:authors ("Damien Cassou" . "damien@cassou.me")) (:maintainer "Damien Cassou" . "damien@cassou.me") (:url . "https://github.com/DamienCassou/hierarchy"))]) + (highlight . [(20210318 2248) nil "Highlighting commands." single ((:commit . "28557cb8d99b96eb509aaec1334c7cdda162517f") (:authors ("Drew Adams")) (:maintainer nil . "Drew Adams (concat \"drew.adams\" \"@\" \"oracle\" \".com\")") (:keywords "faces" "help" "local") (:url . "https://www.emacswiki.org/emacs/download/highlight.el"))]) + (highlight-blocks . [(20190318 1557) ((emacs (24))) "Highlight the blocks point is in" single ((:commit . "33cf3d36662faa36c86c8d53e4d5a3922efa3eb8") (:authors ("Fanael Linithien" . "fanael4@gmail.com")) (:maintainer "Fanael Linithien" . "fanael4@gmail.com") (:url . "https://github.com/Fanael/highlight-blocks"))]) + (highlight-context-line . [(20181122 2203) nil "Improve orientation when scrolling" single ((:commit . "6b334e8207c780835a05b6909b4d826898c33d26") (:authors ("Stefan Kamphausen ")) (:maintainer "Stefan Kamphausen ") (:keywords "faces" "services" "user") (:url . "https://github.com/ska2342/highlight-context-line/"))]) + (highlight-defined . [(20210411 222) ((emacs (24))) "Syntax highlighting of known Elisp symbols" single ((:commit . "4420bdda419875dacb065468aafe273b2022580e") (:authors ("Fanael Linithien" . "fanael4@gmail.com")) (:maintainer "Fanael Linithien" . "fanael4@gmail.com") (:url . "https://github.com/Fanael/highlight-defined"))]) + (highlight-doxygen . [(20200520 1713) nil "Highlight Doxygen comments" single ((:commit . "eec4874e2e89d4eb39091aad89a67dff8f8ec84c") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "faces") (:url . "https://github.com/Lindydancer/highlight-doxygen"))]) + (highlight-escape-sequences . [(20201214 1730) nil "Highlight escape sequences" single ((:commit . "fae976568c04b6fe8a9f2d854c8fe23b357a6878") (:authors ("Dmitry Gutov" . "dgutov@yandex.ru") ("Pavel Matcula" . "dev.plvlml@gmail.com")) (:maintainer "Dmitry Gutov" . "dgutov@yandex.ru") (:keywords "convenience") (:url . "https://github.com/dgutov/highlight-escape-sequences"))]) + (highlight-function-calls . [(20170908 500) ((emacs (24 4))) "Highlight function/macro calls" single ((:commit . "f7a1eaf95fc64cc0db4d0567f9ff79ec4ae04787") (:authors ("Adam Porter" . "adam@alphapapa.net")) (:maintainer "Adam Porter" . "adam@alphapapa.net") (:keywords "faces" "highlighting") (:url . "http://github.com/alphapapa/highlight-function-calls"))]) + (highlight-indent-guides . [(20200820 2328) ((emacs (24 1))) "Minor mode to highlight indentation" single ((:commit . "cf352c85cd15dd18aa096ba9d9ab9b7ab493e8f6") (:authors ("DarthFennec" . "darthfennec@derpymail.org")) (:maintainer "DarthFennec" . "darthfennec@derpymail.org") (:url . "https://github.com/DarthFennec/highlight-indent-guides"))]) + (highlight-indentation . [(20210221 1418) nil "Minor modes for highlighting indentation" single ((:commit . "d88db4248882da2d4316e76ed673b4ac1fa99ce3") (:authors ("Anton Johansson" . "anton.johansson@gmail.com")) (:maintainer "Anton Johansson" . "anton.johansson@gmail.com") (:url . "https://github.com/antonj/Highlight-Indentation-for-Emacs"))]) + (highlight-leading-spaces . [(20151216 1222) ((emacs (24 4))) "Highlight leading spaces" single ((:commit . "840db19d863dd97993fd9f893f5be501627b6354") (:authors ("Thomas Winant" . "dewinant@gmail.com")) (:maintainer "Thomas Winant" . "dewinant@gmail.com") (:url . "https://github.com/mrBliss/highlight-leading-spaces"))]) + (highlight-numbers . [(20181013 1744) ((emacs (24)) (parent-mode (2 0))) "Highlight numbers in source code" single ((:commit . "8b4744c7f46c72b1d3d599d4fb75ef8183dee307") (:authors ("Fanael Linithien" . "fanael4@gmail.com")) (:maintainer "Fanael Linithien" . "fanael4@gmail.com") (:url . "https://github.com/Fanael/highlight-numbers"))]) + (highlight-operators . [(20170213 2220) nil "a face for operators in programming modes" single ((:commit . "7696b43419505d6e3511ad2781f9f1dd3c55ef8c") (:authors ("Jonathan Kotta" . "jpkotta@gmail.com")) (:maintainer "Jonathan Kotta" . "jpkotta@gmail.com"))]) + (highlight-parentheses . [(20220408 845) ((emacs (24 3))) "Highlight surrounding parentheses" single ((:commit . "438a1cb2563e2a2496be4678cc0df8d5b22caf5d") (:authors ("Nikolaj Schumacher ")) (:maintainer "Tassilo Horn" . "tsdh@gnu.org") (:keywords "faces" "matching") (:url . "https://sr.ht/~tsdh/highlight-parentheses.el/"))]) + (highlight-quoted . [(20140916 1822) ((emacs (24))) "Highlight Lisp quotes and quoted symbols" single ((:commit . "24103478158cd19fbcfb4339a3f1fa1f054f1469") (:authors ("Fanael Linithien" . "fanael4@gmail.com")) (:maintainer "Fanael Linithien" . "fanael4@gmail.com") (:url . "https://github.com/Fanael/highlight-quoted"))]) + (highlight-refontification . [(20170211 2024) nil "Visualize font-lock refontification." single ((:commit . "32632897d88c4611fadb08517ca00ef5cbc989b6") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "faces" "tools") (:url . "https://github.com/Lindydancer/highlight-refontification"))]) + (highlight-stages . [(20210306 418) nil "highlight staged (quasi-quoted) expressions" single ((:commit . "95daa710f3d8fc83f42c5da38003fc71ae0da1fc") (:authors ("zk_phi")) (:maintainer "zk_phi") (:url . "http://hins11.yu-yake.com/"))]) + (highlight-symbol . [(20160102 2009) nil "automatic and manual symbol highlighting" single ((:commit . "7a789c779648c55b16e43278e51be5898c121b3a") (:authors ("Nikolaj Schumacher ")) (:maintainer "Nikolaj Schumacher ") (:keywords "faces" "matching") (:url . "http://nschum.de/src/emacs/highlight-symbol/"))]) + (highlight-thing . [(20181229 1301) nil "Minimalistic minor mode to highlight current thing under point." single ((:commit . "561d08a26f78f18d405d4f371f1c813db094e2f3") (:authors ("Felix Geller" . "fgeller@gmail.com")) (:maintainer "Felix Geller" . "fgeller@gmail.com") (:keywords "highlight" "thing" "symbol") (:url . "https://github.com/fgeller/highlight-thing.el"))]) + (highlight-unique-symbol . [(20130612 542) ((deferred (0 3 2))) "highlight symbols which not appear in the repository" single ((:commit . "4141bf86a94e30d94d9af9c29d40b16886226e1c") (:authors ("hitode909" . "hitode909@gmail.com")) (:maintainer "hitode909" . "hitode909@gmail.com") (:url . "https://github.com/hitode909/emacs-highlight-unique-symbol"))]) + (highlight2clipboard . [(20151020 1840) ((htmlize (1 47))) "Copy text to clipboard with highlighting." tar ((:commit . "6ce58a060d9c5843ccb8c79ec2bba7858c68ac15") (:authors ("Anders Lindgren")) (:maintainer "Anders Lindgren") (:keywords "tools"))]) + (hindent . [(20210201 148) ((cl-lib (0 5))) "Indent haskell code using the \"hindent\" program" single ((:commit . "f7e7b12fd119e91c795cbe21bebf7b5af5d273b8") (:authors ("Chris Done" . "chrisdone@gmail.com")) (:maintainer "Chris Done" . "chrisdone@gmail.com") (:url . "https://github.com/chrisdone/hindent"))]) + (hippie-exp-ext . [(20160502 2326) nil "Extension of hippie-expand" single ((:commit . "4eda13f90da51ab217d024701f4c30f91ffcb90e") (:authors ("rubikitch" . "rubikitch@ruby-lang.org")) (:maintainer "rubikitch" . "rubikitch@ruby-lang.org") (:keywords "abbrev" "convenience" "completions" "hippie-expand") (:url . "http://www.emacswiki.org/emacs/download/hippie-exp-ext.el"))]) + (hippie-expand-slime . [(20170723 146) nil "Hook slime's completion into hippie-expand" single ((:commit . "39bbae94896a62854d31754debdfae71d35fec62") (:authors ("Steve Purcell" . "steve@sanityinc.com")) (:maintainer "Steve Purcell" . "steve@sanityinc.com") (:url . "https://github.com/purcell/hippie-expand-slime"))]) + (hippie-namespace . [(20140508 2041) nil "Special treatment for namespace prefixes in hippie-expand" single ((:commit . "d0d0f15c67ab8bef5e9d1e29a89ecd3613a60b49") (:authors ("Roland Walker" . "walker@pobox.com")) (:maintainer "Roland Walker" . "walker@pobox.com") (:keywords "convenience" "lisp" "tools" "completion") (:url . "http://github.com/rolandwalker/hippie-namespace"))]) + (historian . [(20200203 1927) ((emacs (24 4))) "Persistently store selected minibuffer candidates" single ((:commit . "852cb4e72c0f78c8dbb2c972bdcb4e7b0108ff4c") (:authors ("PythonNut" . "pythonnut@pythonnut.com")) (:maintainer "PythonNut" . "pythonnut@pythonnut.com") (:keywords "convenience") (:url . "https://github.com/PythonNut/historian.el"))]) + (history . [(20160821 1602) ((emacs (24 3))) "History utility for source code navigation" tar ((:commit . "5317663fb45bbd5e96d258cb0807dcc266ce67ff") (:authors ("boyw165")) (:maintainer "boyw165") (:url . "https://github.com/boyw165/history"))]) + (historyf . [(20151124 159) nil "file history library like browser" single ((:commit . "196c058ceb092fdd56b0e4ce85b7e714d6f72224") (:authors ("k1LoW (Kenichirou Oyama), ")) (:maintainer "k1LoW (Kenichirou Oyama), ") (:url . "https://github.com/k1LoW/emacs-historyf"))]) + (hive . [(20131217 1512) ((sql (3 0))) "Hive SQL mode extension" single ((:commit . "11b5172e081ad8079fc78758bef6f306f82ae32b") (:authors ("Roman Scherer" . "roman@burningswell.com")) (:maintainer "Roman Scherer" . "roman@burningswell.com") (:keywords "sql" "hive"))]) + (hiwin . [(20150825 827) nil "Visible active window mode." single ((:commit . "6ee8ed051405653bd9b7332d7e9fbb591d954051") (:authors ("k.sugita")) (:maintainer "k.sugita") (:keywords "faces" "editing" "emulating"))]) + (hl-anything . [(20160422 1708) ((emacs (24 3))) "Highlight symbols, selections, enclosing parens and more." tar ((:commit . "8696bc55a8cba408f0fc83a907a9ec529d79e558") (:authors ("boyw165")) (:maintainer "boyw165"))]) + (hl-block-mode . [(20220507 1118) ((emacs (26 1))) "Highlighting nested blocks" single ((:commit . "7e0452c768a4e309d1cdc15025683ebfe71e626f") (:authors ("Campbell Barton" . "ideasman42@gmail.com")) (:maintainer "Campbell Barton" . "ideasman42@gmail.com") (:url . "https://codeberg.com/ideasman42/emacs-hl-block-mode"))]) + (hl-fill-column . [(20200607 757) ((names (0 5)) (emacs (24))) "Highlight fill column." single ((:commit . "5782a91ba0182c4e562fa0db6379ff9dd472856b") (:keywords "fill column" "faces") (:url . "https://github.com/laishulu/hl-fill-column"))]) + (hl-indent . [(20170429 2104) ((emacs (24)) (cl-lib (0 5))) "Highlight irregular indentation." single ((:commit . "bdb2e0177a7c8b29af26998e688b856adc6ded93") (:authors ("Kirill Ignatiev ")) (:maintainer "Kirill Ignatiev ") (:keywords "convenience" "faces") (:url . "https://github.com/ikirill/hl-indent"))]) + (hl-prog-extra . [(20220507 1118) ((emacs (26 2))) "Customizable highlighting for source-code" tar ((:commit . "a8e2ee5d43ce70c59e57d2ab90b39a6cf9e7b851") (:authors ("Campbell Barton" . "ideasman42@gmail.com")) (:maintainer "Campbell Barton" . "ideasman42@gmail.com") (:keywords "convenience") (:url . "https://codeberg.com/ideasman42/emacs-hl-prog-extra"))]) + (hl-sentence . [(20171018 1519) nil "highlight a sentence based on customizable face" single ((:commit . "86ae38d3103bd20da5485cbdd59dfbd396c45ee4") (:authors ("Donald Ephraim Curtis" . "dcurtis@milkbox.net")) (:maintainer "Donald Ephraim Curtis" . "dcurtis@milkbox.net") (:keywords "highlighting") (:url . "http://github.com/milkypostman/hl-sentence"))]) + (hl-todo . [(20220422 1611) ((emacs (25 1)) (compat (28 1 1 0))) "Highlight TODO and similar keywords" single ((:commit . "2337eac8cab0d4b73a96fb3936d2ac87600e3c91") (:authors ("Jonas Bernoulli" . "jonas@bernoul.li")) (:maintainer "Jonas Bernoulli" . "jonas@bernoul.li") (:keywords "convenience") (:url . "https://github.com/tarsius/hl-todo"))]) + (hledger-mode . [(20210706 1225) ((emacs (24 4)) (popup (0 5 3)) (async (1 9)) (htmlize (1 47))) "A mode for writing journal entries for hledger." tar ((:commit . "9ac07ff0adbce6a402c17e789b1750f9da0d22f4") (:authors ("Narendra Joshi" . "narendraj9@gmail.com")) (:maintainer "Narendra Joshi" . "narendraj9@gmail.com") (:keywords "data") (:url . "https://github.com/narendraj9/hledger-mode.git"))]) + (hlint-refactor . [(20190115 900) nil "Apply HLint suggestions" single ((:commit . "c4307f86aad6d02e32e9b30cb6edc115584c791c") (:keywords "haskell" "refactor") (:url . "https://github.com/mpickering/hlint-refactor-mode"))]) + (hlinum . [(20180422 412) ((cl-lib (0 2))) "Extension for linum.el to highlight current line number" single ((:commit . "5646d9c0b9e7598b20b2004eab5439fdc6dbeda5") (:authors ("Tomoya Tanjo" . "ttanjo@gmail.com")) (:maintainer "Tomoya Tanjo" . "ttanjo@gmail.com") (:keywords "convenience" "extensions") (:url . "https://github.com/tom-tan/hlinum-mode/"))]) + (hmac . [(20201004 1819) ((emacs (25 1))) "Hash-based message authentication code" single ((:commit . "f2b99a9a10becfff207cf9418c6dce78364b1a4b") (:authors ("Sean McAfee")) (:maintainer "Sean McAfee") (:url . "https://github.com/grimnebulin/emacs-hmac"))]) + (hnreader . [(20220103 1909) ((emacs (25 1)) (promise (1 1)) (request (0 3 0)) (org (9 2))) "A hackernews reader" single ((:commit . "e17006072b0cd06ab7ff32c6187e9565131a78b2") (:authors ("Thanh Vuong" . "thanhvg@gmail.com")) (:maintainer "Thanh Vuong" . "thanhvg@gmail.com") (:url . "https://github.com/thanhvg/emacs-hnreader/"))]) + (hoa-mode . [(20200610 1339) nil "Major mode for the HOA format" single ((:commit . "18f5c981e256f867f29a93376ccdc04717b159cd") (:authors ("Alexandre Duret-Lutz" . "adl@lrde.epita.fr")) (:maintainer "Alexandre Duret-Lutz" . "adl@lrde.epita.fr") (:keywords "major-mode" "automata" "convenience") (:url . "https://gitlab.lrde.epita.fr/spot/emacs-modes"))]) + (holiday-pascha-etc . [(20160822 58) nil "Eastern Christian analog to holiday-easter-etc" single ((:commit . "eb198656f63cb8679fb0e3a8248782df071a0f3c") (:authors ("Mark A. Hershberger" . "mah@everybody.org")) (:maintainer "Mark A. Hershberger" . "mah@everybody.org") (:url . "http://github.com/hexmode/holiday-pascha-etc"))]) + (holy-books . [(20211025 127) ((s (1 12 0)) (dash (2 16 0)) (emacs (27 1)) (org (9 1))) "Org-mode links/tooltips/lookups for Quran & Bible" single ((:commit . "02c2956d36631d3d8c8b4bacdcf0a5cdd1f3136d") (:authors ("Musa Al-hassy" . "alhassy@gmail.com")) (:maintainer "Musa Al-hassy" . "alhassy@gmail.com") (:keywords "quran" "bible" "links" "tooltips" "convenience" "comm" "hypermedia") (:url . "https://alhassy.github.io/holy-books/"))]) + (home-end . [(20180817 855) ((emacs (24 3)) (keypress-multi-event (1 0))) "Smart multi-purpose home / end keys" single ((:commit . "fbddad2c1268720ce17662a232b48f666e489526") (:authors ("Boruch Baum" . "boruch_baum@gmx.com")) (:maintainer "Boruch Baum" . "boruch_baum@gmx.com") (:keywords "abbrev" "convenience" "wp" "keyboard") (:url . "https://www.github.com/Boruch_Baum/emacs-home-end"))]) + (homebrew-mode . [(20210919 331) ((emacs (24 4)) (inf-ruby (2 4 0)) (dash (1 2 0))) "minor mode for editing Homebrew formulae" single ((:commit . "8c630c6f768b942a86a10750f720abc64a817cd0") (:authors ("Alex Dunn" . "dunn.alex@gmail.com")) (:maintainer "Alex Dunn" . "dunn.alex@gmail.com") (:keywords "homebrew" "brew" "ruby") (:url . "https://github.com/dunn/homebrew-mode"))]) + (honcho . [(20190623 2120) ((emacs (25 1)) (sudo-edit (0 1))) "Run and manage long-running services" single ((:commit . "d5e6206dd23ff9305d976c52845c750a064aca4b") (:authors ("Mario Rodas" . "marsam@users.noreply.github.com")) (:maintainer "Mario Rodas" . "marsam@users.noreply.github.com") (:keywords "convenience") (:url . "https://github.com/emacs-pe/honcho.el"))]) + (hookify . [(20141216 2209) ((s (1 9 0)) (dash (1 5 0))) "Interactive commands to create temporary hooks" single ((:commit . "21baae7393b07257de5796402fde0ca72fb00d77") (:authors ("Philippe Vaucher" . "philippe.vaucher@gmail.com")) (:maintainer "Philippe Vaucher" . "philippe.vaucher@gmail.com") (:keywords "hook" "convenience") (:url . "https://github.com/Silex/hookify"))]) + (horizon-theme . [(20200720 1832) ((emacs (24 3))) "A beautifully warm dual theme" single ((:commit . "9595549c514a9376c61d5d303405f6a6982e9e46") (:url . "https://github.com/aodhneine/horizon-theme.el"))]) + (horoscope . [(20180409 641) ((emacs (24))) "generate horoscopes." single ((:commit . "f4c683e991adce0a8f9023f15050f306f9b9a9ed") (:authors ("Bob Manson" . "manson@cygnus.com")) (:maintainer "Noah Friedman" . "friedman@prep.ai.mit.edu") (:keywords "extensions" "games") (:url . "https://github.com/mschuldt/horoscope.el"))]) + (hotfuzz . [(20210924 936) ((emacs (27 1))) "Fuzzy completion style" single ((:commit . "95a1be449624aa2b25128b900b6211034d0e17bb") (:authors ("Axel Forsman" . "axelsfor@gmail.com")) (:maintainer "Axel Forsman" . "axelsfor@gmail.com") (:keywords "matching") (:url . "https://github.com/axelf4/hotfuzz"))]) + (hound . [(20200122 1700) ((request (0 2 0)) (cl-lib (0 5))) "Display hound search results in a compilation window" single ((:commit . "35e2cdc81fcc904b450a7ef3ec00fd25df6a4431") (:authors ("Ryan Young")) (:maintainer "Ryan Young"))]) + (hover . [(20220129 1935) ((emacs (25 2)) (dash (2 14 1))) "Package to use hover with flutter" single ((:commit . "4ca0638a14a8b304ac2b46e7b342b8d8732ad199") (:authors ("Eric Dallo")) (:maintainer "Eric Dallo") (:keywords "hover" "flutter" "mobile" "tools") (:url . "https://github.com/ericdallo/hover.el"))]) + (howdoi . [(20150204 43) nil "Instant coding answers via Emacs." tar ((:commit . "5fbf7069ee160c597a328e5ce5fb32920e1ca88f") (:authors ("Andrey Tykhonov ")) (:maintainer "Andrey Tykhonov" . "atykhonov@gmail.com") (:keywords "howdoi" "convenience") (:url . "https://github.com/atykhonov/emacs-howdoi/"))]) + (howdoyou . [(20210909 2000) ((emacs (25 1)) (promise (1 1)) (request (0 3 3)) (org (9 2))) "A stackoverflow and its sisters' sites reader" single ((:commit . "a01971a7279c8a031de78513c004d7a09d293712") (:authors ("Thanh Vuong" . "thanhvg@gmail.com")) (:maintainer "Thanh Vuong" . "thanhvg@gmail.com") (:url . "https://github.com/thanhvg/howdoyou/"))]) + (howm . [(20211230 1221) ((cl-lib (0 5))) "Wiki-like note-taking tool" tar ((:commit . "c381e50f0c771c38306bda37bd972a37a36a5db5") (:authors ("HIRAOKA Kazuyuki" . "khi@users.osdn.me")) (:maintainer "HIRAOKA Kazuyuki" . "khi@users.osdn.me") (:url . "https://howm.osdn.jp"))]) + (hsluv . [(20181127 1206) ((seq (2 20))) "hsluv color space conversions" single ((:commit . "c3bc5228e30d66e7dee9ff1a0694c2b976862fc0") (:authors ("Geert Vermeiren")) (:maintainer "Geert Vermeiren") (:keywords "color" "hsluv") (:url . "https://github.com/hsluv/hsluv-emacs"))]) + (ht . [(20210119 741) ((dash (2 12 0))) "The missing hash table library for Emacs" single ((:commit . "c4c1be487d6ecb353d07881526db05d7fc90ea87") (:authors ("Wilfred Hughes" . "me@wilfred.me.uk")) (:maintainer "Wilfred Hughes" . "me@wilfred.me.uk") (:keywords "hash table" "hash map" "hash"))]) + (html-check-frag . [(20201106 1748) ((emacs (24 3))) "Check html-fragments" single ((:commit . "b9d1f2003a126c2e8b6d469964ec2278ad55c9df") (:authors ("Tobias.Zawada" . "i@tn-home.de")) (:maintainer "Tobias.Zawada" . "i@tn-home.de") (:keywords "html"))]) + (html-script-src . [(20120403 1815) nil "Insert \n ")))) + +(defun org-babel-prep-session:processing (_session _params) + "Return an error if the :session header argument is set. +Processing does not support sessions." + (error "Processing does not support sessions")) + +(defun org-babel-variable-assignments:processing (params) + "Return list of processing statements assigning the block's variables." + (mapcar #'org-babel-processing-var-to-processing + (org-babel--get-vars params))) + +(defun org-babel-processing-var-to-processing (pair) + "Convert an elisp value into a Processing variable. +The elisp value PAIR is converted into Processing code specifying +a variable of the same value." + (let ((var (car pair)) + (val (let ((v (cdr pair))) + (if (symbolp v) (symbol-name v) v)))) + (cond + ((integerp val) + (format "int %S=%S;" var val)) + ((floatp val) + (format "float %S=%S;" var val)) + ((stringp val) + (format "String %S=\"%s\";" var val)) + ((and (listp val) (not (listp (car val)))) + (let* ((type (org-babel-processing-define-type val)) + (fmt (if (eq 'String type) "\"%s\"" "%s")) + (vect (mapconcat (lambda (e) (format fmt e)) val ", "))) + (format "%s[] %S={%s};" type var vect))) + ((listp val) + (let* ((type (org-babel-processing-define-type val)) + (fmt (if (eq 'String type) "\"%s\"" "%s")) + (array (mapconcat (lambda (row) + (concat "{" + (mapconcat (lambda (e) (format fmt e)) + row ", ") + "}")) + val ","))) + (format "%S[][] %S={%s};" type var array)))))) + +(defun org-babel-processing-define-type (data) + "Determine type of DATA. + +DATA is a list. Return type as a symbol. + +The type is `String' if any element in DATA is a string. +Otherwise, it is either `float', if some elements are floats, or +`int'." + (letrec ((type 'int) + (find-type + (lambda (row) + (dolist (e row type) + (cond ((listp e) (setq type (funcall find-type e))) + ((stringp e) (throw 'exit 'String)) + ((floatp e) (setq type 'float))))))) + (catch 'exit (funcall find-type data)))) + +(provide 'ob-processing) + +;;; ob-processing.el ends here diff --git a/elpa/org-9.5.2/ob-processing.elc b/elpa/org-9.5.2/ob-processing.elc new file mode 100644 index 0000000..f4e6130 Binary files /dev/null and b/elpa/org-9.5.2/ob-processing.elc differ diff --git a/elpa/org-9.5.2/ob-python.el b/elpa/org-9.5.2/ob-python.el new file mode 100644 index 0000000..3c095ad --- /dev/null +++ b/elpa/org-9.5.2/ob-python.el @@ -0,0 +1,444 @@ +;;; ob-python.el --- Babel Functions for Python -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Authors: Eric Schulte +;; Dan Davison +;; Maintainer: Jack Kamm +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating python source code. + +;;; Code: +(require 'ob) +(require 'org-macs) +(require 'python) + +(declare-function py-shell "ext:python-mode" (&rest args)) +(declare-function py-toggle-shells "ext:python-mode" (arg)) +(declare-function py-shell-send-string "ext:python-mode" (strg &optional process)) + +(defvar org-babel-tangle-lang-exts) +(add-to-list 'org-babel-tangle-lang-exts '("python" . "py")) + +(defvar org-babel-default-header-args:python '()) + +(defcustom org-babel-python-command "python" + "Name of the command for executing Python code." + :version "24.4" + :package-version '(Org . "8.0") + :group 'org-babel + :type 'string) + +(defcustom org-babel-python-mode + (if (featurep 'python-mode) 'python-mode 'python) + "Preferred python mode for use in running python interactively. +This will typically be either `python' or `python-mode'." + :group 'org-babel + :version "24.4" + :package-version '(Org . "8.0") + :type 'symbol) + +(defcustom org-babel-python-hline-to "None" + "Replace hlines in incoming tables with this when translating to python." + :group 'org-babel + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-babel-python-None-to 'hline + "Replace `None' in python tables with this before returning." + :group 'org-babel + :version "24.4" + :package-version '(Org . "8.0") + :type 'symbol) + +(defun org-babel-execute:python (body params) + "Execute a block of Python code with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((org-babel-python-command + (or (cdr (assq :python params)) + org-babel-python-command)) + (session (org-babel-python-initiate-session + (cdr (assq :session params)))) + (result-params (cdr (assq :result-params params))) + (result-type (cdr (assq :result-type params))) + (return-val (when (eq result-type 'value) + (cdr (assq :return params)))) + (preamble (cdr (assq :preamble params))) + (async (org-babel-comint-use-async params)) + (full-body + (concat + (org-babel-expand-body:generic + body params + (org-babel-variable-assignments:python params)) + (when return-val + (format (if session "\n%s" "\nreturn %s") return-val)))) + (result (org-babel-python-evaluate + session full-body result-type + result-params preamble async))) + (org-babel-reassemble-table + result + (org-babel-pick-name (cdr (assq :colname-names params)) + (cdr (assq :colnames params))) + (org-babel-pick-name (cdr (assq :rowname-names params)) + (cdr (assq :rownames params)))))) + +(defun org-babel-prep-session:python (session params) + "Prepare SESSION according to the header arguments in PARAMS. +VARS contains resolved variable references." + (let* ((session (org-babel-python-initiate-session session)) + (var-lines + (org-babel-variable-assignments:python params))) + (org-babel-comint-in-buffer session + (mapc (lambda (var) + (end-of-line 1) (insert var) (comint-send-input) + (org-babel-comint-wait-for-output session)) + var-lines)) + session)) + +(defun org-babel-load-session:python (session body params) + "Load BODY into SESSION." + (save-window-excursion + (let ((buffer (org-babel-prep-session:python session params))) + (with-current-buffer buffer + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert (org-babel-chomp body))) + buffer))) + +;; helper functions + +(defun org-babel-variable-assignments:python (params) + "Return a list of Python statements assigning the block's variables." + (mapcar + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-python-var-to-python (cdr pair)))) + (org-babel--get-vars params))) + +(defun org-babel-python-var-to-python (var) + "Convert an elisp value to a python variable. +Convert an elisp value, VAR, into a string of python source code +specifying a variable of the same value." + (if (listp var) + (concat "[" (mapconcat #'org-babel-python-var-to-python var ", ") "]") + (if (eq var 'hline) + org-babel-python-hline-to + (format + (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S") + (if (stringp var) (substring-no-properties var) var))))) + +(defun org-babel-python-table-or-string (results) + "Convert RESULTS into an appropriate elisp value. +If the results look like a list or tuple, then convert them into an +Emacs-lisp table, otherwise return the results as a string." + (let ((res (org-babel-script-escape results))) + (if (listp res) + (mapcar (lambda (el) (if (eq el 'None) + org-babel-python-None-to el)) + res) + res))) + +(defvar org-babel-python-buffers '((:default . "*Python*"))) + +(defun org-babel-python-session-buffer (session) + "Return the buffer associated with SESSION." + (cdr (assoc session org-babel-python-buffers))) + +(defun org-babel-python-with-earmuffs (session) + (let ((name (if (stringp session) session (format "%s" session)))) + (if (and (string= "*" (substring name 0 1)) + (string= "*" (substring name (- (length name) 1)))) + name + (format "*%s*" name)))) + +(defun org-babel-python-without-earmuffs (session) + (let ((name (if (stringp session) session (format "%s" session)))) + (if (and (string= "*" (substring name 0 1)) + (string= "*" (substring name (- (length name) 1)))) + (substring name 1 (- (length name) 1)) + name))) + +(defvar py-default-interpreter) +(defvar py-which-bufname) +(defvar python-shell-buffer-name) +(defun org-babel-python-initiate-session-by-key (&optional session) + "Initiate a python session. +If there is not a current inferior-process-buffer in SESSION +then create. Return the initialized session." + (save-window-excursion + (let* ((session (if session (intern session) :default)) + (py-buffer (org-babel-python-session-buffer session)) + (cmd (if (member system-type '(cygwin windows-nt ms-dos)) + (concat org-babel-python-command " -i") + org-babel-python-command))) + (cond + ((eq 'python org-babel-python-mode) ; python.el + (unless py-buffer + (setq py-buffer (org-babel-python-with-earmuffs session))) + (let ((python-shell-buffer-name + (org-babel-python-without-earmuffs py-buffer))) + (run-python cmd) + (sleep-for 0 10))) + ((and (eq 'python-mode org-babel-python-mode) + (fboundp 'py-shell)) ; python-mode.el + (require 'python-mode) + ;; Make sure that py-which-bufname is initialized, as otherwise + ;; it will be overwritten the first time a Python buffer is + ;; created. + (py-toggle-shells py-default-interpreter) + ;; `py-shell' creates a buffer whose name is the value of + ;; `py-which-bufname' with '*'s at the beginning and end + (let* ((bufname (if (and py-buffer (buffer-live-p py-buffer)) + (replace-regexp-in-string ;; zap surrounding * + "^\\*\\([^*]+\\)\\*$" "\\1" py-buffer) + (concat "Python-" (symbol-name session)))) + (py-which-bufname bufname)) + (setq py-buffer (org-babel-python-with-earmuffs bufname)) + (py-shell nil nil t org-babel-python-command py-buffer nil nil t nil))) + (t + (error "No function available for running an inferior Python"))) + (setq org-babel-python-buffers + (cons (cons session py-buffer) + (assq-delete-all session org-babel-python-buffers))) + session))) + +(defun org-babel-python-initiate-session (&optional session _params) + "Create a session named SESSION according to PARAMS." + (unless (string= session "none") + (org-babel-python-session-buffer + (org-babel-python-initiate-session-by-key session)))) + +(defvar org-babel-python-eoe-indicator "org_babel_python_eoe" + "A string to indicate that evaluation has completed.") + +(defconst org-babel-python-wrapper-method + " +def main(): +%s + +open('%s', 'w').write( str(main()) )") +(defconst org-babel-python-pp-wrapper-method + " +import pprint +def main(): +%s + +open('%s', 'w').write( pprint.pformat(main()) )") + +(defconst org-babel-python--exec-tmpfile "\ +with open('%s') as __org_babel_python_tmpfile: + exec(compile(__org_babel_python_tmpfile.read(), __org_babel_python_tmpfile.name, 'exec'))" + "Template for Python session command with output results. + +Has a single %s escape, the tempfile containing the source code +to evaluate.") + +(defun org-babel-python-format-session-value + (src-file result-file result-params) + "Return Python code to evaluate SRC-FILE and write result to RESULT-FILE." + (format "\ +import ast +with open('%s') as __org_babel_python_tmpfile: + __org_babel_python_ast = ast.parse(__org_babel_python_tmpfile.read()) +__org_babel_python_final = __org_babel_python_ast.body[-1] +if isinstance(__org_babel_python_final, ast.Expr): + __org_babel_python_ast.body = __org_babel_python_ast.body[:-1] + exec(compile(__org_babel_python_ast, '', 'exec')) + __org_babel_python_final = eval(compile(ast.Expression( + __org_babel_python_final.value), '', 'eval')) + with open('%s', 'w') as __org_babel_python_tmpfile: + if %s: + import pprint + __org_babel_python_tmpfile.write(pprint.pformat(__org_babel_python_final)) + else: + __org_babel_python_tmpfile.write(str(__org_babel_python_final)) +else: + exec(compile(__org_babel_python_ast, '', 'exec')) + __org_babel_python_final = None" + (org-babel-process-file-name src-file 'noquote) + (org-babel-process-file-name result-file 'noquote) + (if (member "pp" result-params) "True" "False"))) + +(defun org-babel-python-evaluate + (session body &optional result-type result-params preamble async) + "Evaluate BODY as Python code." + (if session + (if async + (org-babel-python-async-evaluate-session + session body result-type result-params) + (org-babel-python-evaluate-session + session body result-type result-params)) + (org-babel-python-evaluate-external-process + body result-type result-params preamble))) + +(defun org-babel-python--shift-right (body &optional count) + (with-temp-buffer + (python-mode) + (insert body) + (goto-char (point-min)) + (while (not (eobp)) + (unless (python-syntax-context 'string) + (python-indent-shift-right (line-beginning-position) + (line-end-position) + count)) + (forward-line 1)) + (buffer-string))) + +(defun org-babel-python-evaluate-external-process + (body &optional result-type result-params preamble) + "Evaluate BODY in external python process. +If RESULT-TYPE equals `output' then return standard output as a +string. If RESULT-TYPE equals `value' then return the value of the +last statement in BODY, as elisp." + (let ((raw + (pcase result-type + (`output (org-babel-eval org-babel-python-command + (concat preamble (and preamble "\n") + body))) + (`value (let ((tmp-file (org-babel-temp-file "python-"))) + (org-babel-eval + org-babel-python-command + (concat + preamble (and preamble "\n") + (format + (if (member "pp" result-params) + org-babel-python-pp-wrapper-method + org-babel-python-wrapper-method) + (org-babel-python--shift-right body) + (org-babel-process-file-name tmp-file 'noquote)))) + (org-babel-eval-read-file tmp-file)))))) + (org-babel-result-cond result-params + raw + (org-babel-python-table-or-string (org-trim raw))))) + +(defun org-babel-python--send-string (session body) + "Pass BODY to the Python process in SESSION. +Return output." + (with-current-buffer session + (let* ((string-buffer "") + (comint-output-filter-functions + (cons (lambda (text) (setq string-buffer + (concat string-buffer text))) + comint-output-filter-functions)) + (body (format "\ +try: +%s +except: + raise +finally: + print('%s')" + (org-babel-python--shift-right body 4) + org-babel-python-eoe-indicator))) + (if (not (eq 'python-mode org-babel-python-mode)) + (let ((python-shell-buffer-name + (org-babel-python-without-earmuffs session))) + (python-shell-send-string body)) + (require 'python-mode) + (py-shell-send-string body (get-buffer-process session))) + ;; same as `python-shell-comint-end-of-output-p' in emacs-25.1+ + (while (not (string-match + org-babel-python-eoe-indicator + string-buffer)) + (accept-process-output (get-buffer-process (current-buffer)))) + (org-babel-chomp (substring string-buffer 0 (match-beginning 0)))))) + +(defun org-babel-python-evaluate-session + (session body &optional result-type result-params) + "Pass BODY to the Python process in SESSION. +If RESULT-TYPE equals `output' then return standard output as a +string. If RESULT-TYPE equals `value' then return the value of the +last statement in BODY, as elisp." + (let* ((tmp-src-file (org-babel-temp-file "python-")) + (results + (progn + (with-temp-file tmp-src-file (insert body)) + (pcase result-type + (`output + (let ((body (format org-babel-python--exec-tmpfile + (org-babel-process-file-name + tmp-src-file 'noquote)))) + (org-babel-python--send-string session body))) + (`value + (let* ((tmp-results-file (org-babel-temp-file "python-")) + (body (org-babel-python-format-session-value + tmp-src-file tmp-results-file result-params))) + (org-babel-python--send-string session body) + (sleep-for 0 10) + (org-babel-eval-read-file tmp-results-file))))))) + (org-babel-result-cond result-params + results + (org-babel-python-table-or-string results)))) + +(defun org-babel-python-read-string (string) + "Strip \\='s from around Python string." + (if (and (string-prefix-p "'" string) + (string-suffix-p "'" string)) + (substring string 1 -1) + string)) + +;; Async session eval + +(defconst org-babel-python-async-indicator "print ('ob_comint_async_python_%s_%s')") + +(defun org-babel-python-async-value-callback (params tmp-file) + (let ((result-params (cdr (assq :result-params params))) + (results (org-babel-eval-read-file tmp-file))) + (org-babel-result-cond result-params + results + (org-babel-python-table-or-string results)))) + +(defun org-babel-python-async-evaluate-session + (session body &optional result-type result-params) + "Asynchronously evaluate BODY in SESSION. +Returns a placeholder string for insertion, to later be replaced +by `org-babel-comint-async-filter'." + (org-babel-comint-async-register + session (current-buffer) + "ob_comint_async_python_\\(.+\\)_\\(.+\\)" + 'org-babel-chomp 'org-babel-python-async-value-callback) + (let ((python-shell-buffer-name (org-babel-python-without-earmuffs session))) + (pcase result-type + (`output + (let ((uuid (md5 (number-to-string (random 100000000))))) + (with-temp-buffer + (insert (format org-babel-python-async-indicator "start" uuid)) + (insert "\n") + (insert body) + (insert "\n") + (insert (format org-babel-python-async-indicator "end" uuid)) + (python-shell-send-buffer)) + uuid)) + (`value + (let ((tmp-results-file (org-babel-temp-file "python-")) + (tmp-src-file (org-babel-temp-file "python-"))) + (with-temp-file tmp-src-file (insert body)) + (with-temp-buffer + (insert (org-babel-python-format-session-value tmp-src-file tmp-results-file result-params)) + (insert "\n") + (insert (format org-babel-python-async-indicator "file" tmp-results-file)) + (python-shell-send-buffer)) + tmp-results-file))))) + +(provide 'ob-python) + +;;; ob-python.el ends here diff --git a/elpa/org-9.5.2/ob-python.elc b/elpa/org-9.5.2/ob-python.elc new file mode 100644 index 0000000..a46c6f6 Binary files /dev/null and b/elpa/org-9.5.2/ob-python.elc differ diff --git a/elpa/org-9.5.2/ob-ref.el b/elpa/org-9.5.2/ob-ref.el new file mode 100644 index 0000000..a7ab299 --- /dev/null +++ b/elpa/org-9.5.2/ob-ref.el @@ -0,0 +1,246 @@ +;;; ob-ref.el --- Babel Functions for Referencing External Data -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Authors: Eric Schulte +;; Dan Davison +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Functions for referencing data from the header arguments of a +;; org-babel block. The syntax of such a reference should be + +;; #+VAR: variable-name=file:resource-id + +;; - variable-name :: the name of the variable to which the value +;; will be assigned + +;; - file :: path to the file containing the resource, or omitted if +;; resource is in the current file + +;; - resource-id :: the id or name of the resource + +;; So an example of a simple source block referencing table data in +;; the same file would be + +;; #+NAME: sandbox +;; | 1 | 2 | 3 | +;; | 4 | org-babel | 6 | +;; +;; #+begin_src emacs-lisp :var table=sandbox +;; (message table) +;; #+end_src + +;;; Code: +(require 'ob-core) +(require 'org-macs) +(require 'cl-lib) + +(declare-function org-babel-lob-get-info "ob-lob" (&optional datum)) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-end-of-meta-data "org" (&optional full)) +(declare-function org-find-property "org" (property &optional value)) +(declare-function org-id-find-id-file "org-id" (id)) +(declare-function org-id-find-id-in-file "org-id" (id file &optional markerp)) +(declare-function org-in-commented-heading-p "org" (&optional no-inheritance)) +(declare-function org-narrow-to-subtree "org" ()) +(declare-function org-show-context "org" (&optional key)) + +(defvar org-babel-update-intermediate nil + "Update the in-buffer results of code blocks executed to resolve references.") + +(defun org-babel-ref-parse (assignment) + "Parse a variable ASSIGNMENT in a header argument. + +If the right hand side of the assignment has a literal value +return that value, otherwise interpret it as a reference to an +external resource and find its value using `org-babel-ref-resolve'. + +Return a list with two elements: the name of the variable, and an +Emacs Lisp representation of the value of the variable." + (when (string-match "\\(.+?\\)=" assignment) + (let ((var (org-trim (match-string 1 assignment))) + (ref (org-trim (substring assignment (match-end 0))))) + (cons (intern var) + (let ((out (save-excursion + (when org-babel-current-src-block-location + (goto-char (if (markerp org-babel-current-src-block-location) + (marker-position org-babel-current-src-block-location) + org-babel-current-src-block-location))) + (org-babel-read ref)))) + (if (equal out ref) + (if (and (string-prefix-p "\"" ref) + (string-suffix-p "\"" ref)) + (read ref) + (org-babel-ref-resolve ref)) + out)))))) + +(defun org-babel-ref-goto-headline-id (id) + (or (let ((h (org-find-property "CUSTOM_ID" id))) + (when h (goto-char h))) + (let* ((file (org-id-find-id-file id)) + (m (when file (org-id-find-id-in-file id file 'marker)))) + (when (and file m) + (message "file:%S" file) + (pop-to-buffer-same-window (marker-buffer m)) + (goto-char m) + (move-marker m nil) + (org-show-context) + t)))) + +(defun org-babel-ref-headline-body () + (save-restriction + (org-narrow-to-subtree) + (buffer-substring + (save-excursion (goto-char (point-min)) + (org-end-of-meta-data) + (point)) + (point-max)))) + +(defvar org-babel-library-of-babel) +(defun org-babel-ref-resolve (ref) + "Resolve the reference REF and return its value." + (save-window-excursion + (with-current-buffer (or org-babel-exp-reference-buffer (current-buffer)) + (save-excursion + (let ((case-fold-search t) + args new-refere new-header-args new-referent split-file split-ref + index) + ;; if ref is indexed grab the indices -- beware nested indices + (when (and (string-match "\\[\\([^\\[]+\\)\\]$" ref) + (let ((str (substring ref 0 (match-beginning 0)))) + (= (cl-count ?\( str) (cl-count ?\) str)))) + (setq index (match-string 1 ref)) + (setq ref (substring ref 0 (match-beginning 0)))) + ;; assign any arguments to pass to source block + (when (string-match + "^\\(.+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)(\\(.*\\))$" ref) + (setq new-refere (match-string 1 ref)) + (setq new-header-args (match-string 3 ref)) + (setq new-referent (match-string 5 ref)) + (when (> (length new-refere) 0) + (when (> (length new-referent) 0) + (setq args (mapcar (lambda (ref) (cons :var ref)) + (org-babel-ref-split-args new-referent)))) + (when (> (length new-header-args) 0) + (setq args (append (org-babel-parse-header-arguments + new-header-args) + args))) + (setq ref new-refere))) + (when (string-match "^\\(.+\\):\\(.+\\)$" ref) + (setq split-file (match-string 1 ref)) + (setq split-ref (match-string 2 ref)) + (find-file split-file) + (setq ref split-ref)) + (org-with-wide-buffer + (goto-char (point-min)) + (let* ((params (append args '((:results . "silent")))) + (regexp (org-babel-named-data-regexp-for-name ref)) + (result + (catch :found + ;; Check for code blocks or named data. + (while (re-search-forward regexp nil t) + ;; Ignore COMMENTed headings and orphaned + ;; affiliated keywords. + (unless (org-in-commented-heading-p) + (let ((e (org-element-at-point))) + (when (equal (org-element-property :name e) ref) + (goto-char + (org-element-property :post-affiliated e)) + (pcase (org-element-type e) + (`babel-call + (throw :found + (org-babel-execute-src-block + nil (org-babel-lob-get-info e) params))) + (`src-block + (throw :found + (org-babel-execute-src-block + nil nil + (and + (not org-babel-update-intermediate) + params)))) + ((and (let v (org-babel-read-element e)) + (guard v)) + (throw :found v)) + (_ (error "Reference not found"))))))) + ;; Check for local or global headlines by ID. + (when (org-babel-ref-goto-headline-id ref) + (throw :found (org-babel-ref-headline-body))) + ;; Check the Library of Babel. + (let ((info (cdr (assq (intern ref) + org-babel-library-of-babel)))) + (when info + (throw :found + (org-babel-execute-src-block nil info params)))) + (error "Reference `%s' not found in this buffer" ref)))) + (cond + ((symbolp result) (format "%S" result)) + ((and index (listp result)) + (org-babel-ref-index-list index result)) + (t result))))))))) + +(defun org-babel-ref-index-list (index lis) + "Return the subset of LIS indexed by INDEX. + +Indices are 0 based and negative indices count from the end of +LIS, so 0 references the first element of LIS and -1 references +the last. If INDEX is separated by \",\"s then each \"portion\" +is assumed to index into the next deepest nesting or dimension. + +A valid \"portion\" can consist of either an integer index, two +integers separated by a \":\" in which case the entire range is +returned, or an empty string or \"*\" both of which are +interpreted to mean the entire range and as such are equivalent +to \"0:-1\"." + (if (and (> (length index) 0) (string-match "^\\([^,]*\\),?" index)) + (let* ((ind-re "\\(\\([-[:digit:]]+\\):\\([-[:digit:]]+\\)\\|\\*\\)") + (lgth (length lis)) + (portion (match-string 1 index)) + (remainder (substring index (match-end 0))) + (wrap (lambda (num) (if (< num 0) (+ lgth num) num))) + (open (lambda (ls) (if (and (listp ls) (= (length ls) 1)) (car ls) ls)))) + (funcall + open + (mapcar + (lambda (sub-lis) + (if (listp sub-lis) + (org-babel-ref-index-list remainder sub-lis) + sub-lis)) + (if (or (= 0 (length portion)) (string-match ind-re portion)) + (mapcar + (lambda (n) (nth n lis)) + (apply 'org-number-sequence + (if (and (> (length portion) 0) (match-string 2 portion)) + (list + (funcall wrap (string-to-number (match-string 2 portion))) + (funcall wrap (string-to-number (match-string 3 portion)))) + (list (funcall wrap 0) (funcall wrap -1))))) + (list (nth (funcall wrap (string-to-number portion)) lis)))))) + lis)) + +(defun org-babel-ref-split-args (arg-string) + "Split ARG-STRING into top-level arguments of balanced parenthesis." + (mapcar #'org-trim (org-babel-balanced-split arg-string 44))) + +(provide 'ob-ref) + +;;; ob-ref.el ends here diff --git a/elpa/org-9.5.2/ob-ref.elc b/elpa/org-9.5.2/ob-ref.elc new file mode 100644 index 0000000..87b6d0c Binary files /dev/null and b/elpa/org-9.5.2/ob-ref.elc differ diff --git a/elpa/org-9.5.2/ob-ruby.el b/elpa/org-9.5.2/ob-ruby.el new file mode 100644 index 0000000..b2483f1 --- /dev/null +++ b/elpa/org-9.5.2/ob-ruby.el @@ -0,0 +1,279 @@ +;;; ob-ruby.el --- Babel Functions for Ruby -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating ruby source code. + +;;; Requirements: + +;; - ruby and irb executables :: https://www.ruby-lang.org/ +;; +;; - ruby-mode :: Can be installed through ELPA, or from +;; https://github.com/eschulte/rinari/raw/master/util/ruby-mode.el +;; +;; - inf-ruby mode :: Can be installed through ELPA, or from +;; https://github.com/eschulte/rinari/raw/master/util/inf-ruby.el + +;;; Code: +(require 'ob) +(require 'org-macs) + +(declare-function run-ruby-or-pop-to-buffer "ext:inf-ruby" (command &optional name buffer)) +(declare-function inf-ruby-buffer "ext:inf-ruby" ()) +(declare-function xmp "ext:rcodetools" (&optional option)) + +(defvar inf-ruby-default-implementation) +(defvar inf-ruby-implementations) + +(defvar org-babel-tangle-lang-exts) +(add-to-list 'org-babel-tangle-lang-exts '("ruby" . "rb")) + +(defvar org-babel-default-header-args:ruby '()) + +(defvar org-babel-ruby-command "ruby" + "Name of command to use for executing ruby code. +It's possible to override it by using a header argument `:ruby'") + +(defcustom org-babel-ruby-hline-to "nil" + "Replace hlines in incoming tables with this when translating to ruby." + :group 'org-babel + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-babel-ruby-nil-to 'hline + "Replace nil in ruby tables with this before returning." + :group 'org-babel + :version "24.4" + :package-version '(Org . "8.0") + :type 'symbol) + +(defun org-babel-execute:ruby (body params) + "Execute a block of Ruby code with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((session (org-babel-ruby-initiate-session + (cdr (assq :session params)) params)) + (result-params (cdr (assq :result-params params))) + (result-type (cdr (assq :result-type params))) + (org-babel-ruby-command + (or (cdr (assq :ruby params)) + org-babel-ruby-command)) + (full-body (org-babel-expand-body:generic + body params (org-babel-variable-assignments:ruby params))) + (result (if (member "xmp" result-params) + (with-temp-buffer + (require 'rcodetools) + (insert full-body) + (xmp (cdr (assq :xmp-option params))) + (buffer-string)) + (org-babel-ruby-evaluate + session full-body result-type result-params)))) + (org-babel-reassemble-table + (org-babel-result-cond result-params + result + (org-babel-ruby-table-or-string result)) + (org-babel-pick-name (cdr (assq :colname-names params)) + (cdr (assq :colnames params))) + (org-babel-pick-name (cdr (assq :rowname-names params)) + (cdr (assq :rownames params)))))) + +(defun org-babel-prep-session:ruby (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + ;; (message "params=%S" params) ;; debugging + (let* ((session (org-babel-ruby-initiate-session session)) + (var-lines (org-babel-variable-assignments:ruby params))) + (org-babel-comint-in-buffer session + (sit-for .5) (goto-char (point-max)) + (mapc (lambda (var) + (insert var) (comint-send-input nil t) + (org-babel-comint-wait-for-output session) + (sit-for .1) (goto-char (point-max))) + var-lines)) + session)) + +(defun org-babel-load-session:ruby (session body params) + "Load BODY into SESSION." + (save-window-excursion + (let ((buffer (org-babel-prep-session:ruby session params))) + (with-current-buffer buffer + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert (org-babel-chomp body))) + buffer))) + +;; helper functions + +(defun org-babel-variable-assignments:ruby (params) + "Return list of ruby statements assigning the block's variables." + (mapcar + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-ruby-var-to-ruby (cdr pair)))) + (org-babel--get-vars params))) + +(defun org-babel-ruby-var-to-ruby (var) + "Convert VAR into a ruby variable. +Convert an elisp value into a string of ruby source code +specifying a variable of the same value." + (if (listp var) + (concat "[" (mapconcat #'org-babel-ruby-var-to-ruby var ", ") "]") + (if (eq var 'hline) + org-babel-ruby-hline-to + (format "%S" var)))) + +(defun org-babel-ruby-table-or-string (results) + "Convert RESULTS into an appropriate elisp value. +If RESULTS look like a table, then convert them into an +Emacs-lisp table, otherwise return the results as a string." + (let ((res (org-babel-script-escape results))) + (if (listp res) + (mapcar (lambda (el) (if (not el) + org-babel-ruby-nil-to el)) + res) + res))) + +(defun org-babel-ruby-initiate-session (&optional session params) + "Initiate a ruby session. +If there is not a current inferior-process-buffer in SESSION +then create one. Return the initialized session." + (unless (string= session "none") + (require 'inf-ruby) + (let* ((command (cdr (or (assq :ruby params) + (assoc inf-ruby-default-implementation + inf-ruby-implementations)))) + (buffer (get-buffer (format "*%s*" session))) + (session-buffer (or buffer (save-window-excursion + (run-ruby-or-pop-to-buffer + (if (functionp command) + (funcall command) + command) + (or session "ruby") + (unless session + (inf-ruby-buffer))) + (current-buffer))))) + (if (org-babel-comint-buffer-livep session-buffer) + (progn (sit-for .25) session-buffer) + (sit-for .5) + (org-babel-ruby-initiate-session session))))) + +(defvar org-babel-ruby-eoe-indicator ":org_babel_ruby_eoe" + "String to indicate that evaluation has completed.") +(defvar org-babel-ruby-f-write + "File.open('%s','w'){|f| f.write((_.class == String) ? _ : _.inspect)}") +(defvar org-babel-ruby-pp-f-write + "File.open('%s','w'){|f| $stdout = f; pp(results); $stdout = orig_out}") +(defvar org-babel-ruby-wrapper-method + " +def main() +%s +end +results = main() +File.open('%s', 'w'){ |f| f.write((results.class == String) ? results : results.inspect) } +") +(defvar org-babel-ruby-pp-wrapper-method + " +require 'pp' +def main() +%s +end +results = main() +File.open('%s', 'w') do |f| + $stdout = f + pp results +end +") + +(defun org-babel-ruby-evaluate + (buffer body &optional result-type result-params) + "Pass BODY to the Ruby process in BUFFER. +If RESULT-TYPE equals `output' then return a list of the outputs +of the statements in BODY, if RESULT-TYPE equals `value' then +return the value of the last statement in BODY, as elisp." + (if (not buffer) + ;; external process evaluation + (pcase result-type + (`output (org-babel-eval org-babel-ruby-command body)) + (`value (let ((tmp-file (org-babel-temp-file "ruby-"))) + (org-babel-eval + org-babel-ruby-command + (format (if (member "pp" result-params) + org-babel-ruby-pp-wrapper-method + org-babel-ruby-wrapper-method) + body (org-babel-process-file-name tmp-file 'noquote))) + (org-babel-eval-read-file tmp-file)))) + ;; comint session evaluation + (pcase result-type + (`output + (let ((eoe-string (format "puts \"%s\"" org-babel-ruby-eoe-indicator))) + ;; Force the session to be ready before the actual session + ;; code is run. There is some problem in comint that will + ;; sometimes show the prompt after the input has already + ;; been inserted and that throws off the extraction of the + ;; result for Babel. + (org-babel-comint-with-output + (buffer org-babel-ruby-eoe-indicator t eoe-string) + (insert eoe-string) (comint-send-input nil t)) + ;; Now we can start the evaluation. + (mapconcat + #'identity + (butlast + (split-string + (mapconcat + #'org-trim + (org-babel-comint-with-output + (buffer org-babel-ruby-eoe-indicator t body) + (mapc + (lambda (line) + (insert (org-babel-chomp line)) (comint-send-input nil t)) + (list "conf.echo=false;_org_prompt_mode=conf.prompt_mode;conf.prompt_mode=:NULL" + body + "conf.prompt_mode=_org_prompt_mode;conf.echo=true" + eoe-string))) + "\n") "[\r\n]") 4) "\n"))) + (`value + (let* ((tmp-file (org-babel-temp-file "ruby-")) + (ppp (or (member "code" result-params) + (member "pp" result-params)))) + (org-babel-comint-with-output + (buffer org-babel-ruby-eoe-indicator t body) + (when ppp (insert "require 'pp';") (comint-send-input nil t)) + (mapc + (lambda (line) + (insert (org-babel-chomp line)) (comint-send-input nil t)) + (append + (list body) + (if (not ppp) + (list (format org-babel-ruby-f-write + (org-babel-process-file-name tmp-file 'noquote))) + (list + "results=_" "require 'pp'" "orig_out = $stdout" + (format org-babel-ruby-pp-f-write + (org-babel-process-file-name tmp-file 'noquote)))) + (list org-babel-ruby-eoe-indicator))) + (comint-send-input nil t)) + (org-babel-eval-read-file tmp-file)))))) + +(provide 'ob-ruby) + +;;; ob-ruby.el ends here diff --git a/elpa/org-9.5.2/ob-ruby.elc b/elpa/org-9.5.2/ob-ruby.elc new file mode 100644 index 0000000..0d59e72 Binary files /dev/null and b/elpa/org-9.5.2/ob-ruby.elc differ diff --git a/elpa/org-9.5.2/ob-sass.el b/elpa/org-9.5.2/ob-sass.el new file mode 100644 index 0000000..c8762ca --- /dev/null +++ b/elpa/org-9.5.2/ob-sass.el @@ -0,0 +1,68 @@ +;;; ob-sass.el --- Babel Functions for the Sass CSS generation language -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; For more information on sass see https://sass-lang.com/ +;; +;; This accepts a 'file' header argument which is the target of the +;; compiled sass. The default output type for sass evaluation is +;; either file (if a 'file' header argument was given) or scalar if no +;; such header argument was supplied. +;; +;; A 'cmdline' header argument can be supplied to pass arguments to +;; the sass command line. + +;;; Requirements: + +;; - sass-mode :: https://github.com/nex3/haml/blob/master/extra/sass-mode.el + +;;; Code: +(require 'ob) + +(defvar org-babel-default-header-args:sass '()) + +(defun org-babel-execute:sass (body params) + "Execute a block of Sass code with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((file (cdr (assq :file params))) + (out-file (or file (org-babel-temp-file "sass-out-"))) + (cmdline (cdr (assq :cmdline params))) + (in-file (org-babel-temp-file "sass-in-")) + (cmd (concat "sass " (or cmdline "") + " " (org-babel-process-file-name in-file) + " " (org-babel-process-file-name out-file)))) + (with-temp-file in-file + (insert (org-babel-expand-body:generic body params))) + (org-babel-eval cmd "") + (if file + nil ;; signal that output has already been written to file + (with-temp-buffer (insert-file-contents out-file) (buffer-string))))) + +(defun org-babel-prep-session:sass (_session _params) + "Raise an error because sass does not support sessions." + (error "Sass does not support sessions")) + +(provide 'ob-sass) + +;;; ob-sass.el ends here diff --git a/elpa/org-9.5.2/ob-sass.elc b/elpa/org-9.5.2/ob-sass.elc new file mode 100644 index 0000000..b692287 Binary files /dev/null and b/elpa/org-9.5.2/ob-sass.elc differ diff --git a/elpa/org-9.5.2/ob-scheme.el b/elpa/org-9.5.2/ob-scheme.el new file mode 100644 index 0000000..f4836b2 --- /dev/null +++ b/elpa/org-9.5.2/ob-scheme.el @@ -0,0 +1,241 @@ +;;; ob-scheme.el --- Babel Functions for Scheme -*- lexical-binding: t; -*- + +;; Copyright (C) 2010-2021 Free Software Foundation, Inc. + +;; Authors: Eric Schulte +;; Michael Gauland +;; Keywords: literate programming, reproducible research, scheme +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Now working with SBCL for both session and external evaluation. +;; +;; This certainly isn't optimally robust, but it seems to be working +;; for the basic use cases. + +;;; Requirements: + +;; - a working scheme implementation +;; (e.g. guile https://www.gnu.org/software/guile/guile.html) +;; +;; - for session based evaluation geiser is required, which is available from +;; ELPA. + +;;; Code: +(require 'ob) +(require 'geiser nil t) +(require 'geiser-impl nil t) +(defvar geiser-repl--repl) ; Defined in geiser-repl.el +(defvar geiser-impl--implementation) ; Defined in geiser-impl.el +(defvar geiser-scheme-implementation) ; Defined in geiser-impl.el +(defvar geiser-default-implementation) ; Defined in geiser-impl.el +(defvar geiser-active-implementations) ; Defined in geiser-impl.el +(defvar geiser-debug-show-debug-p) ; Defined in geiser-debug.el +(defvar geiser-debug-jump-to-debug-p) ; Defined in geiser-debug.el +(defvar geiser-repl-use-other-window) ; Defined in geiser-repl.el +(defvar geiser-repl-window-allow-split) ; Defined in geiser-repl.el + +(declare-function run-geiser "ext:geiser-repl" (impl)) +(declare-function geiser-mode "ext:geiser-mode" ()) +(declare-function geiser-eval-region "ext:geiser-mode" + (start end &optional and-go raw nomsg)) +(declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg)) +(declare-function geiser-eval--retort-output "ext:geiser-eval" (ret)) +(declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix)) + +(defcustom org-babel-scheme-null-to 'hline + "Replace `null' and empty lists in scheme tables with this before returning." + :group 'org-babel + :version "26.1" + :package-version '(Org . "9.1") + :type 'symbol) + +(defvar org-babel-default-header-args:scheme '() + "Default header arguments for scheme code blocks.") + +(defun org-babel-expand-body:scheme (body params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (org-babel--get-vars params)) + (prepends (cdr (assq :prologue params))) + (postpends (cdr (assq :epilogue params)))) + (concat (and prepends (concat prepends "\n")) + (if (null vars) body + (format "(let (%s)\n%s\n)" + (mapconcat + (lambda (var) + (format "%S" (print `(,(car var) ',(cdr var))))) + vars + "\n ") + body)) + (and postpends (concat "\n" postpends))))) + + +(defvar org-babel-scheme-repl-map (make-hash-table :test #'equal) + "Map of scheme sessions to session names.") + +(defun org-babel-scheme-cleanse-repl-map () + "Remove dead buffers from the REPL map." + (maphash + (lambda (x y) (unless (buffer-name y) (remhash x org-babel-scheme-repl-map))) + org-babel-scheme-repl-map)) + +(defun org-babel-scheme-get-session-buffer (session-name) + "Look up the scheme buffer for a session; return nil if it doesn't exist." + (org-babel-scheme-cleanse-repl-map) ; Prune dead sessions + (gethash session-name org-babel-scheme-repl-map)) + +(defun org-babel-scheme-set-session-buffer (session-name buffer) + "Record the scheme buffer used for a given session." + (puthash session-name buffer org-babel-scheme-repl-map)) + +(defun org-babel-scheme-get-buffer-impl (buffer) + "Return the scheme implementation geiser associates with the buffer." + (with-current-buffer (set-buffer buffer) + geiser-impl--implementation)) + +(defun org-babel-scheme-get-repl (impl name) + "Switch to a scheme REPL, creating it if it doesn't exist." + (let ((buffer (org-babel-scheme-get-session-buffer name))) + (or buffer + (progn + (run-geiser impl) + (when name + (rename-buffer name t) + (org-babel-scheme-set-session-buffer name (current-buffer))) + (current-buffer))))) + +(defun org-babel-scheme-make-session-name (buffer name impl) + "Generate a name for the session buffer. + +For a named session, the buffer name will be the session name. + +If the session is unnamed (nil), generate a name. + +If the session is `none', use nil for the session name, and +org-babel-scheme-execute-with-geiser will use a temporary session." + (cond ((not name) (concat buffer " " (symbol-name impl) " REPL")) + ((string= name "none") nil) + (name))) + +(defmacro org-babel-scheme-capture-current-message (&rest body) + "Capture current message in both interactive and noninteractive mode." + `(if noninteractive + (let ((original-message (symbol-function 'message)) + (current-message nil)) + (unwind-protect + (progn + (defun message (&rest args) + (setq current-message (apply original-message args))) + ,@body + current-message) + (fset 'message original-message))) + (progn + ,@body + (current-message)))) + +(defun org-babel-scheme-execute-with-geiser (code output impl repl) + "Execute code in specified REPL. +If the REPL doesn't exist, create it using the given scheme +implementation. + +Returns the output of executing the code if the OUTPUT parameter +is true; otherwise returns the last value." + (let ((result nil)) + (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)))) + (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)) + (let ((ret (geiser-eval-region (point-min) (point-max)))) + (setq result (if output + (or (geiser-eval--retort-output ret) + "Geiser Interpreter produced no output") + (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))))) + result)) + +(defun org-babel-scheme--table-or-string (results) + "Convert RESULTS into an appropriate elisp value. +If the results look like a list or tuple, then convert them into an +Emacs-lisp table, otherwise return the results as a string." + (let ((res (org-babel-script-escape results))) + (cond ((listp res) + (mapcar (lambda (el) + (if (or (null el) (eq el 'null)) + org-babel-scheme-null-to + el)) + res)) + (t res)))) + +(defun org-babel-execute:scheme (body params) + "Execute a block of Scheme code with org-babel. +This function is called by `org-babel-execute-src-block'." + (let* ((source-buffer (current-buffer)) + (source-buffer-name (replace-regexp-in-string ;; zap surrounding * + "^ ?\\*\\([^*]+\\)\\*" "\\1" + (buffer-name source-buffer)))) + (save-excursion + (let* ((result-type (cdr (assq :result-type params))) + (impl (or (when (cdr (assq :scheme params)) + (intern (cdr (assq :scheme params)))) + geiser-scheme-implementation + geiser-default-implementation + (car geiser-active-implementations))) + (session (org-babel-scheme-make-session-name + source-buffer-name (cdr (assq :session params)) impl)) + (full-body (org-babel-expand-body:scheme body params)) + (result-params (cdr (assq :result-params params))) + (result + (org-babel-scheme-execute-with-geiser + full-body ; code + (string= result-type "output") ; output? + impl ; implementation + (and (not (string= session "none")) session)))) ; session + (let ((table + (org-babel-reassemble-table + result + (org-babel-pick-name (cdr (assq :colname-names params)) + (cdr (assq :colnames params))) + (org-babel-pick-name (cdr (assq :rowname-names params)) + (cdr (assq :rownames params)))))) + (org-babel-result-cond result-params + result + (org-babel-scheme--table-or-string table))))))) + +(provide 'ob-scheme) + +;;; ob-scheme.el ends here diff --git a/elpa/org-9.5.2/ob-scheme.elc b/elpa/org-9.5.2/ob-scheme.elc new file mode 100644 index 0000000..f2ad77b Binary files /dev/null and b/elpa/org-9.5.2/ob-scheme.elc differ diff --git a/elpa/org-9.5.2/ob-screen.el b/elpa/org-9.5.2/ob-screen.el new file mode 100644 index 0000000..7793825 --- /dev/null +++ b/elpa/org-9.5.2/ob-screen.el @@ -0,0 +1,143 @@ +;;; ob-screen.el --- Babel Support for Interactive Terminal -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: Benjamin Andresen +;; Maintainer: Ken Mankoff +;; Keywords: literate programming, interactive shell +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for interactive terminals. Mostly shell scripts. +;; Heavily inspired by 'eev' from Eduardo Ochs +;; +;; Adding :cmd and :terminal as header arguments +;; :terminal must support the -T (title) and -e (command) parameter +;; +;; You can test the default setup (xterm + sh) with +;; M-x org-babel-screen-test RET + +;;; Code: +(require 'ob) + +(defvar org-babel-screen-location "screen" + "The command location for screen. +In case you want to use a different screen than one selected by your $PATH") + +(defvar org-babel-default-header-args:screen + `((:results . "silent") (:session . "default") (:cmd . "sh") + (:terminal . "xterm") (:screenrc . ,null-device)) + "Default arguments to use when running screen source blocks.") + +(defun org-babel-execute:screen (body params) + "Send a block of code via screen to a terminal using Babel. +\"default\" session is used when none is specified." + (message "Sending source code block to interactive terminal session...") + (save-window-excursion + (let* ((session (cdr (assq :session params))) + (socket (org-babel-screen-session-socketname session))) + (unless socket (org-babel-prep-session:screen session params)) + (org-babel-screen-session-execute-string + session (org-babel-expand-body:generic body params))))) + +(defun org-babel-prep-session:screen (_session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + (let* ((session (cdr (assq :session params))) + (cmd (cdr (assq :cmd params))) + (terminal (cdr (assq :terminal params))) + (screenrc (cdr (assq :screenrc params))) + (process-name (concat "org-babel: terminal (" session ")"))) + (apply 'start-process process-name "*Messages*" + terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location + "-c" ,screenrc "-mS" ,session ,cmd)) + ;; XXX: Is there a better way than the following? + (while (not (org-babel-screen-session-socketname session)) + ;; wait until screen session is available before returning + ))) + +;; helper functions + +(defun org-babel-screen-session-execute-string (session body) + "If SESSION exists, send BODY to it." + (let ((socket (org-babel-screen-session-socketname session))) + (when socket + (let ((tmpfile (org-babel-screen-session-write-temp-file session body))) + (apply 'start-process (concat "org-babel: screen (" session ")") "*Messages*" + org-babel-screen-location + `("-S" ,socket "-X" "eval" "msgwait 0" + ,(concat "readreg z " tmpfile) + "paste z")))))) + +(defun org-babel-screen-session-socketname (session) + "Check if SESSION exists by parsing output of \"screen -ls\"." + (let* ((screen-ls (shell-command-to-string "screen -ls")) + (sockets (delq + nil + (mapcar + (lambda (x) + (when (string-match (rx (or "(Attached)" "(Detached)")) x) + x)) + (split-string screen-ls "\n")))) + (match-socket (car + (delq + nil + (mapcar + (lambda (x) + (and (string-match-p (regexp-quote session) x) + x)) + sockets))))) + (when match-socket (car (split-string match-socket))))) + +(defun org-babel-screen-session-write-temp-file (_session body) + "Save BODY in a temp file that is named after SESSION." + (let ((tmpfile (org-babel-temp-file "screen-"))) + (with-temp-file tmpfile + (insert body) + (insert "\n") + + ;; org-babel has superfluous spaces + (goto-char (point-min)) + (delete-matching-lines "^ +$")) + tmpfile)) + +(defun org-babel-screen-test () + "Test if the default setup works. +The terminal should shortly flicker." + (interactive) + (let* ((random-string (format "%s" (random 99999))) + (tmpfile (org-babel-temp-file "ob-screen-test-")) + (body (concat "echo '" random-string "' > " tmpfile "\nexit\n")) + tmp-string) + (org-babel-execute:screen body org-babel-default-header-args:screen) + ;; XXX: need to find a better way to do the following + (while (not (file-readable-p tmpfile)) + ;; do something, otherwise this will be optimized away + (message "org-babel-screen: File not readable yet.")) + (setq tmp-string (with-temp-buffer + (insert-file-contents-literally tmpfile) + (buffer-substring (point-min) (point-max)))) + (delete-file tmpfile) + (message (concat "org-babel-screen: Setup " + (if (string-match random-string tmp-string) + "WORKS." + "DOESN'T work."))))) + +(provide 'ob-screen) + +;;; ob-screen.el ends here diff --git a/elpa/org-9.5.2/ob-screen.elc b/elpa/org-9.5.2/ob-screen.elc new file mode 100644 index 0000000..9a6bcf7 Binary files /dev/null and b/elpa/org-9.5.2/ob-screen.elc differ diff --git a/elpa/org-9.5.2/ob-sed.el b/elpa/org-9.5.2/ob-sed.el new file mode 100644 index 0000000..4d3eeee --- /dev/null +++ b/elpa/org-9.5.2/ob-sed.el @@ -0,0 +1,106 @@ +;;; ob-sed.el --- Babel Functions for Sed Scripts -*- lexical-binding: t; -*- + +;; Copyright (C) 2015-2021 Free Software Foundation, Inc. + +;; Author: Bjarte Johansen +;; Keywords: literate programming, reproducible research + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Provides a way to evaluate sed scripts in Org mode. + +;;; Usage: + +;; Add to your Emacs config: + +;; (org-babel-do-load-languages +;; 'org-babel-load-languages +;; '((sed . t))) + +;; In addition to the normal header arguments, ob-sed also provides +;; :cmd-line and :in-file. :cmd-line allows one to pass other flags to +;; the sed command like the "--in-place" flag which makes sed edit the +;; file pass to it instead of outputting to standard out or to a +;; different file. :in-file is a header arguments that allows one to +;; tell Org Babel which file the sed script to act on. + +;;; Code: +(require 'ob) + +(defvar org-babel-sed-command "sed" + "Name of the sed executable command.") + +(defvar org-babel-tangle-lang-exts) +(add-to-list 'org-babel-tangle-lang-exts '("sed" . "sed")) + +(defconst org-babel-header-args:sed + '((:cmd-line . :any) + (:in-file . :any)) + "Sed specific header arguments.") + +(defvar org-babel-default-header-args:sed '() + "Default arguments for evaluating a sed source block.") + +(defun org-babel-execute:sed (body params) + "Execute a block of sed code with Org Babel. +BODY is the source inside a sed source block and PARAMS is an +association list over the source block configurations. This +function is called by `org-babel-execute-src-block'." + (message "executing sed source code block") + (let* ((result-params (cdr (assq :result-params params))) + (cmd-line (cdr (assq :cmd-line params))) + (in-file (cdr (assq :in-file params))) + (code-file (let ((file (org-babel-temp-file "sed-"))) + (with-temp-file file + (insert body)) + file)) + (stdin (let ((stdin (cdr (assq :stdin params)))) + (when stdin + (let ((tmp (org-babel-temp-file "sed-stdin-")) + (res (org-babel-ref-resolve stdin))) + (with-temp-file tmp + (insert res)) + tmp)))) + (cmd (mapconcat #'identity + (remq nil + (list org-babel-sed-command + (format "-f \"%s\"" code-file) + cmd-line + in-file)) + " "))) + (org-babel-reassemble-table + (let ((results + (cond + (stdin (with-temp-buffer + (call-process-shell-command cmd stdin (current-buffer)) + (buffer-string))) + (t (org-babel-eval cmd ""))))) + (when results + (org-babel-result-cond result-params + results + (let ((tmp (org-babel-temp-file "sed-results-"))) + (with-temp-file tmp (insert results)) + (org-babel-import-elisp-from-file tmp))))) + (org-babel-pick-name + (cdr (assq :colname-names params)) (cdr (assq :colnames params))) + (org-babel-pick-name + (cdr (assq :rowname-names params)) (cdr (assq :rownames params)))))) + +(provide 'ob-sed) + +;;; ob-sed.el ends here diff --git a/elpa/org-9.5.2/ob-sed.elc b/elpa/org-9.5.2/ob-sed.elc new file mode 100644 index 0000000..f4e8abb Binary files /dev/null and b/elpa/org-9.5.2/ob-sed.elc differ diff --git a/elpa/org-9.5.2/ob-shell.el b/elpa/org-9.5.2/ob-shell.el new file mode 100644 index 0000000..3eed0c1 --- /dev/null +++ b/elpa/org-9.5.2/ob-shell.el @@ -0,0 +1,309 @@ +;;; ob-shell.el --- Babel Functions for Shell Evaluation -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating shell source code. + +;;; Code: +(require 'ob) +(require 'org-macs) +(require 'shell) +(require 'cl-lib) + +(declare-function org-babel-comint-in-buffer "ob-comint" (buffer &rest body) + t) +(declare-function org-babel-comint-wait-for-output "ob-comint" (buffer)) +(declare-function org-babel-comint-buffer-livep "ob-comint" (buffer)) +(declare-function org-babel-comint-with-output "ob-comint" (meta &rest body) + t) +(declare-function orgtbl-to-generic "org-table" (table params)) + +(defvar org-babel-default-header-args:shell '()) +(defvar org-babel-shell-names) + +(defun org-babel-shell-initialize () + "Define execution functions associated to shell names. +This function has to be called whenever `org-babel-shell-names' +is modified outside the Customize interface." + (interactive) + (dolist (name org-babel-shell-names) + (eval `(defun ,(intern (concat "org-babel-execute:" name)) + (body params) + ,(format "Execute a block of %s commands with Babel." name) + (let ((shell-file-name ,name)) + (org-babel-execute:shell body params)))) + (eval `(defalias ',(intern (concat "org-babel-variable-assignments:" name)) + 'org-babel-variable-assignments:shell + ,(format "Return list of %s statements assigning to the block's \ +variables." + name))) + (eval `(defvar ,(intern (concat "org-babel-default-header-args:" name)) '())))) + +(defcustom org-babel-shell-names + '("sh" "bash" "zsh" "fish" "csh" "ash" "dash" "ksh" "mksh" "posh") + "List of names of shell supported by babel shell code blocks. +Call `org-babel-shell-initialize' when modifying this variable +outside the Customize interface." + :group 'org-babel + :type '(repeat (string :tag "Shell name: ")) + :set (lambda (symbol value) + (set-default symbol value) + (org-babel-shell-initialize))) + +(defcustom org-babel-shell-results-defaults-to-output t + "Let shell execution defaults to \":results output\". + +When set to t, use \":results output\" when no :results setting +is set. This is especially useful for inline source blocks. + +When set to nil, stick to the convention of using :results value +as the default setting when no :results is set, the \"value\" of +a shell execution being its exit code." + :group 'org-babel + :type 'boolean + :package-version '(Org . "9.4")) + +(defun org-babel-execute:shell (body params) + "Execute a block of Shell commands with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((session (org-babel-sh-initiate-session + (cdr (assq :session params)))) + (stdin (let ((stdin (cdr (assq :stdin params)))) + (when stdin (org-babel-sh-var-to-string + (org-babel-ref-resolve stdin))))) + (results-params (cdr (assq :result-params params))) + (value-is-exit-status + (or (and + (equal '("replace") results-params) + (not org-babel-shell-results-defaults-to-output)) + (member "value" results-params))) + (cmdline (cdr (assq :cmdline params))) + (full-body (concat + (org-babel-expand-body:generic + body params (org-babel-variable-assignments:shell params)) + (when value-is-exit-status "\necho $?")))) + (org-babel-reassemble-table + (org-babel-sh-evaluate session full-body params stdin cmdline) + (org-babel-pick-name + (cdr (assq :colname-names params)) (cdr (assq :colnames params))) + (org-babel-pick-name + (cdr (assq :rowname-names params)) (cdr (assq :rownames params)))))) + +(defun org-babel-prep-session:shell (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + (let* ((session (org-babel-sh-initiate-session session)) + (var-lines (org-babel-variable-assignments:shell params))) + (org-babel-comint-in-buffer session + (mapc (lambda (var) + (insert var) (comint-send-input nil t) + (org-babel-comint-wait-for-output session)) + var-lines)) + session)) + +(defun org-babel-load-session:shell (session body params) + "Load BODY into SESSION." + (save-window-excursion + (let ((buffer (org-babel-prep-session:shell session params))) + (with-current-buffer buffer + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert (org-babel-chomp body))) + buffer))) + + +;;; Helper functions +(defun org-babel--variable-assignments:sh-generic + (varname values &optional sep hline) + "Return a list of statements declaring the values as a generic variable." + (format "%s=%s" varname (org-babel-sh-var-to-sh values sep hline))) + +(defun org-babel--variable-assignments:bash_array + (varname values &optional sep hline) + "Return a list of statements declaring the values as a bash array." + (format "unset %s\ndeclare -a %s=( %s )" + varname varname + (mapconcat + (lambda (value) (org-babel-sh-var-to-sh value sep hline)) + values + " "))) + +(defun org-babel--variable-assignments:bash_assoc + (varname values &optional sep hline) + "Return a list of statements declaring the values as bash associative array." + (format "unset %s\ndeclare -A %s\n%s" + varname varname + (mapconcat + (lambda (items) + (format "%s[%s]=%s" + varname + (org-babel-sh-var-to-sh (car items) sep hline) + (org-babel-sh-var-to-sh (cdr items) sep hline))) + values + "\n"))) + +(defun org-babel--variable-assignments:bash (varname values &optional sep hline) + "Represent the parameters as useful Bash shell variables." + (pcase values + (`((,_ ,_ . ,_) . ,_) ;two-dimensional array + (org-babel--variable-assignments:bash_assoc varname values sep hline)) + (`(,_ . ,_) ;simple list + (org-babel--variable-assignments:bash_array varname values sep hline)) + (_ ;scalar value + (org-babel--variable-assignments:sh-generic varname values sep hline)))) + +(defun org-babel-variable-assignments:shell (params) + "Return list of shell statements assigning the block's variables." + (let ((sep (cdr (assq :separator params))) + (hline (when (string= "yes" (cdr (assq :hlines params))) + (or (cdr (assq :hline-string params)) + "hline")))) + (mapcar + (lambda (pair) + (if (string-suffix-p "bash" shell-file-name) + (org-babel--variable-assignments:bash + (car pair) (cdr pair) sep hline) + (org-babel--variable-assignments:sh-generic + (car pair) (cdr pair) sep hline))) + (org-babel--get-vars params)))) + +(defun org-babel-sh-var-to-sh (var &optional sep hline) + "Convert an elisp value to a shell variable. +Convert an elisp var into a string of shell commands specifying a +var of the same value." + (concat "'" (replace-regexp-in-string + "'" "'\"'\"'" + (org-babel-sh-var-to-string var sep hline)) + "'")) + +(defun org-babel-sh-var-to-string (var &optional sep hline) + "Convert an elisp value to a string." + (let ((echo-var (lambda (v) (if (stringp v) v (format "%S" v))))) + (cond + ((and (listp var) (or (listp (car var)) (eq (car var) 'hline))) + (orgtbl-to-generic var (list :sep (or sep "\t") :fmt echo-var + :hline hline))) + ((listp var) + (mapconcat echo-var var "\n")) + (t (funcall echo-var var))))) + +(defun org-babel-sh-initiate-session (&optional session _params) + "Initiate a session named SESSION according to PARAMS." + (when (and session (not (string= session "none"))) + (save-window-excursion + (or (org-babel-comint-buffer-livep session) + (progn + (shell session) + ;; Needed for Emacs 23 since the marker is initially + ;; undefined and the filter functions try to use it without + ;; checking. + (set-marker comint-last-output-start (point)) + (get-buffer (current-buffer))))))) + +(defvar org-babel-sh-eoe-indicator "echo 'org_babel_sh_eoe'" + "String to indicate that evaluation has completed.") +(defvar org-babel-sh-eoe-output "org_babel_sh_eoe" + "String to indicate that evaluation has completed.") + +(defun org-babel-sh-evaluate (session body &optional params stdin cmdline) + "Pass BODY to the Shell process in BUFFER. +If RESULT-TYPE equals `output' then return a list of the outputs +of the statements in BODY, if RESULT-TYPE equals `value' then +return the value of the last statement in BODY." + (let* ((shebang (cdr (assq :shebang params))) + (results-params (cdr (assq :result-params params))) + (value-is-exit-status + (or (and + (equal '("replace") results-params) + (not org-babel-shell-results-defaults-to-output)) + (member "value" results-params))) + (results + (cond + ((or stdin cmdline) ; external shell script w/STDIN + (let ((script-file (org-babel-temp-file "sh-script-")) + (stdin-file (org-babel-temp-file "sh-stdin-")) + (padline (not (string= "no" (cdr (assq :padline params)))))) + (with-temp-file script-file + (when shebang (insert shebang "\n")) + (when padline (insert "\n")) + (insert body)) + (set-file-modes script-file #o755) + (with-temp-file stdin-file (insert (or stdin ""))) + (with-temp-buffer + (call-process-shell-command + (concat (if shebang script-file + (format "%s %s" shell-file-name script-file)) + (and cmdline (concat " " cmdline))) + stdin-file + (current-buffer)) + (buffer-string)))) + (session ; session evaluation + (mapconcat + #'org-babel-sh-strip-weird-long-prompt + (mapcar + #'org-trim + (butlast + (org-babel-comint-with-output + (session org-babel-sh-eoe-output t body) + (dolist (line (append (split-string (org-trim body) "\n") + (list org-babel-sh-eoe-indicator))) + (insert line) + (comint-send-input nil t) + (while (save-excursion + (goto-char comint-last-input-end) + (not (re-search-forward + comint-prompt-regexp nil t))) + (accept-process-output + (get-buffer-process (current-buffer)))))) + 2)) + "\n")) + ;; External shell script, with or without a predefined + ;; shebang. + ((org-string-nw-p shebang) + (let ((script-file (org-babel-temp-file "sh-script-")) + (padline (not (equal "no" (cdr (assq :padline params)))))) + (with-temp-file script-file + (insert shebang "\n") + (when padline (insert "\n")) + (insert body)) + (set-file-modes script-file #o755) + (org-babel-eval script-file ""))) + (t (org-babel-eval shell-file-name (org-trim body)))))) + (when value-is-exit-status + (setq results (car (reverse (split-string results "\n" t))))) + (when results + (let ((result-params (cdr (assq :result-params params)))) + (org-babel-result-cond result-params + results + (let ((tmp-file (org-babel-temp-file "sh-"))) + (with-temp-file tmp-file (insert results)) + (org-babel-import-elisp-from-file tmp-file))))))) + +(defun org-babel-sh-strip-weird-long-prompt (string) + "Remove prompt cruft from a string of shell output." + (while (string-match "^% +[\r\n$]+ *" string) + (setq string (substring string (match-end 0)))) + string) + +(provide 'ob-shell) + +;;; ob-shell.el ends here diff --git a/elpa/org-9.5.2/ob-shell.elc b/elpa/org-9.5.2/ob-shell.elc new file mode 100644 index 0000000..f3a59fe Binary files /dev/null and b/elpa/org-9.5.2/ob-shell.elc differ diff --git a/elpa/org-9.5.2/ob-sql.el b/elpa/org-9.5.2/ob-sql.el new file mode 100644 index 0000000..f512d29 --- /dev/null +++ b/elpa/org-9.5.2/ob-sql.el @@ -0,0 +1,421 @@ +;;; ob-sql.el --- Babel Functions for SQL -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating sql source code. +;; (see also ob-sqlite.el) +;; +;; SQL is somewhat unique in that there are many different engines for +;; the evaluation of sql (Mysql, PostgreSQL, etc...), so much of this +;; file will have to be implemented engine by engine. +;; +;; Also SQL evaluation generally takes place inside of a database. +;; +;; Header args used: +;; - engine +;; - cmdline +;; - dbhost +;; - dbport +;; - dbuser +;; - dbpassword +;; - dbconnection (to reference connections in sql-connection-alist) +;; - dbinstance (currently only used by SAP HANA) +;; - database +;; - colnames (default, nil, means "yes") +;; - result-params +;; - out-file +;; +;; The following are used but not really implemented for SQL: +;; - colname-names +;; - rownames +;; - rowname-names +;; +;; Engines supported: +;; - mysql +;; - dbi +;; - mssql +;; - sqsh +;; - postgresql (postgres) +;; - oracle +;; - vertica +;; - saphana +;; +;; TODO: +;; +;; - support for sessions +;; - support for more engines +;; - what's a reasonable way to drop table data into SQL? +;; + +;;; Code: +(require 'ob) + +(declare-function org-table-import "org-table" (file arg)) +(declare-function orgtbl-to-csv "org-table" (table params)) +(declare-function org-table-to-lisp "org-table" (&optional txt)) +(declare-function cygwin-convert-file-name-to-windows "cygw32.c" (file &optional absolute-p)) +(declare-function sql-set-product "sql" (product)) + +(defvar sql-connection-alist) +(defvar org-babel-default-header-args:sql '()) + +(defconst org-babel-header-args:sql + '((engine . :any) + (out-file . :any) + (dbhost . :any) + (dbport . :any) + (dbuser . :any) + (dbpassword . :any) + (dbinstance . :any) + (database . :any)) + "SQL-specific header arguments.") + +(defun org-babel-expand-body:sql (body params) + "Expand BODY according to the values of PARAMS." + (let ((prologue (cdr (assq :prologue params))) + (epilogue (cdr (assq :epilogue params)))) + (mapconcat 'identity + (list + prologue + (org-babel-sql-expand-vars + body (org-babel--get-vars params)) + epilogue) + "\n"))) + +(defun org-babel-edit-prep:sql (info) + "Set `sql-product' in Org edit buffer. +Set `sql-product' in Org edit buffer according to the +corresponding :engine source block header argument." + (let ((product (cdr (assq :engine (nth 2 info))))) + (condition-case nil + (sql-set-product product) + (user-error "Cannot set `sql-product' in Org Src edit buffer")))) + +(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 + (delq nil + (list (when host (concat "-h" host)) + (when port (format "-P%d" port)) + (when user (concat "-u" user)) + (when password (concat "-p" password)) + (when database (concat "-D" 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 + (delq nil + (list (when host (concat "-h" host)) + (when port (format "-p%d" port)) + (when user (concat "-U" user)) + (when database (concat "-d" database)))))) + +(defun org-babel-sql-dbstring-oracle (host port user password database) + "Make Oracle command line arguments for database connection. + +If HOST and PORT are nil then don't pass them. This allows you +to use names defined in your \"TNSNAMES\" file. So you can +connect with + + /@:/ + +or + + /@ + +using its alias." + (cond ((and user password database host port) + (format "%s/%s@%s:%s/%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")))) + +(defun org-babel-sql-dbstring-mssql (host user password database) + "Make sqlcmd command line args for database connection. +`sqlcmd' is the preferred command line tool to access Microsoft +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)))) + " ")) + +(defun org-babel-sql-dbstring-sqsh (host user password database) + "Make sqsh command line args for database connection. +\"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)))) + " ")) + +(defun org-babel-sql-dbstring-vertica (host port user password database) + "Make Vertica command line args for database connection. +Pass nil to omit that arg." + (mapconcat #'identity + (delq nil + (list (when host (format "-h %s" host)) + (when port (format "-p %d" port)) + (when user (format "-U %s" user)) + (when password (format "-w %s" (shell-quote-argument password) )) + (when database (format "-d %s" database)))) + " ")) + +(defun org-babel-sql-dbstring-saphana (host port instance user password database) + "Make SAP HANA command line args for database connection. +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)) + (and instance (format "-i %d" instance)) + (and user (format "-u %s" user)) + (and password (format "-p %s" + (shell-quote-argument password))) + (and database (format "-d %s" database)))) + " ")) + +(defun org-babel-sql-convert-standard-filename (file) + "Convert FILE to OS standard file name. +If in Cygwin environment, uses Cygwin specific function to +convert the file name. In a Windows-NT environment, do nothing. +Otherwise, use Emacs' standard conversion function." + (cond ((fboundp 'cygwin-convert-file-name-to-windows) + (format "%S" (cygwin-convert-file-name-to-windows file))) + ((string= "windows-nt" system-type) file) + (t (format "%S" (convert-standard-filename file))))) + +(defun org-babel-find-db-connection-param (params name) + "Return database connection parameter NAME. +Given a parameter NAME, if :dbconnection is defined in PARAMS +then look for the parameter into the corresponding connection +defined in `sql-connection-alist', otherwise look into PARAMS. +See `sql-connection-alist' (part of SQL mode) for how to define +database connections." + (if (assq :dbconnection params) + (let* ((dbconnection (cdr (assq :dbconnection params))) + (name-mapping '((:dbhost . sql-server) + (:dbport . sql-port) + (:dbuser . sql-user) + (:dbpassword . sql-password) + (:dbinstance . sql-dbinstance) + (:database . sql-database))) + (mapped-name (cdr (assq name name-mapping)))) + (cadr (assq mapped-name + (cdr (assoc dbconnection sql-connection-alist))))) + (cdr (assq name params)))) + +(defun org-babel-execute:sql (body params) + "Execute a block of Sql code with Babel. +This function is called by `org-babel-execute-src-block'." + (let* ((result-params (cdr (assq :result-params params))) + (cmdline (cdr (assq :cmdline params))) + (dbhost (org-babel-find-db-connection-param params :dbhost)) + (dbport (org-babel-find-db-connection-param params :dbport)) + (dbuser (org-babel-find-db-connection-param params :dbuser)) + (dbpassword (org-babel-find-db-connection-param params :dbpassword)) + (dbinstance (org-babel-find-db-connection-param params :dbinstance)) + (database (org-babel-find-db-connection-param params :database)) + (engine (cdr (assq :engine params))) + (colnames-p (not (equal "no" (cdr (assq :colnames params))))) + (in-file (org-babel-temp-file "sql-in-")) + (out-file (or (cdr (assq :out-file params)) + (org-babel-temp-file "sql-out-"))) + (header-delim "") + (command (cl-case (intern engine) + (dbi (format "dbish --batch %s < %s | sed '%s' > %s" + (or cmdline "") + (org-babel-process-file-name in-file) + "/^+/d;s/^|//;s/(NULL)/ /g;$d" + (org-babel-process-file-name out-file))) + (monetdb (format "mclient -f tab %s < %s > %s" + (or cmdline "") + (org-babel-process-file-name in-file) + (org-babel-process-file-name out-file))) + (mssql (format "sqlcmd %s -s \"\t\" %s -i %s -o %s" + (or cmdline "") + (org-babel-sql-dbstring-mssql + dbhost dbuser dbpassword database) + (org-babel-sql-convert-standard-filename + (org-babel-process-file-name in-file)) + (org-babel-sql-convert-standard-filename + (org-babel-process-file-name out-file)))) + (mysql (format "mysql %s %s %s < %s > %s" + (org-babel-sql-dbstring-mysql + dbhost dbport dbuser dbpassword database) + (if colnames-p "" "-N") + (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 \ +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 ""))) + (sqsh (format "sqsh %s %s -i %s -o %s -m csv" + (or cmdline "") + (org-babel-sql-dbstring-sqsh + dbhost dbuser dbpassword database) + (org-babel-sql-convert-standard-filename + (org-babel-process-file-name in-file)) + (org-babel-sql-convert-standard-filename + (org-babel-process-file-name out-file)))) + (vertica (format "vsql %s -f %s -o %s %s" + (org-babel-sql-dbstring-vertica + dbhost dbport dbuser dbpassword database) + (org-babel-process-file-name in-file) + (org-babel-process-file-name out-file) + (or cmdline ""))) + (oracle (format + "sqlplus -s %s < %s > %s" + (org-babel-sql-dbstring-oracle + dbhost dbport dbuser dbpassword database) + (org-babel-process-file-name in-file) + (org-babel-process-file-name out-file))) + (saphana (format "hdbsql %s -I %s -o %s %s" + (org-babel-sql-dbstring-saphana + dbhost dbport dbinstance dbuser dbpassword database) + (org-babel-process-file-name in-file) + (org-babel-process-file-name out-file) + (or cmdline ""))) + (t (user-error "No support for the %s SQL engine" engine))))) + (with-temp-file in-file + (insert + (pcase (intern engine) + (`dbi "/format partbox\n") + (`oracle "SET PAGESIZE 50000 +SET NEWPAGE 0 +SET TAB OFF +SET SPACE 0 +SET LINESIZE 9999 +SET TRIMOUT ON TRIMSPOOL ON +SET ECHO OFF +SET FEEDBACK OFF +SET VERIFY OFF +SET HEADING ON +SET MARKUP HTML OFF SPOOL OFF +SET COLSEP '|' + +") + ((or `mssql `sqsh) "SET NOCOUNT ON + +") + (`vertica "\\a\n") + (_ "")) + (org-babel-expand-body:sql body params) + ;; "sqsh" requires "go" inserted at EOF. + (if (string= engine "sqsh") "\ngo" ""))) + (org-babel-eval command "") + (org-babel-result-cond result-params + (with-temp-buffer + (progn (insert-file-contents-literally out-file) (buffer-string))) + (with-temp-buffer + (cond + ((memq (intern engine) '(dbi mysql postgresql postgres saphana sqsh vertica)) + ;; Add header row delimiter after column-names header in first line + (cond + (colnames-p + (with-temp-buffer + (insert-file-contents out-file) + (goto-char (point-min)) + (forward-line 1) + (insert "-\n") + (setq header-delim "-") + (write-file out-file))))) + (t + ;; Need to figure out the delimiter for the header row + (with-temp-buffer + (insert-file-contents out-file) + (goto-char (point-min)) + (when (re-search-forward "^\\(-+\\)[^-]" nil t) + (setq header-delim (match-string-no-properties 1))) + (goto-char (point-max)) + (forward-char -1) + (while (looking-at "\n") + (delete-char 1) + (goto-char (point-max)) + (forward-char -1)) + (write-file out-file)))) + (org-table-import out-file (if (string= engine "sqsh") '(4) '(16))) + (org-babel-reassemble-table + (mapcar (lambda (x) + (if (string= (car x) header-delim) + 'hline + x)) + (org-table-to-lisp)) + (org-babel-pick-name (cdr (assq :colname-names params)) + (cdr (assq :colnames params))) + (org-babel-pick-name (cdr (assq :rowname-names params)) + (cdr (assq :rownames params)))))))) + +(defun org-babel-sql-expand-vars (body vars &optional sqlite) + "Expand the variables held in VARS in BODY. + +If SQLITE has been provided, prevent passing a format to +`orgtbl-to-csv'. This prevents overriding the default format, which if +there were commas in the context of the table broke the table as an +argument mechanism." + (mapc + (lambda (pair) + (setq body + (replace-regexp-in-string + (format "$%s" (car pair)) + (let ((val (cdr pair))) + (if (listp val) + (let ((data-file (org-babel-temp-file "sql-data-"))) + (with-temp-file data-file + (insert (orgtbl-to-csv + val (if sqlite + nil + '(:fmt (lambda (el) (if (stringp el) + el + (format "%S" el)))))))) + data-file) + (if (stringp val) val (format "%S" val)))) + body))) + vars) + body) + +(defun org-babel-prep-session:sql (_session _params) + "Raise an error because Sql sessions aren't implemented." + (error "SQL sessions not yet implemented")) + +(provide 'ob-sql) + +;;; ob-sql.el ends here diff --git a/elpa/org-9.5.2/ob-sql.elc b/elpa/org-9.5.2/ob-sql.elc new file mode 100644 index 0000000..26c6c10 Binary files /dev/null and b/elpa/org-9.5.2/ob-sql.elc differ diff --git a/elpa/org-9.5.2/ob-sqlite.el b/elpa/org-9.5.2/ob-sqlite.el new file mode 100644 index 0000000..7bfb66c --- /dev/null +++ b/elpa/org-9.5.2/ob-sqlite.el @@ -0,0 +1,148 @@ +;;; ob-sqlite.el --- Babel Functions for SQLite Databases -*- lexical-binding: t; -*- + +;; Copyright (C) 2010-2021 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Maintainer: Nick Savage +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Org-Babel support for evaluating sqlite source code. + +;;; Code: +(require 'ob) +(require 'ob-sql) + +(declare-function org-table-convert-region "org-table" + (beg0 end0 &optional separator)) +(declare-function orgtbl-to-csv "org-table" (table params)) +(declare-function org-table-to-lisp "org-table" (&optional txt)) + +(defvar org-babel-default-header-args:sqlite '()) + +(defvar org-babel-header-args:sqlite + '((db . :any) + (header . :any) + (echo . :any) + (bail . :any) + (csv . :any) + (column . :any) + (html . :any) + (line . :any) + (list . :any) + (separator . :any) + (nullvalue . :any)) + "Sqlite specific header args.") + +(defun org-babel-expand-body:sqlite (body params) + "Expand BODY according to the values of PARAMS." + (org-babel-sql-expand-vars + body (org-babel--get-vars params) t)) + +(defvar org-babel-sqlite3-command "sqlite3") + +(defun org-babel-execute:sqlite (body params) + "Execute a block of Sqlite code with Babel. +This function is called by `org-babel-execute-src-block'." + (let ((result-params (split-string (or (cdr (assq :results params)) ""))) + (db (cdr (assq :db params))) + (separator (cdr (assq :separator params))) + (nullvalue (cdr (assq :nullvalue params))) + (headers-p (equal "yes" (cdr (assq :colnames params)))) + (others (delq nil (mapcar + (lambda (arg) (car (assq arg params))) + (list :header :echo :bail :column + :csv :html :line :list))))) + (unless db (error "ob-sqlite: can't evaluate without a database")) + (with-temp-buffer + (insert + (org-babel-eval + (org-fill-template + "%cmd %header %separator %nullvalue %others %csv %db " + (list + (cons "cmd" org-babel-sqlite3-command) + (cons "header" (if headers-p "-header" "-noheader")) + (cons "separator" + (if separator (format "-separator %s" separator) "")) + (cons "nullvalue" + (if nullvalue (format "-nullvalue %s" nullvalue) "")) + (cons "others" + (mapconcat + (lambda (arg) (format "-%s" (substring (symbol-name arg) 1))) + others " ")) + ;; for easy table parsing, default header type should be -csv + (cons "csv" (if (or (member :csv others) (member :column others) + (member :line others) (member :list others) + (member :html others) separator) + "" + "-csv")) + (cons "db " db))) + ;; body of the code block + (org-babel-expand-body:sqlite body params))) + (org-babel-result-cond result-params + (buffer-string) + (if (equal (point-min) (point-max)) + "" + (org-table-convert-region (point-min) (point-max) + (if (or (member :csv others) + (member :column others) + (member :line others) + (member :list others) + (member :html others) separator) + nil + '(4))) + (org-babel-sqlite-table-or-scalar + (org-babel-sqlite-offset-colnames + (org-table-to-lisp) headers-p))))))) + +(defun org-babel-sqlite-expand-vars (body vars) + "Expand the variables held in VARS in BODY." + (declare (obsolete "use `org-babel-sql-expand-vars' instead." "9.5")) + (org-babel-sql-expand-vars body vars t)) + +(defun org-babel-sqlite-table-or-scalar (result) + "If RESULT looks like a trivial table, then unwrap it." + (if (and (equal 1 (length result)) + (equal 1 (length (car result)))) + (org-babel-read (caar result) t) + (mapcar (lambda (row) + (if (eq 'hline row) + 'hline + (mapcar #'org-babel-sqlite--read-cell row))) + result))) + +(defun org-babel-sqlite-offset-colnames (table headers-p) + "If HEADERS-P is non-nil then offset the first row as column names." + (if headers-p + (cons (car table) (cons 'hline (cdr table))) + table)) + +(defun org-babel-prep-session:sqlite (_session _params) + "Raise an error because support for SQLite sessions isn't implemented. +Prepare SESSION according to the header arguments specified in PARAMS." + (error "SQLite sessions not yet implemented")) + +(defun org-babel-sqlite--read-cell (cell) + "Process CELL to remove unnecessary characters." + (org-babel-read cell t)) + +(provide 'ob-sqlite) + +;;; ob-sqlite.el ends here diff --git a/elpa/org-9.5.2/ob-sqlite.elc b/elpa/org-9.5.2/ob-sqlite.elc new file mode 100644 index 0000000..d7a1326 Binary files /dev/null and b/elpa/org-9.5.2/ob-sqlite.elc differ diff --git a/elpa/org-9.5.2/ob-table.el b/elpa/org-9.5.2/ob-table.el new file mode 100644 index 0000000..e081708 --- /dev/null +++ b/elpa/org-9.5.2/ob-table.el @@ -0,0 +1,152 @@ +;;; ob-table.el --- Support for Calling Babel Functions from Tables -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Should allow calling functions from Org tables using the function +;; `org-sbe' as so... + +;; #+begin_src emacs-lisp :results silent +;; (defun fibbd (n) (if (< n 2) 1 (+ (fibbd (- n 1)) (fibbd (- n 2))))) +;; #+end_src + +;; #+name: fibbd +;; #+begin_src emacs-lisp :var n=2 :results silent +;; (fibbd n) +;; #+end_src + +;; | original | fibbd | +;; |----------+--------| +;; | 0 | | +;; | 1 | | +;; | 2 | | +;; | 3 | | +;; | 4 | | +;; | 5 | | +;; | 6 | | +;; | 7 | | +;; | 8 | | +;; | 9 | | +;; #+TBLFM: $2='(org-sbe "fibbd" (n $1)) + +;; NOTE: The quotation marks around the function name, 'fibbd' here, +;; are optional. + +;;; Code: +(require 'ob-core) +(require 'org-macs) + +(defun org-babel-table-truncate-at-newline (string) + "Replace newline character with ellipses. +If STRING ends in a newline character, then remove the newline +character and replace it with ellipses." + (if (and (stringp string) (string-match "[\n\r]\\(.\\)?" string)) + (concat (substring string 0 (match-beginning 0)) + (when (match-string 1 string) "...")) + string)) + +(defmacro org-sbe (source-block &rest variables) + "Return the results of calling SOURCE-BLOCK with VARIABLES. + +Each element of VARIABLES should be a list of two elements: the +first element is the name of the variable and second element is a +string of its value. + +So this `org-sbe' construct + + (org-sbe \"source-block\" (n $2) (m 3)) + +is the equivalent of the following source code block: + + #+begin_src emacs-lisp :var results=source-block(n=val_at_col_2, m=3) \\ + :results silent + results + #+end_src + +NOTE: The quotation marks around the function name, +'source-block', are optional. + +NOTE: By default, string variable names are interpreted as +references to source-code blocks, to force interpretation of a +cell's value as a string, prefix the identifier a \"$\" (e.g., +\"$$2\" instead of \"$2\" or \"$@2$2\" instead of \"@2$2\"). + +NOTE: It is also possible to pass header arguments to the code +block. In this case a table cell should hold the string value of +the header argument which can then be passed before all variables +as shown in the example below. + +| 1 | 2 | :file nothing.png | nothing.png | +#+TBLFM: @1$4=\\='(org-sbe test-sbe $3 (x $1) (y $2))" + (declare (debug (form form))) + (let* ((header-args (if (stringp (car variables)) (car variables) "")) + (variables (if (stringp (car variables)) (cdr variables) variables))) + (let* (quote + (variables + (mapcar + (lambda (var) + ;; ensure that all cells prefixed with $'s are strings + (cons (car var) + (delq nil (mapcar + (lambda (el) + (if (eq '$ el) + (prog1 nil (setq quote t)) + (prog1 + (cond + (quote (format "\"%s\"" el)) + ((stringp el) (org-no-properties el)) + (t el)) + (setq quote nil)))) + (cdr var))))) + variables))) + (unless (stringp source-block) + (setq source-block (symbol-name source-block))) + (let ((result + (if (and source-block (> (length source-block) 0)) + (let ((params + ;; FIXME: Why `eval'?!?!? + (eval `(org-babel-parse-header-arguments + (concat + ":var results=" + ,source-block + "[" ,header-args "]" + "(" + (mapconcat + (lambda (var-spec) + (if (> (length (cdr var-spec)) 1) + (format "%S='%S" + (car var-spec) + (mapcar #'read (cdr var-spec))) + (format "%S=%s" + (car var-spec) (cadr var-spec)))) + ',variables ", ") + ")"))))) + (org-babel-execute-src-block + nil (list "emacs-lisp" "results" params) + '((:results . "silent")))) + ""))) + (org-trim (if (stringp result) result (format "%S" result))))))) + +(provide 'ob-table) + +;;; ob-table.el ends here diff --git a/elpa/org-9.5.2/ob-table.elc b/elpa/org-9.5.2/ob-table.elc new file mode 100644 index 0000000..0bd827c Binary files /dev/null and b/elpa/org-9.5.2/ob-table.elc differ diff --git a/elpa/org-9.5.2/ob-tangle.el b/elpa/org-9.5.2/ob-tangle.el new file mode 100644 index 0000000..8ed7002 --- /dev/null +++ b/elpa/org-9.5.2/ob-tangle.el @@ -0,0 +1,616 @@ +;;; ob-tangle.el --- Extract Source Code From Org Files -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Extract the code from source blocks out into raw source-code files. + +;;; Code: + +(require 'cl-lib) +(require 'org-src) +(require 'org-macs) +(require 'ol) + +(declare-function make-directory "files" (dir &optional parents)) +(declare-function org-at-heading-p "org" (&optional ignored)) +(declare-function org-babel-update-block-body "ob-core" (new-body)) +(declare-function org-back-to-heading "org" (&optional invisible-ok)) +(declare-function org-before-first-heading-p "org" ()) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-type "org-element" (element)) +(declare-function org-heading-components "org" ()) +(declare-function org-in-commented-heading-p "org" (&optional no-inheritance)) +(declare-function org-in-archived-heading-p "org" (&optional no-inheritance)) +(declare-function outline-previous-heading "outline" ()) +(defvar org-id-link-to-org-use-id nil) ; Dynamically scoped + +(defcustom org-babel-tangle-lang-exts + '(("emacs-lisp" . "el") + ("elisp" . "el")) + "Alist mapping languages to their file extensions. +The key is the language name, the value is the string that should +be inserted as the extension commonly used to identify files +written in this language. If no entry is found in this list, +then the name of the language is used." + :group 'org-babel-tangle + :version "24.1" + :type '(repeat + (cons + (string "Language name") + (string "File Extension")))) + +(defcustom org-babel-tangle-use-relative-file-links t + "Use relative path names in links from tangled source back the Org file." + :group 'org-babel-tangle + :type 'boolean) + +(defcustom org-babel-post-tangle-hook nil + "Hook run in code files tangled by `org-babel-tangle'." + :group 'org-babel + :version "24.1" + :type 'hook) + +(defcustom org-babel-pre-tangle-hook '(save-buffer) + "Hook run at the beginning of `org-babel-tangle'." + :group 'org-babel + :version "24.1" + :type 'hook) + +(defcustom org-babel-tangle-body-hook nil + "Hook run over the contents of each code block body." + :group 'org-babel + :version "24.1" + :type 'hook) + +(defcustom org-babel-tangle-comment-format-beg "[[%link][%source-name]]" + "Format of inserted comments in tangled code files. +The following format strings can be used to insert special +information into the output using `org-fill-template'. +%start-line --- the line number at the start of the code block +%file --------- the file from which the code block was tangled +%link --------- Org style link to the code block +%source-name -- name of the code block + +Upon insertion the formatted comment will be commented out, and +followed by a newline. To inhibit this post-insertion processing +set the `org-babel-tangle-uncomment-comments' variable to a +non-nil value. + +Whether or not comments are inserted during tangling is +controlled by the :comments header argument." + :group 'org-babel + :version "24.1" + :type 'string) + +(defcustom org-babel-tangle-comment-format-end "%source-name ends here" + "Format of inserted comments in tangled code files. +The following format strings can be used to insert special +information into the output using `org-fill-template'. +%start-line --- the line number at the start of the code block +%file --------- the file from which the code block was tangled +%link --------- Org style link to the code block +%source-name -- name of the code block + +Upon insertion the formatted comment will be commented out, and +followed by a newline. To inhibit this post-insertion processing +set the `org-babel-tangle-uncomment-comments' variable to a +non-nil value. + +Whether or not comments are inserted during tangling is +controlled by the :comments header argument." + :group 'org-babel + :version "24.1" + :type 'string) + +(defcustom org-babel-tangle-uncomment-comments nil + "Inhibits automatic commenting and addition of trailing newline +of tangle comments. Use `org-babel-tangle-comment-format-beg' +and `org-babel-tangle-comment-format-end' to customize the format +of tangled comments." + :group 'org-babel + :type 'boolean) + +(defcustom org-babel-process-comment-text 'org-remove-indentation + "Function called to process raw Org text collected to be +inserted as comments in tangled source-code files. The function +should take a single string argument and return a string +result. The default value is `org-remove-indentation'." + :group 'org-babel + :version "24.1" + :type 'function) + +(defun org-babel-find-file-noselect-refresh (file) + "Find file ensuring that the latest changes on disk are +represented in the file." + (find-file-noselect file 'nowarn) + (with-current-buffer (get-file-buffer file) + (revert-buffer t t t))) + +(defmacro org-babel-with-temp-filebuffer (file &rest body) + "Open FILE into a temporary buffer execute BODY there like +`progn', then kill the FILE buffer returning the result of +evaluating BODY." + (declare (indent 1) (debug t)) + (let ((temp-path (make-symbol "temp-path")) + (temp-result (make-symbol "temp-result")) + (temp-file (make-symbol "temp-file")) + (visited-p (make-symbol "visited-p"))) + `(let* ((,temp-path ,file) + (,visited-p (get-file-buffer ,temp-path)) + ,temp-result ,temp-file) + (org-babel-find-file-noselect-refresh ,temp-path) + (setf ,temp-file (get-file-buffer ,temp-path)) + (with-current-buffer ,temp-file + (setf ,temp-result (progn ,@body))) + (unless ,visited-p (kill-buffer ,temp-file)) + ,temp-result))) + +;;;###autoload +(defun org-babel-tangle-file (file &optional target-file lang-re) + "Extract the bodies of source code blocks in FILE. +Source code blocks are extracted with `org-babel-tangle'. + +Optional argument TARGET-FILE can be used to specify a default +export file for all source blocks. + +Optional argument LANG-RE can be used to limit the exported +source code blocks by languages matching a regular expression. + +Return a list whose CAR is the tangled file name." + (interactive "fFile to tangle: \nP") + (let* ((visited (find-buffer-visiting file)) + (buffer (or visited (find-file-noselect file)))) + (prog1 + (with-current-buffer buffer + (org-with-wide-buffer + (mapcar #'expand-file-name + (org-babel-tangle nil target-file lang-re)))) + (unless visited (kill-buffer buffer))))) + +(defun org-babel-tangle-publish (_ filename pub-dir) + "Tangle FILENAME and place the results in PUB-DIR." + (unless (file-exists-p pub-dir) + (make-directory pub-dir t)) + (setq pub-dir (file-name-as-directory pub-dir)) + (mapc (lambda (el) (copy-file el pub-dir t)) (org-babel-tangle-file filename))) + +;;;###autoload +(defun org-babel-tangle (&optional arg target-file lang-re) + "Write code blocks to source-specific files. +Extract the bodies of all source code blocks from the current +file into their own source-specific files. +With one universal prefix argument, only tangle the block at point. +When two universal prefix arguments, only tangle blocks for the +tangle file of the block at point. +Optional argument TARGET-FILE can be used to specify a default +export file for all source blocks. Optional argument LANG-RE can +be used to limit the exported source code blocks by languages +matching a regular expression." + (interactive "P") + (run-hooks 'org-babel-pre-tangle-hook) + ;; Possibly Restrict the buffer to the current code block + (save-restriction + (save-excursion + (when (equal arg '(4)) + (let ((head (org-babel-where-is-src-block-head))) + (if head + (goto-char head) + (user-error "Point is not in a source code block")))) + (let ((block-counter 0) + (org-babel-default-header-args + (if target-file + (org-babel-merge-params org-babel-default-header-args + (list (cons :tangle target-file))) + org-babel-default-header-args)) + (tangle-file + (when (equal arg '(16)) + (or (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info 'light)))) + (user-error "Point is not in a source code block")))) + path-collector) + (mapc ;; map over file-names + (lambda (by-fn) + (let ((file-name (car by-fn))) + (when file-name + (let ((lspecs (cdr by-fn)) + (fnd (file-name-directory file-name)) + modes make-dir she-banged lang) + ;; drop source-blocks to file + ;; We avoid append-to-file as it does not work with tramp. + (with-temp-buffer + (mapc + (lambda (lspec) + (let* ((block-lang (car lspec)) + (spec (cdr lspec)) + (get-spec (lambda (name) (cdr (assq name (nth 4 spec))))) + (she-bang (let ((sheb (funcall get-spec :shebang))) + (when (> (length sheb) 0) sheb))) + (tangle-mode (funcall get-spec :tangle-mode))) + (unless (string-equal block-lang lang) + (setq lang block-lang) + (let ((lang-f (org-src-get-lang-mode lang))) + (when (fboundp lang-f) (ignore-errors (funcall lang-f))))) + ;; if file contains she-bangs, then make it executable + (when she-bang + (unless tangle-mode (setq tangle-mode #o755))) + (when tangle-mode + (add-to-list 'modes tangle-mode)) + ;; Possibly create the parent directories for file. + (let ((m (funcall get-spec :mkdirp))) + (and m fnd (not (string= m "no")) + (setq make-dir t))) + ;; Handle :padlines unless first line in file + (unless (or (string= "no" (funcall get-spec :padline)) + (= (point) (point-min))) + (insert "\n")) + (when (and she-bang (not she-banged)) + (insert (concat she-bang "\n")) + (setq she-banged t)) + (org-babel-spec-to-string spec) + (setq block-counter (+ 1 block-counter)))) + lspecs) + (when make-dir + (make-directory fnd 'parents)) + ;; erase previous file + (when (file-exists-p file-name) + (delete-file file-name)) + (write-region nil nil file-name) + (mapc (lambda (mode) (set-file-modes file-name mode)) modes) + (push file-name path-collector)))))) + (if (equal arg '(4)) + (org-babel-tangle-single-block 1 t) + (org-babel-tangle-collect-blocks lang-re tangle-file))) + (message "Tangled %d code block%s from %s" block-counter + (if (= block-counter 1) "" "s") + (file-name-nondirectory + (buffer-file-name + (or (buffer-base-buffer) + (current-buffer) + (and (org-src-edit-buffer-p) + (org-src-source-buffer)))))) + ;; run `org-babel-post-tangle-hook' in all tangled files + (when org-babel-post-tangle-hook + (mapc + (lambda (file) + (org-babel-with-temp-filebuffer file + (run-hooks 'org-babel-post-tangle-hook))) + path-collector)) + path-collector)))) + +(defun org-babel-tangle-clean () + "Remove comments inserted by `org-babel-tangle'. +Call this function inside of a source-code file generated by +`org-babel-tangle' to remove all comments inserted automatically +by `org-babel-tangle'. Warning, this comment removes any lines +containing constructs which resemble Org file links or noweb +references." + (interactive) + (goto-char (point-min)) + (while (or (re-search-forward "\\[\\[file:.*\\]\\[.*\\]\\]" nil t) + (re-search-forward (org-babel-noweb-wrap) nil t)) + (delete-region (save-excursion (beginning-of-line 1) (point)) + (save-excursion (end-of-line 1) (forward-char 1) (point))))) + +(defun org-babel-spec-to-string (spec) + "Insert SPEC into the current file. + +Insert the source-code specified by SPEC into the current source +code file. This function uses `comment-region' which assumes +that the appropriate major-mode is set. SPEC has the form: + + (start-line file link source-name params body comment)" + (pcase-let* + ((`(,start ,file ,link ,source ,info ,body ,comment) spec) + (comments (cdr (assq :comments info))) + (link? (or (string= comments "both") (string= comments "link") + (string= comments "yes") (string= comments "noweb"))) + (link-data `(("start-line" . ,(number-to-string start)) + ("file" . ,file) + ("link" . ,link) + ("source-name" . ,source))) + (insert-comment (lambda (text) + (when (and comments + (not (string= comments "no")) + (org-string-nw-p text)) + (if org-babel-tangle-uncomment-comments + ;; Plain comments: no processing. + (insert text) + ;; Ensure comments are made to be + ;; comments, and add a trailing newline. + ;; Also ignore invisible characters when + ;; commenting. + (comment-region + (point) + (progn (insert (org-no-properties text)) + (point))) + (end-of-line) + (insert "\n")))))) + (when comment (funcall insert-comment comment)) + (when link? + (funcall insert-comment + (org-fill-template + org-babel-tangle-comment-format-beg link-data))) + (insert body "\n") + (when link? + (funcall insert-comment + (org-fill-template + org-babel-tangle-comment-format-end link-data))))) + +(defun org-babel-effective-tangled-filename (buffer-fn src-lang src-tfile) + "Return effective tangled filename of a source-code block. +BUFFER-FN is the name of the buffer, SRC-LANG the language of the +block and SRC-TFILE is the value of the :tangle header argument, +as computed by `org-babel-tangle-single-block'." + (let ((base-name (cond + ((string= "yes" src-tfile) + ;; Use the buffer name + (file-name-sans-extension buffer-fn)) + ((string= "no" src-tfile) nil) + ((> (length src-tfile) 0) src-tfile))) + (ext (or (cdr (assoc src-lang org-babel-tangle-lang-exts)) src-lang))) + (when base-name + ;; decide if we want to add ext to base-name + (if (and ext (string= "yes" src-tfile)) + (concat base-name "." ext) base-name)))) + +(defun org-babel-tangle-collect-blocks (&optional lang-re tangle-file) + "Collect source blocks in the current Org file. +Return an association list of language and source-code block +specifications of the form used by `org-babel-spec-to-string' +grouped by tangled file name. + +Optional argument LANG-RE can be used to limit the collected +source code blocks by languages matching a regular expression. + +Optional argument TANGLE-FILE can be used to limit the collected +code blocks by target file." + (let ((counter 0) last-heading-pos blocks) + (org-babel-map-src-blocks (buffer-file-name) + (let ((current-heading-pos + (org-with-wide-buffer + (org-with-limited-levels (outline-previous-heading))))) + (if (eq last-heading-pos current-heading-pos) (cl-incf counter) + (setq counter 1) + (setq last-heading-pos current-heading-pos))) + (unless (or (org-in-commented-heading-p) + (org-in-archived-heading-p)) + (let* ((info (org-babel-get-src-block-info 'light)) + (src-lang (nth 0 info)) + (src-tfile (cdr (assq :tangle (nth 2 info))))) + (unless (or (string= src-tfile "no") + (and tangle-file (not (equal tangle-file src-tfile))) + (and lang-re (not (string-match-p lang-re src-lang)))) + ;; Add the spec for this block to blocks under its tangled + ;; file name. + (let* ((block (org-babel-tangle-single-block counter)) + (src-tfile (cdr (assq :tangle (nth 4 block)))) + (file-name (org-babel-effective-tangled-filename + (nth 1 block) src-lang src-tfile)) + (by-fn (assoc file-name blocks))) + (if by-fn (setcdr by-fn (cons (cons src-lang block) (cdr by-fn))) + (push (cons file-name (list (cons src-lang block))) blocks))))))) + ;; Ensure blocks are in the correct order. + (mapcar (lambda (b) (cons (car b) (nreverse (cdr b)))) + (nreverse blocks)))) + +(defun org-babel-tangle-single-block (block-counter &optional only-this-block) + "Collect the tangled source for current block. +Return the list of block attributes needed by +`org-babel-tangle-collect-blocks'. When ONLY-THIS-BLOCK is +non-nil, return the full association list to be used by +`org-babel-tangle' directly." + (let* ((info (org-babel-get-src-block-info)) + (start-line + (save-restriction (widen) + (+ 1 (line-number-at-pos (point))))) + (file (buffer-file-name (buffer-base-buffer))) + (src-lang (nth 0 info)) + (params (nth 2 info)) + (extra (nth 3 info)) + (coderef (nth 6 info)) + (cref-regexp (org-src-coderef-regexp coderef)) + (link (let* ( + ;; The created link is transient. Using ID is + ;; not necessary, but could have side-effects if + ;; used. An ID property may be added to + ;; existing entries thus creatin unexpected file + ;; modifications. + (org-id-link-to-org-use-id nil) + (l (org-no-properties (org-store-link nil)))) + (and (string-match org-link-bracket-re l) + (match-string 1 l)))) + (source-name + (or (nth 4 info) + (format "%s:%d" + (or (ignore-errors (nth 4 (org-heading-components))) + "No heading") + block-counter))) + (expand-cmd (intern (concat "org-babel-expand-body:" src-lang))) + (assignments-cmd + (intern (concat "org-babel-variable-assignments:" src-lang))) + (body + ;; Run the tangle-body-hook. + (let ((body (if (org-babel-noweb-p params :tangle) + (org-babel-expand-noweb-references info) + (nth 1 info)))) + (with-temp-buffer + (insert + ;; Expand body in language specific manner. + (cond ((assq :no-expand params) body) + ((fboundp expand-cmd) (funcall expand-cmd body params)) + (t + (org-babel-expand-body:generic + body params (and (fboundp assignments-cmd) + (funcall assignments-cmd params)))))) + (when (string-match "-r" extra) + (goto-char (point-min)) + (while (re-search-forward cref-regexp nil t) + (replace-match ""))) + (run-hooks 'org-babel-tangle-body-hook) + (buffer-string)))) + (comment + (when (or (string= "both" (cdr (assq :comments params))) + (string= "org" (cdr (assq :comments params)))) + ;; From the previous heading or code-block end + (funcall + org-babel-process-comment-text + (buffer-substring + (max (condition-case nil + (save-excursion + (org-back-to-heading t) ; Sets match data + (match-end 0)) + (error (point-min))) + (save-excursion + (if (re-search-backward + org-babel-src-block-regexp nil t) + (match-end 0) + (point-min)))) + (point))))) + (result + (list start-line + (if org-babel-tangle-use-relative-file-links + (file-relative-name file) + file) + (if (and org-babel-tangle-use-relative-file-links + (string-match org-link-types-re link) + (string= (match-string 1 link) "file")) + (concat "file:" + (file-relative-name (substring link (match-end 0)) + (file-name-directory + (cdr (assq :tangle params))))) + link) + source-name + params + (if org-src-preserve-indentation + (org-trim body t) + (org-trim (org-remove-indentation body))) + comment))) + (if only-this-block + (let* ((src-tfile (cdr (assq :tangle (nth 4 result)))) + (file-name (org-babel-effective-tangled-filename + (nth 1 result) src-lang src-tfile))) + (list (cons file-name (list (cons src-lang result))))) + result))) + +(defun org-babel-tangle-comment-links (&optional info) + "Return a list of begin and end link comments for the code block at point. +INFO, when non nil, is the source block information, as returned +by `org-babel-get-src-block-info'." + (let ((link-data (pcase (or info (org-babel-get-src-block-info 'light)) + (`(,_ ,_ ,_ ,_ ,name ,start ,_) + `(("start-line" . ,(org-with-point-at start + (number-to-string + (line-number-at-pos)))) + ("file" . ,(buffer-file-name)) + ("link" . ,(let (;; The created link is transient. Using ID is + ;; not necessary, but could have side-effects if + ;; used. An ID property may be added to + ;; existing entries thus creatin unexpected file + ;; modifications. + (org-id-link-to-org-use-id nil)) + (org-no-properties (org-store-link nil)))) + ("source-name" . ,name)))))) + (list (org-fill-template org-babel-tangle-comment-format-beg link-data) + (org-fill-template org-babel-tangle-comment-format-end link-data)))) + +;; de-tangling functions +(defun org-babel-detangle (&optional source-code-file) + "Propagate changes in source file back original to Org file. +This requires that code blocks were tangled with link comments +which enable the original code blocks to be found." + (interactive) + (save-excursion + (when source-code-file (find-file source-code-file)) + (goto-char (point-min)) + (let ((counter 0) new-body end) + (while (re-search-forward org-link-bracket-re nil t) + (if (and (match-string 2) + (re-search-forward + (concat " " (regexp-quote (match-string 2)) " ends here") nil t)) + (progn (setq end (match-end 0)) + (forward-line -1) + (save-excursion + (when (setq new-body (org-babel-tangle-jump-to-org)) + (org-babel-update-block-body new-body))) + (setq counter (+ 1 counter))) + (setq end (point))) + (goto-char end)) + (prog1 counter (message "Detangled %d code blocks" counter))))) + +(defun org-babel-tangle-jump-to-org () + "Jump from a tangled code file to the related Org mode file." + (interactive) + (let ((mid (point)) + start body-start end target-buffer target-char link block-name body) + (save-window-excursion + (save-excursion + (while (and (re-search-backward org-link-bracket-re nil t) + (not ; ever wider searches until matching block comments + (and (setq start (line-beginning-position)) + (setq body-start (line-beginning-position 2)) + (setq link (match-string 0)) + (setq block-name (match-string 2)) + (save-excursion + (save-match-data + (re-search-forward + (concat " " (regexp-quote block-name) + " ends here") + nil t) + (setq end (line-beginning-position)))))))) + (unless (and start (< start mid) (< mid end)) + (error "Not in tangled code")) + (setq body (buffer-substring body-start end))) + ;; Go to the beginning of the relative block in Org file. + (org-link-open-from-string link) + (setq target-buffer (current-buffer)) + (if (string-match "[^ \t\n\r]:\\([[:digit:]]+\\)" block-name) + (let ((n (string-to-number (match-string 1 block-name)))) + (if (org-before-first-heading-p) (goto-char (point-min)) + (org-back-to-heading t)) + ;; Do not skip the first block if it begins at point min. + (cond ((or (org-at-heading-p) + (not (eq (org-element-type (org-element-at-point)) + 'src-block))) + (org-babel-next-src-block n)) + ((= n 1)) + (t (org-babel-next-src-block (1- n))))) + (org-babel-goto-named-src-block block-name)) + (goto-char (org-babel-where-is-src-block-head)) + (forward-line 1) + ;; Try to preserve location of point within the source code in + ;; tangled code file. + (let ((offset (- mid body-start))) + (when (> end (+ offset (point))) + (forward-char offset))) + (setq target-char (point))) + (org-src-switch-to-buffer target-buffer t) + (goto-char target-char) + body)) + +(provide 'ob-tangle) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; ob-tangle.el ends here diff --git a/elpa/org-9.5.2/ob-tangle.elc b/elpa/org-9.5.2/ob-tangle.elc new file mode 100644 index 0000000..87fba1e Binary files /dev/null and b/elpa/org-9.5.2/ob-tangle.elc differ diff --git a/elpa/org-9.5.2/ob.el b/elpa/org-9.5.2/ob.el new file mode 100644 index 0000000..1e89b02 --- /dev/null +++ b/elpa/org-9.5.2/ob.el @@ -0,0 +1,43 @@ +;;; ob.el --- Working with Code Blocks in Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Authors: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Code: +(require 'org-macs) +(require 'org-compat) +(require 'org-keys) +(require 'ob-eval) +(require 'ob-core) +(require 'ob-comint) +(require 'ob-exp) +(require 'ob-table) +(require 'ob-lob) +(require 'ob-ref) +(require 'ob-tangle) + +(provide 'ob) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; ob.el ends here diff --git a/elpa/org-9.5.2/ob.elc b/elpa/org-9.5.2/ob.elc new file mode 100644 index 0000000..e0f00a3 Binary files /dev/null and b/elpa/org-9.5.2/ob.elc differ diff --git a/elpa/org-9.5.2/oc-basic.el b/elpa/org-9.5.2/oc-basic.el new file mode 100644 index 0000000..7c83bdc --- /dev/null +++ b/elpa/org-9.5.2/oc-basic.el @@ -0,0 +1,789 @@ +;;; oc-basic.el --- basic back-end for citations -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; The `basic' citation processor provides "activate", "follow", "export" and +;; "insert" capabilities. + +;; "activate" capability re-uses default fontification, but provides additional +;; features on both correct and wrong keys according to the bibliography +;; defined in the document. + +;; When the mouse is over a known key, it displays the corresponding +;; bibliography entry. Any wrong key, however, is highlighted with `error' +;; face. Moreover, moving the mouse onto it displays a list of suggested correct +;; keys, and pressing on the faulty key will try to fix it according to +;; those suggestions. + +;; On a citation key, "follow" capability moves point to the corresponding entry +;; in the current bibliography. Elsewhere on the citation, it asks the user to +;; follow any of the keys cited there, with completion. + +;; "export" capability supports the following citation styles: +;; +;; - author (a), including caps (c) variant, +;; - noauthor (na) including bare (b) variant, +;; - text (t), including bare (b), caps (c), and bare-caps (bc) variants, +;; - note (ft, including bare (b), caps (c), and bare-caps (bc) variants, +;; - nocite (n) +;; - numeric (nb), +;; - default, including bare (b), caps (c), and bare-caps (bc) variants. +;; +;; It also supports the following styles for bibliography: +;; - plain +;; - numeric +;; - author-year (default) + +;; "insert" capability inserts or edits (with completion) citation style or +;; citation reference keys. In an appropriate place, it offers to insert a new +;; citation. With a prefix argument, it removes the one at point. + +;; It supports bibliography files in BibTeX (".bibtex"), biblatex (".bib") and +;; JSON (".json") format. + +;; Disclaimer: this citation processor is meant to be a proof of concept, and +;; possibly a fall-back mechanism when nothing else is available. It is too +;; limited for any serious use case. + +;;; Code: + +(require 'bibtex) +(require 'json) +(require 'map) +(require 'oc) +(require 'seq) + +(declare-function org-open-at-point "org" (&optional arg)) + +(declare-function org-element-interpret-data "org-element" (data)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-type "org-element" (element)) + +(declare-function org-export-data "org-export" (data info)) +(declare-function org-export-derived-backend-p "org-export" (backend &rest backends)) +(declare-function org-export-raw-string "org-export" (contents)) + + +;;; Customization +(defcustom org-cite-basic-sorting-field 'author + "Field used to sort bibliography items as a symbol, or nil." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'symbol + :safe #'symbolp) + +(defcustom org-cite-basic-author-year-separator ", " + "String used to separate cites in an author-year configuration." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'string + :safe #'stringp) + +(defcustom org-cite-basic-max-key-distance 2 + "Maximum (Levenshtein) distance between a wrong key and its suggestions." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'integer + :safe #'integerp) + +(defcustom org-cite-basic-author-column-end 25 + "Column where author field ends in completion table, as an integer." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'integer + :safe #'integerp) + +(defcustom org-cite-basic-column-separator " " + "Column separator in completion table, as a string." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'string + :safe #'stringp) + +(defcustom org-cite-basic-mouse-over-key-face 'highlight + "Face used when mouse is over a citation key." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'face + :safe #'facep) + + +;;; Internal variables +(defvar org-cite-basic--bibliography-cache nil + "Cache for parsed bibliography files. + +This is an association list following the pattern: + + (FILE-ID . ENTRIES) + +FILE-ID is a cons cell (FILE . HASH), with FILE being the absolute file name of +the bibliography file, and HASH a hash of its contents. + +ENTRIES is a hash table with citation references as keys and fields alist as +values.") + +(defvar org-cite-basic--completion-cache (make-hash-table :test #'equal) + "Cache for key completion table. + +This is an a hash-table.") + + +;;; Internal functions +(defun org-cite-basic--parse-json () + "Parse JSON entries in the current buffer. +Return a hash table with citation references as keys and fields alist as values." + (let ((entries (make-hash-table :test #'equal))) + (let ((json-array-type 'list) + (json-key-type 'symbol)) + (dolist (item (json-read)) + (puthash (cdr (assq 'id item)) + (mapcar (pcase-lambda (`(,field . ,value)) + (pcase field + ('author + ;; Author is an array of objects, each + ;; of them designing a person. These + ;; objects may contain multiple + ;; properties, but for this basic + ;; processor, we'll focus on `given' and + ;; `family'. + ;; + ;; For compatibility with BibTeX, add + ;; "and" between authors. + (cons 'author + (mapconcat + (lambda (alist) + (concat (alist-get 'family alist) + " " + (alist-get 'given alist))) + value + " and "))) + ('issued + ;; Date are expressed as an array + ;; (`date-parts') or a "string (`raw'). + ;; In both cases, extract the year and + ;; associate it to `year' field, for + ;; compatibility with BibTeX format. + (let ((date (or (alist-get 'date-parts value) + (alist-get 'raw value)))) + (cons 'year + (cond + ((consp date) + (caar date)) + ((stringp date) + (car (split-string date "-"))) + (t + (error "Unknown CSL-JSON date format: %S" + date)))))) + (_ + (cons field value)))) + item) + entries)) + entries))) + +(defun org-cite-basic--parse-bibtex (dialect) + "Parse BibTeX entries in the current buffer. +DIALECT is the BibTeX dialect used. See `bibtex-dialect'. +Return a hash table with citation references as keys and fields alist as values." + (let ((entries (make-hash-table :test #'equal)) + (bibtex-sort-ignore-string-entries t)) + (bibtex-set-dialect dialect t) + (bibtex-map-entries + (lambda (key &rest _) + ;; Normalize entries: field names are turned into symbols + ;; including special "=key=" and "=type=", and consecutive + ;; white spaces are removed from values. + (puthash key + (mapcar + (pcase-lambda (`(,field . ,value)) + (pcase field + ("=key=" (cons 'id key)) + ("=type=" (cons 'type value)) + (_ + (cons + (intern (downcase field)) + (replace-regexp-in-string "[ \t\n]+" " " value))))) + (bibtex-parse-entry t)) + entries))) + entries)) + +(defun org-cite-basic--parse-bibliography (&optional info) + "List all entries available in the buffer. + +Each association follows the pattern + + (FILE . ENTRIES) + +where FILE is the absolute file name of the BibTeX file, and ENTRIES is a hash +table where keys are references and values are association lists between fields, +as symbols, and values as strings or nil. + +Optional argument INFO is the export state, as a property list." + (if (plist-member info :cite-basic/bibliography) + (plist-get info :cite-basic/bibliography) + (let ((results nil)) + (dolist (file (org-cite-list-bibliography-files)) + (when (file-readable-p file) + (with-temp-buffer + (insert-file-contents file) + (let* ((file-id (cons file (org-buffer-hash))) + (entries + (or (cdr (assoc file-id org-cite-basic--bibliography-cache)) + (let ((table + (pcase (file-name-extension file) + ("json" (org-cite-basic--parse-json)) + ("bib" (org-cite-basic--parse-bibtex 'biblatex)) + ("bibtex" (org-cite-basic--parse-bibtex 'BibTeX)) + (ext + (user-error "Unknown bibliography extension: %S" + ext))))) + (push (cons file-id table) org-cite-basic--bibliography-cache) + table)))) + (push (cons file entries) results))))) + (when info (plist-put info :cite-basic/bibliography results)) + results))) + +(defun org-cite-basic--key-number (key info) + "Return number associated to cited KEY. +INFO is the export state, as a property list." + (let ((predicate + (org-cite-basic--field-less-p org-cite-basic-sorting-field info))) + (org-cite-key-number key info predicate))) + +(defun org-cite-basic--all-keys () + "List all keys available in current bibliography." + (seq-mapcat (pcase-lambda (`(,_ . ,entries)) + (map-keys entries)) + (org-cite-basic--parse-bibliography))) + +(defun org-cite-basic--get-entry (key &optional info) + "Return BibTeX entry for KEY, as an association list. +When non-nil, INFO is the export state, as a property list." + (catch :found + (pcase-dolist (`(,_ . ,entries) (org-cite-basic--parse-bibliography info)) + (let ((entry (gethash key entries))) + (when entry (throw :found entry)))) + nil)) + +(defun org-cite-basic--get-field (field entry-or-key &optional info raw) + "Return FIELD value for ENTRY-OR-KEY, or nil. + +FIELD is a symbol. ENTRY-OR-KEY is either an association list, as returned by +`org-cite-basic--get-entry', or a string representing a citation key. + +Optional argument INFO is the export state, as a property list. + +Return value may be nil or a string. If current export back-end is derived +from `latex', return a raw string instead, unless optional argument RAW is +non-nil." + (let ((value + (cdr + (assq field + (pcase entry-or-key + ((pred stringp) + (org-cite-basic--get-entry entry-or-key info)) + ((pred consp) + entry-or-key) + (_ + (error "Wrong value for ENTRY-OR-KEY: %S" entry-or-key))))))) + (if (and value + (not raw) + (org-export-derived-backend-p (plist-get info :back-end) 'latex)) + (org-export-raw-string value) + value))) + +(defun org-cite-basic--number-to-suffix (n) + "Compute suffix associated to number N. +This is used for disambiguation." + (let ((result nil)) + (apply #'string + (mapcar (lambda (n) (+ 97 n)) + (catch :complete + (while t + (push (% n 26) result) + (setq n (/ n 26)) + (cond + ((= n 0) (throw :complete result)) + ((< n 27) (throw :complete (cons (1- n) result))) + ((= n 27) (throw :complete (cons 0 (cons 0 result)))) + (t nil)))))))) + +(defun org-cite-basic--get-year (entry-or-key info &optional no-suffix) + "Return year associated to ENTRY-OR-KEY. + +ENTRY-OR-KEY is either an association list, as returned by +`org-cite-basic--get-entry', or a string representing a citation +key. INFO is the export state, as a property list. + +Year is obtained from the \"year\" field, if available, or from +the \"date\" field if it starts with a year pattern. + +Unlike `org-cite-basic--get-field', this function disambiguates +author-year patterns by adding a letter suffix to the year when +necessary, unless optional argument NO-SUFFIX is non-nil." + ;; The cache is an association list with the following structure: + ;; + ;; (AUTHOR-YEAR . KEY-SUFFIX-ALIST). + ;; + ;; AUTHOR-YEAR is the author year pair associated to current entry + ;; or key. + ;; + ;; KEY-SUFFIX-ALIST is an association (KEY . SUFFIX), where KEY is + ;; the cite key, as a string, and SUFFIX is the generated suffix + ;; string, or the empty string. + (let* ((author (org-cite-basic--get-field 'author entry-or-key info 'raw)) + (year + (or (org-cite-basic--get-field 'year entry-or-key info 'raw) + (let ((date + (org-cite-basic--get-field 'date entry-or-key info t))) + (and (stringp date) + (string-match (rx string-start + (group (= 4 digit)) + (or string-end (not digit))) + date) + (match-string 1 date))))) + (cache-key (cons author year)) + (key + (pcase entry-or-key + ((pred stringp) entry-or-key) + ((pred consp) (cdr (assq 'id entry-or-key))) + (_ (error "Wrong value for ENTRY-OR-KEY: %S" entry-or-key)))) + (cache (plist-get info :cite-basic/author-date-cache))) + (pcase (assoc cache-key cache) + ('nil + (let ((value (cons cache-key (list (cons key ""))))) + (plist-put info :cite-basic/author-date-cache (cons value cache)) + year)) + (`(,_ . ,alist) + (let ((suffix + (or (cdr (assoc key alist)) + (let ((new (org-cite-basic--number-to-suffix + (1- (length alist))))) + (push (cons key new) alist) + new)))) + (if no-suffix year (concat year suffix))))))) + +(defun org-cite-basic--print-entry (entry style &optional info) + "Format ENTRY according to STYLE string. +ENTRY is an alist, as returned by `org-cite-basic--get-entry'. +Optional argument INFO is the export state, as a property list." + (let ((author (org-cite-basic--get-field 'author entry info)) + (title (org-cite-basic--get-field 'title entry info)) + (from + (or (org-cite-basic--get-field 'publisher entry info) + (org-cite-basic--get-field 'journal entry info) + (org-cite-basic--get-field 'institution entry info) + (org-cite-basic--get-field 'school entry info)))) + (pcase style + ("plain" + (let ((year (org-cite-basic--get-year entry info 'no-suffix))) + (org-cite-concat + author ". " title (and from (list ", " from)) ", " year "."))) + ("numeric" + (let ((n (org-cite-basic--key-number (cdr (assq 'id entry)) info)) + (year (org-cite-basic--get-year entry info 'no-suffix))) + (org-cite-concat + (format "[%d] " n) author ", " + (org-cite-emphasize 'italic title) + (and from (list ", " from)) ", " + year "."))) + ;; Default to author-year. Use year disambiguation there. + (_ + (let ((year (org-cite-basic--get-year entry info))) + (org-cite-concat + author " (" year "). " + (org-cite-emphasize 'italic title) + (and from (list ", " from)) ".")))))) + + +;;; "Activate" capability +(defun org-cite-basic--close-keys (key keys) + "List cite keys close to KEY in terms of string distance." + (seq-filter (lambda (k) + (>= org-cite-basic-max-key-distance + (org-string-distance k key))) + keys)) + +(defun org-cite-basic--set-keymap (beg end suggestions) + "Set keymap on citation key between BEG and END positions. + +When the key is know, SUGGESTIONS is nil. Otherwise, it may be +a list of replacement keys, as strings, which will be offered as +substitutes for the unknown key. Finally, it may be the symbol +`all'." + (let ((km (make-sparse-keymap))) + (define-key km (kbd "") + (pcase suggestions + ('nil #'org-open-at-point) + ('all #'org-cite-insert) + (_ + (lambda () + (interactive) + (setf (buffer-substring beg end) + (concat "@" + (if (= 1 (length suggestions)) + (car suggestions) + (completing-read "Did you mean: " + suggestions nil t)))))))) + (put-text-property beg end 'keymap km))) + +(defun org-cite-basic-activate (citation) + "Set various text properties on CITATION object. + +Fontify whole citation with `org-cite' face. Fontify key with `error' face +when it does not belong to known keys. Otherwise, use `org-cite-key' face. + +Moreover, when mouse is on a known key, display the corresponding bibliography. +On a wrong key, suggest a list of possible keys, and offer to substitute one of +them with a mouse click." + (pcase-let ((`(,beg . ,end) (org-cite-boundaries citation)) + (keys (org-cite-basic--all-keys))) + (put-text-property beg end 'font-lock-multiline t) + (add-face-text-property beg end 'org-cite) + (dolist (reference (org-cite-get-references citation)) + (pcase-let* ((`(,beg . ,end) (org-cite-key-boundaries reference)) + (key (org-element-property :key reference))) + ;; Highlight key on mouse over. + (put-text-property beg end + 'mouse-face + org-cite-basic-mouse-over-key-face) + (if (member key keys) + ;; Activate a correct key. Face is `org-cite-key' and + ;; `help-echo' displays bibliography entry, for reference. + ;; calls `org-open-at-point'. + (let* ((entry (org-cite-basic--get-entry key)) + (bibliography-entry + (org-element-interpret-data + (org-cite-basic--print-entry entry "plain")))) + (add-face-text-property beg end 'org-cite-key) + (put-text-property beg end 'help-echo bibliography-entry) + (org-cite-basic--set-keymap beg end nil)) + ;; Activate a wrong key. Face is `error', `help-echo' + ;; displays possible suggestions. + (add-face-text-property beg end 'error) + (let ((close-keys (org-cite-basic--close-keys key keys))) + (when close-keys + (put-text-property beg end 'help-echo + (concat "Suggestions (mouse-1 to substitute): " + (mapconcat #'identity close-keys " ")))) + ;; When the are close know keys, provides + ;; completion to fix the current one. Otherwise, call + ;; `org-cite-insert'. + (org-cite-basic--set-keymap beg end (or close-keys 'all)))))))) + + +;;; "Export" capability +(defun org-cite-basic--format-author-year (citation format-cite format-ref info) + "Format CITATION object according to author-year format. + +FORMAT-CITE is a function of three arguments: the global prefix, the contents, +and the global suffix. All arguments can be strings or secondary strings. + +FORMAT-REF is a function of four arguments: the reference prefix, as a string or +secondary string, the author, the year, and the reference suffix, as a string or +secondary string. + +INFO is the export state, as a property list." + (org-export-data + (funcall format-cite + (org-element-property :prefix citation) + (org-cite-mapconcat + (lambda (ref) + (let ((k (org-element-property :key ref)) + (prefix (org-element-property :prefix ref)) + (suffix (org-element-property :suffix ref))) + (funcall format-ref + prefix + (org-cite-basic--get-field 'author k info) + (org-cite-basic--get-year k info) + suffix))) + (org-cite-get-references citation) + org-cite-basic-author-year-separator) + (org-element-property :suffix citation)) + info)) + +(defun org-cite-basic--citation-numbers (citation info) + "Return numbers associated to references in CITATION object. +INFO is the export state as a property list." + (let* ((numbers + (sort (mapcar (lambda (k) (org-cite-basic--key-number k info)) + (org-cite-get-references citation t)) + #'<)) + (last (car numbers)) + (result (list (number-to-string (pop numbers))))) + ;; Use compact number references, i.e., "1, 2, 3" becomes "1-3". + (while numbers + (let ((current (pop numbers)) + (next (car numbers))) + (cond + ((and next + (= current (1+ last)) + (= current (1- next))) + (unless (equal "-" (car result)) + (push "-" result))) + ((equal "-" (car result)) + (push (number-to-string current) result)) + (t + (push (format ", %d" current) result))) + (setq last current))) + (apply #'concat (nreverse result)))) + +(defun org-cite-basic--field-less-p (field info) + "Return a sort predicate comparing FIELD values for two citation keys. +INFO is the export state, as a property list." + (and field + (lambda (a b) + (org-string-collate-lessp + (org-cite-basic--get-field field a info 'raw) + (org-cite-basic--get-field field b info 'raw) + nil t)))) + +(defun org-cite-basic--sort-keys (keys info) + "Sort KEYS by author name. +INFO is the export communication channel, as a property list." + (let ((predicate (org-cite-basic--field-less-p org-cite-basic-sorting-field info))) + (if predicate + (sort keys predicate) + keys))) + +(defun org-cite-basic-export-citation (citation style _ info) + "Export CITATION object. +STYLE is the expected citation style, as a pair of strings or nil. INFO is the +export communication channel, as a property list." + (let ((has-variant-p + (lambda (variant type) + ;; Non-nil when style VARIANT has TYPE. TYPE is either + ;; `bare' or `caps'. + (member variant + (pcase type + ('bare '("bare" "bare-caps" "b" "bc")) + ('caps '("caps" "bare-caps" "c" "bc")) + (_ (error "Invalid variant type: %S" type))))))) + (pcase style + ;; "author" style. + (`(,(or "author" "a") . ,variant) + (let ((caps (member variant '("caps" "c")))) + (org-export-data + (mapconcat + (lambda (key) + (let ((author (org-cite-basic--get-field 'author key info))) + (if caps (capitalize author) author))) + (org-cite-get-references citation t) + org-cite-basic-author-year-separator) + info))) + ;; "noauthor" style. + (`(,(or "noauthor" "na") . ,variant) + (format (if (funcall has-variant-p variant 'bare) "%s" "(%s)") + (mapconcat (lambda (key) (org-cite-basic--get-year key info)) + (org-cite-get-references citation t) + org-cite-basic-author-year-separator))) + ;; "nocite" style. + (`(,(or "nocite" "n") . ,_) nil) + ;; "text" and "note" styles. + (`(,(and (or "text" "note" "t" "ft") style) . ,variant) + (when (and (member style '("note" "ft")) + (not (org-cite-inside-footnote-p citation))) + (org-cite-adjust-note citation info) + (org-cite-wrap-citation citation info)) + (let ((bare (funcall has-variant-p variant 'bare)) + (caps (funcall has-variant-p variant 'caps))) + (org-cite-basic--format-author-year + citation + (lambda (p c s) (org-cite-concat p c s)) + (lambda (p a y s) + (org-cite-concat p + (if caps (capitalize a) a) + (if bare " " " (") + y s + (and (not bare) ")"))) + info))) + ;; "numeric" style. + ;; + ;; When using this style on citations with multiple references, + ;; use global affixes and ignore local ones. + (`(,(or "numeric" "nb") . ,_) + (pcase-let ((`(,prefix . ,suffix) (org-cite-main-affixes citation))) + (org-export-data + (org-cite-concat + "(" prefix (org-cite-basic--citation-numbers citation info) suffix ")") + info))) + ;; Default ("nil") style. + (`(,_ . ,variant) + (let ((bare (funcall has-variant-p variant 'bare)) + (caps (funcall has-variant-p variant 'caps))) + (org-cite-basic--format-author-year + citation + (lambda (p c s) + (org-cite-concat (and (not bare) "(") p c s (and (not bare) ")"))) + (lambda (p a y s) + (org-cite-concat p (if caps (capitalize a) a) ", " y s)) + info))) + ;; This should not happen. + (_ (error "Invalid style: %S" style))))) + +(defun org-cite-basic-export-bibliography (keys _files style _props backend info) + "Generate bibliography. +KEYS is the list of cited keys, as strings. STYLE is the expected bibliography +style, as a string. BACKEND is the export back-end, as a symbol. INFO is the +export state, as a property list." + (mapconcat + (lambda (k) + (let ((entry (org-cite-basic--get-entry k info))) + (org-export-data + (org-cite-make-paragraph + (and (org-export-derived-backend-p backend 'latex) + (org-export-raw-string "\\noindent\n")) + (org-cite-basic--print-entry entry style info)) + info))) + (org-cite-basic--sort-keys keys info) + "\n")) + + +;;; "Follow" capability +(defun org-cite-basic-goto (datum _) + "Follow citation or citation reference DATUM. +When DATUM is a citation reference, open bibliography entry referencing +the citation key. Otherwise, select which key to follow among all keys +present in the citation." + (let* ((key + (if (eq 'citation-reference (org-element-type datum)) + (org-element-property :key datum) + (pcase (org-cite-get-references datum t) + (`(,key) key) + (keys + (or (completing-read "Select citation key: " keys nil t) + (user-error "Aborted")))))) + (file + (pcase (seq-find (pcase-lambda (`(,_ . ,entries)) + (gethash key entries)) + (org-cite-basic--parse-bibliography)) + (`(,f . ,_) f) + (_ (user-error "Cannot find citation key: %S" key))))) + (org-open-file file '(4)) + (pcase (file-name-extension file) + ("json" + ;; `rx' can not be used with Emacs <27.1 since `literal' form + ;; is not supported. + (let ((regexp (rx-to-string `(seq "\"id\":" (0+ (any "[ \t]")) "\"" ,key "\"") t))) + (goto-char (point-min)) + (re-search-forward regexp) + (search-backward "{"))) + (_ + (bibtex-set-dialect) + (bibtex-search-entry key))))) + + +;;; "Insert" capability +(defun org-cite-basic--complete-style (_) + "Offer completion for style. +Return chosen style as a string." + (let* ((styles + (mapcar (pcase-lambda (`((,style . ,_) . ,_)) + style) + (org-cite-supported-styles)))) + (pcase styles + (`(,style) style) + (_ (completing-read "Style (\"\" for default): " styles nil t))))) + +(defun org-cite-basic--key-completion-table () + "Return completion table for cite keys, as a hash table. + +In this hash table, keys are a strings with author, date, and +title of the reference. Values are the cite keys. + +Return nil if there are no bibliography files or no entries." + ;; Populate bibliography cache. + (let ((entries (org-cite-basic--parse-bibliography))) + (cond + ((null entries) nil) ;no bibliography files + ((gethash entries org-cite-basic--completion-cache) + org-cite-basic--completion-cache) + (t + (clrhash org-cite-basic--completion-cache) + (dolist (key (org-cite-basic--all-keys)) + (let ((completion + (concat + (let ((author (org-cite-basic--get-field 'author key nil t))) + (if author + (truncate-string-to-width + (replace-regexp-in-string " and " "; " author) + org-cite-basic-author-column-end nil ?\s) + (make-string org-cite-basic-author-column-end ?\s))) + org-cite-basic-column-separator + (let ((date (org-cite-basic--get-year key nil 'no-suffix))) + (format "%4s" (or date ""))) + org-cite-basic-column-separator + (org-cite-basic--get-field 'title key nil t)))) + (puthash completion key org-cite-basic--completion-cache))) + (unless (map-empty-p org-cite-basic--completion-cache) ;no key + (puthash entries t org-cite-basic--completion-cache) + org-cite-basic--completion-cache))))) + +(defun org-cite-basic--complete-key (&optional multiple) + "Prompt for a reference key and return a citation reference string. + +When optional argument MULTIPLE is non-nil, prompt for multiple +keys, until one of them is nil. Then return the list of +reference strings selected. + +Raise an error when no bibliography is set in the buffer." + (let* ((table + (or (org-cite-basic--key-completion-table) + (user-error "No bibliography set"))) + (prompt + (lambda (text) + (completing-read text table nil t)))) + (if (null multiple) + (let ((key (gethash (funcall prompt "Key: ") table))) + (org-string-nw-p key)) + (let* ((keys nil) + (build-prompt + (lambda () + (if keys + (format "Key (empty input exits) %s: " + (mapconcat #'identity (reverse keys) ";")) + "Key (empty input exits): ")))) + (let ((key (funcall prompt (funcall build-prompt)))) + (while (org-string-nw-p key) + (push (gethash key table) keys) + (setq key (funcall prompt (funcall build-prompt))))) + keys)))) + + +;;; Register processor +(org-cite-register-processor 'basic + :activate #'org-cite-basic-activate + :export-citation #'org-cite-basic-export-citation + :export-bibliography #'org-cite-basic-export-bibliography + :follow #'org-cite-basic-goto + :insert (org-cite-make-insert-processor #'org-cite-basic--complete-key + #'org-cite-basic--complete-style) + :cite-styles + '((("author" "a") ("caps" "c")) + (("noauthor" "na") ("bare" "b")) + (("nocite" "n")) + (("note" "ft") ("bare-caps" "bc") ("caps" "c")) + (("numeric" "nb")) + (("text" "t") ("bare-caps" "bc") ("caps" "c")) + (("nil") ("bare" "b") ("bare-caps" "bc") ("caps" "c")))) + +(provide 'oc-basic) +;;; oc-basic.el ends here diff --git a/elpa/org-9.5.2/oc-basic.elc b/elpa/org-9.5.2/oc-basic.elc new file mode 100644 index 0000000..c792d5b Binary files /dev/null and b/elpa/org-9.5.2/oc-basic.elc differ diff --git a/elpa/org-9.5.2/oc-biblatex.el b/elpa/org-9.5.2/oc-biblatex.el new file mode 100644 index 0000000..e985963 --- /dev/null +++ b/elpa/org-9.5.2/oc-biblatex.el @@ -0,0 +1,318 @@ +;;; oc-biblatex.el --- biblatex citation processor for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; This library registers the `biblatex' citation processor, which provides +;; the "export" capability for citations. + +;; The processor relies on "biblatex" LaTeX package. As such it ensures that +;; the package is properly required in the document's preamble. More +;; accurately, it will re-use any "\usepackage{biblatex}" already present in +;; the document (e.g., through `org-latex-packages-alist'), or insert one using +;; options defined in `org-cite-biblatex-options'. + +;; In any case, the library will override style-related options with those +;; specified with the citation processor, in `org-cite-export-processors' or +;; "cite_export" keyword. If you need to use different styles for bibliography +;; and citations, you can separate them with "bibstyle/citestyle" syntax. E.g., +;; +;; #+cite_export: biblatex authortitle/authortitle-ibid + +;; The library supports the following citation styles: +;; +;; - author (a), including caps (c), full (f) and caps-full (cf) variants, +;; - locators (l), including bare (b), caps (c) and bare-caps (bc) variants, +;; - noauthor (na), +;; - nocite (n), +;; - text (t), including caps (c) variant, +;; - default style, including bare (b), caps (c) and bare-caps (bc) variants. + +;; When citation and style permit, the library automatically generates +;; "multicite" versions of the commands above. + +;; Bibliography is printed using "\printbibliography" command. Additional +;; options may be passed to it through a property list attached to the +;; "print_bibliography" keyword. E.g., +;; +;; #+print_bibliography: :section 2 :heading subbibliography +;; +;; Values including spaces must be surrounded with double quotes. If you need +;; to use a key multiple times, you can separate its values with commas, but +;; without any space in-between: +;; +;; #+print_bibliography: :keyword abc,xyz :title "Primary Sources" + +;;; Code: +(require 'org-macs) +(require 'oc) + +(declare-function org-element-property "org-element" (property element)) +(declare-function org-export-data "org-export" (data info)) +(declare-function org-export-get-next-element "org-export" (blob info &optional n)) + + +;;; Customization +(defcustom org-cite-biblatex-options nil + "Options added to \"biblatex\" package. +If \"biblatex\" package is already required in the document, e.g., through +`org-latex-packages-alist' variable, these options are ignored." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(choice + (string :tag "Options (key=value,key2=value2...)") + (const :tag "No option" nil)) + :safe #'string-or-null-p) + + +;;; Internal functions +(defun org-cite-biblatex--package-options (initial style) + "Return options string for \"biblatex\" package. + +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)))))))) + (if (or options-no-style style-options) + (format "[%s]" + (mapconcat #'identity + (append options-no-style style-options) + ",")) + ""))) + +(defun org-cite-biblatex--multicite-p (citation) + "Non-nil when citation could make use of a \"multicite\" command." + (let ((references (org-cite-get-references citation))) + (and (< 1 (length references)) + (seq-some (lambda (r) + (or (org-element-property :prefix r) + (org-element-property :suffix r))) + references)))) + +(defun org-cite-biblatex--atomic-arguments (references info &optional no-opt) + "Build argument for the list of citation REFERENCES. +When NO-OPT argument is non-nil, only provide mandatory arguments." + (let ((mandatory + (format "{%s}" + (mapconcat (lambda (r) (org-element-property :key r)) + references + ",")))) + (if no-opt mandatory + (let* ((origin (pcase references + (`(,reference) reference) + (`(,reference . ,_) + (org-element-property :parent reference)))) + (suffix (org-element-property :suffix origin)) + (prefix (org-element-property :prefix origin))) + (concat (and prefix + (format "[%s]" (org-trim (org-export-data prefix info)))) + (cond + (suffix (format "[%s]" + (org-trim (org-export-data suffix info)))) + (prefix "[]") + (t nil)) + mandatory))))) + +(defun org-cite-biblatex--multi-arguments (citation info) + "Build \"multicite\" command arguments for CITATION object. +INFO is the export state, as a property list." + (let ((global-prefix (org-element-property :prefix citation)) + (global-suffix (org-element-property :suffix citation))) + (concat (and global-prefix + (format "(%s)" + (org-trim (org-export-data global-prefix info)))) + (cond + ;; Global pre/post-notes. + (global-suffix + (format "(%s)" + (org-trim (org-export-data global-suffix info)))) + (global-prefix "()") + (t nil)) + ;; All arguments. + (mapconcat (lambda (r) + (org-cite-biblatex--atomic-arguments (list r) info)) + (org-cite-get-references citation) + "") + ;; According to BibLaTeX manual, left braces or brackets + ;; following a multicite command could be parsed as other + ;; arguments. So we stop any further parsing by inserting + ;; a \relax unconditionally. + "\\relax"))) + +(defun org-cite-biblatex--command (citation info base &optional multi no-opt) + "Return biblatex command using BASE name for CITATION object. + +INFO is the export state, as a property list. + +When optional argument MULTI is non-nil, generate a \"multicite\" command when +appropriate. When optional argument NO-OPT is non-nil, do not add optional +arguments to the command." + (format "\\%s%s" + base + (if (and multi (org-cite-biblatex--multicite-p citation)) + (concat "s" (org-cite-biblatex--multi-arguments citation info)) + (org-cite-biblatex--atomic-arguments + (org-cite-get-references citation) info no-opt)))) + + +;;; Export capability +(defun org-cite-biblatex-export-bibliography (_keys _files _style props &rest _) + "Print references from bibliography. +PROPS is the local properties of the bibliography, as a property list." + (concat "\\printbibliography" + (and props + (let ((key nil) + (results nil)) + (dolist (datum props) + (cond + ((keywordp datum) + (when key (push key results)) + (setq key (substring (symbol-name datum) 1))) + (t + ;; Comma-separated values are associated to the + ;; same keyword. + (push (mapconcat (lambda (v) (concat key "=" v)) + (split-string datum "," t) + ",") + results) + (setq key nil)))) + (format "[%s]" + (mapconcat #'identity (nreverse results) ",")))))) + +(defun org-cite-biblatex-export-citation (citation style _ info) + "Export CITATION object. +STYLE is the citation style, as a pair of either strings or nil. +INFO is the export state, as a property list." + (apply + #'org-cite-biblatex--command citation info + (pcase style + ;; "author" style. + (`(,(or "author" "a") . ,variant) + (pcase variant + ((or "caps" "c") '("Citeauthor*")) + ((or "full" "f") '("citeauthor")) + ((or "caps-full" "cf") '("Citeauthor")) + (_ '("citeauthor*")))) + ;; "locators" style. + (`(,(or "locators" "l") . ,variant) + (pcase variant + ((or "bare" "b") '("notecite")) + ((or "caps" "c") '("Pnotecite")) + ((or "bare-caps" "bc") '("Notecite")) + (_ '("pnotecite")))) + ;; "noauthor" style. + (`(,(or "noauthor" "na") . ,_) '("autocite*")) + ;; "nocite" style. + (`(,(or "nocite" "n") . ,_) '("nocite" nil t)) + ;; "text" style. + (`(,(or "text" "t") . ,variant) + (pcase variant + ((or "caps" "c") '("Textcite" t)) + (_ '("textcite" t)))) + ;; Default "nil" style. + (`(,_ . ,variant) + (pcase variant + ((or "bare" "b") '("cite" t)) + ((or "caps" "c") '("Autocite" t)) + ((or "bare-caps" "bc") '("Cite" t)) + (_ '("autocite" t)))) + ;; This should not happen. + (_ (error "Invalid style: %S" style))))) + +(defun org-cite-biblatex-prepare-preamble (output _keys files style &rest _) + "Prepare document preamble for \"biblatex\" usage. + +OUTPUT is the final output of the export process. FILES is the list of file +names used as the bibliography. + +This function ensures \"biblatex\" package is required. It also adds resources +to the document, and set styles." + (with-temp-buffer + (save-excursion (insert output)) + (when (search-forward "\\begin{document}" nil t) + ;; Ensure there is a \usepackage{biblatex} somewhere or add one. + ;; Then set options. + (goto-char (match-beginning 0)) + (let ((re (rx "\\usepackage" + (opt (group "[" (*? anything) "]")) + "{biblatex}"))) + (cond + ;; No "biblatex" package loaded. Insert "usepackage" command + ;; with appropriate options, including style. + ((not (re-search-backward re nil t)) + (save-excursion + (insert + (format "\\usepackage%s{biblatex}\n" + (org-cite-biblatex--package-options + org-cite-biblatex-options style))))) + ;; "biblatex" package loaded, but without any option. + ;; Include style only. + ((not (match-beginning 1)) + (search-forward "{" nil t) + (insert (org-cite-biblatex--package-options nil style))) + ;; "biblatex" package loaded with some options set. Override + ;; style-related options with ours. + (t + (replace-match + (save-match-data + (org-cite-biblatex--package-options (match-string 1) style)) + nil nil nil 1)))) + ;; Insert resources below. + (forward-line) + (insert (mapconcat (lambda (f) + (format "\\addbibresource%s{%s}" + (if (org-url-p f) "[location=remote]" "") + f)) + files + "\n") + "\n")) + (buffer-string))) + + +;;; Register `biblatex' processor +(org-cite-register-processor 'biblatex + :export-bibliography #'org-cite-biblatex-export-bibliography + :export-citation #'org-cite-biblatex-export-citation + :export-finalizer #'org-cite-biblatex-prepare-preamble + :cite-styles + '((("author" "a") ("caps" "c") ("full" "f") ("caps-full" "cf")) + (("locators" "l") ("bare" "b") ("caps" "c") ("bare-caps" "bc")) + (("noauthor" "na")) + (("nocite" "n")) + (("text" "t") ("caps" "c")) + (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc")))) + +(provide 'oc-biblatex) +;;; oc-biblatex.el ends here diff --git a/elpa/org-9.5.2/oc-biblatex.elc b/elpa/org-9.5.2/oc-biblatex.elc new file mode 100644 index 0000000..22e74bc Binary files /dev/null and b/elpa/org-9.5.2/oc-biblatex.elc differ diff --git a/elpa/org-9.5.2/oc-csl.el b/elpa/org-9.5.2/oc-csl.el new file mode 100644 index 0000000..a92ea8a --- /dev/null +++ b/elpa/org-9.5.2/oc-csl.el @@ -0,0 +1,631 @@ +;;; oc-csl.el --- csl citation processor for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; This library registers the `csl' citation processor, which provides +;; the "export" capability for citations. + +;; The processor relies on the external Citeproc Emacs library, which must be +;; available prior to loading this library. + +;; By default, citations are rendered in Chicago author-date CSL style. You can +;; use another style file by specifying it in `org-cite-export-processors' or +;; from within the document by adding the file name to "cite_export" keyword +;; +;; #+cite_export: csl /path/to/style-file.csl +;; #+cite_export: csl "/path/to/style-file.csl" +;; +;; With the variable `org-cite-csl-styles-dir' set appropriately, the +;; above can even be shortened to +;; +;; #+cite_export: csl style-file.csl +;; +;; Styles can be downloaded, for instance, from the Zotero Style Repository +;; (). Dependent styles (which are not "unique" +;; in the Zotero Style Repository terminology) are not supported. + +;; The processor uses the "en-US" CSL locale file shipped with Org for rendering +;; localized dates and terms in the references, independently of the language +;; settings of the Org document. Additional CSL locales can be made available +;; by setting `org-cite-csl-locales-dir' to a directory containing the locale +;; files in question (see +;; for such files). + +;; Bibliography is defined with the "bibliography" keyword. It supports files +;; with ".bib", ".bibtex", and ".json" extensions. References are exported using +;; the "print_bibliography" keyword. + +;; The library supports the following citation styles: +;; +;; - author (a), including caps (c), full (f), and caps-full (cf) variants, +;; - noauthor (na), including bare (b), caps (c) and bare-caps (bc) variants, +;; - year (y), including a bare (b) variant, +;; - text (t). including caps (c), full (f), and caps-full (cf) variants, +;; - default style, including bare (b), caps (c) and bare-caps (bc) variants. + +;; CSL styles recognize "locator" in citation references' suffix. For example, +;; in the citation +;; +;; [cite:see @Tarski-1965 chapter 1, for an example] +;; +;; "chapter 1" is the locator. The whole citation is rendered as +;; +;; (see Tarski 1965, chap. 1 for an example) +;; +;; in the default CSL style. +;; +;; The locator starts with a locator term, among "bk.", "bks.", "book", "chap.", +;; "chaps.", "chapter", "col.", "cols.", "column", "figure", "fig.", "figs.", +;; "folio", "fol.", "fols.", "number", "no.", "nos.", "line", "l.", "ll.", +;; "note", "n.", "nn.", "opus", "op.", "opp.", "page", "p.", "pp.", "paragraph", +;; "para.", "paras.", "¶", "¶¶", "§", "§§", "part", "pt.", "pts.", "section", +;; "sec.", "secs.", "sub verbo", "s.v.", "s.vv.", "verse", "v.", "vv.", +;; "volume", "vol.", and "vols.". It ends with the last comma or digit in the +;; suffix, whichever comes last, or runs till the end of the suffix. +;; +;; The part of the suffix before the locator is appended to reference's prefix. +;; If no locator term is used, but a number is present, then "page" is assumed. + +;; This library was heavily inspired by and borrows from András Simonyi's +;; Citeproc Org () library. +;; Many thanks to him! + +;;; Code: +(require 'bibtex) +(require 'json) +(require 'oc) + +(require 'citeproc nil t) +(declare-function citeproc-style-cite-note "ext:citeproc") +(declare-function citeproc-proc-style "ext:citeproc") +(declare-function citeproc-bt-entry-to-csl "ext:citeproc") +(declare-function citeproc-locale-getter-from-dir "ext:citeproc") +(declare-function citeproc-create "ext:citeproc") +(declare-function citeproc-citation-create "ext:citeproc") +(declare-function citeproc-append-citations "ext:citeproc") +(declare-function citeproc-render-citations "ext:citeproc") +(declare-function citeproc-render-bib "ext:citeproc") +(declare-function citeproc-hash-itemgetter-from-any "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)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-put-property "org-element" (element property value)) + +(declare-function org-export-data "org-export" (data info)) +(declare-function org-export-derived-backend-p "org-export" (backend &rest backends)) +(declare-function org-export-get-footnote-number "org-export" (footnote info &optional data body-first)) + + +;;; Customization + +;;;; Location of CSL directories +(defcustom org-cite-csl-locales-dir nil + "Directory of CSL locale files. +If nil then only the fallback en-US locale will be available." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(choice + (directory :tag "Locales directory") + (const :tag "Use en-US locale only" nil)) + ;; It's not obvious to me that arbitrary locations are safe. +;;; :safe #'string-or-null-p + ) + +(defcustom org-cite-csl-styles-dir nil + "Directory of CSL style files. +When non-nil, relative style file names are expanded relatively to this +directory. This variable is ignored when style file is absolute." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(choice + (directory :tag "Styles directory") + (const :tag "Use absolute file names" nil)) + ;; It's not obvious to me that arbitrary locations are safe. +;;; :safe #'string-or-null-p + ) + +;;;; Citelinks +(defcustom org-cite-csl-link-cites t + "When non-nil, link cites to references." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'boolean + :safe #'booleanp) + +(defcustom org-cite-csl-no-citelinks-backends '(ascii) + "List of export back-ends for which cite linking is disabled. +Cite linking for export back-ends derived from any of the back-ends listed here, +is also disabled." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(repeat symbol)) + +;;;; Output-specific variables +(defcustom org-cite-csl-html-hanging-indent "1.5em" + "Size of hanging-indent for HTML output in valid CSS units." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'string + :safe #'stringp) + +(defcustom org-cite-csl-html-label-width-per-char "0.6em" + "Character width in CSS units for calculating entry label widths. +Used only when `second-field-align' is activated by the used CSL style." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'string + :safe #'stringp) + +(defcustom org-cite-csl-latex-hanging-indent "1.5em" + "Size of hanging-indent for LaTeX output in valid LaTeX units." + :group 'org-cite + :package-version '(Org . "9.5") + :type 'string + :safe #'stringp) + + +;;; Internal variables +(defconst org-cite-csl--etc-dir + (let ((oc-root (file-name-directory (locate-library "oc")))) + (cond + ;; First check whether it looks like we're running from the main + ;; Org repository. + ((let ((csl-org (expand-file-name "../etc/csl/" oc-root))) + (and (file-directory-p csl-org) csl-org))) + ;; Next look for the directory alongside oc.el because package.el + ;; and straight will put all of org-mode/lisp/ in org-mode/. + ((let ((csl-pkg (expand-file-name "etc/csl/" oc-root))) + (and (file-directory-p csl-pkg) csl-pkg))) + ;; Finally fall back the location used by shared system installs + ;; and when running directly from Emacs repository. + (t + (expand-file-name "org/csl/" data-directory)))) + "Directory containing CSL-related data files.") + +(defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir + "Fallback CSL locale files directory.") + +(defconst org-cite-csl--fallback-style-file + (expand-file-name "chicago-author-date.csl" + org-cite-csl--etc-dir) + "Default CSL style file, or nil. +If nil then the Chicago author-date style is used as a fallback.") + +(defconst org-cite-csl--label-alist + '(("bk." . "book") + ("bks." . "book") + ("book" . "book") + ("chap." . "chapter") + ("chaps." . "chapter") + ("chapter" . "chapter") + ("col." . "column") + ("cols." . "column") + ("column" . "column") + ("figure" . "figure") + ("fig." . "figure") + ("figs." . "figure") + ("folio" . "folio") + ("fol." . "folio") + ("fols." . "folio") + ("number" . "number") + ("no." . "number") + ("nos." . "number") + ("line" . "line") + ("l." . "line") + ("ll." . "line") + ("note" . "note") + ("n." . "note") + ("nn." . "note") + ("opus" . "opus") + ("op." . "opus") + ("opp." . "opus") + ("page" . "page") + ("p" . "page") + ("p." . "page") + ("pp." . "page") + ("paragraph" . "paragraph") + ("para." . "paragraph") + ("paras." . "paragraph") + ("¶" . "paragraph") + ("¶¶" . "paragraph") + ("part" . "part") + ("pt." . "part") + ("pts." . "part") + ("§" . "section") + ("§§" . "section") + ("section" . "section") + ("sec." . "section") + ("secs." . "section") + ("sub verbo" . "sub verbo") + ("s.v." . "sub verbo") + ("s.vv." . "sub verbo") + ("verse" . "verse") + ("v." . "verse") + ("vv." . "verse") + ("volume" . "volume") + ("vol." . "volume") + ("vols." . "volume")) + "Alist mapping locator names to locators.") + +(defconst org-cite-csl--label-regexp + ;; Prior to Emacs-27.1 argument of `regexp' form must be a string literal. + ;; It is the reason why `rx' is avoided here. + (rx-to-string + `(seq (or line-start space) + (regexp ,(regexp-opt (mapcar #'car org-cite-csl--label-alist) t)) + (0+ digit) + (or word-end line-end space " ")) + t) + "Regexp matching a label in a citation reference suffix. +Label is in match group 1.") + + +;;; Internal functions +(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. +INFO is the export state, as a property list." + (citeproc-style-cite-note + (citeproc-proc-style + (org-cite-csl--processor info)))) + +(defun org-cite-csl--create-structure-params (citation info) + "Return citeproc structure creation params for CITATION object. +STYLE is the citation style, as a string or nil. INFO is the export state, as +a property list." + (let ((style (org-cite-citation-style citation info))) + (pcase style + ;; "author" style. + (`(,(or "author" "a") . ,variant) + (pcase variant + ((or "caps" "c") '(:mode author-only :capitalize-first t)) + ((or "full" "f") '(:mode author-only :ignore-et-al t)) + ((or "caps-full" "cf") '(:mode author-only :capitalize-first t :ignore-et-al t)) + (_ '(:mode author-only)))) + ;; "noauthor" style. + (`(,(or "noauthor" "na") . ,variant) + (pcase variant + ((or "bare" "b") '(:mode suppress-author :suppress-affixes t)) + ((or "caps" "c") '(:mode suppress-author :capitalize-first t)) + ((or "bare-caps" "bc") + '(:mode suppress-author :suppress-affixes t :capitalize-first t)) + (_ '(:mode suppress-author)))) + ;; "year" style. + (`(,(or "year" "y") . ,variant) + (pcase variant + ((or "bare" "b") '(:mode year-only :suppress-affixes t)) + (_ '(:mode year-only)))) + ;; "text" style. + (`(,(or "text" "t") . ,variant) + (pcase variant + ((or "caps" "c") '(:mode textual :capitalize-first t)) + ((or "full" "f") '(:mode textual :ignore-et-al t)) + ((or "caps-full" "cf") '(:mode textual :ignore-et-al t :capitalize-first t)) + (_ '(:mode textual)))) + ;; Default "nil" style. + (`(,_ . ,variant) + (pcase variant + ((or "caps" "c") '(:capitalize-first t)) + ((or "bare" "b") '(:suppress-affixes t)) + ((or "bare-caps" "bc") '(:suppress-affixes t :capitalize-first t)) + (_ nil))) + ;; This should not happen. + (_ (error "Invalid style: %S" style))))) + +(defun org-cite-csl--no-citelinks-p (info) + "Non-nil when export BACKEND should not create cite-reference links." + (or (not org-cite-csl-link-cites) + (and org-cite-csl-no-citelinks-backends + (apply #'org-export-derived-backend-p + (plist-get info :back-end) + org-cite-csl-no-citelinks-backends)) + ;; No references are being exported anyway. + (not (org-element-map (plist-get info :parse-tree) 'keyword + (lambda (k) + (equal "PRINT_BIBLIOGRAPHY" (org-element-property :key k))) + info t)))) + +(defun org-cite-csl--output-format (info) + "Return expected Citeproc's output format. +INFO is the export state, as a property list. The return value is a symbol +corresponding to one of the output formats supported by Citeproc: `html', +`latex', or `org'." + (let ((backend (plist-get info :back-end))) + (cond + ((org-export-derived-backend-p backend 'html) 'html) + ((org-export-derived-backend-p backend 'latex) 'latex) + (t 'org)))) + +(defun org-cite-csl--style-file (info) + "Return style file associated to current export process. + +INFO is the export state, as a property list. + +When file name is relative, expand it according to `org-cite-csl-styles-dir', +or raise an error if the variable is unset." + (pcase (org-cite-bibliography-style info) + ('nil org-cite-csl--fallback-style-file) + ((and (pred file-name-absolute-p) file) file) + ((and (guard org-cite-csl-styles-dir) file) + (expand-file-name file org-cite-csl-styles-dir)) + (other + (user-error "Cannot handle relative style file name: %S" other)))) + +(defun org-cite-csl--locale-getter () + "Return a locale getter. +The getter looks for locales in `org-cite-csl-locales-dir' directory. If it +cannot find them, it retrieves the default \"en_US\" from +`org-cite-csl--fallback-locales-dir'." + (lambda (loc) + (or (and org-cite-csl-locales-dir + (ignore-errors + (funcall (citeproc-locale-getter-from-dir org-cite-csl-locales-dir) + loc))) + (funcall (citeproc-locale-getter-from-dir + org-cite-csl--fallback-locales-dir) + loc)))) + +(defun org-cite-csl--processor (info) + "Return Citeproc processor reading items from current bibliography. + +INFO is the export state, as a property list. + +Newly created processor is stored as the value of the `:cite-citeproc-processor' +property in INFO." + (or (plist-get info :cite-citeproc-processor) + (let* ((bibliography (plist-get info :bibliography)) + (locale (or (plist-get info :language) "en_US")) + (processor + (citeproc-create + (org-cite-csl--style-file info) + (citeproc-hash-itemgetter-from-any bibliography) + (org-cite-csl--locale-getter) + locale))) + (plist-put info :cite-citeproc-processor processor) + processor))) + +(defun org-cite-csl--parse-reference (reference info) + "Return Citeproc's structure associated to citation REFERENCE. + +INFO is the export state, as a property list. + +The result is a association list. Keys are: `id', `prefix',`suffix', +`location', `locator' and `label'." + (let (label location-start locator-start location locator prefix suffix) + ;; Parse suffix. Insert it in a temporary buffer to find + ;; different parts: pre-label, label, locator, location (label + + ;; locator), and suffix. + (with-temp-buffer + (save-excursion + (insert (org-element-interpret-data + (org-element-property :suffix reference)))) + (cond + ((re-search-forward org-cite-csl--label-regexp nil t) + (setq location-start (match-beginning 0)) + (setq label (cdr (assoc (match-string 1) org-cite-csl--label-alist))) + (goto-char (match-end 1)) + (skip-chars-forward "[:space:] ") + (setq locator-start (point))) + ((re-search-forward (rx digit) nil t) + (setq location-start (match-beginning 0)) + (setq label "page") + (setq locator-start location-start)) + (t + (setq suffix (org-element-property :suffix reference)))) + ;; Find locator's end, and suffix, if any. To that effect, look + ;; for the last comma or digit after label, whichever comes + ;; last. + (unless suffix + (goto-char (point-max)) + (let ((re (rx (or "," (group digit))))) + (when (re-search-backward re location-start t) + (goto-char (or (match-end 1) (match-beginning 0))) + (setq location (buffer-substring location-start (point))) + (setq locator (org-trim (buffer-substring locator-start (point)))) + ;; Skip comma in suffix. + (setq suffix + (org-cite-parse-objects + (buffer-substring (match-end 0) (point-max)) + t))))) + (setq prefix + (org-cite-concat + (org-element-property :prefix reference) + (and location-start + (org-cite-parse-objects + (buffer-substring 1 location-start) + t))))) + ;; Return value. + (let ((export + (lambda (data) + (org-string-nw-p + (org-trim + ;; When Citeproc exports to Org syntax, avoid mix and + ;; matching output formats by also generating Org + ;; syntax for prefix and suffix. + (if (eq 'org (org-cite-csl--output-format info)) + (org-element-interpret-data data) + (org-export-data data info))))))) + `((id . ,(org-element-property :key reference)) + (prefix . ,(funcall export prefix)) + (suffix . ,(funcall export suffix)) + (locator . ,locator) + (label . ,label) + (location . ,location))))) + +(defun org-cite-csl--create-structure (citation info) + "Create Citeproc structure for CITATION object. +INFO is the export state, as a property list." + (let* ((cites (mapcar (lambda (r) + (org-cite-csl--parse-reference r info)) + (org-cite-get-references citation))) + (footnote (org-cite-inside-footnote-p citation))) + ;; Global prefix is inserted in front of the prefix of the first + ;; reference. + (let ((global-prefix (org-element-property :prefix citation))) + (when global-prefix + (let* ((first (car cites)) + (prefix-item (assq 'prefix first))) + (setcdr prefix-item + (concat (org-element-interpret-data global-prefix) + " " + (cdr prefix-item)))))) + ;; Global suffix is appended to the suffix of the last reference. + (let ((global-suffix (org-element-property :suffix citation))) + (when global-suffix + (let* ((last (org-last cites)) + (suffix-item (assq 'suffix last))) + (setcdr suffix-item + (concat (cdr suffix-item) + " " + (org-element-interpret-data global-suffix)))))) + ;; Check if CITATION needs wrapping, i.e., it should be wrapped in + ;; a footnote, but isn't yet. + (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))) + ;; Return structure. + (apply #'citeproc-citation-create + `(:note-index + ,(and footnote (org-export-get-footnote-number footnote info)) + :cites ,cites + ,@(org-cite-csl--create-structure-params citation info))))) + +(defun org-cite-csl--rendered-citations (info) + "Return the rendered citations as an association list. + +INFO is the export state, as a property list. + +Return an alist (CITATION . OUTPUT) where CITATION object has been rendered as +OUTPUT using Citeproc." + (or (plist-get info :cite-citeproc-rendered-citations) + (let* ((citations (org-cite-list-citations info)) + (processor (org-cite-csl--processor info)) + (structures + (mapcar (lambda (c) (org-cite-csl--create-structure c info)) + citations))) + (citeproc-append-citations structures processor) + (let* ((rendered + (citeproc-render-citations + processor + (org-cite-csl--output-format info) + (org-cite-csl--no-citelinks-p info))) + (result (seq-mapn #'cons citations rendered))) + (plist-put info :cite-citeproc-rendered-citations result) + result)))) + + +;;; Export capability +(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) + (let ((output (cdr (assq citation (org-cite-csl--rendered-citations info))))) + (if (not (eq 'org (org-cite-csl--output-format info))) + output + ;; Parse Org output to re-export it during the regular export + ;; process. + (org-cite-parse-objects output)))) + +(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) + (pcase-let* ((format (org-cite-csl--output-format info)) + (`(,output . ,parameters) + (citeproc-render-bib + (org-cite-csl--processor info) + format + (org-cite-csl--no-citelinks-p info)))) + (pcase format + ('html + (concat + (and (cdr (assq 'second-field-align parameters)) + (let* ((max-offset (cdr (assq 'max-offset parameters))) + (char-width + (string-to-number org-cite-csl-html-label-width-per-char)) + (char-width-unit + (progn + (string-match (number-to-string char-width) + org-cite-csl-html-label-width-per-char) + (substring org-cite-csl-html-label-width-per-char + (match-end 0))))) + (format + "" + (* max-offset char-width) + char-width-unit))) + (and (cdr (assq 'hanging-indent parameters)) + (format + "" + org-cite-csl-html-hanging-indent + org-cite-csl-html-hanging-indent)) + output)) + ('latex + (if (cdr (assq 'hanging-indent parameters)) + (format "\\begin{hangparas}{%s}{1}\n%s\n\\end{hangparas}" + org-cite-csl-latex-hanging-indent + output) + output)) + (_ + ;; Parse Org output to re-export it during the regular export + ;; process. + (org-cite-parse-elements output))))) + +(defun org-cite-csl-finalizer (output _keys _files _style _backend info) + "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) + (if (not (eq 'latex (org-cite-csl--output-format info))) + output + (with-temp-buffer + (save-excursion (insert output)) + (when (search-forward "\\begin{document}" nil t) + (goto-char (match-beginning 0)) + ;; Ensure that \citeprocitem is defined for citeproc-el. + (insert "\\makeatletter\n\\newcommand{\\citeprocitem}[2]{\\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\\hyper@linkend}\n\\makeatother\n\n") + ;; Ensure there is a \usepackage{hanging} somewhere or add one. + (let ((re (rx "\\usepackage" (opt "[" (*? nonl) "]") "{hanging}"))) + (unless (re-search-backward re nil t) + (insert "\\usepackage[notquote]{hanging}\n")))) + (buffer-string)))) + + +;;; Register `csl' processor +(org-cite-register-processor 'csl + :export-citation #'org-cite-csl-render-citation + :export-bibliography #'org-cite-csl-render-bibliography + :export-finalizer #'org-cite-csl-finalizer + :cite-styles + '((("author" "a") ("full" "f") ("caps" "c") ("caps-full" "cf")) + (("noauthor" "na") ("bare" "b") ("caps" "c") ("bare-caps" "bc")) + (("year" "y") ("bare" "b")) + (("text" "t") ("caps" "c") ("full" "f") ("caps-full" "cf")) + (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc")))) + +(provide 'oc-csl) +;;; oc-csl.el ends here diff --git a/elpa/org-9.5.2/oc-csl.elc b/elpa/org-9.5.2/oc-csl.elc new file mode 100644 index 0000000..b794445 Binary files /dev/null and b/elpa/org-9.5.2/oc-csl.elc differ diff --git a/elpa/org-9.5.2/oc-natbib.el b/elpa/org-9.5.2/oc-natbib.el new file mode 100644 index 0000000..bf086f3 --- /dev/null +++ b/elpa/org-9.5.2/oc-natbib.el @@ -0,0 +1,193 @@ +;;; oc-natbib.el --- Citation processor using natbib LaTeX package -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; This library registers the `natbib' citation processor, which provides the +;; "export" capability for citations. + +;; The processor relies on "natbib" LaTeX package. As such it ensures that the +;; package is properly required in the document's preamble. More accurately, it +;; will use any "\\usepackage{natbib}" command already present in the document +;; (e.g., through `org-latex-packages-alist'), or insert one using options +;; defined in `org-cite-natbib-options'. + +;; It supports the following citation styles: +;; +;; - author (a), including caps (c), and full (f) variants, +;; - noauthor (na), including bare (b) variant, +;; - text (t), including bare (b), caps (c), full (f), bare-caps (bc), +;; bare-full (bf), caps-full (cf), and bare-caps-full (bcf) variants, +;; - default, including bare (b), caps (c), full (f), bare-caps (bc), +;; bare-full (bf), caps-full (cf), and bare-caps-full (bcf) variants. + +;; Bibliography accepts any style supported by "natbib" package. + +;;; Code: +(require 'oc) + +(declare-function org-element-property "org-element" (property element)) + +(declare-function org-export-data "org-export" (data info)) + + +;;; Customization +(defcustom org-cite-natbib-options nil + "List of options added to \"natbib\" package. +If \"natbib\" package is already required in the document, e.g., through +`org-latex-packages-alist' variable, these options are ignored." + :group 'org-cite + :package-version '(Org . "9.5") + :type + '(set + (const :tag "use round parentheses (default)" round) + (const :tag "use square brackets" square) + (const :tag "use curly braces" curly) + (const :tag "use angle brackets" angle) + (const :tag "separate multiple citations with colons (default)" colon) + (const :tag "separate multiple citations with comas" comma) + (const :tag "generate author-year citations" authoryear) + (const :tag "generate numerical citations" numbers) + (const :tag "generate superscripted numerical citations" super) + (const :tag "order multiple citations according to the list of references" sort) + (const :tag "order as above, but numerical citations are compressed if possible" sort&compress) + (const :tag "display full author list on first citation, abbreviate the others" longnamesfirst) + (const :tag "redefine \\thebibliography to issue \\section* instead of \\chapter*" sectionbib) + (const :tag "keep all the authors' names in a citation on one line" nonamebreak))) + + +;;; Internal functions +(defun org-cite-natbib--style-to-command (style) + "Return command name to use according to STYLE pair." + (pcase style + ;; "author" style. + (`(,(or "author" "a") . ,variant) + (pcase variant + ((or "caps" "c") "\\Citeauthor") + ((or "full" "f") "\\citeauthor*") + (_ "\\citeauthor"))) + ;; "noauthor" style. + (`(,(or "noauthor" "na") . ,variant) + (pcase variant + ((or "bare" "b") "\\citeyear") + (_ "\\citeyearpar"))) + ;; "nocite" style. + (`(,(or "nocite" "n") . ,_) "\\nocite") + ;; "text" style. + (`(,(or "text" "t") . ,variant) + (pcase variant + ((or "bare" "b") "\\citealt") + ((or "caps" "c") "\\Citet") + ((or "full" "f") "\\citet*") + ((or "bare-caps" "bc") "\\Citealt") + ((or "bare-full" "bf") "\\citealt*") + ((or "caps-full" "cf") "\\Citet*") + ((or "bare-caps-full" "bcf") "\\Citealt*") + (_ "\\citet"))) + ;; Default ("nil") style. + (`(,_ . ,variant) + (pcase variant + ((or "bare" "b") "\\citealp") + ((or "caps" "c") "\\Citep") + ((or "full" "f") "\\citep*") + ((or "bare-caps" "bc") "\\Citealp") + ((or "bare-full" "bf") "\\citealp*") + ((or "caps-full" "cf") "\\Citep*") + ((or "bare-caps-full" "bcf") "\\Citealp*") + (_ "\\citep"))) + ;; This should not happen. + (_ (error "Invalid style: %S" style)))) + +(defun org-cite-natbib--build-optional-arguments (citation info) + "Build optional arguments for citation command. +CITATION is the citation object. INFO is the export state, as a property list." + (pcase-let ((`(,prefix . ,suffix) (org-cite-main-affixes citation))) + (concat (and prefix (format "[%s]" (org-trim (org-export-data prefix info)))) + (cond + (suffix (format "[%s]" (org-trim (org-export-data suffix info)))) + (prefix "[]") + (t nil))))) + +(defun org-cite-natbib--build-arguments (citation) + "Build arguments for citation command for CITATION object." + (format "{%s}" + (mapconcat #'identity + (org-cite-get-references citation t) + ","))) + + +;;; Export capability +(defun org-cite-natbib-export-bibliography (_keys files style &rest _) + "Print references from bibliography FILES. +FILES is a list of absolute file names. STYLE is the bibliography style, as +a string or nil." + (concat (and style (format "\\bibliographystyle{%s}\n" style)) + (format "\\bibliography{%s}" + (mapconcat #'file-name-sans-extension + files + ",")))) + +(defun org-cite-natbib-export-citation (citation style _ info) + "Export CITATION object. +STYLE is the citation style, as a pair of strings or nil. INFO is the export +state, as a property list." + (concat (org-cite-natbib--style-to-command style) + (org-cite-natbib--build-optional-arguments citation info) + (org-cite-natbib--build-arguments citation))) + +(defun org-cite-natbib-use-package (output &rest _) + "Ensure output requires \"natbib\" package. +OUTPUT is the final output of the export process." + (with-temp-buffer + (save-excursion (insert output)) + (when (search-forward "\\begin{document}" nil t) + ;; Ensure there is a \usepackage{natbib} somewhere or add one. + (goto-char (match-beginning 0)) + (let ((re (rx "\\usepackage" (opt "[" (*? nonl) "]") "{natbib}"))) + (unless (re-search-backward re nil t) + (insert + (format "\\usepackage%s{natbib}\n" + (if (null org-cite-natbib-options) + "" + (format "[%s]" + (mapconcat #'symbol-name + org-cite-natbib-options + ",")))))))) + (buffer-string))) + + +;;; Register `natbib' processor +(org-cite-register-processor 'natbib + :export-bibliography #'org-cite-natbib-export-bibliography + :export-citation #'org-cite-natbib-export-citation + :export-finalizer #'org-cite-natbib-use-package + :cite-styles + '((("author" "a") ("caps" "a") ("full" "f")) + (("noauthor" "na") ("bare" "b")) + (("text" "t") + ("bare" "b") ("caps" "c") ("full" "f") ("bare-caps" "bc") + ("bare-full" "bf") ("caps-full" "cf") ("bare-caps-full" "bcf")) + (("nil") + ("bare" "b") ("caps" "c") ("full" "f") ("bare-caps" "bc") + ("bare-full" "bf") ("caps-full" "cf") ("bare-caps-full" "bcf")))) + +(provide 'oc-natbib) +;;; oc-natbib.el ends here diff --git a/elpa/org-9.5.2/oc-natbib.elc b/elpa/org-9.5.2/oc-natbib.elc new file mode 100644 index 0000000..8f465ff Binary files /dev/null and b/elpa/org-9.5.2/oc-natbib.elc differ diff --git a/elpa/org-9.5.2/oc.el b/elpa/org-9.5.2/oc.el new file mode 100644 index 0000000..a77daa7 --- /dev/null +++ b/elpa/org-9.5.2/oc.el @@ -0,0 +1,1650 @@ +;;; oc.el --- Org Cite library -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; This library provides tooling to handle citations in Org, e.g, +;; activate, follow, insert, and export them, respectively called +;; "activate", "follow", "insert" and "export" capabilities. +;; Libraries responsible for providing some, or all, of these +;; capabilities are called "citation processors". + +;; Such processors are defined using `org-cite-register-processor'. +;; Using this function, it is possible, in addition to giving it a +;; name, to attach functions associated to capabilities. As such, a +;; processor handling citation export must set the `:export-citation' +;; property to an appropriate function. Likewise, "activate" +;; capability requires an appropriate `:activate' property, "insert" +;; requires `:insert' property and, unsurprisingly, "follow" +;; capability implies `:follow' property. + +;; As a user, the first thing to do is setting a bibliography, either +;; globally with `org-cite-global-bibliography', or locally using one +;; or more "bibliography" keywords. Then one can select any +;; registered processor for each capability by providing a processor +;; name to the variables `org-cite-activate-processor' and +;; `org-cite-follow-processor'. + +;; The "export" capability is slightly more involved as one need to +;; select the processor providing it, but may also provide a default +;; style for citations and bibliography. Also, the choice of an +;; export processor may depend of the current export back-end. The +;; association between export back-ends and triplets of parameters can +;; be set in `org-cite-export-processors' variable, or in a document, +;; through the "cite_export" keyword. + +;; Eventually, this library provides some tools, mainly targeted at +;; processor implementors. Most are export-specific and are located +;; in the "Tools only available during export" and "Tools generating +;; or operating on parsed data" sections. + +;; The few others can be used directly from an Org buffer, or operate +;; on processors. See "Generic tools" section. + +;;; Code: + +(require 'org-compat) +(require 'org-macs) +(require 'seq) + +(declare-function org-at-heading-p "org" (&optional _)) +(declare-function org-collect-keywords "org" (keywords &optional unique directory)) + +(declare-function org-element-adopt-elements "org-element" (parent &rest children)) +(declare-function org-element-citation-parser "org-element" ()) +(declare-function org-element-citation-reference-parser "org-element" ()) +(declare-function org-element-class "org-element" (datum &optional parent)) +(declare-function org-element-contents "org-element" (element)) +(declare-function org-element-create "org-element" (type &optional props &rest children)) +(declare-function org-element-extract-element "org-element" (element)) +(declare-function org-element-insert-before "org-element" (element location)) +(declare-function org-element-lineage "org-element" (datum &optional types with-self)) +(declare-function org-element-map "org-element" (data types fun &optional info first-match no-recursion with-affiliated)) +(declare-function org-element-normalize-string "org-element" (s)) +(declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only)) +(declare-function org-element-parse-secondary-string "org-element" (string restriction &optional parent)) +(declare-function org-element-context "org-element" (&optional element)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-put-property "org-element" (element property value)) +(declare-function org-element-restriction "org-element" (element)) +(declare-function org-element-set-element "org-element" (old new)) +(declare-function org-element-type "org-element" (element)) + +(declare-function org-export-derived-backend-p "org-export" (backend &rest backends)) +(declare-function org-export-get-next-element "org-export" (blob info &optional n)) +(declare-function org-export-get-previous-element "org-export" (blob info &optional n)) +(declare-function org-export-raw-string "org-export" (s)) + +(defvar org-complex-heading-regexp) +(defvar org-element-all-objects) +(defvar org-element-citation-key-re) +(defvar org-element-citation-prefix-re) +(defvar org-element-parsed-keywords) + + +;;; Constants +;; Borrowed from "citeproc.el" library. +(defconst org-cite--default-region-alist + '(("af" . "za") ("ca" . "ad") ("cs" . "cz") ("cy" . "gb") + ("da" . "dk") ("el" . "gr") ("et" . "ee") ("fa" . "ir") + ("he" . "ir") ("ja" . "jp") ("km" . "kh") ("ko" . "kr") + ("nb" . "no") ("nn" . "no") ("sl" . "si") ("sr" . "rs") + ("sv" . "se") ("uk" . "ua") ("vi" . "vn") ("zh" . "cn")) + "Alist mapping those languages to their default region. +Only those languages are given for which the default region is not simply the +result of duplicating the language part.") + + +;;; Configuration variables +(defgroup org-cite nil + "Options concerning citations in Org mode." + :group 'org + :tag "Org Cite") + +(defcustom org-cite-global-bibliography nil + "List of bibliography files available in all documents. +File names must be absolute." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(choice (const :tag "No global bibliography" nil) + (repeat :tag "List of bibliography files" + (file :tag "Bibliography")))) + +(defcustom org-cite-activate-processor 'basic + "Processor used for activating citations, as a symbol." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(choice (const :tag "Default fontification" nil) + (symbol :tag "Citation processor"))) + +(defcustom org-cite-export-processors '((t basic)) + "Processor used for exporting citations, as a triplet, or nil. + +When nil, citations and bibliography are not exported. + +When non-nil, the value is an association list between export back-ends and +citation export processors: + + (BACK-END . PROCESSOR) + +where BACK-END is the name of an export back-end or t, and PROCESSOR is a +triplet following the pattern + + (NAME BIBLIOGRAPHY-STYLE CITATION-STYLE) + +There, NAME is the name of a registered citation processor providing export +functionality, as a symbol. BIBLIOGRAPHY-STYLE (respectively CITATION-STYLE) +is the desired default style to use when printing a bibliography (respectively +exporting a citation), as a string or nil. Both BIBLIOGRAPHY-STYLE and +CITATION-STYLE are optional. NAME is mandatory. + +The export process selects the citation processor associated to the current +export back-end, or the most specific back-end the current one is derived from, +or, if all are inadequate, to the processor associated to t. For example, with +the following value + + ((beamer natbib) + (latex biblatex) + (t csl)) + +exporting with `beamer' or any back-end derived from it will use `natbib', +whereas exporting with `latex' or any back-end derived from it but different +from `beamer' will use `biblatex' processor. Any other back-end, such as +`html', will use `csl' processor. + +CITATION-STYLE is overridden by adding a style to any citation object. A nil +style lets the export processor choose the default output. Any style not +recognized by the export processor is equivalent to nil. + +The citation triplet can also be set with the CITE_EXPORT keyword. +E.g., + + #+CITE_EXPORT: basic note numeric + +or + + #+CITE_EXPORT: basic + +In that case, `basic' processor is used on every export, independently on the +back-end." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(choice (const :tag "No export" nil) + (alist :key-type symbol + :value-type + (list :tag "Citation processor" + (symbol :tag "Processor name") + (choice + (const :tag "Default bibliography style" nil) + (string :tag "Use specific bibliography style")) + (choice + (const :tag "Default citation style" nil) + (string :tag "Use specific citation style")))))) + +(defcustom org-cite-follow-processor 'basic + "Processor used for following citations, as a symbol." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(choice (const :tag "No following" nil) + (symbol :tag "Citation processor"))) + +(defcustom org-cite-insert-processor 'basic + "Processor used for inserting citations, as a symbol." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(choice (const :tag "No insertion" nil) + (symbol :tag "Citation processor"))) + +(defcustom org-cite-adjust-note-numbers t + "When non-nil, allow process to modify location of note numbers. + +When this variable is non-nil, it is possible to swap between author-date and +note style without modifying the document. To that effect, citations should +always be located as in an author-date style. Prior to turning the citation +into a footnote, the citation processor moves the citation (i.e., the future +note number), and the surrounding punctuation, according to rules defined in +`org-cite-note-rules'. + +When nil, the note number is not moved." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(choice (const :tag "Automatic note number location" t) + (const :tag "Place note numbers manually" nil)) + :safe #'booleanp) + +(defcustom org-cite-note-rules + '(("en-us" inside outside after) + ("fr" adaptive same before)) + "Alist between languages and typographic rules for citations in note style. + +When `org-cite-adjust-note-numbers' is non-nil, and note style is requested, +citation processor is allowed to move the note marker according to some specific +rules, detailed here. More accurately, a rule is a list following the pattern + + (LANGUAGE-TAG . RULE) + + LANGUAGE-TAG is a down-cased string representing a language tag as defined in + RFC 4646. It may constituted of a language and a region separated with an + hyphen (e.g., \"en-us\"), or the language alone (e.g., \"fr\"). A language + without a region applies to all regions. + + RULE is a triplet + + (PUNCTUATION NUMBER ORDER) + + PUNCTUATION is the desired location of the punctuation with regards to the + quotation, if any. It may be `inside', `outside', or `adaptive'. The latter + permits subtler control over the punctuation: when there is no space between + the quotation mark and the punctuation, it is equivalent to `inside'. + Otherwise, it means `outside', as illustrated in the following examples: + + \"A quotation ending without punctuation\" [cite:@org21]. + \"A quotation ending with a period\"[cite:@org21]. + + Notwithstanding the above, a space always appear before the citation when it + is to become anything else than a note. + + NUMBER is the desired location of the note number with regards to the + quotation mark, if any. It may be `inside', `outside', or `same'. When set + to `same', the number appears on the same side as the punctuation, unless + there is punctuation on both sides or on none. + + ORDER is the relative position of the citation with regards to the closest + punctuation. It may be `after' or `before'. + +For example (adaptive same before) corresponds to French typography. + +When the locale is unknown to this variable, the default rule is: + + (adaptive outside after) + +This roughly follows the Oxford Guide to Style recommendations." + :group 'org-cite + :package-version '(Org . "9.5") + :type + '(repeat + (list :tag "Typographic rule" + (string :tag "Language code") + (choice :tag "Location of punctuation" + (const :tag "Punctuation inside quotation" inside) + (const :tag "Punctuation outside quotation" outside) + (const :tag "Location depends on spacing" adaptive)) + (choice :tag "Location of citation" + (const :tag "Citation inside quotation" inside) + (const :tag "Citation outside quotation" outside) + (const :tag "Citation next to punctuation" same)) + (choice :tag "Order of citation and punctuation" + (const :tag "Citation first" before) + (const :tag "Citation last" after))))) + +(defcustom org-cite-punctuation-marks '("." "," ";" ":" "!" "?") + "List of strings that can be moved around when placing note numbers. + +When `org-cite-adjust-note-numbers' is non-nil, the citation processor is +allowed to shuffle punctuation marks specified in this list in order to +place note numbers according to rules defined in `org-cite-note-rules'." + :group 'org-cite + :package-version '(Org . "9.5") + :type '(repeat string)) + + +;;; Citation processors +(cl-defstruct (org-cite-processor (:constructor org-cite--make-processor) + (:copier nil)) + (name nil :read-only t) + (activate nil :read-only t) + (cite-styles nil :read-only t) + (export-bibliography nil :read-only t) + (export-citation nil :read-only t) + (export-finalizer nil :read-only t) + (follow nil :read-only t) + (insert nil :read-only t)) + +(defvar org-cite--processors nil + "List of registered citation processors. +See `org-cite-register-processor' for more information about +processors.") + +(defun org-cite--get-processor (name) + "Return citation processor named after symbol NAME. +Return nil if no such processor is found." + (seq-find (lambda (p) (eq name (org-cite-processor-name p))) + org-cite--processors)) + +(defun org-cite-register-processor (name &rest body) + "Mark citation processor NAME as available. + +NAME is a symbol. BODY is a property list, where the following +optional keys can be set: + + `:activate' + + Function activating a citation. It is called with a single + argument: a citation object extracted from the current + buffer. It may add text properties to the buffer. If it is + not provided, `org-cite-fontify-default' is used. + + `:export-bibliography' + + Function rendering a bibliography. It is called with six + arguments: the list of citation keys used in the document, as + strings, a list of bibliography files, the style, as a string + or nil, the local properties, as a property list, the export + back-end, as a symbol, and the communication channel, as a + property list. + + It is called at each \"print_bibliography\" keyword in the + parse tree. It may return a string, a parsed element, a list + of parsed elements, or nil. When it returns nil, the keyword + is ignored. Otherwise, the value it returns replaces the + keyword in the export output. + + `:export-citation' (mandatory for \"export\" capability) + + Function rendering citations. It is called with four + arguments: a citation object, the style, as a pair, the + export back-end, as a symbol, and the communication channel, + as a property list. + + It is called on each citation object in the parse tree. It + may return a string, a parsed object, a secondary string, or + nil. When it returns nil, the citation is ignored. + Otherwise, the value it returns replaces the citation object + in the export output. + + `:export-finalizer' + + Function called at the end of export process. It must accept + six arguments: the output, as a string, a list of citation + keys used in the document, a list of bibliography files, the + expected bibliography style, as a string or nil, the export + back-end, as a symbol, and the communication channel, as a + property list. + + It must return a string, which will become the final output + from the export process, barring subsequent modifications + from export filters. + + `:follow' + + Function called to follow a citation. It accepts two + arguments, the citation or citation reference object at + point, and any prefix argument received during interactive + call of `org-open-at-point'. + + `:insert' + + Function called to insert a citation. It accepts two + arguments, the citation or citation reference object at point + or nil, and any prefix argument received. + + `:cite-styles' + + When the processor has export capability, the value can + specify what cite styles, variants, and their associated + shortcuts are supported. It can be useful information for + completion or linting. + + The expected format is + + ((STYLE . SHORTCUTS) . VARIANTS)) + + where STYLE is a string, SHORTCUTS a list of strings or nil, + and VARIANTS is a list of pairs (VARIANT . SHORTCUTS), + VARIANT being a string and SHORTCUTS a list of strings or + nil. + + The \"nil\" style denotes the processor fall-back style. It + should have a corresponding entry in the value. + +Return a non-nil value on a successful operation." + (declare (indent 1)) + (unless (and name (symbolp name)) + (error "Invalid processor name: %S" name)) + (when (org-cite--get-processor name) + (org-cite-unregister-processor name)) + (push (apply #'org-cite--make-processor :name name body) + org-cite--processors)) + +(defun org-cite-unregister-processor (name) + "Unregister citation processor NAME. +NAME is a symbol. Raise an error if processor is not registered. +Return a non-nil value on a successful operation." + (unless (and name (symbolp name)) + (error "Invalid processor name: %S" name)) + (pcase (org-cite--get-processor name) + ('nil (error "Processor %S not registered" name)) + (processor + (setq org-cite--processors (delete processor org-cite--processors)))) + t) + +(defun org-cite-processor-has-capability-p (processor capability) + "Return non-nil if PROCESSOR is able to handle CAPABILITY. +PROCESSOR is the name of a cite processor, as a symbol. CAPABILITY is +`activate', `export', `follow', or `insert'." + (let ((p (org-cite--get-processor processor))) + (pcase capability + ((guard (not p)) nil) ;undefined processor + ('activate (functionp (org-cite-processor-activate p))) + ('export (functionp (org-cite-processor-export-citation p))) + ('follow (functionp (org-cite-processor-follow p))) + ('insert (functionp (org-cite-processor-insert p))) + (other (error "Invalid capability: %S" other))))) + + +;;; Internal functions +(defun org-cite--set-post-blank (datum blanks) + "Set `:post-blank' property from element or object before DATUM to BLANKS. +DATUM is an element or object. BLANKS is an integer. DATUM is modified +by side-effect." + (if (not (eq 'plain-text (org-element-type datum))) + (org-element-put-property datum :post-blank blanks) + ;; Remove any blank from string before DATUM so it is exported + ;; with exactly BLANKS white spaces. + (org-element-set-element + datum + (replace-regexp-in-string + "[ \t\n]*\\'" (make-string blanks ?\s) datum)))) + +(defun org-cite--set-previous-post-blank (datum blanks info) + "Set `:post-blank' property from element or object before DATUM to BLANKS. +DATUM is an element or object. BLANKS is an integer. INFO is the export +state, as a property list. Previous element or object, if any, is modified by +side-effect." + (let ((previous (org-export-get-previous-element datum info))) + (when previous + (org-cite--set-post-blank previous blanks)))) + +(defun org-cite--insert-at-split (s citation n regexp) + "Split string S and insert CITATION object between the two parts. +S is split at beginning of match group N upon matching REGEXP against it. +This function assumes S precedes CITATION." + ;; When extracting the citation, remove white spaces before it, but + ;; preserve those after it. + (let ((post-blank (org-element-property :post-blank citation))) + (when (and post-blank (> post-blank 0)) + (org-element-insert-before (make-string post-blank ?\s) citation))) + (org-element-insert-before + (org-element-put-property (org-element-extract-element citation) + :post-blank 0) + s) + (string-match regexp s) + (let* ((split (match-beginning n)) + (first-part (substring s nil split)) + ;; Remove trailing white spaces as they are before the + ;; citation. + (last-part + (replace-regexp-in-string (rx (1+ (any blank ?\n)) string-end) + "" + (substring s split)))) + (when (org-string-nw-p first-part) + (org-element-insert-before first-part citation)) + (org-element-set-element s last-part))) + +(defun org-cite--move-punct-before (punct citation s info) + "Move punctuation PUNCT before CITATION object. +String S contains PUNCT. INFO is the export state, as a property list. +The function assumes S follows CITATION. Parse tree is modified by side-effect." + (if (equal s punct) + (org-element-extract-element s) ;it would be empty anyway + (org-element-set-element s (substring s (length punct)))) + ;; Remove blanks before citation. + (org-cite--set-previous-post-blank citation 0 info) + (org-element-insert-before + ;; Blanks between citation and punct are now before punct and + ;; citation. + (concat (make-string (or (org-element-property :post-blank citation) 0) ?\s) + punct) + citation)) + +(defun org-cite--parse-as-plist (s) + "Parse string S as a property list. +Values are always strings. Return nil if S is nil." + (cond + ((null s) nil) + ((stringp s) + (with-temp-buffer + (save-excursion (insert s)) + (skip-chars-forward " \t") + (let ((results nil) + (value-flag nil)) + (while (not (eobp)) + (pcase (char-after) + (?: + (push (read (current-buffer)) results) + (setq value-flag t)) + ((guard (not value-flag)) + (skip-chars-forward "^ \t")) + (?\" + (let ((origin (point))) + (condition-case _ + (progn + (read (current-buffer)) + (push (buffer-substring (1+ origin) (1- (point))) results)) + (end-of-file + (goto-char origin) + (skip-chars-forward "^ \t") + (push (buffer-substring origin (point)) results))) + (setq value-flag nil))) + (_ + (let ((origin (point))) + (skip-chars-forward "^ \t") + (push (buffer-substring origin (point)) results) + (setq value-flag nil)))) + (skip-chars-forward " \t")) + (nreverse results)))) + (t (error "Invalid argument type: %S" s)))) + +(defun org-cite--get-note-rule (info) + "Return punctuation rule according to language used for export. + +INFO is the export state, as a property list. + +Rule is found according to the language used for export and +`org-cite-note-rules', which see. + +If there is no rule matching current language, the rule defaults +to (adaptive outside after)." + (let* ((language-tags + ;; Normalize language as a language-region tag, as described + ;; in RFC 4646. + (pcase (split-string (plist-get info :language) "[-_]") + (`(,language) + (list language + (or (cdr (assoc language org-cite--default-region-alist)) + language))) + (`(,language ,region) + (list language region)) + (other + (error "Invalid language identifier: %S" other)))) + (language-region (mapconcat #'downcase language-tags "-")) + (language (car language-tags))) + (or (cdr (assoc language-region org-cite-note-rules)) + (cdr (assoc language org-cite-note-rules)) + '(adaptive outside after)))) + + +;;; Generic tools +(defun org-cite-list-bibliography-files () + "List all bibliography files defined in the buffer." + (delete-dups + (append (mapcar (lambda (value) + (pcase value + (`(,f . ,d) + (expand-file-name (org-strip-quotes f) d)))) + (pcase (org-collect-keywords + '("BIBLIOGRAPHY") nil '("BIBLIOGRAPHY")) + (`(("BIBLIOGRAPHY" . ,pairs)) pairs))) + org-cite-global-bibliography))) + +(defun org-cite-get-references (citation &optional keys-only) + "Return citations references contained in CITATION object. + +When optional argument KEYS-ONLY is non-nil, return the references' keys, as a +list of strings. + +Assume CITATION object comes from either a full parse tree, e.g., during export, +or from the current buffer." + (let ((contents (org-element-contents citation))) + (cond + ((null contents) + (org-with-point-at (org-element-property :contents-begin citation) + (narrow-to-region (point) (org-element-property :contents-end citation)) + (let ((references nil)) + (while (not (eobp)) + (let ((reference (org-element-citation-reference-parser))) + (goto-char (org-element-property :end reference)) + (push (if keys-only + (org-element-property :key reference) + reference) + references))) + (nreverse references)))) + (keys-only (mapcar (lambda (r) (org-element-property :key r)) contents)) + (t contents)))) + +(defun org-cite-boundaries (citation) + "Return the beginning and end strict position of CITATION. +Returns a (BEG . END) pair." + (let ((beg (org-element-property :begin citation)) + (end (org-with-point-at (org-element-property :end citation) + (skip-chars-backward " \t") + (point)))) + (cons beg end))) + +(defun org-cite-key-boundaries (reference) + "Return citation REFERENCE's key boundaries as buffer positions. +The function returns a pair (START . END) where START and END denote positions +in the current buffer. Positions include leading \"@\" character." + (org-with-point-at (org-element-property :begin reference) + (let ((end (org-element-property :end reference))) + (re-search-forward org-element-citation-key-re end t) + (cons (match-beginning 0) (match-end 0))))) + +(defun org-cite-main-affixes (citation) + "Return main affixes for CITATION object. + +Some export back-ends only support a single pair of affixes per +citation, even if it contains multiple keys. This function +decides what affixes are the most appropriate. + +Return a pair (PREFIX . SUFFIX) where PREFIX and SUFFIX are +parsed data." + (let ((source + ;; When there are multiple references, use global affixes. + ;; Otherwise, local affixes have priority. + (pcase (org-cite-get-references citation) + (`(,reference) reference) + (_ citation)))) + (cons (org-element-property :prefix source) + (org-element-property :suffix source)))) + +(defun org-cite-supported-styles (&optional processors) + "List of supported citation styles and variants. + +Supported styles are those handled by export processors from +`org-cite-export-processors', or in PROCESSORS, as a list of symbols, +when non-nil. + +Return value is a list with the following items: + + ((STYLE . SHORTCUTS) . VARIANTS)) + +where STYLE is a string, SHORTCUTS a list of strings, and VARIANTS is a list of +pairs (VARIANT . SHORTCUTS), VARIANT being a string and SHORTCUTS a list of +strings." + (let ((collection + (seq-mapcat + (lambda (name) + (org-cite-processor-cite-styles (org-cite--get-processor name))) + (or processors + (mapcar (pcase-lambda (`(,_ . (,name . ,_))) name) + org-cite-export-processors)))) + (result nil)) + ;; Merge duplicate styles. Each style full name is guaranteed to + ;; be unique, and associated to all shortcuts and all variants in + ;; the initial collection. + (pcase-dolist (`((,style . ,shortcuts) . ,variants) collection) + (let ((entry (assoc style result))) + (if (not entry) + (push (list style shortcuts variants) result) + (setf (nth 1 entry) + (seq-uniq (append shortcuts (nth 1 entry)))) + (setf (nth 2 entry) + (append variants (nth 2 entry)))))) + ;; Return value with the desired format. + (nreverse + (mapcar (pcase-lambda (`(,style ,shortcuts ,variants)) + (cons (cons style (nreverse shortcuts)) + ;; Merge variant shortcuts. + (let ((result nil)) + (pcase-dolist (`(,variant . ,shortcuts) variants) + (let ((entry (assoc variant result))) + (if (not entry) + (push (cons variant shortcuts) result) + (setf (cdr entry) + (seq-uniq (append shortcuts (cdr entry))))))) + result))) + result)))) + +(defun org-cite-delete-citation (datum) + "Delete citation or citation reference DATUM. +When removing the last reference, also remove the whole citation." + (pcase (org-element-type datum) + ('citation + (pcase-let* ((`(,begin . ,end) (org-cite-boundaries datum)) + (pos-before-blank + (org-with-point-at begin + (skip-chars-backward " \t") + (point))) + (pos-after-blank (org-element-property :end datum)) + (first-on-line? + (= pos-before-blank (line-beginning-position))) + (last-on-line? + (= pos-after-blank (line-end-position)))) + (cond + ;; The citation is alone on its line. Remove the whole line. + ;; Do not leave it blank as it might break a surrounding + ;; paragraph. + ((and first-on-line? last-on-line?) + (delete-region (line-beginning-position) (line-beginning-position 2))) + ;; When the citation starts the line, preserve indentation. + (first-on-line? (delete-region begin pos-after-blank)) + ;; When the citation ends the line, remove any trailing space. + (last-on-line? (delete-region pos-before-blank (line-end-position))) + ;; Otherwise, delete blanks before the citation. + ;; Nevertheless, make sure there is at least one blank left, + ;; so as to not splice unrelated surroundings. + (t + (delete-region pos-before-blank end) + (when (= pos-after-blank end) + (org-with-point-at pos-before-blank (insert " "))))))) + ('citation-reference + (let* ((citation (org-element-property :parent datum)) + (references (org-cite-get-references citation)) + (begin (org-element-property :begin datum)) + (end (org-element-property :end datum))) + (cond + ;; Single reference. + ((= 1 (length references)) + (org-cite-delete-citation citation)) + ;; First reference, no prefix. + ((and (= begin (org-element-property :contents-begin citation)) + (not (org-element-property :prefix citation))) + (org-with-point-at (org-element-property :begin datum) + (skip-chars-backward " \t") + (delete-region (point) end))) + ;; Last reference, no suffix. + ((and (= end (org-element-property :contents-end citation)) + (not (org-element-property :suffix citation))) + (delete-region (1- begin) (1- (cdr (org-cite-boundaries citation))))) + ;; Somewhere in-between. + (t + (delete-region begin end))))) + (other + (error "Invalid object type: %S" other)))) + + +;;; Tools only available during export +(defun org-cite-citation-style (citation info) + "Return citation style used for CITATION object. + +Style is a pair (NAME . VARIANT) where NAME and VARIANT are strings or nil. +A nil NAME means the default style for the current processor should be used. + +INFO is a plist used as a communication channel." + (let* ((separate + (lambda (s) + (cond + ((null s) (cons nil nil)) + ((not (string-match "/" s)) (cons s nil)) + (t (cons (substring s nil (match-beginning 0)) + (org-string-nw-p (substring s (match-end 0)))))))) + (local (funcall separate (org-element-property :style citation))) + (global + (funcall separate (pcase (plist-get info :cite-export) + (`(,_ ,_ ,style) style) + (_ nil))))) + (cond + ((org-string-nw-p (car local)) + (cons (org-not-nil (car local)) (cdr local))) + (t + (cons (org-not-nil (car global)) + (or (cdr local) (cdr global))))))) + +(defun org-cite-bibliography-style (info) + "Return expected bibliography style. +INFO is a plist used as a communication channel." + (pcase (plist-get info :cite-export) + (`(,_ ,style ,_) style) + (_ nil))) + +(defun org-cite-bibliography-properties (keyword) + "Return properties associated to \"print_bibliography\" KEYWORD object. +Return value is a property list." + (org-cite--parse-as-plist (org-element-property :value keyword))) + +(defun org-cite-list-citations (info) + "List citations in the exported document. +Citations are ordered by appearance in the document, when following footnotes. +INFO is the export communication channel, as a property list." + (or (plist-get info :citations) + (letrec ((cites nil) + (tree (plist-get info :parse-tree)) + (find-definition + ;; Find definition for standard reference LABEL. At + ;; this point, it is impossible to rely on + ;; `org-export-get-footnote-definition' because the + ;; function caches results that could contain + ;; un-processed citation objects. So we use + ;; a simplified version of the function above. + (lambda (label) + (org-element-map tree 'footnote-definition + (lambda (d) + (and (equal label (org-element-property :label d)) + (or (org-element-contents d) ""))) + info t))) + (search-cites + (lambda (data) + (org-element-map data '(citation footnote-reference) + (lambda (datum) + (pcase (org-element-type datum) + ('citation (push datum cites)) + ;; Do not force entering inline definitions, since + ;; `org-element-map' is going to enter it anyway. + ((guard (eq 'inline (org-element-property :type datum)))) + ;; Walk footnote definition. + (_ + (let ((label (org-element-property :label datum))) + (funcall search-cites + (funcall find-definition label)))))) + info nil 'footnote-definition t)))) + (funcall search-cites tree) + (let ((result (nreverse cites))) + (plist-put info :citations result) + result)))) + +(defun org-cite-list-keys (info) + "List citation keys in the exported document. +Keys are ordered by first appearance in the document, when following footnotes. +Duplicate keys are removed. INFO is the export communication channel, as a +property list." + (delete-dups + (org-element-map (org-cite-list-citations info) 'citation-reference + (lambda (r) (org-element-property :key r)) + info))) + +(defun org-cite-key-number (key info &optional predicate) + "Return number associated to string KEY. + +INFO is the export communication channel, as a property list. + +Optional argument PREDICATE is called with two keys, and returns non-nil +if the first reference should sort before the second. When nil, references +are sorted in order cited." + (let* ((keys (org-cite-list-keys info)) + (sorted-keys (if (functionp predicate) + (sort keys predicate) + keys)) + (position (seq-position sorted-keys key #'string-equal))) + (and (integerp position) + (1+ position)))) + +(defun org-cite-inside-footnote-p (citation &optional strict) + "Non-nil when CITATION object is contained within a footnote. + +When optional argument STRICT is non-nil, return t only if CITATION represents +the sole contents of the footnote, e.g., after calling `org-cite-wrap-citation'. + +When non-nil, the return value if the footnote container." + (let ((footnote + (org-element-lineage citation + '(footnote-definition footnote-reference)))) + (and footnote + (or (not strict) + (equal (org-element-contents (org-element-property :parent citation)) + (list citation))) + ;; Return value. + footnote))) + +(defun org-cite-wrap-citation (citation info) + "Wrap an anonymous inline footnote around CITATION object in the parse tree. + +INFO is the export state, as a property list. + +White space before the citation, if any, are removed. The parse tree is +modified by side-effect. + +Return newly created footnote object." + (let ((footnote + (list 'footnote-reference + (list :label nil + :type 'inline + :contents-begin (org-element-property :begin citation) + :contents-end (org-element-property :end citation) + :post-blank (org-element-property :post-blank citation))))) + ;; Remove any white space before citation. + (org-cite--set-previous-post-blank citation 0 info) + ;; Footnote swallows citation. + (org-element-insert-before footnote citation) + (org-element-adopt-elements footnote + (org-element-extract-element citation)))) + +(defun org-cite-adjust-note (citation info &optional rule punct) + "Adjust note number location for CITATION object, and punctuation around it. + +INFO is the export state, as a property list. + +Optional argument RULE is the punctuation rule used, as a triplet. When nil, +rule is determined according to `org-cite-note-rules', which see. + +Optional argument PUNCT is a list of punctuation marks to be considered. +When nil, it defaults to `org-cite-punctuation-marks'. + +Parse tree is modified by side-effect. + +Note: when calling both `org-cite-adjust-note' and `org-cite-wrap-citation' on +the same object, call `org-cite-adjust-note' first." + (when org-cite-adjust-note-numbers + (pcase-let* ((rule (or rule (org-cite--get-note-rule info))) + (punct-re (regexp-opt (or punct org-cite-punctuation-marks))) + ;; with Emacs <27.1. Argument of `regexp' form (PUNCT-RE this case) + ;; must be a string literal. + (previous-punct-re + (rx-to-string `(seq (opt (group (regexp ,(rx (0+ (any blank ?\n)))) + (regexp ,punct-re))) + (regexp ,(rx (opt (0+ (any blank ?\n)) (group ?\")) + (opt (group (1+ (any blank ?\n)))) + string-end))) + t)) + (next-punct-re + (rx-to-string `(seq string-start + (group (0+ (any blank ?\n)) (regexp ,punct-re))) + t)) + (next (org-export-get-next-element citation info)) + (final-punct + (and (stringp next) + (string-match next-punct-re next) + (match-string 1 next))) + (previous + ;; Find the closest terminal object. Consider + ;; citation, subscript and superscript objects as + ;; terminal. + (org-last + (org-element-map (org-export-get-previous-element citation info) + '(citation code entity export-snippet footnote-reference + line-break latex-fragment link plain-text + radio-target statistics-cookie timestamp + verbatim) + #'identity info nil '(citation subscript superscript)))) + (`(,punct ,quote ,spacing) + (and (stringp previous) + (string-match previous-punct-re previous) + (list (match-string 1 previous) + (match-string 2 previous) + (match-string 3 previous))))) + ;; Bail you when there is no quote and either no punctuation, or + ;; punctuation on both sides. + (when (or quote (org-xor punct final-punct)) + ;; Phase 1: handle punctuation rule. + (pcase rule + ((guard (not quote)) nil) + ;; Move punctuation inside. + (`(,(or `inside (and `adaptive (guard (not spacing)))) . ,_) + ;; This only makes sense if there is a quotation before the + ;; citation that does not end with some punctuation. + (when (and (not punct) final-punct) + ;; Quote guarantees there is a string object before + ;; citation. Likewise, any final punctuation guarantees + ;; there is a string object following citation. + (let ((new-prev + (replace-regexp-in-string + previous-punct-re + (concat final-punct "\"") previous nil nil 2)) + (new-next + (replace-regexp-in-string + ;; Before Emacs-27.1 `literal' `rx' form with a variable + ;; as an argument is not available. + (rx-to-string `(seq string-start ,final-punct) t) + "" next))) + (org-element-set-element previous new-prev) + (org-element-set-element next new-next) + (setq previous new-prev) + (setq next new-next) + (setq punct final-punct) + (setq final-punct nil)))) + ;; Move punctuation outside. + (`(,(or `outside (and `adaptive (guard spacing))) . ,_) + ;; This is only meaningful if there is some inner + ;; punctuation and no final punctuation already. + (when (and punct (not final-punct)) + ;; Inner punctuation guarantees there is text object + ;; before the citation. However, there is no information + ;; about the object following citation, if any. + ;; Therefore, we handle all the possible cases (string, + ;; other type, or none). + (let ((new-prev + (replace-regexp-in-string + previous-punct-re "" previous nil nil 1)) + (new-next (if (stringp next) (concat punct next) punct))) + (org-element-set-element previous new-prev) + (cond + ((stringp next) + (org-element-set-element next new-next)) + (next + (org-element-insert-before new-next next)) + (t + (org-element-adopt-elements + (org-element-property :parent citation) + new-next))) + (setq previous new-prev) + (setq next new-next) + (setq final-punct punct) + (setq punct nil)))) + (_ + (error "Invalid punctuation rule: %S" rule)))) + ;; Phase 2: move citation to its appropriate location. + ;; + ;; First transform relative citation location into a definitive + ;; location, according to the surrounding punctuation. + (pcase rule + (`(,punctuation same ,order) + (setf rule + (list punctuation + (cond + ;; When there is punctuation on both sides, the + ;; citation is necessarily on the outside. + ((and punct final-punct) 'outside) + (punct 'inside) + (final-punct 'outside) + ;; No punctuation: bail out on next step. + (t nil)) + order)))) + (pcase rule + (`(,_ nil ,_) nil) + (`(,_ inside after) + ;; Citation has to be moved after punct, if there is + ;; a quotation mark, or after final punctuation. + (cond + (quote + (org-cite--insert-at-split previous citation 2 previous-punct-re)) + (final-punct + (org-cite--move-punct-before final-punct citation next info)) + ;; There is only punct, and we're already after it. + (t nil))) + (`(,_ inside before) + ;; Citation is already behind final-punct, so only consider + ;; other locations. + (when (or punct quote) + (org-cite--insert-at-split previous citation 0 previous-punct-re))) + (`(,_ outside after) + ;; Citation is already after any punct or quote. It can only + ;; move past final punctuation, if there is one. + (when final-punct + (org-cite--move-punct-before final-punct citation next info))) + (`(,_ outside before) + ;; The only non-trivial case is when citation follows punct + ;; without a quote. + (when (and punct (not quote)) + (org-cite--insert-at-split previous citation 0 previous-punct-re))) + (_ + (error "Invalid punctuation rule: %S" rule)))))) + + +;;; Tools generating or operating on parsed data +(defun org-cite-parse-elements (s) + "Parse string S as a list of Org elements. + +The return value is suitable as a replacement for a +\"print_bibliography\" keyword. As a consequence, the function +raises an error if S contains a headline." + (with-temp-buffer + (insert s) + (pcase (org-element-contents (org-element-parse-buffer)) + ('nil nil) + (`(,(and section (guard (eq 'section (org-element-type section))))) + (org-element-contents section)) + (_ + (error "Headlines cannot replace a keyword"))))) + +(defun org-cite-parse-objects (s &optional affix) + "Parse string S as a secondary string. + +The return value is suitable as a replacement for a citation object. + +When optional argument AFFIX is non-nil, restrict the set of allowed object +types to match the contents of a citation affix." + (org-element-parse-secondary-string + s (org-element-restriction (if affix 'citation-reference 'paragraph)))) + +(defun org-cite-make-paragraph (&rest data) + "Return a paragraph element containing DATA. +DATA are strings, objects or secondary strings." + (apply #'org-element-create 'paragraph nil (apply #'org-cite-concat data))) + +(defun org-cite-emphasize (type &rest data) + "Apply emphasis TYPE on DATA. +TYPE is a symbol among `bold', `italic', `strike-through' and `underline'. +DATA are strings, objects or secondary strings. Return an object of type TYPE." + (declare (indent 1)) + (unless (memq type '(bold italic strike-through underline)) + (error "Wrong emphasis type: %S" type)) + (apply #'org-element-create type nil (apply #'org-cite-concat data))) + +(defun org-cite-concat (&rest data) + "Concatenate all the DATA arguments and make the result a secondary string. +Each argument may be a string, an object, or a secondary string." + (let ((results nil)) + (dolist (datum (reverse data)) + (pcase datum + ('nil nil) + ;; Element or object. + ((pred org-element-type) (push datum results)) + ;; Secondary string. + ((pred consp) (setq results (append datum results))) + (_ + (signal + 'wrong-type-argument + (list (format "Argument is not a string or a secondary string: %S" + datum)))))) + results)) + +(defun org-cite-mapconcat (function data separator) + "Apply FUNCTION to each element of DATA, and return a secondary string. + +In between each pair of results, stick SEPARATOR, which may be a string, +an object, or a secondary string. FUNCTION must be a function of one argument, +and must return either a string, an object, or a secondary string." + (and data + (let ((result (list (funcall function (car data))))) + (dolist (datum (cdr data)) + (setq result + (org-cite-concat result separator (funcall function datum)))) + result))) + + +;;; Internal interface with fontification (activate capability) +(defun org-cite-fontify-default (cite) + "Fontify CITE with `org-cite' and `org-cite-key' faces. +CITE is a citation object. The function applies `org-cite' face +on the whole citation, and `org-cite-key' face on each key." + (let ((beg (org-element-property :begin cite)) + (end (org-with-point-at (org-element-property :end cite) + (skip-chars-backward " \t") + (point)))) + (add-text-properties beg end '(font-lock-multiline t)) + (add-face-text-property beg end 'org-cite) + (dolist (reference (org-cite-get-references cite)) + (let ((boundaries (org-cite-key-boundaries reference))) + (add-face-text-property (car boundaries) (cdr boundaries) + 'org-cite-key))))) + +(defun org-cite-activate (limit) + "Activate citations from up to LIMIT buffer position. +Each citation encountered is activated using the appropriate function +from the processor set in `org-cite-activate-processor'." + (let* ((name org-cite-activate-processor) + (activate + (or (and name + (org-cite-processor-has-capability-p name 'activate) + (org-cite-processor-activate (org-cite--get-processor name))) + #'org-cite-fontify-default))) + (when (re-search-forward org-element-citation-prefix-re limit t) + (let ((cite (org-with-point-at (match-beginning 0) + (org-element-citation-parser)))) + (when cite + (funcall activate cite) + ;; Move after cite object and make sure to return + ;; a non-nil value. + (goto-char (org-element-property :end cite))))))) + + +;;; Internal interface with Org Export library (export capability) +(defun org-cite-store-bibliography (info) + "Store bibliography in the communication channel. + +Bibliography is stored as a list of absolute file names in the `:bibliography' +property. + +INFO is the communication channel, as a plist. It is modified by side-effect." + (plist-put info :bibliography (org-cite-list-bibliography-files))) + +(defun org-cite-store-export-processor (info) + "Store export processor in the `:cite-export' property during export. + +Export processor is stored as a triplet, or nil. + +When non-nil, it is defined as (NAME BIBLIOGRAPHY-STYLE CITATION-STYLE) where +NAME is a symbol, whereas BIBLIOGRAPHY-STYLE and CITATION-STYLE are strings, +or nil. + +INFO is the communication channel, as a plist. It is modified by side-effect." + (let* ((err + (lambda (s) + (user-error "Invalid cite export processor definition: %S" s))) + (processor + (pcase (plist-get info :cite-export) + ((or "" `nil) nil) + ;; Value is a string. It comes from a "cite_export" + ;; keyword. It may contain between 1 and 3 tokens, the + ;; first one being a symbol and the other (optional) two, + ;; strings. + ((and (pred stringp) s) + (with-temp-buffer + (save-excursion (insert s)) + (let ((result (list (read (current-buffer))))) + (dotimes (_ 2) + (skip-chars-forward " \t") + (cond + ((eobp) (push nil result)) + ((char-equal ?\" (char-after)) + (condition-case _ + (push (org-not-nil (read (current-buffer))) result) + (error (funcall err s)))) + (t + (let ((origin (point))) + (skip-chars-forward "^ \t") + (push (org-not-nil (buffer-substring origin (point))) + result))))) + (unless (eobp) (funcall err s)) + (nreverse result)))) + ;; Value is an alist. It must come from + ;; `org-cite-export-processors' variable. Find the most + ;; appropriate processor according to current export + ;; back-end. + ((and (pred consp) alist) + (let* ((backend (plist-get info :back-end)) + (candidates + ;; Limit candidates to processors associated to + ;; back-ends derived from or equal to the current + ;; one. + (sort (seq-filter + (pcase-lambda (`(,key . ,_)) + (org-export-derived-backend-p backend key)) + alist) + (lambda (a b) + (org-export-derived-backend-p (car a) (car b)))))) + ;; Select the closest candidate, or fallback to t. + (pcase (or (car candidates) (assq t alist)) + ('nil nil) + (`(,_ . ,p) + ;; Normalize value by turning it into a triplet. + (pcase p + (`(,(pred symbolp)) + (append p (list nil nil))) + (`(,(pred symbolp) ,(pred string-or-null-p)) + (append p (list nil))) + (`(,(pred symbolp) + ,(pred string-or-null-p) + ,(pred string-or-null-p)) + p) + (_ (funcall err p)))) + (other (funcall err (cdr other)))))) + (other (funcall err other))))) + (pcase processor + ('nil nil) + (`(,name . ,_) + (cond + ((not (org-cite--get-processor name)) + (user-error "Unknown processor %S" name)) + ((not (org-cite-processor-has-capability-p name 'export)) + (user-error "Processor %S is unable to handle citation export" name))))) + (plist-put info :cite-export processor))) + +(defun org-cite-export-citation (citation _ info) + "Export CITATION object according to INFO property list. +This function delegates the export of the current citation to the +selected citation processor." + (pcase (plist-get info :cite-export) + ('nil nil) + (`(,p ,_ ,_) + (funcall (org-cite-processor-export-citation (org-cite--get-processor p)) + citation + (org-cite-citation-style citation info) + (plist-get info :back-end) + info)) + (other (error "Invalid `:cite-export' value: %S" other)))) + +(defun org-cite-export-bibliography (keyword _ info) + "Return bibliography associated to \"print_bibliography\" KEYWORD. +BACKEND is the export back-end, as a symbol. INFO is a plist +used as a communication channel." + (pcase (plist-get info :cite-export) + ('nil nil) + (`(,p ,_ ,_) + (let ((export-bibilography + (org-cite-processor-export-bibliography + (org-cite--get-processor p)))) + (when export-bibilography + (funcall export-bibilography + (org-cite-list-keys info) + (plist-get info :bibliography) + (org-cite-bibliography-style info) + (org-cite-bibliography-properties keyword) + (plist-get info :back-end) + info)))) + (other (error "Invalid `:cite-export' value: %S" other)))) + +(defun org-cite-process-citations (info) + "Replace all citations in the parse tree. +INFO is the communication channel, as a plist. Parse tree is modified +by side-effect." + (dolist (cite (org-cite-list-citations info)) + (let ((replacement (org-cite-export-citation cite nil info)) + (blanks (or (org-element-property :post-blank cite) 0))) + (if (null replacement) + ;; Before removing the citation, transfer its `:post-blank' + ;; property to the object before, if any. + (org-cite--set-previous-post-blank cite blanks info) + ;; Make sure there is a space between a quotation mark and + ;; a citation. This is particularly important when using + ;; `adaptive' note rule. See `org-cite-note-rules'. + (let ((previous (org-export-get-previous-element cite info))) + (when (and (org-string-nw-p previous) + (string-suffix-p "\"" previous)) + (org-cite--set-previous-post-blank cite 1 info))) + (pcase replacement + ;; String. + ((pred stringp) + ;; Handle `:post-blank' before replacing value. + (let ((output (concat (org-trim replacement) + (make-string blanks ?\s)))) + (org-element-insert-before (org-export-raw-string output) cite))) + ;; Single element. + (`(,(pred symbolp) . ,_) + (org-cite--set-post-blank replacement blanks) + (org-element-insert-before replacement cite)) + ;; Secondary string: splice objects at cite's place. + ;; Transfer `:post-blank' to the last object. + ((pred consp) + (let ((last nil)) + (dolist (datum replacement) + (setq last datum) + (org-element-insert-before datum cite)) + (org-cite--set-post-blank last blanks))) + (_ + (error "Invalid return value from citation export processor: %S" + replacement)))) + (org-element-extract-element cite)))) + +(defun org-cite-process-bibliography (info) + "Replace all \"print_bibliography\" keywords in the parse tree. + +INFO is the communication channel, as a plist. Parse tree is modified +by side effect." + (org-element-map (plist-get info :parse-tree) 'keyword + (lambda (keyword) + (when (equal "PRINT_BIBLIOGRAPHY" (org-element-property :key keyword)) + (let ((replacement (org-cite-export-bibliography keyword nil info)) + (blanks (or (org-element-property :post-blank keyword) 0))) + (pcase replacement + ;; Before removing the citation, transfer its + ;; `:post-blank' property to the element before, if any. + ('nil + (org-cite--set-previous-post-blank keyword blanks info) + (org-element-extract-element keyword)) + ;; Handle `:post-blank' before replacing keyword with string. + ((pred stringp) + (let ((output (concat (org-element-normalize-string replacement) + (make-string blanks ?\n)))) + (org-element-set-element keyword (org-export-raw-string output)))) + ;; List of elements: splice contents before keyword and + ;; remove the latter. Transfer `:post-blank' to last + ;; element. + ((and `(,(pred listp) . ,_) contents) + (let ((last nil)) + (dolist (datum contents) + (setq last datum) + (org-element-insert-before datum keyword)) + (org-cite--set-post-blank last blanks) + (org-element-extract-element keyword))) + ;; Single element: replace the keyword. + (`(,(pred symbolp) . ,_) + (org-cite--set-post-blank replacement blanks) + (org-element-set-element keyword replacement)) + (_ + (error "Invalid return value from citation export processor: %S" + replacement)))))) + info)) + +(defun org-cite-finalize-export (output info) + "Finalizer for export process. +OUTPUT is the full output of the export process. INFO is the communication +channel, as a property list." + (pcase (plist-get info :cite-export) + ('nil output) + (`(,p ,_ ,_) + (let ((finalizer + (org-cite-processor-export-finalizer (org-cite--get-processor p)))) + (if (not finalizer) + output + (funcall finalizer + output + (org-cite-list-keys info) + (plist-get info :bibliography) + (org-cite-bibliography-style info) + (plist-get info :back-end) + info)))) + (other (error "Invalid `:cite-export' value: %S" other)))) + + +;;; Internal interface with `org-open-at-point' (follow capability) +(defun org-cite-follow (datum arg) + "Follow citation or citation-reference DATUM. +Following is done according to the processor set in `org-cite-follow-processor'. +ARG is the prefix argument received when calling `org-open-at-point', or nil." + (let ((name org-cite-follow-processor)) + (cond + ((null name) + (user-error "No processor set to follow citations")) + ((not (org-cite--get-processor name)) + (user-error "Unknown processor %S" name)) + ((not (org-cite-processor-has-capability-p name 'follow)) + (user-error "Processor %S cannot follow citations" name)) + (t + (let ((follow (org-cite-processor-follow (org-cite--get-processor name)))) + (funcall follow datum arg)))))) + + +;;; Meta-command for citation insertion (insert capability) +(defun org-cite--allowed-p (context) + "Non-nil when a citation can be inserted at point. +CONTEXT is the element or object at point, as returned by `org-element-context'." + (let ((type (org-element-type context))) + (cond + ;; No citation in attributes, except in parsed ones. + ;; + ;; XXX: Inserting citation in a secondary value is not allowed + ;; yet. Is it useful? + ((let ((post (org-element-property :post-affiliated context))) + (and post (< (point) post))) + (let ((case-fold-search t)) + (looking-back + (rx-to-string + `(seq line-start (0+ (any " \t")) + "#+" + (or ,@org-element-parsed-keywords) + ":" + (0+ nonl)) + t) + (line-beginning-position)))) + ;; Paragraphs and blank lines at top of document are fine. + ((memq type '(nil paragraph))) + ;; So are contents of verse blocks. + ((eq type 'verse-block) + (and (>= (point) (org-element-property :contents-begin context)) + (< (point) (org-element-property :contents-end context)))) + ;; In an headline or inlinetask, point must be either on the + ;; heading itself or on the blank lines below. + ((memq type '(headline inlinetask)) + (or (not (org-at-heading-p)) + (and (save-excursion + (beginning-of-line) + (and (let ((case-fold-search t)) + (not (looking-at-p "\\*+ END[ \t]*$"))) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp)))) + (match-beginning 4) + (>= (point) (match-beginning 4)) + (or (not (match-beginning 5)) + (< (point) (match-beginning 5)))))) + ;; White spaces after an object or blank lines after an element + ;; are OK. + ((>= (point) + (save-excursion (goto-char (org-element-property :end context)) + (skip-chars-backward " \r\t\n") + (if (eq (org-element-class context) 'object) (point) + (line-beginning-position 2))))) + ;; At the beginning of a footnote definition, right after the + ;; label, is OK. + ((eq type 'footnote-definition) (looking-at (rx space))) + ;; At the start of a list item is fine, as long as the bullet is + ;; unaffected. + ((eq type 'item) + (> (point) (+ (org-element-property :begin context) + (current-indentation) + (if (org-element-property :checkbox context) + 5 1)))) + ;; Other elements are invalid. + ((eq (org-element-class context) 'element) nil) + ;; Just before object is fine. + ((= (point) (org-element-property :begin context))) + ;; Within recursive object too, but not in a link. + ((eq type 'link) nil) + ((eq type 'table-cell) + ;; :contents-begin is not reliable on empty cells, so special + ;; case it. + (<= (save-excursion (skip-chars-backward " \t") (point)) + (org-element-property :contents-end context))) + ((let ((cbeg (org-element-property :contents-begin context)) + (cend (org-element-property :contents-end context))) + (and cbeg (>= (point) cbeg) (<= (point) cend))))))) + +(defun org-cite--insert-string-before (string reference) + "Insert STRING before citation REFERENCE object." + (org-with-point-at (org-element-property :begin reference) + (insert string ";"))) + +(defun org-cite--insert-string-after (string reference) + "Insert STRING after citation REFERENCE object." + (org-with-point-at (org-element-property :end reference) + ;; Make sure to move forward when we're inserting at point, so the + ;; insertion can happen multiple times. + (if (char-equal ?\; (char-before)) + (insert-before-markers string ";") + (insert-before-markers ";" string)))) + +(defun org-cite--keys-to-citation (keys) + "Build a citation object from a list of citation KEYS. +Citation keys are strings without the leading \"@\"." + (apply #'org-element-create + 'citation + nil + (mapcar (lambda (k) + (org-element-create 'citation-reference (list :key k))) + keys))) + +(defun org-cite-make-insert-processor (select-key select-style) + "Build a function appropriate as an insert processor. + +SELECT-KEY is a function called with one argument. When it is nil, the function +should return a citation key as a string, or nil. Otherwise, the function +should return a list of such keys, or nil. The keys should not have any leading +\"@\" character. + +SELECT-STYLE is a function called with one argument, the citation object being +edited or constructed so far. It should return a style string, or nil. + +The return value is a function of two arguments: CONTEXT and ARG. CONTEXT is +either a citation reference, a citation object, or nil. ARG is a prefix +argument. + +The generated function inserts or edit a citation at point. More specifically, + + On a citation reference: + + - on the prefix or right before the \"@\" character, insert a new reference + before the current one, + - on the suffix, insert it after the reference, + - otherwise, update the cite key, preserving both affixes. + + When ARG is non-nil, remove the reference, possibly removing the whole + citation if it contains a single reference. + + On a citation object: + + - on the style part, offer to update it, + - on the global prefix, add a new reference before the first one, + - on the global suffix, add a new reference after the last one, + + Elsewhere, insert a citation at point. When ARG is non-nil, offer to complete + style in addition to references." + (unless (and (functionp select-key) (functionp select-style)) + (error "Wrong argument type(s)")) + (lambda (context arg) + (pcase (org-element-type context) + ;; When on a citation, check point is not on the blanks after it. + ;; Otherwise, consider we're after it. + ((and 'citation + (guard + (let ((boundaries (org-cite-boundaries context))) + (and (< (point) (cdr boundaries)) + (> (point) (car boundaries)))))) + ;; When ARG is non-nil, delete the whole citation. Otherwise, + ;; action depends on the point. + (if arg + (org-cite-delete-citation context) + (let* ((begin (org-element-property :begin context)) + (style-end (1- (org-with-point-at begin (search-forward ":"))))) + (if (>= style-end (point)) + ;; On style part, edit the style. + (let ((style-start (+ 5 begin)) + (style (funcall select-style))) + (unless style (user-error "Aborted")) + (org-with-point-at style-start + (delete-region style-start style-end) + (when (org-string-nw-p style) (insert "/" style)))) + ;; On an affix, insert a new reference before or after + ;; point. + (let* ((references (org-cite-get-references context)) + (key (concat "@" (funcall select-key nil)))) + (if (< (point) (org-element-property :contents-begin context)) + (org-cite--insert-string-before key (car references)) + (org-cite--insert-string-after key (org-last references)))))))) + ;; On a citation reference. If ARG is not nil, remove the + ;; reference. Otherwise, action depends on the point. + ((and 'citation-reference (guard arg)) (org-cite-delete-citation context)) + ('citation-reference + (pcase-let* ((`(,start . ,end) (org-cite-key-boundaries context)) + (key (concat "@" + (or (funcall select-key nil) + (user-error "Aborted"))))) + ;; Right before the "@" character, do not replace the reference + ;; at point, but insert a new one before it. It makes adding + ;; a new reference at the beginning easier in the following + ;; case: [cite:@key]. + (cond + ((>= start (point)) (org-cite--insert-string-before key context)) + ((<= end (point)) (org-cite--insert-string-after key context)) + (t + (org-with-point-at start + (delete-region start end) + (insert key)))))) + (_ + (let ((keys (funcall select-key t))) + (unless keys (user-error "Aborted")) + (insert + (format "[cite%s:%s]" + (if arg + (let ((style (funcall select-style + (org-cite--keys-to-citation keys)))) + (if (org-string-nw-p style) + (concat "/" style) + "")) + "") + (mapconcat (lambda (k) (concat "@" k)) keys "; ")))))))) + +;;;###autoload +(defun org-cite-insert (arg) + "Insert a citation at point. +Insertion is done according to the processor set in `org-cite-insert-processor'. +ARG is the prefix argument received when calling interactively the function." + (interactive "P") + (let ((name org-cite-insert-processor)) + (cond + ((null name) + (user-error "No processor set to insert citations")) + ((not (org-cite--get-processor name)) + (user-error "Unknown processor %S" name)) + ((not (org-cite-processor-has-capability-p name 'insert)) + (user-error "Processor %S cannot insert citations" name)) + (t + (let ((context (org-element-context)) + (insert (org-cite-processor-insert (org-cite--get-processor name)))) + (cond + ((memq (org-element-type context) '(citation citation-reference)) + (funcall insert context arg)) + ((org-cite--allowed-p context) + (funcall insert nil arg)) + (t + (user-error "Cannot insert a citation here")))))))) + +(provide 'oc) +;;; oc.el ends here diff --git a/elpa/org-9.5.2/oc.elc b/elpa/org-9.5.2/oc.elc new file mode 100644 index 0000000..57a3282 Binary files /dev/null and b/elpa/org-9.5.2/oc.elc differ diff --git a/elpa/org-9.5.2/ol-bbdb.el b/elpa/org-9.5.2/ol-bbdb.el new file mode 100644 index 0000000..f697f1f --- /dev/null +++ b/elpa/org-9.5.2/ol-bbdb.el @@ -0,0 +1,546 @@ +;;; ol-bbdb.el --- Links to BBDB entries -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Authors: Carsten Dominik +;; Thomas Baumann +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to BBDB database entries from within Org. +;; Org mode loads this module by default - if this is not what you want, +;; configure the variable `org-modules'. + +;; It also implements an interface (based on Ivar Rummelhoff's +;; bbdb-anniv.el) for those Org users, who do not use the diary +;; but who do want to include the anniversaries stored in the BBDB +;; into the org-agenda. If you already include the `diary' into the +;; agenda, you might want to prefer to include the anniversaries in +;; the diary using bbdb-anniv.el. +;; +;; Put the following in /somewhere/at/home/diary.org and make sure +;; that this file is in `org-agenda-files'. +;; +;; %%(org-bbdb-anniversaries) +;; +;; For example my diary.org looks like: +;; * Anniversaries +;; #+CATEGORY: Anniv +;; %%(org-bbdb-anniversaries) +;; +;; +;; To add an anniversary to a BBDB record, press `C-o' in the record. +;; You will be prompted for the field name, in this case it must be +;; "anniversary". If this is the first time you are using this field, +;; you need to confirm that it should be created. +;; +;; The format of an anniversary field stored in BBDB is the following +;; (items in {} are optional): +;; +;; YYYY-MM-DD{ CLASS-OR-FORMAT-STRING} +;; {\nYYYY-MM-DD CLASS-OR-FORMAT-STRING}... +;; +;; CLASS-OR-FORMAT-STRING is one of two things: +;; +;; - an identifier for a class of anniversaries (e.g. birthday or +;; wedding) from `org-bbdb-anniversary-format-alist' which then +;; defines the format string for this class +;; - the (format) string displayed in the diary. +;; +;; You can enter multiple anniversaries for a single BBDB record by +;; separating them with a newline character. At the BBDB prompt for +;; the field value, type `C-q C-j' to enter a newline between two +;; anniversaries. +;; +;; If you omit the CLASS-OR-FORMAT-STRING entirely, it defaults to the +;; value of `org-bbdb-default-anniversary-format' ("birthday" by +;; default). +;; +;; The substitutions in the format string are (in order): +;; - the name of the record containing this anniversary +;; - the number of years +;; - an ordinal suffix (st, nd, rd, th) for the year +;; +;; See the documentation of `org-bbdb-anniversary-format-alist' for +;; further options. +;; +;; Example +;; +;; 1973-06-22 +;; 20??-??-?? wedding +;; 1998-03-12 %s created bbdb-anniv.el %d years ago +;; +;; From Org's agenda, you can use `C-c C-o' to jump to the BBDB +;; link from which the entry at point originates. +;; +;;; Code: + +(require 'cl-lib) +(require 'org-compat) +(require 'org-macs) +(require 'ol) + +;;; Declare functions and variables + +(declare-function bbdb "ext:bbdb-com" (string elidep)) +(declare-function bbdb-company "ext:bbdb-com" (string elidep)) +(declare-function bbdb-current-record "ext:bbdb-com" (&optional planning-on-modifying)) +(declare-function bbdb-name "ext:bbdb-com" (string elidep)) +(declare-function bbdb-completing-read-record "ext:bbdb-com" (prompt &optional omit-records)) +(declare-function bbdb-record-field "ext:bbdb" (record field)) +(declare-function bbdb-record-getprop "ext:bbdb" (record property)) +(declare-function bbdb-record-name "ext:bbdb" (record)) +(declare-function bbdb-records "ext:bbdb" (&optional dont-check-disk already-in-db-buffer)) +(declare-function bbdb-split "ext:bbdb" (string separators)) +(declare-function bbdb-string-trim "ext:bbdb" (string)) +(declare-function bbdb-record-get-field "ext:bbdb" (record field)) +(declare-function bbdb-search-name "ext:bbdb-com" (regexp &optional layout)) +(declare-function bbdb-search-organization "ext:bbdb-com" (regexp &optional layout)) + +;; `bbdb-record-note' was part of BBDB v3.x +(declare-function bbdb-record-note "ext:bbdb" (record label)) +;; `bbdb-record-xfield' replaces it in recent BBDB v3.x+ +(declare-function bbdb-record-xfield "ext:bbdb" (record label)) + +(declare-function calendar-absolute-from-gregorian "calendar" (date)) +(declare-function calendar-gregorian-from-absolute "calendar" (date)) +(declare-function calendar-leap-year-p "calendar" (year)) + +(declare-function diary-ordinal-suffix "diary-lib" (n)) + +(with-no-warnings (defvar date)) ; unprefixed, from calendar.el + +;;; Customization + +(defgroup org-bbdb-anniversaries nil + "Customizations for including anniversaries from BBDB into Agenda." + :group 'org-bbdb) + +(defcustom org-bbdb-default-anniversary-format "birthday" + "Default anniversary class." + :type 'string + :group 'org-bbdb-anniversaries + :require 'bbdb) + +(defcustom org-bbdb-general-anniversary-description-after 7 + "When to switch anniversary descriptions to a more general format. + +Anniversary descriptions include the point in time, when the +anniversary appears. This is, in its most general form, just the +date of the anniversary. Or more specific terms, like \"today\", +\"tomorrow\" or \"in n days\" are used to describe the time span. + +If the anniversary happens in less than that number of days, the +specific description is used. Otherwise, the general one is +used." + :group 'org-bbdb-anniversaries + :version "26.1" + :package-version '(Org . "9.1") + :type 'integer + :require 'bbdb + :safe #'integerp) + +(defcustom org-bbdb-anniversary-format-alist + '(("birthday" . + (lambda (name years suffix) + (concat "Birthday: [[bbdb:" name "][" name " (" + (format "%s" years) ; handles numbers as well as strings + suffix ")]]"))) + ("wedding" . + (lambda (name years suffix) + (concat "[[bbdb:" name "][" name "'s " + (format "%s" years) + suffix " wedding anniversary]]")))) + "How different types of anniversaries should be formatted. +An alist of elements (STRING . FORMAT) where STRING is the name of an +anniversary class and format is either: +1) A format string with the following substitutions (in order): + - the name of the record containing this anniversary + - the number of years + - an ordinal suffix (st, nd, rd, th) for the year + +2) A function to be called with three arguments: NAME YEARS SUFFIX + (string int string) returning a string for the diary or nil. + +3) An Emacs Lisp form that should evaluate to a string (or nil) in the + scope of variables NAME, YEARS and SUFFIX (among others)." + :type '(alist :key-type (string :tag "Class") + :value-type (function :tag "Function")) + :group 'org-bbdb-anniversaries + :require 'bbdb) + +(defcustom org-bbdb-anniversary-field 'anniversary + "The BBDB field which contains anniversaries. +The anniversaries are stored in the following format + +YYYY-MM-DD Class-or-Format-String + +where class is one of the customized classes for anniversaries; +birthday and wedding are predefined. Format-String can take three +substitutions 1) the name of the record containing this +anniversary, 2) the number of years, and 3) an ordinal suffix for +the year. + +Multiple anniversaries can be separated by \\n." + :type 'symbol + :group 'org-bbdb-anniversaries + :require 'bbdb) + +(defcustom org-bbdb-extract-date-fun 'org-bbdb-anniv-extract-date + "How to retrieve `month date year' from the anniversary field. + +Customize if you have already filled your BBDB with dates +different from YYYY-MM-DD. The function must return a list (month +date year)." + :type 'function + :group 'org-bbdb-anniversaries + :require 'bbdb) + +;; Install the link type +(org-link-set-parameters "bbdb" + :follow #'org-bbdb-open + :export #'org-bbdb-export + :complete #'org-bbdb-complete-link + :store #'org-bbdb-store-link) + +;;; Implementation + +(defun org-bbdb-store-link () + "Store a link to a BBDB database entry." + (when (eq major-mode 'bbdb-mode) + ;; This is BBDB, we make this link! + (let* ((rec (bbdb-current-record)) + (name (bbdb-record-name rec)) + (company (if (fboundp 'bbdb-record-getprop) + (bbdb-record-getprop rec 'company) + (car (bbdb-record-field rec 'organization)))) + (link (concat "bbdb:" name))) + (org-link-store-props :type "bbdb" :name name :company company + :link link :description name) + link))) + +(defun org-bbdb-export (path desc format _) + "Create the export version of a BBDB link specified by PATH or DESC. +If exporting to either HTML or LaTeX FORMAT the link will be +italicized, in all other cases it is left unchanged." + (when (string= desc (format "bbdb:%s" path)) + (setq desc path)) + (cond + ((eq format 'html) (format "%s" desc)) + ((eq format 'latex) (format "\\textit{%s}" desc)) + ((eq format 'odt) + (format "%s" desc)) + (t desc))) + +(defun org-bbdb-open (name _) + "Follow a BBDB link to NAME." + (require 'bbdb-com) + (let ((inhibit-redisplay (not debug-on-error))) + (if (fboundp 'bbdb-name) + (org-bbdb-open-old name) + (org-bbdb-open-new name)))) + +(defun org-bbdb-open-old (name) + (catch 'exit + ;; Exact match on name + (bbdb-name (concat "\\`" name "\\'") nil) + (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) + ;; Exact match on name + (bbdb-company (concat "\\`" name "\\'") nil) + (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) + ;; Partial match on name + (bbdb-name name nil) + (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) + ;; Partial match on company + (bbdb-company name nil) + (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) + ;; General match including network address and notes + (bbdb name nil) + (when (= 0 (buffer-size (get-buffer "*BBDB*"))) + (delete-window (get-buffer-window "*BBDB*")) + (error "No matching BBDB record")))) + +(defun org-bbdb-open-new (name) + (catch 'exit + ;; Exact match on name + (bbdb-search-name (concat "\\`" name "\\'") nil) + (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) + ;; Exact match on name + (bbdb-search-organization (concat "\\`" name "\\'") nil) + (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) + ;; Partial match on name + (bbdb-search-name name nil) + (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) + ;; Partial match on company + (bbdb-search-organization name nil) + (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) + ;; General match including network address and notes + (bbdb name nil) + (when (= 0 (buffer-size (get-buffer "*BBDB*"))) + (delete-window (get-buffer-window "*BBDB*")) + (error "No matching BBDB record")))) + +(defun org-bbdb-anniv-extract-date (time-str) + "Convert YYYY-MM-DD to (month date year). +Argument TIME-STR is the value retrieved from BBDB. If YYYY- is omitted +it will be considered unknown." + (pcase (org-split-string time-str "-") + (`(,a ,b) (list (string-to-number a) (string-to-number b) nil)) + (`(,a ,b ,c) (list (string-to-number b) + (string-to-number c) + (string-to-number a))))) + +(defun org-bbdb-anniv-split (str) + "Split multiple entries in the BBDB anniversary field. +Argument STR is the anniversary field in BBDB." + (let ((pos (string-match "[ \t]" str))) + (if pos (list (substring str 0 pos) + (bbdb-string-trim (substring str pos))) + (list str nil)))) + +(defvar org-bbdb-anniv-hash nil + "A hash holding anniversaries extracted from BBDB. +The hash table is created on first use.") + +(defvar org-bbdb-updated-p t + "This is non-nil if BBDB has been updated since we last built the hash.") + +(defun org-bbdb-make-anniv-hash () + "Create a hash with anniversaries extracted from BBDB, for fast access. +The anniversaries are assumed to be stored `org-bbdb-anniversary-field'." + (let ((old-bbdb (fboundp 'bbdb-record-getprop)) + (record-func (if (fboundp 'bbdb-record-xfield) + 'bbdb-record-xfield + 'bbdb-record-note)) + split tmp annivs) + (clrhash org-bbdb-anniv-hash) + (dolist (rec (bbdb-records)) + (when (setq annivs (if old-bbdb + (bbdb-record-getprop + rec org-bbdb-anniversary-field) + (funcall record-func + rec org-bbdb-anniversary-field))) + (setq annivs (if old-bbdb + (bbdb-split annivs "\n") + ;; parameter order is reversed in new bbdb + (bbdb-split "\n" annivs))) + (while annivs + (setq split (org-bbdb-anniv-split (pop annivs))) + (pcase-let ((`(,m ,d ,y) (funcall org-bbdb-extract-date-fun + (car split)))) + (setq tmp (gethash (list m d) org-bbdb-anniv-hash)) + (puthash (list m d) (cons (list y + (bbdb-record-name rec) + (cadr split)) + tmp) + org-bbdb-anniv-hash)))))) + (setq org-bbdb-updated-p nil)) + +(defun org-bbdb-updated (_rec) + "Record the fact that BBDB has been updated. +This is used by Org to re-create the anniversary hash table." + (setq org-bbdb-updated-p t)) + +(add-hook 'bbdb-after-change-hook 'org-bbdb-updated) + +;;;###autoload +(defun org-bbdb-anniversaries () + "Extract anniversaries from BBDB for display in the agenda. +When called programmatically, this function expects the `date' +variable to be globally bound." + (require 'bbdb) + (require 'diary-lib) + (unless (hash-table-p org-bbdb-anniv-hash) + (setq org-bbdb-anniv-hash + (make-hash-table :test 'equal :size 366))) + + (when (or org-bbdb-updated-p + (= 0 (hash-table-count org-bbdb-anniv-hash))) + (org-bbdb-make-anniv-hash)) + + (let* ((m (car date)) ; month + (d (nth 1 date)) ; day + (y (nth 2 date)) ; year + (annivs (gethash (list m d) org-bbdb-anniv-hash)) + (text ()) + rec recs) + + ;; We don't want to miss people born on Feb. 29th + (when (and (= m 3) (= d 1) + (not (null (gethash (list 2 29) org-bbdb-anniv-hash))) + (not (calendar-leap-year-p y))) + (setq recs (gethash (list 2 29) org-bbdb-anniv-hash)) + (while (setq rec (pop recs)) + (push rec annivs))) + + (when annivs + (while (setq rec (pop annivs)) + (when rec + (let* ((class (or (nth 2 rec) + org-bbdb-default-anniversary-format)) + (form (or (cdr (assoc-string + class org-bbdb-anniversary-format-alist t)) + class)) ; (as format string) + (name (nth 1 rec)) + (years (if (eq (car rec) nil) + "unknown" + (- y (car rec)))) + (suffix (if (eq (car rec) nil) + "" + (diary-ordinal-suffix years))) + (tmp (cond + ((functionp form) + (funcall form name years suffix)) + ((listp form) (eval form)) + (t (format form name years suffix))))) + (org-add-props tmp nil 'org-bbdb-name name) + (if text + (setq text (append text (list tmp))) + (setq text (list tmp))))) + )) + text)) + +;;; Return the list of anniversaries for today and the next n-1 +;;; (default: n=7) days. This is meant to be used in an org file +;;; instead of org-bbdb-anniversaries: +;;; +;;; %%(org-bbdb-anniversaries-future) +;;; +;;; or +;;; +;;; %%(org-bbdb-anniversaries-future 3) +;;; +;;; to override the 7-day default. + +(defun org-bbdb-date-list (d n) + "Return list of dates in (m d y) format from the given date D to n-1 days hence." + (let ((abs (calendar-absolute-from-gregorian d))) + (mapcar (lambda (i) (calendar-gregorian-from-absolute (+ abs i))) + (number-sequence 0 (1- n))))) + +(defun org-bbdb-anniversary-description (agenda-date anniv-date) + "Return a string used to incorporate into an agenda anniversary entry. +The calculation of the anniversary description string is based on +the difference between the anniversary date, given as ANNIV-DATE, +and the date on which the entry appears in the agenda, given as +AGENDA-DATE. This makes it possible to have different entries +for the same event depending on if it occurs in the next few days +or far away in the future." + (let ((delta (- (calendar-absolute-from-gregorian anniv-date) + (calendar-absolute-from-gregorian agenda-date)))) + (cond + ((= delta 0) " -- today\\&") + ((= delta 1) " -- tomorrow\\&") + ((< delta org-bbdb-general-anniversary-description-after) + (format " -- in %d days\\&" delta)) + ((pcase-let ((`(,month ,day ,year) anniv-date)) + (format " -- %d-%02d-%02d\\&" year month day)))))) + +(defun org-bbdb-anniversaries-future (&optional n) + "Return list of anniversaries for today and the next n-1 days (default n=7)." + (let ((n (or n 7))) + (when (<= n 0) + (error "The (optional) argument of `org-bbdb-anniversaries-future' \ +must be positive")) + (let ( + ;; List of relevant dates. + (dates (org-bbdb-date-list date n)) + ;; Function to annotate text of each element of l with the + ;; anniversary date d. + (annotate-descriptions + (lambda (agenda-date d l) + (mapcar (lambda (x) + ;; The assumption here is that x is a bbdb link + ;; of the form [[bbdb:name][description]]. + ;; This function rather arbitrarily modifies + ;; the description by adding the date to it in + ;; a fixed format. + (let ((desc (org-bbdb-anniversary-description + agenda-date d))) + (string-match "]]" x) + (replace-match desc nil nil x))) + l)))) + ;; Map a function that generates anniversaries for each date + ;; over the dates and nconc the results into a single list. When + ;; it is no longer necessary to support older versions of Emacs, + ;; this can be done with a cl-mapcan; for now, we use the (apply + ;; #'nconc ...) method for compatibility. + (apply #'nconc + (mapcar + (lambda (d) + (let ((agenda-date date) + (date d)) + ;; Rebind 'date' so that org-bbdb-anniversaries will + ;; be fooled into giving us the list for the given + ;; date and then annotate the descriptions for that + ;; date. + (funcall annotate-descriptions agenda-date d (org-bbdb-anniversaries)))) + dates))))) + +(defun org-bbdb-complete-link () + "Read a bbdb link with name completion." + (require 'bbdb-com) + (let ((rec (bbdb-completing-read-record "Name: "))) + (concat "bbdb:" + (bbdb-record-name (if (listp rec) + (car rec) + rec))))) + +(defun org-bbdb-anniv-export-ical () + "Extract anniversaries from BBDB and convert them to icalendar format." + (require 'bbdb) + (require 'diary-lib) + (unless (hash-table-p org-bbdb-anniv-hash) + (setq org-bbdb-anniv-hash + (make-hash-table :test 'equal :size 366))) + (when (or org-bbdb-updated-p + (= 0 (hash-table-count org-bbdb-anniv-hash))) + (org-bbdb-make-anniv-hash)) + (maphash 'org-bbdb-format-vevent org-bbdb-anniv-hash)) + +(defun org-bbdb-format-vevent (key recs) + (let (rec categ) + (while (setq rec (pop recs)) + (setq categ (or (nth 2 rec) org-bbdb-default-anniversary-format)) + (princ (format "BEGIN:VEVENT +UID: ANNIV-%4i%02i%02i-%s +DTSTART:%4i%02i%02i +SUMMARY:%s +DESCRIPTION:%s +CATEGORIES:%s +RRULE:FREQ=YEARLY +END:VEVENT\n" + (nth 0 rec) (nth 0 key) (nth 1 key) + (mapconcat 'identity + (org-split-string (nth 1 rec) "[^a-zA-Z0-90]+") + "-") + (nth 0 rec) (nth 0 key) (nth 1 key) + (nth 1 rec) + (concat (capitalize categ) " " (nth 1 rec)) + categ))))) + +(provide 'ol-bbdb) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; ol-bbdb.el ends here diff --git a/elpa/org-9.5.2/ol-bbdb.elc b/elpa/org-9.5.2/ol-bbdb.elc new file mode 100644 index 0000000..f0df437 Binary files /dev/null and b/elpa/org-9.5.2/ol-bbdb.elc differ diff --git a/elpa/org-9.5.2/ol-bibtex.el b/elpa/org-9.5.2/ol-bibtex.el new file mode 100644 index 0000000..476095d --- /dev/null +++ b/elpa/org-9.5.2/ol-bibtex.el @@ -0,0 +1,770 @@ +;;; ol-bibtex.el --- Links to BibTeX entries -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2007-2021 Free Software Foundation, Inc. +;; +;; Authors: Bastien Guerry +;; Carsten Dominik +;; Eric Schulte +;; Keywords: org, wp, capture +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;; +;;; Commentary: +;; +;; This file implements links to database entries in BibTeX files. +;; Instead of defining a special link prefix, it uses the normal file +;; links combined with a custom search mechanism to find entries +;; by reference key. And it constructs a nice description tag for +;; the link that contains the author name, the year and a short title. +;; +;; It also stores detailed information about the entry so that +;; capture templates can access and enter this information easily. +;; +;; The available properties for each entry are listed here: +;; +;; :author :publisher :volume :pages +;; :editor :url :number :journal +;; :title :year :series :address +;; :booktitle :month :annote :abstract +;; :key :btype +;; +;; Here is an example of a capture template that use some of this +;; information (:author :year :title :journal :pages): +;; +;; (setq org-capture-templates +;; '((?b "* READ %?\n\n%a\n\n%:author (%:year): %:title\n \ +;; In %:journal, %:pages."))) +;; +;; Let's say you want to capture this BibTeX entry: +;; +;; @Article{dolev83, +;; author = {Danny Dolev and Andrew C. Yao}, +;; title = {On the security of public-key protocols}, +;; journal = {IEEE Transaction on Information Theory}, +;; year = 1983, +;; volume = 2, +;; number = 29, +;; pages = {198--208}, +;; month = {Mars} +;; } +;; +;; M-x `org-capture' on this entry will produce this buffer: +;; +;; ===================================================================== +;; * READ <== [point here] +;; +;; [[file:file.bib::dolev83][Dolev & Yao 1983: security of public key protocols]] +;; +;; Danny Dolev and Andrew C. Yao (1983): On the security of public-key protocols +;; In IEEE Transaction on Information Theory, 198--208. +;; ===================================================================== +;; +;; Additionally, the following functions are now available for storing +;; bibtex entries within Org documents. +;; +;; - Run `org-bibtex' to export the current file to a .bib. +;; +;; - Run `org-bibtex-check' or `org-bibtex-check-all' to check and +;; fill in missing field of either the current, or all headlines +;; +;; - Run `org-bibtex-create' to add a bibtex entry +;; +;; - Use `org-bibtex-read' to read a bibtex entry after `point' or in +;; the active region, then call `org-bibtex-write' in a .org file to +;; insert a heading for the read bibtex entry +;; +;; - All Bibtex information is taken from the document compiled by +;; Andrew Roberts from the Bibtex manual, available at +;; https://www.andy-roberts.net/res/writing/latex/bibentries.pdf +;; +;;; History: +;; +;; The link creation part has been part of Org for a long time. +;; +;; Creating better capture template information was inspired by a request +;; of Austin Frank: https://orgmode.org/list/m0myu03vbx.fsf@gmail.com +;; and then implemented by Bastien Guerry. +;; +;; Eric Schulte eventually added the functions for translating between +;; Org headlines and Bibtex entries, and for fleshing out the Bibtex +;; fields of existing Org headlines. +;; +;; Org mode loads this module by default - if this is not what you want, +;; configure the variable `org-modules'. + +;;; Code: + +(require 'bibtex) +(require 'cl-lib) +(require 'org-compat) +(require 'org-macs) +(require 'ol) + +(defvar org-agenda-overriding-header) +(defvar org-agenda-search-view-always-boolean) +(defvar org-bibtex-description nil) ; dynamically scoped from org.el +(defvar org-id-locations) +(defvar org-property-end-re) +(defvar org-special-properties) +(defvar org-window-config-before-follow-link) + +(declare-function bibtex-beginning-of-entry "bibtex" ()) +(declare-function bibtex-generate-autokey "bibtex" ()) +(declare-function bibtex-parse-entry "bibtex" (&optional content)) +(declare-function bibtex-url "bibtex" (&optional pos no-browse)) + +(declare-function org-back-to-heading "org" (&optional invisible-ok)) +(declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) +(declare-function org-entry-properties "org" (&optional pom which)) +(declare-function org-get-tags "org" (&optional pos local)) +(declare-function org-heading-components "org" ()) +(declare-function org-insert-heading "org" (&optional arg invisible-ok top)) +(declare-function org-map-entries "org" (func &optional match scope &rest skip)) +(declare-function org-narrow-to-subtree "org" ()) +(declare-function org-set-property "org" (property value)) +(declare-function org-toggle-tag "org" (tag &optional onoff)) + +(declare-function org-search-view "org-agenda" (&optional todo-only string edit-at)) + + +;;; Bibtex data +(defvar org-bibtex-types + '((:article + (:description . "An article from a journal or magazine") + (:required :author :title :journal :year) + (:optional :volume :number :pages :month :note :doi)) + (:book + (:description . "A book with an explicit publisher") + (:required (:editor :author) :title :publisher :year) + (:optional (:volume :number) :series :address :edition :month :note :doi)) + (:booklet + (:description . "A work that is printed and bound, but without a named publisher or sponsoring institution.") + (:required :title) + (:optional :author :howpublished :address :month :year :note :doi :url)) + (:conference + (:description . "") + (:required :author :title :booktitle :year) + (:optional :editor :pages :organization :publisher :address :month :note :doi :url)) + (:inbook + (:description . "A part of a book, which may be a chapter (or section or whatever) and/or a range of pages.") + (:required (:author :editor) :title (:chapter :pages) :publisher :year) + (:optional :crossref (:volume :number) :series :type :address :edition :month :note :doi)) + (:incollection + (:description . "A part of a book having its own title.") + (:required :author :title :booktitle :publisher :year) + (:optional :crossref :editor (:volume :number) :series :type :chapter :pages :address :edition :month :note :doi)) + (:inproceedings + (:description . "An article in a conference proceedings") + (:required :author :title :booktitle :year) + (:optional :crossref :editor (:volume :number) :series :pages :address :month :organization :publisher :note :doi)) + (:manual + (:description . "Technical documentation.") + (:required :title) + (:optional :author :organization :address :edition :month :year :note :doi :url)) + (:mastersthesis + (:description . "A Master’s thesis.") + (:required :author :title :school :year) + (:optional :type :address :month :note :doi :url)) + (:misc + (:description . "Use this type when nothing else fits.") + (:required) + (:optional :author :title :howpublished :month :year :note :doi :url)) + (:phdthesis + (:description . "A PhD thesis.") + (:required :author :title :school :year) + (:optional :type :address :month :note :doi :url)) + (:proceedings + (:description . "The proceedings of a conference.") + (:required :title :year) + (:optional :editor (:volume :number) :series :address :month :organization :publisher :note :doi)) + (:techreport + (:description . "A report published by a school or other institution.") + (:required :author :title :institution :year) + (:optional :type :address :month :note :doi :url)) + (:unpublished + (:description . "A document having an author and title, but not formally published.") + (:required :author :title :note) + (:optional :month :year :doi :url))) + "Bibtex entry types with required and optional parameters.") + +(defvar org-bibtex-fields + '((:address . "Usually the address of the publisher or other type of institution. For major publishing houses, van Leunen recommends omitting the information entirely. For small publishers, on the other hand, you can help the reader by giving the complete address.") + (:annote . "An annotation. It is not used by the standard bibliography styles, but may be used by others that produce an annotated bibliography.") + (:author . "The name(s) of the author(s), in the format described in the LaTeX book. Remember, all names are separated with the and keyword, and not commas.") + (:booktitle . "Title of a book, part of which is being cited. See the LaTeX book for how to type titles. For book entries, use the title field instead.") + (:chapter . "A chapter (or section or whatever) number.") + (:crossref . "The database key of the entry being cross referenced.") + (:doi . "The digital object identifier.") + (:edition . "The edition of a book for example, 'Second'. This should be an ordinal, and should have the first letter capitalized, as shown here; the standard styles convert to lower case when necessary.") + (:editor . "Name(s) of editor(s), typed as indicated in the LaTeX book. If there is also an author field, then the editor field gives the editor of the book or collection in which the reference appears.") + (:howpublished . "How something strange has been published. The first word should be capitalized.") + (:institution . "The sponsoring institution of a technical report.") + (:journal . "A journal name.") + (:key . "Used for alphabetizing, cross-referencing, and creating a label when the author information is missing. This field should not be confused with the key that appears in the \\cite command and at the beginning of the database entry.") + (:month . "The month in which the work was published or, for an unpublished work, in which it was written. You should use the standard three-letter abbreviation,") + (:note . "Any additional information that can help the reader. The first word should be capitalized.") + (:number . "Any additional information that can help the reader. The first word should be capitalized.") + (:organization . "The organization that sponsors a conference or that publishes a manual.") + (:pages . "One or more page numbers or range of numbers, such as 42-111 or 7,41,73-97 or 43+ (the ‘+’ in this last example indicates pages following that don’t form simple range). BibTEX requires double dashes for page ranges (--).") + (:publisher . "The publisher’s name.") + (:school . "The name of the school where a thesis was written.") + (:series . "The name of a series or set of books. When citing an entire book, the title field gives its title and an optional series field gives the name of a series or multi-volume set in which the book is published.") + (:title . "The work’s title, typed as explained in the LaTeX book.") + (:type . "The type of a technical report for example, 'Research Note'.") + (:url . "Uniform resource locator.") + (:volume . "The volume of a journal or multi-volume book.") + (:year . "The year of publication or, for an unpublished work, the year it was written. Generally it should consist of four numerals, such as 1984, although the standard styles can handle any year whose last four nonpunctuation characters are numerals, such as '(about 1984)'")) + "Bibtex fields with descriptions.") + +(defvar org-bibtex-entries nil + "List to hold parsed bibtex entries.") + +(defcustom org-bibtex-autogen-keys nil + "Set to a truth value to use `bibtex-generate-autokey' to generate keys." + :group 'org-bibtex + :version "24.1" + :type 'boolean) + +(defcustom org-bibtex-prefix nil + "Optional prefix for all bibtex property names. +For example setting to `BIB_' would allow interoperability with fireforg." + :group 'org-bibtex + :version "24.1" + :type '(choice + (const nil) + (string))) + +(defcustom org-bibtex-treat-headline-as-title t + "Treat headline text as title if title property is absent. +If an entry is missing a title property, use the headline text as +the property. If this value is t, `org-bibtex-check' will ignore +a missing title field." + :group 'org-bibtex + :version "24.1" + :type 'boolean) + +(defcustom org-bibtex-headline-format-function + (lambda (entry) (cdr (assq :title entry))) + "Function returning the headline text for `org-bibtex-write'. +It should take a single argument, the bibtex entry (an alist as +returned by `org-bibtex-read'). The default value simply returns +the entry title." + :group 'org-bibtex + :version "26.1" + :package-version '(Org . "9.1") + :type 'function) + +(defcustom org-bibtex-export-arbitrary-fields nil + "When converting to bibtex allow fields not defined in `org-bibtex-fields'. +This only has effect if `org-bibtex-prefix' is defined, so as to +ensure that other org-properties, such as CATEGORY or LOGGING are +not placed in the exported bibtex entry." + :group 'org-bibtex + :version "24.1" + :type 'boolean) + +(defcustom org-bibtex-key-property "CUSTOM_ID" + "Property that holds the bibtex key. +By default, this is CUSTOM_ID, which enables easy linking to +bibtex headlines from within an org file. This can be set to ID +to enable global links, but only with great caution, as global +IDs must be unique." + :group 'org-bibtex + :version "24.1" + :type 'string) + +(defcustom org-bibtex-tags nil + "List of tag(s) that should be added to new bib entries." + :group 'org-bibtex + :version "24.1" + :type '(repeat :tag "Tag" (string))) + +(defcustom org-bibtex-tags-are-keywords nil + "Convert the value of the keywords field to tags and vice versa. + +When non-nil, comma-separated entries in a bibtex entry's keywords +field will be converted to Org tags. Note: spaces will be escaped +with underscores, and characters that are not permitted in Org +tags will be removed. + +When non-nil, local tags in an Org entry will be exported as +a comma-separated string of keywords when exported to bibtex. +If `org-bibtex-inherit-tags' is non-nil, inherited tags will also +be exported as keywords. Tags defined in `org-bibtex-tags' or +`org-bibtex-no-export-tags' will not be exported." + :group 'org-bibtex + :version "24.1" + :type 'boolean) + +(defcustom org-bibtex-no-export-tags nil + "List of tag(s) that should not be converted to keywords. +This variable is relevant only if `org-bibtex-tags-are-keywords' +is non-nil." + :group 'org-bibtex + :version "24.1" + :type '(repeat :tag "Tag" (string))) + +(defcustom org-bibtex-inherit-tags nil + "Controls whether inherited tags are converted to bibtex keywords. +It is relevant only if `org-bibtex-tags-are-keywords' is non-nil. +Tag inheritance itself is controlled by `org-use-tag-inheritance' +and `org-tags-exclude-from-inheritance'." + :group 'org-bibtex + :version "26.1" + :package-version '(Org . "8.3") + :type 'boolean) + +(defcustom org-bibtex-type-property-name "btype" + "Property in which to store bibtex entry type (e.g., article)." + :group 'org-bibtex + :version "24.1" + :type 'string) + + +;;; Utility functions +(defun org-bibtex-get (property) + (let ((it (let ((org-special-properties + (delete "FILE" (copy-sequence org-special-properties)))) + (or + (org-entry-get (point) (upcase property)) + (org-entry-get (point) (concat org-bibtex-prefix + (upcase property))))))) + (when it (org-trim it)))) + +(defun org-bibtex-put (property value) + (let ((prop (upcase (if (keywordp property) + (substring (symbol-name property) 1) + property)))) + (org-set-property + (concat (unless (string= org-bibtex-key-property prop) org-bibtex-prefix) + prop) + value))) + +(defun org-bibtex-headline () + "Return a bibtex entry of the given headline as a string." + (letrec ((val (lambda (key lst) (cdr (assoc key lst)))) + (to (lambda (string) (intern (concat ":" string)))) + (from (lambda (key) (substring (symbol-name key) 1))) + (flatten (lambda (&rest lsts) + (apply #'append (mapcar + (lambda (e) + (if (listp e) (apply flatten e) (list e))) + lsts)))) + (id (org-bibtex-get org-bibtex-key-property)) + (type (org-bibtex-get org-bibtex-type-property-name)) + (tags (when org-bibtex-tags-are-keywords + (delq nil + (mapcar + (lambda (tag) + (unless (member tag + (append org-bibtex-tags + org-bibtex-no-export-tags)) + tag)) + (if org-bibtex-inherit-tags (org-get-tags) + (org-get-tags nil t))))))) + (when type + (let ((entry (format + "@%s{%s,\n%s\n}\n" type id + (mapconcat + (lambda (pair) + (format " %s={%s}" (car pair) (cdr pair))) + (remove nil + (if (and org-bibtex-export-arbitrary-fields + org-bibtex-prefix) + (mapcar + (lambda (kv) + (let ((key (car kv)) (val0 (cdr kv))) + (when (and + (string-match org-bibtex-prefix key) + (not (string= + (downcase (concat org-bibtex-prefix + org-bibtex-type-property-name)) + (downcase key)))) + (cons (downcase (replace-regexp-in-string + org-bibtex-prefix "" key)) + val0)))) + (org-entry-properties nil 'standard)) + (mapcar + (lambda (field) + (let ((value (or (org-bibtex-get (funcall from field)) + (and (eq :title field) + (nth 4 (org-heading-components)))))) + (when value (cons (funcall from field) value)))) + (funcall flatten + (funcall val :required (funcall val (funcall to type) org-bibtex-types)) + (funcall val :optional (funcall val (funcall to type) org-bibtex-types)))))) + ",\n")))) + (with-temp-buffer + (insert entry) + (when tags + (bibtex-beginning-of-entry) + (if (re-search-forward "keywords.*=.*{\\(.*\\)}" nil t) + (progn (goto-char (match-end 1)) (insert ", ")) + (search-forward ",\n" nil t) + (insert " keywords={},\n") + (search-backward "}," nil t)) + (insert (mapconcat #'identity tags ", "))) + (buffer-string)))))) + +(defun org-bibtex-ask (field) + (unless (assoc field org-bibtex-fields) + (error "Field:%s is not known" field)) + (save-window-excursion + (let* ((name (substring (symbol-name field) 1)) + (buf-name (format "*Bibtex Help %s*" name))) + (with-output-to-temp-buffer buf-name + (princ (cdr (assoc field org-bibtex-fields)))) + (with-current-buffer buf-name (visual-line-mode 1)) + (org-fit-window-to-buffer (get-buffer-window buf-name)) + (let ((result (read-from-minibuffer (format "%s: " name)))) + (when (> (length result) 0) result))))) + +(defun org-bibtex-autokey () + "Generate an autokey for the current headline." + (org-bibtex-put org-bibtex-key-property + (if org-bibtex-autogen-keys + (let* ((entry (org-bibtex-headline)) + (key + (with-temp-buffer + (insert entry) + (bibtex-generate-autokey)))) + ;; test for duplicate IDs if using global ID + (when (and + (equal org-bibtex-key-property "ID") + (featurep 'org-id) + (hash-table-p org-id-locations) + (gethash key org-id-locations)) + (warn "Another entry has the same ID")) + key) + (read-from-minibuffer "id: ")))) + +(defun org-bibtex-fleshout (type &optional optional) + "Fleshout current heading, ensuring all required fields are present. +With optional argument OPTIONAL, also prompt for optional fields." + (let ((val (lambda (key lst) (cdr (assoc key lst)))) + (keyword (lambda (name) (intern (concat ":" (downcase name))))) + (name (lambda (keyword) (substring (symbol-name keyword) 1)))) + (dolist (field (append + (if org-bibtex-treat-headline-as-title + (remove :title (funcall val :required (funcall val type org-bibtex-types))) + (funcall val :required (funcall val type org-bibtex-types))) + (when optional (funcall val :optional (funcall val type org-bibtex-types))))) + (when (consp field) ; or'd pair of fields e.g., (:editor :author) + (let ((present (nth 0 (remove + nil + (mapcar + (lambda (f) + (when (org-bibtex-get (funcall name f)) f)) + field))))) + (setf field (or present (funcall keyword + (completing-read + "Field: " (mapcar name field))))))) + (let ((name (funcall name field))) + (unless (org-bibtex-get name) + (let ((prop (org-bibtex-ask field))) + (when prop (org-bibtex-put name prop))))))) + (when (and type (assoc type org-bibtex-types) + (not (org-bibtex-get org-bibtex-key-property))) + (org-bibtex-autokey))) + + +;;; Bibtex link functions +(org-link-set-parameters "bibtex" + :follow #'org-bibtex-open + :store #'org-bibtex-store-link) + +(defun org-bibtex-open (path arg) + "Visit the bibliography entry on PATH. +ARG, when non-nil, is a universal prefix argument. See +`org-open-file' for details." + (org-link-open-as-file path arg)) + +(defun org-bibtex-store-link () + "Store a link to a BibTeX entry." + (when (eq major-mode 'bibtex-mode) + (let* ((search (org-create-file-search-in-bibtex)) + (link (concat "file:" (abbreviate-file-name buffer-file-name) + "::" search)) + (entry (mapcar ; repair strings enclosed in "..." or {...} + (lambda(c) + (if (string-match + "^\\(?:{\\|\"\\)\\(.*\\)\\(?:}\\|\"\\)$" (cdr c)) + (cons (car c) (match-string 1 (cdr c))) c)) + (save-excursion + (bibtex-beginning-of-entry) + (bibtex-parse-entry))))) + (org-link-store-props + :key (cdr (assoc "=key=" entry)) + :author (or (cdr (assoc "author" entry)) "[no author]") + :doi (or (cdr (assoc "doi" entry)) "[no doi]") + :editor (or (cdr (assoc "editor" entry)) "[no editor]") + :title (or (cdr (assoc "title" entry)) "[no title]") + :booktitle (or (cdr (assoc "booktitle" entry)) "[no booktitle]") + :journal (or (cdr (assoc "journal" entry)) "[no journal]") + :publisher (or (cdr (assoc "publisher" entry)) "[no publisher]") + :pages (or (cdr (assoc "pages" entry)) "[no pages]") + :url (or (cdr (assoc "url" entry)) "[no url]") + :year (or (cdr (assoc "year" entry)) "[no year]") + :month (or (cdr (assoc "month" entry)) "[no month]") + :address (or (cdr (assoc "address" entry)) "[no address]") + :volume (or (cdr (assoc "volume" entry)) "[no volume]") + :number (or (cdr (assoc "number" entry)) "[no number]") + :annote (or (cdr (assoc "annote" entry)) "[no annotation]") + :series (or (cdr (assoc "series" entry)) "[no series]") + :abstract (or (cdr (assoc "abstract" entry)) "[no abstract]") + :btype (or (cdr (assoc "=type=" entry)) "[no type]") + :type "bibtex" + :link link + :description org-bibtex-description)))) + +(defun org-create-file-search-in-bibtex () + "Create the search string and description for a BibTeX database entry." + ;; Make a good description for this entry, using names, year and the title + ;; Put it into the `description' variable which is dynamically scoped. + (let ((bibtex-autokey-names 1) + (bibtex-autokey-names-stretch 1) + (bibtex-autokey-name-case-convert-function 'identity) + (bibtex-autokey-name-separator " & ") + (bibtex-autokey-additional-names " et al.") + (bibtex-autokey-year-length 4) + (bibtex-autokey-name-year-separator " ") + (bibtex-autokey-titlewords 3) + (bibtex-autokey-titleword-separator " ") + (bibtex-autokey-titleword-case-convert-function 'identity) + (bibtex-autokey-titleword-length 'infty) + (bibtex-autokey-year-title-separator ": ")) + (setq org-bibtex-description (bibtex-generate-autokey))) + ;; Now parse the entry, get the key and return it. + (save-excursion + (bibtex-beginning-of-entry) + (cdr (assoc "=key=" (bibtex-parse-entry))))) + +(defun org-execute-file-search-in-bibtex (s) + "Find the link search string S as a key for a database entry." + (when (eq major-mode 'bibtex-mode) + ;; Yes, we want to do the search in this file. + ;; We construct a regexp that searches for "@entrytype{" followed by the key + (goto-char (point-min)) + (and (re-search-forward (concat "@[a-zA-Z]+[ \t\n]*{[ \t\n]*" + (regexp-quote s) "[ \t\n]*,") + nil t) + (goto-char (match-beginning 0))) + (if (and (match-beginning 0) (equal current-prefix-arg '(16))) + ;; Use double prefix to indicate that any web link should be browsed + (let ((b (current-buffer)) (p (point))) + ;; Restore the window configuration because we just use the web link + (set-window-configuration org-window-config-before-follow-link) + (with-current-buffer b + (goto-char p) + (bibtex-url))) + (recenter 0)) ; Move entry start to beginning of window + ;; return t to indicate that the search is done. + t)) + +;; Finally add the link search function to the right hook. +(add-hook 'org-execute-file-search-functions 'org-execute-file-search-in-bibtex) + + +;;; Bibtex <-> Org headline translation functions +(defun org-bibtex (filename) + "Export each headline in the current file to a bibtex entry. +Headlines are exported using `org-bibtex-headline'." + (interactive + (list (read-file-name + "Bibtex file: " nil nil nil + (let ((file (buffer-file-name (buffer-base-buffer)))) + (and file + (file-name-nondirectory + (concat (file-name-sans-extension file) ".bib"))))))) + (let ((error-point + (catch 'bib + (let ((bibtex-entries + (remove nil (org-map-entries + (lambda () + (condition-case nil + (org-bibtex-headline) + (error (throw 'bib (point))))))))) + (with-temp-file filename + (insert (mapconcat #'identity bibtex-entries "\n"))) + (message "Successfully exported %d BibTeX entries to %s" + (length bibtex-entries) filename) + nil)))) + (when error-point + (goto-char error-point) + (message "Bibtex error at %S" (nth 4 (org-heading-components)))))) + +(defun org-bibtex-check (&optional optional) + "Check the current headline for required fields. +With prefix argument OPTIONAL also prompt for optional fields." + (interactive "P") + (save-restriction + (org-narrow-to-subtree) + (let ((type (let ((name (org-bibtex-get org-bibtex-type-property-name))) + (when name (intern (concat ":" name)))))) + (when type (org-bibtex-fleshout type optional))))) + +(defun org-bibtex-check-all (&optional optional) + "Check all headlines in the current file. +With prefix argument OPTIONAL also prompt for optional fields." + (interactive) (org-map-entries (lambda () (org-bibtex-check optional)))) + +(defun org-bibtex-create (&optional arg nonew) + "Create a new entry at the given level. +With a prefix arg, query for optional fields as well. +If nonew is t, add data to the headline of the entry at point." + (interactive "P") + (let* ((type (completing-read + "Type: " (mapcar (lambda (type) + (substring (symbol-name (car type)) 1)) + org-bibtex-types) + nil nil (when nonew + (org-bibtex-get org-bibtex-type-property-name)))) + (type (if (keywordp type) type (intern (concat ":" type)))) + (org-bibtex-treat-headline-as-title (if nonew nil t))) + (unless (assoc type org-bibtex-types) + (error "Type:%s is not known" type)) + (if nonew + (org-back-to-heading) + (org-insert-heading) + (let ((title (org-bibtex-ask :title))) + (insert title) + (org-bibtex-put "TITLE" title))) + (org-bibtex-put org-bibtex-type-property-name + (substring (symbol-name type) 1)) + (org-bibtex-fleshout type arg) + (dolist (tag org-bibtex-tags) (org-toggle-tag tag 'on)))) + +(defun org-bibtex-create-in-current-entry (&optional arg) + "Add bibliographical data to the current entry. +With a prefix arg, query for optional fields." + (interactive "P") + (org-bibtex-create arg t)) + +(defun org-bibtex-read () + "Read a bibtex entry and save to `org-bibtex-entries'. +This uses `bibtex-parse-entry'." + (interactive) + (let ((keyword (lambda (str) (intern (concat ":" (downcase str))))) + (clean-space (lambda (str) (replace-regexp-in-string + "[[:space:]\n\r]+" " " str))) + (strip-delim + (lambda (str) ; strip enclosing "..." and {...} + (dolist (pair '((34 . 34) (123 . 125))) + (when (and (> (length str) 1) + (= (aref str 0) (car pair)) + (= (aref str (1- (length str))) (cdr pair))) + (setf str (substring str 1 (1- (length str)))))) + str))) + (push (mapcar + (lambda (pair) + (cons (let ((field (funcall keyword (car pair)))) + (pcase field + (:=type= :type) + (:=key= :key) + (_ field))) + (funcall clean-space (funcall strip-delim (cdr pair))))) + (save-excursion (bibtex-beginning-of-entry) (bibtex-parse-entry))) + org-bibtex-entries) + (unless (car org-bibtex-entries) (pop org-bibtex-entries)))) + +(defun org-bibtex-read-buffer (buffer) + "Read all bibtex entries in BUFFER and save to `org-bibtex-entries'. +Return the number of saved entries." + (interactive "bBuffer: ") + (let ((start-length (length org-bibtex-entries))) + (with-current-buffer buffer + (save-excursion + (goto-char (point-max)) + (while (not (= (point) (point-min))) + (backward-char 1) + (org-bibtex-read) + (bibtex-beginning-of-entry)))) + (let ((added (- (length org-bibtex-entries) start-length))) + (message "Parsed %d entries" added) + added))) + +(defun org-bibtex-read-file (file) + "Read FILE with `org-bibtex-read-buffer'." + (interactive "fFile: ") + (org-bibtex-read-buffer (find-file-noselect file 'nowarn 'rawfile))) + +(defun org-bibtex-write () + "Insert a heading built from the first element of `org-bibtex-entries'." + (interactive) + (when (= (length org-bibtex-entries) 0) + (error "No entries in `org-bibtex-entries'")) + (let* ((entry (pop org-bibtex-entries)) + (org-special-properties nil) ; avoids errors with `org-entry-put' + (val (lambda (field) (cdr (assoc field entry)))) + (togtag (lambda (tag) (org-toggle-tag tag 'on)))) + (org-insert-heading) + (insert (funcall org-bibtex-headline-format-function entry)) + (org-bibtex-put "TITLE" (funcall val :title)) + (org-bibtex-put org-bibtex-type-property-name + (downcase (funcall val :type))) + (dolist (pair entry) + (pcase (car pair) + (:title nil) + (:type nil) + (:key (org-bibtex-put org-bibtex-key-property (cdr pair))) + (:keywords (if org-bibtex-tags-are-keywords + (dolist (kw (split-string (cdr pair) ", *")) + (funcall + togtag + (replace-regexp-in-string + "[^[:alnum:]_@#%]" "" + (replace-regexp-in-string "[ \t]+" "_" kw)))) + (org-bibtex-put (car pair) (cdr pair)))) + (_ (org-bibtex-put (car pair) (cdr pair))))) + (mapc togtag org-bibtex-tags))) + +(defun org-bibtex-yank () + "If kill ring holds a bibtex entry yank it as an Org headline." + (interactive) + (let (entry) + (with-temp-buffer (yank 1) (setf entry (org-bibtex-read))) + (if entry + (org-bibtex-write) + (error "Yanked text does not appear to contain a BibTeX entry")))) + +(defun org-bibtex-import-from-file (file) + "Read bibtex entries from FILE and insert as Org headlines after point." + (interactive "fFile: ") + (dotimes (_ (org-bibtex-read-file file)) + (save-excursion (org-bibtex-write)) + (re-search-forward org-property-end-re) + (open-line 1) (forward-char 1))) + +(defun org-bibtex-export-to-kill-ring () + "Export current headline to kill ring as bibtex entry." + (interactive) + (let ((result (org-bibtex-headline))) + (kill-new result) result)) + +(defun org-bibtex-search (string) + "Search for bibliographical entries in agenda files. +This function relies `org-search-view' to locate results." + (interactive "sSearch string: ") + (let ((org-agenda-overriding-header "Bib search results:") + (org-agenda-search-view-always-boolean t)) + (org-search-view nil + (format "%s +{:%s%s:}" + string (or org-bibtex-prefix "") + org-bibtex-type-property-name)))) + +(provide 'ol-bibtex) + +;;; ol-bibtex.el ends here diff --git a/elpa/org-9.5.2/ol-bibtex.elc b/elpa/org-9.5.2/ol-bibtex.elc new file mode 100644 index 0000000..f587696 Binary files /dev/null and b/elpa/org-9.5.2/ol-bibtex.elc differ diff --git a/elpa/org-9.5.2/ol-docview.el b/elpa/org-9.5.2/ol-docview.el new file mode 100644 index 0000000..7ab67de --- /dev/null +++ b/elpa/org-9.5.2/ol-docview.el @@ -0,0 +1,103 @@ +;;; ol-docview.el --- Links to Docview mode buffers -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: Jan Böcker +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to open files in doc-view-mode. +;; Org mode loads this module by default - if this is not what you want, +;; configure the variable `org-modules'. + +;; The links take the form +;; +;; docview::: +;; +;; for example: [[docview:~/.elisp/org/doc/org.pdf::1][Org-Mode Manual]] +;; +;; Autocompletion for inserting links is supported; you will be +;; prompted for a file and a page number. +;; +;; If you use org-store-link in a doc-view mode buffer, the stored +;; link will point to the current page. + +;;; Code: + + +(require 'doc-view) +(require 'ol) + +(declare-function doc-view-goto-page "doc-view" (page)) +(declare-function image-mode-window-get "image-mode" (prop &optional winprops)) +(declare-function org-open-file "org" (path &optional in-emacs line search)) + +(org-link-set-parameters "docview" + :follow #'org-docview-open + :export #'org-docview-export + :store #'org-docview-store-link) + +(defun org-docview-export (link description format) + "Export a docview link from Org files." + (let ((path (if (string-match "\\(.+\\)::.+" link) (match-string 1 link) + link)) + (desc (or description link))) + (when (stringp path) + (setq path (expand-file-name path)) + (cond + ((eq format 'html) (format "%s" path desc)) + ((eq format 'latex) (format "\\href{%s}{%s}" path desc)) + ((eq format 'ascii) (format "%s (%s)" desc path)) + (t path))))) + +(defun org-docview-open (link _) + (string-match "\\(.*?\\)\\(?:::\\([0-9]+\\)\\)?$" link) + (let ((path (match-string 1 link)) + (page (and (match-beginning 2) + (string-to-number (match-string 2 link))))) + ;; Let Org mode open the file (in-emacs = 1) to ensure + ;; org-link-frame-setup is respected. + (org-open-file path 1) + (when page (doc-view-goto-page page)))) + +(defun org-docview-store-link () + "Store a link to a docview buffer." + (when (eq major-mode 'doc-view-mode) + ;; This buffer is in doc-view-mode + (let* ((path buffer-file-name) + (page (image-mode-window-get 'page)) + (link (concat "docview:" path "::" (number-to-string page)))) + (org-link-store-props + :type "docview" + :link link + :description path)))) + +(defun org-docview-complete-link () + "Use the existing file name completion for file. +Links to get the file name, then ask the user for the page number +and append it." + (concat (replace-regexp-in-string "^file:" "docview:" (org-link-complete-file)) + "::" + (read-from-minibuffer "Page:" "1"))) + +(provide 'ol-docview) + +;;; ol-docview.el ends here diff --git a/elpa/org-9.5.2/ol-docview.elc b/elpa/org-9.5.2/ol-docview.elc new file mode 100644 index 0000000..604876c Binary files /dev/null and b/elpa/org-9.5.2/ol-docview.elc differ diff --git a/elpa/org-9.5.2/ol-doi.el b/elpa/org-9.5.2/ol-doi.el new file mode 100644 index 0000000..d2d16b2 --- /dev/null +++ b/elpa/org-9.5.2/ol-doi.el @@ -0,0 +1,72 @@ +;;; ol-doi.el --- DOI links support in Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; This library introduces the "doi" link type in Org, and provides +;; code for opening and exporting such links. + +;;; Code: + +(require 'ol) + +(defcustom org-link-doi-server-url "https://doi.org/" + "The URL of the DOI server." + :group 'org-link-follow + :version "24.3" + :type 'string + :safe #'stringp) + +(defun org-link-doi-open (path arg) + "Open a \"doi\" type link. +PATH is a the path to search for, as a string." + (browse-url (url-encode-url (concat org-link-doi-server-url path)) arg)) + +(defun org-link-doi-export (path desc backend info) + "Export a \"doi\" type link. +PATH is the DOI name. DESC is the description of the link, or +nil. BACKEND is a symbol representing the backend used for +export. INFO is a a plist containing the export parameters." + (let ((uri (concat org-link-doi-server-url path))) + (pcase backend + (`html + (format "%s" uri (or desc uri))) + (`latex + (if desc (format "\\href{%s}{%s}" uri desc) + (format "\\url{%s}" uri))) + (`ascii + (if (not desc) (format "<%s>" uri) + (concat (format "[%s]" desc) + (and (not (plist-get info :ascii-links-to-notes)) + (format " (<%s>)" uri))))) + (`texinfo + (if (not desc) (format "@uref{%s}" uri) + (format "@uref{%s, %s}" uri desc))) + (_ uri)))) + +(org-link-set-parameters "doi" + :follow #'org-link-doi-open + :export #'org-link-doi-export) + + +(provide 'org-link-doi) +(provide 'ol-doi) +;;; ol-doi.el ends here diff --git a/elpa/org-9.5.2/ol-doi.elc b/elpa/org-9.5.2/ol-doi.elc new file mode 100644 index 0000000..71a1b36 Binary files /dev/null and b/elpa/org-9.5.2/ol-doi.elc differ diff --git a/elpa/org-9.5.2/ol-eshell.el b/elpa/org-9.5.2/ol-eshell.el new file mode 100644 index 0000000..a7550e3 --- /dev/null +++ b/elpa/org-9.5.2/ol-eshell.el @@ -0,0 +1,68 @@ +;;; ol-eshell.el --- Links to Working Directories in Eshell -*- lexical-binding: t; -*- + +;; Copyright (C) 2011-2021 Free Software Foundation, Inc. + +;; Author: Konrad Hinsen + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'eshell) +(require 'esh-mode) +(require 'ol) + +(declare-function eshell/pwd "em-dirs.el" (&rest args)) + +(org-link-set-parameters "eshell" + :follow #'org-eshell-open + :store #'org-eshell-store-link) + +(defun org-eshell-open (link _) + "Switch to an eshell buffer and execute a command line. +The link can be just a command line (executed in the default +eshell buffer) or a command line prefixed by a buffer name +followed by a colon." + (let* ((buffer-and-command + (if (string-match "\\([A-Za-z0-9+*-]+\\):\\(.*\\)" link) + (list (match-string 1 link) + (match-string 2 link)) + (list eshell-buffer-name link))) + (eshell-buffer-name (car buffer-and-command)) + (command (cadr buffer-and-command))) + (if (get-buffer eshell-buffer-name) + (pop-to-buffer-same-window eshell-buffer-name) + (eshell)) + (goto-char (point-max)) + (eshell-kill-input) + (insert command) + (eshell-send-input))) + +(defun org-eshell-store-link () + "Store a link that, when opened, switches back to the current eshell buffer +and the current working directory." + (when (eq major-mode 'eshell-mode) + (let* ((command (concat "cd " (eshell/pwd))) + (link (concat (buffer-name) ":" command))) + (org-link-store-props + :link (concat "eshell:" link) + :description command)))) + +(provide 'ol-eshell) + +;;; ol-eshell.el ends here diff --git a/elpa/org-9.5.2/ol-eshell.elc b/elpa/org-9.5.2/ol-eshell.elc new file mode 100644 index 0000000..f3a12c8 Binary files /dev/null and b/elpa/org-9.5.2/ol-eshell.elc differ diff --git a/elpa/org-9.5.2/ol-eww.el b/elpa/org-9.5.2/ol-eww.el new file mode 100644 index 0000000..e9ffee6 --- /dev/null +++ b/elpa/org-9.5.2/ol-eww.el @@ -0,0 +1,181 @@ +;;; ol-eww.el --- Store URL and kill from Eww mode -*- lexical-binding: t -*- + +;; Copyright (C) 2014-2021 Free Software Foundation, Inc. + +;; Author: Marco Wahl a +;; Keywords: link, eww +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + + +;;; Commentary: + +;; When this module is active `org-store-link' (often on key C-c l) in +;; an EWW buffer stores a link to the current url of the eww buffer. + +;; In an EWW buffer function `org-eww-copy-for-org-mode' kills either +;; a region or the whole buffer if no region is set and transforms the +;; text on the fly so that it can be pasted into an Org buffer with +;; hot links. + +;; C-c C-x C-w (and also C-c C-x M-w) trigger +;; `org-eww-copy-for-org-mode'. + +;; Hint: A lot of code of this module comes from module org-w3m which +;; has been written by Andy Steward based on the idea of Richard +;; Riley. Thanks! + +;; Potential: Since the code for w3m and eww is so similar one could +;; try to refactor. + + +;;; Code: +(require 'ol) +(require 'cl-lib) +(require 'eww) + +;; For Emacsen < 25. +(defvar eww-current-title) +(defvar eww-current-url) + + +;; Store Org link in Eww mode buffer +(org-link-set-parameters "eww" + :follow #'org-eww-open + :store #'org-eww-store-link) + +(defun org-eww-open (url _) + "Open URL with Eww in the current buffer." + (eww url)) + +(defun org-eww-store-link () + "Store a link to the url of an EWW buffer." + (when (eq major-mode 'eww-mode) + (org-link-store-props + :type "eww" + :link (if (< emacs-major-version 25) + eww-current-url + (eww-current-url)) + :url (url-view-url t) + :description (if (< emacs-major-version 25) + (or eww-current-title eww-current-url) + (or (plist-get eww-data :title) + (eww-current-url)))))) + + +;; Some auxiliary functions concerning links in Eww buffers +(defun org-eww-goto-next-url-property-change () + "Move to the start of next link if exists. +Otherwise point is not moved. Return point." + (goto-char + (or (next-single-property-change (point) 'shr-url) + (point)))) + +(defun org-eww-has-further-url-property-change-p () + "Non-nil if there is a next url property change." + (save-excursion + (not (eq (point) (org-eww-goto-next-url-property-change))))) + +(defun org-eww-url-below-point () + "Return the url below point if there is an url; otherwise, return nil." + (get-text-property (point) 'shr-url)) + + +(defun org-eww-copy-for-org-mode () + "Copy current buffer content or active region with `org-mode' style links. +This will encode `link-title' and `link-location' with +`org-link-make-string' and insert the transformed text into the +kill ring, so that it can be yanked into an Org mode buffer with +links working correctly. + +Further lines starting with a star get quoted with a comma to +keep the structure of the Org file." + (interactive) + (let* ((regionp (org-region-active-p)) + (transform-start (point-min)) + (transform-end (point-max)) + return-content + link-location link-title + temp-position out-bound) + (when regionp + (setq transform-start (region-beginning)) + (setq transform-end (region-end)) + ;; Deactivate mark if current mark is activate. + (when (fboundp 'deactivate-mark) (deactivate-mark))) + (message "Transforming links...") + (save-excursion + (goto-char transform-start) + (while (and (not out-bound) ; still inside region to copy + (org-eww-has-further-url-property-change-p)) ; there is a next link + ;; Store current point before jump next anchor. + (setq temp-position (point)) + ;; Move to next anchor when current point is not at anchor. + (or (org-eww-url-below-point) + (org-eww-goto-next-url-property-change)) + (cl-assert + (org-eww-url-below-point) t + "program logic error: point must have an url below but it hasn't") + (if (<= (point) transform-end) ; if point is inside transform bound + (progn + ;; Get content between two links. + (when (< temp-position (point)) + (setq return-content (concat return-content + (buffer-substring + temp-position (point))))) + ;; Get link location at current point. + (setq link-location (org-eww-url-below-point)) + ;; Get link title at current point. + (setq link-title + (buffer-substring + (point) + (org-eww-goto-next-url-property-change))) + ;; concat `org-mode' style url to `return-content'. + (setq return-content + (concat return-content + (if (org-string-nw-p link-location) + ;; Hint: link-location is different + ;; for form-elements. + (org-link-make-string link-location link-title) + link-title)))) + (goto-char temp-position) ; reset point before jump next anchor + (setq out-bound t))) ; for break out `while' loop + ;; Add the rest until end of the region to be copied. + (when (< (point) transform-end) + (setq return-content + (concat return-content + (buffer-substring (point) transform-end)))) + ;; Quote lines starting with *. + (org-kill-new (replace-regexp-in-string "^\\*" ",*" return-content)) + (message "Transforming links...done, use C-y to insert text into Org mode file")))) + + +;; Additional keys for eww-mode + +(defun org-eww-extend-eww-keymap () + (define-key eww-mode-map "\C-c\C-x\M-w" 'org-eww-copy-for-org-mode) + (define-key eww-mode-map "\C-c\C-x\C-w" 'org-eww-copy-for-org-mode)) + +(when (and (boundp 'eww-mode-map) + (keymapp eww-mode-map)) ; eww is already up. + (org-eww-extend-eww-keymap)) + +(add-hook 'eww-mode-hook #'org-eww-extend-eww-keymap) + + +(provide 'ol-eww) + +;;; ol-eww.el ends here diff --git a/elpa/org-9.5.2/ol-eww.elc b/elpa/org-9.5.2/ol-eww.elc new file mode 100644 index 0000000..cf8f47e Binary files /dev/null and b/elpa/org-9.5.2/ol-eww.elc differ diff --git a/elpa/org-9.5.2/ol-gnus.el b/elpa/org-9.5.2/ol-gnus.el new file mode 100644 index 0000000..72bdd73 --- /dev/null +++ b/elpa/org-9.5.2/ol-gnus.el @@ -0,0 +1,272 @@ +;;; ol-gnus.el --- Links to Gnus Groups and Messages -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Tassilo Horn +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to Gnus groups and messages from within Org. +;; Org mode loads this module by default - if this is not what you want, +;; configure the variable `org-modules'. + +;;; Code: + +(require 'gnus-sum) +(require 'gnus-util) +(require 'nnheader) +(or (require 'nnselect nil t) ; Emacs >= 28 + (require 'nnir nil t)) ; Emacs < 28 +(require 'ol) + + +;;; Declare external functions and variables + +(declare-function gnus-activate-group "gnus-start" (group &optional scan dont-check method dont-sub-check)) +(declare-function gnus-find-method-for-group "gnus" (group &optional info)) +(declare-function gnus-article-show-summary "gnus-art" ()) +(declare-function gnus-group-group-name "gnus-group") +(declare-function gnus-group-jump-to-group "gnus-group" (group &optional prompt)) +(declare-function gnus-group-read-group "gnus-group" (&optional all no-article group select-articles)) +(declare-function message-fetch-field "message" (header &optional not-all)) +(declare-function message-generate-headers "message" (headers)) +(declare-function message-narrow-to-headers "message") +(declare-function message-tokenize-header "message" (header &optional separator)) +(declare-function message-unquote-tokens "message" (elems)) +(declare-function nnvirtual-map-article "nnvirtual" (article)) + +(defvar gnus-newsgroup-name) +(defvar gnus-summary-buffer) +(defvar gnus-other-frame-object) + + +;;; Customization variables + +(defcustom org-gnus-prefer-web-links nil + "If non-nil, `org-store-link' creates web links to Google groups. +\\When nil, Gnus will be used for such links. +Using a prefix argument to the command `\\[org-store-link]' (`org-store-link') +negates this setting for the duration of the command." + :group 'org-link-store + :type 'boolean) + +(defcustom org-gnus-no-server nil + "Should Gnus be started using `gnus-no-server'?" + :group 'org-gnus + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + + +;;; Install the link type + +(org-link-set-parameters "gnus" + :follow #'org-gnus-open + :store #'org-gnus-store-link) + +;;; Implementation + +(defun org-gnus-group-link (group) + "Create a link to the Gnus group GROUP. +If GROUP is a newsgroup and `org-gnus-prefer-web-links' is +non-nil, create a link to groups.google.com. Otherwise create a +link to the group inside Gnus. + +If `org-store-link' was called with a prefix arg the meaning of +`org-gnus-prefer-web-links' is reversed." + (let ((unprefixed-group (replace-regexp-in-string "^[^:]+:" "" group))) + (if (and (string-prefix-p "nntp" group) ;; Only for nntp groups + (org-xor current-prefix-arg + org-gnus-prefer-web-links)) + (concat "https://groups.google.com/group/" unprefixed-group) + (concat "gnus:" group)))) + +(defun org-gnus-article-link (group newsgroups message-id x-no-archive) + "Create a link to a Gnus article. + +The article is specified by its MESSAGE-ID. Additional +parameters are the Gnus GROUP, the NEWSGROUPS the article was +posted to and the X-NO-ARCHIVE header value of that article. + +If GROUP is a newsgroup and `org-gnus-prefer-web-links' is +non-nil, create a link to groups.google.com. +Otherwise create a link to the article inside Gnus. + +If `org-store-link' was called with a prefix arg the meaning of +`org-gnus-prefer-web-links' is reversed." + (if (and (org-xor current-prefix-arg org-gnus-prefer-web-links) + newsgroups ;make web links only for nntp groups + (not x-no-archive)) ;and if X-No-Archive isn't set + (format "https://groups.google.com/groups/search?as_umsgid=%s" + (url-encode-url message-id)) + (concat "gnus:" group "#" message-id))) + +(defun org-gnus-store-link () + "Store a link to a Gnus folder or message." + (pcase major-mode + (`gnus-group-mode + (let ((group (gnus-group-group-name))) + (when group + (org-link-store-props :type "gnus" :group group) + (let ((description (org-gnus-group-link group))) + (org-link-add-props :link description :description description) + description)))) + ((or `gnus-summary-mode `gnus-article-mode) + (let* ((group + (pcase (gnus-find-method-for-group gnus-newsgroup-name) + (`(nnvirtual . ,_) + (save-excursion + (car (nnvirtual-map-article (gnus-summary-article-number))))) + (`(,(or `nnselect `nnir) . ,_) ; nnir is for Emacs < 28. + (save-excursion + (cond + ((fboundp 'nnselect-article-group) + (nnselect-article-group (gnus-summary-article-number))) + ((fboundp 'nnir-article-group) + (nnir-article-group (gnus-summary-article-number))) + (t + (error "No article-group variant bound"))))) + (_ gnus-newsgroup-name))) + (header (if (eq major-mode 'gnus-article-mode) + ;; When in an article, first move to summary + ;; buffer, with point on the summary of the + ;; current article before extracting headers. + (save-window-excursion + (save-excursion + (gnus-article-show-summary) + (gnus-summary-article-header))) + (gnus-summary-article-header))) + (from (mail-header-from header)) + (message-id (org-unbracket-string "<" ">" (mail-header-id header))) + (date (org-trim (mail-header-date header))) + ;; Remove text properties of subject string to avoid Emacs + ;; bug #3506. + (subject (org-no-properties + (copy-sequence (mail-header-subject header)))) + (to (cdr (assq 'To (mail-header-extra header)))) + newsgroups x-no-archive) + ;; Fetching an article is an expensive operation; newsgroup and + ;; x-no-archive are only needed for web links. + (when (org-xor current-prefix-arg org-gnus-prefer-web-links) + ;; Make sure the original article buffer is up-to-date. + (save-window-excursion (gnus-summary-select-article)) + (setq to (or to (gnus-fetch-original-field "To"))) + (setq newsgroups (gnus-fetch-original-field "Newsgroups")) + (setq x-no-archive (gnus-fetch-original-field "x-no-archive"))) + (org-link-store-props :type "gnus" :from from :date date :subject subject + :message-id message-id :group group :to to) + (let ((link (org-gnus-article-link + group newsgroups message-id x-no-archive)) + (description (org-link-email-description))) + (org-link-add-props :link link :description description) + link))) + (`message-mode + (setq org-store-link-plist nil) ;reset + (save-excursion + (save-restriction + (message-narrow-to-headers) + (unless (message-fetch-field "Message-ID") + (message-generate-headers '(Message-ID))) + (goto-char (point-min)) + (re-search-forward "^Message-ID:" nil t) + (put-text-property (line-beginning-position) (line-end-position) + 'message-deletable nil) + (let ((gcc (org-last (message-unquote-tokens + (message-tokenize-header + (mail-fetch-field "gcc" nil t) " ,")))) + (id (org-unbracket-string "<" ">" + (mail-fetch-field "Message-ID"))) + (to (mail-fetch-field "To")) + (from (mail-fetch-field "From")) + (subject (mail-fetch-field "Subject")) + ) ;; newsgroup xarchive ;those are always nil for gcc + (unless gcc (error "Can not create link: No Gcc header found")) + (org-link-store-props :type "gnus" :from from :subject subject + :message-id id :group gcc :to to) + (let ((link (org-gnus-article-link gcc nil id nil)) ;;newsgroup xarchive + (description (org-link-email-description))) + (org-link-add-props :link link :description description) + link))))))) + +(defun org-gnus-open-nntp (path) + "Follow the nntp: link specified by PATH." + (let* ((spec (split-string path "/")) + (server (split-string (nth 2 spec) "@")) + (group (nth 3 spec)) + (article (nth 4 spec))) + (org-gnus-follow-link + (format "nntp+%s:%s" (or (cdr server) (car server)) group) + article))) + +(defun org-gnus-open (path _) + "Follow the Gnus message or folder link specified by PATH." + (unless (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path) + (error "Error in Gnus link %S" path)) + (let ((group (match-string-no-properties 1 path)) + (article (match-string-no-properties 3 path))) + (org-gnus-follow-link group article))) + +(defun org-gnus-follow-link (&optional group article) + "Follow a Gnus link to GROUP and ARTICLE." + (require 'gnus) + (funcall (cdr (assq 'gnus org-link-frame-setup))) + (when gnus-other-frame-object (select-frame gnus-other-frame-object)) + (let ((group (org-no-properties group)) + (article (org-no-properties article))) + (cond + ((and group article) + (gnus-activate-group group) + (condition-case nil + (let ((msg "Couldn't follow Gnus link. Summary couldn't be opened.")) + (pcase (gnus-find-method-for-group group) + (`(nndoc . ,_) + (if (gnus-group-read-group t nil group) + (gnus-summary-goto-article article nil t) + (message msg))) + (_ + (let ((articles 1) + group-opened) + (while (and (not group-opened) + ;; Stop on integer overflows. Note: We + ;; can drop this once we require at least + ;; Emacs 27, which supports bignums. + (> articles 0)) + (setq group-opened (gnus-group-read-group articles t group)) + (setq articles (if (< articles 16) + (1+ articles) + (* articles 2)))) + (if group-opened + (gnus-summary-goto-article article nil t) + (message msg)))))) + (quit + (message "Couldn't follow Gnus link. The linked group is empty.")))) + (group (gnus-group-jump-to-group group))))) + +(defun org-gnus-no-new-news () + "Like `\\[gnus]' but doesn't check for new news." + (cond ((gnus-alive-p) nil) + (org-gnus-no-server (gnus-no-server)) + (t (gnus)))) + +(provide 'ol-gnus) + +;;; ol-gnus.el ends here diff --git a/elpa/org-9.5.2/ol-gnus.elc b/elpa/org-9.5.2/ol-gnus.elc new file mode 100644 index 0000000..25179f2 Binary files /dev/null and b/elpa/org-9.5.2/ol-gnus.elc differ diff --git a/elpa/org-9.5.2/ol-info.el b/elpa/org-9.5.2/ol-info.el new file mode 100644 index 0000000..a535ea5 --- /dev/null +++ b/elpa/org-9.5.2/ol-info.el @@ -0,0 +1,148 @@ +;;; ol-info.el --- Links to Info Nodes -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to Info nodes from within Org mode. +;; Org mode loads this module by default - if this is not what you want, +;; configure the variable `org-modules'. + +;;; Code: + +(require 'ol) + +;; Declare external functions and variables + +(declare-function Info-find-node "info" + (filename nodename &optional no-going-back strict-case)) +(defvar Info-current-file) +(defvar Info-current-node) + +;; Install the link type +(org-link-set-parameters "info" + :follow #'org-info-open + :export #'org-info-export + :store #'org-info-store-link) + +;; Implementation +(defun org-info-store-link () + "Store a link to an Info file and node." + (when (eq major-mode 'Info-mode) + (let ((link (concat "info:" + (file-name-nondirectory Info-current-file) + "#" Info-current-node)) + (desc (concat (file-name-nondirectory Info-current-file) + "#" Info-current-node))) + (org-link-store-props :type "info" :file Info-current-file + :node Info-current-node + :link link :description desc) + link))) + +(defun org-info-open (path _) + "Follow an Info file and node link specified by PATH." + (org-info-follow-link path)) + + +(defun org-info-follow-link (name) + "Follow an Info file and node link specified by NAME." + (if (or (string-match "\\(.*\\)\\(?:#\\|::\\)\\(.*\\)" name) + (string-match "\\(.*\\)" name)) + (let ((filename (match-string 1 name)) + (nodename-or-index (or (match-string 2 name) "Top"))) + (require 'info) + ;; If nodename-or-index is invalid node name, then look it up + ;; in the index. + (condition-case nil + (Info-find-node filename nodename-or-index) + (user-error (Info-find-node filename "Top") + (condition-case nil + (Info-index nodename-or-index) + (user-error "Could not find '%s' node or index entry" + nodename-or-index))))) + (user-error "Could not open: %s" name))) + +(defconst org-info-emacs-documents + '("ada-mode" "auth" "autotype" "bovine" "calc" "ccmode" "cl" "dbus" "dired-x" + "ebrowse" "ede" "ediff" "edt" "efaq-w32" "efaq" "eieio" "eintr" "elisp" + "emacs-gnutls" "emacs-mime" "emacs" "epa" "erc" "ert" "eshell" "eudc" "eww" + "flymake" "forms" "gnus" "htmlfontify" "idlwave" "ido" "info" "mairix-el" + "message" "mh-e" "newsticker" "nxml-mode" "octave-mode" "org" "pcl-cvs" + "pgg" "rcirc" "reftex" "remember" "sasl" "sc" "semantic" "ses" "sieve" + "smtpmail" "speedbar" "srecode" "todo-mode" "tramp" "url" "vip" "viper" + "widget" "wisent" "woman") + "List of Emacs documents available. +Taken from ") + +(defconst org-info-other-documents + '(("libc" . "https://www.gnu.org/software/libc/manual/html_mono/libc.html") + ("make" . "https://www.gnu.org/software/make/manual/make.html")) + "Alist of documents generated from Texinfo source. +When converting info links to HTML, links to any one of these manuals are +converted to use these URL.") + +(defun org-info-map-html-url (filename) + "Return URL or HTML file associated to Info FILENAME. +If FILENAME refers to an official GNU document, return a URL pointing to +the official page for that document, e.g., use \"gnu.org\" for all Emacs +related documents. Otherwise, append \".html\" extension to FILENAME. +See `org-info-emacs-documents' and `org-info-other-documents' for details." + (cond ((member filename org-info-emacs-documents) + (format "https://www.gnu.org/software/emacs/manual/html_mono/%s.html" + filename)) + ((cdr (assoc filename org-info-other-documents))) + (t (concat filename ".html")))) + +(defun org-info--expand-node-name (node) + "Expand Info NODE to HTML cross reference." + ;; See (info "(texinfo) HTML Xref Node Name Expansion") for the + ;; expansion rule. + (let ((node (replace-regexp-in-string + "\\([ \t\n\r]+\\)\\|\\([^a-zA-Z0-9]\\)" + (lambda (m) + (if (match-end 1) "-" (format "_%04x" (string-to-char m)))) + (org-trim node)))) + (cond ((string= node "") "") + ((string-match-p "\\`[0-9]" node) (concat "g_t" node)) + (t node)))) + +(defun org-info-export (path desc format) + "Export an info link. +See `org-link-parameters' for details about PATH, DESC and FORMAT." + (let* ((parts (split-string path "#\\|::")) + (manual (car parts)) + (node (or (nth 1 parts) "Top"))) + (pcase format + (`html + (format "%s" + (org-info-map-html-url manual) + (org-info--expand-node-name node) + (or desc path))) + (`texinfo + (let ((title (or desc ""))) + (format "@ref{%s,%s,,%s,}" node title manual))) + (_ nil)))) + +(provide 'ol-info) + +;;; ol-info.el ends here diff --git a/elpa/org-9.5.2/ol-info.elc b/elpa/org-9.5.2/ol-info.elc new file mode 100644 index 0000000..9b21245 Binary files /dev/null and b/elpa/org-9.5.2/ol-info.elc differ diff --git a/elpa/org-9.5.2/ol-irc.el b/elpa/org-9.5.2/ol-irc.el new file mode 100644 index 0000000..df62dd0 --- /dev/null +++ b/elpa/org-9.5.2/ol-irc.el @@ -0,0 +1,269 @@ +;;; ol-irc.el --- Links to IRC Sessions -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. +;; +;; Author: Philip Jackson +;; Keywords: erc, irc, link, org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; This file implements links to an IRC session from within Org mode. +;; Org mode loads this module by default - if this is not what you want, +;; configure the variable `org-modules'. +;; +;; Please customize the variable `org-modules' to select +;; extensions you would like to use, and to deselect those which you don't +;; want. +;; +;; Please note that at the moment only ERC is supported. Other clients +;; shouldn't be difficult to add though. +;; +;; Then set `org-irc-link-to-logs' to non-nil if you would like a +;; file:/ type link to be created to the current line in the logs or +;; to t if you would like to create an irc:/ style link. +;; +;; Links within an org buffer might look like this: +;; +;; [[irc:/irc.libera.chat/#emacs/bob][chat with bob in #emacs on Libera.Chat]] +;; [[irc:/irc.libera.chat/#emacs][#emacs on Libera.Chat]] +;; [[irc:/irc.libera.chat/]] +;; +;; If, when the resulting link is visited, there is no connection to a +;; requested server then one will be created. + +;;; Code: + +(require 'ol) + +(declare-function erc-buffer-filter "erc" (predicate &optional proc)) +(declare-function erc-channel-p "erc" (channel)) +(declare-function erc-cmd-JOIN "erc" (channel &optional key)) +(declare-function erc-current-logfile "erc-log" (&optional buffer)) +(declare-function erc-default-target "erc" ()) +(declare-function erc-get-server-nickname-list "erc" ()) +(declare-function erc-logging-enabled "erc-log" (&optional buffer)) +(declare-function erc-prompt "erc" ()) +(declare-function erc-save-buffer-in-logs "erc-log" (&optional buffer)) +(declare-function erc-server-buffer "erc" ()) + +(defvar org-irc-client 'erc + "The IRC client to act on.") + +(defvar org-irc-link-to-logs nil + "Non-nil will store a link to the logs, nil will store an irc: style link.") + +(defvar erc-default-port) ; dynamically scoped from erc.el +(defvar erc-session-port) ; dynamically scoped form erc-backend.el +(defvar erc-session-server) ; dynamically scoped form erc-backend.el + +;; Generic functions/config (extend these for other clients) + +(org-link-set-parameters "irc" + :follow #'org-irc-visit + :store #'org-irc-store-link + :export #'org-irc-export) + +(defun org-irc-visit (link _) + "Parse LINK and dispatch to the correct function based on the client found." + (let ((link (org-irc-parse-link link))) + (cond + ((eq org-irc-client 'erc) + (org-irc-visit-erc link)) + (t + (error "ERC only known client"))))) + +(defun org-irc-parse-link (link) + "Parse an IRC LINK and return the attributes found. +Parse a LINK that looks like server:port/chan/user (port, chan +and user being optional) and return any of the port, channel or user +attributes that are found." + (let* ((parts (split-string link "/" t)) + (len (length parts))) + (when (or (< len 1) (> len 3)) + (error "Failed to parse link needed 1-3 parts, got %d" len)) + (setcar parts (split-string (car parts) ":" t)) + parts)) + +;;;###autoload +(defun org-irc-store-link () + "Dispatch to the appropriate function to store a link to an IRC session." + (cond + ((eq major-mode 'erc-mode) + (org-irc-erc-store-link)))) + +(defun org-irc-ellipsify-description (string &optional after) + "Remove unnecessary white space from STRING and add ellipses if necessary. +Strip starting and ending white space from STRING and replace any +chars that the value AFTER with `...'" + (let* ((after (number-to-string (or after 30))) + (replace-map (list (cons "^[ \t]*" "") + (cons "[ \t]*$" "") + (cons (concat "^\\(.\\{" after + "\\}\\).*") "\\1...")))) + (dolist (x replace-map string) + (when (string-match (car x) string) + (setq string (replace-match (cdr x) nil nil string)))))) + +;; ERC specific functions + +(defun org-irc-erc-get-line-from-log (erc-line) + "Find the best line to link to from the ERC logs given ERC-LINE as a start. +If the user is on the ERC-prompt then search backward for the +first non-blank line, otherwise return the current line. The +result is a cons of the filename and search string." + (erc-save-buffer-in-logs) + (require 'erc-log) + (with-current-buffer (find-file-noselect (erc-current-logfile)) + (goto-char (point-max)) + (list + (abbreviate-file-name buffer-file-name) + ;; can we get a '::' part? + (if (string= erc-line (erc-prompt)) + (progn + (goto-char (point-at-bol)) + (when (search-backward-regexp "^[^ ]" nil t) + (buffer-substring-no-properties (point-at-bol) + (point-at-eol)))) + (when (search-backward erc-line nil t) + (buffer-substring-no-properties (point-at-bol) + (point-at-eol))))))) + +(defun org-irc-erc-store-link () + "Store a link to the IRC log file or the session itself. +Depending on the variable `org-irc-link-to-logs' store either a +link to the log file for the current session or an irc: link to +the session itself." + (require 'erc-log) + (if org-irc-link-to-logs + (let* ((erc-line (buffer-substring-no-properties + (point-at-bol) (point-at-eol))) + (parsed-line (org-irc-erc-get-line-from-log erc-line))) + (if (erc-logging-enabled nil) + (progn + (org-link-store-props + :type "file" + :description (concat "'" (org-irc-ellipsify-description + (cadr parsed-line) 20) + "' from an IRC conversation") + :link (concat "file:" (car parsed-line) "::" + (cadr parsed-line))) + t) + (error "This ERC session is not being logged"))) + (let* ((link-text (org-irc-get-erc-link)) + (link (org-irc-parse-link link-text))) + (if link-text + (progn + (org-link-store-props + :type "irc" + :link (concat "irc:/" link-text) + :description (concat "irc session `" link-text "'") + :server (car (car link)) + :port (or (string-to-number (cadr (pop link))) erc-default-port) + :nick (pop link)) + t) + (error "Failed to create ('irc:/' style) ERC link"))))) + +(defun org-irc-get-erc-link () + "Return an org compatible irc:/ link from an ERC buffer." + (let* ((session-port (if (numberp erc-session-port) + (number-to-string erc-session-port) + erc-session-port)) + (link (concat erc-session-server ":" session-port))) + (concat link "/" + (if (and (erc-default-target) + (erc-channel-p (erc-default-target)) + (car (get-text-property (point) 'erc-data))) + ;; we can get a nick + (let ((nick (car (get-text-property (point) 'erc-data)))) + (concat (erc-default-target) "/" nick)) + (erc-default-target))))) + +(defun org-irc-get-current-erc-port () + "Return the current port as a number. +Return the current port number or, if none is set, return the ERC +default." + (cond + ((stringp erc-session-port) + (string-to-number erc-session-port)) + ((numberp erc-session-port) + erc-session-port) + (t + erc-default-port))) + +(defun org-irc-visit-erc (link) + "Visit an ERC buffer based on criteria found in LINK." + (require 'erc) + (require 'erc-log) + (let* ((server (car (car link))) + (port (let ((p (cadr (pop link)))) + (if p (string-to-number p) erc-default-port))) + (server-buffer) + (buffer-list + (erc-buffer-filter + (lambda nil + (let ((tmp-server-buf (erc-server-buffer))) + (and tmp-server-buf + (with-current-buffer tmp-server-buf + (and + (eq (org-irc-get-current-erc-port) port) + (string= erc-session-server server) + (setq server-buffer tmp-server-buf))))))))) + (if buffer-list + (let ((chan-name (pop link))) + ;; if we got a channel name then switch to it or join it + (if chan-name + (let ((chan-buf (catch 'found + (dolist (x buffer-list) + (if (string= (buffer-name x) chan-name) + (throw 'found x)))))) + (if chan-buf + (progn + (pop-to-buffer-same-window chan-buf) + ;; if we got a nick, and they're in the chan, + ;; then start a chat with them + (let ((nick (pop link))) + (when nick + (if (member nick (erc-get-server-nickname-list)) + (progn + (goto-char (point-max)) + (insert (concat nick ": "))) + (error "%s not found in %s" nick chan-name))))) + (progn + (pop-to-buffer-same-window server-buffer) + (erc-cmd-JOIN chan-name)))) + (pop-to-buffer-same-window server-buffer))) + ;; no server match, make new connection + (erc-select :server server :port port)))) + +(defun org-irc-export (link description format) + "Export an IRC link. +See `org-link-parameters' for details about LINK, DESCRIPTION and +FORMAT." + (let ((desc (or description link))) + (pcase format + (`html (format "%s" link desc)) + (`md (format "[%s](irc:%s)" desc link)) + (_ nil)))) + +(provide 'ol-irc) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; ol-irc.el ends here diff --git a/elpa/org-9.5.2/ol-irc.elc b/elpa/org-9.5.2/ol-irc.elc new file mode 100644 index 0000000..40263fd Binary files /dev/null and b/elpa/org-9.5.2/ol-irc.elc differ diff --git a/elpa/org-9.5.2/ol-man.el b/elpa/org-9.5.2/ol-man.el new file mode 100644 index 0000000..0d9ac7c --- /dev/null +++ b/elpa/org-9.5.2/ol-man.el @@ -0,0 +1,86 @@ +;;; ol-man.el --- Links to man pages -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2020-2021 Free Software Foundation, Inc. +;; Author: Carsten Dominik +;; Maintainer: Bastien Guerry +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is 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, 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +(require 'ol) + +(org-link-set-parameters "man" + :follow #'org-man-open + :export #'org-man-export + :store #'org-man-store-link) + +(defcustom org-man-command 'man + "The Emacs command to be used to display a man page." + :group 'org-link + :type '(choice (const man) (const woman))) + +(defun org-man-open (path _) + "Visit the manpage on PATH. +PATH should be a topic that can be thrown at the man command. +If PATH contains extra ::STRING which will use `occur' to search +matched strings in man buffer." + (string-match "\\(.*?\\)\\(?:::\\(.*\\)\\)?$" path) + (let* ((command (match-string 1 path)) + (search (match-string 2 path))) + (funcall org-man-command command) + (when search + (with-current-buffer (concat "*Man " command "*") + (goto-char (point-min)) + (search-forward search))))) + +(defun org-man-store-link () + "Store a link to a README file." + (when (memq major-mode '(Man-mode woman-mode)) + ;; This is a man page, we do make this link + (let* ((page (org-man-get-page-name)) + (link (concat "man:" page)) + (description (format "Manpage for %s" page))) + (org-link-store-props + :type "man" + :link link + :description description)))) + +(defun org-man-get-page-name () + "Extract the page name from the buffer name." + ;; This works for both `Man-mode' and `woman-mode'. + (if (string-match " \\(\\S-+\\)\\*" (buffer-name)) + (match-string 1 (buffer-name)) + (error "Cannot create link to this man page"))) + +(defun org-man-export (link description format) + "Export a man page link from Org files." + (let ((path (format "http://man.he.net/?topic=%s§ion=all" link)) + (desc (or description link))) + (cond + ((eq format 'html) (format "%s" path desc)) + ((eq format 'latex) (format "\\href{%s}{%s}" path desc)) + ((eq format 'texinfo) (format "@uref{%s,%s}" path desc)) + ((eq format 'ascii) (format "%s (%s)" desc path)) + ((eq format 'md) (format "[%s](%s)" desc path)) + (t path)))) + +(provide 'ol-man) + +;;; ol-man.el ends here diff --git a/elpa/org-9.5.2/ol-man.elc b/elpa/org-9.5.2/ol-man.elc new file mode 100644 index 0000000..4ef669b Binary files /dev/null and b/elpa/org-9.5.2/ol-man.elc differ diff --git a/elpa/org-9.5.2/ol-mhe.el b/elpa/org-9.5.2/ol-mhe.el new file mode 100644 index 0000000..37147a3 --- /dev/null +++ b/elpa/org-9.5.2/ol-mhe.el @@ -0,0 +1,219 @@ +;;; ol-mhe.el --- Links to MH-E Messages -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Thomas Baumann +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to MH-E messages from within Org. +;; Org mode loads this module by default - if this is not what you want, +;; configure the variable `org-modules'. + +;;; Code: + +(require 'org-macs) +(require 'ol) + +;; Customization variables + +(defcustom org-mhe-search-all-folders nil + "Non-nil means the search for the mh-message may extend to all folders. +When non-nil, the search for a message will extend to all other +folders if it cannot be found in the folder given in the link. +Searching all folders may be slow with the default pick based +search but is very efficient with one of the other search engines +supported by MH-E." + :group 'org-link-follow + :type 'boolean) + +;; Declare external functions and variables +(declare-function mh-display-msg "mh-show" (msg-num folder-name)) +(declare-function mh-find-path "mh-utils" ()) +(declare-function mh-get-header-field "mh-utils" (field)) +(declare-function mh-get-msg-num "mh-utils" (error-if-no-message)) +(declare-function mh-header-display "mh-show" ()) +(declare-function mh-index-previous-folder "mh-search" ()) +(declare-function mh-normalize-folder-name "mh-utils" + (folder &optional empty-string-okay dont-remove-trailing-slash + return-nil-if-folder-empty)) +(declare-function mh-search "mh-search" + (folder search-regexp &optional redo-search-flag + window-config)) +(declare-function mh-search-choose "mh-search" (&optional searcher)) +(declare-function mh-show "mh-show" (&optional message redisplay-flag)) +(declare-function mh-show-buffer-message-number "mh-comp" (&optional buffer)) +(declare-function mh-show-header-display "mh-show" t t) +(declare-function mh-show-msg "mh-show" (msg)) +(declare-function mh-show-show "mh-show" t t) +(declare-function mh-visit-folder "mh-folder" (folder &optional + range index-data)) +(defvar mh-progs) +(defvar mh-current-folder) +(defvar mh-show-folder-buffer) +(defvar mh-index-folder) +(defvar mh-searcher) +(defvar mh-search-regexp-builder) + +;; Install the link type +(org-link-set-parameters "mhe" :follow #'org-mhe-open :store #'org-mhe-store-link) + +;; Implementation +(defun org-mhe-store-link () + "Store a link to an MH-E folder or message." + (when (or (eq major-mode 'mh-folder-mode) + (eq major-mode 'mh-show-mode)) + (save-window-excursion + (let* ((from (org-mhe-get-header "From:")) + (to (org-mhe-get-header "To:")) + (message-id (org-mhe-get-header "Message-Id:")) + (subject (org-mhe-get-header "Subject:")) + (date (org-mhe-get-header "Date:")) + link desc) + (org-link-store-props :type "mh" :from from :to to :date date + :subject subject :message-id message-id) + (setq desc (org-link-email-description)) + (setq link (concat "mhe:" (org-mhe-get-message-real-folder) "#" + (org-unbracket-string "<" ">" message-id))) + (org-link-add-props :link link :description desc) + link)))) + +(defun org-mhe-open (path _) + "Follow an MH-E message link specified by PATH." + (let (folder article) + (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path)) + (error "Error in MH-E link")) + (setq folder (match-string 1 path) + article (match-string 3 path)) + (org-mhe-follow-link folder article))) + +;;; mh-e integration based on planner-mode +(defun org-mhe-get-message-real-folder () + "Return the name of the real folder for the current message. +So if you use sequences, it will now work." + (save-excursion + (let* ((folder + (if (eq major-mode 'mh-folder-mode) + mh-current-folder + ;; Refer to the show buffer + mh-show-folder-buffer)) + (end-index + (if (boundp 'mh-index-folder) + (min (length mh-index-folder) (length folder)))) + ) + ;; a simple test on mh-index-data does not work, because + ;; mh-index-data is always nil in a show buffer. + (if (and (boundp 'mh-index-folder) + (string= mh-index-folder (substring folder 0 end-index))) + (if (eq major-mode 'mh-show-mode) + (save-window-excursion + (let (pop-up-frames) + (when (buffer-live-p (get-buffer folder)) + (progn + (pop-to-buffer folder) + (org-mhe-get-message-folder-from-index) + ) + ))) + (org-mhe-get-message-folder-from-index) + ) + folder + ) + ))) + +(defun org-mhe-get-message-folder-from-index () + "Return the name of the message folder in an index folder buffer." + (save-excursion + (mh-index-previous-folder) + (if (re-search-forward "^\\(\\+.*\\)$" nil t) + (message "%s" (match-string 1))))) + +(defun org-mhe-get-message-folder () + "Return the name of the current message folder. +Be careful if you use sequences." + (save-excursion + (if (eq major-mode 'mh-folder-mode) + mh-current-folder + ;; Refer to the show buffer + mh-show-folder-buffer))) + +(defun org-mhe-get-message-num () + "Return the number of the current message. +Be careful if you use sequences." + (save-excursion + (if (eq major-mode 'mh-folder-mode) + (mh-get-msg-num nil) + ;; Refer to the show buffer + (mh-show-buffer-message-number)))) + +(defun org-mhe-get-header (header) + "Return the field for HEADER of the message in folder mode. +This will create a show buffer for the corresponding message. If +you have a better idea of how to do this then please let us know." + (let* ((folder (org-mhe-get-message-folder)) + (num (org-mhe-get-message-num)) + (buffer (get-buffer-create (concat "show-" folder))) + (header-field)) + (with-current-buffer buffer + (mh-display-msg num folder) + (if (eq major-mode 'mh-folder-mode) + (mh-header-display) + (mh-show-header-display)) + (set-buffer buffer) + (setq header-field (mh-get-header-field header)) + (if (eq major-mode 'mh-folder-mode) + (mh-show) + (mh-show-show)) + (org-trim header-field)))) + +(defun org-mhe-follow-link (folder article) + "Follow an MH-E link to FOLDER and ARTICLE. +If ARTICLE is nil FOLDER is shown. If the configuration variable +`org-mhe-search-all-folders' is t and `mh-searcher' is pick, +ARTICLE is searched in all folders. Indexed searches (swish++, +namazu, and others supported by MH-E) will always search in all +folders." + (require 'mh-e) + (require 'mh-search) + (require 'mh-utils) + (mh-find-path) + (if (not article) + (mh-visit-folder (mh-normalize-folder-name folder)) + (mh-search-choose) + (if (eq mh-searcher 'pick) + (progn + (setq article (org-link-add-angle-brackets article)) + (mh-search folder (list "--message-id" article)) + (when (and org-mhe-search-all-folders + (not (org-mhe-get-message-real-folder))) + (kill-buffer) + (mh-search "+" (list "--message-id" article)))) + (if mh-search-regexp-builder + (mh-search "+" (funcall mh-search-regexp-builder + (list (cons 'message-id article)))) + (mh-search "+" article))) + (if (org-mhe-get-message-real-folder) + (mh-show-msg 1) + (kill-buffer) + (error "Message not found")))) + +(provide 'ol-mhe) + +;;; ol-mhe.el ends here diff --git a/elpa/org-9.5.2/ol-mhe.elc b/elpa/org-9.5.2/ol-mhe.elc new file mode 100644 index 0000000..5e6f664 Binary files /dev/null and b/elpa/org-9.5.2/ol-mhe.elc differ diff --git a/elpa/org-9.5.2/ol-rmail.el b/elpa/org-9.5.2/ol-rmail.el new file mode 100644 index 0000000..2593ebd --- /dev/null +++ b/elpa/org-9.5.2/ol-rmail.el @@ -0,0 +1,117 @@ +;;; ol-rmail.el --- Links to Rmail Messages -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to Rmail messages from within Org mode. +;; Org mode loads this module by default - if this is not what you +;; want, configure the variable `org-modules'. + +;;; Code: + +(require 'ol) + +;; Declare external functions and variables +(declare-function rmail-show-message "rmail" (&optional n no-summary)) +(declare-function rmail-what-message "rmail" (&optional pos)) +(declare-function rmail-toggle-header "rmail" (&optional arg)) +(declare-function rmail "rmail" (&optional file-name-arg)) +(declare-function rmail-widen "rmail" ()) +(defvar rmail-current-message) ; From rmail.el +(defvar rmail-header-style) ; From rmail.el +(defvar rmail-file-name) ; From rmail.el + +;; Install the link type +(org-link-set-parameters "rmail" + :follow #'org-rmail-open + :store #'org-rmail-store-link) + +;; Implementation +(defun org-rmail-store-link () + "Store a link to an Rmail folder or message." + (when (or (eq major-mode 'rmail-mode) + (eq major-mode 'rmail-summary-mode)) + (save-window-excursion + (save-restriction + (when (eq major-mode 'rmail-summary-mode) + (rmail-show-message rmail-current-message)) + (when (fboundp 'rmail-narrow-to-non-pruned-header) + (rmail-narrow-to-non-pruned-header)) + (when (eq rmail-header-style 'normal) + (rmail-toggle-header -1)) + (let* ((folder buffer-file-name) + (message-id (mail-fetch-field "message-id")) + (from (mail-fetch-field "from")) + (to (mail-fetch-field "to")) + (subject (mail-fetch-field "subject")) + (date (mail-fetch-field "date")) + desc link) + (org-link-store-props + :type "rmail" :from from :to to :date date + :subject subject :message-id message-id) + (setq message-id (org-unbracket-string "<" ">" message-id)) + (setq desc (org-link-email-description)) + (setq link (concat "rmail:" folder "#" message-id)) + (org-link-add-props :link link :description desc) + (rmail-show-message rmail-current-message) + link))))) + +(defun org-rmail-open (path _) + "Follow an Rmail message link to the specified PATH." + (let (folder article) + (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path)) + (error "Error in Rmail link")) + (setq folder (match-string 1 path) + article (match-string 3 path)) + (org-rmail-follow-link folder article))) + +(defun org-rmail-follow-link (folder article) + "Follow an Rmail link to FOLDER and ARTICLE." + (require 'rmail) + (cond ((null article) (setq article "")) + ((stringp article) + (setq article (org-link-add-angle-brackets article))) + (t (user-error "Wrong RMAIL link format"))) + (let (message-number) + (save-excursion + (save-window-excursion + (rmail (if (string= folder "RMAIL") rmail-file-name folder)) + (setq message-number + (save-restriction + (rmail-widen) + (goto-char (point-max)) + (if (re-search-backward + (concat "^Message-ID:\\s-+" (regexp-quote article)) + nil t) + (rmail-what-message)))))) + (if message-number + (progn + (rmail (if (string= folder "RMAIL") rmail-file-name folder)) + (rmail-show-message message-number) + message-number) + (error "Message not found")))) + +(provide 'ol-rmail) + +;;; ol-rmail.el ends here diff --git a/elpa/org-9.5.2/ol-rmail.elc b/elpa/org-9.5.2/ol-rmail.elc new file mode 100644 index 0000000..37858d3 Binary files /dev/null and b/elpa/org-9.5.2/ol-rmail.elc differ diff --git a/elpa/org-9.5.2/ol-w3m.el b/elpa/org-9.5.2/ol-w3m.el new file mode 100644 index 0000000..9e03269 --- /dev/null +++ b/elpa/org-9.5.2/ol-w3m.el @@ -0,0 +1,221 @@ +;;; ol-w3m.el --- Copy and Paste From W3M -*- lexical-binding: t; -*- + +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. + +;; Author: Andy Stewart +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements copying HTML content from a w3m buffer and +;; transforming the text on the fly so that it can be pasted into an +;; Org buffer with hot links. It will also work for regions in gnus +;; buffers that have been washed with w3m. + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Acknowledgments: + +;; Richard Riley +;; +;; The idea of transforming the HTML content with Org syntax is +;; proposed by Richard, I'm just coding it. +;; + +;;; Code: + +(require 'ol) + +(defvar w3m-current-url) +(defvar w3m-current-title) + +(org-link-set-parameters "w3m" :store #'org-w3m-store-link) +(defun org-w3m-store-link () + "Store a link to a w3m buffer." + (when (eq major-mode 'w3m-mode) + (org-link-store-props + :type "w3m" + :link w3m-current-url + :url (url-view-url t) + :description (or w3m-current-title w3m-current-url)))) + +(defun org-w3m-copy-for-org-mode () + "Copy current buffer content or active region with Org style links. +This will encode `link-title' and `link-location' with +`org-link-make-string', and insert the transformed test into the kill ring, +so that it can be yanked into an Org buffer with links working correctly." + (interactive) + (let* ((regionp (org-region-active-p)) + (transform-start (point-min)) + (transform-end (point-max)) + return-content + link-location link-title + temp-position out-bound) + (when regionp + (setq transform-start (region-beginning)) + (setq transform-end (region-end)) + ;; Deactivate mark if current mark is activate. + (when (fboundp 'deactivate-mark) (deactivate-mark))) + (message "Transforming links...") + (save-excursion + (goto-char transform-start) + (while (and (not out-bound) ; still inside region to copy + (not (org-w3m-no-next-link-p))) ; no next link current buffer + ;; store current point before jump next anchor + (setq temp-position (point)) + ;; move to next anchor when current point is not at anchor + (or (get-text-property (point) 'w3m-href-anchor) (org-w3m-get-next-link-start)) + (cond + ((<= (point) transform-end) ; point is inside transform bound + ;; get content between two links. + (when (> (point) temp-position) + (setq return-content (concat return-content + (buffer-substring + temp-position (point))))) + (cond + ((setq link-location (get-text-property (point) 'w3m-href-anchor)) + ;; current point is a link + ;; (we thus also got link location at current point) + ;; get link title at current point. + (setq link-title (buffer-substring (point) + (org-w3m-get-anchor-end))) + ;; concat Org style url to `return-content'. + (setq return-content + (concat return-content + (if (org-string-nw-p link-location) + (org-link-make-string link-location link-title) + link-title)))) + ((setq link-location (get-text-property (point) 'w3m-image)) + ;; current point is an image + ;; (we thus also got image link location at current point) + ;; get link title at current point. + (setq link-title (buffer-substring (point) (org-w3m-get-image-end))) + ;; concat Org style url to `return-content'. + (setq return-content + (concat return-content + (if (org-string-nw-p link-location) + (org-link-make-string link-location link-title) + link-title)))) + (t nil))); current point is neither a link nor an image + (t ; point is NOT inside transform bound + (goto-char temp-position) ; reset point before jump next anchor + (setq out-bound t)))) ; for break out `while' loop + ;; add the rest until end of the region to be copied + (when (< (point) transform-end) + (setq return-content + (concat return-content + (buffer-substring (point) transform-end)))) + (org-kill-new return-content) + (message "Transforming links...done, use C-y to insert text into Org file") + (message "Copy with link transformation complete.")))) + +(defun org-w3m-get-anchor-start () + "Move cursor to the start of current anchor. Return point." + ;; get start position of anchor or current point + ;; NOTE: This function seems never to be used. Should it be removed? + (goto-char (or (previous-single-property-change (point) 'w3m-anchor-sequence) + (point)))) + +(defun org-w3m-get-anchor-end () + "Move cursor to the end of current anchor. Return point." + ;; get end position of anchor or point + (goto-char (or (next-single-property-change (point) 'w3m-anchor-sequence) + (point)))) + +(defun org-w3m-get-image-end () + "Move cursor to the end of current image. Return point." + ;; get end position of image or point + ;; NOTE: Function `org-w3m-get-image-start' was not created because + ;; function `org-w3m-get-anchor-start' is never used. + (goto-char (or (next-single-property-change (point) 'w3m-image) + (point)))) + +(defun org-w3m-get-next-link-start () + "Move cursor to the start of next link or image. Return point." + (let (pos start-pos anchor-pos image-pos) + (setq pos (setq start-pos (point))) + (setq anchor-pos + (catch 'reach + (while (setq pos (next-single-property-change pos 'w3m-anchor-sequence)) + (when (get-text-property pos 'w3m-href-anchor) + (throw 'reach pos))))) + (setq pos start-pos) + (setq image-pos + (catch 'reach + (while (setq pos (next-single-property-change pos 'w3m-image)) + (when (get-text-property pos 'w3m-image) + (throw 'reach pos))))) + (goto-char (min (or anchor-pos (point-max)) (or image-pos (point-max)))))) + +(defun org-w3m-get-prev-link-start () + "Move cursor to the start of previous link. Return point." + ;; NOTE: This function is only called by `org-w3m-no-prev-link-p', + ;; which itself seems never to be used. Should it be removed? + ;; + ;; WARNING: This function has not been updated to account for + ;; `w3m-image'. See `org-w3m-get-next-link-start'. + (catch 'reach + (let ((pos (point))) + (while (setq pos (previous-single-property-change pos 'w3m-anchor-sequence)) + (when (get-text-property pos 'w3m-href-anchor) + ;; jump to previous anchor + (goto-char pos) + ;; return point when current is valid link + (throw 'reach nil))))) + (point)) + +(defun org-w3m-no-next-link-p () + "Whether there is no next link after the cursor. +Return t if there is no next link; otherwise, return nil." + (save-excursion + (equal (point) (org-w3m-get-next-link-start)))) + +(defun org-w3m-no-prev-link-p () + "Whether there is no previous link after the cursor. +Return t if there is no previous link; otherwise, return nil." + ;; NOTE: This function seems never to be used. Should it be removed? + (save-excursion + (equal (point) (org-w3m-get-prev-link-start)))) + +;; Install keys into the w3m keymap +(defvar w3m-mode-map) +(defvar w3m-minor-mode-map) +(when (and (boundp 'w3m-mode-map) + (keymapp w3m-mode-map)) + (define-key w3m-mode-map "\C-c\C-x\M-w" 'org-w3m-copy-for-org-mode) + (define-key w3m-mode-map "\C-c\C-x\C-w" 'org-w3m-copy-for-org-mode)) +(when (and (boundp 'w3m-minor-mode-map) + (keymapp w3m-minor-mode-map)) + (define-key w3m-minor-mode-map "\C-c\C-x\M-w" 'org-w3m-copy-for-org-mode) + (define-key w3m-minor-mode-map "\C-c\C-x\C-w" 'org-w3m-copy-for-org-mode)) +(add-hook + 'w3m-mode-hook + (lambda () + (define-key w3m-mode-map "\C-c\C-x\M-w" 'org-w3m-copy-for-org-mode) + (define-key w3m-mode-map "\C-c\C-x\C-w" 'org-w3m-copy-for-org-mode))) +(add-hook + 'w3m-minor-mode-hook + (lambda () + (define-key w3m-minor-mode-map "\C-c\C-x\M-w" 'org-w3m-copy-for-org-mode) + (define-key w3m-minor-mode-map "\C-c\C-x\C-w" 'org-w3m-copy-for-org-mode))) + +(provide 'ol-w3m) + +;;; ol-w3m.el ends here diff --git a/elpa/org-9.5.2/ol-w3m.elc b/elpa/org-9.5.2/ol-w3m.elc new file mode 100644 index 0000000..937307f Binary files /dev/null and b/elpa/org-9.5.2/ol-w3m.elc differ diff --git a/elpa/org-9.5.2/ol.el b/elpa/org-9.5.2/ol.el new file mode 100644 index 0000000..aa18497 --- /dev/null +++ b/elpa/org-9.5.2/ol.el @@ -0,0 +1,2042 @@ +;;; ol.el --- Org links library -*- lexical-binding: t; -*- + +;; Copyright (C) 2018-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; This library provides tooling to handle both external and internal +;; links. + +;;; Code: + +(require 'org-compat) +(require 'org-macs) + +(defvar clean-buffer-list-kill-buffer-names) +(defvar org-agenda-buffer-name) +(defvar org-comment-string) +(defvar org-highlight-links) +(defvar org-id-link-to-org-use-id) +(defvar org-inhibit-startup) +(defvar org-outline-regexp-bol) +(defvar org-src-source-file-name) +(defvar org-time-stamp-formats) +(defvar org-ts-regexp) + +(declare-function calendar-cursor-to-date "calendar" (&optional error event)) +(declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep)) +(declare-function org-at-heading-p "org" (&optional _)) +(declare-function org-back-to-heading "org" (&optional invisible-ok)) +(declare-function org-before-first-heading-p "org" ()) +(declare-function org-do-occur "org" (regexp &optional cleanup)) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-cache-refresh "org-element" (pos)) +(declare-function org-element-context "org-element" (&optional element)) +(declare-function org-element-lineage "org-element" (datum &optional types with-self)) +(declare-function org-element-link-parser "org-element" ()) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-element-update-syntax "org-element" ()) +(declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) +(declare-function org-find-property "org" (property &optional value)) +(declare-function org-get-heading "org" (&optional no-tags no-todo no-priority no-comment)) +(declare-function org-id-find-id-file "org-id" (id)) +(declare-function org-id-store-link "org-id" ()) +(declare-function org-insert-heading "org" (&optional arg invisible-ok top)) +(declare-function org-load-modules-maybe "org" (&optional force)) +(declare-function org-mark-ring-push "org" (&optional pos buffer)) +(declare-function org-mode "org" ()) +(declare-function org-occur "org" (regexp &optional keep-previous callback)) +(declare-function org-open-file "org" (path &optional in-emacs line search)) +(declare-function org-overview "org" ()) +(declare-function org-restart-font-lock "org" ()) +(declare-function org-run-like-in-org-mode "org" (cmd)) +(declare-function org-show-context "org" (&optional key)) +(declare-function org-src-coderef-format "org-src" (&optional element)) +(declare-function org-src-coderef-regexp "org-src" (fmt &optional label)) +(declare-function org-src-edit-buffer-p "org-src" (&optional buffer)) +(declare-function org-src-source-buffer "org-src" ()) +(declare-function org-src-source-type "org-src" ()) +(declare-function org-time-stamp-format "org" (&optional long inactive)) +(declare-function outline-next-heading "outline" ()) + + +;;; Customization + +(defgroup org-link nil + "Options concerning links in Org mode." + :tag "Org Link" + :group 'org) + +(defcustom org-link-parameters nil + "Alist of properties that defines all the links in Org mode. + +The key in each association is a string of the link type. +Subsequent optional elements make up a property list for that +type. + +All properties are optional. However, the most important ones +are, in this order, `:follow', `:export', and `:store', described +below. + +`:follow' + + Function used to follow the link, when the `org-open-at-point' + command runs on it. It is called with two arguments: the path, + as a string, and a universal prefix argument. + + Here, you may use `org-link-open-as-file' helper function for + types similar to \"file\". + +`:export' + + Function that accepts four arguments: + - the path, as a string, + - the description as a string, or nil, + - the export back-end, + - the export communication channel, as a plist. + + When nil, export for that type of link is delegated to the + back-end. + +`:store' + + Function responsible for storing the link. See the function + `org-store-link-functions' for a description of the expected + arguments. + +Additional properties provide more specific control over the +link. + +`:activate-func' + + Function to run at the end of Font Lock activation. It must + accept four arguments: + - the buffer position at the start of the link, + - the buffer position at its end, + - the path, as a string, + - a boolean, non-nil when the link has brackets. + +`:complete' + + Function that inserts a link with completion. The function + takes one optional prefix argument. + +`:display' + + Value for `invisible' text property on the hidden parts of the + link. The most useful value is `full', which will not fold the + link in descriptive display. Default is `org-link'. + +`:face' + + Face for the link, or a function returning a face. The + function takes one argument, which is the path. + + The default face is `org-link'. + +`:help-echo' + + String or function used as a value for the `help-echo' text + property. The function is called with one argument, the help + string to display, and should return a string. + +`:htmlize-link' + + Function or plist for the `htmlize-link' text property. The + function takes no argument. + + Default is (:uri \"type:path\") + +`:keymap' + + Active keymap when point is on the link. Default is + `org-mouse-map'. + +`:mouse-face' + + Face used when hovering over the link. Default is + `highlight'." + :group 'org-link + :package-version '(Org . "9.1") + :type '(alist :tag "Link display parameters" + :value-type plist)) + +(defcustom org-link-descriptive t + "Non-nil means Org displays descriptive links. + +E.g. [[https://orgmode.org][Org website]] is be displayed as +\"Org Website\", hiding the link itself and just displaying its +description. When set to nil, Org displays the full links +literally. + +You can interactively set the value of this variable by calling +`org-toggle-link-display' or from the \"Org > Hyperlinks\" menu." + :group 'org-link + :type 'boolean + :safe #'booleanp) + +(defcustom org-link-make-description-function nil + "Function to use for generating link descriptions from links. +This function must take two parameters: the first one is the +link, the second one is the description generated by +`org-insert-link'. The function should return the description to +use." + :group 'org-link + :type '(choice (const nil) (function)) + :safe #'null) + +(defcustom org-link-file-path-type 'adaptive + "How the path name in file links should be stored. +Valid values are: + +relative Relative to the current directory, i.e. the directory of the file + into which the link is being inserted. +absolute Absolute path, if possible with ~ for home directory. +noabbrev Absolute path, no abbreviation of home directory. +adaptive Use relative path for files in the current directory and sub- + directories of it. For other files, use an absolute path. + +Alternatively, users may supply a custom function that takes the +full filename as an argument and returns the path." + :group 'org-link + :type '(choice + (const relative) + (const absolute) + (const noabbrev) + (const adaptive) + (function)) + :package-version '(Org . "9.5") + :safe #'symbolp) + +(defcustom org-link-abbrev-alist nil + "Alist of link abbreviations. +The car of each element is a string, to be replaced at the start of a link. +The cdrs are replacement values, like (\"linkkey\" . REPLACE). Abbreviated +links in Org buffers can have an optional tag after a double colon, e.g., + + [[linkkey:tag][description]] + +The `linkkey' must be a single word, starting with a letter, followed +by letters, numbers, `-' or `_'. + +If REPLACE is a string, the tag will simply be appended to create the link. +If the string contains \"%s\", the tag will be inserted there. If the string +contains \"%h\", it will cause a url-encoded version of the tag to be inserted +at that point (see the function `url-hexify-string'). If the string contains +the specifier \"%(my-function)\", then the custom function `my-function' will +be invoked: this function takes the tag as its only argument and must return +a string. + +REPLACE may also be a function that will be called with the tag as the +only argument to create the link, which should be returned as a string. + +See the manual for examples." + :group 'org-link + :type '(repeat + (cons (string :tag "Protocol") + (choice + (string :tag "Format") + (function)))) + :safe (lambda (val) + (pcase val + (`(,(pred stringp) . ,(pred stringp)) t) + (_ nil)))) + +(defgroup org-link-follow nil + "Options concerning following links in Org mode." + :tag "Org Follow Link" + :group 'org-link) + +(defcustom org-link-translation-function nil + "Function to translate links with different syntax to Org syntax. +This can be used to translate links created for example by the Planner +or emacs-wiki packages to Org syntax. +The function must accept two parameters, a TYPE containing the link +protocol name like \"rmail\" or \"gnus\" as a string, and the linked path, +which is everything after the link protocol. It should return a cons +with possibly modified values of type and path. +Org contains a function for this, so if you set this variable to +`org-translate-link-from-planner', you should be able follow many +links created by planner." + :group 'org-link-follow + :type '(choice (const nil) (function)) + :safe #'null) + +(defcustom org-link-frame-setup + '((vm . vm-visit-folder-other-frame) + (vm-imap . vm-visit-imap-folder-other-frame) + (gnus . org-gnus-no-new-news) + (file . find-file-other-window) + (wl . wl-other-frame)) + "Setup the frame configuration for following links. +When following a link with Emacs, it may often be useful to display +this link in another window or frame. This variable can be used to +set this up for the different types of links. +For VM, use any of + `vm-visit-folder' + `vm-visit-folder-other-window' + `vm-visit-folder-other-frame' +For Gnus, use any of + `gnus' + `gnus-other-frame' + `org-gnus-no-new-news' +For FILE, use any of + `find-file' + `find-file-other-window' + `find-file-other-frame' +For Wanderlust use any of + `wl' + `wl-other-frame' +For the calendar, use the variable `calendar-setup'. +For BBDB, it is currently only possible to display the matches in +another window." + :group 'org-link-follow + :type '(list + (cons (const vm) + (choice + (const vm-visit-folder) + (const vm-visit-folder-other-window) + (const vm-visit-folder-other-frame))) + (cons (const vm-imap) + (choice + (const vm-visit-imap-folder) + (const vm-visit-imap-folder-other-window) + (const vm-visit-imap-folder-other-frame))) + (cons (const gnus) + (choice + (const gnus) + (const gnus-other-frame) + (const org-gnus-no-new-news))) + (cons (const file) + (choice + (const find-file) + (const find-file-other-window) + (const find-file-other-frame))) + (cons (const wl) + (choice + (const wl) + (const wl-other-frame))))) + +(defcustom org-link-search-must-match-exact-headline 'query-to-create + "Non-nil means internal fuzzy links can only match headlines. + +When nil, the a fuzzy link may point to a target or a named +construct in the document. When set to the special value +`query-to-create', offer to create a new headline when none +matched. + +Spaces and statistics cookies are ignored during heading searches." + :group 'org-link-follow + :version "24.1" + :type '(choice + (const :tag "Use fuzzy text search" nil) + (const :tag "Match only exact headline" t) + (const :tag "Match exact headline or query to create it" + query-to-create)) + :safe #'symbolp) + +(defcustom org-link-use-indirect-buffer-for-internals nil + "Non-nil means use indirect buffer to display infile links. +Activating internal links (from one location in a file to another location +in the same file) normally just jumps to the location. When the link is +activated with a `\\[universal-argument]' prefix (or with mouse-3), the link \ +is displayed in +another window. When this option is set, the other window actually displays +an indirect buffer clone of the current buffer, to avoid any visibility +changes to the current buffer." + :group 'org-link-follow + :type 'boolean + :safe #'booleanp) + +(defcustom org-link-shell-confirm-function 'yes-or-no-p + "Non-nil means ask for confirmation before executing shell links. + +Shell links can be dangerous: just think about a link + + [[shell:rm -rf ~/*][Web Search]] + +This link would show up in your Org document as \"Web Search\", +but really it would remove your entire home directory. +Therefore we advise against setting this variable to nil. +Just change it to `y-or-n-p' if you want to confirm with a +single keystroke rather than having to type \"yes\"." + :group 'org-link-follow + :type '(choice + (const :tag "with yes-or-no (safer)" yes-or-no-p) + (const :tag "with y-or-n (faster)" y-or-n-p) + (const :tag "no confirmation (dangerous)" nil))) + +(defcustom org-link-shell-skip-confirm-regexp "" + "Regexp to skip confirmation for shell links." + :group 'org-link-follow + :version "24.1" + :type 'regexp) + +(defcustom org-link-elisp-confirm-function 'yes-or-no-p + "Non-nil means ask for confirmation before executing Emacs Lisp links. +Elisp links can be dangerous: just think about a link + + [[elisp:(shell-command \"rm -rf ~/*\")][Web Search]] + +This link would show up in your Org document as \"Web Search\", +but really it would remove your entire home directory. +Therefore we advise against setting this variable to nil. +Just change it to `y-or-n-p' if you want to confirm with a +single keystroke rather than having to type \"yes\"." + :group 'org-link-follow + :type '(choice + (const :tag "with yes-or-no (safer)" yes-or-no-p) + (const :tag "with y-or-n (faster)" y-or-n-p) + (const :tag "no confirmation (dangerous)" nil))) + +(defcustom org-link-elisp-skip-confirm-regexp "" + "A regexp to skip confirmation for Elisp links." + :group 'org-link-follow + :version "24.1" + :type 'regexp) + +(defgroup org-link-store nil + "Options concerning storing links in Org mode." + :tag "Org Store Link" + :group 'org-link) + +(defcustom org-link-context-for-files t + "Non-nil means file links from `org-store-link' contain context. +\\ +A search string is added to the file name with \"::\" as separator +and used to find the context when the link is activated by the command +`org-open-at-point'. When this option is t, the entire active region +is be placed in the search string of the file link. If set to a +positive integer N, only the first N lines of context are stored. + +Using a prefix argument to the command `org-store-link' \ +\(`\\[universal-argument] \\[org-store-link]') +negates this setting for the duration of the command." + :group 'org-link-store + :type '(choice boolean integer) + :safe (lambda (val) (or (booleanp val) (integerp val)))) + +(defcustom org-link-email-description-format "Email %c: %s" + "Format of the description part of a link to an email or Usenet message. +The following %-escapes will be replaced by corresponding information: + +%F full \"From\" field +%f name, taken from \"From\" field, address if no name +%T full \"To\" field +%t first name in \"To\" field, address if no name +%c correspondent. Usually \"from NAME\", but if you sent it yourself, it + will be \"to NAME\". See also the variable `org-from-is-user-regexp'. +%s subject +%d date +%m message-id. + +You may use normal field width specification between the % and the letter. +This is for example useful to limit the length of the subject. + +Examples: \"%f on: %.30s\", \"Email from %f\", \"Email %c\"" + :group 'org-link-store + :package-version '(Org . "9.3") + :type 'string + :safe #'stringp) + +(defcustom org-link-from-user-regexp + (let ((mail (and (org-string-nw-p user-mail-address) + (format "\\<%s\\>" (regexp-quote user-mail-address)))) + (name (and (org-string-nw-p user-full-name) + (format "\\<%s\\>" (regexp-quote user-full-name))))) + (if (and mail name) (concat mail "\\|" name) (or mail name))) + "Regexp matched against the \"From:\" header of an email or Usenet message. +It should match if the message is from the user him/herself." + :group 'org-link-store + :type 'regexp + :safe #'stringp) + +(defcustom org-link-keep-stored-after-insertion nil + "Non-nil means keep link in list for entire session. +\\ +The command `org-store-link' adds a link pointing to the current +location to an internal list. These links accumulate during a session. +The command `org-insert-link' can be used to insert links into any +Org file (offering completion for all stored links). + +When this option is nil, every link which has been inserted once using +`\\[org-insert-link]' will be removed from the list, to make completing the \ +unused +links more efficient." + :group 'org-link-store + :type 'boolean + :safe #'booleanp) + +;;; Public variables + +(defconst org-target-regexp (let ((border "[^<>\n\r \t]")) + (format "<<\\(%s\\|%s[^<>\n\r]*%s\\)>>" + border border border)) + "Regular expression matching a link target.") + +(defconst org-radio-target-regexp (format "<%s>" org-target-regexp) + "Regular expression matching a radio target.") + +(defvar-local org-target-link-regexp nil + "Regular expression matching radio targets in plain text.") + +(defvar org-link-types-re nil + "Matches a link that has a url-like prefix like \"http:\".") + +(defvar org-link-angle-re nil + "Matches link with angular brackets, spaces are allowed.") + +(defvar org-link-plain-re nil + "Matches plain link, without spaces. +Group 1 must contain the link type (i.e. https). +Group 2 must contain the link path (i.e. //example.com). +Used by `org-element-link-parser'.") + +(defvar org-link-bracket-re nil + "Matches a link in double brackets.") + +(defvar org-link-any-re nil + "Regular expression matching any link.") + +(defvar-local org-link-abbrev-alist-local nil + "Buffer-local version of `org-link-abbrev-alist', which see. +The value of this is taken from the LINK keywords.") + +(defvar org-stored-links nil + "Contains the links stored with `org-store-link'.") + +(defvar org-store-link-plist nil + "Plist with info about the most recently link created with `org-store-link'.") + +(defvar org-create-file-search-functions nil + "List of functions to construct the right search string for a file link. + +These functions are called in turn with point at the location to +which the link should point. + +A function in the hook should first test if it would like to +handle this file type, for example by checking the `major-mode' +or the file extension. If it decides not to handle this file, it +should just return nil to give other functions a chance. If it +does handle the file, it must return the search string to be used +when following the link. The search string will be part of the +file link, given after a double colon, and `org-open-at-point' +will automatically search for it. If special measures must be +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 +with \\[org-insert-link].") + +(defvar org-execute-file-search-functions nil + "List of functions to execute a file search triggered by a link. + +Functions added to this hook must accept a single argument, the +search string that was part of the file link, the part after the +double colon. The function must first check if it would like to +handle this search, for example by checking the `major-mode' or +the file extension. If it decides not to handle this search, it +should just return nil to give other functions a chance. If it +does handle the search, it must return a non-nil value to keep +other functions from trying. + +Each function can access the current prefix argument through the +variable `current-prefix-arg'. Note that a single prefix is used +to force opening a link in Emacs, so it may be good to only use a +numeric or double prefix to guide the search function. + +In case this is needed, a function in this hook can also restore +the window configuration before `org-open-at-point' was called using: + + (set-window-configuration org-window-config-before-follow-link)") + +(defvar org-open-link-functions nil + "Hook for functions finding a plain text link. +These functions must take a single argument, the link content. +They will be called for links that look like [[link text][description]] +when LINK TEXT does not have a protocol like \"http:\" and does not look +like a filename (e.g. \"./blue.png\"). + +These functions will be called *before* Org attempts to resolve the +link by doing text searches in the current buffer - so if you want a +link \"[[target]]\" to still find \"<>\", your function should +handle this as a special case. + +When the function does handle the link, it must return a non-nil value. +If it decides that it is not responsible for this link, it must return +nil to indicate that Org can continue with other options like +exact and fuzzy text search.") + + +;;; Internal Variables + +(defconst org-link--forbidden-chars "]\t\n\r<>" + "Characters forbidden within a link, as a string.") + +(defvar org-link--history nil + "History for inserted links.") + +(defvar org-link--insert-history nil + "Minibuffer history for links inserted with `org-insert-link'.") + +(defvar org-link--search-failed nil + "Non-nil when last link search failed.") + + +;;; Internal Functions + +(defun org-link--try-special-completion (type) + "If there is completion support for link type TYPE, offer it." + (let ((fun (org-link-get-parameter type :complete))) + (if (functionp fun) + (funcall fun) + (read-string "Link (no completion support): " (concat type ":"))))) + +(defun org-link--prettify (link) + "Return a human-readable representation of LINK. +The car of LINK must be a raw link. The cdr of LINK must be +either a link description or nil." + (let ((desc (or (cadr link) ""))) + (concat (format "%-45s" (substring desc 0 (min (length desc) 40))) + "<" (car link) ">"))) + +(defun org-link--decode-compound (hex) + "Unhexify Unicode hex-chars HEX. +E.g. \"%C3%B6\" is the German o-Umlaut. Note: this function also +decodes single byte encodings like \"%E1\" (a-acute) if not +followed by another \"%[A-F0-9]{2}\" group." + (save-match-data + (let* ((bytes (cdr (split-string hex "%"))) + (ret "") + (eat 0) + (sum 0)) + (while bytes + (let* ((val (string-to-number (pop bytes) 16)) + (shift-xor + (if (= 0 eat) + (cond + ((>= val 252) (cons 6 252)) + ((>= val 248) (cons 5 248)) + ((>= val 240) (cons 4 240)) + ((>= val 224) (cons 3 224)) + ((>= val 192) (cons 2 192)) + (t (cons 0 0))) + (cons 6 128)))) + (when (>= val 192) (setq eat (car shift-xor))) + (setq val (logxor val (cdr shift-xor))) + (setq sum (+ (lsh sum (car shift-xor)) val)) + (when (> eat 0) (setq eat (- eat 1))) + (cond + ((= 0 eat) ;multi byte + (setq ret (concat ret (char-to-string sum))) + (setq sum 0)) + ((not bytes) ; single byte(s) + (setq ret (org-link--decode-single-byte-sequence hex)))))) + ret))) + +(defun org-link--decode-single-byte-sequence (hex) + "Unhexify hex-encoded single byte character sequence HEX." + (mapconcat (lambda (byte) + (char-to-string (string-to-number byte 16))) + (cdr (split-string hex "%")) + "")) + +(defun org-link--fontify-links-to-this-file () + "Fontify links to the current file in `org-stored-links'." + (let ((f (buffer-file-name)) a b) + (setq a (mapcar (lambda(l) + (let ((ll (car l))) + (when (and (string-match "^file:\\(.+\\)::" ll) + (equal f (expand-file-name (match-string 1 ll)))) + ll))) + org-stored-links)) + (when (featurep 'org-id) + (setq b (mapcar (lambda(l) + (let ((ll (car l))) + (when (and (string-match "^id:\\(.+\\)$" ll) + (equal f (expand-file-name + (or (org-id-find-id-file + (match-string 1 ll)) "")))) + ll))) + org-stored-links))) + (mapcar (lambda(l) + (put-text-property 0 (length l) 'face 'font-lock-comment-face l)) + (delq nil (append a b))))) + +(defun org-link--buffer-for-internals () + "Return buffer used for displaying the target of internal links." + (cond + ((not org-link-use-indirect-buffer-for-internals) (current-buffer)) + ((string-suffix-p "(Clone)" (buffer-name)) + (message "Buffer is already a clone, not making another one") + ;; We also do not modify visibility in this case. + (current-buffer)) + (t ;make a new indirect buffer for displaying the link + (let* ((indirect-buffer-name (concat (buffer-name) "(Clone)")) + (indirect-buffer + (or (get-buffer indirect-buffer-name) + (make-indirect-buffer (current-buffer) + indirect-buffer-name + 'clone)))) + (with-current-buffer indirect-buffer (org-overview)) + indirect-buffer)))) + +(defun org-link--search-radio-target (target) + "Search a radio target matching TARGET in current buffer. +White spaces are not significant." + (let ((re (format "<<<%s>>>" + (mapconcat #'regexp-quote + (split-string target) + "[ \t]+\\(?:\n[ \t]*\\)?"))) + (origin (point))) + (goto-char (point-min)) + (catch :radio-match + (while (re-search-forward re nil t) + (forward-char -1) + (let ((object (org-element-context))) + (when (eq (org-element-type object) 'radio-target) + (goto-char (org-element-property :begin object)) + (org-show-context 'link-search) + (throw :radio-match nil)))) + (goto-char origin) + (user-error "No match for radio target: %s" target)))) + +(defun org-link--context-from-region () + "Return context string from active region, or nil." + (when (org-region-active-p) + (let ((context (buffer-substring (region-beginning) (region-end)))) + (when (and (wholenump org-link-context-for-files) + (> org-link-context-for-files 0)) + (let ((lines (org-split-string context "\n"))) + (setq context + (mapconcat #'identity + (cl-subseq lines 0 org-link-context-for-files) + "\n")))) + context))) + +(defun org-link--normalize-string (string &optional context) + "Remove ignored contents from STRING string and return it. +This function removes contiguous white spaces and statistics +cookies. When optional argument CONTEXT is non-nil, it assumes +STRING is a context string, and also removes special search +syntax around the string." + (let ((string + (org-trim + (replace-regexp-in-string + (rx (one-or-more (any " \t"))) + " " + (replace-regexp-in-string + ;; Statistics cookie regexp. + (rx (seq "[" (0+ digit) (or "%" (seq "/" (0+ digit))) "]")) + " " + string))))) + (when context + (while (cond ((and (string-prefix-p "(" string) + (string-suffix-p ")" string)) + (setq string (org-trim (substring string 1 -1)))) + ((string-match "\\`[#*]+[ \t]*" string) + (setq string (substring string (match-end 0)))) + (t nil)))) + string)) + + +;;; Public API + +(defun org-link-types () + "Return a list of known link types." + (mapcar #'car org-link-parameters)) + +(defun org-link-get-parameter (type key) + "Get TYPE link property for KEY. +TYPE is a string and KEY is a plist keyword. See +`org-link-parameters' for supported keywords." + (plist-get (cdr (assoc type org-link-parameters)) + key)) + +(defun org-link-set-parameters (type &rest parameters) + "Set link TYPE properties to PARAMETERS. +PARAMETERS should be keyword value pairs. See +`org-link-parameters' for supported keys." + (when (member type '("coderef" "custom-id" "fuzzy" "radio")) + (error "Cannot override reserved link type: %S" type)) + (let ((data (assoc type org-link-parameters))) + (if data (setcdr data (org-combine-plists (cdr data) parameters)) + (push (cons type parameters) org-link-parameters) + (org-link-make-regexps) + (when (featurep 'org-element) (org-element-update-syntax))))) + +(defun org-link-make-regexps () + "Update the link regular expressions. +This should be called after the variable `org-link-parameters' has changed." + (let ((types-re (regexp-opt (org-link-types) t))) + (setq org-link-types-re + (concat "\\`" types-re ":") + org-link-angle-re + (format "<%s:\\([^>\n]*\\(?:\n[ \t]*[^> \t\n][^>\n]*\\)*\\)>" + types-re) + org-link-plain-re + (let* ((non-space-bracket "[^][ \t\n()<>]") + (parenthesis + `(seq "(" + (0+ (or (regex ,non-space-bracket) + (seq "(" + (0+ (regex ,non-space-bracket)) + ")"))) + ")"))) + ;; Heuristics for an URL link inspired by + ;; https://daringfireball.net/2010/07/improved_regex_for_matching_urls + (rx-to-string + `(seq word-start + ;; Link type: match group 1. + (regexp ,types-re) + ":" + ;; Link path: match group 2. + (group + (1+ (or (regex ,non-space-bracket) + ,parenthesis)) + (or (regexp "[^[:punct:] \t\n]") + ?/ + ,parenthesis))))) + org-link-bracket-re + (rx (seq "[[" + ;; URI part: match group 1. + (group + (one-or-more + (or (not (any "[]\\")) + (and "\\" (zero-or-more "\\\\") (any "[]")) + (and (one-or-more "\\") (not (any "[]")))))) + "]" + ;; Description (optional): match group 2. + (opt "[" (group (+? anything)) "]") + "]")) + org-link-any-re + (concat "\\(" org-link-bracket-re "\\)\\|\\(" + org-link-angle-re "\\)\\|\\(" + org-link-plain-re "\\)")))) + +(defun org-link-complete-file (&optional arg) + "Create a file link using completion." + (let ((file (read-file-name "File: ")) + (pwd (file-name-as-directory (expand-file-name "."))) + (pwd1 (file-name-as-directory (abbreviate-file-name + (expand-file-name "."))))) + (cond ((equal arg '(16)) + (concat "file:" + (abbreviate-file-name (expand-file-name file)))) + ((string-match + (concat "^" (regexp-quote pwd1) "\\(.+\\)") file) + (concat "file:" (match-string 1 file))) + ((string-match + (concat "^" (regexp-quote pwd) "\\(.+\\)") + (expand-file-name file)) + (concat "file:" + (match-string 1 (expand-file-name file)))) + (t (concat "file:" file))))) + +(defun org-link-email-description (&optional fmt) + "Return the description part of an email link. +This takes information from `org-store-link-plist' and formats it +according to FMT (default from `org-link-email-description-format')." + (setq fmt (or fmt org-link-email-description-format)) + (let* ((p org-store-link-plist) + (to (plist-get p :toaddress)) + (from (plist-get p :fromaddress)) + (table + (list + (cons "%c" (plist-get p :fromto)) + (cons "%F" (plist-get p :from)) + (cons "%f" (or (plist-get p :fromname) (plist-get p :fromaddress) "?")) + (cons "%T" (plist-get p :to)) + (cons "%t" (or (plist-get p :toname) (plist-get p :toaddress) "?")) + (cons "%s" (plist-get p :subject)) + (cons "%d" (plist-get p :date)) + (cons "%m" (plist-get p :message-id))))) + (when (string-match "%c" fmt) + ;; Check if the user wrote this message + (if (and org-link-from-user-regexp from to + (save-match-data (string-match org-link-from-user-regexp from))) + (setq fmt (replace-match "to %t" t t fmt)) + (setq fmt (replace-match "from %f" t t fmt)))) + (org-replace-escapes fmt table))) + +(defun org-link-store-props (&rest plist) + "Store link properties. +The properties are pre-processed by extracting names, addresses +and dates." + (let ((x (plist-get plist :from))) + (when x + (let ((adr (mail-extract-address-components x))) + (setq plist (plist-put plist :fromname (car adr))) + (setq plist (plist-put plist :fromaddress (nth 1 adr)))))) + (let ((x (plist-get plist :to))) + (when x + (let ((adr (mail-extract-address-components x))) + (setq plist (plist-put plist :toname (car adr))) + (setq plist (plist-put plist :toaddress (nth 1 adr)))))) + (let ((x (ignore-errors (date-to-time (plist-get plist :date))))) + (when x + (setq plist (plist-put plist :date-timestamp + (format-time-string + (org-time-stamp-format t) x))) + (setq plist (plist-put plist :date-timestamp-inactive + (format-time-string + (org-time-stamp-format t t) x))))) + (let ((from (plist-get plist :from)) + (to (plist-get plist :to))) + (when (and from to org-link-from-user-regexp) + (setq plist + (plist-put plist :fromto + (if (string-match org-link-from-user-regexp from) + (concat "to %t") + (concat "from %f")))))) + (setq org-store-link-plist plist)) + +(defun org-link-add-props (&rest plist) + "Add these properties to the link property list." + (let (key value) + (while plist + (setq key (pop plist) value (pop plist)) + (setq org-store-link-plist + (plist-put org-store-link-plist key value))))) + +(defun org-link-encode (text table) + "Return percent escaped representation of string TEXT. +TEXT is a string with the text to escape. TABLE is a list of +characters that should be escaped." + (mapconcat + (lambda (c) + (if (memq c table) + (mapconcat (lambda (e) (format "%%%.2X" e)) + (or (encode-coding-char c 'utf-8) + (error "Unable to percent escape character: %c" c)) + "") + (char-to-string c))) + text "")) + +(defun org-link-decode (s) + "Decode percent-encoded parts in string S. +E.g. \"%C3%B6\" becomes the german o-Umlaut." + (replace-regexp-in-string "\\(%[0-9A-Za-z]\\{2\\}\\)+" + #'org-link--decode-compound s t t)) + +(defun org-link-escape (link) + "Backslash-escape sensitive characters in string LINK." + (replace-regexp-in-string + (rx (seq (group (zero-or-more "\\")) (group (or string-end (any "[]"))))) + (lambda (m) + (concat (match-string 1 m) + (match-string 1 m) + (and (/= (match-beginning 2) (match-end 2)) "\\"))) + link nil t 1)) + +(defun org-link-unescape (link) + "Remove escaping backslash characters from string LINK." + (replace-regexp-in-string + (rx (group (one-or-more "\\")) (or string-end (any "[]"))) + (lambda (_) + (concat (make-string (/ (- (match-end 1) (match-beginning 1)) 2) ?\\))) + link nil t 1)) + +(defun org-link-make-string (link &optional description) + "Make a bracket link, consisting of LINK and DESCRIPTION. +LINK is escaped with backslashes for inclusion in buffer." + (let* ((zero-width-space (string ?\x200B)) + (description + (and (org-string-nw-p description) + ;; Description cannot contain two consecutive square + ;; brackets, or end with a square bracket. To prevent + ;; this, insert a zero width space character between + ;; the brackets, or at the end of the description. + (replace-regexp-in-string + "\\(]\\)\\(]\\)" + (concat "\\1" zero-width-space "\\2") + (replace-regexp-in-string "]\\'" + (concat "\\&" zero-width-space) + (org-trim description)))))) + (if (not (org-string-nw-p link)) description + (format "[[%s]%s]" + (org-link-escape link) + (if description (format "[%s]" description) ""))))) + +(defun org-store-link-functions () + "List of functions that are called to create and store a link. + +The functions are defined in the `:store' property of +`org-link-parameters'. + +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: + +:type The link prefix, like \"http\". This must be given. +:link The link, like \"http://www.astro.uva.nl/~dominik\". + This is obligatory as well. +:description Optional default description for the second pair + of brackets in an Org mode link. The user can still change + this when inserting this link into an Org mode buffer. + +In addition to these, any additional properties can be specified +and then used in capture templates." + (cl-loop for link in org-link-parameters + with store-func + do (setq store-func (org-link-get-parameter (car link) :store)) + if store-func + collect store-func)) + +(defun org-link-expand-abbrev (link) + "Replace link abbreviations in LINK string. +Abbreviations are defined in `org-link-abbrev-alist'." + (if (not (string-match "^\\([^:]*\\)\\(::?\\(.*\\)\\)?$" link)) link + (let* ((key (match-string 1 link)) + (as (or (assoc key org-link-abbrev-alist-local) + (assoc key org-link-abbrev-alist))) + (tag (and (match-end 2) (match-string 3 link))) + rpl) + (if (not as) + link + (setq rpl (cdr as)) + (cond + ((symbolp rpl) (funcall rpl tag)) + ((string-match "%(\\([^)]+\\))" rpl) + (replace-match + (save-match-data + (funcall (intern-soft (match-string 1 rpl)) tag)) + t t rpl)) + ((string-match "%s" rpl) (replace-match (or tag "") t t rpl)) + ((string-match "%h" rpl) + (replace-match (url-hexify-string (or tag "")) t t rpl)) + (t (concat rpl tag))))))) + +(defun org-link-open (link &optional arg) + "Open a link object LINK. + +ARG is an optional prefix argument. Some link types may handle +it. For example, it determines what application to run when +opening a \"file\" link. + +Functions responsible for opening the link are either hard-coded +for internal and \"file\" links, or stored as a parameter in +`org-link-parameters', which see." + (let ((type (org-element-property :type link)) + (path (org-element-property :path link))) + (pcase type + ;; Opening a "file" link requires special treatment since we + ;; first need to integrate search option, if any. + ("file" + (let* ((option (org-element-property :search-option link)) + (path (if option (concat path "::" option) path))) + (org-link-open-as-file path + (pcase (org-element-property :application link) + ((guard arg) arg) + ("emacs" 'emacs) + ("sys" 'system))))) + ;; Internal links. + ((or "coderef" "custom-id" "fuzzy" "radio") + (unless (run-hook-with-args-until-success 'org-open-link-functions path) + (if (not arg) (org-mark-ring-push) + (switch-to-buffer-other-window (org-link--buffer-for-internals))) + (let ((destination + (org-with-wide-buffer + (if (equal type "radio") + (org-link--search-radio-target path) + (org-link-search + (pcase type + ("custom-id" (concat "#" path)) + ("coderef" (format "(%s)" path)) + (_ path)) + ;; Prevent fuzzy links from matching themselves. + (and (equal type "fuzzy") + (+ 2 (org-element-property :begin link))))) + (point)))) + (unless (and (<= (point-min) destination) + (>= (point-max) destination)) + (widen)) + (goto-char destination)))) + (_ + ;; Look for a dedicated "follow" function in custom links. + (let ((f (org-link-get-parameter type :follow))) + (when (functionp f) + ;; Function defined in `:follow' parameter may use a single + ;; argument, as it was mandatory before Org 9.4. This is + ;; deprecated, but support it for now. + (condition-case nil + (funcall (org-link-get-parameter type :follow) path arg) + (wrong-number-of-arguments + (funcall (org-link-get-parameter type :follow) path))))))))) + +(defun org-link-open-from-string (s &optional arg) + "Open a link in the string S, as if it was in Org mode. +Optional argument is passed to `org-open-file' when S is +a \"file\" link." + (interactive "sLink: \nP") + (pcase (with-temp-buffer + (let ((org-inhibit-startup nil)) + (insert s) + (org-mode) + (goto-char (point-min)) + (org-element-link-parser))) + (`nil (user-error "No valid link in %S" s)) + (link (org-link-open link arg)))) + +(defun org-link-search (s &optional avoid-pos stealth) + "Search for a search string S. + +If S starts with \"#\", it triggers a custom ID search. + +If S is enclosed within parenthesis, it initiates a coderef +search. + +If S is surrounded by forward slashes, it is interpreted as +a regular expression. In Org mode files, this will create an +`org-occur' sparse tree. In ordinary files, `occur' will be used +to list matches. If the current buffer is in `dired-mode', grep +will be used to search in all files. + +When AVOID-POS is given, ignore matches near that position. + +When optional argument STEALTH is non-nil, do not modify +visibility around point, thus ignoring `org-show-context-detail' +variable. + +Search is case-insensitive and ignores white spaces. Return type +of matched result, which is either `dedicated' or `fuzzy'." + (unless (org-string-nw-p s) (error "Invalid search string \"%s\"" s)) + (let* ((case-fold-search t) + (origin (point)) + (normalized (replace-regexp-in-string "\n[ \t]*" " " s)) + (starred (eq (string-to-char normalized) ?*)) + (words (split-string (if starred (substring s 1) s))) + (s-multi-re (mapconcat #'regexp-quote words "\\(?:[ \t\n]+\\)")) + (s-single-re (mapconcat #'regexp-quote words "[ \t]+")) + type) + (cond + ;; Check if there are any special search functions. + ((run-hook-with-args-until-success 'org-execute-file-search-functions s)) + ((eq (string-to-char s) ?#) + ;; Look for a custom ID S if S starts with "#". + (let* ((id (substring normalized 1)) + (match (org-find-property "CUSTOM_ID" id))) + (if match (progn (goto-char match) (setf type 'dedicated)) + (error "No match for custom ID: %s" id)))) + ((string-match "\\`(\\(.*\\))\\'" normalized) + ;; Look for coderef targets if S is enclosed within parenthesis. + (let ((coderef (match-string-no-properties 1 normalized)) + (re (substring s-single-re 1 -1))) + (goto-char (point-min)) + (catch :coderef-match + (while (re-search-forward re nil t) + (let ((element (org-element-at-point))) + (when (and (memq (org-element-type element) + '(example-block src-block)) + (org-match-line + (concat ".*?" (org-src-coderef-regexp + (org-src-coderef-format element) + coderef)))) + (setq type 'dedicated) + (goto-char (match-beginning 2)) + (throw :coderef-match nil)))) + (goto-char origin) + (error "No match for coderef: %s" coderef)))) + ((string-match "\\`/\\(.*\\)/\\'" normalized) + ;; Look for a regular expression. + (funcall (if (derived-mode-p 'org-mode) #'org-occur #'org-do-occur) + (match-string 1 s))) + ;; From here, we handle fuzzy links. + ;; + ;; Look for targets, only if not in a headline search. + ((and (not starred) + (let ((target (format "<<%s>>" s-multi-re))) + (catch :target-match + (goto-char (point-min)) + (while (re-search-forward target nil t) + (backward-char) + (let ((context (org-element-context))) + (when (eq (org-element-type context) 'target) + (setq type 'dedicated) + (goto-char (org-element-property :begin context)) + (throw :target-match t)))) + nil)))) + ;; Look for elements named after S, only if not in a headline + ;; search. + ((and (not starred) + (let ((name (format "^[ \t]*#\\+NAME: +%s[ \t]*$" s-single-re))) + (catch :name-match + (goto-char (point-min)) + (while (re-search-forward name nil t) + (let* ((element (org-element-at-point)) + (name (org-element-property :name element))) + (when (and name (equal words (split-string name))) + (setq type 'dedicated) + (beginning-of-line) + (throw :name-match t)))) + nil)))) + ;; Regular text search. Prefer headlines in Org mode buffers. + ;; Ignore COMMENT keyword, TODO keywords, priority cookies, + ;; statistics cookies and tags. + ((and (derived-mode-p 'org-mode) + (let ((title-re + (format "%s.*\\(?:%s[ \t]\\)?.*%s" + org-outline-regexp-bol + org-comment-string + (mapconcat #'regexp-quote words ".+")))) + (goto-char (point-min)) + (catch :found + (while (re-search-forward title-re nil t) + (when (equal words + (split-string + (org-link--normalize-string + (org-get-heading t t t t)))) + (throw :found t))) + nil))) + (beginning-of-line) + (setq type 'dedicated)) + ;; Offer to create non-existent headline depending on + ;; `org-link-search-must-match-exact-headline'. + ((and (derived-mode-p 'org-mode) + (eq org-link-search-must-match-exact-headline 'query-to-create) + (yes-or-no-p "No match - create this as a new heading? ")) + (goto-char (point-max)) + (unless (bolp) (newline)) + (org-insert-heading nil t t) + (insert s "\n") + (beginning-of-line 0)) + ;; Only headlines are looked after. No need to process + ;; further: throw an error. + ((and (derived-mode-p 'org-mode) + (or starred org-link-search-must-match-exact-headline)) + (goto-char origin) + (error "No match for fuzzy expression: %s" normalized)) + ;; Regular text search. + ((catch :fuzzy-match + (goto-char (point-min)) + (while (re-search-forward s-multi-re nil t) + ;; Skip match if it contains AVOID-POS or it is included in + ;; a link with a description but outside the description. + (unless (or (and avoid-pos + (<= (match-beginning 0) avoid-pos) + (> (match-end 0) avoid-pos)) + (and (save-match-data + (org-in-regexp org-link-bracket-re)) + (match-beginning 3) + (or (> (match-beginning 3) (point)) + (<= (match-end 3) (point))) + (org-element-lineage + (save-match-data (org-element-context)) + '(link) t))) + (goto-char (match-beginning 0)) + (setq type 'fuzzy) + (throw :fuzzy-match t))) + nil)) + ;; All failed. Throw an error. + (t (goto-char origin) + (error "No match for fuzzy expression: %s" normalized))) + ;; Disclose surroundings of match, if appropriate. + (when (and (derived-mode-p 'org-mode) (not stealth)) + (org-show-context 'link-search)) + type)) + +(defun org-link-heading-search-string (&optional string) + "Make search string for the current headline or STRING. + +Search string starts with an asterisk. COMMENT keyword and +statistics cookies are removed, and contiguous spaces are packed +into a single one. + +When optional argument STRING is non-nil, assume it a headline, +without any asterisk, TODO or COMMENT keyword, and without any +priority cookie or tag." + (concat "*" + (org-link--normalize-string + (or string (org-get-heading t t t t))))) + +(defun org-link-open-as-file (path arg) + "Pretend PATH is a file name and open it. + +According to \"file\"-link syntax, PATH may include additional +search options, separated from the file name with \"::\". + +This function is meant to be used as a possible tool for +`:follow' property in `org-link-parameters'." + (let* ((option (and (string-match "::\\(.*\\)\\'" path) + (match-string 1 path))) + (file-name (if (not option) path + (substring path 0 (match-beginning 0))))) + (if (string-match "[*?{]" (file-name-nondirectory file-name)) + (dired file-name) + (apply #'org-open-file + file-name + arg + (cond ((not option) nil) + ((string-match-p "\\`[0-9]+\\'" option) + (list (string-to-number option))) + (t (list nil option))))))) + +(defun org-link-display-format (s) + "Replace links in string S with their description. +If there is no description, use the link target." + (save-match-data + (replace-regexp-in-string + org-link-bracket-re + (lambda (m) (or (match-string 2 m) (match-string 1 m))) + s nil t))) + +(defun org-link-add-angle-brackets (s) + "Wrap string S within angle brackets." + (unless (equal (substring s 0 1) "<") (setq s (concat "<" s))) + (unless (equal (substring s -1) ">") (setq s (concat s ">"))) + s) + + +;;; Built-in link types + +;;;; "elisp" link type +(defun org-link--open-elisp (path _) + "Open a \"elisp\" type link. +PATH is the sexp to evaluate, as a string." + (if (or (and (org-string-nw-p org-link-elisp-skip-confirm-regexp) + (string-match-p org-link-elisp-skip-confirm-regexp path)) + (not org-link-elisp-confirm-function) + (funcall org-link-elisp-confirm-function + (format "Execute %S as Elisp? " + (org-add-props path nil 'face 'org-warning)))) + (message "%s => %s" path + (if (eq ?\( (string-to-char path)) + (eval (read path)) + (call-interactively (read path)))) + (user-error "Abort"))) + +(org-link-set-parameters "elisp" :follow #'org-link--open-elisp) + +;;;; "file" link type +(org-link-set-parameters "file" :complete #'org-link-complete-file) + +;;;; "help" link type +(defun org-link--open-help (path _) + "Open a \"help\" type link. +PATH is a symbol name, as a string." + (pcase (intern path) + ((and (pred fboundp) function) (describe-function function)) + ((and (pred boundp) variable) (describe-variable variable)) + (name (user-error "Unknown function or variable: %s" name)))) + +(defun org-link--store-help () + "Store \"help\" type link." + (when (eq major-mode 'help-mode) + (let ((symbol + (save-excursion + (goto-char (point-min)) + ;; In case the help is about the key-binding, store the + ;; function instead. + (search-forward "runs the command " (line-end-position) t) + (read (current-buffer))))) + (org-link-store-props :type "help" + :link (format "help:%s" symbol) + :description nil)))) + +(org-link-set-parameters "help" + :follow #'org-link--open-help + :store #'org-link--store-help) + +;;;; "http", "https", "mailto", "ftp", and "news" link types +(dolist (scheme '("ftp" "http" "https" "mailto" "news")) + (org-link-set-parameters scheme + :follow + (lambda (url arg) + (browse-url (concat scheme ":" url) arg)))) + +;;;; "shell" link type +(defun org-link--open-shell (path _) + "Open a \"shell\" type link. +PATH is the command to execute, as a string." + (if (or (and (org-string-nw-p org-link-shell-skip-confirm-regexp) + (string-match-p org-link-shell-skip-confirm-regexp path)) + (not org-link-shell-confirm-function) + (funcall org-link-shell-confirm-function + (format "Execute %S in shell? " + (org-add-props path nil 'face 'org-warning)))) + (let ((buf (generate-new-buffer "*Org Shell Output*"))) + (message "Executing %s" path) + (shell-command path buf) + (when (featurep 'midnight) + (setq clean-buffer-list-kill-buffer-names + (cons (buffer-name buf) + clean-buffer-list-kill-buffer-names)))) + (user-error "Abort"))) + +(org-link-set-parameters "shell" :follow #'org-link--open-shell) + + +;;; Interactive Functions + +;;;###autoload +(defun org-next-link (&optional search-backward) + "Move forward to the next link. +If the link is in hidden text, expose it. When SEARCH-BACKWARD +is non-nil, move backward." + (interactive) + (let ((pos (point)) + (search-fun (if search-backward #'re-search-backward + #'re-search-forward))) + ;; Tweak initial position. If last search failed, wrap around. + ;; Otherwise, make sure we do not match current link. + (cond + ((not (and org-link--search-failed (eq this-command last-command))) + (cond + ((and (not search-backward) (looking-at org-link-any-re)) + (goto-char (match-end 0))) + (search-backward + (pcase (org-in-regexp org-link-any-re nil t) + (`(,beg . ,_) (goto-char beg)) + (_ nil))) + (t nil))) + (search-backward + (goto-char (point-max)) + (message "Link search wrapped back to end of buffer")) + (t + (goto-char (point-min)) + (message "Link search wrapped back to beginning of buffer"))) + (setq org-link--search-failed nil) + (catch :found + (while (funcall search-fun org-link-any-re nil t) + (let ((context (save-excursion + (unless search-backward (forward-char -1)) + (org-element-context)))) + (pcase (org-element-lineage context '(link) t) + (`nil nil) + (link + (goto-char (org-element-property :begin link)) + (when (org-invisible-p) (org-show-context)) + (throw :found t))))) + (goto-char pos) + (setq org-link--search-failed t) + (message "No further link found")))) + +;;;###autoload +(defun org-previous-link () + "Move backward to the previous link. +If the link is in hidden text, expose it." + (interactive) + (org-next-link t)) + +;;;###autoload +(defun org-toggle-link-display () + "Toggle the literal or descriptive display of links." + (interactive) + (if org-link-descriptive (remove-from-invisibility-spec '(org-link)) + (add-to-invisibility-spec '(org-link))) + (org-restart-font-lock) + (setq org-link-descriptive (not org-link-descriptive))) + +;;;###autoload +(defun org-store-link (arg &optional interactive?) + "Store a link to the current location. +\\ +This link is added to `org-stored-links' and can later be inserted +into an Org buffer with `org-insert-link' (`\\[org-insert-link]'). + +For some link types, a `\\[universal-argument]' prefix ARG is interpreted. \ +A single +`\\[universal-argument]' negates `org-context-in-file-links' for file links or +`org-gnus-prefer-web-links' for links to Usenet articles. + +A `\\[universal-argument] \\[universal-argument]' prefix ARG forces \ +skipping storing functions that are not +part of Org core. + +A `\\[universal-argument] \\[universal-argument] \\[universal-argument]' \ +prefix ARG forces storing a link for each line in the +active region. + +Assume the function is called interactively if INTERACTIVE? is +non-nil." + (interactive "P\np") + (org-load-modules-maybe) + (if (and (equal arg '(64)) (org-region-active-p)) + (save-excursion + (let ((end (region-end))) + (goto-char (region-beginning)) + (set-mark (point)) + (while (< (point-at-eol) end) + (move-end-of-line 1) (activate-mark) + (let (current-prefix-arg) + (call-interactively 'org-store-link)) + (move-beginning-of-line 2) + (set-mark (point))))) + (setq org-store-link-plist nil) + (let (link cpltxt desc search custom-id agenda-link) ;; description + (cond + ;; Store a link using an external link type, if any function is + ;; available. If more than one can generate a link from current + ;; location, ask which one to use. + ((and (not (equal arg '(16))) + (let ((results-alist nil)) + (dolist (f (org-store-link-functions)) + (when (funcall f) + ;; XXX: return value is not link's plist, so we + ;; store the new value before it is modified. It + ;; would be cleaner to ask store link functions to + ;; return the plist instead. + (push (cons f (copy-sequence org-store-link-plist)) + results-alist))) + (pcase results-alist + (`nil nil) + (`((,_ . ,_)) t) ;single choice: nothing to do + (`((,name . ,_) . ,_) + ;; Reinstate link plist associated to the chosen + ;; function. + (apply #'org-link-store-props + (cdr (assoc-string + (completing-read + (format "Store link with (default %s): " name) + (mapcar #'car results-alist) + nil t nil nil (symbol-name name)) + results-alist))) + t)))) + (setq link (plist-get org-store-link-plist :link)) + ;; If store function actually set `:description' property, use + ;; it, even if it is nil. Otherwise, fallback to link value. + (setq desc (if (plist-member org-store-link-plist :description) + (plist-get org-store-link-plist :description) + link))) + + ;; Store a link from a remote editing buffer. + ((org-src-edit-buffer-p) + (let ((coderef-format (org-src-coderef-format)) + (format-link + (lambda (label) + (if org-src-source-file-name + (format "file:%s::(%s)" org-src-source-file-name label) + (format "(%s)" label))))) + (cond + ;; Code references do not exist in this type of buffer. + ;; Pretend we're linking from the source buffer directly. + ((not (memq (org-src-source-type) '(example-block src-block))) + (with-current-buffer (org-src-source-buffer) + (org-store-link arg interactive?)) + (setq link nil)) + ;; A code reference exists. Use it. + ((save-excursion + (beginning-of-line) + (re-search-forward (org-src-coderef-regexp coderef-format) + (line-end-position) + t)) + (setq link (funcall format-link (match-string-no-properties 3)))) + ;; No code reference. Create a new one then store the link + ;; to it, but only in the function is called interactively. + (interactive? + (end-of-line) + (let* ((label (read-string "Code line label: ")) + (reference (format coderef-format label)) + (gc (- 79 (length reference)))) + (if (< (current-column) gc) + (org-move-to-column gc t) + (insert " ")) + (insert reference) + (setq link (funcall format-link label)))) + ;; No code reference, and non-interactive call. Don't know + ;; what to do. Give up. + (t (setq link nil))))) + + ;; We are in the agenda, link to referenced location + ((equal (bound-and-true-p org-agenda-buffer-name) (buffer-name)) + (let ((m (or (get-text-property (point) 'org-hd-marker) + (get-text-property (point) 'org-marker)))) + (when m + (org-with-point-at m + (setq agenda-link (org-store-link nil interactive?)))))) + + ((eq major-mode 'calendar-mode) + (let ((cd (calendar-cursor-to-date))) + (setq link + (format-time-string + (car org-time-stamp-formats) + (apply 'encode-time + (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd) + nil nil nil)))) + (org-link-store-props :type "calendar" :date cd))) + + ((eq major-mode 'w3-mode) + (setq cpltxt (if (and (buffer-name) + (not (string-match "Untitled" (buffer-name)))) + (buffer-name) + (url-view-url t)) + link (url-view-url t)) + (org-link-store-props :type "w3" :url (url-view-url t))) + + ((eq major-mode 'image-mode) + (setq cpltxt (concat "file:" + (abbreviate-file-name buffer-file-name)) + link cpltxt) + (org-link-store-props :type "image" :file buffer-file-name)) + + ;; In dired, store a link to the file of the current line + ((derived-mode-p 'dired-mode) + (let ((file (dired-get-filename nil t))) + (setq file (if file + (abbreviate-file-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 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 + + ((and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 'org-mode)) + (org-with-limited-levels + (cond + ;; Store a link using the target at point. + ((org-in-regexp "[^<]<<\\([^<>]+\\)>>[^>]" 1) + (setq cpltxt + (concat "file:" + (abbreviate-file-name + (buffer-file-name (buffer-base-buffer))) + "::" (match-string 1)) + link cpltxt)) + ;; Store a link using the CUSTOM_ID property. + ((setq custom-id (org-entry-get nil "CUSTOM_ID")) + (setq cpltxt + (concat "file:" + (abbreviate-file-name + (buffer-file-name (buffer-base-buffer))) + "::#" custom-id) + link cpltxt)) + ;; Store a link using (and perhaps creating) the ID property. + ((and (featurep 'org-id) + (or (eq org-id-link-to-org-use-id t) + (and interactive? + (or (eq org-id-link-to-org-use-id 'create-if-interactive) + (and (eq org-id-link-to-org-use-id + 'create-if-interactive-and-no-custom-id) + (not custom-id)))) + (and org-id-link-to-org-use-id (org-entry-get nil "ID")))) + (setq link (condition-case nil + (prog1 (org-id-store-link) + (setq desc (or (plist-get org-store-link-plist + :description) + ""))) + (error + ;; Probably before first headline, link only to file. + (concat "file:" + (abbreviate-file-name + (buffer-file-name (buffer-base-buffer)))))))) + (t + ;; Just link to current headline. + (setq cpltxt (concat "file:" + (abbreviate-file-name + (buffer-file-name (buffer-base-buffer))))) + ;; Add a context search string. + (when (org-xor org-link-context-for-files (equal arg '(4))) + (let* ((element (org-element-at-point)) + (name (org-element-property :name element)) + (context + (cond + ((let ((region (org-link--context-from-region))) + (and region (org-link--normalize-string region t)))) + (name) + ((org-before-first-heading-p) + (org-link--normalize-string (org-current-line-string) t)) + (t (org-link-heading-search-string))))) + (when (org-string-nw-p context) + (setq cpltxt (format "%s::%s" cpltxt context)) + (setq desc + (or name + ;; Although description is not a search + ;; string, use `org-link--normalize-string' + ;; to prettify it (contiguous white spaces) + ;; and remove volatile contents (statistics + ;; cookies). + (and (not (org-before-first-heading-p)) + (org-link--normalize-string + (org-get-heading t t t t))) + "NONE"))))) + (setq link cpltxt))))) + + ((buffer-file-name (buffer-base-buffer)) + ;; Just link to this file here. + (setq cpltxt (concat "file:" + (abbreviate-file-name + (buffer-file-name (buffer-base-buffer))))) + ;; Add a context search string. + (when (org-xor org-link-context-for-files (equal arg '(4))) + (let ((context (org-link--normalize-string + (or (org-link--context-from-region) + (org-current-line-string)) + t))) + ;; Only use search option if there is some text. + (when (org-string-nw-p context) + (setq cpltxt (format "%s::%s" cpltxt context)) + (setq desc "NONE")))) + (setq link cpltxt)) + + (interactive? + (user-error "No method for storing a link from this buffer")) + + (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) + desc (or desc cpltxt)) + (cond ((not desc)) + ((equal desc "NONE") (setq desc nil)) + (t (setq desc (org-link-display-format desc)))) + ;; Store and return the link + (if (not (and interactive? link)) + (or agenda-link (and link (org-link-make-string link desc))) + (if (member (list link desc) org-stored-links) + (message "This link has already been stored") + (push (list link desc) org-stored-links) + (message "Stored: %s" (or desc link)) + (when custom-id + (setq link (concat "file:" + (abbreviate-file-name + (buffer-file-name (buffer-base-buffer))) + "::#" custom-id)) + (push (list link desc) org-stored-links))) + (car org-stored-links))))) + +;;;###autoload +(defun org-insert-link (&optional complete-file link-location description) + "Insert a link. At the prompt, enter the link. + +Completion can be used to insert any of the link protocol prefixes in use. + +The history can be used to select a link previously stored with +`org-store-link'. When the empty string is entered (i.e. if you just +press `RET' at the prompt), the link defaults to the most recently +stored link. As `SPC' triggers completion in the minibuffer, you need to +use `M-SPC' or `C-q SPC' to force the insertion of a space character. + +You will also be prompted for a description, and if one is given, it will +be displayed in the buffer instead of the link. + +If there is already a link at point, this command will allow you to edit +link and description parts. + +With a `\\[universal-argument]' prefix, prompts for a file to link to. The \ +file name can be +selected using completion. The path to the file will be relative to the +current directory if the file is in the current directory or a subdirectory. +Otherwise, the link will be the absolute path as completed in the minibuffer +\(i.e. normally ~/path/to/file). You can configure this behavior using the +option `org-link-file-path-type'. + +With a `\\[universal-argument] \\[universal-argument]' prefix, enforce an \ +absolute path even if the file is in +the current directory or below. + +A `\\[universal-argument] \\[universal-argument] \\[universal-argument]' \ +prefix negates `org-link-keep-stored-after-insertion'. + +If the LINK-LOCATION parameter is non-nil, this value will be used as +the link location instead of reading one interactively. + +If the DESCRIPTION parameter is non-nil, this value will be used as the +default description. 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." + (interactive "P") + (let* ((wcf (current-window-configuration)) + (origbuf (current-buffer)) + (region (when (org-region-active-p) + (buffer-substring (region-beginning) (region-end)))) + (remove (and region (list (region-beginning) (region-end)))) + (desc region) + (link link-location) + (abbrevs org-link-abbrev-alist-local) + entry all-prefixes auto-desc) + (cond + (link-location) ; specified by arg, just use it. + ((org-in-regexp org-link-bracket-re 1) + ;; We do have a link at point, and we are going to edit it. + (setq remove (list (match-beginning 0) (match-end 0))) + (setq desc (when (match-end 2) (match-string-no-properties 2))) + (setq link (read-string "Link: " + (org-link-unescape + (match-string-no-properties 1))))) + ((or (org-in-regexp org-link-angle-re) + (org-in-regexp org-link-plain-re)) + ;; Convert to bracket link + (setq remove (list (match-beginning 0) (match-end 0)) + link (read-string "Link: " + (org-unbracket-string "<" ">" (match-string 0))))) + ((member complete-file '((4) (16))) + ;; Completing read for file names. + (setq link (org-link-complete-file complete-file))) + (t + ;; Read link, with completion for stored links. + (org-link--fontify-links-to-this-file) + (org-switch-to-buffer-other-window "*Org Links*") + (with-current-buffer "*Org Links*" + (erase-buffer) + (insert "Insert a link. +Use TAB to complete link prefixes, then RET for type-specific completion support\n") + (when org-stored-links + (insert "\nStored links are available with / or M-p/n \ +\(most recent with RET):\n\n") + (insert (mapconcat #'org-link--prettify + (reverse org-stored-links) + "\n"))) + (goto-char (point-min))) + (when (get-buffer-window "*Org Links*" 'visible) + (let ((cw (selected-window))) + (select-window (get-buffer-window "*Org Links*" 'visible)) + (with-current-buffer "*Org Links*" (setq truncate-lines t)) + (unless (pos-visible-in-window-p (point-max)) + (org-fit-window-to-buffer)) + (and (window-live-p cw) (select-window cw)))) + (setq all-prefixes (append (mapcar #'car abbrevs) + (mapcar #'car org-link-abbrev-alist) + (org-link-types))) + (unwind-protect + ;; Fake a link history, containing the stored links. + (let ((org-link--history + (append (mapcar #'car org-stored-links) + org-link--insert-history))) + (setq link + (org-completing-read + "Link: " + (append + (mapcar (lambda (x) (concat x ":")) all-prefixes) + (mapcar #'car org-stored-links)) + nil nil nil + 'org-link--history + (caar org-stored-links))) + (unless (org-string-nw-p link) (user-error "No link selected")) + (dolist (l org-stored-links) + (when (equal link (cadr l)) + (setq link (car l)) + (setq auto-desc t))) + (when (or (member link all-prefixes) + (and (equal ":" (substring link -1)) + (member (substring link 0 -1) all-prefixes) + (setq link (substring link 0 -1)))) + (setq link (with-current-buffer origbuf + (org-link--try-special-completion link))))) + (set-window-configuration wcf) + (kill-buffer "*Org Links*")) + (setq entry (assoc link org-stored-links)) + (or entry (push link org-link--insert-history)) + (setq desc (or desc (nth 1 entry))))) + + (when (funcall (if (equal complete-file '(64)) 'not 'identity) + (not org-link-keep-stored-after-insertion)) + (setq org-stored-links (delq (assoc link org-stored-links) + org-stored-links))) + + (when (and (string-match org-link-plain-re link) + (not (string-match org-ts-regexp link))) + ;; URL-like link, normalize the use of angular brackets. + (setq link (org-unbracket-string "<" ">" link))) + + ;; Check if we are linking to the current file with a search + ;; option If yes, simplify the link by using only the search + ;; option. + (when (and (buffer-file-name (buffer-base-buffer)) + (let ((case-fold-search nil)) + (string-match "\\`file:\\(.+?\\)::" link))) + (let ((path (match-string-no-properties 1 link)) + (search (substring-no-properties link (match-end 0)))) + (save-match-data + (when (equal (file-truename (buffer-file-name (buffer-base-buffer))) + (file-truename path)) + ;; We are linking to this same file, with a search option + (setq link search))))) + + ;; Check if we can/should use a relative path. If yes, simplify + ;; the link. + (let ((case-fold-search nil)) + (when (string-match "\\`\\(file\\|docview\\):" link) + (let* ((type (match-string-no-properties 0 link)) + (path-start (match-end 0)) + (search (and (string-match "::\\(.*\\)\\'" link) + (match-string 1 link))) + (path + (if search + (substring-no-properties + link path-start (match-beginning 0)) + (substring-no-properties link (match-end 0)))) + (origpath path)) + (cond + ((or (eq org-link-file-path-type 'absolute) + (equal complete-file '(16))) + (setq path (abbreviate-file-name (expand-file-name path)))) + ((eq org-link-file-path-type 'noabbrev) + (setq path (expand-file-name path))) + ((eq org-link-file-path-type 'relative) + (setq path (file-relative-name path))) + ((functionp org-link-file-path-type) + (setq path (funcall org-link-file-path-type + (expand-file-name path)))) + (t + (save-match-data + (if (string-match (concat "^" (regexp-quote + (expand-file-name + (file-name-as-directory + default-directory)))) + (expand-file-name path)) + ;; We are linking a file with relative path name. + (setq path (substring (expand-file-name path) + (match-end 0))) + (setq path (abbreviate-file-name (expand-file-name path))))))) + (setq link (concat type path (and search (concat "::" search)))) + (when (equal desc origpath) + (setq desc path))))) + + (unless auto-desc + (let ((initial-input + (cond + (description) + ((not org-link-make-description-function) desc) + (t (condition-case nil + (funcall org-link-make-description-function link desc) + (error + (message "Can't get link description from %S" + (symbol-name org-link-make-description-function)) + (sit-for 2) + nil)))))) + (setq desc (if (called-interactively-p 'any) + (read-string "Description: " initial-input) + initial-input)))) + + (unless (org-string-nw-p desc) (setq desc nil)) + (when remove (apply #'delete-region remove)) + (insert (org-link-make-string link desc)) + ;; Redisplay so as the new link has proper invisible characters. + (sit-for 0))) + +;;;###autoload +(defun org-insert-all-links (arg &optional pre post) + "Insert all links in `org-stored-links'. +When a universal prefix, do not delete the links from `org-stored-links'. +When `ARG' is a number, insert the last N link(s). +`PRE' and `POST' are optional arguments to define a string to +prepend or to append." + (interactive "P") + (let ((org-link-keep-stored-after-insertion (equal arg '(4))) + (links (copy-sequence org-stored-links)) + (pr (or pre "- ")) + (po (or post "\n")) + (cnt 1) l) + (if (null org-stored-links) + (message "No link to insert") + (while (and (or (listp arg) (>= arg cnt)) + (setq l (if (listp arg) + (pop links) + (pop org-stored-links)))) + (setq cnt (1+ cnt)) + (insert pr) + (org-insert-link nil (car l) (or (cadr l) "")) + (insert po))))) + +;;;###autoload +(defun org-insert-last-stored-link (arg) + "Insert the last link stored in `org-stored-links'." + (interactive "p") + (org-insert-all-links arg "" "\n")) + +;;;###autoload +(defun org-insert-link-global () + "Insert a link like Org mode does. +This command can be called in any mode to insert a link in Org syntax." + (interactive) + (org-load-modules-maybe) + (org-run-like-in-org-mode 'org-insert-link)) + +;;;###autoload +(defun org-update-radio-target-regexp () + "Find all radio targets in this file and update the regular expression. +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 + ;; line-breakable characters. + (before-re "\\(?:^\\|[^[:alnum:]]\\|\\c|\\)\\(") + (after-re "\\)\\(?:$\\|[^[:alnum:]]\\|\\c|\\)") + (targets + (org-with-wide-buffer + (goto-char (point-min)) + (let (rtn) + (while (re-search-forward org-radio-target-regexp nil t) + ;; Make sure point is really within the object. + (backward-char) + (let ((obj (org-element-context))) + (when (eq (org-element-type obj) 'radio-target) + (cl-pushnew (org-element-property :value obj) rtn + :test #'equal)))) + rtn)))) + (setq org-target-link-regexp + (and targets + (concat before-re + (mapconcat + (lambda (x) + (replace-regexp-in-string + " +" "\\s-+" (regexp-quote x) t t)) + targets + "\\|") + after-re))) + (unless (equal old-regexp org-target-link-regexp) + ;; Clean-up cache. + (let ((regexp (cond ((not old-regexp) org-target-link-regexp) + ((not org-target-link-regexp) old-regexp) + (t + (concat before-re + (mapconcat + (lambda (re) + (substring re (length before-re) + (- (length after-re)))) + (list old-regexp org-target-link-regexp) + "\\|") + after-re))))) + (when (featurep 'org-element) + (org-with-point-at 1 + (while (re-search-forward regexp nil t) + (org-element-cache-refresh (match-beginning 1)))))) + ;; Re fontify buffer. + (when (memq 'radio org-highlight-links) + (org-restart-font-lock))))) + + +;;; Initialize Regexps + +(org-link-make-regexps) + +(provide 'ol) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; ol.el ends here diff --git a/elpa/org-9.5.2/ol.elc b/elpa/org-9.5.2/ol.elc new file mode 100644 index 0000000..f9c0371 Binary files /dev/null and b/elpa/org-9.5.2/ol.elc differ diff --git a/elpa/org-9.5.2/org-agenda.el b/elpa/org-9.5.2/org-agenda.el new file mode 100644 index 0000000..59bdd5b --- /dev/null +++ b/elpa/org-9.5.2/org-agenda.el @@ -0,0 +1,10892 @@ +;;; org-agenda.el --- Dynamic task and appointment lists for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the code for creating and using the Agenda for Org. +;; +;; The functions `org-batch-agenda', `org-batch-agenda-csv', and +;; `org-batch-store-agenda-views' are implemented as macros to provide +;; a convenient way for extracting agenda information from the command +;; line. The Lisp does not evaluate parameters of a macro call; thus +;; it is not necessary to quote the parameters passed to one of those +;; functions. E.g. you can write: +;; +;; emacs -batch -l ~/.emacs -eval '(org-batch-agenda "a" org-agenda-span 7)' +;; +;; To export an agenda spanning 7 days. If `org-batch-agenda' would +;; have been implemented as a regular function you'd have to quote the +;; symbol org-agenda-span. Moreover: To use a symbol as parameter +;; value you would have to double quote the symbol. +;; +;; This is a hack, but it works even when running Org byte-compiled. +;; + +;;; Code: + +(require 'cl-lib) +(require 'ol) +(require 'org) +(require 'org-macs) +(require 'org-refile) + +(declare-function diary-add-to-list "diary-lib" + (date string specifier &optional marker globcolor literal)) +(declare-function calendar-iso-to-absolute "cal-iso" (date)) +(declare-function calendar-astro-date-string "cal-julian" (&optional date)) +(declare-function calendar-bahai-date-string "cal-bahai" (&optional date)) +(declare-function calendar-chinese-date-string "cal-china" (&optional date)) +(declare-function calendar-coptic-date-string "cal-coptic" (&optional date)) +(declare-function calendar-ethiopic-date-string "cal-coptic" (&optional date)) +(declare-function calendar-french-date-string "cal-french" (&optional date)) +(declare-function calendar-goto-date "cal-move" (date)) +(declare-function calendar-hebrew-date-string "cal-hebrew" (&optional date)) +(declare-function calendar-islamic-date-string "cal-islam" (&optional date)) +(declare-function calendar-iso-date-string "cal-iso" (&optional date)) +(declare-function calendar-iso-from-absolute "cal-iso" (date)) +(declare-function calendar-julian-date-string "cal-julian" (&optional date)) +(declare-function calendar-mayan-date-string "cal-mayan" (&optional date)) +(declare-function calendar-persian-date-string "cal-persia" (&optional date)) +(declare-function calendar-check-holidays "holidays" (date)) + +(declare-function org-columns-remove-overlays "org-colview" ()) +(declare-function org-datetree-find-date-create "org-datetree" + (date &optional keep-restriction)) +(declare-function org-columns-quit "org-colview" ()) +(declare-function diary-date-display-form "diary-lib" (&optional type)) +(declare-function org-mobile-write-agenda-for-mobile "org-mobile" (file)) +(declare-function org-habit-insert-consistency-graphs + "org-habit" (&optional line)) +(declare-function org-is-habit-p "org-habit" (&optional pom)) +(declare-function org-habit-parse-todo "org-habit" (&optional pom)) +(declare-function org-habit-get-priority "org-habit" (habit &optional moment)) +(declare-function org-agenda-columns "org-colview" ()) +(declare-function org-add-archive-files "org-archive" (files)) +(declare-function org-capture "org-capture" (&optional goto keys)) +(declare-function org-clock-modify-effort-estimate "org-clock" (&optional value)) + +(defvar calendar-mode-map) +(defvar org-clock-current-task) +(defvar org-current-tag-alist) +(defvar org-mobile-force-id-on-agenda-items) +(defvar org-habit-show-habits) +(defvar org-habit-show-habits-only-for-today) +(defvar org-habit-show-all-today) +(defvar org-habit-scheduled-past-days) + +;; Defined somewhere in this file, but used before definition. +(defvar org-agenda-buffer-name "*Org Agenda*") +(defvar org-agenda-overriding-header nil) +(defvar org-agenda-title-append nil) +;; (with-no-warnings (defvar entry)) ;; unprefixed, from calendar.el +;; (with-no-warnings (defvar date)) ;; unprefixed, from calendar.el +(defvar original-date) ; dynamically scoped, calendar.el does scope this + +(defvar org-agenda-undo-list nil + "List of undoable operations in the agenda since last refresh.") +(defvar org-agenda-pending-undo-list nil + "In a series of undo commands, this is the list of remaining undo items.") + +(defcustom org-agenda-confirm-kill 1 + "When set, remote killing from the agenda buffer needs confirmation. +When t, a confirmation is always needed. When a number N, confirmation is +only needed when the text to be killed contains more than N non-white lines." + :group 'org-agenda + :type '(choice + (const :tag "Never" nil) + (const :tag "Always" t) + (integer :tag "When more than N lines"))) + +(defcustom org-agenda-compact-blocks nil + "Non-nil means make the block agenda more compact. +This is done globally by leaving out lines like the agenda span +name and week number or the separator lines." + :group 'org-agenda + :type 'boolean) + +(defcustom org-agenda-block-separator ?= + "The separator between blocks in the agenda. +If this is a string, it will be used as the separator, with a newline added. +If it is a character, it will be repeated to fill the window width. +If nil the separator is disabled. In `org-agenda-custom-commands' this +addresses the separator between the current and the previous block." + :group 'org-agenda + :type '(choice + (const :tag "Disabled" nil) + (character) + (string))) + +(defgroup org-agenda-export nil + "Options concerning exporting agenda views in Org mode." + :tag "Org Agenda Export" + :group 'org-agenda) + +(defcustom org-agenda-with-colors t + "Non-nil means use colors in agenda views." + :group 'org-agenda-export + :type 'boolean) + +(defcustom org-agenda-exporter-settings nil + ;; FIXME: Do we really want to evaluate those settings and thus force + ;; the user to use `quote' all the time? + "Alist of variable/value pairs that should be active during agenda export. +This is a good place to set options for ps-print and for htmlize. +Note that the way this is implemented, the values will be evaluated +before assigned to the variables. So make sure to quote values you do +*not* want evaluated, for example + + (setq org-agenda-exporter-settings + \\='((ps-print-color-p \\='black-white)))" + :group 'org-agenda-export + :type '(repeat + (list + (variable) + (sexp :tag "Value")))) + +(defcustom org-agenda-before-write-hook '(org-agenda-add-entry-text) + "Hook run in a temporary buffer before writing the agenda to an export file. +A useful function for this hook is `org-agenda-add-entry-text'." + :group 'org-agenda-export + :type 'hook + :options '(org-agenda-add-entry-text)) + +(defcustom org-agenda-add-entry-text-maxlines 0 + "Maximum number of entry text lines to be added to agenda. +This is only relevant when `org-agenda-add-entry-text' is part of +`org-agenda-before-write-hook', which is the default. +When this is 0, nothing will happen. When it is greater than 0, it +specifies the maximum number of lines that will be added for each entry +that is listed in the agenda view. + +Note that this variable is not used during display, only when exporting +the agenda. For agenda display, see the variables `org-agenda-entry-text-mode' +and `org-agenda-entry-text-maxlines'." + :group 'org-agenda + :type 'integer) + +(defcustom org-agenda-add-entry-text-descriptive-links t + "Non-nil means export org-links as descriptive links in agenda added text. +This variable applies to the text added to the agenda when +`org-agenda-add-entry-text-maxlines' is larger than 0. +When this variable is nil, the URL will (also) be shown." + :group 'org-agenda + :type 'boolean) + +(defcustom org-agenda-export-html-style nil + "The style specification for exported HTML Agenda files. +If this variable contains a string, it will replace the default + +or, if you want to keep the style in a file, + + + +As the value of this option simply gets inserted into the HTML header, +you can \"misuse\" it to also add other text to the header." + :group 'org-agenda-export + :group 'org-export-html + :type '(choice + (const nil) + (string))) + +(defcustom org-agenda-persistent-filter nil + "When set, keep filters from one agenda view to the next." + :group 'org-agenda + :type 'boolean) + +(defgroup org-agenda-custom-commands nil + "Options concerning agenda views in Org mode." + :tag "Org Agenda Custom Commands" + :group 'org-agenda) + +(defconst org-sorting-choice + '(choice + (const time-up) (const time-down) + (const timestamp-up) (const timestamp-down) + (const scheduled-up) (const scheduled-down) + (const deadline-up) (const deadline-down) + (const ts-up) (const ts-down) + (const tsia-up) (const tsia-down) + (const category-keep) (const category-up) (const category-down) + (const tag-down) (const tag-up) + (const priority-up) (const priority-down) + (const todo-state-up) (const todo-state-down) + (const effort-up) (const effort-down) + (const habit-up) (const habit-down) + (const alpha-up) (const alpha-down) + (const user-defined-up) (const user-defined-down)) + "Sorting choices.") + +;; Keep custom values for `org-agenda-filter-preset' compatible with +;; the new variable `org-agenda-tag-filter-preset'. +(defvaralias 'org-agenda-filter-preset 'org-agenda-tag-filter-preset) +(defvaralias 'org-agenda-filter 'org-agenda-tag-filter) + +(defvar org-agenda-entry-types '(:deadline :scheduled :timestamp :sexp) + "List of types searched for when creating the daily/weekly agenda. +This variable is a list of symbols that controls the types of +items that appear in the daily/weekly agenda. Allowed symbols in this +list are + + :timestamp List items containing a date stamp or date range matching + the selected date. This includes sexp entries in angular + brackets. + + :sexp List entries resulting from plain diary-like sexps. + + :deadline List deadline due on that date. When the date is today, + also list any deadlines past due, or due within + `org-deadline-warning-days'. + + :deadline* Same as above, but only include the deadline if it has an + hour specification as [h]h:mm. + + :scheduled List all items which are scheduled for the given date. + The diary for *today* also contains items which were + scheduled earlier and are not yet marked DONE. + + :scheduled* Same as above, but only include the scheduled item if it + has an hour specification as [h]h:mm. + +By default, all four non-starred types are turned on. + +When :scheduled* or :deadline* are included, :schedule or :deadline +will be ignored. + +Never set this variable globally using `setq', because then it +will apply to all future agenda commands. Instead, bind it with +`let' to scope it dynamically into the agenda-constructing +command. A good way to set it is through options in +`org-agenda-custom-commands'. For a more flexible (though +somewhat less efficient) way of determining what is included in +the daily/weekly agenda, see `org-agenda-skip-function'.") + +(defconst org-agenda-custom-commands-local-options + `(repeat :tag "Local settings for this command. Remember to quote values" + (choice :tag "Setting" + (list :tag "Heading for this block" + (const org-agenda-overriding-header) + (string :tag "Headline")) + (list :tag "Files to be searched" + (const org-agenda-files) + (list + (const :format "" quote) + (repeat (file)))) + (list :tag "Sorting strategy" + (const org-agenda-sorting-strategy) + (list + (const :format "" quote) + (repeat + ,org-sorting-choice))) + (list :tag "Prefix format" + (const org-agenda-prefix-format :value " %-12:c%?-12t% s") + (string)) + (list :tag "Number of days in agenda" + (const org-agenda-span) + (list + (const :format "" quote) + (choice (const :tag "Day" day) + (const :tag "Week" week) + (const :tag "Fortnight" fortnight) + (const :tag "Month" month) + (const :tag "Year" year) + (integer :tag "Custom")))) + (list :tag "Fixed starting date" + (const org-agenda-start-day) + (string :value "2007-11-01")) + (list :tag "Start on day of week" + (const org-agenda-start-on-weekday) + (choice :value 1 + (const :tag "Today" nil) + (integer :tag "Weekday No."))) + (list :tag "Include data from diary" + (const org-agenda-include-diary) + (boolean)) + (list :tag "Deadline Warning days" + (const org-deadline-warning-days) + (integer :value 1)) + (list :tag "Category filter preset" + (const org-agenda-category-filter-preset) + (list + (const :format "" quote) + (repeat + (string :tag "+category or -category")))) + (list :tag "Tags filter preset" + (const org-agenda-tag-filter-preset) + (list + (const :format "" quote) + (repeat + (string :tag "+tag or -tag")))) + (list :tag "Effort filter preset" + (const org-agenda-effort-filter-preset) + (list + (const :format "" quote) + (repeat + (string :tag "+=10 or -=10 or +<10 or ->10")))) + (list :tag "Regexp filter preset" + (const org-agenda-regexp-filter-preset) + (list + (const :format "" quote) + (repeat + (string :tag "+regexp or -regexp")))) + (list :tag "Set daily/weekly entry types" + (const org-agenda-entry-types) + (list + (const :format "" quote) + (set :greedy t :value ,org-agenda-entry-types + (const :deadline) + (const :scheduled) + (const :deadline*) + (const :scheduled*) + (const :timestamp) + (const :sexp)))) + (list :tag "Columns format" + (const org-overriding-columns-format) + (string :tag "Format")) + (list :tag "Standard skipping condition" + :value (org-agenda-skip-function '(org-agenda-skip-entry-if)) + (const org-agenda-skip-function) + (list + (const :format "" quote) + (list + (choice + :tag "Skipping range" + (const :tag "Skip entry" org-agenda-skip-entry-if) + (const :tag "Skip subtree" org-agenda-skip-subtree-if)) + (repeat :inline t :tag "Conditions for skipping" + (choice + :tag "Condition type" + (list :tag "Regexp matches" :inline t + (const :format "" regexp) + (regexp)) + (list :tag "Regexp does not match" :inline t + (const :format "" notregexp) + (regexp)) + (list :tag "TODO state is" :inline t + (const todo) + (choice + (const :tag "Any not-done state" todo) + (const :tag "Any done state" done) + (const :tag "Any state" any) + (list :tag "Keyword list" + (const :format "" quote) + (repeat (string :tag "Keyword"))))) + (list :tag "TODO state is not" :inline t + (const nottodo) + (choice + (const :tag "Any not-done state" todo) + (const :tag "Any done state" done) + (const :tag "Any state" any) + (list :tag "Keyword list" + (const :format "" quote) + (repeat (string :tag "Keyword"))))) + (const :tag "scheduled" scheduled) + (const :tag "not scheduled" notscheduled) + (const :tag "deadline" deadline) + (const :tag "no deadline" notdeadline) + (const :tag "timestamp" timestamp) + (const :tag "no timestamp" nottimestamp)))))) + (list :tag "Non-standard skipping condition" + :value (org-agenda-skip-function) + (const org-agenda-skip-function) + (sexp :tag "Function or form (quoted!)")) + (list :tag "Any variable" + (variable :tag "Variable") + (sexp :tag "Value (sexp)")))) + "Selection of examples for agenda command settings. +This will be spliced into the custom type of +`org-agenda-custom-commands'.") + + +(defcustom org-agenda-custom-commands + '(("n" "Agenda and all TODOs" ((agenda "") (alltodo "")))) + "Custom commands for the agenda. +\\ +These commands will be offered on the splash screen displayed by the +agenda dispatcher `\\[org-agenda]'. Each entry is a list like this: + + (key desc type match settings files) + +key The key (one or more characters as a string) to be associated + with the command. +desc A description of the command, when omitted or nil, a default + description is built using MATCH. +type The command type, any of the following symbols: + agenda The daily/weekly agenda. + todo Entries with a specific TODO keyword, in all agenda files. + search Entries containing search words entry or headline. + tags Tags/Property/TODO match in all agenda files. + tags-todo Tags/P/T match in all agenda files, TODO entries only. + todo-tree Sparse tree of specific TODO keyword in *current* file. + tags-tree Sparse tree with all tags matches in *current* file. + occur-tree Occur sparse tree for *current* file. + ... A user-defined function. +match What to search for: + - a single keyword for TODO keyword searches + - a tags/property/todo match expression for searches + - a word search expression for text searches. + - a regular expression for occur searches + For all other commands, this should be the empty string. +settings A list of option settings, similar to that in a let form, so like + this: ((opt1 val1) (opt2 val2) ...). The values will be + evaluated at the moment of execution, so quote them when needed. +files A list of files to write the produced agenda buffer to with + the command `org-store-agenda-views'. + If a file name ends in \".html\", an HTML version of the buffer + is written out. If it ends in \".ps\", a postscript version is + produced. Otherwise, only the plain text is written to the file. + +You can also define a set of commands, to create a composite agenda buffer. +In this case, an entry looks like this: + + (key desc (cmd1 cmd2 ...) general-settings-for-whole-set files) + +where + +desc A description string to be displayed in the dispatcher menu. +cmd An agenda command, similar to the above. However, tree commands + are not allowed, but instead you can get agenda and global todo list. + So valid commands for a set are: + (agenda \"\" settings) + (alltodo \"\" settings) + (stuck \"\" settings) + (todo \"match\" settings files) + (search \"match\" settings files) + (tags \"match\" settings files) + (tags-todo \"match\" settings files) + +Each command can carry a list of options, and another set of options can be +given for the whole set of commands. Individual command options take +precedence over the general options. + +When using several characters as key to a command, the first characters +are prefix commands. For the dispatcher to display useful information, you +should provide a description for the prefix, like + + (setq org-agenda-custom-commands + \\='((\"h\" . \"HOME + Name tag searches\") ; describe prefix \"h\" + (\"hl\" tags \"+HOME+Lisa\") + (\"hp\" tags \"+HOME+Peter\") + (\"hk\" tags \"+HOME+Kim\")))" + :group 'org-agenda-custom-commands + :type `(repeat + (choice :value ("x" "Describe command here" tags "" nil) + (list :tag "Single command" + (string :tag "Access Key(s) ") + (option (string :tag "Description")) + (choice + (const :tag "Agenda" agenda) + (const :tag "TODO list" alltodo) + (const :tag "Search words" search) + (const :tag "Stuck projects" stuck) + (const :tag "Tags/Property match (all agenda files)" tags) + (const :tag "Tags/Property match of TODO entries (all agenda files)" tags-todo) + (const :tag "TODO keyword search (all agenda files)" todo) + (const :tag "Tags sparse tree (current buffer)" tags-tree) + (const :tag "TODO keyword tree (current buffer)" todo-tree) + (const :tag "Occur tree (current buffer)" occur-tree) + (sexp :tag "Other, user-defined function")) + (string :tag "Match (only for some commands)") + ,org-agenda-custom-commands-local-options + (option (repeat :tag "Export" (file :tag "Export to")))) + (list :tag "Command series, all agenda files" + (string :tag "Access Key(s)") + (string :tag "Description ") + (repeat :tag "Component" + (choice + (list :tag "Agenda" + (const :format "" agenda) + (const :tag "" :format "" "") + ,org-agenda-custom-commands-local-options) + (list :tag "TODO list (all keywords)" + (const :format "" alltodo) + (const :tag "" :format "" "") + ,org-agenda-custom-commands-local-options) + (list :tag "Search words" + (const :format "" search) + (string :tag "Match") + ,org-agenda-custom-commands-local-options) + (list :tag "Stuck projects" + (const :format "" stuck) + (const :tag "" :format "" "") + ,org-agenda-custom-commands-local-options) + (list :tag "Tags/Property match (all agenda files)" + (const :format "" tags) + (string :tag "Match") + ,org-agenda-custom-commands-local-options) + (list :tag "Tags/Property match of TODO entries (all agenda files)" + (const :format "" tags-todo) + (string :tag "Match") + ,org-agenda-custom-commands-local-options) + (list :tag "TODO keyword search" + (const :format "" todo) + (string :tag "Match") + ,org-agenda-custom-commands-local-options) + (list :tag "Other, user-defined function" + (symbol :tag "function") + (string :tag "Match") + ,org-agenda-custom-commands-local-options))) + + (repeat :tag "Settings for entire command set" + (list (variable :tag "Any variable") + (sexp :tag "Value"))) + (option (repeat :tag "Export" (file :tag "Export to")))) + (cons :tag "Prefix key documentation" + (string :tag "Access Key(s)") + (string :tag "Description "))))) + +(defcustom org-agenda-query-register ?o + "The register holding the current query string. +The purpose of this is that if you construct a query string interactively, +you can then use it to define a custom command." + :group 'org-agenda-custom-commands + :type 'character) + +(defcustom org-stuck-projects + '("+LEVEL=2/-DONE" ("TODO" "NEXT" "NEXTACTION") nil "") + "How to identify stuck projects. +This is a list of four items: +1. A tags/todo/property matcher string that is used to identify a project. + See the manual for a description of tag and property searches. + The entire tree below a headline matched by this is considered one project. +2. A list of TODO keywords identifying non-stuck projects. + If the project subtree contains any headline with one of these todo + keywords, the project is considered to be not stuck. If you specify + \"*\" as a keyword, any TODO keyword will mark the project unstuck. +3. A list of tags identifying non-stuck projects. + If the project subtree contains any headline with one of these tags, + the project is considered to be not stuck. If you specify \"*\" as + a tag, any tag will mark the project unstuck. Note that this is about + the explicit presence of a tag somewhere in the subtree, inherited + tags do not count here. If inherited tags make a project not stuck, + use \"-TAG\" in the tags part of the matcher under (1.) above. +4. An arbitrary regular expression matching non-stuck projects. + +If the project turns out to be not stuck, search continues also in the +subtree to see if any of the subtasks have project status. + +See also the variable `org-tags-match-list-sublevels' which applies +to projects matched by this search as well. + +After defining this variable, you may use `org-agenda-list-stuck-projects' +\(bound to `\\[org-agenda] #') to produce the list." + :group 'org-agenda-custom-commands + :type '(list + (string :tag "Tags/TODO match to identify a project") + (repeat :tag "Projects are *not* stuck if they have an entry with \ +TODO keyword any of" (string)) + (repeat :tag "Projects are *not* stuck if they have an entry with \ +TAG being any of" (string)) + (regexp :tag "Projects are *not* stuck if this regexp matches inside \ +the subtree"))) + +(defgroup org-agenda-skip nil + "Options concerning skipping parts of agenda files." + :tag "Org Agenda Skip" + :group 'org-agenda) + +(defcustom org-agenda-skip-function-global nil + "Function to be called at each match during agenda construction. +If this function returns nil, the current match should not be skipped. +If the function decided to skip an agenda match, is must return the +buffer position from which the search should be continued. +This may also be a Lisp form, which will be evaluated. + +This variable will be applied to every agenda match, including +tags/property searches and TODO lists. So try to make the test function +do its checking as efficiently as possible. To implement a skipping +condition just for specific agenda commands, use the variable +`org-agenda-skip-function' which can be set in the options section +of custom agenda commands." + :group 'org-agenda-skip + :type 'sexp) + +(defgroup org-agenda-daily/weekly nil + "Options concerning the daily/weekly agenda." + :tag "Org Agenda Daily/Weekly" + :group 'org-agenda) +(defgroup org-agenda-todo-list nil + "Options concerning the global todo list agenda view." + :tag "Org Agenda Todo List" + :group 'org-agenda) +(defgroup org-agenda-match-view nil + "Options concerning the general tags/property/todo match agenda view." + :tag "Org Agenda Match View" + :group 'org-agenda) +(defgroup org-agenda-search-view nil + "Options concerning the search agenda view." + :tag "Org Agenda Search View" + :group 'org-agenda) + +(defvar org-agenda-archives-mode nil + "Non-nil means the agenda will include archived items. +If this is the symbol `trees', trees in the selected agenda scope +that are marked with the ARCHIVE tag will be included anyway. When this is +t, also all archive files associated with the current selection of agenda +files will be included.") + +(defcustom org-agenda-restriction-lock-highlight-subtree t + "Non-nil means highlight the whole subtree when restriction is active. +Otherwise only highlight the headline. Highlighting the whole subtree is +useful to ensure no edits happen beyond the restricted region." + :group 'org-agenda + :type 'boolean) + +(defcustom org-agenda-skip-comment-trees t + "Non-nil means skip trees that start with the COMMENT keyword. +When nil, these trees are also scanned by agenda commands." + :group 'org-agenda-skip + :type 'boolean) + +(defcustom org-agenda-todo-list-sublevels t + "Non-nil means check also the sublevels of a TODO entry for TODO entries. +When nil, the sublevels of a TODO entry are not checked, resulting in +potentially much shorter TODO lists." + :group 'org-agenda-skip + :group 'org-agenda-todo-list + :type 'boolean) + +(defcustom org-agenda-todo-ignore-with-date nil + "Non-nil means don't show entries with a date in the global todo list. +You can use this if you prefer to mark mere appointments with a TODO keyword, +but don't want them to show up in the TODO list. +When this is set, it also covers deadlines and scheduled items, the settings +of `org-agenda-todo-ignore-scheduled' and `org-agenda-todo-ignore-deadlines' +will be ignored. +See also the variable `org-agenda-tags-todo-honor-ignore-options'." + :group 'org-agenda-skip + :group 'org-agenda-todo-list + :type 'boolean) + +(defcustom org-agenda-todo-ignore-timestamp nil + "Non-nil means don't show entries with a timestamp. +This applies when creating the global todo list. +Valid values are: + +past Don't show entries for today or in the past. + +future Don't show entries with a timestamp in the future. + The idea behind this is that if it has a future + timestamp, you don't want to think about it until the + date. + +all Don't show any entries with a timestamp in the global todo list. + The idea behind this is that by setting a timestamp, you + have already \"taken care\" of this item. + +This variable can also have an integer as a value. If positive (N), +todos with a timestamp N or more days in the future will be ignored. If +negative (-N), todos with a timestamp N or more days in the past will be +ignored. If 0, todos with a timestamp either today or in the future will +be ignored. For example, a value of -1 will exclude todos with a +timestamp in the past (yesterday or earlier), while a value of 7 will +exclude todos with a timestamp a week or more in the future. + +See also `org-agenda-todo-ignore-with-date'. +See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want +to make his option also apply to the tags-todo list." + :group 'org-agenda-skip + :group 'org-agenda-todo-list + :version "24.1" + :type '(choice + (const :tag "Ignore future timestamp todos" future) + (const :tag "Ignore past or present timestamp todos" past) + (const :tag "Ignore all timestamp todos" all) + (const :tag "Show timestamp todos" nil) + (integer :tag "Ignore if N or more days in past(-) or future(+)."))) + +(defcustom org-agenda-todo-ignore-scheduled nil + "Non-nil means, ignore some scheduled TODO items when making TODO list. +This applies when creating the global todo list. +Valid values are: + +past Don't show entries scheduled today or in the past. + +future Don't show entries scheduled in the future. + The idea behind this is that by scheduling it, you don't want to + think about it until the scheduled date. + +all Don't show any scheduled entries in the global todo list. + The idea behind this is that by scheduling it, you have already + \"taken care\" of this item. + +t Same as `all', for backward compatibility. + +This variable can also have an integer as a value. See +`org-agenda-todo-ignore-timestamp' for more details. + +See also `org-agenda-todo-ignore-with-date'. +See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want +to make his option also apply to the tags-todo list." + :group 'org-agenda-skip + :group 'org-agenda-todo-list + :type '(choice + (const :tag "Ignore future-scheduled todos" future) + (const :tag "Ignore past- or present-scheduled todos" past) + (const :tag "Ignore all scheduled todos" all) + (const :tag "Ignore all scheduled todos (compatibility)" t) + (const :tag "Show scheduled todos" nil) + (integer :tag "Ignore if N or more days in past(-) or future(+)."))) + +(defcustom org-agenda-todo-ignore-deadlines nil + "Non-nil means ignore some deadline TODO items when making TODO list. + +There are different motivations for using different values, please think +carefully when configuring this variable. + +This applies when creating the global TODO list. + +Valid values are: + +near Don't show near deadline entries. A deadline is near when it is + closer than `org-deadline-warning-days' days. The idea behind this + is that such items will appear in the agenda anyway. + +far Don't show TODO entries where a deadline has been defined, but + is not going to happen anytime soon. This is useful if you want to use + the TODO list to figure out what to do now. + +past Don't show entries with a deadline timestamp for today or in the past. + +future Don't show entries with a deadline timestamp in the future, not even + when they become `near' ones. Use it with caution. + +all Ignore all TODO entries that do have a deadline. + +t Same as `near', for backward compatibility. + +This variable can also have an integer as a value. See +`org-agenda-todo-ignore-timestamp' for more details. + +See also `org-agenda-todo-ignore-with-date'. +See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want +to make his option also apply to the tags-todo list." + :group 'org-agenda-skip + :group 'org-agenda-todo-list + :type '(choice + (const :tag "Ignore near deadlines" near) + (const :tag "Ignore near deadlines (compatibility)" t) + (const :tag "Ignore far deadlines" far) + (const :tag "Ignore all TODOs with a deadlines" all) + (const :tag "Show all TODOs, even if they have a deadline" nil) + (integer :tag "Ignore if N or more days in past(-) or future(+)."))) + +(defcustom org-agenda-todo-ignore-time-comparison-use-seconds nil + "Time unit to use when possibly ignoring an agenda item. + +See the docstring of various `org-agenda-todo-ignore-*' options. +The default is to compare time stamps using days. An item is thus +considered to be in the future if it is at least one day after today. +Non-nil means to compare time stamps using seconds. An item is then +considered future if it has a time value later than current time." + :group 'org-agenda-skip + :group 'org-agenda-todo-list + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Compare time with days" nil) + (const :tag "Compare time with seconds" t))) + +(defcustom org-agenda-tags-todo-honor-ignore-options nil + "Non-nil means honor todo-list ignores options also in tags-todo search. +The variables + `org-agenda-todo-ignore-with-date', + `org-agenda-todo-ignore-timestamp', + `org-agenda-todo-ignore-scheduled', + `org-agenda-todo-ignore-deadlines' +make the global TODO list skip entries that have time stamps of certain +kinds. If this option is set, the same options will also apply for the +tags-todo search, which is the general tags/property matcher +restricted to unfinished TODO entries only." + :group 'org-agenda-skip + :group 'org-agenda-todo-list + :group 'org-agenda-match-view + :type 'boolean) + +(defcustom org-agenda-skip-scheduled-if-done nil + "Non-nil means don't show scheduled items in agenda when they are done. +This is relevant for the daily/weekly agenda, not for the TODO list. It +applies only to the actual date of the scheduling. Warnings about an item +with a past scheduling dates are always turned off when the item is DONE." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :type 'boolean) + +(defcustom org-agenda-skip-scheduled-if-deadline-is-shown nil + "Non-nil means skip scheduling line if same entry shows because of deadline. + +In the agenda of today, an entry can show up multiple times +because it is both scheduled and has a nearby deadline, and maybe +a plain time stamp as well. + +When this variable is nil, the entry will be shown several times. + +When set to t, then only the deadline is shown and the fact that +the entry is scheduled today or was scheduled previously is not +shown. + +When set to the symbol `not-today', skip scheduled previously, +but not scheduled today. + +When set to the symbol `repeated-after-deadline', skip scheduled +items if they are repeated beyond the current deadline." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :type '(choice + (const :tag "Never" nil) + (const :tag "Always" t) + (const :tag "Not when scheduled today" not-today) + (const :tag "When repeated past deadline" repeated-after-deadline))) + +(defcustom org-agenda-skip-timestamp-if-deadline-is-shown nil + "Non-nil means skip timestamp line if same entry shows because of deadline. +In the agenda of today, an entry can show up multiple times +because it has both a plain timestamp and has a nearby deadline. +When this variable is t, then only the deadline is shown and the +fact that the entry has a timestamp for or including today is not +shown. When this variable is nil, the entry will be shown +several times." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :version "24.1" + :type '(choice + (const :tag "Never" nil) + (const :tag "Always" t))) + +(defcustom org-agenda-skip-deadline-if-done nil + "Non-nil means don't show deadlines when the corresponding item is done. +When nil, the deadline is still shown and should give you a happy feeling. +This is relevant for the daily/weekly agenda. It applies only to the +actual date of the deadline. Warnings about approaching and past-due +deadlines are always turned off when the item is DONE." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :type 'boolean) + +(defcustom org-agenda-skip-deadline-prewarning-if-scheduled nil + "Non-nil means skip deadline prewarning when entry is also scheduled. +This will apply on all days where a prewarning for the deadline would +be shown, but not at the day when the entry is actually due. On that day, +the deadline will be shown anyway. +This variable may be set to nil, t, the symbol `pre-scheduled', +or a number which will then give the number of days before the actual +deadline when the prewarnings should resume. The symbol `pre-scheduled' +eliminates the deadline prewarning only prior to the scheduled date. +This can be used in a workflow where the first showing of the deadline will +trigger you to schedule it, and then you don't want to be reminded of it +because you will take care of it on the day when scheduled." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :version "24.1" + :type '(choice + (const :tag "Always show prewarning" nil) + (const :tag "Remove prewarning prior to scheduled date" pre-scheduled) + (const :tag "Remove prewarning if entry is scheduled" t) + (integer :tag "Restart prewarning N days before deadline"))) + +(defcustom org-agenda-skip-scheduled-delay-if-deadline nil + "Non-nil means skip scheduled delay when entry also has a deadline. +This variable may be set to nil, t, the symbol `post-deadline', +or a number which will then give the number of days after the actual +scheduled date when the delay should expire. The symbol `post-deadline' +eliminates the schedule delay when the date is posterior to the deadline." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Always honor delay" nil) + (const :tag "Ignore delay if posterior to the deadline" post-deadline) + (const :tag "Ignore delay if entry has a deadline" t) + (integer :tag "Honor delay up until N days after the scheduled date"))) + +(defcustom org-agenda-skip-additional-timestamps-same-entry nil + "When nil, multiple same-day timestamps in entry make multiple agenda lines. +When non-nil, after the search for timestamps has matched once in an +entry, the rest of the entry will not be searched." + :group 'org-agenda-skip + :type 'boolean) + +(defcustom org-agenda-skip-timestamp-if-done nil + "Non-nil means don't select item by timestamp or -range if it is DONE." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :type 'boolean) + +(defcustom org-agenda-dim-blocked-tasks t + "Non-nil means dim blocked tasks in the agenda display. +This causes some overhead during agenda construction, but if you +have turned on `org-enforce-todo-dependencies', +`org-enforce-todo-checkbox-dependencies', or any other blocking +mechanism, this will create useful feedback in the agenda. + +Instead of t, this variable can also have the value `invisible'. +Then blocked tasks will be invisible and only become visible when +they become unblocked. An exemption to this behavior is when a task is +blocked because of unchecked checkboxes below it. Since checkboxes do +not show up in the agenda views, making this task invisible you remove any +trace from agenda views that there is something to do. Therefore, a task +that is blocked because of checkboxes will never be made invisible, it +will only be dimmed." + :group 'org-agenda-daily/weekly + :group 'org-agenda-todo-list + :version "24.3" + :type '(choice + (const :tag "Do not dim" nil) + (const :tag "Dim to a gray face" t) + (const :tag "Make invisible" invisible))) + +(defgroup org-agenda-startup nil + "Options concerning initial settings in the Agenda in Org Mode." + :tag "Org Agenda Startup" + :group 'org-agenda) + +(defcustom org-agenda-menu-show-matcher t + "Non-nil means show the match string in the agenda dispatcher menu. +When nil, the matcher string is not shown, but is put into the help-echo +property so than moving the mouse over the command shows it. +Setting it to nil is good if matcher strings are very long and/or if +you want to use two-columns display (see `org-agenda-menu-two-columns')." + :group 'org-agenda + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-menu-two-columns nil + "Non-nil means, use two columns to show custom commands in the dispatcher. +If you use this, you probably want to set `org-agenda-menu-show-matcher' +to nil." + :group 'org-agenda + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-finalize-hook nil + "Hook run just before displaying an agenda buffer. +The buffer is still writable when the hook is called. + +You can modify some of the buffer substrings but you should be +extra careful not to modify the text properties of the agenda +headlines as the agenda display heavily relies on them." + :group 'org-agenda-startup + :type 'hook) + +(defcustom org-agenda-filter-hook nil + "Hook run just after filtering with `org-agenda-filter'." + :group 'org-agenda-startup + :package-version '(Org . "9.4") + :type 'hook) + +(defcustom org-agenda-mouse-1-follows-link nil + "Non-nil means mouse-1 on a link will follow the link in the agenda. +A longer mouse click will still set point. Needs to be set +before org.el is loaded." + :group 'org-agenda-startup + :type 'boolean) + +(defcustom org-agenda-start-with-follow-mode nil + "The initial value of follow mode in a newly created agenda window." + :group 'org-agenda-startup + :type 'boolean) + +(defcustom org-agenda-follow-indirect nil + "Non-nil means `org-agenda-follow-mode' displays only the +current item's tree, in an indirect buffer." + :group 'org-agenda + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-show-outline-path t + "Non-nil means show outline path in echo area after line motion." + :group 'org-agenda-startup + :type 'boolean) + +(defcustom org-agenda-start-with-entry-text-mode nil + "The initial value of entry-text-mode in a newly created agenda window." + :group 'org-agenda-startup + :type 'boolean) + +(defcustom org-agenda-entry-text-maxlines 5 + "Number of text lines to be added when `E' is pressed in the agenda. + +Note that this variable only used during agenda display. To add entry text +when exporting the agenda, configure the variable +`org-agenda-add-entry-text-maxlines'." + :group 'org-agenda + :type 'integer) + +(defcustom org-agenda-entry-text-exclude-regexps nil + "List of regular expressions to clean up entry text. +The complete matches of all regular expressions in this list will be +removed from entry text before it is shown in the agenda." + :group 'org-agenda + :type '(repeat (regexp))) + +(defcustom org-agenda-entry-text-leaders " > " + "Text prepended to the entry text in agenda buffers." + :version "24.4" + :package-version '(Org . "8.0") + :group 'org-agenda + :type 'string) + +(defvar org-agenda-entry-text-cleanup-hook nil + "Hook that is run after basic cleanup of entry text to be shown in agenda. +This cleanup is done in a temporary buffer, so the function may inspect and +change the entire buffer. +Some default stuff like drawers and scheduling/deadline dates will already +have been removed when this is called, as will any matches for regular +expressions listed in `org-agenda-entry-text-exclude-regexps'.") + +(defvar org-agenda-include-inactive-timestamps nil + "Non-nil means include inactive time stamps in agenda. +Dynamically scoped.") + +(defgroup org-agenda-windows nil + "Options concerning the windows used by the Agenda in Org Mode." + :tag "Org Agenda Windows" + :group 'org-agenda) + +(defcustom org-agenda-window-setup 'reorganize-frame + "How the agenda buffer should be displayed. +Possible values for this option are: + +current-window Show agenda in the current window, keeping all other windows. +other-window Use `switch-to-buffer-other-window' to display agenda. +only-window Show agenda, deleting all other windows. +reorganize-frame Show only two windows on the current frame, the current + window and the agenda. +other-frame Use `switch-to-buffer-other-frame' to display agenda. + Also, when exiting the agenda, kill that frame. +other-tab Use `switch-to-buffer-other-tab' to display the + agenda, making use of the `tab-bar-mode' introduced + in Emacs version 27.1. Also, kill that tab when + exiting the agenda view. + +See also the variable `org-agenda-restore-windows-after-quit'." + :group 'org-agenda-windows + :type '(choice + (const current-window) + (const other-frame) + (const other-tab) + (const other-window) + (const only-window) + (const reorganize-frame)) + :package-version '(Org . "9.4")) + +(defcustom org-agenda-window-frame-fractions '(0.5 . 0.75) + "The min and max height of the agenda window as a fraction of frame height. +The value of the variable is a cons cell with two numbers between 0 and 1. +It only matters if `org-agenda-window-setup' is `reorganize-frame'." + :group 'org-agenda-windows + :type '(cons (number :tag "Minimum") (number :tag "Maximum"))) + +(defcustom org-agenda-restore-windows-after-quit nil + "Non-nil means restore window configuration upon exiting agenda. +Before the window configuration is changed for displaying the +agenda, the current status is recorded. When the agenda is +exited with `q' or `x' and this option is set, the old state is +restored. If `org-agenda-window-setup' is `other-frame' or +`other-tab', the value of this option will be ignored." + :group 'org-agenda-windows + :type 'boolean) + +(defcustom org-agenda-span 'week + "Number of days to include in overview display. +Can be day, week, month, year, or any number of days. +Custom commands can set this variable in the options section." + :group 'org-agenda-daily/weekly + :type '(choice (const :tag "Day" day) + (const :tag "Week" week) + (const :tag "Fortnight" fortnight) + (const :tag "Month" month) + (const :tag "Year" year) + (integer :tag "Custom"))) + +(defcustom org-agenda-start-on-weekday 1 + "Non-nil means start the overview always on the specified weekday. +0 denotes Sunday, 1 denotes Monday, etc. +When nil, always start on the current day. +Custom commands can set this variable in the options section." + :group 'org-agenda-daily/weekly + :type '(choice (const :tag "Today" nil) + (integer :tag "Weekday No."))) + +(defcustom org-agenda-show-all-dates t + "Non-nil means `org-agenda' shows every day in the selected range. +When nil, only the days which actually have entries are shown." + :group 'org-agenda-daily/weekly + :type 'boolean) + +(defcustom org-agenda-format-date 'org-agenda-format-date-aligned + "Format string for displaying dates in the agenda. +Used by the daily/weekly agenda. This should be a format string +understood by `format-time-string', or a function returning the +formatted date as a string. The function must take a single +argument, a calendar-style date list like (month day year)." + :group 'org-agenda-daily/weekly + :type '(choice + (string :tag "Format string") + (function :tag "Function"))) + +(defun org-agenda-end-of-line () + "Go to the end of visible line." + (interactive) + (goto-char (line-end-position))) + +(defun org-agenda-format-date-aligned (date) + "Format a DATE string for display in the daily/weekly agenda. +This function makes sure that dates are aligned for easy reading." + (require 'cal-iso) + (let* ((dayname (calendar-day-name date)) + (day (cadr date)) + (day-of-week (calendar-day-of-week date)) + (month (car date)) + (monthname (calendar-month-name month)) + (year (nth 2 date)) + (iso-week (org-days-to-iso-week + (calendar-absolute-from-gregorian date))) + ;; (weekyear (cond ((and (= month 1) (>= iso-week 52)) + ;; (1- year)) + ;; ((and (= month 12) (<= iso-week 1)) + ;; (1+ year)) + ;; (t year))) + (weekstring (if (= day-of-week 1) + (format " W%02d" iso-week) + ""))) + (format "%-10s %2d %s %4d%s" + dayname day monthname year weekstring))) + +(defcustom org-agenda-time-leading-zero nil + "Non-nil means use leading zero for military times in agenda. +For example, 9:30am would become 09:30 rather than 9:30." + :group 'org-agenda-daily/weekly + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-timegrid-use-ampm nil + "When set, show AM/PM style timestamps on the timegrid." + :group 'org-agenda + :version "24.1" + :type 'boolean) + +(defun org-agenda-time-of-day-to-ampm (time) + "Convert TIME of a string like \"13:45\" to an AM/PM style time string." + (let* ((hour-number (string-to-number (substring time 0 -3))) + (minute (substring time -2)) + (ampm "am")) + (cond + ((equal hour-number 12) + (setq ampm "pm")) + ((> hour-number 12) + (setq ampm "pm") + (setq hour-number (- hour-number 12)))) + (concat + (if org-agenda-time-leading-zero + (format "%02d" hour-number) + (format "%02s" (number-to-string hour-number))) + ":" minute ampm))) + +(defun org-agenda-time-of-day-to-ampm-maybe (time) + "Conditionally convert TIME to AM/PM format. +This is based on `org-agenda-timegrid-use-ampm'." + (if org-agenda-timegrid-use-ampm + (org-agenda-time-of-day-to-ampm time) + time)) + +(defcustom org-agenda-weekend-days '(6 0) + "Which days are weekend? +These days get the special face `org-agenda-date-weekend' in the agenda." + :group 'org-agenda-daily/weekly + :type '(set :greedy t + (const :tag "Monday" 1) + (const :tag "Tuesday" 2) + (const :tag "Wednesday" 3) + (const :tag "Thursday" 4) + (const :tag "Friday" 5) + (const :tag "Saturday" 6) + (const :tag "Sunday" 0))) + +(defcustom org-agenda-move-date-from-past-immediately-to-today t + "Non-nil means jump to today when moving a past date forward in time. +When using S-right in the agenda to move a date forward, and the date +stamp currently points to the past, the first key press will move it +to today. When nil, just move one day forward even if the date stays +in the past." + :group 'org-agenda-daily/weekly + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-diary-file 'diary-file + "File to which to add new entries with the `i' key in agenda and calendar. +When this is the symbol `diary-file', the functionality in the Emacs +calendar will be used to add entries to the `diary-file'. But when this +points to a file, `org-agenda-diary-entry' will be used instead." + :group 'org-agenda + :type '(choice + (const :tag "The standard Emacs diary file" diary-file) + (file :tag "Special Org file diary entries"))) + +(defcustom org-agenda-include-diary nil + "If non-nil, include in the agenda entries from the Emacs Calendar's diary. +Custom commands can set this variable in the options section." + :group 'org-agenda-daily/weekly + :type 'boolean) + +(defcustom org-agenda-include-deadlines t + "If non-nil, include entries within their deadline warning period. +Custom commands can set this variable in the options section." + :group 'org-agenda-daily/weekly + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-show-future-repeats t + "Non-nil shows repeated entries in the future part of the agenda. +When set to the symbol `next' only the first future repeat is shown." + :group 'org-agenda-daily/weekly + :type '(choice + (const :tag "Show all repeated entries" t) + (const :tag "Show next repeated entry" next) + (const :tag "Do not show repeated entries" nil)) + :version "26.1" + :package-version '(Org . "9.1") + :safe #'symbolp) + +(defcustom org-agenda-prefer-last-repeat nil + "Non-nil sets date for repeated entries to their last repeat. + +When nil, display SCHEDULED and DEADLINE dates at their base +date, and in today's agenda, as a reminder. Display plain +time-stamps, on the other hand, at every repeat date in the past +in addition to the base date. + +When non-nil, show a repeated entry at its latest repeat date, +possibly being today even if it wasn't marked as done. This +setting is useful if you do not always mark repeated entries as +done and, yet, consider that reaching repeat date starts the task +anew. + +When set to a list of strings, prefer last repeats only for +entries with these TODO keywords." + :group 'org-agenda-daily/weekly + :type '(choice + (const :tag "Prefer last repeat" t) + (const :tag "Prefer base date" nil) + (repeat :tag "Prefer last repeat for entries with these TODO keywords" + (string :tag "TODO keyword"))) + :version "26.1" + :package-version '(Org . "9.1") + :safe (lambda (x) (or (booleanp x) (consp x)))) + +(defcustom org-scheduled-past-days 10000 + "Number of days to continue listing scheduled items not marked DONE. +When an item is scheduled on a date, it shows up in the agenda on +this day and will be listed until it is marked done or for the +number of days given here." + :group 'org-agenda-daily/weekly + :type 'integer + :safe 'integerp) + +(defcustom org-deadline-past-days 10000 + "Number of days to warn about missed deadlines. +When an item has deadline on a date, it shows up in the agenda on +this day and will appear as a reminder until it is marked DONE or +for the number of days given here." + :group 'org-agenda-daily/weekly + :type 'integer + :version "26.1" + :package-version '(Org . "9.1") + :safe 'integerp) + +(defcustom org-agenda-log-mode-items '(closed clock) + "List of items that should be shown in agenda log mode. +\\\ +This list may contain the following symbols: + + closed Show entries that have been closed on that day. + clock Show entries that have received clocked time on that day. + state Show all logged state changes. +Note that instead of changing this variable, you can also press \ +`\\[universal-argument] \\[org-agenda-log-mode]' in +the agenda to display all available LOG items temporarily." + :group 'org-agenda-daily/weekly + :type '(set :greedy t (const closed) (const clock) (const state))) + +(defcustom org-agenda-clock-consistency-checks + '(:max-duration "10:00" :min-duration 0 :max-gap "0:05" + :gap-ok-around ("4:00") + :default-face ((:background "DarkRed") (:foreground "white")) + :overlap-face nil :gap-face nil :no-end-time-face nil + :long-face nil :short-face nil) + "This is a property list, with the following keys: + +:max-duration Mark clocking chunks that are longer than this time. + This is a time string like \"HH:MM\", or the number + of minutes as an integer. + +:min-duration Mark clocking chunks that are shorter that this. + This is a time string like \"HH:MM\", or the number + of minutes as an integer. + +:max-gap Mark gaps between clocking chunks that are longer than + this duration. A number of minutes, or a string + like \"HH:MM\". + +:gap-ok-around List of times during the day which are usually not working + times. When a gap is detected, but the gap contains any + of these times, the gap is *not* reported. For example, + if this is (\"4:00\" \"13:00\") then gaps that contain + 4:00 in the morning (i.e. the night) and 13:00 + (i.e. a typical lunch time) do not cause a warning. + You should have at least one time during the night in this + list, or otherwise the first task each morning will trigger + a warning because it follows a long gap. + +Furthermore, the following properties can be used to define faces for +issue display. + +:default-face the default face, if the specific face is undefined +:overlap-face face for overlapping clocks +:gap-face face for gaps between clocks +:no-end-time-face face for incomplete clocks +:long-face face for clock intervals that are too long +:short-face face for clock intervals that are too short" + :group 'org-agenda-daily/weekly + :group 'org-clock + :version "24.1" + :type 'plist) + +(defcustom org-agenda-log-mode-add-notes t + "Non-nil means add first line of notes to log entries in agenda views. +If a log item like a state change or a clock entry is associated with +notes, the first line of these notes will be added to the entry in the +agenda display." + :group 'org-agenda-daily/weekly + :type 'boolean) + +(defcustom org-agenda-start-with-log-mode nil + "The initial value of log-mode in a newly created agenda window. +See `org-agenda-log-mode' and `org-agenda-log-mode-items' for further +explanations on the possible values." + :group 'org-agenda-startup + :group 'org-agenda-daily/weekly + :type '(choice (const :tag "Don't show log items" nil) + (const :tag "Show only log items" only) + (const :tag "Show all possible log items" clockcheck) + (repeat :tag "Choose among possible values for `org-agenda-log-mode-items'" + (choice (const :tag "Show closed log items" closed) + (const :tag "Show clocked log items" clock) + (const :tag "Show all logged state changes" state))))) + +(defcustom org-agenda-start-with-clockreport-mode nil + "The initial value of clockreport-mode in a newly created agenda window." + :group 'org-agenda-startup + :group 'org-agenda-daily/weekly + :type 'boolean) + +(defcustom org-agenda-clockreport-parameter-plist '(:link t :maxlevel 2) + "Property list with parameters for the clocktable in clockreport mode. +This is the display mode that shows a clock table in the daily/weekly +agenda, the properties for this dynamic block can be set here. +The usual clocktable parameters are allowed here, but you cannot set +the properties :name, :tstart, :tend, :block, and :scope - these will +be overwritten to make sure the content accurately reflects the +current display in the agenda." + :group 'org-agenda-daily/weekly + :type 'plist) + +(defvaralias 'org-agenda-search-view-search-words-only + 'org-agenda-search-view-always-boolean) + +(defcustom org-agenda-search-view-always-boolean nil + "Non-nil means the search string is interpreted as individual parts. + +The search string for search view can either be interpreted as a phrase, +or as a list of snippets that define a boolean search for a number of +strings. + +When this is non-nil, the string will be split on whitespace, and each +snippet will be searched individually, and all must match in order to +select an entry. A snippet is then a single string of non-white +characters, or a string in double quotes, or a regexp in {} braces. +If a snippet is preceded by \"-\", the snippet must *not* match. +\"+\" is syntactic sugar for positive selection. Each snippet may +be found as a full word or a partial word, but see the variable +`org-agenda-search-view-force-full-words'. + +When this is nil, search will look for the entire search phrase as one, +with each space character matching any amount of whitespace, including +line breaks. + +Even when this is nil, you can still switch to Boolean search dynamically +by preceding the first snippet with \"+\" or \"-\". If the first snippet +is a regexp marked with braces like \"{abc}\", this will also switch to +boolean search." + :group 'org-agenda-search-view + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-search-view-force-full-words nil + "Non-nil means, search words must be matches as complete words. +When nil, they may also match part of a word." + :group 'org-agenda-search-view + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-search-view-max-outline-level 0 + "Maximum outline level to display in search view. +E.g. when this is set to 1, the search view will only +show headlines of level 1. When set to 0, the default +value, don't limit agenda view by outline level." + :group 'org-agenda-search-view + :version "26.1" + :package-version '(Org . "8.3") + :type 'integer) + +(defgroup org-agenda-time-grid nil + "Options concerning the time grid in the Org Agenda." + :tag "Org Agenda Time Grid" + :group 'org-agenda) + +(defcustom org-agenda-search-headline-for-time t + "Non-nil means search headline for a time-of-day. +If the headline contains a time-of-day in one format or another, it will +be used to sort the entry into the time sequence of items for a day. +Some people have time stamps in the headline that refer to the creation +time or so, and then this produces an unwanted side effect. If this is +the case for your, use this variable to turn off searching the headline +for a time." + :group 'org-agenda-time-grid + :type 'boolean) + +(defcustom org-agenda-use-time-grid t + "Non-nil means show a time grid in the agenda schedule. +A time grid is a set of lines for specific times (like every two hours between +8:00 and 20:00). The items scheduled for a day at specific times are +sorted in between these lines. +For details about when the grid will be shown, and what it will look like, see +the variable `org-agenda-time-grid'." + :group 'org-agenda-time-grid + :type 'boolean) + +(defcustom org-agenda-time-grid + '((daily today require-timed) + (800 1000 1200 1400 1600 1800 2000) + "......" + "----------------") + + "The settings for time grid for agenda display. +This is a list of four items. The first item is again a list. It contains +symbols specifying conditions when the grid should be displayed: + + daily if the agenda shows a single day + weekly if the agenda shows an entire week + today show grid on current date, independent of daily/weekly display + require-timed show grid only if at least one item has a time specification + remove-match skip grid times already present in an entry + +The second item is a list of integers, indicating the times that +should have a grid line. + +The third item is a string which will be placed right after the +times that have a grid line. + +The fourth item is a string placed after the grid times. This +will align with agenda items." + :group 'org-agenda-time-grid + :type + '(list + (set :greedy t :tag "Grid Display Options" + (const :tag "Show grid in single day agenda display" daily) + (const :tag "Show grid in weekly agenda display" weekly) + (const :tag "Always show grid for today" today) + (const :tag "Show grid only if any timed entries are present" + require-timed) + (const :tag "Skip grid times already present in an entry" + remove-match)) + (repeat :tag "Grid Times" (integer :tag "Time")) + (string :tag "Grid String (after agenda times)") + (string :tag "Grid String (aligns with agenda items)"))) + +(defcustom org-agenda-show-current-time-in-grid t + "Non-nil means show the current time in the time grid." + :group 'org-agenda-time-grid + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-current-time-string + "now - - - - - - - - - - - - - - - - - - - - - - - - -" + "The string for the current time marker in the agenda." + :group 'org-agenda-time-grid + :version "24.1" + :type 'string) + +(defgroup org-agenda-sorting nil + "Options concerning sorting in the Org Agenda." + :tag "Org Agenda Sorting" + :group 'org-agenda) + +(defcustom org-agenda-sorting-strategy + '((agenda habit-down time-up priority-down category-keep) + (todo priority-down category-keep) + (tags priority-down category-keep) + (search category-keep)) + "Sorting structure for the agenda items of a single day. +This is a list of symbols which will be used in sequence to determine +if an entry should be listed before another entry. The following +symbols are recognized: + +time-up Put entries with time-of-day indications first, early first. +time-down Put entries with time-of-day indications first, late first. +timestamp-up Sort by any timestamp, early first. +timestamp-down Sort by any timestamp, late first. +scheduled-up Sort by scheduled timestamp, early first. +scheduled-down Sort by scheduled timestamp, late first. +deadline-up Sort by deadline timestamp, early first. +deadline-down Sort by deadline timestamp, late first. +ts-up Sort by active timestamp, early first. +ts-down Sort by active timestamp, late first. +tsia-up Sort by inactive timestamp, early first. +tsia-down Sort by inactive timestamp, late first. +category-keep Keep the default order of categories, corresponding to the + sequence in `org-agenda-files'. +category-up Sort alphabetically by category, A-Z. +category-down Sort alphabetically by category, Z-A. +tag-up Sort alphabetically by last tag, A-Z. +tag-down Sort alphabetically by last tag, Z-A. +priority-up Sort numerically by priority, high priority last. +priority-down Sort numerically by priority, high priority first. +todo-state-up Sort by todo state, tasks that are done last. +todo-state-down Sort by todo state, tasks that are done first. +effort-up Sort numerically by estimated effort, high effort last. +effort-down Sort numerically by estimated effort, high effort first. +user-defined-up Sort according to `org-agenda-cmp-user-defined', high last. +user-defined-down Sort according to `org-agenda-cmp-user-defined', high first. +habit-up Put entries that are habits first. +habit-down Put entries that are habits last. +alpha-up Sort headlines alphabetically. +alpha-down Sort headlines alphabetically, reversed. + +The different possibilities will be tried in sequence, and testing stops +if one comparison returns a \"not-equal\". For example, the default + '(time-up category-keep priority-down) +means: Pull out all entries having a specified time of day and sort them, +in order to make a time schedule for the current day the first thing in the +agenda listing for the day. Of the entries without a time indication, keep +the grouped in categories, don't sort the categories, but keep them in +the sequence given in `org-agenda-files'. Within each category sort by +priority. + +Leaving out `category-keep' would mean that items will be sorted across +categories by priority. + +Instead of a single list, this can also be a set of list for specific +contents, with a context symbol in the car of the list, any of +`agenda', `todo', `tags', `search' for the corresponding agenda views. + +Custom commands can bind this variable in the options section." + :group 'org-agenda-sorting + :type `(choice + (repeat :tag "General" ,org-sorting-choice) + (list :tag "Individually" + (cons (const :tag "Strategy for Weekly/Daily agenda" agenda) + (repeat ,org-sorting-choice)) + (cons (const :tag "Strategy for TODO lists" todo) + (repeat ,org-sorting-choice)) + (cons (const :tag "Strategy for Tags matches" tags) + (repeat ,org-sorting-choice)) + (cons (const :tag "Strategy for search matches" search) + (repeat ,org-sorting-choice))))) + +(defcustom org-agenda-cmp-user-defined nil + "A function to define the comparison `user-defined'. +This function must receive two arguments, agenda entry a and b. +If a>b, return +1. If a effort operator. Then, tasks with no effort defined will be treated +as tasks with high effort. +When nil, such items are sorted as 0 minutes effort." + :group 'org-agenda-sorting + :type 'boolean) + +(defgroup org-agenda-line-format nil + "Options concerning the entry prefix in the Org agenda display." + :tag "Org Agenda Line Format" + :group 'org-agenda) + +(defcustom org-agenda-prefix-format + '((agenda . " %i %-12:c%?-12t% s") + (todo . " %i %-12:c") + (tags . " %i %-12:c") + (search . " %i %-12:c")) + "Format specifications for the prefix of items in the agenda views. + +An alist with one entry per agenda type. The keys of the +sublists are `agenda', `todo', `search' and `tags'. The values +are format strings. + +This format works similar to a printf format, with the following meaning: + + %c the category of the item, \"Diary\" for entries from the diary, + or as given by the CATEGORY keyword or derived from the file name + %e the effort required by the item + %l the level of the item (insert X space(s) if item is of level X) + %i the icon category of the item, see `org-agenda-category-icon-alist' + %T the last tag of the item (ignore inherited tags, which come first) + %t the HH:MM time-of-day specification if one applies to the entry + %s Scheduling/Deadline information, a short string + %b show breadcrumbs, i.e., the names of the higher levels + %(expression) Eval EXPRESSION and replace the control string + by the result + +All specifiers work basically like the standard `%s' of printf, but may +contain two additional characters: a question mark just after the `%' +and a whitespace/punctuation character just before the final letter. + +If the first character after `%' is a question mark, the entire field +will only be included if the corresponding value applies to the current +entry. This is useful for fields which should have fixed width when +present, but zero width when absent. For example, \"%?-12t\" will +result in a 12 character time field if a time of the day is specified, +but will completely disappear in entries which do not contain a time. + +If there is punctuation or whitespace character just before the +final format letter, this character will be appended to the field +value if the value is not empty. For example, the format +\"%-12:c\" leads to \"Diary: \" if the category is \"Diary\". If +the category is empty, no additional colon is inserted. + +The default value for the agenda sublist is \" %-12:c%?-12t% s\", +which means: + +- Indent the line with two space characters +- Give the category a 12 chars wide field, padded with whitespace on + the right (because of `-'). Append a colon if there is a category + (because of `:'). +- If there is a time-of-day, put it into a 12 chars wide field. If no + time, don't put in an empty field, just skip it (because of '?'). +- Finally, put the scheduling information. + +See also the variables `org-agenda-remove-times-when-in-prefix' and +`org-agenda-remove-tags'. + +Custom commands can set this variable in the options section." + :type '(choice + (string :tag "General format") + (list :greedy t :tag "View dependent" + (cons (const agenda) (string :tag "Format")) + (cons (const todo) (string :tag "Format")) + (cons (const tags) (string :tag "Format")) + (cons (const search) (string :tag "Format")))) + :group 'org-agenda-line-format + :version "26.1" + :package-version '(Org . "9.1")) + +(defcustom org-agenda-breadcrumbs-separator "->" + "The separator of breadcrumbs in agenda lines." + :group 'org-agenda-line-format + :package-version '(Org . "9.3") + :type 'string + :safe #'stringp) + +(defvar org-prefix-format-compiled nil + "The compiled prefix format and associated variables. +This is a list where first element is a list of variable bindings, and second +element is the compiled format expression. See the variable +`org-agenda-prefix-format'.") + +(defcustom org-agenda-todo-keyword-format "%-1s" + "Format for the TODO keyword in agenda lines. +Set this to something like \"%-12s\" if you want all TODO keywords +to occupy a fixed space in the agenda display." + :group 'org-agenda-line-format + :type 'string) + +(defcustom org-agenda-diary-sexp-prefix nil + "A regexp that matches part of a diary sexp entry +which should be treated as scheduling/deadline information in +`org-agenda'. + +For example, you can use this to extract the `diary-remind-message' from +`diary-remind' entries." + :group 'org-agenda-line-format + :type '(choice (const :tag "None" nil) (regexp :tag "Regexp"))) + +(defcustom org-agenda-timerange-leaders '("" "(%d/%d): ") + "Text preceding timerange entries in the agenda view. +This is a list with two strings. The first applies when the range +is entirely on one day. The second applies if the range spans several days. +The strings may have two \"%d\" format specifiers which will be filled +with the sequence number of the days, and the total number of days in the +range, respectively." + :group 'org-agenda-line-format + :type '(list + (string :tag "Deadline today ") + (choice :tag "Deadline relative" + (string :tag "Format string") + (function)))) + +(defcustom org-agenda-scheduled-leaders '("Scheduled: " "Sched.%2dx: ") + "Text preceding scheduled items in the agenda view. +This is a list with two strings. The first applies when the item is +scheduled on the current day. The second applies when it has been scheduled +previously, it may contain a %d indicating that this is the nth time that +this item is scheduled, due to automatic rescheduling of unfinished items +for the following day. So this number is one larger than the number of days +that passed since this item was scheduled first." + :group 'org-agenda-line-format + :version "24.4" + :package-version '(Org . "8.0") + :type '(list + (string :tag "Scheduled today ") + (string :tag "Scheduled previously"))) + +(defcustom org-agenda-inactive-leader "[" + "Text preceding item pulled into the agenda by inactive time stamps. +These entries are added to the agenda when pressing \"[\"." + :group 'org-agenda-line-format + :version "24.1" + :type 'string) + +(defcustom org-agenda-deadline-leaders '("Deadline: " "In %3d d.: " "%2d d. ago: ") + "Text preceding deadline items in the agenda view. +This is a list with three strings. The first applies when the item has its +deadline on the current day. The second applies when the deadline is in the +future, the third one when it is in the past. The strings may contain %d +to capture the number of days." + :group 'org-agenda-line-format + :version "24.4" + :package-version '(Org . "8.0") + :type '(list + (string :tag "Deadline today ") + (string :tag "Deadline in the future ") + (string :tag "Deadline in the past "))) + +(defcustom org-agenda-remove-times-when-in-prefix t + "Non-nil means remove duplicate time specifications in agenda items. +When the format `org-agenda-prefix-format' contains a `%t' specifier, a +time-of-day specification in a headline or diary entry is extracted and +placed into the prefix. If this option is non-nil, the original specification +\(a timestamp or -range, or just a plain time(range) specification like +11:30-4pm) will be removed for agenda display. This makes the agenda less +cluttered. +The option can be t or nil. It may also be the symbol `beg', indicating +that the time should only be removed when it is located at the beginning of +the headline/diary entry." + :group 'org-agenda-line-format + :type '(choice + (const :tag "Always" t) + (const :tag "Never" nil) + (const :tag "When at beginning of entry" beg))) + +(defcustom org-agenda-remove-timeranges-from-blocks nil + "Non-nil means remove time ranges specifications in agenda +items that span on several days." + :group 'org-agenda-line-format + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-default-appointment-duration nil + "Default duration for appointments that only have a starting time. +When nil, no duration is specified in such cases. +When non-nil, this must be the number of minutes, e.g. 60 for one hour." + :group 'org-agenda-line-format + :type '(choice + (integer :tag "Minutes") + (const :tag "No default duration"))) + +(defcustom org-agenda-show-inherited-tags t + "Non-nil means show inherited tags in each agenda line. + +When this option is set to `always', it takes precedence over +`org-agenda-use-tag-inheritance' and inherited tags are shown +in every agenda. + +When this option is set to t (the default), inherited tags are +shown when they are available, i.e. when the value of +`org-agenda-use-tag-inheritance' enables tag inheritance for the +given agenda type. + +This can be set to a list of agenda types in which the agenda +must display the inherited tags. Available types are `todo', +`agenda' and `search'. + +When set to nil, never show inherited tags in agenda lines." + :group 'org-agenda-line-format + :group 'org-agenda + :version "24.3" + :type '(choice + (const :tag "Show inherited tags when available" t) + (const :tag "Always show inherited tags" always) + (repeat :tag "Show inherited tags only in selected agenda types" + (symbol :tag "Agenda type")))) + +(defcustom org-agenda-use-tag-inheritance '(todo search agenda) + "List of agenda view types where to use tag inheritance. + +In tags/tags-todo/tags-tree agenda views, tag inheritance is +controlled by `org-use-tag-inheritance'. In other agenda types, +`org-use-tag-inheritance' is not used for the selection of the +agenda entries. Still, you may want the agenda to be aware of +the inherited tags anyway, e.g. for later tag filtering. + +Allowed value are `todo', `search' and `agenda'. + +This variable has no effect if `org-agenda-show-inherited-tags' +is set to `always'. In that case, the agenda is aware of those +tags. + +The default value sets tags in every agenda type. Setting this +option to nil will speed up non-tags agenda view a lot." + :group 'org-agenda + :version "26.1" + :package-version '(Org . "9.1") + :type '(choice + (const :tag "Use tag inheritance in all agenda types" t) + (repeat :tag "Use tag inheritance in selected agenda types" + (symbol :tag "Agenda type")))) + +(defcustom org-agenda-hide-tags-regexp nil + "Regular expression used to filter away specific tags in agenda views. +This means that these tags will be present, but not be shown in the agenda +line. Secondary filtering will still work on the hidden tags. +Nil means don't hide any tags." + :group 'org-agenda-line-format + :type '(choice + (const :tag "Hide none" nil) + (regexp :tag "Regexp "))) + +(defvaralias 'org-agenda-remove-tags-when-in-prefix + 'org-agenda-remove-tags) + +(defcustom org-agenda-remove-tags nil + "Non-nil means remove the tags from the headline copy in the agenda. +When this is the symbol `prefix', only remove tags when +`org-agenda-prefix-format' contains a `%T' specifier." + :group 'org-agenda-line-format + :type '(choice + (const :tag "Always" t) + (const :tag "Never" nil) + (const :tag "When prefix format contains %T" prefix))) + +(defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column) + +(defcustom org-agenda-tags-column 'auto + "Shift tags in agenda items to this column. +If set to `auto', tags will be automatically aligned to the right +edge of the window. + +If set to a positive number, tags will be left-aligned to that +column. If set to a negative number, tags will be right-aligned +to that column. For example, -80 works well for a normal 80 +character screen." + :group 'org-agenda-line-format + :type '(choice + (const :tag "Automatically align to right edge of window" auto) + (integer :tag "Specific column" -80)) + :package-version '(Org . "9.1") + :version "26.1") + +(defcustom org-agenda-fontify-priorities 'cookies + "Non-nil means highlight low and high priorities in agenda. +When t, the highest priority entries are bold, lowest priority italic. +However, settings in `org-priority-faces' will overrule these faces. +When this variable is the symbol `cookies', only fontify the +cookies, not the entire task. +This may also be an association list of priority faces, whose +keys are the character values of `org-priority-highest', +`org-priority-default', and `org-priority-lowest' (the default values +are ?A, ?B, and ?C, respectively). The face may be a named face, a +color as a string, or a list like `(:background \"Red\")'. +If it is a color, the variable `org-faces-easy-properties' +determines if it is a foreground or a background color." + :group 'org-agenda-line-format + :type '(choice + (const :tag "Never" nil) + (const :tag "Defaults" t) + (const :tag "Cookies only" cookies) + (repeat :tag "Specify" + (list (character :tag "Priority" :value ?A) + (choice :tag "Face " + (string :tag "Color") + (sexp :tag "Face")))))) + +(defcustom org-agenda-day-face-function nil + "Function called to determine what face should be used to display a day. +The only argument passed to that function is the day. It should +returns a face, or nil if does not want to specify a face and let +the normal rules apply." + :group 'org-agenda-line-format + :version "24.1" + :type '(choice (const nil) (function))) + +(defcustom org-agenda-category-icon-alist nil + "Alist of category icon to be displayed in agenda views. + +Each entry should have the following format: + + (CATEGORY-REGEXP FILE-OR-DATA TYPE DATA-P PROPS) + +Where CATEGORY-REGEXP is a regexp matching the categories where +the icon should be displayed. +FILE-OR-DATA either a file path or a string containing image data. + +The other fields can be omitted safely if not needed: +TYPE indicates the image type. +DATA-P is a boolean indicating whether the FILE-OR-DATA string is +image data. +PROPS are additional image attributes to assign to the image, +like, e.g. `:ascent center'. + + (\"Org\" \"/path/to/icon.png\" nil nil :ascent center) + +If you want to set the display properties yourself, just put a +list as second element: + + (CATEGORY-REGEXP (MY PROPERTY LIST)) + +For example, to display a 16px horizontal space for Emacs +category, you can use: + + (\"Emacs\" \\='(space . (:width (16))))" + :group 'org-agenda-line-format + :version "24.1" + :type '(alist :key-type (regexp :tag "Regexp matching category") + :value-type (choice (list :tag "Icon" + (string :tag "File or data") + (symbol :tag "Type") + (boolean :tag "Data?") + (repeat :tag "Extra image properties" :inline t sexp)) + (list :tag "Display properties" sexp)))) + +(defgroup org-agenda-column-view nil + "Options concerning column view in the agenda." + :tag "Org Agenda Column View" + :group 'org-agenda) + +(defcustom org-agenda-view-columns-initially nil + "When non-nil, switch to columns view right after creating the agenda." + :group 'org-agenda-column-view + :type 'boolean + :version "26.1" + :package-version '(Org . "9.0") + :safe #'booleanp) + +(defcustom org-agenda-columns-show-summaries t + "Non-nil means show summaries for columns displayed in the agenda view." + :group 'org-agenda-column-view + :type 'boolean) + +(defcustom org-agenda-columns-compute-summary-properties t + "Non-nil means recompute all summary properties before column view. +When column view in the agenda is listing properties that have a summary +operator, it can go to all relevant buffers and recompute the summaries +there. This can mean overhead for the agenda column view, but is necessary +to have thing up to date. +As a special case, a CLOCKSUM property also makes sure that the clock +computations are current." + :group 'org-agenda-column-view + :type 'boolean) + +(defcustom org-agenda-columns-add-appointments-to-effort-sum nil + "Non-nil means the duration of an appointment will add to day effort. +The property to which appointment durations will be added is the one given +in the option `org-effort-property'. If an appointment does not have +an end time, `org-agenda-default-appointment-duration' will be used. If that +is not set, an appointment without end time will not contribute to the time +estimate." + :group 'org-agenda-column-view + :type 'boolean) + +(defcustom org-agenda-auto-exclude-function nil + "A function called with a tag to decide if it is filtered on \ +\\`\\[org-agenda-filter-by-tag] RET'. +The sole argument to the function, which is called once for each +possible tag, is a string giving the name of the tag. The +function should return either nil if the tag should be included +as normal, \"-\" to exclude the tag, or \"+\" to exclude +lines not carrying this tag. +Note that for the purpose of tag filtering, only the lower-case version of +all tags will be considered, so that this function will only ever see +the lower-case version of all tags." + :group 'org-agenda + :type '(choice (const nil) (function))) + +(defcustom org-agenda-bulk-custom-functions nil + "Alist of characters and custom functions for bulk actions. +For example, this value makes those two functions available: + + \\='((?R set-category) + (?C bulk-cut)) + +With selected entries in an agenda buffer, `B R' will call +the custom function `set-category' on the selected entries. +Note that functions in this alist don't need to be quoted. + +You can also specify a function which collects arguments to be +used for each call to your bulk custom function. The argument +collecting function will be run once and should return a list of +arguments to pass to the bulk function. For example: + + \\='((?R set-category get-category)) + +Now, `B R' will call the custom `get-category' which would prompt +the user once for a category. That category is then passed as an +argument to `set-category' for each entry it's called against." + :type + '(alist :key-type character + :value-type + (group (function :tag "Bulk Custom Function") + (choice (function :tag "Bulk Custom Argument Function") + (const :tag "No Bulk Custom Argument Function" nil)))) + :package-version '(Org . "9.5") + :group 'org-agenda) + +(defmacro org-agenda-with-point-at-orig-entry (string &rest body) + "Execute BODY with point at location given by `org-hd-marker' property. +If STRING is non-nil, the text property will be fetched from position 0 +in that string. If STRING is nil, it will be fetched from the beginning +of the current line." + (declare (debug t)) + (org-with-gensyms (marker) + `(let ((,marker (get-text-property (if ,string 0 (point-at-bol)) + 'org-hd-marker ,string))) + (with-current-buffer (marker-buffer ,marker) + (save-excursion + (goto-char ,marker) + ,@body))))) + +(defun org-add-agenda-custom-command (entry) + "Replace or add a command in `org-agenda-custom-commands'. +This is mostly for hacking and trying a new command - once the command +works you probably want to add it to `org-agenda-custom-commands' for good." + (let ((ass (assoc (car entry) org-agenda-custom-commands))) + (if ass + (setcdr ass (cdr entry)) + (push entry org-agenda-custom-commands)))) + +(defmacro org-agenda--insert-overriding-header (default) + "Insert header into agenda view. +The inserted header depends on `org-agenda-overriding-header'. +If the empty string, don't insert a header. If any other string, +insert it as a header. If nil, insert DEFAULT, which should +evaluate to a string. If a function, call it and insert the +string that it returns." + (declare (debug (form)) (indent defun)) + `(cond + ((not org-agenda-overriding-header) (insert ,default)) + ((equal org-agenda-overriding-header "") nil) + ((stringp org-agenda-overriding-header) + (insert (propertize org-agenda-overriding-header + 'face 'org-agenda-structure) + "\n")) + ((functionp org-agenda-overriding-header) + (insert (funcall org-agenda-overriding-header))) + (t (user-error "Invalid value for `org-agenda-overriding-header': %S" + org-agenda-overriding-header)))) + +;;; Define the org-agenda-mode + +(defvaralias 'org-agenda-keymap 'org-agenda-mode-map) +(defvar org-agenda-mode-map (make-sparse-keymap) + "Keymap for `org-agenda-mode'.") + +(org-remap org-agenda-mode-map 'move-end-of-line 'org-agenda-end-of-line) + +(defvar org-agenda-menu) ; defined later in this file. +(defvar org-agenda-restrict nil) ; defined later in this file. +(defvar org-agenda-follow-mode nil) +(defvar org-agenda-entry-text-mode nil) +(defvar org-agenda-clockreport-mode nil) +(defvar org-agenda-show-log nil + "When non-nil, show the log in the agenda. +Do not set this directly; instead use +`org-agenda-start-with-log-mode', which see.") +(defvar org-agenda-redo-command nil) +(defvar org-agenda-query-string nil) +(defvar org-agenda-mode-hook nil + "Hook run after `org-agenda-mode' is turned on. +The buffer is still writable when this hook is called.") +(defvar org-agenda-type nil) +(defvar org-agenda-force-single-file nil) +(defvar org-agenda-bulk-marked-entries nil + "List of markers that refer to marked entries in the agenda.") +(defvar org-agenda-current-date nil + "Active date when building the agenda.") + +;;; Multiple agenda buffers support + +(defcustom org-agenda-sticky nil + "Non-nil means agenda q key will bury agenda buffers. +Agenda commands will then show existing buffer instead of generating new ones. +When nil, `q' will kill the single agenda buffer." + :group 'org-agenda + :version "24.3" + :type 'boolean) + + +;;;###autoload +(defun org-toggle-sticky-agenda (&optional arg) + "Toggle `org-agenda-sticky'." + (interactive "P") + (let ((new-value (if arg + (> (prefix-numeric-value arg) 0) + (not org-agenda-sticky)))) + (if (equal new-value org-agenda-sticky) + (and (called-interactively-p 'interactive) + (message "Sticky agenda was already %s" + (if org-agenda-sticky "enabled" "disabled"))) + (setq org-agenda-sticky new-value) + (org-agenda-kill-all-agenda-buffers) + (and (called-interactively-p 'interactive) + (message "Sticky agenda %s" + (if org-agenda-sticky "enabled" "disabled")))))) + +(defvar org-agenda-buffer nil + "Agenda buffer currently being generated.") + +(defvar org-agenda-last-prefix-arg nil) +(defvar org-agenda-this-buffer-name nil) +(defvar org-agenda-doing-sticky-redo nil) +(defvar org-agenda-this-buffer-is-sticky nil) +(defvar org-agenda-last-indirect-buffer nil + "Last buffer loaded by `org-agenda-tree-to-indirect-buffer'.") + +(defconst org-agenda-local-vars + '(org-agenda-this-buffer-name + org-agenda-undo-list + org-agenda-pending-undo-list + org-agenda-follow-mode + org-agenda-entry-text-mode + org-agenda-clockreport-mode + org-agenda-show-log + org-agenda-redo-command + org-agenda-query-string + org-agenda-type + org-agenda-bulk-marked-entries + org-agenda-undo-has-started-in + org-agenda-info + org-agenda-pre-window-conf + org-agenda-columns-active + org-agenda-tag-filter + org-agenda-category-filter + org-agenda-top-headline-filter + org-agenda-regexp-filter + org-agenda-effort-filter + org-agenda-markers + org-agenda-last-search-view-search-was-boolean + org-agenda-last-indirect-buffer + org-agenda-filtered-by-category + org-agenda-filter-form + org-agenda-cycle-counter + org-agenda-last-prefix-arg) + "Variables that must be local in agenda buffers to allow multiple buffers.") + +(defun org-agenda-mode () + "Mode for time-sorted view on action items in Org files. + +The following commands are available: + +\\{org-agenda-mode-map}" + (interactive) + (ignore-errors (require 'face-remap)) + (let ((agenda-local-vars-to-keep + '(text-scale-mode-amount + text-scale-mode + text-scale-mode-lighter + face-remapping-alist)) + (save (buffer-local-variables))) + (kill-all-local-variables) + (cl-flet ((reset-saved (var-set) + "Reset variables in VAR-SET to possibly stored value in SAVE." + (dolist (elem save) + (pcase elem + (`(,var . ,val) ;ignore unbound variables + (when (and val (memq var var-set)) + (set var val))))))) + (cond (org-agenda-doing-sticky-redo + ;; Refreshing sticky agenda-buffer + ;; + ;; Preserve the value of `org-agenda-local-vars' variables. + (mapc #'make-local-variable org-agenda-local-vars) + (reset-saved org-agenda-local-vars) + (setq-local org-agenda-this-buffer-is-sticky t)) + (org-agenda-sticky + ;; Creating a sticky Agenda buffer for the first time + (mapc #'make-local-variable org-agenda-local-vars) + (setq-local org-agenda-this-buffer-is-sticky t)) + (t + ;; Creating a non-sticky agenda buffer + (setq-local org-agenda-this-buffer-is-sticky nil))) + (mapc #'make-local-variable agenda-local-vars-to-keep) + (reset-saved agenda-local-vars-to-keep))) + (setq org-agenda-undo-list nil + org-agenda-pending-undo-list nil + org-agenda-bulk-marked-entries nil) + (setq major-mode 'org-agenda-mode) + ;; Keep global-font-lock-mode from turning on font-lock-mode + (setq-local font-lock-global-modes (list 'not major-mode)) + (setq mode-name "Org-Agenda") + (setq indent-tabs-mode nil) + (use-local-map org-agenda-mode-map) + (when org-startup-truncated (setq truncate-lines t)) + (setq-local line-move-visual nil) + (add-hook 'post-command-hook #'org-agenda-update-agenda-type nil 'local) + (add-hook 'pre-command-hook #'org-unhighlight nil 'local) + ;; Make sure properties are removed when copying text + (if (boundp 'filter-buffer-substring-functions) + (add-hook 'filter-buffer-substring-functions + (lambda (fun start end delete) + (substring-no-properties (funcall fun start end delete))) + nil t) + ;; Emacs >= 24.4. + (add-function :filter-return (local 'filter-buffer-substring-function) + #'substring-no-properties)) + (unless org-agenda-keep-modes + (setq org-agenda-follow-mode org-agenda-start-with-follow-mode + org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode + org-agenda-show-log org-agenda-start-with-log-mode + org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode)) + (add-to-invisibility-spec '(org-filtered)) + (add-to-invisibility-spec '(org-link)) + (easy-menu-change + '("Agenda") "Agenda Files" + (append + (list + (vector + (if (get 'org-agenda-files 'org-restrict) + "Restricted to single file" + "Edit File List") + '(org-edit-agenda-file-list) + (not (get 'org-agenda-files 'org-restrict))) + "--") + (mapcar #'org-file-menu-entry (org-agenda-files)))) + (org-agenda-set-mode-name) + (run-mode-hooks 'org-agenda-mode-hook)) + +(substitute-key-definition #'undo #'org-agenda-undo + org-agenda-mode-map global-map) +(org-defkey org-agenda-mode-map "\C-i" #'org-agenda-goto) +(org-defkey org-agenda-mode-map [(tab)] #'org-agenda-goto) +(org-defkey org-agenda-mode-map "\C-m" #'org-agenda-switch-to) +(org-defkey org-agenda-mode-map "\C-k" #'org-agenda-kill) +(org-defkey org-agenda-mode-map "\C-c\C-w" #'org-agenda-refile) +(org-defkey org-agenda-mode-map [(meta down)] #'org-agenda-drag-line-forward) +(org-defkey org-agenda-mode-map [(meta up)] #'org-agenda-drag-line-backward) +(org-defkey org-agenda-mode-map "m" #'org-agenda-bulk-mark) +(org-defkey org-agenda-mode-map "\M-m" #'org-agenda-bulk-toggle) +(org-defkey org-agenda-mode-map "*" #'org-agenda-bulk-mark-all) +(org-defkey org-agenda-mode-map "\M-*" #'org-agenda-bulk-toggle-all) +(org-defkey org-agenda-mode-map "#" #'org-agenda-dim-blocked-tasks) +(org-defkey org-agenda-mode-map "%" #'org-agenda-bulk-mark-regexp) +(org-defkey org-agenda-mode-map "u" #'org-agenda-bulk-unmark) +(org-defkey org-agenda-mode-map "U" #'org-agenda-bulk-unmark-all) +(org-defkey org-agenda-mode-map "B" #'org-agenda-bulk-action) +(org-defkey org-agenda-mode-map "k" #'org-agenda-capture) +(org-defkey org-agenda-mode-map "A" #'org-agenda-append-agenda) +(org-defkey org-agenda-mode-map "\C-c\C-x!" #'org-reload) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-a" #'org-agenda-archive-default) +(org-defkey org-agenda-mode-map "\C-c\C-xa" #'org-agenda-toggle-archive-tag) +(org-defkey org-agenda-mode-map "\C-c\C-xA" #'org-agenda-archive-to-archive-sibling) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-s" #'org-agenda-archive) +(org-defkey org-agenda-mode-map "\C-c$" #'org-agenda-archive) +(org-defkey org-agenda-mode-map "$" #'org-agenda-archive) +(org-defkey org-agenda-mode-map "\C-c\C-o" #'org-agenda-open-link) +(org-defkey org-agenda-mode-map " " #'org-agenda-show-and-scroll-up) +(org-defkey org-agenda-mode-map [backspace] #'org-agenda-show-scroll-down) +(org-defkey org-agenda-mode-map "\d" #'org-agenda-show-scroll-down) +(org-defkey org-agenda-mode-map [(control shift right)] #'org-agenda-todo-nextset) +(org-defkey org-agenda-mode-map [(control shift left)] #'org-agenda-todo-previousset) +(org-defkey org-agenda-mode-map "\C-c\C-xb" #'org-agenda-tree-to-indirect-buffer) +(org-defkey org-agenda-mode-map "o" #'delete-other-windows) +(org-defkey org-agenda-mode-map "L" #'org-agenda-recenter) +(org-defkey org-agenda-mode-map "\C-c\C-t" #'org-agenda-todo) +(org-defkey org-agenda-mode-map "t" #'org-agenda-todo) +(org-defkey org-agenda-mode-map "a" #'org-agenda-archive-default-with-confirmation) +(org-defkey org-agenda-mode-map ":" #'org-agenda-set-tags) +(org-defkey org-agenda-mode-map "\C-c\C-q" #'org-agenda-set-tags) +(org-defkey org-agenda-mode-map "." #'org-agenda-goto-today) +(org-defkey org-agenda-mode-map "j" #'org-agenda-goto-date) +(org-defkey org-agenda-mode-map "d" #'org-agenda-day-view) +(org-defkey org-agenda-mode-map "w" #'org-agenda-week-view) +(org-defkey org-agenda-mode-map "y" #'org-agenda-year-view) +(org-defkey org-agenda-mode-map "\C-c\C-z" #'org-agenda-add-note) +(org-defkey org-agenda-mode-map "z" #'org-agenda-add-note) +(org-defkey org-agenda-mode-map [(shift right)] #'org-agenda-do-date-later) +(org-defkey org-agenda-mode-map [(shift left)] #'org-agenda-do-date-earlier) +(org-defkey org-agenda-mode-map [?\C-c ?\C-x (right)] #'org-agenda-do-date-later) +(org-defkey org-agenda-mode-map [?\C-c ?\C-x (left)] #'org-agenda-do-date-earlier) +(org-defkey org-agenda-mode-map ">" #'org-agenda-date-prompt) +(org-defkey org-agenda-mode-map "\C-c\C-s" #'org-agenda-schedule) +(org-defkey org-agenda-mode-map "\C-c\C-d" #'org-agenda-deadline) +(let ((l '(1 2 3 4 5 6 7 8 9 0))) + (while l (org-defkey org-agenda-mode-map + (number-to-string (pop l)) #'digit-argument))) +(org-defkey org-agenda-mode-map "F" #'org-agenda-follow-mode) +(org-defkey org-agenda-mode-map "R" #'org-agenda-clockreport-mode) +(org-defkey org-agenda-mode-map "E" #'org-agenda-entry-text-mode) +(org-defkey org-agenda-mode-map "l" #'org-agenda-log-mode) +(org-defkey org-agenda-mode-map "v" #'org-agenda-view-mode-dispatch) +(org-defkey org-agenda-mode-map "D" #'org-agenda-toggle-diary) +(org-defkey org-agenda-mode-map "!" #'org-agenda-toggle-deadlines) +(org-defkey org-agenda-mode-map "G" #'org-agenda-toggle-time-grid) +(org-defkey org-agenda-mode-map "r" #'org-agenda-redo) +(org-defkey org-agenda-mode-map "g" #'org-agenda-redo-all) +(org-defkey org-agenda-mode-map "e" #'org-agenda-set-effort) +(org-defkey org-agenda-mode-map "\C-c\C-xe" #'org-agenda-set-effort) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-e" + #'org-clock-modify-effort-estimate) +(org-defkey org-agenda-mode-map "\C-c\C-xp" #'org-agenda-set-property) +(org-defkey org-agenda-mode-map "q" #'org-agenda-quit) +(org-defkey org-agenda-mode-map "Q" #'org-agenda-Quit) +(org-defkey org-agenda-mode-map "x" #'org-agenda-exit) +(org-defkey org-agenda-mode-map "\C-x\C-w" #'org-agenda-write) +(org-defkey org-agenda-mode-map "\C-x\C-s" #'org-save-all-org-buffers) +(org-defkey org-agenda-mode-map "s" #'org-save-all-org-buffers) +(org-defkey org-agenda-mode-map "T" #'org-agenda-show-tags) +(org-defkey org-agenda-mode-map "n" #'org-agenda-next-line) +(org-defkey org-agenda-mode-map "p" #'org-agenda-previous-line) +(org-defkey org-agenda-mode-map "N" #'org-agenda-next-item) +(org-defkey org-agenda-mode-map "P" #'org-agenda-previous-item) +(substitute-key-definition #'next-line #'org-agenda-next-line + org-agenda-mode-map global-map) +(substitute-key-definition #'previous-line #'org-agenda-previous-line + org-agenda-mode-map global-map) +(org-defkey org-agenda-mode-map "\C-c\C-a" #'org-attach) +(org-defkey org-agenda-mode-map "\C-c\C-n" #'org-agenda-next-date-line) +(org-defkey org-agenda-mode-map "\C-c\C-p" #'org-agenda-previous-date-line) +(org-defkey org-agenda-mode-map "\C-c," #'org-agenda-priority) +(org-defkey org-agenda-mode-map "," #'org-agenda-priority) +(org-defkey org-agenda-mode-map "i" #'org-agenda-diary-entry) +(org-defkey org-agenda-mode-map "c" #'org-agenda-goto-calendar) +(org-defkey org-agenda-mode-map "C" #'org-agenda-convert-date) +(org-defkey org-agenda-mode-map "M" #'org-agenda-phases-of-moon) +(org-defkey org-agenda-mode-map "S" #'org-agenda-sunrise-sunset) +(org-defkey org-agenda-mode-map "h" #'org-agenda-holidays) +(org-defkey org-agenda-mode-map "H" #'org-agenda-holidays) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-i" #'org-agenda-clock-in) +(org-defkey org-agenda-mode-map "I" #'org-agenda-clock-in) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-o" #'org-agenda-clock-out) +(org-defkey org-agenda-mode-map "O" #'org-agenda-clock-out) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-x" #'org-agenda-clock-cancel) +(org-defkey org-agenda-mode-map "X" #'org-agenda-clock-cancel) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-j" #'org-clock-goto) +(org-defkey org-agenda-mode-map "J" #'org-agenda-clock-goto) +(org-defkey org-agenda-mode-map "+" #'org-agenda-priority-up) +(org-defkey org-agenda-mode-map "-" #'org-agenda-priority-down) +(org-defkey org-agenda-mode-map [(shift up)] #'org-agenda-priority-up) +(org-defkey org-agenda-mode-map [(shift down)] #'org-agenda-priority-down) +(org-defkey org-agenda-mode-map [?\C-c ?\C-x (up)] #'org-agenda-priority-up) +(org-defkey org-agenda-mode-map [?\C-c ?\C-x (down)] #'org-agenda-priority-down) +(org-defkey org-agenda-mode-map "f" #'org-agenda-later) +(org-defkey org-agenda-mode-map "b" #'org-agenda-earlier) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-c" #'org-agenda-columns) +(org-defkey org-agenda-mode-map "\C-c\C-x>" #'org-agenda-remove-restriction-lock) +(org-defkey org-agenda-mode-map "\C-c\C-x<" #'org-agenda-set-restriction-lock-from-agenda) +(org-defkey org-agenda-mode-map "[" #'org-agenda-manipulate-query-add) +(org-defkey org-agenda-mode-map "]" #'org-agenda-manipulate-query-subtract) +(org-defkey org-agenda-mode-map "{" #'org-agenda-manipulate-query-add-re) +(org-defkey org-agenda-mode-map "}" #'org-agenda-manipulate-query-subtract-re) +(org-defkey org-agenda-mode-map "\\" #'org-agenda-filter-by-tag) +(org-defkey org-agenda-mode-map "_" #'org-agenda-filter-by-effort) +(org-defkey org-agenda-mode-map "=" #'org-agenda-filter-by-regexp) +(org-defkey org-agenda-mode-map "/" #'org-agenda-filter) +(org-defkey org-agenda-mode-map "|" #'org-agenda-filter-remove-all) +(org-defkey org-agenda-mode-map "~" #'org-agenda-limit-interactively) +(org-defkey org-agenda-mode-map "<" #'org-agenda-filter-by-category) +(org-defkey org-agenda-mode-map "^" #'org-agenda-filter-by-top-headline) +(org-defkey org-agenda-mode-map ";" #'org-timer-set-timer) +(org-defkey org-agenda-mode-map "\C-c\C-x_" #'org-timer-stop) +(org-defkey org-agenda-mode-map "?" #'org-agenda-show-the-flagging-note) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-mg" #'org-mobile-pull) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-mp" #'org-mobile-push) +(org-defkey org-agenda-mode-map "\C-c\C-xI" #'org-info-find-node) +(org-defkey org-agenda-mode-map [mouse-2] #'org-agenda-goto-mouse) +(org-defkey org-agenda-mode-map [mouse-3] #'org-agenda-show-mouse) +(org-defkey org-agenda-mode-map [remap forward-paragraph] #'org-agenda-forward-block) +(org-defkey org-agenda-mode-map [remap backward-paragraph] #'org-agenda-backward-block) +(org-defkey org-agenda-mode-map "\C-c\C-c" #'org-agenda-ctrl-c-ctrl-c) + +(when org-agenda-mouse-1-follows-link + (org-defkey org-agenda-mode-map [follow-link] 'mouse-face)) + +(easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu." + '("Agenda" + ("Agenda Files") + "--" + ("Agenda Dates" + ["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda)] + ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)] + ["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)] + ["Jump to date" org-agenda-goto-date (org-agenda-check-type nil 'agenda)]) + "--" + ("View" + ["Day View" org-agenda-day-view + :active (org-agenda-check-type nil 'agenda) + :style radio :selected (eq org-agenda-current-span 'day) + :keys "v d (or just d)"] + ["Week View" org-agenda-week-view + :active (org-agenda-check-type nil 'agenda) + :style radio :selected (eq org-agenda-current-span 'week) + :keys "v w"] + ["Fortnight View" org-agenda-fortnight-view + :active (org-agenda-check-type nil 'agenda) + :style radio :selected (eq org-agenda-current-span 'fortnight) + :keys "v t"] + ["Month View" org-agenda-month-view + :active (org-agenda-check-type nil 'agenda) + :style radio :selected (eq org-agenda-current-span 'month) + :keys "v m"] + ["Year View" org-agenda-year-view + :active (org-agenda-check-type nil 'agenda) + :style radio :selected (eq org-agenda-current-span 'year) + :keys "v y"] + "--" + ["Include Diary" org-agenda-toggle-diary + :style toggle :selected org-agenda-include-diary + :active (org-agenda-check-type nil 'agenda)] + ["Include Deadlines" org-agenda-toggle-deadlines + :style toggle :selected org-agenda-include-deadlines + :active (org-agenda-check-type nil 'agenda)] + ["Use Time Grid" org-agenda-toggle-time-grid + :style toggle :selected org-agenda-use-time-grid + :active (org-agenda-check-type nil 'agenda)] + "--" + ["Show clock report" org-agenda-clockreport-mode + :style toggle :selected org-agenda-clockreport-mode + :active (org-agenda-check-type nil 'agenda)] + ["Show some entry text" org-agenda-entry-text-mode + :style toggle :selected org-agenda-entry-text-mode + :active t] + "--" + ["Show Logbook entries" org-agenda-log-mode + :style toggle :selected org-agenda-show-log + :active (org-agenda-check-type nil 'agenda) + :keys "v l (or just l)"] + ["Include archived trees" org-agenda-archives-mode + :style toggle :selected org-agenda-archives-mode :active t + :keys "v a"] + ["Include archive files" (org-agenda-archives-mode t) + :style toggle :selected (eq org-agenda-archives-mode t) :active t + :keys "v A"] + "--" + ["Remove Restriction" org-agenda-remove-restriction-lock org-agenda-restrict]) + ("Filter current view" + ["with generic interface" org-agenda-filter t] + "--" + ["by category at cursor" org-agenda-filter-by-category t] + ["by tag" org-agenda-filter-by-tag t] + ["by effort" org-agenda-filter-by-effort t] + ["by regexp" org-agenda-filter-by-regexp t] + ["by top-level headline" org-agenda-filter-by-top-headline t] + "--" + ["Remove all filtering" org-agenda-filter-remove-all t] + "--" + ["limit" org-agenda-limit-interactively t]) + ["Rebuild buffer" org-agenda-redo t] + ["Write view to file" org-agenda-write t] + ["Save all Org buffers" org-save-all-org-buffers t] + "--" + ["Show original entry" org-agenda-show t] + ["Go To (other window)" org-agenda-goto t] + ["Go To (this window)" org-agenda-switch-to t] + ["Capture with cursor date" org-agenda-capture t] + ["Follow Mode" org-agenda-follow-mode + :style toggle :selected org-agenda-follow-mode :active t] + ;; ["Tree to indirect frame" org-agenda-tree-to-indirect-buffer t] + "--" + ("TODO" + ["Cycle TODO" org-agenda-todo t] + ["Next TODO set" org-agenda-todo-nextset t] + ["Previous TODO set" org-agenda-todo-previousset t] + ["Add note" org-agenda-add-note t]) + ("Archive/Refile/Delete" + ["Archive default" org-agenda-archive-default t] + ["Archive default" org-agenda-archive-default-with-confirmation t] + ["Toggle ARCHIVE tag" org-agenda-toggle-archive-tag t] + ["Move to archive sibling" org-agenda-archive-to-archive-sibling t] + ["Archive subtree" org-agenda-archive t] + "--" + ["Refile" org-agenda-refile t] + "--" + ["Delete subtree" org-agenda-kill t]) + ("Bulk action" + ["Mark entry" org-agenda-bulk-mark t] + ["Mark all" org-agenda-bulk-mark-all t] + ["Unmark entry" org-agenda-bulk-unmark t] + ["Unmark all" org-agenda-bulk-unmark-all :active t :keys "U"] + ["Toggle mark" org-agenda-bulk-toggle t] + ["Toggle all" org-agenda-bulk-toggle-all t] + ["Mark regexp" org-agenda-bulk-mark-regexp t]) + ["Act on all marked" org-agenda-bulk-action t] + "--" + ("Tags and Properties" + ["Show all Tags" org-agenda-show-tags t] + ["Set Tags current line" org-agenda-set-tags (not (org-region-active-p))] + ["Change tag in region" org-agenda-set-tags (org-region-active-p)] + "--" + ["Column View" org-columns t]) + ("Deadline/Schedule" + ["Schedule" org-agenda-schedule t] + ["Set Deadline" org-agenda-deadline t] + "--" + ["Change Date +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda)] + ["Change Date -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda)] + ["Change Time +1 hour" org-agenda-do-date-later :active (org-agenda-check-type nil 'agenda) :keys "C-u S-right"] + ["Change Time -1 hour" org-agenda-do-date-earlier :active (org-agenda-check-type nil 'agenda) :keys "C-u S-left"] + ["Change Time + min" org-agenda-date-later :active (org-agenda-check-type nil 'agenda) :keys "C-u C-u S-right"] + ["Change Time - min" org-agenda-date-earlier :active (org-agenda-check-type nil 'agenda) :keys "C-u C-u S-left"] + ["Change Date to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda)]) + ("Clock and Effort" + ["Clock in" org-agenda-clock-in t] + ["Clock out" org-agenda-clock-out t] + ["Clock cancel" org-agenda-clock-cancel t] + ["Goto running clock" org-clock-goto t] + "--" + ["Set Effort" org-agenda-set-effort t] + ["Change clocked effort" org-clock-modify-effort-estimate + (org-clock-is-active)]) + ("Priority" + ["Set Priority" org-agenda-priority t] + ["Increase Priority" org-agenda-priority-up t] + ["Decrease Priority" org-agenda-priority-down t] + ["Show Priority" org-priority-show t]) + ("Calendar/Diary" + ["New Diary Entry" org-agenda-diary-entry (org-agenda-check-type nil 'agenda)] + ["Goto Calendar" org-agenda-goto-calendar (org-agenda-check-type nil 'agenda)] + ["Phases of the Moon" org-agenda-phases-of-moon (org-agenda-check-type nil 'agenda)] + ["Sunrise/Sunset" org-agenda-sunrise-sunset (org-agenda-check-type nil 'agenda)] + ["Holidays" org-agenda-holidays (org-agenda-check-type nil 'agenda)] + ["Convert" org-agenda-convert-date (org-agenda-check-type nil 'agenda)] + "--" + ["Create iCalendar File" org-icalendar-combine-agenda-files t]) + "--" + ["Undo Remote Editing" org-agenda-undo org-agenda-undo-list] + "--" + ("MobileOrg" + ["Push Files and Views" org-mobile-push t] + ["Get Captured and Flagged" org-mobile-pull t] + ["Find FLAGGED Tasks" (org-agenda nil "?") :active t :keys "\\[org-agenda] ?"] + ["Show note / unflag" org-agenda-show-the-flagging-note t] + "--" + ["Setup" (progn (require 'org-mobile) (customize-group 'org-mobile)) t]) + "--" + ["Quit" org-agenda-quit t] + ["Exit and Release Buffers" org-agenda-exit t] + )) + +;;; Agenda undo + +(defvar org-agenda-allow-remote-undo t + "Non-nil means allow remote undo from the agenda buffer.") +(defvar org-agenda-undo-has-started-in nil + "Buffers that have already seen `undo-start' in the current undo sequence.") + +(defun org-agenda-undo () + "Undo a remote editing step in the agenda. +This undoes changes both in the agenda buffer and in the remote buffer +that have been changed along." + (interactive) + (or org-agenda-allow-remote-undo + (user-error "Check the variable `org-agenda-allow-remote-undo' to activate remote undo")) + (when (not (eq this-command last-command)) + (setq org-agenda-undo-has-started-in nil + org-agenda-pending-undo-list org-agenda-undo-list)) + (when (not org-agenda-pending-undo-list) + (user-error "No further undo information")) + (let* ((entry (pop org-agenda-pending-undo-list)) + buf line cmd rembuf) + (setq cmd (pop entry) line (pop entry)) + (setq rembuf (nth 2 entry)) + (org-with-remote-undo rembuf + (while (bufferp (setq buf (pop entry))) + (when (pop entry) + (with-current-buffer buf + (let (;; (last-undo-buffer buf) + (inhibit-read-only t)) + (unless (memq buf org-agenda-undo-has-started-in) + (push buf org-agenda-undo-has-started-in) + (make-local-variable 'pending-undo-list) + (undo-start)) + (while (and pending-undo-list + (listp pending-undo-list) + (not (car pending-undo-list))) + (pop pending-undo-list)) + (undo-more 1)))))) + (org-goto-line line) + (message "`%s' undone (buffer %s)" cmd (buffer-name rembuf)))) + +(defun org-verify-change-for-undo (l1 l2) + "Verify that a real change occurred between the undo lists L1 and L2." + (while (and l1 (listp l1) (null (car l1))) (pop l1)) + (while (and l2 (listp l2) (null (car l2))) (pop l2)) + (not (eq l1 l2))) + +;;; Agenda dispatch + +(defvar org-agenda-restrict-begin (make-marker)) +(defvar org-agenda-restrict-end (make-marker)) +(defvar org-agenda-last-dispatch-buffer nil) +(defvar org-agenda-overriding-restriction nil) + +(defcustom org-agenda-custom-commands-contexts nil + "Alist of custom agenda keys and contextual rules. + +For example, if you have a custom agenda command \"p\" and you +want this command to be accessible only from plain text files, +use this: + + \\='((\"p\" ((in-file . \"\\\\.txt\\\\'\")))) + +Here are the available contexts definitions: + + in-file: command displayed only in matching files + in-mode: command displayed only in matching modes + not-in-file: command not displayed in matching files + not-in-mode: command not displayed in matching modes + in-buffer: command displayed only in matching buffers +not-in-buffer: command not displayed in matching buffers + [function]: a custom function taking no argument + +If you define several checks, the agenda command will be +accessible if there is at least one valid check. + +You can also bind a key to another agenda custom command +depending on contextual rules. + + \\='((\"p\" \"q\" ((in-file . \"\\\\.txt\\\\'\")))) + +Here it means: in .txt files, use \"p\" as the key for the +agenda command otherwise associated with \"q\". (The command +originally associated with \"q\" is not displayed to avoid +duplicates.)" + :version "24.3" + :group 'org-agenda-custom-commands + :type '(repeat (list :tag "Rule" + (string :tag " Agenda key") + (string :tag "Replace by command") + (repeat :tag "Available when" + (choice + (cons :tag "Condition" + (choice + (const :tag "In file" in-file) + (const :tag "Not in file" not-in-file) + (const :tag "In buffer" in-buffer) + (const :tag "Not in buffer" not-in-buffer) + (const :tag "In mode" in-mode) + (const :tag "Not in mode" not-in-mode)) + (regexp)) + (function :tag "Custom function")))))) + +(defcustom org-agenda-max-entries nil + "Maximum number of entries to display in an agenda. +This can be nil (no limit) or an integer or an alist of agenda +types with an associated number of entries to display in this +type." + :version "24.4" + :package-version '(Org . "8.0") + :group 'org-agenda-custom-commands + :type '(choice (symbol :tag "No limit" nil) + (integer :tag "Max number of entries") + (repeat + (cons (choice :tag "Agenda type" + (const agenda) + (const todo) + (const tags) + (const search)) + (integer :tag "Max number of entries"))))) + +(defcustom org-agenda-max-todos nil + "Maximum number of TODOs to display in an agenda. +This can be nil (no limit) or an integer or an alist of agenda +types with an associated number of entries to display in this +type." + :version "24.4" + :package-version '(Org . "8.0") + :group 'org-agenda-custom-commands + :type '(choice (symbol :tag "No limit" nil) + (integer :tag "Max number of TODOs") + (repeat + (cons (choice :tag "Agenda type" + (const agenda) + (const todo) + (const tags) + (const search)) + (integer :tag "Max number of TODOs"))))) + +(defcustom org-agenda-max-tags nil + "Maximum number of tagged entries to display in an agenda. +This can be nil (no limit) or an integer or an alist of agenda +types with an associated number of entries to display in this +type." + :version "24.4" + :package-version '(Org . "8.0") + :group 'org-agenda-custom-commands + :type '(choice (symbol :tag "No limit" nil) + (integer :tag "Max number of tagged entries") + (repeat + (cons (choice :tag "Agenda type" + (const agenda) + (const todo) + (const tags) + (const search)) + (integer :tag "Max number of tagged entries"))))) + +(defcustom org-agenda-max-effort nil + "Maximum cumulated effort duration for the agenda. +This can be nil (no limit) or a number of minutes (as an integer) +or an alist of agenda types with an associated number of minutes +to limit entries to in this type." + :version "24.4" + :package-version '(Org . "8.0") + :group 'org-agenda-custom-commands + :type '(choice (symbol :tag "No limit" nil) + (integer :tag "Max number of minutes") + (repeat + (cons (choice :tag "Agenda type" + (const agenda) + (const todo) + (const tags) + (const search)) + (integer :tag "Max number of minutes"))))) + +(defvar org-agenda-keep-restricted-file-list nil) +(defvar org-keys nil) +(defvar org-match nil) +;;;###autoload +(defun org-agenda (&optional arg keys restriction) + "Dispatch agenda commands to collect entries to the agenda buffer. +Prompts for a command to execute. Any prefix arg will be passed +on to the selected command. The default selections are: + +a Call `org-agenda-list' to display the agenda for current day or week. +t Call `org-todo-list' to display the global todo list. +T Call `org-todo-list' to display the global todo list, select only + entries with a specific TODO keyword (the user gets a prompt). +m Call `org-tags-view' to display headlines with tags matching + a condition (the user is prompted for the condition). +M Like `m', but select only TODO entries, no ordinary headlines. +e Export views to associated files. +s Search entries for keywords. +S Search entries for keywords, only with TODO keywords. +/ Multi occur across all agenda files and also files listed + in `org-agenda-text-search-extra-files'. +< Restrict agenda commands to buffer, subtree, or region. + Press several times to get the desired effect. +> Remove a previous restriction. +# List \"stuck\" projects. +! Configure what \"stuck\" means. +C Configure custom agenda commands. + +More commands can be added by configuring the variable +`org-agenda-custom-commands'. In particular, specific tags and TODO keyword +searches can be pre-defined in this way. + +If the current buffer is in Org mode and visiting a file, you can also +first press `<' once to indicate that the agenda should be temporarily +\(until the next use of `\\[org-agenda]') restricted to the current file. +Pressing `<' twice means to restrict to the current subtree or region +\(if active)." + (interactive "P") + (catch 'exit + (let* ((org-keys keys) + (prefix-descriptions nil) + (org-agenda-buffer-name org-agenda-buffer-name) + (org-agenda-window-setup (if (equal (buffer-name) + org-agenda-buffer-name) + 'current-window + org-agenda-window-setup)) + (org-agenda-custom-commands-orig org-agenda-custom-commands) + (org-agenda-custom-commands + ;; normalize different versions + (delq nil + (mapcar + (lambda (x) + (cond ((stringp (cdr x)) + (push x prefix-descriptions) + nil) + ((stringp (nth 1 x)) x) + ((not (nth 1 x)) (cons (car x) (cons "" (cddr x)))) + (t (cons (car x) (cons "" (cdr x)))))) + org-agenda-custom-commands))) + (org-agenda-custom-commands + (org-contextualize-keys + org-agenda-custom-commands org-agenda-custom-commands-contexts)) + ;; (buf (current-buffer)) + (bfn (buffer-file-name (buffer-base-buffer))) + entry type org-match lprops ans) ;; key + ;; Turn off restriction unless there is an overriding one, + (unless org-agenda-overriding-restriction + (unless org-agenda-keep-restricted-file-list + ;; There is a request to keep the file list in place + (put 'org-agenda-files 'org-restrict nil)) + (setq org-agenda-restrict nil) + (move-marker org-agenda-restrict-begin nil) + (move-marker org-agenda-restrict-end nil)) + ;; Delete old local properties + (put 'org-agenda-redo-command 'org-lprops nil) + ;; Delete previously set last-arguments + (put 'org-agenda-redo-command 'last-args nil) + ;; Remember where this call originated + (setq org-agenda-last-dispatch-buffer (current-buffer)) + (unless org-keys + (setq ans (org-agenda-get-restriction-and-command prefix-descriptions) + org-keys (car ans) + restriction (cdr ans))) + ;; If we have sticky agenda buffers, set a name for the buffer, + ;; depending on the invoking keys. The user may still set this + ;; as a command option, which will overwrite what we do here. + (when org-agenda-sticky + (setq org-agenda-buffer-name + (format "*Org Agenda(%s)*" org-keys))) + ;; Establish the restriction, if any + (when (and (not org-agenda-overriding-restriction) restriction) + (put 'org-agenda-files 'org-restrict (list bfn)) + (cond + ((eq restriction 'region) + (setq org-agenda-restrict (current-buffer)) + (move-marker org-agenda-restrict-begin (region-beginning)) + (move-marker org-agenda-restrict-end (region-end))) + ((eq restriction 'subtree) + (save-excursion + (setq org-agenda-restrict (current-buffer)) + (org-back-to-heading t) + (move-marker org-agenda-restrict-begin (point)) + (move-marker org-agenda-restrict-end + (progn (org-end-of-subtree t))))) + ((and (eq restriction 'buffer) + (or (< 1 (point-min)) + (< (point-max) (1+ (buffer-size))))) + (setq org-agenda-restrict (current-buffer)) + (move-marker org-agenda-restrict-begin (point-min)) + (move-marker org-agenda-restrict-end (point-max))))) + + ;; For example the todo list should not need it (but does...) + (cond + ((setq entry (assoc org-keys org-agenda-custom-commands)) + (if (or (symbolp (nth 2 entry)) (functionp (nth 2 entry))) + (progn + ;; FIXME: Is (nth 3 entry) supposed to have access (via dynvars) + ;; to some of the local variables? There's no doc about + ;; that for `org-agenda-custom-commands'. + (setq type (nth 2 entry) org-match (eval (nth 3 entry) t) + lprops (nth 4 entry)) + (when org-agenda-sticky + (setq org-agenda-buffer-name + (or (and (stringp org-match) (format "*Org Agenda(%s:%s)*" org-keys org-match)) + (format "*Org Agenda(%s)*" org-keys)))) + (put 'org-agenda-redo-command 'org-lprops lprops) + (cl-progv + (mapcar #'car lprops) + (mapcar (lambda (binding) (eval (cadr binding) t)) lprops) + (pcase type + (`agenda + (org-agenda-list current-prefix-arg)) + (`agenda* + (org-agenda-list current-prefix-arg nil nil t)) + (`alltodo + (org-todo-list current-prefix-arg)) + (`search + (org-search-view current-prefix-arg org-match nil)) + (`stuck + (org-agenda-list-stuck-projects current-prefix-arg)) + (`tags + (org-tags-view current-prefix-arg org-match)) + (`tags-todo + (org-tags-view '(4) org-match)) + (`todo + (org-todo-list org-match)) + (`tags-tree + (org-check-for-org-mode) + (org-match-sparse-tree current-prefix-arg org-match)) + (`todo-tree + (org-check-for-org-mode) + (org-occur (concat "^" org-outline-regexp "[ \t]*" + (regexp-quote org-match) "\\>"))) + (`occur-tree + (org-check-for-org-mode) + (org-occur org-match)) + ((pred functionp) + (funcall type org-match)) + ;; FIXME: Will signal an error since it's not `functionp'! + ((pred fboundp) (funcall type org-match)) + (_ (user-error "Invalid custom agenda command type %s" type))))) + (org-agenda-run-series (nth 1 entry) (cddr entry)))) + ((equal org-keys "C") + (setq org-agenda-custom-commands org-agenda-custom-commands-orig) + (customize-variable 'org-agenda-custom-commands)) + ((equal org-keys "a") (call-interactively 'org-agenda-list)) + ((equal org-keys "s") (call-interactively 'org-search-view)) + ((equal org-keys "S") (org-call-with-arg 'org-search-view (or arg '(4)))) + ((equal org-keys "t") (call-interactively 'org-todo-list)) + ((equal org-keys "T") (org-call-with-arg 'org-todo-list (or arg '(4)))) + ((equal org-keys "m") (call-interactively 'org-tags-view)) + ((equal org-keys "M") (org-call-with-arg 'org-tags-view (or arg '(4)))) + ((equal org-keys "e") (call-interactively 'org-store-agenda-views)) + ((equal org-keys "?") (org-tags-view nil "+FLAGGED") + (add-hook + 'post-command-hook + (lambda () + (unless (current-message) + (let* ((m (org-agenda-get-any-marker)) + (note (and m (org-entry-get m "THEFLAGGINGNOTE")))) + (when note + (message "FLAGGING-NOTE ([?] for more info): %s" + (org-add-props + (replace-regexp-in-string + "\\\\n" "//" + (copy-sequence note)) + nil 'face 'org-warning)))))) + t t)) + ((equal org-keys "#") (call-interactively 'org-agenda-list-stuck-projects)) + ((equal org-keys "/") (call-interactively 'org-occur-in-agenda-files)) + ((equal org-keys "!") (customize-variable 'org-stuck-projects)) + (t (user-error "Invalid agenda key")))))) + +(defvar org-agenda-multi) + +(defun org-agenda-append-agenda () + "Append another agenda view to the current one. +This function allows interactive building of block agendas. +Agenda views are separated by `org-agenda-block-separator'." + (interactive) + (unless (derived-mode-p 'org-agenda-mode) + (user-error "Can only append from within agenda buffer")) + (let ((org-agenda-multi t)) + (org-agenda) + (widen) + (org-agenda-finalize) + (setq buffer-read-only t) + (org-agenda-fit-window-to-buffer))) + +(defun org-agenda-normalize-custom-commands (cmds) + "Normalize custom commands CMDS." + (delq nil + (mapcar + (lambda (x) + (cond ((stringp (cdr x)) nil) + ((stringp (nth 1 x)) x) + ((not (nth 1 x)) (cons (car x) (cons "" (cddr x)))) + (t (cons (car x) (cons "" (cdr x)))))) + cmds))) + +(defun org-agenda-get-restriction-and-command (prefix-descriptions) + "The user interface for selecting an agenda command." + (catch 'exit + (let* ((bfn (buffer-file-name (buffer-base-buffer))) + (restrict-ok (and bfn (derived-mode-p 'org-mode))) + (region-p (org-region-active-p)) + (custom org-agenda-custom-commands) + (selstring "") + restriction second-time + c entry key type match prefixes rmheader header-end custom1 desc + line lines left right n n1) + (save-window-excursion + (delete-other-windows) + (org-switch-to-buffer-other-window " *Agenda Commands*") + (erase-buffer) + (insert (eval-when-compile + (let ((header + (copy-sequence + "Press key for an agenda command: +-------------------------------- < Buffer, subtree/region restriction +a Agenda for current week or day > Remove restriction +t List of all TODO entries e Export agenda views +m Match a TAGS/PROP/TODO query T Entries with special TODO kwd +s Search for keywords M Like m, but only TODO entries +/ Multi-occur S Like s, but only TODO entries +? Find :FLAGGED: entries C Configure custom agenda commands +* Toggle sticky agenda views # List stuck projects (!=configure) +")) + (start 0)) + (while (string-match + "\\(^\\| \\|(\\)\\(\\S-\\)\\( \\|=\\)" + header start) + (setq start (match-end 0)) + (add-text-properties (match-beginning 2) (match-end 2) + '(face bold) header)) + header))) + (setq header-end (point-marker)) + (while t + (setq custom1 custom) + (when (eq rmheader t) + (org-goto-line 1) + (re-search-forward ":" nil t) + (delete-region (match-end 0) (point-at-eol)) + (forward-char 1) + (looking-at "-+") + (delete-region (match-end 0) (point-at-eol)) + (move-marker header-end (match-end 0))) + (goto-char header-end) + (delete-region (point) (point-max)) + + ;; Produce all the lines that describe custom commands and prefixes + (setq lines nil) + (while (setq entry (pop custom1)) + (setq key (car entry) desc (nth 1 entry) + type (nth 2 entry) + match (nth 3 entry)) + (if (> (length key) 1) + (cl-pushnew (string-to-char key) prefixes :test #'equal) + (setq line + (format + "%-4s%-14s" + (org-add-props (copy-sequence key) + '(face bold)) + (cond + ((string-match "\\S-" desc) desc) + ((eq type 'agenda) "Agenda for current week or day") + ((eq type 'agenda*) "Appointments for current week or day") + ((eq type 'alltodo) "List of all TODO entries") + ((eq type 'search) "Word search") + ((eq type 'stuck) "List of stuck projects") + ((eq type 'todo) "TODO keyword") + ((eq type 'tags) "Tags query") + ((eq type 'tags-todo) "Tags (TODO)") + ((eq type 'tags-tree) "Tags tree") + ((eq type 'todo-tree) "TODO kwd tree") + ((eq type 'occur-tree) "Occur tree") + ((functionp type) (if (symbolp type) + (symbol-name type) + "Lambda expression")) + (t "???")))) + (cond + ((not (org-string-nw-p match)) nil) + (org-agenda-menu-show-matcher + (setq line + (concat line ": " + (cond + ((stringp match) + (propertize match 'face 'org-warning)) + ((listp type) + (format "set of %d commands" (length type))))))) + (t + (org-add-props line nil 'help-echo (concat "Matcher: " match)))) + (push line lines))) + (setq lines (nreverse lines)) + (when prefixes + (mapc (lambda (x) + (push + (format "%s %s" + (org-add-props (char-to-string x) + nil 'face 'bold) + (or (cdr (assoc (concat selstring + (char-to-string x)) + prefix-descriptions)) + "Prefix key")) + lines)) + prefixes)) + + ;; Check if we should display in two columns + (if org-agenda-menu-two-columns + (progn + (setq n (length lines) + n1 (+ (/ n 2) (mod n 2)) + right (nthcdr n1 lines) + left (copy-sequence lines)) + (setcdr (nthcdr (1- n1) left) nil)) + (setq left lines right nil)) + (while left + (insert "\n" (pop left)) + (when right + (if (< (current-column) 40) + (move-to-column 40 t) + (insert " ")) + (insert (pop right)))) + + ;; Make the window the right size + (goto-char (point-min)) + (if second-time + (when (not (pos-visible-in-window-p (point-max))) + (org-fit-window-to-buffer)) + (setq second-time t) + (org-fit-window-to-buffer)) + + ;; Hint to navigation if window too small for all information + (setq header-line-format + (when (not (pos-visible-in-window-p (point-max))) + "Use C-v, M-v, C-n or C-p to navigate.")) + + ;; Ask for selection + (cl-loop + do (progn + (message "Press key for agenda command%s:" + (if (or restrict-ok org-agenda-overriding-restriction) + (if org-agenda-overriding-restriction + " (restriction lock active)" + (if restriction + (format " (restricted to %s)" restriction) + " (unrestricted)")) + "")) + (setq c (read-char-exclusive))) + until (not (memq c '(14 16 22 134217846))) + do (org-scroll c)) + + (message "") + (cond + ((assoc (char-to-string c) custom) + (setq selstring (concat selstring (char-to-string c))) + (throw 'exit (cons selstring restriction))) + ((memq c prefixes) + (setq selstring (concat selstring (char-to-string c)) + prefixes nil + rmheader (or rmheader t) + custom (delq nil (mapcar + (lambda (x) + (if (or (= (length (car x)) 1) + (/= (string-to-char (car x)) c)) + nil + (cons (substring (car x) 1) (cdr x)))) + custom)))) + ((eq c ?*) + (call-interactively 'org-toggle-sticky-agenda) + (sit-for 2)) + ((and (not restrict-ok) (memq c '(?1 ?0 ?<))) + (message "Restriction is only possible in Org buffers") + (ding) (sit-for 1)) + ((eq c ?1) + (org-agenda-remove-restriction-lock 'noupdate) + (setq restriction 'buffer)) + ((eq c ?0) + (org-agenda-remove-restriction-lock 'noupdate) + (setq restriction (if region-p 'region 'subtree))) + ((eq c ?<) + (org-agenda-remove-restriction-lock 'noupdate) + (setq restriction + (cond + ((eq restriction 'buffer) + (if region-p 'region 'subtree)) + ((memq restriction '(subtree region)) + nil) + (t 'buffer)))) + ((eq c ?>) + (org-agenda-remove-restriction-lock 'noupdate) + (setq restriction nil)) + ((and (equal selstring "") (memq c '(?s ?S ?a ?t ?m ?L ?C ?e ?T ?M ?# ?! ?/ ??))) + (throw 'exit (cons (setq selstring (char-to-string c)) restriction))) + ((and (> (length selstring) 0) (eq c ?\d)) + (delete-window) + (org-agenda-get-restriction-and-command prefix-descriptions)) + + ((equal c ?q) (user-error "Abort")) + (t (user-error "Invalid key %c" c)))))))) + +(defun org-agenda-fit-window-to-buffer () + "Fit the window to the buffer size." + (and (memq org-agenda-window-setup '(reorganize-frame)) + (fboundp 'fit-window-to-buffer) + (if (and (= (cdr org-agenda-window-frame-fractions) 1.0) + (= (car org-agenda-window-frame-fractions) 1.0)) + (delete-other-windows) + (org-fit-window-to-buffer + nil + (floor (* (frame-height) (cdr org-agenda-window-frame-fractions))) + (floor (* (frame-height) (car org-agenda-window-frame-fractions))))))) + +(defvar org-cmd nil) +(defvar org-agenda-overriding-cmd nil) +(defvar org-agenda-overriding-arguments nil) +(defvar org-agenda-overriding-cmd-arguments nil) + +(defun org-let (list &rest body) ;FIXME: So many kittens are suffering here. + (declare (indent 1) (obsolete cl-progv "2021")) + (eval (cons 'let (cons list body)))) + +(defun org-let2 (list1 list2 &rest body) ;FIXME: Where did our karma go? + (declare (indent 2) (obsolete cl-progv "2021")) + (eval (cons 'let (cons list1 (list (cons 'let (cons list2 body))))))) + +(defun org-agenda-run-series (name series) + "Run agenda NAME as a SERIES of agenda commands." + (let* ((gprops (nth 1 series)) + (gvars (mapcar #'car gprops)) + (gvals (mapcar (lambda (binding) (eval (cadr binding) t)) gprops))) + (cl-progv gvars gvals (org-agenda-prepare name)) + ;; We need to reset agenda markers here, because when constructing a + ;; block agenda, the individual blocks do not do that. + (org-agenda-reset-markers) + (with-no-warnings + (defvar match)) ;Used via the `eval' below. + (let* ((org-agenda-multi t) + ;; FIXME: Redo should contain lists of (FUNS . ARGS) rather + ;; than expressions, so you don't need to `quote' the args + ;; and you just need to `apply' instead of `eval' when using it. + (redo (list 'org-agenda-run-series name (list 'quote series))) + (cmds (car series)) + match + org-cmd type lprops) + (while (setq org-cmd (pop cmds)) + (setq type (car org-cmd)) + (setq match (eval (nth 1 org-cmd) t)) + (setq lprops (nth 2 org-cmd)) + (let ((org-agenda-overriding-arguments + (if (eq org-agenda-overriding-cmd org-cmd) + (or org-agenda-overriding-arguments + org-agenda-overriding-cmd-arguments))) + (lvars (mapcar #'car lprops)) + (lvals (mapcar (lambda (binding) (eval (cadr binding) t)) lprops))) + (cl-progv (append gvars lvars) (append gvals lvals) + (pcase type + (`agenda + (call-interactively 'org-agenda-list)) + (`agenda* + (funcall 'org-agenda-list nil nil t)) + (`alltodo + (call-interactively 'org-todo-list)) + (`search + (org-search-view current-prefix-arg match nil)) + (`stuck + (call-interactively 'org-agenda-list-stuck-projects)) + (`tags + (org-tags-view current-prefix-arg match)) + (`tags-todo + (org-tags-view '(4) match)) + (`todo + (org-todo-list match)) + ((pred fboundp) + (funcall type match)) + (_ (error "Invalid type in command series")))))) + (widen) + (let ((inhibit-read-only t)) + (add-text-properties (point-min) (point-max) + `(org-series t org-series-redo-cmd ,redo))) + (setq org-agenda-redo-command redo) + (goto-char (point-min))) + (org-agenda-fit-window-to-buffer) + (cl-progv gvars gvals (org-agenda-finalize)))) + +(defun org-agenda--split-plist (plist) + ;; We could/should arguably use `map-keys' and `map-values'. + (let (keys vals) + (while plist + (push (pop plist) keys) + (push (pop plist) vals)) + (cons (nreverse keys) (nreverse vals)))) + +;;;###autoload +(defmacro org-batch-agenda (cmd-key &rest parameters) + "Run an agenda command in batch mode and send the result to STDOUT. +If CMD-KEY is a string of length 1, it is used as a key in +`org-agenda-custom-commands' and triggers this command. If it is a +longer string it is used as a tags/todo match string. +Parameters are alternating variable names and values that will be bound +before running the agenda command." + (pcase-let ((`(,vars . ,exps) (org-agenda--split-plist parameters))) + `(org--batch-agenda ,cmd-key ',vars (list ,@exps)))) + +(defun org--batch-agenda (cmd-key vars vals) + ;; `org-batch-agenda' is a macro because every other "parameter" is + ;; a variable name rather than an expression to evaluate. Yuck! + (cl-progv vars vals + (let (org-agenda-sticky) + (if (> (length cmd-key) 1) + (org-tags-view nil cmd-key) + (org-agenda nil cmd-key)))) + (set-buffer org-agenda-buffer-name) + (princ (buffer-string))) + +(defvar org-agenda-info nil) + +;;;###autoload +(defmacro org-batch-agenda-csv (cmd-key &rest parameters) + "Run an agenda command in batch mode and send the result to STDOUT. +If CMD-KEY is a string of length 1, it is used as a key in +`org-agenda-custom-commands' and triggers this command. If it is a +longer string it is used as a tags/todo match string. +Parameters are alternating variable names and values that will be bound +before running the agenda command. + +The output gives a line for each selected agenda item. Each +item is a list of comma-separated values, like this: + +category,head,type,todo,tags,date,time,extra,priority-l,priority-n + +category The category of the item +head The headline, without TODO kwd, TAGS and PRIORITY +type The type of the agenda entry, can be + todo selected in TODO match + tagsmatch selected in tags match + diary imported from diary + deadline a deadline on given date + scheduled scheduled on given date + timestamp entry has timestamp on given date + closed entry was closed on given date + upcoming-deadline warning about deadline + past-scheduled forwarded scheduled item + block entry has date block including g. date +todo The todo keyword, if any +tags All tags including inherited ones, separated by colons +date The relevant date, like 2007-2-14 +time The time, like 15:00-16:50 +extra String with extra planning info +priority-l The priority letter if any was given +priority-n The computed numerical priority +agenda-day The day in the agenda where this is listed" + (pcase-let ((`(,vars . ,exps) (org-agenda--split-plist parameters))) + `(org--batch-agenda-csv ,cmd-key ',vars (list ,@exps)))) + +(defun org--batch-agenda-csv (cmd-key vars vals) + ;; `org-batch-agenda-csv' is a macro because every other "parameter" is + ;; a variable name rather than an expression to evaluate. Yuck! + (let ((org-agenda-remove-tags t)) + (cl-progv vars vals + ;; FIXME: Shouldn't this be 1 (see commit 10173ad6d610b)? + (if (> (length cmd-key) 2) + (org-tags-view nil cmd-key) + (org-agenda nil cmd-key)))) + (set-buffer org-agenda-buffer-name) + (let ((lines (org-split-string (buffer-string) "\n"))) + (dolist (line lines) + (when (get-text-property 0 'org-category line) + (setq org-agenda-info + (org-fix-agenda-info (text-properties-at 0 line))) + (princ + (mapconcat #'org-agenda-export-csv-mapper + '(org-category txt type todo tags date time extra + priority-letter priority agenda-day) + ",")) + (princ "\n"))))) + +(defun org-fix-agenda-info (props) + "Make sure all properties on an agenda item have a canonical form. +This ensures the export commands can easily use it." + (let (tmp re) + (when (setq tmp (plist-get props 'tags)) + (setq props (plist-put props 'tags (mapconcat #'identity tmp ":")))) + (when (setq tmp (plist-get props 'date)) + (when (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) + (let ((calendar-date-display-form '(year "-" month "-" day))) + '((format "%4d, %9s %2s, %4s" dayname monthname day year)) + + (setq tmp (calendar-date-string tmp))) + (setq props (plist-put props 'date tmp))) + (when (setq tmp (plist-get props 'day)) + (when (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) + (let ((calendar-date-display-form '(year "-" month "-" day))) + (setq tmp (calendar-date-string tmp))) + (setq props (plist-put props 'day tmp)) + (setq props (plist-put props 'agenda-day tmp))) + (when (setq tmp (plist-get props 'txt)) + (when (string-match "\\[#\\([A-Z0-9]\\)\\] ?" tmp) + (plist-put props 'priority-letter (match-string 1 tmp)) + (setq tmp (replace-match "" t t tmp))) + (when (and (setq re (plist-get props 'org-todo-regexp)) + (setq re (concat "\\`\\.*" re " ?")) + (let ((case-fold-search nil)) (string-match re tmp))) + (plist-put props 'todo (match-string 1 tmp)) + (setq tmp (replace-match "" t t tmp))) + (plist-put props 'txt tmp))) + props) + +(defun org-agenda-export-csv-mapper (prop) + (let ((res (plist-get org-agenda-info prop))) + (setq res + (cond + ((not res) "") + ((stringp res) res) + (t (prin1-to-string res)))) + (org-trim (replace-regexp-in-string "," ";" res nil t)))) + +;;;###autoload +(defun org-store-agenda-views (&rest _parameters) + "Store agenda views." + (interactive) + (org--batch-store-agenda-views nil nil)) + +;;;###autoload +(defmacro org-batch-store-agenda-views (&rest parameters) + "Run all custom agenda commands that have a file argument." + (pcase-let ((`(,vars . ,exps) (org-agenda--split-plist parameters))) + `(org--batch-store-agenda-views ',vars (list ,@exps)))) + +(defun org--batch-store-agenda-views (vars vals) + (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands)) + (pop-up-frames nil) + (dir default-directory) + cmd thiscmdkey thiscmdcmd match files opts cmd-or-set bufname) + (save-window-excursion + (while cmds + (setq cmd (pop cmds) + thiscmdkey (car cmd) + thiscmdcmd (cdr cmd) + match (nth 2 thiscmdcmd) + bufname (if org-agenda-sticky + (or (and (stringp match) + (format "*Org Agenda(%s:%s)*" thiscmdkey match)) + (format "*Org Agenda(%s)*" thiscmdkey)) + org-agenda-buffer-name) + cmd-or-set (nth 2 cmd) + opts (nth (if (listp cmd-or-set) 3 4) cmd) + files (nth (if (listp cmd-or-set) 4 5) cmd)) + (if (stringp files) (setq files (list files))) + (when files + (let* ((opts (append org-agenda-exporter-settings opts)) + (vars (append (mapcar #'car opts) vars)) + (vals (append (mapcar (lambda (binding) (eval (cadr binding) t)) + opts) + vals))) + (cl-progv vars vals + (org-agenda nil thiscmdkey)) + (set-buffer bufname) + (while files + (cl-progv vars vals + (org-agenda-write (expand-file-name (pop files) dir) + nil t bufname)))) + (and (get-buffer bufname) + (kill-buffer bufname))))))) + +(defvar org-agenda-current-span nil + "The current span used in the agenda view.") ; local variable in the agenda buffer +(defun org-agenda-mark-header-line (pos) + "Mark the line at POS as an agenda structure header." + (save-excursion + (goto-char pos) + (put-text-property (point-at-bol) (point-at-eol) + 'org-agenda-structural-header t) + (when org-agenda-title-append + (put-text-property (point-at-bol) (point-at-eol) + 'org-agenda-title-append org-agenda-title-append)))) + +(defvar org-mobile-creating-agendas) ; defined in org-mobile.el +(defvar org-agenda-write-buffer-name "Agenda View") +(defun org-agenda-write (file &optional open nosettings agenda-bufname) + "Write the current buffer (an agenda view) as a file. + +Depending on the extension of the file name, plain text (.txt), +HTML (.html or .htm), PDF (.pdf) or Postscript (.ps) is produced. +If the extension is .ics, translate visible agenda into iCalendar +format. If the extension is .org, collect all subtrees +corresponding to the agenda entries and add them in an .org file. + +With prefix argument OPEN, open the new file immediately. If +NOSETTINGS is given, do not scope the settings of +`org-agenda-exporter-settings' into the export commands. This is +used when the settings have already been scoped and we do not +wish to overrule other, higher priority settings. If +AGENDA-BUFFER-NAME is provided, use this as the buffer name for +the agenda to write." + (interactive "FWrite agenda to file: \nP") + (if (or (not (file-writable-p file)) + (and (file-exists-p file) + (if (called-interactively-p 'any) + (not (y-or-n-p (format "Overwrite existing file %s? " file)))))) + (user-error "Cannot write agenda to file %s" file)) + (cl-progv + (if nosettings nil (mapcar #'car org-agenda-exporter-settings)) + (if nosettings nil (mapcar (lambda (binding) (eval (cadr binding) t)) + org-agenda-exporter-settings)) + (save-excursion + (save-window-excursion + (let ((bs (copy-sequence (buffer-string))) + (extension (file-name-extension file)) + (default-directory (file-name-directory file)) + ) ;; beg content + (with-temp-buffer + (rename-buffer org-agenda-write-buffer-name t) + (set-buffer-modified-p nil) + (insert bs) + (org-agenda-remove-marked-text 'invisible 'org-filtered) + (run-hooks 'org-agenda-before-write-hook) + (cond + ((bound-and-true-p org-mobile-creating-agendas) + (org-mobile-write-agenda-for-mobile file)) + ((string= "org" extension) + (let (content p m message-log-max) + (goto-char (point-min)) + (while (setq p (next-single-property-change (point) 'org-hd-marker nil)) + (goto-char p) + (setq m (get-text-property (point) 'org-hd-marker)) + (when m + (push (with-current-buffer (marker-buffer m) + (goto-char m) + (org-copy-subtree 1 nil t t) + org-subtree-clip) + content))) + (find-file file) + (erase-buffer) + (dolist (s content) (org-paste-subtree 1 s)) + (write-file file) + (kill-buffer (current-buffer)) + (message "Org file written to %s" file))) + ((member extension '("html" "htm")) + (or (require 'htmlize nil t) + (error "Please install htmlize from https://github.com/hniksic/emacs-htmlize")) + (declare-function htmlize-buffer "htmlize" (&optional buffer)) + (set-buffer (htmlize-buffer (current-buffer))) + (when org-agenda-export-html-style + ;; replace ")) + (insert org-agenda-export-html-style)) + (write-file file) + (kill-buffer (current-buffer)) + (message "HTML written to %s" file)) + ((string= "ps" extension) + (require 'ps-print) + (ps-print-buffer-with-faces file) + (message "Postscript written to %s" file)) + ((string= "pdf" extension) + (require 'ps-print) + (ps-print-buffer-with-faces + (concat (file-name-sans-extension file) ".ps")) + (call-process "ps2pdf" nil nil nil + (expand-file-name + (concat (file-name-sans-extension file) ".ps")) + (expand-file-name file)) + (delete-file (concat (file-name-sans-extension file) ".ps")) + (message "PDF written to %s" file)) + ((string= "ics" extension) + (require 'ox-icalendar) + (declare-function org-icalendar-export-current-agenda + "ox-icalendar" (file)) + (org-icalendar-export-current-agenda (expand-file-name file))) + (t + (let ((bs (buffer-string))) + (find-file file) + (erase-buffer) + (insert bs) + (save-buffer 0) + (kill-buffer (current-buffer)) + (message "Plain text written to %s" file)))))))) + (set-buffer (or agenda-bufname + ;; FIXME: I'm pretty sure called-interactively-p + ;; doesn't do what we want here! + (and (called-interactively-p 'any) (buffer-name)) + org-agenda-buffer-name))) + (when open (org-open-file file))) + +(defun org-agenda-remove-marked-text (property &optional value) + "Delete all text marked with VALUE of PROPERTY. +VALUE defaults to t." + (let (beg) + (setq value (or value t)) + (while (setq beg (text-property-any (point-min) (point-max) + property value)) + (delete-region + beg (or (next-single-property-change beg property) + (point-max)))))) + +(defun org-agenda-add-entry-text () + "Add entry text to agenda lines. +This will add a maximum of `org-agenda-add-entry-text-maxlines' lines of the +entry text following headings shown in the agenda. +Drawers will be excluded, also the line with scheduling/deadline info." + (when (and (> org-agenda-add-entry-text-maxlines 0) + (not (bound-and-true-p org-mobile-creating-agendas))) + (let (m txt) + (goto-char (point-min)) + (while (not (eobp)) + (if (not (setq m (org-get-at-bol 'org-hd-marker))) + (beginning-of-line 2) + (setq txt (org-agenda-get-some-entry-text + m org-agenda-add-entry-text-maxlines " > ")) + (end-of-line 1) + (if (string-match "\\S-" txt) + (insert "\n" txt) + (or (eobp) (forward-char 1)))))))) + +(defun org-agenda-get-some-entry-text (marker n-lines &optional indent + &rest keep) + "Extract entry text from MARKER, at most N-LINES lines. +This will ignore drawers etc, just get the text. +If INDENT is given, prefix every line with this string. If KEEP is +given, it is a list of symbols, defining stuff that should not be +removed from the entry content. Currently only `planning' is allowed here." + (let (txt drawer-re kwd-time-re ind) + (save-excursion + (with-current-buffer (marker-buffer marker) + (if (not (derived-mode-p 'org-mode)) + (setq txt "") + (org-with-wide-buffer + (goto-char marker) + (end-of-line 1) + (setq txt (buffer-substring + (min (1+ (point)) (point-max)) + (progn (outline-next-heading) (point))) + drawer-re org-drawer-regexp + kwd-time-re (concat "^[ \t]*" org-keyword-time-regexp + ".*\n?")) + (with-temp-buffer + (insert txt) + (when org-agenda-add-entry-text-descriptive-links + (goto-char (point-min)) + (while (org-activate-links (point-max)) + (goto-char (match-end 0)))) + (goto-char (point-min)) + (while (re-search-forward org-link-bracket-re (point-max) t) + (set-text-properties (match-beginning 0) (match-end 0) + nil)) + (goto-char (point-min)) + (while (re-search-forward drawer-re nil t) + (delete-region + (match-beginning 0) + (progn (re-search-forward + "^[ \t]*:END:.*\n?" nil 'move) + (point)))) + (unless (member 'planning keep) + (goto-char (point-min)) + (while (re-search-forward kwd-time-re nil t) + (replace-match ""))) + (goto-char (point-min)) + (when org-agenda-entry-text-exclude-regexps + (let ((re-list org-agenda-entry-text-exclude-regexps) re) + (while (setq re (pop re-list)) + (goto-char (point-min)) + (while (re-search-forward re nil t) + (replace-match ""))))) + (goto-char (point-max)) + (skip-chars-backward " \t\n") + (when (looking-at "[ \t\n]+\\'") (replace-match "")) + + ;; find and remove min common indentation + (goto-char (point-min)) + (untabify (point-min) (point-max)) + (setq ind (current-indentation)) + (while (not (eobp)) + (unless (looking-at "[ \t]*$") + (setq ind (min ind (current-indentation)))) + (beginning-of-line 2)) + (goto-char (point-min)) + (while (not (eobp)) + (unless (looking-at "[ \t]*$") + (move-to-column ind) + (delete-region (point-at-bol) (point))) + (beginning-of-line 2)) + + (run-hooks 'org-agenda-entry-text-cleanup-hook) + + (goto-char (point-min)) + (when indent + (while (and (not (eobp)) (re-search-forward "^" nil t)) + (replace-match indent t t))) + (goto-char (point-min)) + (while (looking-at "[ \t]*\n") (replace-match "")) + (goto-char (point-max)) + (when (> (org-current-line) + n-lines) + (org-goto-line (1+ n-lines)) + (backward-char 1)) + (setq txt (buffer-substring (point-min) (point)))))))) + txt)) + +(defun org-check-for-org-mode () + "Make sure current buffer is in Org mode. Error if not." + (or (derived-mode-p 'org-mode) + (error "Cannot execute Org agenda command on buffer in %s" + major-mode))) + +;;; Agenda prepare and finalize + +(defvar org-agenda-multi nil) ; dynamically scoped +(defvar org-agenda-pre-window-conf nil) +(defvar org-agenda-columns-active nil) +(defvar org-agenda-name nil) +(defvar org-agenda-tag-filter nil) +(defvar org-agenda-category-filter nil) +(defvar org-agenda-regexp-filter nil) +(defvar org-agenda-effort-filter nil) +(defvar org-agenda-top-headline-filter nil) + +(defvar org-agenda-represented-categories nil + "Cache for the list of all categories in the agenda.") +(defvar org-agenda-represented-tags nil + "Cache for the list of all categories in the agenda.") +(defvar org-agenda-tag-filter-preset nil + "A preset of the tags filter used for secondary agenda filtering. +This must be a list of strings, each string must be a single tag preceded +by \"+\" or \"-\". +This variable should not be set directly, but agenda custom commands can +bind it in the options section. The preset filter is a global property of +the entire agenda view. In a block agenda, it will not work reliably to +define a filter for one of the individual blocks. You need to set it in +the global options and expect it to be applied to the entire view.") + +(defconst org-agenda-filter-variables + '((category . org-agenda-category-filter) + (tag . org-agenda-tag-filter) + (effort . org-agenda-effort-filter) + (regexp . org-agenda-regexp-filter)) + "Alist of filter types and associated variables.") +(defun org-agenda-filter-any () + "Is any filter active?" + (cl-some (lambda (x) + (or (symbol-value (cdr x)) + (get :preset-filter x))) + org-agenda-filter-variables)) + +(defvar org-agenda-category-filter-preset nil + "A preset of the category filter used for secondary agenda filtering. +This must be a list of strings, each string must be a single category +preceded by \"+\" or \"-\". +This variable should not be set directly, but agenda custom commands can +bind it in the options section. The preset filter is a global property of +the entire agenda view. In a block agenda, it will not work reliably to +define a filter for one of the individual blocks. You need to set it in +the global options and expect it to be applied to the entire view.") + +(defvar org-agenda-regexp-filter-preset nil + "A preset of the regexp filter used for secondary agenda filtering. +This must be a list of strings, each string must be a single regexp +preceded by \"+\" or \"-\". +This variable should not be set directly, but agenda custom commands can +bind it in the options section. The preset filter is a global property of +the entire agenda view. In a block agenda, it will not work reliably to +define a filter for one of the individual blocks. You need to set it in +the global options and expect it to be applied to the entire view.") + +(defvar org-agenda-effort-filter-preset nil + "A preset of the effort condition used for secondary agenda filtering. +This must be a list of strings, each string must be a single regexp +preceded by \"+\" or \"-\". +This variable should not be set directly, but agenda custom commands can +bind it in the options section. The preset filter is a global property of +the entire agenda view. In a block agenda, it will not work reliably to +define a filter for one of the individual blocks. You need to set it in +the global options and expect it to be applied to the entire view.") + +(defun org-agenda-use-sticky-p () + "Return non-nil if an agenda buffer named +`org-agenda-buffer-name' exists and should be shown instead of +generating a new one." + (and + ;; turned off by user + org-agenda-sticky + ;; For multi-agenda buffer already exists + (not org-agenda-multi) + ;; 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) + (and + (equal current-prefix-arg + org-agenda-last-prefix-arg) + ;; In case user turned stickiness on, while having existing + ;; Agenda buffer active, don't reuse that buffer, because it + ;; does not have org variables local + org-agenda-this-buffer-is-sticky)))) + +(defvar org-agenda-buffer-tmp-name nil) + +(defun org-agenda--get-buffer-name (sticky-name) + (or org-agenda-buffer-tmp-name + (and org-agenda-doing-sticky-redo org-agenda-buffer-name) + sticky-name + "*Org Agenda*")) + +(defun org-agenda-prepare-window (abuf filter-alist) + "Setup agenda buffer in the window. +ABUF is the buffer for the agenda window. +FILTER-ALIST is an alist of filters we need to apply when +`org-agenda-persistent-filter' is non-nil." + (let* ((awin (get-buffer-window abuf)) wconf) + (cond + ((equal (current-buffer) abuf) nil) + (awin (select-window awin)) + ((not (setq wconf (current-window-configuration)))) + ((eq org-agenda-window-setup 'current-window) + (pop-to-buffer-same-window abuf)) + ((eq org-agenda-window-setup 'other-window) + (org-switch-to-buffer-other-window abuf)) + ((eq org-agenda-window-setup 'other-frame) + (switch-to-buffer-other-frame abuf)) + ((eq org-agenda-window-setup 'other-tab) + (if (fboundp 'switch-to-buffer-other-tab) + (switch-to-buffer-other-tab abuf) + (user-error "Your version of Emacs does not have tab bar support"))) + ((eq org-agenda-window-setup 'only-window) + (delete-other-windows) + (pop-to-buffer-same-window abuf)) + ((eq org-agenda-window-setup 'reorganize-frame) + (delete-other-windows) + (org-switch-to-buffer-other-window abuf))) + (setq org-agenda-tag-filter (cdr (assq 'tag filter-alist))) + (setq org-agenda-category-filter (cdr (assq 'cat filter-alist))) + (setq org-agenda-effort-filter (cdr (assq 'effort filter-alist))) + (setq org-agenda-regexp-filter (cdr (assq 're filter-alist))) + ;; Additional test in case agenda is invoked from within agenda + ;; buffer via elisp link. + (unless (equal (current-buffer) abuf) + (pop-to-buffer-same-window abuf)) + (setq org-agenda-pre-window-conf + (or wconf org-agenda-pre-window-conf)))) + +(defun org-agenda-prepare (&optional name) + (let ((filter-alist (when org-agenda-persistent-filter + (with-current-buffer + (get-buffer-create org-agenda-buffer-name) + `((tag . ,org-agenda-tag-filter) + (re . ,org-agenda-regexp-filter) + (effort . ,org-agenda-effort-filter) + (cat . ,org-agenda-category-filter)))))) + (if (org-agenda-use-sticky-p) + (progn + (put 'org-agenda-tag-filter :preset-filter nil) + (put 'org-agenda-category-filter :preset-filter nil) + (put 'org-agenda-regexp-filter :preset-filter nil) + (put 'org-agenda-effort-filter :preset-filter nil) + ;; Popup existing buffer + (org-agenda-prepare-window (get-buffer org-agenda-buffer-name) + filter-alist) + (message "Sticky Agenda buffer, use `r' to refresh") + (or org-agenda-multi (org-agenda-fit-window-to-buffer)) + (throw 'exit "Sticky Agenda buffer, use `r' to refresh")) + (setq org-todo-keywords-for-agenda nil) + (put 'org-agenda-tag-filter :preset-filter + org-agenda-tag-filter-preset) + (put 'org-agenda-category-filter :preset-filter + org-agenda-category-filter-preset) + (put 'org-agenda-regexp-filter :preset-filter + org-agenda-regexp-filter-preset) + (put 'org-agenda-effort-filter :preset-filter + org-agenda-effort-filter-preset) + (if org-agenda-multi + (progn + (setq buffer-read-only nil) + (goto-char (point-max)) + (unless (or (bobp) org-agenda-compact-blocks + (not org-agenda-block-separator)) + (insert "\n" + (if (stringp org-agenda-block-separator) + org-agenda-block-separator + (make-string (window-width) org-agenda-block-separator)) + "\n")) + (narrow-to-region (point) (point-max))) + (setq org-done-keywords-for-agenda nil) + ;; Setting any org variables that are in org-agenda-local-vars + ;; list need to be done after the prepare call + (org-agenda-prepare-window + (get-buffer-create org-agenda-buffer-name) filter-alist) + (setq buffer-read-only nil) + (org-agenda-reset-markers) + (let ((inhibit-read-only t)) (erase-buffer)) + (org-agenda-mode) + (setq org-agenda-buffer (current-buffer)) + (setq org-agenda-contributing-files nil) + (setq org-agenda-columns-active nil) + (org-agenda-prepare-buffers (org-agenda-files nil 'ifmode)) + (setq org-todo-keywords-for-agenda + (org-uniquify org-todo-keywords-for-agenda)) + (setq org-done-keywords-for-agenda + (org-uniquify org-done-keywords-for-agenda)) + (setq org-agenda-last-prefix-arg current-prefix-arg) + (setq org-agenda-this-buffer-name org-agenda-buffer-name) + (and name (not org-agenda-name) + (setq-local org-agenda-name name))) + (setq buffer-read-only nil)))) + +(defvar org-overriding-columns-format) +(defvar org-local-columns-format) +(defun org-agenda-finalize () + "Finishing touch for the agenda buffer. +This function is called just before displaying the agenda. If +you want to add your own functions to the finalization of the +agenda display, configure `org-agenda-finalize-hook'." + (unless org-agenda-multi + (let ((inhibit-read-only t)) + (save-excursion + (goto-char (point-min)) + (save-excursion + (while (org-activate-links (point-max)) + (goto-char (match-end 0)))) + (unless (eq org-agenda-remove-tags t) + (org-agenda-align-tags)) + (unless org-agenda-with-colors + (remove-text-properties (point-min) (point-max) '(face nil))) + (when (bound-and-true-p org-overriding-columns-format) + (setq-local org-local-columns-format + org-overriding-columns-format)) + (when org-agenda-view-columns-initially + (org-agenda-columns)) + (when org-agenda-fontify-priorities + (org-agenda-fontify-priorities)) + (when (and org-agenda-dim-blocked-tasks org-blocker-hook) + (org-agenda-dim-blocked-tasks)) + (org-agenda-mark-clocking-task) + (when org-agenda-entry-text-mode + (org-agenda-entry-text-hide) + (org-agenda-entry-text-show)) + (when (and (featurep 'org-habit) + (save-excursion (next-single-property-change (point-min) 'org-habit-p))) + (org-habit-insert-consistency-graphs)) + (setq org-agenda-type (org-get-at-bol 'org-agenda-type)) + (unless (or (eq org-agenda-show-inherited-tags 'always) + (and (listp org-agenda-show-inherited-tags) + (memq org-agenda-type org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (and (listp org-agenda-use-tag-inheritance) + (not (memq org-agenda-type + org-agenda-use-tag-inheritance)))))) + (let (mrk) + (save-excursion + (goto-char (point-min)) + (while (equal (forward-line) 0) + (when (setq mrk (get-text-property (point) 'org-hd-marker)) + (put-text-property (point-at-bol) (point-at-eol) + 'tags + (org-with-point-at mrk + (org-get-tags)))))))) + (setq org-agenda-represented-tags nil + org-agenda-represented-categories nil) + (when org-agenda-top-headline-filter + (org-agenda-filter-top-headline-apply + org-agenda-top-headline-filter)) + (when org-agenda-tag-filter + (org-agenda-filter-apply org-agenda-tag-filter 'tag t)) + (when (get 'org-agenda-tag-filter :preset-filter) + (org-agenda-filter-apply + (get 'org-agenda-tag-filter :preset-filter) 'tag t)) + (when org-agenda-category-filter + (org-agenda-filter-apply org-agenda-category-filter 'category)) + (when (get 'org-agenda-category-filter :preset-filter) + (org-agenda-filter-apply + (get 'org-agenda-category-filter :preset-filter) 'category)) + (when org-agenda-regexp-filter + (org-agenda-filter-apply org-agenda-regexp-filter 'regexp)) + (when (get 'org-agenda-regexp-filter :preset-filter) + (org-agenda-filter-apply + (get 'org-agenda-regexp-filter :preset-filter) 'regexp)) + (when org-agenda-effort-filter + (org-agenda-filter-apply org-agenda-effort-filter 'effort)) + (when (get 'org-agenda-effort-filter :preset-filter) + (org-agenda-filter-apply + (get 'org-agenda-effort-filter :preset-filter) 'effort)) + (add-hook 'kill-buffer-hook #'org-agenda-reset-markers 'append 'local)) + (run-hooks 'org-agenda-finalize-hook)))) + +(defun org-agenda-mark-clocking-task () + "Mark the current clock entry in the agenda if it is present." + ;; We need to widen when `org-agenda-finalize' is called from + ;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in'). + (when (bound-and-true-p org-clock-current-task) + (save-restriction + (widen) + (org-agenda-unmark-clocking-task) + (when (marker-buffer org-clock-hd-marker) + (save-excursion + (goto-char (point-min)) + (let (s ov) + (while (setq s (next-single-property-change (point) 'org-hd-marker)) + (goto-char s) + (when (equal (org-get-at-bol 'org-hd-marker) + org-clock-hd-marker) + (setq ov (make-overlay (point-at-bol) (1+ (point-at-eol)))) + (overlay-put ov 'type 'org-agenda-clocking) + (overlay-put ov 'face 'org-agenda-clocking) + (overlay-put ov 'help-echo + "The clock is running in this item"))))))))) + +(defun org-agenda-unmark-clocking-task () + "Unmark the current clocking task." + (mapc (lambda (o) + (when (eq (overlay-get o 'type) 'org-agenda-clocking) + (delete-overlay o))) + (overlays-in (point-min) (point-max)))) + +(defun org-agenda-fontify-priorities () + "Make highest priority lines bold, and lowest italic." + (interactive) + (mapc (lambda (o) (when (eq (overlay-get o 'org-type) 'org-priority) + (delete-overlay o))) + (overlays-in (point-min) (point-max))) + (save-excursion + (let (b e p ov h l) + (goto-char (point-min)) + (while (re-search-forward org-priority-regexp nil t) + (setq h (or (get-char-property (point) 'org-priority-highest) + org-priority-highest) + l (or (get-char-property (point) 'org-priority-lowest) + org-priority-lowest) + p (string-to-char (match-string 2)) + b (match-beginning 1) + e (if (eq org-agenda-fontify-priorities 'cookies) + (1+ (match-end 2)) + (point-at-eol)) + ov (make-overlay b e)) + (overlay-put + ov 'face + (let ((special-face + (cond ((org-face-from-face-or-color + 'priority 'org-priority + (cdr (assoc p org-priority-faces)))) + ((and (listp org-agenda-fontify-priorities) + (org-face-from-face-or-color + 'priority 'org-priority + (cdr (assoc p org-agenda-fontify-priorities))))) + ((equal p l) 'italic) + ((equal p h) 'bold)))) + (if special-face (list special-face 'org-priority) 'org-priority))) + (overlay-put ov 'org-type 'org-priority))))) + +(defvar org-depend-tag-blocked) + +(defun org-agenda-dim-blocked-tasks (&optional _invisible) + "Dim currently blocked TODOs in the agenda display. +When INVISIBLE is non-nil, hide currently blocked TODO instead of +dimming them." ;FIXME: The arg isn't used, actually! + (interactive "P") + (when (called-interactively-p 'interactive) + (message "Dim or hide blocked tasks...")) + (dolist (o (overlays-in (point-min) (point-max))) + (when (eq (overlay-get o 'face) 'org-agenda-dimmed-todo-face) + (delete-overlay o))) + (save-excursion + (let ((inhibit-read-only t)) + (goto-char (point-min)) + (while (let ((pos (text-property-not-all + (point) (point-max) 'org-todo-blocked nil))) + (when pos (goto-char pos))) + (let* ((invisible + (eq (org-get-at-bol 'org-todo-blocked) 'invisible)) + (todo-blocked + (eq (org-get-at-bol 'org-filter-type) 'todo-blocked)) + (ov (make-overlay (if invisible + (line-end-position 0) + (line-beginning-position)) + (line-end-position)))) + (when todo-blocked + (overlay-put ov 'face 'org-agenda-dimmed-todo-face)) + (when invisible + (org-agenda-filter-hide-line 'todo-blocked))) + (if (= (point-max) (line-end-position)) + (goto-char (point-max)) + (move-beginning-of-line 2))))) + (when (called-interactively-p 'interactive) + (message "Dim or hide blocked tasks...done"))) + +(defun org-agenda--mark-blocked-entry (entry) + "If ENTRY is blocked, mark it for fontification or invisibility. + +If the header at `org-hd-marker' is blocked according to +`org-entry-blocked-p', then if `org-agenda-dim-blocked-tasks' is +'invisible and the header is not blocked by checkboxes, set the +text property `org-todo-blocked' to `invisible', otherwise set it +to t." + (when (get-text-property 0 'todo-state entry) + (let ((entry-marker (get-text-property 0 'org-hd-marker entry)) + (org-blocked-by-checkboxes nil) + ;; Necessary so that `org-entry-blocked-p' does not change + ;; the buffer. + (org-depend-tag-blocked nil)) + (when entry-marker + (let ((blocked + (with-current-buffer (marker-buffer entry-marker) + (save-excursion + (goto-char entry-marker) + (org-entry-blocked-p))))) + (when blocked + (let ((really-invisible + (and (not org-blocked-by-checkboxes) + (eq org-agenda-dim-blocked-tasks 'invisible)))) + (put-text-property + 0 (length entry) 'org-todo-blocked + (if really-invisible 'invisible t) + entry) + (put-text-property + 0 (length entry) 'org-filter-type 'todo-blocked entry))))))) + entry) + +(defvar org-agenda-skip-function nil + "Function to be called at each match during agenda construction. +If this function returns nil, the current match should not be skipped. +Otherwise, the function must return a position from where the search +should be continued. +This may also be a Lisp form, it will be evaluated. +Never set this variable using `setq' or so, because then it will apply +to all future agenda commands. If you do want a global skipping condition, +use the option `org-agenda-skip-function-global' instead. +The correct usage for `org-agenda-skip-function' is to bind it with +`let' to scope it dynamically into the agenda-constructing command. +A good way to set it is through options in `org-agenda-custom-commands'.") + +(defun org-agenda-skip () + "Throw to `:skip' in places that should be skipped. +Also moves point to the end of the skipped region, so that search can +continue from there." + (let ((p (point-at-bol)) to) + (when (or + (save-excursion (goto-char p) (looking-at comment-start-skip)) + (and org-agenda-skip-archived-trees (not org-agenda-archives-mode) + (or (and (get-text-property p :org-archived) + (org-end-of-subtree t)) + (and (member org-archive-tag org-file-tags) + (goto-char (point-max))))) + (and org-agenda-skip-comment-trees + (get-text-property p :org-comment) + (org-end-of-subtree t)) + (and (setq to (or (org-agenda-skip-eval org-agenda-skip-function-global) + (org-agenda-skip-eval org-agenda-skip-function))) + (goto-char to)) + (org-in-src-block-p t)) + (throw :skip t)))) + +(defun org-agenda-skip-eval (form) + "If FORM is a function or a list, call (or eval) it and return the result. +`save-excursion' and `save-match-data' are wrapped around the call, so point +and match data are returned to the previous state no matter what these +functions do." + (let (fp) + (and form + (or (setq fp (functionp form)) + (consp form)) + (save-excursion + (save-match-data + (if fp + (funcall form) + (eval form t))))))) + +(defvar org-agenda-markers nil + "List of all currently active markers created by `org-agenda'.") +(defvar org-agenda-last-marker-time (float-time) + "Creation time of the last agenda marker.") + +(defun org-agenda-new-marker (&optional pos) + "Return a new agenda marker. +Marker is at point, or at POS if non-nil. Org mode keeps a list +of these markers and resets them when they are no longer in use." + (let ((m (copy-marker (or pos (point)) t))) + (setq org-agenda-last-marker-time (float-time)) + (if org-agenda-buffer + (with-current-buffer org-agenda-buffer + (push m org-agenda-markers)) + (push m org-agenda-markers)) + m)) + +(defun org-agenda-reset-markers () + "Reset markers created by `org-agenda'." + (while org-agenda-markers + (move-marker (pop org-agenda-markers) nil))) + +(defun org-agenda-save-markers-for-cut-and-paste (beg end) + "Save relative positions of markers in region. +This check for agenda markers in all agenda buffers currently active." + (dolist (buf (buffer-list)) + (with-current-buffer buf + (when (eq major-mode 'org-agenda-mode) + (mapc (lambda (m) (org-check-and-save-marker m beg end)) + org-agenda-markers))))) + +;;; Entry text mode + +(defun org-agenda-entry-text-show-here () + "Add some text from the entry as context to the current line." + (let (m txt o) + (setq m (org-get-at-bol 'org-hd-marker)) + (unless (marker-buffer m) + (error "No marker points to an entry here")) + (setq txt (concat "\n" (org-no-properties + (org-agenda-get-some-entry-text + m org-agenda-entry-text-maxlines + org-agenda-entry-text-leaders)))) + (when (string-match "\\S-" txt) + (setq o (make-overlay (point-at-bol) (point-at-eol))) + (overlay-put o 'evaporate t) + (overlay-put o 'org-overlay-type 'agenda-entry-content) + (overlay-put o 'after-string txt)))) + +(defun org-agenda-entry-text-show () + "Add entry context for all agenda lines." + (interactive) + (save-excursion + (goto-char (point-max)) + (beginning-of-line 1) + (while (not (bobp)) + (when (org-get-at-bol 'org-hd-marker) + (org-agenda-entry-text-show-here)) + (beginning-of-line 0)))) + +(defun org-agenda-entry-text-hide () + "Remove any shown entry context." + (mapc (lambda (o) + (when (eq (overlay-get o 'org-overlay-type) + 'agenda-entry-content) + (delete-overlay o))) + (overlays-in (point-min) (point-max)))) + +(defun org-agenda-get-day-face (date) + "Return the face DATE should be displayed with." + (cond ((and (functionp org-agenda-day-face-function) + (funcall org-agenda-day-face-function date))) + ((and (org-agenda-today-p date) + (memq (calendar-day-of-week date) org-agenda-weekend-days)) + 'org-agenda-date-weekend-today) + ((org-agenda-today-p date) 'org-agenda-date-today) + ((memq (calendar-day-of-week date) org-agenda-weekend-days) + 'org-agenda-date-weekend) + (t 'org-agenda-date))) + +(defvar org-agenda-show-log-scoped) + +;;; Agenda Daily/Weekly + +(defvar org-agenda-start-day nil ; dynamically scoped parameter + "Start day for the agenda view. +Custom commands can set this variable in the options section. +This is usually a string like \"2007-11-01\", \"+2d\" or any other +input allowed when reading a date through the Org calendar. +See the docstring of `org-read-date' for details.") +(defvar org-starting-day nil) ; local variable in the agenda buffer +(defvar org-arg-loc nil) ; local variable + +;;;###autoload +(defun org-agenda-list (&optional arg start-day span with-hour) + "Produce a daily/weekly view from all files in variable `org-agenda-files'. +The view will be for the current day or week, but from the overview buffer +you will be able to go to other days/weeks. + +With a numeric prefix argument in an interactive call, the agenda will +span ARG days. Lisp programs should instead specify SPAN to change +the number of days. SPAN defaults to `org-agenda-span'. + +START-DAY defaults to TODAY, or to the most recent match for the weekday +given in `org-agenda-start-on-weekday'. + +When WITH-HOUR is non-nil, only include scheduled and deadline +items if they have an hour specification like [h]h:mm." + (interactive "P") + (when org-agenda-overriding-arguments + (setq arg (car org-agenda-overriding-arguments) + start-day (nth 1 org-agenda-overriding-arguments) + span (nth 2 org-agenda-overriding-arguments))) + (when (and (integerp arg) (> arg 0)) + (setq span arg arg nil)) + (when (numberp span) + (unless (< 0 span) + (user-error "Agenda creation impossible for this span(=%d days)" span))) + (catch 'exit + (setq org-agenda-buffer-name + (org-agenda--get-buffer-name + (and org-agenda-sticky + (cond ((and org-keys (stringp org-match)) + (format "*Org Agenda(%s:%s)*" org-keys org-match)) + (org-keys + (format "*Org Agenda(%s)*" org-keys)) + (t "*Org Agenda(a)*"))))) + (org-agenda-prepare "Day/Week") + (setq start-day (or start-day org-agenda-start-day)) + (when (stringp start-day) + ;; Convert to an absolute day number + (setq start-day (time-to-days (org-read-date nil t start-day)))) + (org-compile-prefix-format 'agenda) + (org-set-sorting-strategy 'agenda) + (let* ((span (org-agenda-ndays-to-span (or span org-agenda-span))) + (today (org-today)) + (sd (or start-day today)) + (ndays (org-agenda-span-to-ndays span sd)) + (org-agenda-start-on-weekday + (and (or (eq ndays 7) (eq ndays 14)) + org-agenda-start-on-weekday)) + (thefiles (org-agenda-files nil 'ifmode)) + (files thefiles) + (start (if (or (null org-agenda-start-on-weekday) + (< ndays 7)) + sd + (let* ((nt (calendar-day-of-week + (calendar-gregorian-from-absolute sd))) + (n1 org-agenda-start-on-weekday) + (d (- nt n1))) + (- sd (+ (if (< d 0) 7 0) d))))) + (day-numbers (list start)) + (day-cnt 0) + (inhibit-redisplay (not debug-on-error)) + (org-agenda-show-log-scoped org-agenda-show-log) + s rtn rtnall file date d start-pos end-pos todayp ;; e + clocktable-start clocktable-end) ;; filter + (setq org-agenda-redo-command + (list 'org-agenda-list (list 'quote arg) start-day (list 'quote span) with-hour)) + (dotimes (_ (1- ndays)) + (push (1+ (car day-numbers)) day-numbers)) + (setq day-numbers (nreverse day-numbers)) + (setq clocktable-start (car day-numbers) + clocktable-end (1+ (or (org-last day-numbers) 0))) + (setq-local org-starting-day (car day-numbers)) + (setq-local org-arg-loc arg) + (setq-local org-agenda-current-span (org-agenda-ndays-to-span span)) + (unless org-agenda-compact-blocks + (let* ((d1 (car day-numbers)) + (d2 (org-last day-numbers)) + (w1 (org-days-to-iso-week d1)) + (w2 (org-days-to-iso-week d2))) + (setq s (point)) + (org-agenda--insert-overriding-header + (concat (org-agenda-span-name span) + "-agenda" + (cond ((<= 350 (- d2 d1)) "") + ((= w1 w2) (format " (W%02d)" w1)) + (t (format " (W%02d-W%02d)" w1 w2))) + ":\n"))) + ;; Add properties if we actually inserted a header. + (when (> (point) s) + (add-text-properties s (1- (point)) + (list 'face 'org-agenda-structure + 'org-date-line t)) + (org-agenda-mark-header-line s))) + (while (setq d (pop day-numbers)) + (setq date (calendar-gregorian-from-absolute d) + s (point)) + (if (or (setq todayp (= d today)) + (and (not start-pos) (= d sd))) + (setq start-pos (point)) + (when (and start-pos (not end-pos)) + (setq end-pos (point)))) + (setq files thefiles + rtnall nil) + (while (setq file (pop files)) + (catch 'nextfile + (org-check-agenda-file file) + (let ((org-agenda-entry-types org-agenda-entry-types)) + ;; Starred types override non-starred equivalents + (when (member :deadline* org-agenda-entry-types) + (setq org-agenda-entry-types + (delq :deadline org-agenda-entry-types))) + (when (member :scheduled* org-agenda-entry-types) + (setq org-agenda-entry-types + (delq :scheduled org-agenda-entry-types))) + ;; Honor with-hour + (when with-hour + (when (member :deadline org-agenda-entry-types) + (setq org-agenda-entry-types + (delq :deadline org-agenda-entry-types)) + (push :deadline* org-agenda-entry-types)) + (when (member :scheduled org-agenda-entry-types) + (setq org-agenda-entry-types + (delq :scheduled org-agenda-entry-types)) + (push :scheduled* org-agenda-entry-types))) + (unless org-agenda-include-deadlines + (setq org-agenda-entry-types + (delq :deadline* (delq :deadline org-agenda-entry-types)))) + (cond + ((memq org-agenda-show-log-scoped '(only clockcheck)) + (setq rtn (org-agenda-get-day-entries + file date :closed))) + (org-agenda-show-log-scoped + (setq rtn (apply #'org-agenda-get-day-entries + file date + (append '(:closed) org-agenda-entry-types)))) + (t + (setq rtn (apply #'org-agenda-get-day-entries + file date + org-agenda-entry-types))))) + (setq rtnall (append rtnall rtn)))) ;; all entries + (when org-agenda-include-diary + (let ((org-agenda-search-headline-for-time t)) + (require 'diary-lib) + (setq rtn (org-get-entries-from-diary date)) + (setq rtnall (append rtnall rtn)))) + (when (or rtnall org-agenda-show-all-dates) + (setq day-cnt (1+ day-cnt)) + (insert + (if (stringp org-agenda-format-date) + (format-time-string org-agenda-format-date + (org-time-from-absolute date)) + (funcall org-agenda-format-date date)) + "\n") + (put-text-property s (1- (point)) 'face + (org-agenda-get-day-face date)) + (put-text-property s (1- (point)) 'org-date-line t) + (put-text-property s (1- (point)) 'org-agenda-date-header t) + (put-text-property s (1- (point)) 'org-day-cnt day-cnt) + (when todayp + (put-text-property s (1- (point)) 'org-today t)) + (setq rtnall + (org-agenda-add-time-grid-maybe rtnall ndays todayp)) + (when rtnall (insert ;; all entries + (org-agenda-finalize-entries rtnall 'agenda) + "\n")) + (put-text-property s (1- (point)) 'day d) + (put-text-property s (1- (point)) 'org-day-cnt day-cnt))) + (when (and org-agenda-clockreport-mode clocktable-start) + (let ((org-agenda-files (org-agenda-files nil 'ifmode)) + ;; the above line is to ensure the restricted range! + (p (copy-sequence org-agenda-clockreport-parameter-plist)) + tbl) + (setq p (org-plist-delete p :block)) + (setq p (plist-put p :tstart clocktable-start)) + (setq p (plist-put p :tend clocktable-end)) + (setq p (plist-put p :scope 'agenda)) + (setq tbl (apply #'org-clock-get-clocktable p)) + (insert tbl))) + (goto-char (point-min)) + (or org-agenda-multi (org-agenda-fit-window-to-buffer)) + (unless (or (not (get-buffer-window org-agenda-buffer-name)) + (and (pos-visible-in-window-p (point-min)) + (pos-visible-in-window-p (point-max)))) + (goto-char (1- (point-max))) + (recenter -1) + (when (not (pos-visible-in-window-p (or start-pos 1))) + (goto-char (or start-pos 1)) + (recenter 1))) + (goto-char (or start-pos 1)) + (add-text-properties (point-min) (point-max) + `(org-agenda-type agenda + org-last-args (,arg ,start-day ,span) + org-redo-cmd ,org-agenda-redo-command + org-series-cmd ,org-cmd)) + (when (eq org-agenda-show-log-scoped 'clockcheck) + (org-agenda-show-clocking-issues)) + (org-agenda-finalize) + (setq buffer-read-only t) + (message "")))) + +(defun org-agenda-ndays-to-span (n) + "Return a span symbol for a span of N days, or N if none matches." + (cond ((symbolp n) n) + ((= n 1) 'day) + ((= n 7) 'week) + ((= n 14) 'fortnight) + (t n))) + +(defun org-agenda-span-to-ndays (span &optional start-day) + "Return ndays from SPAN, possibly starting at START-DAY. +START-DAY is an absolute time value." + (cond ((numberp span) span) + ((eq span 'day) 1) + ((eq span 'week) 7) + ((eq span 'fortnight) 14) + ((eq span 'month) + (let ((date (calendar-gregorian-from-absolute start-day))) + (calendar-last-day-of-month (car date) (cl-caddr date)))) + ((eq span 'year) + (let ((date (calendar-gregorian-from-absolute start-day))) + (if (calendar-leap-year-p (cl-caddr date)) 366 365))))) + +(defun org-agenda-span-name (span) + "Return a SPAN name." + (if (null span) + "" + (if (symbolp span) + (capitalize (symbol-name span)) + (format "%d days" span)))) + +;;; Agenda word search + +(defvar org-agenda-search-history nil) + +(defvar org-search-syntax-table nil + "Special syntax table for Org search. +In this table, we have single quotes not as word constituents, to +that when \"+Ameli\" is searched as a work, it will also match \"Ameli's\"") + +(defvar org-mode-syntax-table) ; From org.el +(defun org-search-syntax-table () + (unless org-search-syntax-table + (setq org-search-syntax-table (copy-syntax-table org-mode-syntax-table)) + (modify-syntax-entry ?' "." org-search-syntax-table) + (modify-syntax-entry ?` "." org-search-syntax-table)) + org-search-syntax-table) + +(defvar org-agenda-last-search-view-search-was-boolean nil) + +;;;###autoload +(defun org-search-view (&optional todo-only string edit-at) + "Show all entries that contain a phrase or words or regular expressions. + +With optional prefix argument TODO-ONLY, only consider entries that are +TODO entries. The argument STRING can be used to pass a default search +string into this function. If EDIT-AT is non-nil, it means that the +user should get a chance to edit this string, with cursor at position +EDIT-AT. + +The search string can be viewed either as a phrase that should be found as +is, or it can be broken into a number of snippets, each of which must match +in a Boolean way to select an entry. The default depends on the variable +`org-agenda-search-view-always-boolean'. +Even if this is turned off (the default) you can always switch to +Boolean search dynamically by preceding the first word with \"+\" or \"-\". + +The default is a direct search of the whole phrase, where each space in +the search string can expand to an arbitrary amount of whitespace, +including newlines. + +If using a Boolean search, the search string is split on whitespace and +each snippet is searched separately, with logical AND to select an entry. +Words prefixed with a minus must *not* occur in the entry. Words without +a prefix or prefixed with a plus must occur in the entry. Matching is +case-insensitive. Words are enclosed by word delimiters (i.e. they must +match whole words, not parts of a word) if +`org-agenda-search-view-force-full-words' is set (default is nil). + +Boolean search snippets enclosed by curly braces are interpreted as +regular expressions that must or (when preceded with \"-\") must not +match in the entry. Snippets enclosed into double quotes will be taken +as a whole, to include whitespace. + +- If the search string starts with an asterisk, search only in headlines. +- If (possibly after the leading star) the search string starts with an + exclamation mark, this also means to look at TODO entries only, an effect + that can also be achieved with a prefix argument. +- If (possibly after star and exclamation mark) the search string starts + with a colon, this will mean that the (non-regexp) snippets of the + Boolean search must match as full words. + +This command searches the agenda files, and in addition the files +listed in `org-agenda-text-search-extra-files' unless a restriction lock +is active." + (interactive "P") + (when org-agenda-overriding-arguments + (setq todo-only (car org-agenda-overriding-arguments) + string (nth 1 org-agenda-overriding-arguments) + edit-at (nth 2 org-agenda-overriding-arguments))) + (let* ((props (list 'face nil + 'done-face 'org-agenda-done + 'org-not-done-regexp org-not-done-regexp + 'org-todo-regexp org-todo-regexp + 'org-complex-heading-regexp org-complex-heading-regexp + 'mouse-face 'highlight + 'help-echo "mouse-2 or RET jump to location")) + (full-words org-agenda-search-view-force-full-words) + (org-agenda-text-search-extra-files org-agenda-text-search-extra-files) + regexp rtn rtnall files file pos inherited-tags + marker category level tags c neg re boolean + ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) + (unless (and (not edit-at) + (stringp string) + (string-match "\\S-" string)) + (setq string (read-string + (if org-agenda-search-view-always-boolean + "[+-]Word/{Regexp} ...: " + "Phrase or [+-]Word/{Regexp} ...: ") + (cond + ((integerp edit-at) (cons string edit-at)) + (edit-at string)) + 'org-agenda-search-history))) + (catch 'exit + (setq org-agenda-buffer-name + (org-agenda--get-buffer-name + (and org-agenda-sticky + (if (stringp string) + (format "*Org Agenda(%s:%s)*" + (or org-keys (or (and todo-only "S") "s")) + string) + (format "*Org Agenda(%s)*" + (or (and todo-only "S") "s")))))) + (org-agenda-prepare "SEARCH") + (org-compile-prefix-format 'search) + (org-set-sorting-strategy 'search) + (setq org-agenda-redo-command + (list 'org-search-view (if todo-only t nil) + (list 'if 'current-prefix-arg nil string))) + (setq org-agenda-query-string string) + (if (equal (string-to-char string) ?*) + (setq hdl-only t + words (substring string 1)) + (setq words string)) + (when (equal (string-to-char words) ?!) + (setq todo-only t + words (substring words 1))) + (when (equal (string-to-char words) ?:) + (setq full-words t + words (substring words 1))) + (when (or org-agenda-search-view-always-boolean + (member (string-to-char words) '(?- ?+ ?\{))) + (setq boolean t)) + (setq words (split-string words)) + (let (www w) + (while (setq w (pop words)) + (while (and (string-match "\\\\\\'" w) words) + (setq w (concat (substring w 0 -1) " " (pop words)))) + (push w www)) + (setq words (nreverse www) www nil) + (while (setq w (pop words)) + (when (and (string-match "\\`[-+]?{" w) + (not (string-match "}\\'" w))) + (while (and words (not (string-match "}\\'" (car words)))) + (setq w (concat w " " (pop words)))) + (setq w (concat w " " (pop words)))) + (push w www)) + (setq words (nreverse www))) + (setq org-agenda-last-search-view-search-was-boolean boolean) + (when boolean + (let (wds w) + (while (setq w (pop words)) + (when (or (equal (substring w 0 1) "\"") + (and (> (length w) 1) + (member (substring w 0 1) '("+" "-")) + (equal (substring w 1 2) "\""))) + (while (and words (not (equal (substring w -1) "\""))) + (setq w (concat w " " (pop words))))) + (and (string-match "\\`\\([-+]?\\)\"" w) + (setq w (replace-match "\\1" nil nil w))) + (and (equal (substring w -1) "\"") (setq w (substring w 0 -1))) + (push w wds)) + (setq words (nreverse wds)))) + (if boolean + (mapc (lambda (w) + (setq c (string-to-char w)) + (if (equal c ?-) + (setq neg t w (substring w 1)) + (if (equal c ?+) + (setq neg nil w (substring w 1)) + (setq neg nil))) + (if (string-match "\\`{.*}\\'" w) + (setq re (substring w 1 -1)) + (if full-words + (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>")) + (setq re (regexp-quote (downcase w))))) + (if neg (push re regexps-) (push re regexps+))) + words) + (push (mapconcat #'regexp-quote words "\\s-+") + regexps+)) + (setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b))))) + (if (not regexps+) + (setq regexp org-outline-regexp-bol) + (setq regexp (pop regexps+)) + (when hdl-only (setq regexp (concat org-outline-regexp-bol ".*?" + regexp)))) + (setq files (org-agenda-files nil 'ifmode)) + ;; Add `org-agenda-text-search-extra-files' unless there is some + ;; restriction. + (when (eq (car org-agenda-text-search-extra-files) 'agenda-archives) + (pop org-agenda-text-search-extra-files) + (unless (get 'org-agenda-files 'org-restrict) + (setq files (org-add-archive-files files)))) + ;; Uniquify files. However, let `org-check-agenda-file' handle + ;; non-existent ones. + (setq files (cl-remove-duplicates + (append files org-agenda-text-search-extra-files) + :test (lambda (a b) + (and (file-exists-p a) + (file-exists-p b) + (file-equal-p a b)))) + rtnall nil) + (while (setq file (pop files)) + (setq ee nil) + (catch 'nextfile + (org-check-agenda-file file) + (setq buffer (if (file-exists-p file) + (org-get-agenda-file-buffer file) + (error "No such file %s" file))) + (unless buffer + ;; If file does not exist, make sure an error message is sent + (setq rtn (list (format "ORG-AGENDA-ERROR: No such org-file %s" + file)))) + (with-current-buffer buffer + (with-syntax-table (org-search-syntax-table) + (unless (derived-mode-p 'org-mode) + (error "Agenda file %s is not in Org mode" file)) + (let ((case-fold-search t)) + (save-excursion + (save-restriction + (if (eq buffer org-agenda-restrict) + (narrow-to-region org-agenda-restrict-begin + org-agenda-restrict-end) + (widen)) + (goto-char (point-min)) + (unless (or (org-at-heading-p) + (outline-next-heading)) + (throw 'nextfile t)) + (goto-char (max (point-min) (1- (point)))) + (while (re-search-forward regexp nil t) + (org-back-to-heading t) + (while (and (not (zerop org-agenda-search-view-max-outline-level)) + (> (org-reduced-level (org-outline-level)) + org-agenda-search-view-max-outline-level) + (forward-line -1) + (org-back-to-heading t))) + (skip-chars-forward "* ") + (setq beg (point-at-bol) + beg1 (point) + end (progn + (outline-next-heading) + (while (and (not (zerop org-agenda-search-view-max-outline-level)) + (> (org-reduced-level (org-outline-level)) + org-agenda-search-view-max-outline-level) + (forward-line 1) + (outline-next-heading))) + (point))) + + (catch :skip + (goto-char beg) + (org-agenda-skip) + (setq str (buffer-substring-no-properties + (point-at-bol) + (if hdl-only (point-at-eol) end))) + (mapc (lambda (wr) (when (string-match wr str) + (goto-char (1- end)) + (throw :skip t))) + regexps-) + (mapc (lambda (wr) (unless (string-match wr str) + (goto-char (1- end)) + (throw :skip t))) + (if todo-only + (cons (concat "^\\*+[ \t]+" + org-not-done-regexp) + regexps+) + regexps+)) + (goto-char beg) + (setq marker (org-agenda-new-marker (point)) + category (org-get-category) + level (make-string (org-reduced-level (org-outline-level)) ? ) + inherited-tags + (or (eq org-agenda-show-inherited-tags 'always) + (and (listp org-agenda-show-inherited-tags) + (memq 'todo org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (memq 'todo org-agenda-use-tag-inheritance)))) + tags (org-get-tags nil (not inherited-tags)) + txt (org-agenda-format-item + "" + (buffer-substring-no-properties + beg1 (point-at-eol)) + level category tags t)) + (org-add-props txt props + 'org-marker marker 'org-hd-marker marker + 'org-todo-regexp org-todo-regexp + 'level level + 'org-complex-heading-regexp org-complex-heading-regexp + 'priority 1000 + 'type "search") + (push txt ee) + (goto-char (1- end)))))))))) + (setq rtn (nreverse ee)) + (setq rtnall (append rtnall rtn))) + (org-agenda--insert-overriding-header + (with-temp-buffer + (insert "Search words: ") + (add-text-properties (point-min) (1- (point)) + (list 'face 'org-agenda-structure)) + (setq pos (point)) + (insert string "\n") + (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure-filter)) + (setq pos (point)) + (unless org-agenda-multi + (insert (substitute-command-keys "\\\ +Press `\\[org-agenda-manipulate-query-add]', \ +`\\[org-agenda-manipulate-query-subtract]' to add/sub word, \ +`\\[org-agenda-manipulate-query-add-re]', \ +`\\[org-agenda-manipulate-query-subtract-re]' to add/sub regexp, \ +`\\[universal-argument] \\[org-agenda-redo]' for a fresh search\n")) + (add-text-properties pos (1- (point)) + (list 'face 'org-agenda-structure-secondary))) + (buffer-string))) + (org-agenda-mark-header-line (point-min)) + (when rtnall + (insert (org-agenda-finalize-entries rtnall 'search) "\n")) + (goto-char (point-min)) + (or org-agenda-multi (org-agenda-fit-window-to-buffer)) + (add-text-properties (point-min) (point-max) + `(org-agenda-type search + org-last-args (,todo-only ,string ,edit-at) + org-redo-cmd ,org-agenda-redo-command + org-series-cmd ,org-cmd)) + (org-agenda-finalize) + (setq buffer-read-only t)))) + +;;; Agenda TODO list + +(defun org-agenda-propertize-selected-todo-keywords (keywords) + "Use `org-todo-keyword-faces' for the selected todo KEYWORDS." + (concat + (if (or (equal keywords "ALL") (not keywords)) + (propertize "ALL" 'face 'org-agenda-structure-filter) + (mapconcat + (lambda (kw) + (propertize kw 'face (list (org-get-todo-face kw) 'org-agenda-structure))) + (org-split-string keywords "|") + "|")) + "\n")) + +(defvar org-select-this-todo-keyword nil) +(defvar org-last-arg nil) + +(defvar crm-separator) + +;;;###autoload +(defun org-todo-list (&optional arg) + "Show all (not done) TODO entries from all agenda file in a single list. +The prefix arg can be used to select a specific TODO keyword and limit +the list to these. When using `\\[universal-argument]', you will be prompted +for a keyword. A numeric prefix directly selects the Nth keyword in +`org-todo-keywords-1'." + (interactive "P") + (when org-agenda-overriding-arguments + (setq arg org-agenda-overriding-arguments)) + (when (and (stringp arg) (not (string-match "\\S-" arg))) (setq arg nil)) + (let* ((today (org-today)) + (date (calendar-gregorian-from-absolute today)) + (completion-ignore-case t) + kwds org-select-this-todo-keyword rtn rtnall files file pos) + (catch 'exit + (setq org-agenda-buffer-name + (org-agenda--get-buffer-name + (and org-agenda-sticky + (if (stringp org-select-this-todo-keyword) + (format "*Org Agenda(%s:%s)*" (or org-keys "t") + org-select-this-todo-keyword) + (format "*Org Agenda(%s)*" (or org-keys "t")))))) + (org-agenda-prepare "TODO") + (setq kwds org-todo-keywords-for-agenda + org-select-this-todo-keyword (if (stringp arg) arg + (and (integerp arg) + (> arg 0) + (nth (1- arg) kwds)))) + (when (equal arg '(4)) + (setq org-select-this-todo-keyword + (mapconcat #'identity + (let ((crm-separator "|")) + (completing-read-multiple + "Keyword (or KWD1|KWD2|...): " + (mapcar #'list kwds) nil nil)) + "|"))) + (and (equal 0 arg) (setq org-select-this-todo-keyword nil)) + (org-compile-prefix-format 'todo) + (org-set-sorting-strategy 'todo) + (setq org-agenda-redo-command + `(org-todo-list (or (and (numberp current-prefix-arg) + current-prefix-arg) + ,org-select-this-todo-keyword + current-prefix-arg ,arg))) + (setq files (org-agenda-files nil 'ifmode) + rtnall nil) + (while (setq file (pop files)) + (catch 'nextfile + (org-check-agenda-file file) + (setq rtn (org-agenda-get-day-entries file date :todo)) + (setq rtnall (append rtnall rtn)))) + (org-agenda--insert-overriding-header + (with-temp-buffer + (insert "Global list of TODO items of type: ") + (add-text-properties (point-min) (1- (point)) + (list 'face 'org-agenda-structure + 'short-heading + (concat "ToDo: " + (or org-select-this-todo-keyword "ALL")))) + (org-agenda-mark-header-line (point-min)) + (insert (org-agenda-propertize-selected-todo-keywords + org-select-this-todo-keyword)) + (setq pos (point)) + (unless org-agenda-multi + (insert (substitute-command-keys "Press \ +\\`N \\[org-agenda-redo]' (e.g. `0 \\[org-agenda-redo]') \ +to search again: (0)[ALL]")) + (let ((n 0)) + (dolist (k kwds) + (let ((s (format "(%d)%s" (cl-incf n) k))) + (when (> (+ (current-column) (string-width s) 1) (window-width)) + (insert "\n ")) + (insert " " s)))) + (insert "\n")) + (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure-secondary)) + (buffer-string))) + (org-agenda-mark-header-line (point-min)) + (when rtnall + (insert (org-agenda-finalize-entries rtnall 'todo) "\n")) + (goto-char (point-min)) + (or org-agenda-multi (org-agenda-fit-window-to-buffer)) + (add-text-properties (point-min) (point-max) + `(org-agenda-type todo + org-last-args ,arg + org-redo-cmd ,org-agenda-redo-command + org-series-cmd ,org-cmd)) + (org-agenda-finalize) + (setq buffer-read-only t)))) + +;;; Agenda tags match + +;;;###autoload +(defun org-tags-view (&optional todo-only match) + "Show all headlines for all `org-agenda-files' matching a TAGS criterion. +The prefix arg TODO-ONLY limits the search to TODO entries." + (interactive "P") + (when org-agenda-overriding-arguments + (setq todo-only (car org-agenda-overriding-arguments) + match (nth 1 org-agenda-overriding-arguments))) + (let* ((org-tags-match-list-sublevels + org-tags-match-list-sublevels) + (completion-ignore-case t) + (org--matcher-tags-todo-only todo-only) + rtn rtnall files file pos matcher + buffer) + (when (and (stringp match) (not (string-match "\\S-" match))) + (setq match nil)) + (catch 'exit + (setq org-agenda-buffer-name + (org-agenda--get-buffer-name + (and org-agenda-sticky + (if (stringp match) + (format "*Org Agenda(%s:%s)*" + (or org-keys (or (and todo-only "M") "m")) + match) + (format "*Org Agenda(%s)*" + (or (and todo-only "M") "m")))))) + (setq matcher (org-make-tags-matcher match)) + ;; Prepare agendas (and `org-tag-alist-for-agenda') before + ;; expanding tags within `org-make-tags-matcher' + (org-agenda-prepare (concat "TAGS " match)) + (setq match (car matcher) + matcher (cdr matcher)) + (org-compile-prefix-format 'tags) + (org-set-sorting-strategy 'tags) + (setq org-agenda-query-string match) + (setq org-agenda-redo-command + (list 'org-tags-view + `(quote ,org--matcher-tags-todo-only) + `(if current-prefix-arg nil ,org-agenda-query-string))) + (setq files (org-agenda-files nil 'ifmode) + rtnall nil) + (while (setq file (pop files)) + (catch 'nextfile + (org-check-agenda-file file) + (setq buffer (if (file-exists-p file) + (org-get-agenda-file-buffer file) + (error "No such file %s" file))) + (if (not buffer) + ;; If file does not exist, error message to agenda + (setq rtn (list + (format "ORG-AGENDA-ERROR: No such org-file %s" file)) + rtnall (append rtnall rtn)) + (with-current-buffer buffer + (unless (derived-mode-p 'org-mode) + (error "Agenda file %s is not in Org mode" file)) + (save-excursion + (save-restriction + (if (eq buffer org-agenda-restrict) + (narrow-to-region org-agenda-restrict-begin + org-agenda-restrict-end) + (widen)) + (setq rtn (org-scan-tags 'agenda + matcher + org--matcher-tags-todo-only)) + (setq rtnall (append rtnall rtn)))))))) + (org-agenda--insert-overriding-header + (with-temp-buffer + (insert "Headlines with TAGS match: ") + (add-text-properties (point-min) (1- (point)) + (list 'face 'org-agenda-structure + 'short-heading + (concat "Match: " match))) + (setq pos (point)) + (insert match "\n") + (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure-filter)) + (setq pos (point)) + (unless org-agenda-multi + (insert (substitute-command-keys + "Press \ +\\`\\[universal-argument] \\[org-agenda-redo]' \ +to search again\n"))) + (add-text-properties pos (1- (point)) + (list 'face 'org-agenda-structure-secondary)) + (buffer-string))) + (org-agenda-mark-header-line (point-min)) + (when rtnall + (insert (org-agenda-finalize-entries rtnall 'tags) "\n")) + (goto-char (point-min)) + (or org-agenda-multi (org-agenda-fit-window-to-buffer)) + (add-text-properties + (point-min) (point-max) + `(org-agenda-type tags + org-last-args (,org--matcher-tags-todo-only ,match) + org-redo-cmd ,org-agenda-redo-command + org-series-cmd ,org-cmd)) + (org-agenda-finalize) + (setq buffer-read-only t)))) + +;;; Agenda Finding stuck projects + +(defvar org-agenda-skip-regexp nil + "Regular expression used in skipping subtrees for the agenda. +This is basically a temporary global variable that can be set and then +used by user-defined selections using `org-agenda-skip-function'.") + +(defvar org-agenda-overriding-header nil + "When set during agenda, todo and tags searches it replaces the header. +If an empty string, no header will be inserted. If any other +string, it will be inserted as a header. If a function, insert +the string returned by the function as a header. If nil, a +header will be generated automatically according to the command. +This variable should not be set directly, but custom commands can +bind it in the options section.") + +(defun org-agenda-skip-entry-if (&rest conditions) + "Skip entry if any of CONDITIONS is true. +See `org-agenda-skip-if' for details." + (org-agenda-skip-if nil conditions)) + +(defun org-agenda-skip-subtree-if (&rest conditions) + "Skip subtree if any of CONDITIONS is true. +See `org-agenda-skip-if' for details." + (org-agenda-skip-if t conditions)) + +(defun org-agenda-skip-if (subtree conditions) + "Check current entity for CONDITIONS. +If SUBTREE is non-nil, the entire subtree is checked. Otherwise, only +the entry (i.e. the text before the next heading) is checked. + +CONDITIONS is a list of symbols, boolean OR is used to combine the results +from different tests. Valid conditions are: + +scheduled Check if there is a scheduled cookie +notscheduled Check if there is no scheduled cookie +deadline Check if there is a deadline +notdeadline Check if there is no deadline +timestamp Check if there is a timestamp (also deadline or scheduled) +nottimestamp Check if there is no timestamp (also deadline or scheduled) +regexp Check if regexp matches +notregexp Check if regexp does not match. +todo Check if TODO keyword matches +nottodo Check if TODO keyword does not match + +The regexp is taken from the conditions list, it must come right after +the `regexp' or `notregexp' element. + +`todo' and `nottodo' accept as an argument a list of todo +keywords, which may include \"*\" to match any todo keyword. + + (org-agenda-skip-entry-if \\='todo \\='(\"TODO\" \"WAITING\")) + +would skip all entries with \"TODO\" or \"WAITING\" keywords. + +Instead of a list, a keyword class may be given. For example: + + (org-agenda-skip-entry-if \\='nottodo \\='done) + +would skip entries that haven't been marked with any of \"DONE\" +keywords. Possible classes are: `todo', `done', `any'. + +If any of these conditions is met, this function returns the end point of +the entity, causing the search to continue from there. This is a function +that can be put into `org-agenda-skip-function' for the duration of a command." + (org-back-to-heading t) + (let* (;; (beg (point)) + (end (if subtree (save-excursion (org-end-of-subtree t) (point)) + (org-entry-end-position))) + (planning-end (if subtree end (line-end-position 2))) + m) + (and + (or (and (memq 'scheduled conditions) + (re-search-forward org-scheduled-time-regexp planning-end t)) + (and (memq 'notscheduled conditions) + (not + (save-excursion + (re-search-forward org-scheduled-time-regexp planning-end t)))) + (and (memq 'deadline conditions) + (re-search-forward org-deadline-time-regexp planning-end t)) + (and (memq 'notdeadline conditions) + (not + (save-excursion + (re-search-forward org-deadline-time-regexp planning-end t)))) + (and (memq 'timestamp conditions) + (re-search-forward org-ts-regexp end t)) + (and (memq 'nottimestamp conditions) + (not (save-excursion (re-search-forward org-ts-regexp end t)))) + (and (setq m (memq 'regexp conditions)) + (stringp (nth 1 m)) + (re-search-forward (nth 1 m) end t)) + (and (setq m (memq 'notregexp conditions)) + (stringp (nth 1 m)) + (not (save-excursion (re-search-forward (nth 1 m) end t)))) + (and (or + (setq m (memq 'nottodo conditions)) + (setq m (memq 'todo-unblocked conditions)) + (setq m (memq 'nottodo-unblocked conditions)) + (setq m (memq 'todo conditions))) + (org-agenda-skip-if-todo m end))) + end))) + +(defun org-agenda-skip-if-todo (args end) + "Helper function for `org-agenda-skip-if', do not use it directly. +ARGS is a list with first element either `todo', `nottodo', +`todo-unblocked' or `nottodo-unblocked'. The remainder is either +a list of TODO keywords, or a state symbol `todo' or `done' or +`any'." + (let ((todo-re + (concat "^\\*+[ \t]+" + (regexp-opt + (pcase args + (`(,_ todo) + (org-delete-all org-done-keywords + (copy-sequence org-todo-keywords-1))) + (`(,_ done) org-done-keywords) + (`(,_ any) org-todo-keywords-1) + (`(,_ ,(pred atom)) + (error "Invalid TODO class or type: %S" args)) + (`(,_ ,(pred (member "*"))) org-todo-keywords-1) + (`(,_ ,todo-list) todo-list)) + 'words)))) + (pcase args + (`(todo . ,_) + (let (case-fold-search) (re-search-forward todo-re end t))) + (`(nottodo . ,_) + (not (let (case-fold-search) (re-search-forward todo-re end t)))) + (`(todo-unblocked . ,_) + (catch :unblocked + (while (let (case-fold-search) (re-search-forward todo-re end t)) + (when (org-entry-blocked-p) (throw :unblocked t))) + nil)) + (`(nottodo-unblocked . ,_) + (catch :unblocked + (while (let (case-fold-search) (re-search-forward todo-re end t)) + (when (org-entry-blocked-p) (throw :unblocked nil))) + t)) + (`(,type . ,_) (error "Unknown TODO skip type: %S" type))))) + +;;;###autoload +(defun org-agenda-list-stuck-projects (&rest _ignore) + "Create agenda view for projects that are stuck. +Stuck projects are project that have no next actions. For the definitions +of what a project is and how to check if it stuck, customize the variable +`org-stuck-projects'." + (interactive) + (let* ((org-agenda-overriding-header + (or org-agenda-overriding-header "List of stuck projects: ")) + (matcher (nth 0 org-stuck-projects)) + (todo (nth 1 org-stuck-projects)) + (tags (nth 2 org-stuck-projects)) + (gen-re (org-string-nw-p (nth 3 org-stuck-projects))) + (todo-wds + (if (not (member "*" todo)) todo + (org-agenda-prepare-buffers (org-agenda-files nil 'ifmode)) + (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 "\\|")))) + (tags-re (cond ((null tags) nil) + ((member "*" tags) org-tag-line-re) + (tags + (let ((other-tags (format "\\(?:%s:\\)*" org-tag-re))) + (concat org-outline-regexp-bol + ".*?[ \t]:" + other-tags + (regexp-opt tags t) + ":" other-tags "[ \t]*$"))) + (t nil))) + (re-list (delq nil (list todo-re tags-re gen-re))) + (skip-re + (if (null re-list) + (error "Missing information to identify unstuck projects") + (mapconcat #'identity re-list "\\|"))) + (org-agenda-skip-function + ;; Skip entry if `org-agenda-skip-regexp' matches anywhere + ;; in the subtree. + (lambda () + (and (save-excursion + (let ((case-fold-search nil)) + (re-search-forward + skip-re (save-excursion (org-end-of-subtree t)) t))) + (progn (outline-next-heading) (point)))))) + (org-tags-view nil matcher) + (setq org-agenda-buffer-name (buffer-name)) + (with-current-buffer org-agenda-buffer-name + (setq org-agenda-redo-command + `(org-agenda-list-stuck-projects ,current-prefix-arg)) + (let ((inhibit-read-only t)) + (add-text-properties + (point-min) (point-max) + `(org-redo-cmd ,org-agenda-redo-command)))))) + +;;; Diary integration + +(defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param. +(defvar diary-list-entries-hook) +(defvar diary-time-regexp) +(defvar diary-modify-entry-list-string-function) +(defvar diary-file-name-prefix) +(defvar diary-display-function) + +(defun org-get-entries-from-diary (date) + "Get the (Emacs Calendar) diary entries for DATE." + (require 'diary-lib) + (declare-function diary-fancy-display "diary-lib" ()) + (let* ((diary-fancy-buffer "*temporary-fancy-diary-buffer*") + (diary-display-function #'diary-fancy-display) + (pop-up-frames nil) + (diary-list-entries-hook + (cons 'org-diary-default-entry diary-list-entries-hook)) + (diary-file-name-prefix nil) ; turn this feature off + (diary-modify-entry-list-string-function + #'org-modify-diary-entry-string) + (diary-time-regexp (concat "^" diary-time-regexp)) + entries + (org-disable-agenda-to-diary t)) + (save-excursion + (save-window-excursion + (diary-list-entries date 1))) + (if (not (get-buffer diary-fancy-buffer)) + (setq entries nil) + (with-current-buffer diary-fancy-buffer + (setq buffer-read-only nil) + (if (zerop (buffer-size)) + ;; No entries + (setq entries nil) + ;; Omit the date and other unnecessary stuff + (org-agenda-cleanup-fancy-diary) + ;; Add prefix to each line and extend the text properties + (if (zerop (buffer-size)) + (setq entries nil) + (setq entries (buffer-substring (point-min) (- (point-max) 1))) + (setq entries + (with-temp-buffer + (insert entries) (goto-char (point-min)) + (while (re-search-forward "\n[ \t]+\\(.+\\)$" nil t) + (unless (save-match-data (string-match diary-time-regexp (match-string 1))) + (replace-match (concat "; " (match-string 1))))) + (buffer-string))))) + (set-buffer-modified-p nil) + (kill-buffer diary-fancy-buffer))) + (when entries + (setq entries (org-split-string entries "\n")) + (setq entries + (mapcar + (lambda (x) + (setq x (org-agenda-format-item "" x nil "Diary" nil 'time)) + ;; Extend the text properties to the beginning of the line + (org-add-props x (text-properties-at (1- (length x)) x) + 'type "diary" 'date date 'face 'org-agenda-diary)) + entries))))) + +(defvar org-agenda-cleanup-fancy-diary-hook nil + "Hook run when the fancy diary buffer is cleaned up.") + +(defun org-agenda-cleanup-fancy-diary () + "Remove unwanted stuff in buffer created by `fancy-diary-display'. +This gets rid of the date, the underline under the date, and the +dummy entry installed by Org mode to ensure non-empty diary for +each date. It also removes lines that contain only whitespace." + (goto-char (point-min)) + (if (looking-at ".*?:[ \t]*") + (progn + (replace-match "") + (re-search-forward "\n=+$" nil t) + (replace-match "") + (while (re-search-backward "^ +\n?" nil t) (replace-match ""))) + (re-search-forward "\n=+$" nil t) + (delete-region (point-min) (min (point-max) (1+ (match-end 0))))) + (goto-char (point-min)) + (while (re-search-forward "^ +\n" nil t) + (replace-match "")) + (goto-char (point-min)) + (when (re-search-forward "^Org mode dummy\n?" nil t) + (replace-match "")) + (run-hooks 'org-agenda-cleanup-fancy-diary-hook)) + +(defun org-modify-diary-entry-string (string) + "Add text properties to string, allowing Org to act on it." + (org-add-props string nil + 'mouse-face 'highlight + 'help-echo (if buffer-file-name + (format "mouse-2 or RET jump to diary file %s" + (abbreviate-file-name buffer-file-name)) + "") + 'org-agenda-diary-link t + 'org-marker (org-agenda-new-marker (point-at-bol)))) + +(defun org-diary-default-entry () + "Add a dummy entry to the diary. +Needed to avoid empty dates which mess up holiday display." + ;; Catch the error if dealing with the new add-to-diary-alist + (when org-disable-agenda-to-diary + (diary-add-to-list original-date "Org mode dummy" ""))) + +(defvar org-diary-last-run-time nil) + +;;;###autoload +(defun org-diary (&rest args) + "Return diary information from org files. +This function can be used in a \"sexp\" diary entry in the Emacs calendar. +It accesses org files and extracts information from those files to be +listed in the diary. The function accepts arguments specifying what +items should be listed. For a list of arguments allowed here, see the +variable `org-agenda-entry-types'. + +The call in the diary file should look like this: + + &%%(org-diary) ~/path/to/some/orgfile.org + +Use a separate line for each org file to check. Or, if you omit the file name, +all files listed in `org-agenda-files' will be checked automatically: + + &%%(org-diary) + +If you don't give any arguments (as in the example above), the default value +of `org-agenda-entry-types' is used: (:deadline :scheduled :timestamp :sexp). +So the example above may also be written as + + &%%(org-diary :deadline :timestamp :sexp :scheduled) + +The function expects the lisp variables `entry' and `date' to be provided +by the caller, because this is how the calendar works. Don't use this +function from a program - use `org-agenda-get-day-entries' instead." + (with-no-warnings (defvar date) (defvar entry)) + (when (> (- (float-time) + org-agenda-last-marker-time) + 5) + ;; I am not sure if this works with sticky agendas, because the marker + ;; list is then no longer a global variable. + (org-agenda-reset-markers)) + (org-compile-prefix-format 'agenda) + (org-set-sorting-strategy 'agenda) + (setq args (or args org-agenda-entry-types)) + (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) + (list entry) + (org-agenda-files t))) + (time (float-time)) + file rtn results) + (when (or (not org-diary-last-run-time) + (> (- time + org-diary-last-run-time) + 3)) + (org-agenda-prepare-buffers files)) + (setq org-diary-last-run-time time) + ;; If this is called during org-agenda, don't return any entries to + ;; the calendar. Org Agenda will list these entries itself. + (when org-disable-agenda-to-diary (setq files nil)) + (while (setq file (pop files)) + (setq rtn (apply #'org-agenda-get-day-entries file date args)) + (setq results (append results rtn))) + (when results + (setq results + (mapcar (lambda (i) (replace-regexp-in-string + org-link-bracket-re "\\2" i)) + results)) + (concat (org-agenda-finalize-entries results) "\n")))) + +;;; Agenda entry finders + +(defun org-agenda--timestamp-to-absolute (&rest args) + "Call `org-time-string-to-absolute' with ARGS. +However, throw `:skip' whenever an error is raised." + (condition-case e + (apply #'org-time-string-to-absolute args) + (org-diary-sexp-no-match (throw :skip nil)) + (error + (message "%s; Skipping entry" (error-message-string e)) + (throw :skip nil)))) + +(defun org-agenda-get-day-entries (file date &rest args) + "Does the work for `org-diary' and `org-agenda'. +FILE is the path to a file to be checked for entries. DATE is date like +the one returned by `calendar-current-date'. ARGS are symbols indicating +which kind of entries should be extracted. For details about these, see +the documentation of `org-diary'." + (let* ((org-startup-folded nil) + (org-startup-align-all-tables nil) + (buffer (if (file-exists-p file) (org-get-agenda-file-buffer file) + (error "No such file %s" file)))) + (if (not buffer) + ;; If file does not exist, signal it in diary nonetheless. + (list (format "ORG-AGENDA-ERROR: No such org-file %s" file)) + (with-current-buffer buffer + (unless (derived-mode-p 'org-mode) + (error "Agenda file %s is not in Org mode" file)) + (setq org-agenda-buffer (or org-agenda-buffer buffer)) + (setf org-agenda-current-date date) + (save-excursion + (save-restriction + (if (eq buffer org-agenda-restrict) + (narrow-to-region org-agenda-restrict-begin + org-agenda-restrict-end) + (widen)) + ;; Rationalize ARGS. Also make sure `:deadline' comes + ;; first in order to populate DEADLINES before passing it. + ;; + ;; We use `delq' since `org-uniquify' duplicates ARGS, + ;; guarding us from modifying `org-agenda-entry-types'. + (setf args (org-uniquify (or args org-agenda-entry-types))) + (when (and (memq :scheduled args) (memq :scheduled* args)) + (setf args (delq :scheduled* args))) + (cond + ((memq :deadline args) + (setf args (cons :deadline + (delq :deadline (delq :deadline* args))))) + ((memq :deadline* args) + (setf args (cons :deadline* (delq :deadline* args))))) + ;; Collect list of headlines. Return them flattened. + (let ((case-fold-search nil) results deadlines) + (org-dlet + ((date date)) + (dolist (arg args (apply #'nconc (nreverse results))) + (pcase arg + ((and :todo (guard (org-agenda-today-p date))) + (push (org-agenda-get-todos) results)) + (:timestamp + (push (org-agenda-get-blocks) results) + (push (org-agenda-get-timestamps deadlines) results)) + (:sexp + (push (org-agenda-get-sexps) results)) + (:scheduled + (push (org-agenda-get-scheduled deadlines) results)) + (:scheduled* + (push (org-agenda-get-scheduled deadlines t) results)) + (:closed + (push (org-agenda-get-progress) results)) + (:deadline + (setf deadlines (org-agenda-get-deadlines)) + (push deadlines results)) + (:deadline* + (setf deadlines (org-agenda-get-deadlines t)) + (push deadlines results)))))))))))) + +(defsubst org-em (x y list) + "Is X or Y a member of LIST?" + (or (memq x list) (memq y list))) + +(defvar org-heading-keyword-regexp-format) ; defined in org.el +(defvar org-agenda-sorting-strategy-selected nil) + +(defun org-agenda-entry-get-agenda-timestamp (pom) + "Retrieve timestamp information for sorting agenda views. +Given a point or marker POM, returns a cons cell of the timestamp +and the timestamp type relevant for the sorting strategy in +`org-agenda-sorting-strategy-selected'." + (let (ts ts-date-type) + (save-match-data + (cond ((org-em 'scheduled-up 'scheduled-down + org-agenda-sorting-strategy-selected) + (setq ts (org-entry-get pom "SCHEDULED") + ts-date-type " scheduled")) + ((org-em 'deadline-up 'deadline-down + org-agenda-sorting-strategy-selected) + (setq ts (org-entry-get pom "DEADLINE") + ts-date-type " deadline")) + ((org-em 'ts-up 'ts-down + org-agenda-sorting-strategy-selected) + (setq ts (org-entry-get pom "TIMESTAMP") + ts-date-type " timestamp")) + ((org-em 'tsia-up 'tsia-down + org-agenda-sorting-strategy-selected) + (setq ts (org-entry-get pom "TIMESTAMP_IA") + ts-date-type " timestamp_ia")) + ((org-em 'timestamp-up 'timestamp-down + org-agenda-sorting-strategy-selected) + (setq ts (or (org-entry-get pom "SCHEDULED") + (org-entry-get pom "DEADLINE") + (org-entry-get pom "TIMESTAMP") + (org-entry-get pom "TIMESTAMP_IA")) + ts-date-type "")) + (t (setq ts-date-type ""))) + (cons (when ts (ignore-errors (org-time-string-to-absolute ts))) + ts-date-type)))) + +(defun org-agenda-get-todos () + "Return the TODO information for agenda display." + (let* ((props (list 'face nil + 'done-face 'org-agenda-done + 'org-not-done-regexp org-not-done-regexp + 'org-todo-regexp org-todo-regexp + 'org-complex-heading-regexp org-complex-heading-regexp + 'mouse-face 'highlight + 'help-echo + (format "mouse-2 or RET jump to org file %s" + (abbreviate-file-name buffer-file-name)))) + (case-fold-search nil) + (regexp (format org-heading-keyword-regexp-format + (cond + ((and org-select-this-todo-keyword + (equal org-select-this-todo-keyword "*")) + org-todo-regexp) + (org-select-this-todo-keyword + (concat "\\(" + (mapconcat #'identity + (org-split-string + org-select-this-todo-keyword + "|") + "\\|") + "\\)")) + (t org-not-done-regexp)))) + marker priority category level tags todo-state + ts-date ts-date-type ts-date-pair + ee txt beg end inherited-tags todo-state-end-pos) + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + (catch :skip + (save-match-data + (beginning-of-line) + (org-agenda-skip) + (setq beg (point) end (save-excursion (outline-next-heading) (point))) + (unless (and (setq todo-state (org-get-todo-state)) + (setq todo-state-end-pos (match-end 2))) + (goto-char end) + (throw :skip nil)) + (when (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item end) + (goto-char (1+ beg)) + (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible)) + (throw :skip nil))) + (goto-char (match-beginning 2)) + (setq marker (org-agenda-new-marker (match-beginning 0)) + category (org-get-category) + ts-date-pair (org-agenda-entry-get-agenda-timestamp (point)) + ts-date (car ts-date-pair) + ts-date-type (cdr ts-date-pair) + txt (org-trim (buffer-substring (match-beginning 2) (match-end 0))) + inherited-tags + (or (eq org-agenda-show-inherited-tags 'always) + (and (listp org-agenda-show-inherited-tags) + (memq 'todo org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (memq 'todo org-agenda-use-tag-inheritance)))) + tags (org-get-tags nil (not inherited-tags)) + level (make-string (org-reduced-level (org-outline-level)) ? ) + txt (org-agenda-format-item "" txt level category tags t) + priority (1+ (org-get-priority txt))) + (org-add-props txt props + 'org-marker marker 'org-hd-marker marker + 'priority priority + 'level level + 'ts-date ts-date + 'type (concat "todo" ts-date-type) 'todo-state todo-state) + (push txt ee) + (if org-agenda-todo-list-sublevels + (goto-char todo-state-end-pos) + (org-end-of-subtree 'invisible)))) + (nreverse ee))) + +(defun org-agenda-todo-custom-ignore-p (time n) + "Check whether timestamp is farther away than n number of days. +This function is invoked if `org-agenda-todo-ignore-deadlines', +`org-agenda-todo-ignore-scheduled' or +`org-agenda-todo-ignore-timestamp' is set to an integer." + (let ((days (org-time-stamp-to-now + time org-agenda-todo-ignore-time-comparison-use-seconds))) + (if (>= n 0) + (>= days n) + (<= days n)))) + +;;;###autoload +(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item + (&optional end) + "Do we have a reason to ignore this TODO entry because it has a time stamp?" + (when (or org-agenda-todo-ignore-with-date + org-agenda-todo-ignore-scheduled + org-agenda-todo-ignore-deadlines + org-agenda-todo-ignore-timestamp) + (setq end (or end (save-excursion (outline-next-heading) (point)))) + (save-excursion + (or (and org-agenda-todo-ignore-with-date + (re-search-forward org-ts-regexp end t)) + (and org-agenda-todo-ignore-scheduled + (re-search-forward org-scheduled-time-regexp end t) + (cond + ((eq org-agenda-todo-ignore-scheduled 'future) + (> (org-time-stamp-to-now + (match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) + 0)) + ((eq org-agenda-todo-ignore-scheduled 'past) + (<= (org-time-stamp-to-now + (match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) + 0)) + ((numberp org-agenda-todo-ignore-scheduled) + (org-agenda-todo-custom-ignore-p + (match-string 1) org-agenda-todo-ignore-scheduled)) + (t))) + (and org-agenda-todo-ignore-deadlines + (re-search-forward org-deadline-time-regexp end t) + (cond + ((eq org-agenda-todo-ignore-deadlines 'all) t) + ((eq org-agenda-todo-ignore-deadlines 'far) + (not (org-deadline-close-p (match-string 1)))) + ((eq org-agenda-todo-ignore-deadlines 'future) + (> (org-time-stamp-to-now + (match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) + 0)) + ((eq org-agenda-todo-ignore-deadlines 'past) + (<= (org-time-stamp-to-now + (match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) + 0)) + ((numberp org-agenda-todo-ignore-deadlines) + (org-agenda-todo-custom-ignore-p + (match-string 1) org-agenda-todo-ignore-deadlines)) + (t (org-deadline-close-p (match-string 1))))) + (and org-agenda-todo-ignore-timestamp + (let ((buffer (current-buffer)) + (regexp + (concat + org-scheduled-time-regexp "\\|" org-deadline-time-regexp)) + (start (point))) + ;; Copy current buffer into a temporary one + (with-temp-buffer + (insert-buffer-substring buffer start end) + (goto-char (point-min)) + ;; Delete SCHEDULED and DEADLINE items + (while (re-search-forward regexp end t) + (delete-region (match-beginning 0) (match-end 0))) + (goto-char (point-min)) + ;; No search for timestamp left + (when (re-search-forward org-ts-regexp nil t) + (cond + ((eq org-agenda-todo-ignore-timestamp 'future) + (> (org-time-stamp-to-now + (match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) + 0)) + ((eq org-agenda-todo-ignore-timestamp 'past) + (<= (org-time-stamp-to-now + (match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) + 0)) + ((numberp org-agenda-todo-ignore-timestamp) + (org-agenda-todo-custom-ignore-p + (match-string 1) org-agenda-todo-ignore-timestamp)) + (t)))))))))) + +(defun org-agenda-get-timestamps (&optional deadlines) + "Return the date stamp information for agenda display. +Optional argument DEADLINES is a list of deadline items to be +displayed in agenda view." + (with-no-warnings (defvar date)) + (let* ((props (list 'face 'org-agenda-calendar-event + 'org-not-done-regexp org-not-done-regexp + 'org-todo-regexp org-todo-regexp + 'org-complex-heading-regexp org-complex-heading-regexp + 'mouse-face 'highlight + 'help-echo + (format "mouse-2 or RET jump to Org file %s" + (abbreviate-file-name buffer-file-name)))) + (current (calendar-absolute-from-gregorian date)) + (today (org-today)) + (deadline-position-alist + (mapcar (lambda (d) + (let ((m (get-text-property 0 'org-hd-marker d))) + (and m (marker-position m)))) + deadlines)) + ;; Match time-stamps set to current date, time-stamps with + ;; a repeater, and S-exp time-stamps. + (regexp + (concat + (if org-agenda-include-inactive-timestamps "[[<]" "<") + (regexp-quote + (substring + (format-time-string + (car org-time-stamp-formats) + (encode-time ; DATE bound by calendar + 0 0 0 (nth 1 date) (car date) (nth 2 date))) + 1 11)) + "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)" + "\\|\\(<%%\\(([^>\n]+)\\)>\\)")) + timestamp-items) + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + ;; Skip date ranges, scheduled and deadlines, which are handled + ;; specially. Also skip time-stamps before first headline as + ;; there would be no entry to add to the agenda. Eventually, + ;; ignore clock entries. + (catch :skip + (save-match-data + (when (or (org-at-date-range-p) + (org-at-planning-p) + (org-before-first-heading-p) + (and org-agenda-include-inactive-timestamps + (org-at-clock-log-p))) + (throw :skip nil)) + (org-agenda-skip)) + (let* ((pos (match-beginning 0)) + (repeat (match-string 1)) + (sexp-entry (match-string 3)) + (time-stamp (if (or repeat sexp-entry) (match-string 0) + (save-excursion + (goto-char pos) + (looking-at org-ts-regexp-both) + (match-string 0)))) + (todo-state (org-get-todo-state)) + (warntime (get-text-property (point) 'org-appt-warntime)) + (done? (member todo-state org-done-keywords))) + ;; Possibly skip done tasks. + (when (and done? org-agenda-skip-timestamp-if-done) + (throw :skip t)) + ;; S-exp entry doesn't match current day: skip it. + (when (and sexp-entry (not (org-diary-sexp-entry sexp-entry "" date))) + (throw :skip nil)) + (when repeat + (let* ((past + ;; A repeating time stamp is shown at its base + ;; date and every repeated date up to TODAY. If + ;; `org-agenda-prefer-last-repeat' is non-nil, + ;; however, only the last repeat before today + ;; (inclusive) is shown. + (org-agenda--timestamp-to-absolute + repeat + (if (or (> current today) + (eq org-agenda-prefer-last-repeat t) + (member todo-state org-agenda-prefer-last-repeat)) + today + current) + 'past (current-buffer) pos)) + (future + ;; Display every repeated date past TODAY + ;; (exclusive) unless + ;; `org-agenda-show-future-repeats' is nil. If + ;; this variable is set to `next', only display + ;; the first repeated date after TODAY + ;; (exclusive). + (cond + ((<= current today) past) + ((not org-agenda-show-future-repeats) past) + (t + (let ((base (if (eq org-agenda-show-future-repeats 'next) + (1+ today) + current))) + (org-agenda--timestamp-to-absolute + repeat base 'future (current-buffer) pos)))))) + (when (and (/= current past) (/= current future)) + (throw :skip nil)))) + (save-excursion + (re-search-backward org-outline-regexp-bol nil t) + ;; Possibly skip time-stamp when a deadline is set. + (when (and org-agenda-skip-timestamp-if-deadline-is-shown + (assq (point) deadline-position-alist)) + (throw :skip nil)) + (let* ((category (org-get-category pos)) + (inherited-tags + (or (eq org-agenda-show-inherited-tags 'always) + (and (consp org-agenda-show-inherited-tags) + (memq 'agenda org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (memq 'agenda + org-agenda-use-tag-inheritance))))) + (tags (org-get-tags nil (not inherited-tags))) + (level (make-string (org-reduced-level (org-outline-level)) + ?\s)) + (head (and (looking-at "\\*+[ \t]+\\(.*\\)") + (match-string 1))) + (inactive? (= (char-after pos) ?\[)) + (habit? (and (fboundp 'org-is-habit-p) (org-is-habit-p))) + (item + (org-agenda-format-item + (and inactive? org-agenda-inactive-leader) + head level category tags time-stamp org-ts-regexp habit?))) + (org-add-props item props + 'priority (if habit? + (org-habit-get-priority (org-habit-parse-todo)) + (org-get-priority item)) + 'org-marker (org-agenda-new-marker pos) + 'org-hd-marker (org-agenda-new-marker) + 'date date + 'level level + 'ts-date (if repeat (org-agenda--timestamp-to-absolute repeat) + current) + 'todo-state todo-state + 'warntime warntime + 'type "timestamp") + (push item timestamp-items)))) + (when org-agenda-skip-additional-timestamps-same-entry + (outline-next-heading)))) + (nreverse timestamp-items))) + +(defun org-agenda-get-sexps () + "Return the sexp information for agenda display." + (require 'diary-lib) + (with-no-warnings (defvar date) (defvar entry)) + (let* ((props (list 'face 'org-agenda-calendar-sexp + 'mouse-face 'highlight + 'help-echo + (format "mouse-2 or RET jump to org file %s" + (abbreviate-file-name buffer-file-name)))) + (regexp "^&?%%(") + ;; FIXME: Is this `entry' binding intended to be dynamic, + ;; so as to "hide" any current binding for it? + marker category extra level ee txt tags entry + result beg b sexp sexp-entry todo-state warntime inherited-tags) + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + (catch :skip + (org-agenda-skip) + (setq beg (match-beginning 0)) + (goto-char (1- (match-end 0))) + (setq b (point)) + (forward-sexp 1) + (setq sexp (buffer-substring b (point))) + (setq sexp-entry (if (looking-at "[ \t]*\\(\\S-.*\\)") + (org-trim (match-string 1)) + "")) + (setq result (org-diary-sexp-entry sexp sexp-entry date)) + (when result + (setq marker (org-agenda-new-marker beg) + level (make-string (org-reduced-level (org-outline-level)) ? ) + category (org-get-category beg) + inherited-tags + (or (eq org-agenda-show-inherited-tags 'always) + (and (listp org-agenda-show-inherited-tags) + (memq 'agenda org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (memq 'agenda org-agenda-use-tag-inheritance)))) + tags (org-get-tags nil (not inherited-tags)) + todo-state (org-get-todo-state) + warntime (get-text-property (point) 'org-appt-warntime) + extra nil) + + (dolist (r (if (stringp result) + (list result) + result)) ;; we expect a list here + (when (and org-agenda-diary-sexp-prefix + (string-match org-agenda-diary-sexp-prefix r)) + (setq extra (match-string 0 r) + r (replace-match "" nil nil r))) + (if (string-match "\\S-" r) + (setq txt r) + (setq txt "SEXP entry returned empty string")) + (setq txt (org-agenda-format-item extra txt level category tags 'time)) + (org-add-props txt props 'org-marker marker + 'date date 'todo-state todo-state + 'level level 'type "sexp" 'warntime warntime) + (push txt ee))))) + (nreverse ee))) + +;; Calendar sanity: define some functions that are independent of +;; `calendar-date-style'. +(defun org-anniversary (year month day &optional mark) + "Like `diary-anniversary', but with fixed (ISO) order of arguments." + (with-no-warnings + (let ((calendar-date-style 'iso)) + (diary-anniversary year month day mark)))) +(defun org-cyclic (N year month day &optional mark) + "Like `diary-cyclic', but with fixed (ISO) order of arguments." + (with-no-warnings + (let ((calendar-date-style 'iso)) + (diary-cyclic N year month day mark)))) +(defun org-block (Y1 M1 D1 Y2 M2 D2 &optional mark) + "Like `diary-block', but with fixed (ISO) order of arguments." + (with-no-warnings + (let ((calendar-date-style 'iso)) + (diary-block Y1 M1 D1 Y2 M2 D2 mark)))) +(defun org-date (year month day &optional mark) + "Like `diary-date', but with fixed (ISO) order of arguments." + (with-no-warnings + (let ((calendar-date-style 'iso)) + (diary-date year month day mark)))) + +;; Define the `org-class' function +(defun org-class (y1 m1 d1 y2 m2 d2 dayname &rest skip-weeks) + "Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS. +DAYNAME is a number between 0 (Sunday) and 6 (Saturday). +SKIP-WEEKS is any number of ISO weeks in the block period for which the +item should be skipped. If any of the SKIP-WEEKS arguments is the symbol +`holidays', then any date that is known by the Emacs calendar to be a +holiday will also be skipped. If SKIP-WEEKS arguments are holiday strings, +then those holidays will be skipped." + (with-no-warnings (defvar date) (defvar entry)) + (let* ((date1 (calendar-absolute-from-gregorian (list m1 d1 y1))) + (date2 (calendar-absolute-from-gregorian (list m2 d2 y2))) + (d (calendar-absolute-from-gregorian date)) + (h (when skip-weeks (calendar-check-holidays date)))) + (and + (<= date1 d) + (<= d date2) + (= (calendar-day-of-week date) dayname) + (or (not skip-weeks) + (progn + (require 'cal-iso) + (not (member (car (calendar-iso-from-absolute d)) skip-weeks)))) + (not (or (and h (memq 'holidays skip-weeks)) + (delq nil (mapcar (lambda(g) (member g skip-weeks)) h)))) + entry))) + +(defalias 'org-get-closed #'org-agenda-get-progress) +(defun org-agenda-get-progress () + "Return the logged TODO entries for agenda display." + (with-no-warnings (defvar date)) + (let* ((props (list 'mouse-face 'highlight + 'org-not-done-regexp org-not-done-regexp + 'org-todo-regexp org-todo-regexp + 'org-complex-heading-regexp org-complex-heading-regexp + 'help-echo + (format "mouse-2 or RET jump to org file %s" + (abbreviate-file-name buffer-file-name)))) + (items (if (consp org-agenda-show-log-scoped) + org-agenda-show-log-scoped + (if (eq org-agenda-show-log-scoped 'clockcheck) + '(clock) + org-agenda-log-mode-items))) + (parts + (delq nil + (list + (when (memq 'closed items) (concat "\\<" org-closed-string)) + (when (memq 'clock items) (concat "\\<" org-clock-string)) + (when (memq 'state items) + (format "- +State \"%s\".*?" org-todo-regexp))))) + (parts-re (if parts (mapconcat #'identity parts "\\|") + (error "`org-agenda-log-mode-items' is empty"))) + (regexp (concat + "\\(" parts-re "\\)" + " *\\[" + (regexp-quote + (substring + (format-time-string + (car org-time-stamp-formats) + (encode-time ; DATE bound by calendar + 0 0 0 (nth 1 date) (car date) (nth 2 date))) + 1 11)))) + (org-agenda-search-headline-for-time nil) + marker hdmarker priority category level tags closedp type + statep clockp state ee txt extra timestr rest clocked inherited-tags) + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + (catch :skip + (org-agenda-skip) + (setq marker (org-agenda-new-marker (match-beginning 0)) + closedp (equal (match-string 1) org-closed-string) + statep (equal (string-to-char (match-string 1)) ?-) + clockp (not (or closedp statep)) + state (and statep (match-string 2)) + category (org-get-category (match-beginning 0)) + timestr (buffer-substring (match-beginning 0) (point-at-eol))) + (when (string-match "\\]" timestr) + ;; substring should only run to end of time stamp + (setq rest (substring timestr (match-end 0)) + timestr (substring timestr 0 (match-end 0))) + (if (and (not closedp) (not statep) + (string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*?\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)" + rest)) + (progn (setq timestr (concat (substring timestr 0 -1) + "-" (match-string 1 rest) "]")) + (setq clocked (match-string 2 rest))) + (setq clocked "-"))) + (save-excursion + (setq extra + (cond + ((not org-agenda-log-mode-add-notes) nil) + (statep + (and (looking-at ".*\\\\\n[ \t]*\\([^-\n \t].*?\\)[ \t]*$") + (match-string 1))) + (clockp + (and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ \t]*$") + (match-string 1))))) + (if (not (re-search-backward org-outline-regexp-bol nil t)) + (throw :skip nil) + (goto-char (match-beginning 0)) + (setq hdmarker (org-agenda-new-marker) + inherited-tags + (or (eq org-agenda-show-inherited-tags 'always) + (and (listp org-agenda-show-inherited-tags) + (memq 'todo org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (memq 'todo org-agenda-use-tag-inheritance)))) + tags (org-get-tags nil (not inherited-tags)) + level (make-string (org-reduced-level (org-outline-level)) ? )) + (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") + (setq txt (match-string 1)) + (when extra + (if (string-match "\\([ \t]+\\)\\(:[^ \n\t]*?:\\)[ \t]*$" txt) + (setq txt (concat (substring txt 0 (match-beginning 1)) + " - " extra " " (match-string 2 txt))) + (setq txt (concat txt " - " extra)))) + (setq txt (org-agenda-format-item + (cond + (closedp "Closed: ") + (statep (concat "State: (" state ")")) + (t (concat "Clocked: (" clocked ")"))) + txt level category tags timestr))) + (setq type (cond (closedp "closed") + (statep "state") + (t "clock"))) + (setq priority 100000) + (org-add-props txt props + 'org-marker marker 'org-hd-marker hdmarker 'face 'org-agenda-done + 'priority priority 'level level + 'type type 'date date + 'undone-face 'org-warning 'done-face 'org-agenda-done) + (push txt ee)) + (goto-char (point-at-eol)))) + (nreverse ee))) + +(defun org-agenda-show-clocking-issues () + "Add overlays, showing issues with clocking. +See also the user option `org-agenda-clock-consistency-checks'." + (interactive) + (let* ((pl org-agenda-clock-consistency-checks) + (re (concat "^[ \t]*" + org-clock-string + "[ \t]+" + "\\(\\[.*?\\]\\)" ; group 1 is first stamp + "\\(-\\{1,3\\}\\(\\[.*?\\]\\)\\)?")) ; group 3 is second + (tlstart 0.) + (tlend 0.) + (maxtime (org-duration-to-minutes + (or (plist-get pl :max-duration) "24:00"))) + (mintime (org-duration-to-minutes + (or (plist-get pl :min-duration) 0))) + (maxgap (org-duration-to-minutes + ;; default 30:00 means never complain + (or (plist-get pl :max-gap) "30:00"))) + (gapok (mapcar #'org-duration-to-minutes + (plist-get pl :gap-ok-around))) + (def-face (or (plist-get pl :default-face) + '((:background "DarkRed") (:foreground "white")))) + issue face m te ts dt ov) + (goto-char (point-min)) + (while (re-search-forward " Clocked: +(\\(?:-\\|\\([0-9]+:[0-9]+\\)\\))" nil t) + (setq issue nil face def-face) + (catch 'next + (setq m (org-get-at-bol 'org-marker) + te nil ts nil) + (unless (and m (markerp m)) + (setq issue "No valid clock line") (throw 'next t)) + (org-with-point-at m + (save-excursion + (goto-char (point-at-bol)) + (unless (looking-at re) + (error "No valid Clock line") + (throw 'next t)) + (unless (match-end 3) + (setq issue + (format + "No end time: (%s)" + (org-duration-from-minutes + (floor + (- (float-time (org-current-time)) + (float-time (org-time-string-to-time (match-string 1)))) + 60))) + face (or (plist-get pl :no-end-time-face) face)) + (throw 'next t)) + (setq ts (match-string 1) + te (match-string 3) + ts (float-time (org-time-string-to-time ts)) + te (float-time (org-time-string-to-time te)) + dt (- te ts)))) + (cond + ((> dt (* 60 maxtime)) + ;; a very long clocking chunk + (setq issue (format "Clocking interval is very long: %s" + (org-duration-from-minutes (floor dt 60))) + face (or (plist-get pl :long-face) face))) + ((< dt (* 60 mintime)) + ;; a very short clocking chunk + (setq issue (format "Clocking interval is very short: %s" + (org-duration-from-minutes (floor dt 60))) + face (or (plist-get pl :short-face) face))) + ((and (> tlend 0) (< ts tlend)) + ;; Two clock entries are overlapping + (setq issue (format "Clocking overlap: %d minutes" + (/ (- tlend ts) 60)) + face (or (plist-get pl :overlap-face) face))) + ((and (> tlend 0) (> ts (+ tlend (* 60 maxgap)))) + ;; There is a gap, lets see if we need to report it + (unless (org-agenda-check-clock-gap tlend ts gapok) + (setq issue (format "Clocking gap: %d minutes" + (/ (- ts tlend) 60)) + face (or (plist-get pl :gap-face) face)))) + (t nil))) + (setq tlend (or te tlend) tlstart (or ts tlstart)) + (when issue + ;; OK, there was some issue, add an overlay to show the issue + (setq ov (make-overlay (point-at-bol) (point-at-eol))) + (overlay-put ov 'before-string + (concat + (org-add-props + (format "%-43s" (concat " " issue)) + nil + 'face face) + "\n")) + (overlay-put ov 'evaporate t))))) + +(defun org-agenda-check-clock-gap (t1 t2 ok-list) + "Check if gap T1 -> T2 contains one of the OK-LIST time-of-day values." + (catch 'exit + (unless ok-list + ;; there are no OK times for gaps... + (throw 'exit nil)) + (when (> (- (/ t2 36000) (/ t1 36000)) 24) + ;; This is more than 24 hours, so it is OK. + ;; because we have at least one OK time, that must be in the + ;; 24 hour interval. + (throw 'exit t)) + ;; We have a shorter gap. + ;; Now we have to get the minute of the day when these times are + (let* ((t1dec (org-decode-time t1)) + (t2dec (org-decode-time t2)) + ;; compute the minute on the day + (min1 (+ (nth 1 t1dec) (* 60 (nth 2 t1dec)))) + (min2 (+ (nth 1 t2dec) (* 60 (nth 2 t2dec))))) + (when (< min2 min1) + ;; if min2 is smaller than min1, this means it is on the next day. + ;; Wrap it to after midnight. + (setq min2 (+ min2 1440))) + ;; Now check if any of the OK times is in the gap + (mapc (lambda (x) + ;; Wrap the time to after midnight if necessary + (when (< x min1) (setq x (+ x 1440))) + ;; Check if in interval + (and (<= min1 x) (>= min2 x) (throw 'exit t))) + ok-list) + ;; Nope, this gap is not OK + nil))) + +(defun org-agenda-get-deadlines (&optional with-hour) + "Return the deadline information for agenda display. +When WITH-HOUR is non-nil, only return deadlines with an hour +specification like [h]h:mm." + (with-no-warnings (defvar date)) + (let* ((props (list 'mouse-face 'highlight + 'org-not-done-regexp org-not-done-regexp + 'org-todo-regexp org-todo-regexp + 'org-complex-heading-regexp org-complex-heading-regexp + 'help-echo + (format "mouse-2 or RET jump to org file %s" + (abbreviate-file-name buffer-file-name)))) + (regexp (if with-hour + org-deadline-time-hour-regexp + org-deadline-time-regexp)) + (today (org-today)) + (today? (org-agenda-today-p date)) ; DATE bound by calendar. + (current (calendar-absolute-from-gregorian date)) + deadline-items) + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + (catch :skip + (unless (save-match-data (org-at-planning-p)) (throw :skip nil)) + (org-agenda-skip) + (let* ((s (match-string 1)) + (pos (1- (match-beginning 1))) + (todo-state (save-match-data (org-get-todo-state))) + (done? (member todo-state org-done-keywords)) + (sexp? (string-prefix-p "%%" s)) + ;; DEADLINE is the deadline date for the entry. It is + ;; either the base date or the last repeat, according + ;; to `org-agenda-prefer-last-repeat'. + (deadline + (cond + (sexp? (org-agenda--timestamp-to-absolute s current)) + ((or (eq org-agenda-prefer-last-repeat t) + (member todo-state org-agenda-prefer-last-repeat)) + (org-agenda--timestamp-to-absolute + s today 'past (current-buffer) pos)) + (t (org-agenda--timestamp-to-absolute s)))) + ;; REPEAT is the future repeat closest from CURRENT, + ;; according to `org-agenda-show-future-repeats'. If + ;; the latter is nil, or if the time stamp has no + ;; repeat part, default to DEADLINE. + (repeat + (cond + (sexp? deadline) + ((<= current today) deadline) + ((not org-agenda-show-future-repeats) deadline) + (t + (let ((base (if (eq org-agenda-show-future-repeats 'next) + (1+ today) + current))) + (org-agenda--timestamp-to-absolute + s base 'future (current-buffer) pos))))) + (diff (- deadline current)) + (suppress-prewarning + (let ((scheduled + (and org-agenda-skip-deadline-prewarning-if-scheduled + (org-entry-get nil "SCHEDULED")))) + (cond + ((not scheduled) nil) + ;; The current item has a scheduled date, so + ;; evaluate its prewarning lead time. + ((integerp org-agenda-skip-deadline-prewarning-if-scheduled) + ;; Use global prewarning-restart lead time. + org-agenda-skip-deadline-prewarning-if-scheduled) + ((eq org-agenda-skip-deadline-prewarning-if-scheduled + 'pre-scheduled) + ;; Set pre-warning to no earlier than SCHEDULED. + (min (- deadline + (org-agenda--timestamp-to-absolute scheduled)) + org-deadline-warning-days)) + ;; Set pre-warning to deadline. + (t 0)))) + (wdays (or suppress-prewarning (org-get-wdays s)))) + (cond + ;; Only display deadlines at their base date, at future + ;; repeat occurrences or in today agenda. + ((= current deadline) nil) + ((= current repeat) nil) + ((not today?) (throw :skip nil)) + ;; Upcoming deadline: display within warning period WDAYS. + ((> deadline current) (when (> diff wdays) (throw :skip nil))) + ;; Overdue deadline: warn about it for + ;; `org-deadline-past-days' duration. + (t (when (< org-deadline-past-days (- diff)) (throw :skip nil)))) + ;; Possibly skip done tasks. + (when (and done? + (or org-agenda-skip-deadline-if-done + (/= deadline current))) + (throw :skip nil)) + (save-excursion + (re-search-backward "^\\*+[ \t]+" nil t) + (goto-char (match-end 0)) + (let* ((category (org-get-category)) + (level (make-string (org-reduced-level (org-outline-level)) + ?\s)) + (head (buffer-substring (point) (line-end-position))) + (inherited-tags + (or (eq org-agenda-show-inherited-tags 'always) + (and (listp org-agenda-show-inherited-tags) + (memq 'agenda org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (memq 'agenda + org-agenda-use-tag-inheritance))))) + (tags (org-get-tags nil (not inherited-tags))) + (time + (cond + ;; No time of day designation if it is only + ;; a reminder. + ((and (/= current deadline) (/= current repeat)) nil) + ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) + (concat (substring s (match-beginning 1)) " ")) + (t 'time))) + (item + (org-agenda-format-item + ;; Insert appropriate suffixes before deadlines. + ;; Those only apply to today agenda. + (pcase-let ((`(,now ,future ,past) + org-agenda-deadline-leaders)) + (cond + ((and today? (< deadline today)) (format past (- diff))) + ((and today? (> deadline today)) (format future diff)) + (t now))) + head level category tags time)) + (face (org-agenda-deadline-face + (- 1 (/ (float diff) (max wdays 1))))) + (upcoming? (and today? (> deadline today))) + (warntime (get-text-property (point) 'org-appt-warntime))) + (org-add-props item props + 'org-marker (org-agenda-new-marker pos) + 'org-hd-marker (org-agenda-new-marker (line-beginning-position)) + 'warntime warntime + 'level level + 'ts-date deadline + 'priority + ;; Adjust priority to today reminders about deadlines. + ;; Overdue deadlines get the highest priority + ;; increase, then imminent deadlines and eventually + ;; more distant deadlines. + (let ((adjust (if today? (- diff) 0))) + (+ adjust (org-get-priority item))) + 'todo-state todo-state + 'type (if upcoming? "upcoming-deadline" "deadline") + 'date (if upcoming? date deadline) + 'face (if done? 'org-agenda-done face) + 'undone-face face + 'done-face 'org-agenda-done) + (push item deadline-items)))))) + (nreverse deadline-items))) + +(defun org-agenda-deadline-face (fraction) + "Return the face to displaying a deadline item. +FRACTION is what fraction of the head-warning time has passed." + (assoc-default fraction org-agenda-deadline-faces #'<=)) + +(defun org-agenda-get-scheduled (&optional deadlines with-hour) + "Return the scheduled information for agenda display. +Optional argument DEADLINES is a list of deadline items to be +displayed in agenda view. When WITH-HOUR is non-nil, only return +scheduled items with an hour specification like [h]h:mm." + (with-no-warnings (defvar date)) + (let* ((props (list 'org-not-done-regexp org-not-done-regexp + 'org-todo-regexp org-todo-regexp + 'org-complex-heading-regexp org-complex-heading-regexp + 'done-face 'org-agenda-done + 'mouse-face 'highlight + 'help-echo + (format "mouse-2 or RET jump to Org file %s" + (abbreviate-file-name buffer-file-name)))) + (regexp (if with-hour + org-scheduled-time-hour-regexp + org-scheduled-time-regexp)) + (today (org-today)) + (todayp (org-agenda-today-p date)) ; DATE bound by calendar. + (current (calendar-absolute-from-gregorian date)) + (deadline-pos + (mapcar (lambda (d) + (let ((m (get-text-property 0 'org-hd-marker d))) + (and m (marker-position m)))) + deadlines)) + scheduled-items) + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + (catch :skip + (unless (save-match-data (org-at-planning-p)) (throw :skip nil)) + (org-agenda-skip) + (let* ((s (match-string 1)) + (pos (1- (match-beginning 1))) + (todo-state (save-match-data (org-get-todo-state))) + (donep (member todo-state org-done-keywords)) + (sexp? (string-prefix-p "%%" s)) + ;; SCHEDULE is the scheduled date for the entry. It is + ;; either the bare date or the last repeat, according + ;; to `org-agenda-prefer-last-repeat'. + (schedule + (cond + (sexp? (org-agenda--timestamp-to-absolute s current)) + ((or (eq org-agenda-prefer-last-repeat t) + (member todo-state org-agenda-prefer-last-repeat)) + (org-agenda--timestamp-to-absolute + s today 'past (current-buffer) pos)) + (t (org-agenda--timestamp-to-absolute s)))) + ;; REPEAT is the future repeat closest from CURRENT, + ;; according to `org-agenda-show-future-repeats'. If + ;; the latter is nil, or if the time stamp has no + ;; repeat part, default to SCHEDULE. + (repeat + (cond + (sexp? schedule) + ((<= current today) schedule) + ((not org-agenda-show-future-repeats) schedule) + (t + (let ((base (if (eq org-agenda-show-future-repeats 'next) + (1+ today) + current))) + (org-agenda--timestamp-to-absolute + s base 'future (current-buffer) pos))))) + (diff (- current schedule)) + (warntime (get-text-property (point) 'org-appt-warntime)) + (pastschedp (< schedule today)) + (futureschedp (> schedule today)) + (habitp (and (fboundp 'org-is-habit-p) (org-is-habit-p))) + (suppress-delay + (let ((deadline (and org-agenda-skip-scheduled-delay-if-deadline + (org-entry-get nil "DEADLINE")))) + (cond + ((not deadline) nil) + ;; The current item has a deadline date, so + ;; evaluate its delay time. + ((integerp org-agenda-skip-scheduled-delay-if-deadline) + ;; Use global delay time. + (- org-agenda-skip-scheduled-delay-if-deadline)) + ((eq org-agenda-skip-scheduled-delay-if-deadline + 'post-deadline) + ;; Set delay to no later than DEADLINE. + (min (- schedule + (org-agenda--timestamp-to-absolute deadline)) + org-scheduled-delay-days)) + (t 0)))) + (ddays + (cond + ;; Nullify delay when a repeater triggered already + ;; and the delay is of the form --Xd. + ((and (string-match-p "--[0-9]+[hdwmy]" s) + (> schedule (org-agenda--timestamp-to-absolute s))) + 0) + (suppress-delay + (let ((org-scheduled-delay-days suppress-delay)) + (org-get-wdays s t t))) + (t (org-get-wdays s t))))) + ;; Display scheduled items at base date (SCHEDULE), today if + ;; scheduled before the current date, and at any repeat past + ;; today. However, skip delayed items and items that have + ;; been displayed for more than `org-scheduled-past-days'. + (unless (and todayp + habitp + (bound-and-true-p org-habit-show-all-today)) + (when (or (and (> ddays 0) (< diff ddays)) + (> diff (or (and habitp org-habit-scheduled-past-days) + org-scheduled-past-days)) + (> schedule current) + (and (/= current schedule) + (/= current today) + (/= current repeat))) + (throw :skip nil))) + ;; Possibly skip done tasks. + (when (and donep + (or org-agenda-skip-scheduled-if-done + (/= schedule current))) + (throw :skip nil)) + ;; Skip entry if it already appears as a deadline, per + ;; `org-agenda-skip-scheduled-if-deadline-is-shown'. This + ;; doesn't apply to habits. + (when (pcase org-agenda-skip-scheduled-if-deadline-is-shown + ((guard + (or (not (memq (line-beginning-position 0) deadline-pos)) + habitp)) + nil) + (`repeated-after-deadline + (let ((deadline (time-to-days + (org-get-deadline-time (point))))) + (and (<= schedule deadline) (> current deadline)))) + (`not-today pastschedp) + (`t t) + (_ nil)) + (throw :skip nil)) + ;; Skip habits if `org-habit-show-habits' is nil, or if we + ;; only show them for today. Also skip done habits. + (when (and habitp + (or donep + (not (bound-and-true-p org-habit-show-habits)) + (and (not todayp) + (bound-and-true-p + org-habit-show-habits-only-for-today)))) + (throw :skip nil)) + (save-excursion + (re-search-backward "^\\*+[ \t]+" nil t) + (goto-char (match-end 0)) + (let* ((category (org-get-category)) + (inherited-tags + (or (eq org-agenda-show-inherited-tags 'always) + (and (listp org-agenda-show-inherited-tags) + (memq 'agenda org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (memq 'agenda + org-agenda-use-tag-inheritance))))) + (tags (org-get-tags nil (not inherited-tags))) + (level (make-string (org-reduced-level (org-outline-level)) + ?\s)) + (head (buffer-substring (point) (line-end-position))) + (time + (cond + ;; No time of day designation if it is only a + ;; reminder, except for habits, which always show + ;; the time of day. Habits are an exception + ;; because if there is a time of day, that is + ;; interpreted to mean they should usually happen + ;; then, even if doing the habit was missed. + ((and + (not habitp) + (/= current schedule) + (/= current repeat)) + nil) + ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) + (concat (substring s (match-beginning 1)) " ")) + (t 'time))) + (item + (org-agenda-format-item + (pcase-let ((`(,first ,past) org-agenda-scheduled-leaders)) + ;; Show a reminder of a past scheduled today. + (if (and todayp pastschedp) + (format past diff) + first)) + head level category tags time nil habitp)) + (face (cond ((and (not habitp) pastschedp) + 'org-scheduled-previously) + ((and habitp futureschedp) + 'org-agenda-done) + (todayp 'org-scheduled-today) + (t 'org-scheduled))) + (habitp (and habitp (org-habit-parse-todo)))) + (org-add-props item props + 'undone-face face + 'face (if donep 'org-agenda-done face) + 'org-marker (org-agenda-new-marker pos) + 'org-hd-marker (org-agenda-new-marker (line-beginning-position)) + 'type (if pastschedp "past-scheduled" "scheduled") + 'date (if pastschedp schedule date) + 'ts-date schedule + 'warntime warntime + 'level level + 'priority (if habitp (org-habit-get-priority habitp) + (+ 99 diff (org-get-priority item))) + 'org-habit-p habitp + 'todo-state todo-state) + (push item scheduled-items)))))) + (nreverse scheduled-items))) + +(defun org-agenda-get-blocks () + "Return the date-range information for agenda display." + (with-no-warnings (defvar date)) + (let* ((props (list 'face nil + 'org-not-done-regexp org-not-done-regexp + 'org-todo-regexp org-todo-regexp + 'org-complex-heading-regexp org-complex-heading-regexp + 'mouse-face 'highlight + 'help-echo + (format "mouse-2 or RET jump to org file %s" + (abbreviate-file-name buffer-file-name)))) + (regexp org-tr-regexp) + (d0 (calendar-absolute-from-gregorian date)) + marker hdmarker ee txt d1 d2 s1 s2 category + level todo-state tags pos head donep inherited-tags) + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + (catch :skip + (org-agenda-skip) + (setq pos (point)) + (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 + ;; 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 marker (org-agenda-new-marker (point)) + category (org-get-category)) + (if (not (re-search-backward org-outline-regexp-bol nil t)) + (throw :skip nil) + (goto-char (match-beginning 0)) + (setq hdmarker (org-agenda-new-marker (point)) + inherited-tags + (or (eq org-agenda-show-inherited-tags 'always) + (and (listp org-agenda-show-inherited-tags) + (memq 'agenda org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (memq 'agenda org-agenda-use-tag-inheritance)))) + tags (org-get-tags nil (not inherited-tags))) + (setq level (make-string (org-reduced-level (org-outline-level)) ? )) + (looking-at "\\*+[ \t]+\\(.*\\)") + (setq head (match-string 1)) + (let ((remove-re + (if org-agenda-remove-timeranges-from-blocks + (concat + "<" (regexp-quote s1) ".*?>" + "--" + "<" (regexp-quote s2) ".*?>") + nil))) + (setq txt (org-agenda-format-item + (format + (nth (if (= d1 d2) 0 1) + org-agenda-timerange-leaders) + (1+ (- d0 d1)) (1+ (- d2 d1))) + head level category tags + (save-match-data + (let ((hhmm1 (and (string-match org-ts-regexp1 s1) + (match-string 6 s1))) + (hhmm2 (and (string-match org-ts-regexp1 s2) + (match-string 6 s2)))) + (cond ((string= hhmm1 hhmm2) + (concat "<" start-time ">--<" end-time ">")) + ((and (= d1 d0) (= d2 d0)) + (concat "<" start-time ">--<" end-time ">")) + ((= d1 d0) + (concat "<" start-time ">")) + ((= d2 d0) + (concat "<" end-time ">"))))) + remove-re)))) + (org-add-props txt props + 'org-marker marker 'org-hd-marker hdmarker + 'type "block" 'date date + 'level level + 'todo-state todo-state + 'priority (org-get-priority txt)) + (push txt ee)))) + (goto-char pos))) + ;; Sort the entries by expiration date. + (nreverse ee))) + +;;; Agenda presentation and sorting + +(defvar org-prefix-has-time nil + "A flag, set by `org-compile-prefix-format'. +The flag is set if the currently compiled format contains a `%t'.") +(defvar org-prefix-has-tag nil + "A flag, set by `org-compile-prefix-format'. +The flag is set if the currently compiled format contains a `%T'.") +(defvar org-prefix-has-effort nil + "A flag, set by `org-compile-prefix-format'. +The flag is set if the currently compiled format contains a `%e'.") +(defvar org-prefix-has-breadcrumbs nil + "A flag, set by `org-compile-prefix-format'. +The flag is set if the currently compiled format contains a `%b'.") +(defvar org-prefix-category-length nil + "Used by `org-compile-prefix-format' to remember the category field width.") +(defvar org-prefix-category-max-length nil + "Used by `org-compile-prefix-format' to remember the category field width.") + +(defun org-agenda-get-category-icon (category) + "Return an image for CATEGORY according to `org-agenda-category-icon-alist'." + (cl-dolist (entry org-agenda-category-icon-alist) + (when (string-match-p (car entry) category) + (if (listp (cadr entry)) + (cl-return (cadr entry)) + (cl-return (apply #'create-image (cdr entry))))))) + +(defun org-agenda-format-item (extra txt &optional with-level with-category tags dotime + remove-re habitp) + "Format TXT to be inserted into the agenda buffer. +In particular, add the prefix and corresponding text properties. + +EXTRA must be a string to replace the `%s' specifier in the prefix format. +WITH-LEVEL may be a string to replace the `%l' specifier. +WITH-CATEGORY (a string, a symbol or nil) may be used to overrule the default +category taken from local variable or file name. It will replace the `%c' +specifier in the format. +DOTIME, when non-nil, indicates that a time-of-day should be extracted from +TXT for sorting of this entry, and for the `%t' specifier in the format. +When DOTIME is a string, this string is searched for a time before TXT is. +TAGS can be the tags of the headline. +Any match of REMOVE-RE will be removed from TXT." + ;; We keep the org-prefix-* variable values along with a compiled + ;; formatter, so that multiple agendas existing at the same time do + ;; not step on each other toes. + ;; + ;; It was inconvenient to make these variables buffer local in + ;; Agenda buffers, because this function expects to be called with + ;; the buffer where item comes from being current, and not agenda + ;; buffer + (let* ((bindings (car org-prefix-format-compiled)) + (formatter (cadr org-prefix-format-compiled))) + (cl-loop for (var value) in bindings + do (set var value)) + (save-match-data + ;; Diary entries sometimes have extra whitespace at the beginning + (setq txt (org-trim txt)) + + ;; Fix the tags part in txt + (setq txt (org-agenda-fix-displayed-tags + txt tags + org-agenda-show-inherited-tags + org-agenda-hide-tags-regexp)) + + (with-no-warnings + ;; `time', `tag', `effort' are needed for the eval of the prefix format. + ;; Based on what I see in `org-compile-prefix-format', I added + ;; a few more. + (defvar breadcrumbs) (defvar category) (defvar category-icon) + (defvar effort) (defvar extra) + (defvar level) (defvar tag) (defvar time)) + (let* ((category (or with-category + (if buffer-file-name + (file-name-sans-extension + (file-name-nondirectory buffer-file-name)) + ""))) + (category-icon (org-agenda-get-category-icon category)) + (category-icon (if category-icon + (propertize " " 'display category-icon) + "")) + (effort (and (not (string= txt "")) + (get-text-property 1 'effort txt))) + (tag (if tags (nth (1- (length tags)) tags) "")) + (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 txt)))) + (time-of-day (and dotime (org-get-time-of-day ts))) + stamp plain s0 s1 s2 rtn srp l + 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)) + + ;; 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) + (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))) + ;; 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) + org-agenda-default-appointment-duration) + nil t))) + ;; Compute the duration + (when s2 + (setq duration (- (org-duration-to-minutes s2) + (org-duration-to-minutes s1)))) + ;; 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 (string-match org-tag-group-re txt) + ;; Tags are in the string + (if (or (eq org-agenda-remove-tags t) + (and org-agenda-remove-tags + org-prefix-has-tag)) + (setq txt (replace-match "" t t txt)) + (setq txt (replace-match + (concat (make-string (max (- 50 (length txt)) 1) ?\ ) + (match-string 1 txt)) + t t txt)))) + + (when remove-re + (while (string-match remove-re txt) + (setq txt (replace-match "" t t txt)))) + + ;; Set org-heading property on `txt' to mark the start of the + ;; heading. + (add-text-properties 0 (length txt) '(org-heading t) txt) + + ;; Prepare the variables needed in the eval of the compiled format + (when org-prefix-has-breadcrumbs + (setq breadcrumbs (org-with-point-at (org-get-at-bol 'org-marker) + (let ((s (org-format-outline-path (org-get-outline-path) + (1- (frame-width)) + nil org-agenda-breadcrumbs-separator))) + (if (eq "" 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))) + (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 + 'extra-space (make-string + (- org-prefix-category-length l 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))))) + ;; Evaluate the compiled format + (setq rtn (concat (eval formatter t) txt)) + + ;; And finally add the text properties + (remove-text-properties 0 (length rtn) '(line-prefix t wrap-prefix t) rtn) + (org-add-props rtn nil + 'org-category category + 'tags tags + 'org-priority-highest org-priority-highest + 'org-priority-lowest org-priority-lowest + 'time-of-day time-of-day + 'duration duration + 'breadcrumbs breadcrumbs + 'txt txt + 'level level + 'time time + 'extra extra + 'format org-prefix-format-compiled + 'dotime dotime))))) + +(defun org-agenda-fix-displayed-tags (txt tags add-inherited hide-re) + "Remove tags string from TXT, and add a modified list of tags. +The modified list may contain inherited tags, and tags matched by +`org-agenda-hide-tags-regexp' will be removed." + (when (or add-inherited hide-re) + (when (string-match org-tag-group-re txt) + (setq txt (substring txt 0 (match-beginning 0)))) + (setq tags + (delq nil + (mapcar (lambda (tg) + (if (or (and hide-re (string-match hide-re tg)) + (and (not add-inherited) + (get-text-property 0 'inherited tg))) + nil + tg)) + tags))) + (when tags + (let ((have-i (get-text-property 0 'inherited (car tags))) + i) + (setq txt (concat txt " :" + (mapconcat + (lambda (x) + (setq i (get-text-property 0 'inherited x)) + (if (and have-i (not i)) + (progn + (setq have-i nil) + (concat ":" x)) + x)) + tags ":") + (if have-i "::" ":")))))) + txt) + +(defvar org-agenda-sorting-strategy) ;; because the def is in a let form + +(defun org-agenda-add-time-grid-maybe (list ndays todayp) + "Add a time-grid for agenda items which need it. + +LIST is the list of agenda items formatted by `org-agenda-list'. +NDAYS is the span of the current agenda view. +TODAYP is t when the current agenda view is on today." + (catch 'exit + (cond ((not org-agenda-use-time-grid) (throw 'exit list)) + ((and todayp (member 'today (car org-agenda-time-grid)))) + ((and (= ndays 1) (member 'daily (car org-agenda-time-grid)))) + ((member 'weekly (car org-agenda-time-grid))) + (t (throw 'exit list))) + (let* ((have (delq nil (mapcar + (lambda (x) (get-text-property 1 'time-of-day x)) + list))) + (string (nth 3 org-agenda-time-grid)) + (gridtimes (nth 1 org-agenda-time-grid)) + (req (car org-agenda-time-grid)) + (remove (member 'remove-match req)) + new time) + (when (and (member 'require-timed req) (not have)) + ;; don't show empty grid + (throw 'exit list)) + (while (setq time (pop gridtimes)) + (unless (and remove (member time have)) + (setq time (replace-regexp-in-string " " "0" (format "%04s" time))) + (push (org-agenda-format-item + nil string nil "" nil + (concat (substring time 0 -2) ":" (substring time -2))) + new) + (put-text-property + 2 (length (car new)) 'face 'org-time-grid (car new)))) + (when (and todayp org-agenda-show-current-time-in-grid) + (push (org-agenda-format-item + nil org-agenda-current-time-string nil "" nil + (format-time-string "%H:%M ")) + new) + (put-text-property + 2 (length (car new)) 'face 'org-agenda-current-time (car new))) + + (if (member 'time-up org-agenda-sorting-strategy-selected) + (append new list) + (append list new))))) + +(defun org-compile-prefix-format (key) + "Compile the prefix format into a Lisp form that can be evaluated. +The resulting form and associated variable bindings is returned +and stored in the variable `org-prefix-format-compiled'." + (setq org-prefix-has-time nil + org-prefix-has-tag nil + org-prefix-category-length nil + org-prefix-has-effort nil + org-prefix-has-breadcrumbs nil) + (let ((s (cond + ((stringp org-agenda-prefix-format) + org-agenda-prefix-format) + ((assq key org-agenda-prefix-format) + (cdr (assq key org-agenda-prefix-format))) + (t " %-12:c%?-12t% s"))) + (start 0) + varform vars var c f opt) ;; e + (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cltseib]\\|(.+?)\\)" + s start) + (setq var (or (cdr (assoc (match-string 4 s) + '(("c" . category) ("t" . time) ("l" . level) ("s" . extra) + ("i" . category-icon) ("T" . tag) ("e" . effort) ("b" . breadcrumbs)))) + 'eval) + c (or (match-string 3 s) "") + opt (match-beginning 1) + start (1+ (match-beginning 0))) + (cl-case var + (time (setq org-prefix-has-time t)) + (tag (setq org-prefix-has-tag t)) + (effort (setq org-prefix-has-effort t)) + (breadcrumbs (setq org-prefix-has-breadcrumbs t))) + (setq f (concat "%" (match-string 2 s) "s")) + (when (eq var 'category) + (setq org-prefix-category-length + (floor (abs (string-to-number (match-string 2 s))))) + (setq org-prefix-category-max-length + (let ((x (match-string 2 s))) + (save-match-data + (and (string-match "\\.[0-9]+" x) + (string-to-number (substring (match-string 0 x) 1))))))) + (if (eq var 'eval) + (setq varform `(format ,f (org-eval ,(read (substring s (match-beginning 4)))))) + (if opt + (setq varform + `(if (member ,var '("" nil)) + "" + (format ,f (concat ,var ,c)))) + (setq varform + `(format ,f (if (member ,var '("" nil)) "" + (concat ,var ,c (get-text-property 0 'extra-space ,var))))))) + (if (eq var 'eval) + (setf (substring s (match-beginning 0) + (+ (match-beginning 4) + (length (format "%S" (read (substring s (match-beginning 4))))))) + "%s") + (setq s (replace-match "%s" t nil s))) + (push varform vars)) + (setq vars (nreverse vars)) + (with-current-buffer (or org-agenda-buffer (current-buffer)) + (setq org-prefix-format-compiled + (list + `((org-prefix-has-time ,org-prefix-has-time) + (org-prefix-has-tag ,org-prefix-has-tag) + (org-prefix-category-length ,org-prefix-category-length) + (org-prefix-has-effort ,org-prefix-has-effort) + (org-prefix-has-breadcrumbs ,org-prefix-has-breadcrumbs)) + `(format ,s ,@vars)))))) + +(defun org-set-sorting-strategy (key) + (setq org-agenda-sorting-strategy-selected + (if (symbolp (car org-agenda-sorting-strategy)) + ;; the old format + org-agenda-sorting-strategy + (or (cdr (assq key org-agenda-sorting-strategy)) + (cdr (assq 'agenda org-agenda-sorting-strategy)) + '(time-up category-keep priority-down))))) + +(defun org-get-time-of-day (s &optional string) + "Check string S for a time of day. + +If found, return it as a military time number between 0 and 2400. +If not found, return nil. + +The optional STRING argument forces conversion into a 5 character wide string +HH:MM. When it is `overtime', any time above 24:00 is turned into \"+H:MM\" +where H:MM is the duration above midnight." + (let ((case-fold-search t) + (time-regexp + (rx word-start + (group (opt (any "012")) digit) ;group 1: hours + (or (and ":" (group (any "012345") digit) ;group 2: minutes + (opt (group (or "am" "pm")))) ;group 3: am/pm + ;; Special "HHam/pm" case. + (group-n 3 (or "am" "pm"))) + word-end))) + (save-match-data + (when (and (string-match time-regexp s) + (not (eq 'org-link (get-text-property 1 'face s)))) + (let ((hours + (let* ((ampm (and (match-end 3) (downcase (match-string 3 s)))) + (am-p (equal ampm "am"))) + (pcase (string-to-number (match-string 1 s)) + ((and (guard (not ampm)) h) h) + (12 (if am-p 0 12)) + (h (+ h (if am-p 0 12)))))) + (minutes + (if (match-end 2) + (string-to-number (match-string 2 s)) + 0))) + (pcase string + (`nil (+ minutes (* hours 100))) + ((and `overtime + (guard (or (> hours 24) + (and (= hours 24) + (> minutes 0))))) + (format "+%d:%02d" (- hours 24) minutes)) + ((guard org-agenda-time-leading-zero) + (format "%02d:%02d" hours minutes)) + (_ + (format "%d:%02d" hours minutes)))))))) + +(defvar org-agenda-before-sorting-filter-function nil + "Function to be applied to agenda items prior to sorting. +Prior to sorting also means just before they are inserted into the agenda. + +To aid sorting, you may revisit the original entries and add more text +properties which will later be used by the sorting functions. + +The function should take a string argument, an agenda line. +It has access to the text properties in that line, which contain among +other things, the property `org-hd-marker' that points to the entry +where the line comes from. Note that not all lines going into the agenda +have this property, only most. + +The function should return the modified string. It is probably best +to ONLY change text properties. + +You can also use this function as a filter, by returning nil for lines +you don't want to have in the agenda at all. For this application, you +could bind the variable in the options section of a custom command.") + +(defun org-agenda-finalize-entries (list &optional type) + "Sort, limit and concatenate the LIST of agenda items. +The optional argument TYPE tells the agenda type." + (let ((max-effort (cond ((listp org-agenda-max-effort) + (cdr (assoc type org-agenda-max-effort))) + (t org-agenda-max-effort))) + (max-todo (cond ((listp org-agenda-max-todos) + (cdr (assoc type org-agenda-max-todos))) + (t org-agenda-max-todos))) + (max-tags (cond ((listp org-agenda-max-tags) + (cdr (assoc type org-agenda-max-tags))) + (t org-agenda-max-tags))) + (max-entries (cond ((listp org-agenda-max-entries) + (cdr (assoc type org-agenda-max-entries))) + (t org-agenda-max-entries)))) + (when org-agenda-before-sorting-filter-function + (setq list + (delq nil + (mapcar + org-agenda-before-sorting-filter-function list)))) + (setq list (mapcar #'org-agenda-highlight-todo list) + list (mapcar #'identity (sort list #'org-entries-lessp))) + (when max-effort + (setq list (org-agenda-limit-entries + list 'effort-minutes max-effort + (lambda (e) (or e (if org-agenda-sort-noeffort-is-high + 32767 -1)))))) + (when max-todo + (setq list (org-agenda-limit-entries list 'todo-state max-todo))) + (when max-tags + (setq list (org-agenda-limit-entries list 'tags max-tags))) + (when max-entries + (setq list (org-agenda-limit-entries list 'org-hd-marker max-entries))) + (when (and org-agenda-dim-blocked-tasks org-blocker-hook) + (setq list (mapcar #'org-agenda--mark-blocked-entry list))) + (mapconcat #'identity list "\n"))) + +(defun org-agenda-limit-entries (list prop limit &optional fn) + "Limit the number of agenda entries." + (let ((include (and limit (< limit 0)))) + (if limit + (let ((fun (or fn (lambda (p) (when p 1)))) + (lim 0)) + (delq nil + (mapcar + (lambda (e) + (let ((pval (funcall + fun (get-text-property (1- (length e)) + prop e)))) + (when pval (setq lim (+ lim pval))) + (cond ((and pval (<= lim (abs limit))) e) + ((and include (not pval)) e)))) + list))) + list))) + +(defun org-agenda-limit-interactively (remove) + "In agenda, interactively limit entries to various maximums." + (interactive "P") + (if remove + (progn (setq org-agenda-max-entries nil + org-agenda-max-todos nil + org-agenda-max-tags nil + org-agenda-max-effort nil) + (org-agenda-redo)) + (let* ((max (read-char "Number of [e]ntries [t]odos [T]ags [E]ffort? ")) + (msg (cond ((= max ?E) "How many minutes? ") + ((= max ?e) "How many entries? ") + ((= max ?t) "How many TODO entries? ") + ((= max ?T) "How many tagged entries? ") + (t (user-error "Wrong input")))) + (num (string-to-number (read-from-minibuffer msg)))) + (cond ((equal max ?e) + (let ((org-agenda-max-entries num)) (org-agenda-redo))) + ((equal max ?t) + (let ((org-agenda-max-todos num)) (org-agenda-redo))) + ((equal max ?T) + (let ((org-agenda-max-tags num)) (org-agenda-redo))) + ((equal max ?E) + (let ((org-agenda-max-effort num)) (org-agenda-redo)))))) + (org-agenda-fit-window-to-buffer)) + +(defun org-agenda-highlight-todo (x) + (let ((org-done-keywords org-done-keywords-for-agenda) + (case-fold-search nil) + re) + (if (eq x 'line) + (save-excursion + (beginning-of-line 1) + (setq re (org-get-at-bol 'org-todo-regexp)) + (goto-char (or (text-property-any (point-at-bol) (point-at-eol) 'org-heading t) (point))) + (when (looking-at (concat "[ \t]*\\.*\\(" re "\\) +")) + (add-text-properties (match-beginning 0) (match-end 1) + (list 'face (org-get-todo-face 1))) + (let ((s (buffer-substring (match-beginning 1) (match-end 1)))) + (delete-region (match-beginning 1) (1- (match-end 0))) + (goto-char (match-beginning 1)) + (insert (format org-agenda-todo-keyword-format s))))) + (let ((pl (text-property-any 0 (length x) 'org-heading t x))) + (setq re (get-text-property 0 'org-todo-regexp x)) + (when (and re + ;; Test `pl' because if there's no heading content, + ;; there's no point matching to highlight. Note + ;; that if we didn't test `pl' first, and there + ;; happened to be no keyword from `org-todo-regexp' + ;; on this heading line, then the `equal' comparison + ;; afterwards would spuriously succeed in the case + ;; where `pl' is nil -- causing an args-out-of-range + ;; error when we try to add text properties to text + ;; that isn't there. + pl + (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)") + x pl) + pl)) + (add-text-properties + (or (match-end 1) (match-end 0)) (match-end 0) + (list 'face (org-get-todo-face (match-string 2 x))) + x) + (when (match-end 1) + (setq x + (concat + (substring x 0 (match-end 1)) + (unless (string= org-agenda-todo-keyword-format "") + (format org-agenda-todo-keyword-format + (match-string 2 x))) + ;; Remove `display' property as the icon could leak + ;; on the white space. + (org-add-props " " (org-plist-delete (text-properties-at 0 x) + 'display)) + (substring x (match-end 3))))))) + x))) + +(defsubst org-cmp-values (a b property) + "Compare the numeric value of text PROPERTY for string A and B." + (let ((pa (or (get-text-property (1- (length a)) property a) 0)) + (pb (or (get-text-property (1- (length b)) property b) 0))) + (cond ((> pa pb) +1) + ((< pa pb) -1)))) + +(defsubst org-cmp-effort (a b) + "Compare the effort values of string A and B." + (let* ((def (if org-agenda-sort-noeffort-is-high 32767 -1)) + ;; `effort-minutes' property is not directly accessible from + ;; the strings, but is stored as a property in `txt'. + (ea (or (get-text-property + 0 'effort-minutes (get-text-property 0 'txt a)) + def)) + (eb (or (get-text-property + 0 'effort-minutes (get-text-property 0 'txt b)) + def))) + (cond ((> ea eb) +1) + ((< ea eb) -1)))) + +(defsubst org-cmp-category (a b) + "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)))) + +(defsubst org-cmp-todo-state (a b) + "Compare the todo states of strings A and B." + (let* ((ma (or (get-text-property 1 'org-marker a) + (get-text-property 1 'org-hd-marker a))) + (mb (or (get-text-property 1 'org-marker b) + (get-text-property 1 'org-hd-marker b))) + (fa (and ma (marker-buffer ma))) + (fb (and mb (marker-buffer mb))) + (todo-kwds + (or (and fa (with-current-buffer fa org-todo-keywords-1)) + (and fb (with-current-buffer fb org-todo-keywords-1)))) + (ta (or (get-text-property 1 'todo-state a) "")) + (tb (or (get-text-property 1 'todo-state b) "")) + (la (- (length (member ta todo-kwds)))) + (lb (- (length (member tb todo-kwds)))) + (donepa (member ta org-done-keywords-for-agenda)) + (donepb (member tb org-done-keywords-for-agenda))) + (cond ((and donepa (not donepb)) -1) + ((and (not donepa) donepb) +1) + ((< la lb) -1) + ((< lb la) +1)))) + +(defsubst org-cmp-alpha (a b) + "Compare the headlines, alphabetically." + (let* ((pla (text-property-any 0 (length a) 'org-heading t a)) + (plb (text-property-any 0 (length b) 'org-heading t b)) + (ta (and pla (substring a pla))) + (tb (and plb (substring b plb))) + (case-fold-search nil)) + (when pla + (when (string-match (concat "\\`[ \t]*" (or (get-text-property 0 'org-todo-regexp a) "") + "\\([ \t]*\\[[a-zA-Z0-9]\\]\\)? *") + ta) + (setq ta (substring ta (match-end 0)))) + (setq ta (downcase ta))) + (when plb + (when (string-match (concat "\\`[ \t]*" (or (get-text-property 0 'org-todo-regexp b) "") + "\\([ \t]*\\[[a-zA-Z0-9]\\]\\)? *") + tb) + (setq tb (substring tb (match-end 0)))) + (setq tb (downcase tb))) + (cond ((not (or ta tb)) nil) + ((not ta) +1) + ((not tb) -1) + ((string-lessp ta tb) -1) + ((string-lessp tb ta) +1)))) + +(defsubst org-cmp-tag (a b) + "Compare the string values of the first tags of A and B." + (let ((ta (car (last (get-text-property 1 'tags a)))) + (tb (car (last (get-text-property 1 'tags b))))) + (cond ((not (or ta tb)) nil) + ((not ta) +1) + ((not tb) -1) + ((string-lessp ta tb) -1) + ((string-lessp tb ta) +1)))) + +(defsubst org-cmp-time (a b) + "Compare the time-of-day values of strings A and B." + (let* ((def (if org-agenda-sort-notime-is-late 9901 -1)) + (ta (or (get-text-property 1 'time-of-day a) def)) + (tb (or (get-text-property 1 'time-of-day b) def))) + (cond ((< ta tb) -1) + ((< tb ta) +1)))) + +(defsubst org-cmp-ts (a b type) + "Compare the timestamps values of entries A and B. +When TYPE is \"scheduled\", \"deadline\", \"timestamp\" or +\"timestamp_ia\", compare within each of these type. When TYPE +is the empty string, compare all timestamps without respect of +their type." + (let* ((def (and (not org-agenda-sort-notime-is-late) -1)) + (ta (or (and (string-match type (or (get-text-property 1 'type a) "")) + (get-text-property 1 'ts-date a)) + def)) + (tb (or (and (string-match type (or (get-text-property 1 'type b) "")) + (get-text-property 1 'ts-date b)) + def))) + (cond ((if ta (and tb (< ta tb)) tb) -1) + ((if tb (and ta (< tb ta)) ta) +1)))) + +(defsubst org-cmp-habit-p (a b) + "Compare the todo states of strings A and B." + (let ((ha (get-text-property 1 'org-habit-p a)) + (hb (get-text-property 1 'org-habit-p b))) + (cond ((and ha (not hb)) -1) + ((and (not ha) hb) +1)))) + +(defun org-entries-lessp (a b) + "Predicate for sorting agenda entries." + ;; The following variables will be used when the form is evaluated. + ;; So even though the compiler complains, keep them. + (let ((ss org-agenda-sorting-strategy-selected)) + (org-dlet + ((timestamp-up (and (org-em 'timestamp-up 'timestamp-down ss) + (org-cmp-ts a b ""))) + (timestamp-down (if timestamp-up (- timestamp-up) nil)) + (scheduled-up (and (org-em 'scheduled-up 'scheduled-down ss) + (org-cmp-ts a b "scheduled"))) + (scheduled-down (if scheduled-up (- scheduled-up) nil)) + (deadline-up (and (org-em 'deadline-up 'deadline-down ss) + (org-cmp-ts a b "deadline"))) + (deadline-down (if deadline-up (- deadline-up) nil)) + (tsia-up (and (org-em 'tsia-up 'tsia-down ss) + (org-cmp-ts a b "timestamp_ia"))) + (tsia-down (if tsia-up (- tsia-up) nil)) + (ts-up (and (org-em 'ts-up 'ts-down ss) + (org-cmp-ts a b "timestamp"))) + (ts-down (if ts-up (- ts-up) nil)) + (time-up (and (org-em 'time-up 'time-down ss) + (org-cmp-time a b))) + (time-down (if time-up (- time-up) nil)) + (stats-up (and (org-em 'stats-up 'stats-down ss) + (org-cmp-values a b 'org-stats))) + (stats-down (if stats-up (- stats-up) nil)) + (priority-up (and (org-em 'priority-up 'priority-down ss) + (org-cmp-values a b 'priority))) + (priority-down (if priority-up (- priority-up) nil)) + (effort-up (and (org-em 'effort-up 'effort-down ss) + (org-cmp-effort a b))) + (effort-down (if effort-up (- effort-up) nil)) + (category-up (and (or (org-em 'category-up 'category-down ss) + (memq 'category-keep ss)) + (org-cmp-category a b))) + (category-down (if category-up (- category-up) nil)) + (category-keep (if category-up +1 nil)) + (tag-up (and (org-em 'tag-up 'tag-down ss) + (org-cmp-tag a b))) + (tag-down (if tag-up (- tag-up) nil)) + (todo-state-up (and (org-em 'todo-state-up 'todo-state-down ss) + (org-cmp-todo-state a b))) + (todo-state-down (if todo-state-up (- todo-state-up) nil)) + (habit-up (and (org-em 'habit-up 'habit-down ss) + (org-cmp-habit-p a b))) + (habit-down (if habit-up (- habit-up) nil)) + (alpha-up (and (org-em 'alpha-up 'alpha-down ss) + (org-cmp-alpha a b))) + (alpha-down (if alpha-up (- alpha-up) nil)) + (need-user-cmp (org-em 'user-defined-up 'user-defined-down ss)) + user-defined-up user-defined-down) + (when (and need-user-cmp org-agenda-cmp-user-defined + (functionp org-agenda-cmp-user-defined)) + (setq user-defined-up + (funcall org-agenda-cmp-user-defined a b) + user-defined-down (if user-defined-up (- user-defined-up) nil))) + (cdr (assoc + (eval (cons 'or org-agenda-sorting-strategy-selected) t) + '((-1 . t) (1 . nil) (nil . nil))))))) + +;;; Agenda restriction lock + +(defvar org-agenda-restriction-lock-overlay (make-overlay 1 1) + "Overlay to mark the headline to which agenda commands are restricted.") +(overlay-put org-agenda-restriction-lock-overlay + 'face 'org-agenda-restriction-lock) +(overlay-put org-agenda-restriction-lock-overlay + 'help-echo "Agendas are currently limited to this subtree.") +(delete-overlay org-agenda-restriction-lock-overlay) + +(defun org-agenda-set-restriction-lock-from-agenda (arg) + "Set the restriction lock to the agenda item at point from within the agenda. +When called with a `\\[universal-argument]' prefix, restrict to +the file which contains the item. +Argument ARG is the prefix argument." + (interactive "P") + (unless (derived-mode-p 'org-agenda-mode) + (user-error "Not in an Org agenda buffer")) + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker))) + (with-current-buffer buffer + (goto-char pos) + (org-agenda-set-restriction-lock arg)))) + +;;;###autoload +(defun org-agenda-set-restriction-lock (&optional type) + "Set restriction lock for agenda to current subtree or file. +When in a restricted subtree, remove it. + +The restriction will span over the entire file if TYPE is `file', +or if type is '(4), or if the cursor is before the first headline +in the file. Otherwise, only apply the restriction to the current +subtree." + (interactive "P") + (if (and org-agenda-overriding-restriction + (member org-agenda-restriction-lock-overlay + (overlays-at (point))) + (equal (overlay-start org-agenda-restriction-lock-overlay) + (point))) + (org-agenda-remove-restriction-lock 'noupdate) + (org-agenda-remove-restriction-lock 'noupdate) + (and (equal type '(4)) (setq type 'file)) + (setq type (cond + (type type) + ((org-at-heading-p) 'subtree) + ((condition-case nil (org-back-to-heading t) (error nil)) + 'subtree) + (t 'file))) + (if (eq type 'subtree) + (progn + (setq org-agenda-restrict (current-buffer)) + (setq org-agenda-overriding-restriction 'subtree) + (put 'org-agenda-files 'org-restrict + (list (buffer-file-name (buffer-base-buffer)))) + (org-back-to-heading t) + (move-overlay org-agenda-restriction-lock-overlay + (point) + (if org-agenda-restriction-lock-highlight-subtree + (save-excursion (org-end-of-subtree t t) (point)) + (point-at-eol))) + (move-marker org-agenda-restrict-begin (point)) + (move-marker org-agenda-restrict-end + (save-excursion (org-end-of-subtree t t))) + (message "Locking agenda restriction to subtree")) + (put 'org-agenda-files 'org-restrict + (list (buffer-file-name (buffer-base-buffer)))) + (setq org-agenda-restrict nil) + (setq org-agenda-overriding-restriction 'file) + (move-marker org-agenda-restrict-begin nil) + (move-marker org-agenda-restrict-end nil) + (message "Locking agenda restriction to file")) + (setq current-prefix-arg nil)) + (org-agenda-maybe-redo)) + +(defun org-agenda-remove-restriction-lock (&optional noupdate) + "Remove agenda restriction lock." + (interactive "P") + (if (not org-agenda-restrict) + (message "No agenda restriction to remove.") + (delete-overlay org-agenda-restriction-lock-overlay) + (delete-overlay org-speedbar-restriction-lock-overlay) + (setq org-agenda-overriding-restriction nil) + (setq org-agenda-restrict nil) + (put 'org-agenda-files 'org-restrict nil) + (move-marker org-agenda-restrict-begin nil) + (move-marker org-agenda-restrict-end nil) + (setq current-prefix-arg nil) + (message "Agenda restriction lock removed") + (or noupdate (org-agenda-maybe-redo)))) + +(defun org-agenda-maybe-redo () + "If there is any window showing the agenda view, update it." + (let ((w (get-buffer-window (or org-agenda-this-buffer-name + org-agenda-buffer-name) + t)) + (w0 (selected-window))) + (when w + (select-window w) + (org-agenda-redo) + (select-window w0) + (if org-agenda-overriding-restriction + (message "Agenda view shifted to new %s restriction" + org-agenda-overriding-restriction) + (message "Agenda restriction lock removed"))))) + +;;; Agenda commands + +(defun org-agenda-check-type (error &rest types) + "Check if agenda buffer or component is of allowed type. +If ERROR is non-nil, throw an error, otherwise just return nil. +Allowed types are `agenda' `todo' `tags' `search'." + (cond ((not org-agenda-type) + (error "No Org agenda currently displayed")) + ((memq org-agenda-type types) t) + (error + (error "Not allowed in '%s'-type agenda buffer or component" org-agenda-type)) + (t nil))) + +(defun org-agenda-Quit () + "Exit the agenda, killing the agenda buffer. +Like `org-agenda-quit', but kill the buffer even when +`org-agenda-sticky' is non-nil." + (interactive) + (org-agenda--quit)) + +(defun org-agenda-quit () + "Exit the agenda. + +When `org-agenda-sticky' is non-nil, bury the agenda buffer +instead of killing it. + +When `org-agenda-restore-windows-after-quit' is non-nil, restore +the pre-agenda window configuration. + +When column view is active, exit column view instead of the +agenda." + (interactive) + (org-agenda--quit org-agenda-sticky)) + +(defun org-agenda--quit (&optional bury) + (if org-agenda-columns-active + (org-columns-quit) + (let ((wconf org-agenda-pre-window-conf) + (buf (current-buffer)) + (org-agenda-last-indirect-window + (and (eq org-indirect-buffer-display 'other-window) + org-agenda-last-indirect-buffer + (get-buffer-window org-agenda-last-indirect-buffer)))) + (cond + ((eq org-agenda-window-setup 'other-frame) + (delete-frame)) + ((eq org-agenda-window-setup 'other-tab) + (if (fboundp 'tab-bar-close-tab) + (tab-bar-close-tab) + (user-error "Your version of Emacs does not have tab bar mode support"))) + ((and org-agenda-restore-windows-after-quit + wconf) + ;; Maybe restore the pre-agenda window configuration. Reset + ;; `org-agenda-pre-window-conf' before running + ;; `set-window-configuration', which loses the current buffer. + (setq org-agenda-pre-window-conf nil) + (set-window-configuration wconf)) + (t + (when org-agenda-last-indirect-window + (delete-window org-agenda-last-indirect-window)) + (and (not (eq org-agenda-window-setup 'current-window)) + (not (one-window-p)) + (delete-window)))) + (if bury + ;; Set the agenda buffer as the current buffer instead of + ;; passing it as an argument to `bury-buffer' so that + ;; `bury-buffer' removes it from the window. + (with-current-buffer buf + (bury-buffer)) + (kill-buffer buf) + (setq org-agenda-archives-mode nil + org-agenda-buffer nil))))) + +(defun org-agenda-exit () + "Exit the agenda, killing Org buffers loaded by the agenda. +Like `org-agenda-Quit', but kill any buffers that were created by +the agenda. Org buffers visited directly by the user will not be +touched. Also, exit the agenda even if it is in column view." + (interactive) + (when org-agenda-columns-active + (org-columns-quit)) + (org-release-buffers org-agenda-new-buffers) + (setq org-agenda-new-buffers nil) + (org-agenda-Quit)) + +(defun org-agenda-kill-all-agenda-buffers () + "Kill all buffers in `org-agenda-mode'. +This is used when toggling sticky agendas." + (interactive) + (let (blist) + (dolist (buf (buffer-list)) + (when (with-current-buffer buf (eq major-mode 'org-agenda-mode)) + (push buf blist))) + (mapc #'kill-buffer blist))) + +(defun org-agenda-execute (arg) + "Execute another agenda command, keeping same window. +So this is just a shortcut for \\`\\[org-agenda]', available +in the agenda." + (interactive "P") + (let ((org-agenda-window-setup 'current-window)) + (org-agenda arg))) + +(defun org-agenda-redo (&optional all) + "Rebuild possibly ALL agenda view(s) in the current buffer." + (interactive "P") + (defvar org-agenda-tag-filter-while-redo) ;FIXME: Where is this var used? + (let* ((p (or (and (looking-at "\\'") (1- (point))) (point))) + (cpa (unless (eq all t) current-prefix-arg)) + (org-agenda-doing-sticky-redo org-agenda-sticky) + (org-agenda-sticky nil) + (org-agenda-buffer-name (or org-agenda-this-buffer-name + org-agenda-buffer-name)) + (org-agenda-keep-modes t) + (tag-filter org-agenda-tag-filter) + (tag-preset (get 'org-agenda-tag-filter :preset-filter)) + (top-hl-filter org-agenda-top-headline-filter) + (cat-filter org-agenda-category-filter) + (cat-preset (get 'org-agenda-category-filter :preset-filter)) + (re-filter org-agenda-regexp-filter) + (re-preset (get 'org-agenda-regexp-filter :preset-filter)) + (effort-filter org-agenda-effort-filter) + (effort-preset (get 'org-agenda-effort-filter :preset-filter)) + (org-agenda-tag-filter-while-redo (or tag-filter tag-preset)) + (cols org-agenda-columns-active) + (line (org-current-line)) + (window-line (- line (org-current-line (window-start)))) + (lprops (get 'org-agenda-redo-command 'org-lprops)) + (redo-cmd (get-text-property p 'org-redo-cmd)) + (last-args (get-text-property p 'org-last-args)) + (org-agenda-overriding-cmd (get-text-property p 'org-series-cmd)) + (org-agenda-overriding-cmd-arguments + (unless (eq all t) + (cond ((listp last-args) + (cons (or cpa (car last-args)) (cdr last-args))) + ((stringp last-args) + last-args)))) + (series-redo-cmd (get-text-property p 'org-series-redo-cmd))) + (put 'org-agenda-tag-filter :preset-filter nil) + (put 'org-agenda-category-filter :preset-filter nil) + (put 'org-agenda-regexp-filter :preset-filter nil) + (put 'org-agenda-effort-filter :preset-filter nil) + (and cols (org-columns-quit)) + (message "Rebuilding agenda buffer...") + (if series-redo-cmd + (eval series-redo-cmd t) + (cl-progv + (mapcar #'car lprops) + (mapcar (lambda (binding) (eval (cadr binding) t)) lprops) + (eval redo-cmd t))) + (setq org-agenda-undo-list nil + org-agenda-pending-undo-list nil + org-agenda-tag-filter tag-filter + org-agenda-category-filter cat-filter + org-agenda-regexp-filter re-filter + org-agenda-effort-filter effort-filter + org-agenda-top-headline-filter top-hl-filter) + (message "Rebuilding agenda buffer...done") + (put 'org-agenda-tag-filter :preset-filter tag-preset) + (put 'org-agenda-category-filter :preset-filter cat-preset) + (put 'org-agenda-regexp-filter :preset-filter re-preset) + (put 'org-agenda-effort-filter :preset-filter effort-preset) + (let ((tag (or tag-filter tag-preset)) + (cat (or cat-filter cat-preset)) + (effort (or effort-filter effort-preset)) + (re (or re-filter re-preset))) + (when tag (org-agenda-filter-apply tag 'tag t)) + (when cat (org-agenda-filter-apply cat 'category)) + (when effort (org-agenda-filter-apply effort 'effort)) + (when re (org-agenda-filter-apply re 'regexp))) + (and top-hl-filter (org-agenda-filter-top-headline-apply top-hl-filter)) + (and cols (called-interactively-p 'any) (org-agenda-columns)) + (org-goto-line line) + (when (called-interactively-p 'any) (recenter window-line)))) + +(defun org-agenda-redo-all (&optional exhaustive) + "Rebuild all agenda views in the current buffer. +With a prefix argument, do so in all agenda buffers." + (interactive "P") + (if exhaustive + (dolist (buffer (buffer-list)) + (with-current-buffer buffer + (when (derived-mode-p 'org-agenda-mode) + (org-agenda-redo t)))) + (org-agenda-redo t))) + +(defvar org-global-tags-completion-table nil) +(defvar org-agenda-filter-form nil) +(defvar org-agenda-filtered-by-category nil) + +(defsubst org-agenda-get-category () + "Return the category of the agenda line." + (org-get-at-bol 'org-category)) + +(defun org-agenda-filter-by-category (strip) + "Filter lines in the agenda buffer that have a specific category. +The category is that of the current line. +With a `\\[universal-argument]' prefix argument, exclude the lines of that category. +When there is already a category filter in place, this command removes the +filter." + (interactive "P") + (if (and org-agenda-filtered-by-category + org-agenda-category-filter) + (org-agenda-filter-show-all-cat) + (let ((cat (org-no-properties (org-get-at-eol 'org-category 1)))) + (cond + ((and cat strip) + (org-agenda-filter-apply + (push (concat "-" cat) org-agenda-category-filter) 'category)) + (cat + (org-agenda-filter-apply + (setq org-agenda-category-filter + (list (concat "+" cat))) + 'category)) + (t (error "No category at point")))))) + +(defun org-find-top-headline (&optional pos) + "Find the topmost parent headline and return it. +POS when non-nil is the marker or buffer position to start the +search from." + (save-excursion + (with-current-buffer (if (markerp pos) (marker-buffer pos) (current-buffer)) + (when pos (goto-char pos)) + ;; Skip up to the topmost parent. + (while (org-up-heading-safe)) + (ignore-errors + (replace-regexp-in-string + "^\\[[0-9]+/[0-9]+\\] *\\|^\\[%[0-9]+\\] *" "" + (nth 4 (org-heading-components))))))) + +(defvar org-agenda-filtered-by-top-headline nil) +(defun org-agenda-filter-by-top-headline (strip) + "Keep only those lines that are descendants from the same top headline. +The top headline is that of the current line. With prefix arg STRIP, hide +all lines of the category at point." + (interactive "P") + (if org-agenda-filtered-by-top-headline + (progn + (setq org-agenda-filtered-by-top-headline nil + org-agenda-top-headline-filter nil) + (org-agenda-filter-show-all-top-filter)) + (let ((toph (org-find-top-headline (org-get-at-bol 'org-hd-marker)))) + (if toph (org-agenda-filter-top-headline-apply toph strip) + (error "No top-level headline at point"))))) + +(defvar org-agenda-regexp-filter nil) +(defun org-agenda-filter-by-regexp (strip-or-accumulate) + "Filter agenda entries by a regular expressions. +You will be prompted for the regular expression, and the agenda +view will only show entries that are matched by that expression. + +With one `\\[universal-argument]' prefix argument, hide entries matching the regexp. +When there is already a regexp filter active, this command removed the +filter. However, with two `\\[universal-argument]' prefix arguments, add a new condition to +an already existing regexp filter." + (interactive "P") + (let* ((strip (equal strip-or-accumulate '(4))) + (accumulate (equal strip-or-accumulate '(16)))) + (cond + ((and org-agenda-regexp-filter (not accumulate)) + (org-agenda-filter-show-all-re) + (message "Regexp filter removed")) + (t (let ((flt (concat (if strip "-" "+") + (read-from-minibuffer + (if strip + "Hide entries matching regexp: " + "Narrow to entries matching regexp: "))))) + (push flt org-agenda-regexp-filter) + (org-agenda-filter-apply org-agenda-regexp-filter 'regexp)))))) + +(defvar org-agenda-effort-filter nil) +(defun org-agenda-filter-by-effort (strip-or-accumulate) + "Filter agenda entries by effort. +With no `\\[universal-argument]' prefix argument, keep entries matching the effort condition. +With one `\\[universal-argument]' prefix argument, filter out entries matching the condition. +With two `\\[universal-argument]' prefix arguments, add a second condition to the existing filter. +This last option is in practice not very useful, but it is available for +consistency with the other filter commands." + (interactive "P") + (let* ((efforts (split-string + (or (cdr (assoc-string (concat org-effort-property "_ALL") + org-global-properties + t)) + "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00"))) + ;; XXX: the following handles only up to 10 different + ;; effort values. + (allowed-keys (if (null efforts) nil + (mapcar (lambda (n) (mod n 10)) ;turn 10 into 0 + (number-sequence 1 (length efforts))))) + (keep (equal strip-or-accumulate '(16))) + (negative (equal strip-or-accumulate '(4))) + (current org-agenda-effort-filter) + (op nil)) + (while (not (memq op '(?< ?> ?= ?_))) + (setq op (read-char-exclusive + "Effort operator? (> = or <) or press `_' again to remove filter"))) + ;; Select appropriate duration. Ignore non-digit characters. + (if (eq op ?_) + (progn + (org-agenda-filter-show-all-effort) + (message "Effort filter removed")) + (let ((prompt + (apply #'format + (concat "Effort %c " + (mapconcat (lambda (s) (concat "[%d]" s)) + efforts + " ")) + op allowed-keys)) + (eff -1)) + (while (not (memq eff allowed-keys)) + (message prompt) + (setq eff (- (read-char-exclusive) 48))) + (org-agenda-filter-show-all-effort) + (setq org-agenda-effort-filter + (append + (list (concat (if negative "-" "+") + (char-to-string op) + ;; Numbering is 1 2 3 ... 9 0, but we want + ;; 0 1 2 ... 8 9. + (nth (mod (1- eff) 10) efforts))) + (if keep current nil))) + (org-agenda-filter-apply org-agenda-effort-filter 'effort))))) + +(defun org-agenda-filter (&optional strip-or-accumulate) + "Prompt for a general filter string and apply it to the agenda. + +The string may contain filter elements like + ++category ++tag ++ and = are also allowed as effort operators ++/regexp/ + +Instead of `+', `-' is allowed to strip the agenda of matching entries. +`+' is optional if it is not required to separate two string parts. +Multiple filter elements can be concatenated without spaces, for example + + +work-John<0:10-/plot/ + +selects entries with category `work' and effort estimates below 10 minutes, +and deselects entries with tag `John' or matching the regexp `plot'. + +During entry of the filter, completion for tags, categories and effort +values is offered. Since the syntax for categories and tags is identical +there should be no overlap between categories and tags. If there is, tags +get priority. + +A single `\\[universal-argument]' prefix arg STRIP-OR-ACCUMULATE will negate the +entire filter, which can be useful in connection with the prompt history. + +A double `\\[universal-argument] \\[universal-argument]' prefix arg will add the new filter elements to the +existing ones. A shortcut for this is to add an additional `+' at the +beginning of the string, like `+-John'. + +With a triple prefix argument, execute the computed filtering defined in +the variable `org-agenda-auto-exclude-function'." + (interactive "P") + (if (equal strip-or-accumulate '(64)) + ;; Execute the auto-exclude action + (if (not org-agenda-auto-exclude-function) + (user-error "`org-agenda-auto-exclude-function' is undefined") + (org-agenda-filter-show-all-tag) + (setq org-agenda-tag-filter nil) + (dolist (tag (org-agenda-get-represented-tags)) + (let ((modifier (funcall org-agenda-auto-exclude-function tag))) + (when modifier + (push modifier org-agenda-tag-filter)))) + (unless (null org-agenda-tag-filter) + (org-agenda-filter-apply org-agenda-tag-filter 'tag 'expand))) + ;; Prompt for a filter and act + (let* ((tag-list (org-agenda-get-represented-tags)) + (category-list (org-agenda-get-represented-categories)) + (negate (equal strip-or-accumulate '(4))) + (cf (mapconcat #'identity org-agenda-category-filter "")) + (tf (mapconcat #'identity org-agenda-tag-filter "")) + ;; (rpl-fn (lambda (c) (replace-regexp-in-string "^\\+" "" (or (car c) "")))) + (ef (replace-regexp-in-string "^\\+" "" (or (car org-agenda-effort-filter) ""))) + (rf (replace-regexp-in-string "^\\+" "" (or (car org-agenda-regexp-filter) ""))) + (ff (concat cf tf ef (when (not (equal rf "")) (concat "/" rf "/")))) + (f-string (completing-read + (concat + (if negate "Negative filter" "Filter") + " [+cat-tag<0:10-/regexp/]: ") + #'org-agenda-filter-completion-function + nil nil ff)) + (keep (or (if (string-match "^\\+[+-]" f-string) + (progn (setq f-string (substring f-string 1)) t)) + (equal strip-or-accumulate '(16)))) + (fc (if keep org-agenda-category-filter)) + (ft (if keep org-agenda-tag-filter)) + (fe (if keep org-agenda-effort-filter)) + (fr (if keep org-agenda-regexp-filter)) + pm s) + ;; If the filter contains a double-quoted string, replace a + ;; single hyphen by the arbitrary and temporary string "~~~" + ;; to disambiguate such hyphens from syntactic ones. + (setq f-string (replace-regexp-in-string + "\"\\([^\"]*\\)-\\([^\"]*\\)\"" "\"\\1~~~\\2\"" f-string)) + (while (string-match "^[ \t]*\\([-+]\\)?\\(\\([^-+<>=/ \t]+\\)\\|\\([<>=][0-9:]+\\)\\|\\(/\\([^/]+\\)/?\\)\\)" f-string) + (setq pm (if (match-beginning 1) (match-string 1 f-string) "+")) + (when negate + (setq pm (if (equal pm "+") "-" "+"))) + (cond + ((match-beginning 3) + ;; category or tag + (setq s (replace-regexp-in-string ; Remove the temporary special string. + "~~~" "-" (match-string 3 f-string))) + (cond + ((member s tag-list) + (org-pushnew-to-end (concat pm s) ft)) + ((member s category-list) + (org-pushnew-to-end (concat pm ; Remove temporary double quotes. + (replace-regexp-in-string "\"\\(.*\\)\"" "\\1" s)) + fc)) + (t (message + "`%s%s' filter ignored because tag/category is not represented" + pm s)))) + ((match-beginning 4) + ;; effort + (org-pushnew-to-end (concat pm (match-string 4 f-string)) fe)) + ((match-beginning 5) + ;; regexp + (org-pushnew-to-end (concat pm (match-string 6 f-string)) fr))) + (setq f-string (substring f-string (match-end 0)))) + (org-agenda-filter-remove-all) + (and fc (org-agenda-filter-apply + (setq org-agenda-category-filter fc) 'category)) + (and ft (org-agenda-filter-apply + (setq org-agenda-tag-filter ft) 'tag 'expand)) + (and fe (org-agenda-filter-apply + (setq org-agenda-effort-filter fe) 'effort)) + (and fr (org-agenda-filter-apply + (setq org-agenda-regexp-filter fr) 'regexp)) + (run-hooks 'org-agenda-filter-hook)))) + +(defun org-agenda-filter-completion-function (string _predicate &optional flag) + "Complete a complex filter string. +FLAG specifies the type of completion operation to perform. This +function is passed as a collection function to `completing-read', +which see." + (let ((completion-ignore-case t) ;tags are case-sensitive + (confirm (lambda (x) (stringp x))) + (prefix "") + (operator "") + table) + (when (string-match "^\\(.*\\([-+<>=]\\)\\)\\([^-+<>=]*\\)$" string) + (setq prefix (match-string 1 string) + operator (match-string 2 string) + string (match-string 3 string))) + (cond + ((member operator '("+" "-" "" nil)) + (setq table (append (org-agenda-get-represented-categories) + (org-agenda-get-represented-tags)))) + ((member operator '("<" ">" "=")) + (setq table (split-string + (or (cdr (assoc-string (concat org-effort-property "_ALL") + org-global-properties + t)) + "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00") + " +"))) + (t (setq table nil))) + (pcase flag + (`t (all-completions string table confirm)) + (`lambda (assoc string table)) ;exact match? + (`nil + (pcase (try-completion string table confirm) + ((and completion (pred stringp)) + (concat prefix completion)) + (completion completion))) + (_ nil)))) + +(defun org-agenda-filter-remove-all () + "Remove all filters from the current agenda buffer." + (interactive) + (when org-agenda-tag-filter + (org-agenda-filter-show-all-tag)) + (when org-agenda-category-filter + (org-agenda-filter-show-all-cat)) + (when org-agenda-regexp-filter + (org-agenda-filter-show-all-re)) + (when org-agenda-top-headline-filter + (org-agenda-filter-show-all-top-filter)) + (when org-agenda-effort-filter + (org-agenda-filter-show-all-effort)) + (org-agenda-finalize) + (when (called-interactively-p 'interactive) + (message "All agenda filters removed"))) + +(defun org-agenda-filter-by-tag (strip-or-accumulate &optional char exclude) + "Keep only those lines in the agenda buffer that have a specific tag. + +The tag is selected with its fast selection letter, as configured. + +With a `\\[universal-argument]' prefix, apply the filter negatively, stripping all matches. + +With a `\\[universal-argument] \\[universal-argument]' prefix, add the new tag to the existing filter +instead of replacing it. + +With a `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix, filter the literal tag, \ +i.e. don't +filter on all its group members. + +A Lisp caller can specify CHAR. EXCLUDE means that the new tag +should be used to exclude the search - the interactive user can +also press `-' or `+' to switch between filtering and excluding." + (interactive "P") + (let* ((alist org-tag-alist-for-agenda) + (seen-chars nil) + (tag-chars (mapconcat + (lambda (x) (if (and (not (symbolp (car x))) + (cdr x) + (not (member (cdr x) seen-chars))) + (progn + (push (cdr x) seen-chars) + (char-to-string (cdr x))) + "")) + org-tag-alist-for-agenda "")) + (valid-char-list (append '(?\t ?\r ?\\ ?. ?\s ?q) + (string-to-list tag-chars))) + (exclude (or exclude (equal strip-or-accumulate '(4)))) + (accumulate (equal strip-or-accumulate '(16))) + (expand (not (equal strip-or-accumulate '(64)))) + (inhibit-read-only t) + (current org-agenda-tag-filter) + a tag) ;; n + (unless char + (while (not (memq char valid-char-list)) + (org-unlogged-message + "%s by tag%s: [%s ]tag-char [TAB]tag %s[\\]off [q]uit" + (if exclude "Exclude[+]" "Filter[-]") + (if expand "" " (no grouptag expand)") + tag-chars + (if org-agenda-auto-exclude-function "[RET] " "")) + (setq char (read-char-exclusive)) + ;; Excluding or filtering down + (cond ((eq char ?-) (setq exclude t)) + ((eq char ?+) (setq exclude nil))))) + (when (eq char ?\t) + (unless (local-variable-p 'org-global-tags-completion-table) + (setq-local org-global-tags-completion-table + (org-global-tags-completion-table))) + (let ((completion-ignore-case t)) + (setq tag (completing-read + "Tag: " org-global-tags-completion-table nil t)))) + (cond + ((eq char ?\r) + (org-agenda-filter-show-all-tag) + (when org-agenda-auto-exclude-function + (setq org-agenda-tag-filter nil) + (dolist (tag (org-agenda-get-represented-tags)) + (let ((modifier (funcall org-agenda-auto-exclude-function tag))) + (when modifier + (push modifier org-agenda-tag-filter)))) + (unless (null org-agenda-tag-filter) + (org-agenda-filter-apply org-agenda-tag-filter 'tag expand)))) + ((eq char ?\\) + (org-agenda-filter-show-all-tag) + (when (get 'org-agenda-tag-filter :preset-filter) + (org-agenda-filter-apply org-agenda-tag-filter 'tag expand))) + ((eq char ?.) + (setq org-agenda-tag-filter + (mapcar (lambda(tag) (concat "+" tag)) + (org-get-at-bol 'tags))) + (org-agenda-filter-apply org-agenda-tag-filter 'tag expand)) + ((eq char ?q)) ;If q, abort (even if there is a q-key for a tag...) + ((or (eq char ?\s) + (setq a (rassoc char alist)) + (and tag (setq a (cons tag nil)))) + (org-agenda-filter-show-all-tag) + (setq tag (car a)) + (setq org-agenda-tag-filter + (cons (concat (if exclude "-" "+") tag) + (if accumulate current nil))) + (org-agenda-filter-apply org-agenda-tag-filter 'tag expand)) + (t (error "Invalid tag selection character %c" char))))) + +(defun org-agenda-get-represented-categories () + "Return a list of all categories used in this agenda buffer." + (or org-agenda-represented-categories + (when (derived-mode-p 'org-agenda-mode) + (let ((pos (point-min)) categories) + (while (and (< pos (point-max)) + (setq pos (next-single-property-change + pos 'org-category nil (point-max)))) + (push (get-text-property pos 'org-category) categories)) + (setq org-agenda-represented-categories + ;; Enclose category names with a hyphen in double + ;; quotes to process them specially in `org-agenda-filter'. + (mapcar (lambda (s) (if (string-match-p "-" s) (format "\"%s\"" s) s)) + (nreverse (org-uniquify (delq nil categories))))))))) + +(defvar org-tag-groups-alist-for-agenda) +(defun org-agenda-get-represented-tags () + "Return a list of all tags used in this agenda buffer. +These will be lower-case, for filtering." + (or org-agenda-represented-tags + (when (derived-mode-p 'org-agenda-mode) + (let ((pos (point-min)) tags-lists tt) + (while (and (< pos (point-max)) + (setq pos (next-single-property-change + pos 'tags nil (point-max)))) + (setq tt (get-text-property pos 'tags)) + (if tt (push tt tags-lists))) + (setq tags-lists + (nreverse (org-uniquify + (delq nil (apply #'append tags-lists))))) + (dolist (tag tags-lists) + (mapc + (lambda (group) + (when (member tag group) + (push (car group) tags-lists))) + org-tag-groups-alist-for-agenda)) + (setq org-agenda-represented-tags tags-lists))))) + +(defun org-agenda-filter-make-matcher (filter type &optional expand) + "Create the form that tests a line for agenda filter. +Optional argument EXPAND can be used for the TYPE tag and will +expand the tags in the FILTER if any of the tags in FILTER are +grouptags." + (let ((multi-pos-cats + (and (eq type 'category) + (string-match-p "\\+.*\\+" + (mapconcat (lambda (cat) (substring cat 0 1)) + filter "")))) + f f1) + (cond + ;; Tag filter + ((eq type 'tag) + (setq filter + (delete-dups + (append (get 'org-agenda-tag-filter :preset-filter) + filter))) + (dolist (x filter) + (let ((op (string-to-char x))) + (if expand (setq x (org-agenda-filter-expand-tags (list x) t)) + (setq x (list x))) + (setq f1 (org-agenda-filter-make-matcher-tag-exp x op)) + (push f1 f)))) + ;; Category filter + ((eq type 'category) + (setq filter + (delete-dups + (append (get 'org-agenda-category-filter :preset-filter) + filter))) + (dolist (x filter) + (if (equal "-" (substring x 0 1)) + (setq f1 (list 'not (list 'equal (substring x 1) 'cat))) + (setq f1 (list 'equal (substring x 1) 'cat))) + (push f1 f))) + ;; Regexp filter + ((eq type 'regexp) + (setq filter + (delete-dups + (append (get 'org-agenda-regexp-filter :preset-filter) + filter))) + (dolist (x filter) + (if (equal "-" (substring x 0 1)) + (setq f1 (list 'not (list 'string-match (substring x 1) 'txt))) + (setq f1 (list 'string-match (substring x 1) 'txt))) + (push f1 f))) + ;; Effort filter + ((eq type 'effort) + (setq filter + (delete-dups + (append (get 'org-agenda-effort-filter :preset-filter) + filter))) + (dolist (x filter) + (push (org-agenda-filter-effort-form x) f)))) + (cons (if multi-pos-cats 'or 'and) (nreverse f)))) + +(defun org-agenda-filter-make-matcher-tag-exp (tags op) + "Return a form associated to tag-expression TAGS. +Build a form testing a line for agenda filter for +tag-expressions. OP is an operator of type CHAR that allows the +function to set the right switches in the returned form." + (let (form) + ;; Any of the expressions can match if OP is +, all must match if + ;; the operator is -. + (dolist (x tags (cons (if (eq op ?-) 'and 'or) form)) + (let* ((tag (substring x 1)) + (f (cond + ((string= "" tag) 'tags) + ((and (string-match-p "\\`{" tag) (string-match-p "}\\'" tag)) + ;; TAG is a regexp. + (list 'org-match-any-p (substring tag 1 -1) 'tags)) + (t (list 'member tag 'tags))))) + (push (if (eq op ?-) (list 'not f) f) form))))) + +(defun org-agenda-filter-effort-form (e) + "Return the form to compare the effort of the current line with what E says. +E looks like \"+<2:25\"." + (let (op) + (setq e (substring e 1)) + (setq op (string-to-char e) e (substring e 1)) + (setq op (cond ((equal op ?<) '<=) + ((equal op ?>) '>=) + ((equal op ??) op) + (t '=))) + (list 'org-agenda-compare-effort (list 'quote op) + (org-duration-to-minutes e)))) + +(defun org-agenda-compare-effort (op value) + "Compare the effort of the current line with VALUE, using OP. +If the line does not have an effort defined, return nil." + ;; `effort-minutes' property cannot be extracted directly from + ;; current line but is stored as a property in `txt'. + (let ((effort (get-text-property 0 'effort-minutes (org-get-at-bol 'txt)))) + (funcall op + (or effort (if org-agenda-sort-noeffort-is-high 32767 -1)) + value))) + +(defun org-agenda-filter-expand-tags (filter &optional no-operator) + "Expand group tags in FILTER for the agenda. +When NO-OPERATOR is non-nil, do not add the + operator to +returned tags." + (if org-group-tags + (let (case-fold-search rtn) + (mapc + (lambda (f) + (let (f0 dir) + (if (string-match "^\\([+-]\\)\\(.+\\)" f) + (setq dir (match-string 1 f) f0 (match-string 2 f)) + (setq dir (if no-operator "" "+") f0 f)) + (setq rtn (append (mapcar (lambda(f1) (concat dir f1)) + (org-tags-expand f0 t)) + rtn)))) + filter) + (reverse rtn)) + filter)) + +(defun org-agenda-filter-apply (filter type &optional expand) + "Set FILTER as the new agenda filter and apply it. +Optional argument EXPAND can be used for the TYPE tag and will +expand the tags in the FILTER if any of the tags in FILTER are +grouptags." + ;; Deactivate `org-agenda-entry-text-mode' when filtering + (when org-agenda-entry-text-mode (org-agenda-entry-text-mode)) + (setq org-agenda-filter-form (org-agenda-filter-make-matcher + filter type expand)) + ;; Only set `org-agenda-filtered-by-category' to t when a unique + ;; category is used as the filter: + (setq org-agenda-filtered-by-category + (and (eq type 'category) + (not (equal (substring (car filter) 0 1) "-")))) + (org-agenda-set-mode-name) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (when (or (org-get-at-bol 'org-hd-marker) + (org-get-at-bol 'org-marker)) + (org-dlet + ((tags (org-get-at-bol 'tags)) + (cat (org-agenda-get-category)) + (txt (or (org-get-at-bol 'txt) ""))) + (unless (eval org-agenda-filter-form t) + (org-agenda-filter-hide-line type)))) + (beginning-of-line 2))) + (when (get-char-property (point) 'invisible) + (ignore-errors (org-agenda-previous-line)))) + +(defun org-agenda-filter-top-headline-apply (hl &optional negative) + "Filter by top headline HL." + (org-agenda-set-mode-name) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (let* ((pos (org-get-at-bol 'org-hd-marker)) + (tophl (and pos (org-find-top-headline pos)))) + (when (and tophl (funcall (if negative 'identity 'not) + (string= hl tophl))) + (org-agenda-filter-hide-line 'top-headline))) + (beginning-of-line 2))) + (when (get-char-property (point) 'invisible) + (org-agenda-previous-line)) + (setq org-agenda-top-headline-filter hl + org-agenda-filtered-by-top-headline t)) + +(defun org-agenda-filter-hide-line (type) + "If current line is TYPE, hide it in the agenda buffer." + (let* (buffer-invisibility-spec + (beg (max (point-min) (1- (point-at-bol)))) + (end (point-at-eol))) + (let ((inhibit-read-only t)) + (add-text-properties + beg end `(invisible org-filtered org-filter-type ,type))))) + +(defun org-agenda-remove-filter (type) + "Remove filter of type TYPE from the agenda buffer." + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((inhibit-read-only t) pos) + (while (setq pos (text-property-any (point) (point-max) + 'org-filter-type type)) + (goto-char pos) + (remove-text-properties + (point) (next-single-property-change (point) 'org-filter-type) + `(invisible org-filtered org-filter-type ,type)))) + (set (intern (format "org-agenda-%s-filter" (intern-soft type))) nil) + (setq org-agenda-filter-form nil) + (org-agenda-set-mode-name) + (org-agenda-finalize))) + +(defun org-agenda-filter-show-all-tag nil + (org-agenda-remove-filter 'tag)) +(defun org-agenda-filter-show-all-re nil + (org-agenda-remove-filter 'regexp)) +(defun org-agenda-filter-show-all-effort nil + (org-agenda-remove-filter 'effort)) +(defun org-agenda-filter-show-all-cat nil + (org-agenda-remove-filter 'category)) +(defun org-agenda-filter-show-all-top-filter nil + (org-agenda-remove-filter 'top-headline)) + +(defun org-agenda-manipulate-query-add () + "Manipulate the query by adding a search term with positive selection. +Positive selection means the term must be matched for selection of an entry." + (interactive) + (org-agenda-manipulate-query ?\[)) +(defun org-agenda-manipulate-query-subtract () + "Manipulate the query by adding a search term with negative selection. +Negative selection means term must not be matched for selection of an entry." + (interactive) + (org-agenda-manipulate-query ?\])) +(defun org-agenda-manipulate-query-add-re () + "Manipulate the query by adding a search regexp with positive selection. +Positive selection means the regexp must match for selection of an entry." + (interactive) + (org-agenda-manipulate-query ?\{)) +(defun org-agenda-manipulate-query-subtract-re () + "Manipulate the query by adding a search regexp with negative selection. +Negative selection means regexp must not match for selection of an entry." + (interactive) + (org-agenda-manipulate-query ?\})) +(defun org-agenda-manipulate-query (char) + (cond + ((eq org-agenda-type 'agenda) + (let ((org-agenda-include-inactive-timestamps t)) + (org-agenda-redo)) + (message "Display now includes inactive timestamps as well")) + ((eq org-agenda-type 'search) + (org-add-to-string + 'org-agenda-query-string + (if org-agenda-last-search-view-search-was-boolean + (cdr (assoc char '((?\[ . " +") (?\] . " -") + (?\{ . " +{}") (?\} . " -{}")))) + " ")) + (setq org-agenda-redo-command + (list 'org-search-view + (car (get-text-property (min (1- (point-max)) (point)) + 'org-last-args)) + org-agenda-query-string + (+ (length org-agenda-query-string) + (if (member char '(?\{ ?\})) 0 1)))) + (set-register org-agenda-query-register org-agenda-query-string) + (let ((org-agenda-overriding-arguments + (cdr org-agenda-redo-command))) + (org-agenda-redo))) + (t (error "Cannot manipulate query for %s-type agenda buffers" + org-agenda-type)))) + +(defun org-add-to-string (var string) + (set var (concat (symbol-value var) string))) + +(defun org-agenda-goto-date (date) + "Jump to DATE in agenda." + (interactive + (list + (let ((org-read-date-prefer-future org-agenda-jump-prefer-future)) + (org-read-date)))) + (let* ((day (time-to-days (org-time-string-to-time date))) + (org-agenda-sticky-orig org-agenda-sticky) + (org-agenda-buffer-tmp-name (buffer-name)) + (args (get-text-property (min (1- (point-max)) (point)) 'org-last-args)) + (0-arg (or current-prefix-arg (car args))) + (2-arg (nth 2 args)) + (with-hour-p (nth 4 org-agenda-redo-command)) + (newcmd (list 'org-agenda-list 0-arg date + (org-agenda-span-to-ndays + 2-arg (org-time-string-to-absolute date)) + with-hour-p)) + (newargs (cdr newcmd)) + (inhibit-read-only t) + org-agenda-sticky) + (if (not (org-agenda-check-type t 'agenda)) + (error "Not available in non-agenda views") + (add-text-properties (point-min) (point-max) + `(org-redo-cmd ,newcmd org-last-args ,newargs)) + (org-agenda-redo) + (goto-char (point-min)) + (while (not (or (= (or (get-text-property (point) 'day) 0) day) + (save-excursion (move-beginning-of-line 2) (eobp)))) + (move-beginning-of-line 2)) + (setq org-agenda-sticky org-agenda-sticky-orig + org-agenda-this-buffer-is-sticky org-agenda-sticky)))) + +(defun org-agenda-goto-today () + "Go to today." + (interactive) + (org-agenda-check-type t 'agenda) + (let* ((args (get-text-property (min (1- (point-max)) (point)) 'org-last-args)) + (curspan (nth 2 args)) + (tdpos (text-property-any (point-min) (point-max) 'org-today t))) + (cond + (tdpos (goto-char tdpos)) + ((eq org-agenda-type 'agenda) + (let* ((sd (org-agenda-compute-starting-span + (org-today) (or curspan org-agenda-span))) + (org-agenda-overriding-arguments args)) + (setf (nth 1 org-agenda-overriding-arguments) sd) + (org-agenda-redo) + (org-agenda-find-same-or-today-or-agenda))) + (t (error "Cannot find today"))))) + +(defun org-agenda-find-same-or-today-or-agenda (&optional cnt) + (goto-char + (or (and cnt (text-property-any (point-min) (point-max) 'org-day-cnt cnt)) + (text-property-any (point-min) (point-max) 'org-today t) + (text-property-any (point-min) (point-max) 'org-agenda-type 'agenda) + (and (get-text-property (min (1- (point-max)) (point)) 'org-series) + (org-agenda-backward-block)) + (point-min)))) + +(defun org-agenda-backward-block () + "Move backward by one agenda block." + (interactive) + (org-agenda-forward-block 'backward)) + +(defun org-agenda-forward-block (&optional backward) + "Move forward by one agenda block. +When optional argument BACKWARD is set, go backward." + (interactive) + (cond ((not (derived-mode-p 'org-agenda-mode)) + (user-error + "Cannot execute this command outside of org-agenda-mode buffers")) + ((looking-at (if backward "\\`" "\\'")) + (message "Already at the %s block" (if backward "first" "last"))) + (t (let ((_pos (prog1 (point) + (ignore-errors (if backward (backward-char 1) + (move-end-of-line 1))))) + (f (if backward + #'previous-single-property-change + #'next-single-property-change)) + moved dest) + (while (and (setq dest (funcall + f (point) 'org-agenda-structural-header)) + (not (get-text-property + (point) 'org-agenda-structural-header))) + (setq moved t) + (goto-char dest)) + (if moved (move-beginning-of-line 1) + (goto-char (if backward (point-min) (point-max))) + (move-beginning-of-line 1) + (message "No %s block" (if backward "previous" "further"))))))) + +(defun org-agenda-later (arg) + "Go forward in time by the current span. +With prefix ARG, go forward that many times the current span." + (interactive "p") + (org-agenda-check-type t 'agenda) + (let* ((wstart (window-start)) + (args (get-text-property (min (1- (point-max)) (point)) 'org-last-args)) + (span (or (nth 2 args) org-agenda-current-span)) + (sd (or (nth 1 args) (org-get-at-bol 'day) org-starting-day)) + (greg (calendar-gregorian-from-absolute sd)) + (cnt (org-get-at-bol 'org-day-cnt)) + greg2) + (cond + ((numberp span) + (setq sd (+ (* span arg) sd))) + ((eq span 'day) + (setq sd (+ arg sd))) + ((eq span 'week) + (setq sd (+ (* 7 arg) sd))) + ((eq span 'fortnight) + (setq sd (+ (* 14 arg) sd))) + ((eq span 'month) + (setq greg2 (list (+ (car greg) arg) (nth 1 greg) (nth 2 greg)) + sd (calendar-absolute-from-gregorian greg2)) + (setcar greg2 (1+ (car greg2)))) + ((eq span 'year) + (setq greg2 (list (car greg) (nth 1 greg) (+ arg (nth 2 greg))) + sd (calendar-absolute-from-gregorian greg2)) + (setcar (nthcdr 2 greg2) (1+ (nth 2 greg2)))) + (t + (setq sd (+ (* span arg) sd)))) + (let ((org-agenda-overriding-cmd + ;; `cmd' may have been set by `org-agenda-run-series' which + ;; uses `org-agenda-overriding-cmd' to decide whether + ;; overriding is allowed for `cmd' + (get-text-property (min (1- (point-max)) (point)) 'org-series-cmd)) + (org-agenda-overriding-arguments + (list (car args) sd span))) + (org-agenda-redo) + (org-agenda-find-same-or-today-or-agenda cnt)) + (set-window-start nil wstart))) + +(defun org-agenda-earlier (arg) + "Go backward in time by the current span. +With prefix ARG, go backward that many times the current span." + (interactive "p") + (org-agenda-later (- arg))) + +(defun org-agenda-view-mode-dispatch () + "Call one of the view mode commands." + (interactive) + (org-unlogged-message + "View: [d]ay [w]eek for[t]night [m]onth [y]ear [SPC]reset [q]uit/abort + time[G]rid [[]inactive [f]ollow [l]og [L]og-all [c]lockcheck + [a]rch-trees [A]rch-files clock[R]eport include[D]iary [E]ntryText") + (pcase (read-char-exclusive) + (?\ (call-interactively 'org-agenda-reset-view)) + (?d (call-interactively 'org-agenda-day-view)) + (?w (call-interactively 'org-agenda-week-view)) + (?t (call-interactively 'org-agenda-fortnight-view)) + (?m (call-interactively 'org-agenda-month-view)) + (?y (call-interactively 'org-agenda-year-view)) + (?l (call-interactively 'org-agenda-log-mode)) + (?L (org-agenda-log-mode '(4))) + (?c (org-agenda-log-mode 'clockcheck)) + ((or ?F ?f) (call-interactively 'org-agenda-follow-mode)) + (?a (call-interactively 'org-agenda-archives-mode)) + (?A (org-agenda-archives-mode 'files)) + ((or ?R ?r) (call-interactively 'org-agenda-clockreport-mode)) + ((or ?E ?e) (call-interactively 'org-agenda-entry-text-mode)) + (?G (call-interactively 'org-agenda-toggle-time-grid)) + (?D (call-interactively 'org-agenda-toggle-diary)) + (?\! (call-interactively 'org-agenda-toggle-deadlines)) + (?\[ (let ((org-agenda-include-inactive-timestamps t)) + (org-agenda-check-type t 'agenda) + (org-agenda-redo)) + (message "Display now includes inactive timestamps as well")) + (?q (message "Abort")) + (key (user-error "Invalid key: %s" key)))) + +(defun org-agenda-reset-view () + "Switch to default view for agenda." + (interactive) + (org-agenda-change-time-span org-agenda-span)) + +(defun org-agenda-day-view (&optional day-of-month) + "Switch to daily view for agenda. +With argument DAY-OF-MONTH, switch to that day of the month." + (interactive "P") + (org-agenda-change-time-span 'day day-of-month)) + +(defun org-agenda-week-view (&optional iso-week) + "Switch to weekly view for agenda. +With argument ISO-WEEK, switch to the corresponding ISO week. +If ISO-WEEK has more then 2 digits, only the last two encode +the week. Any digits before this encode a year. So 200712 +means week 12 of year 2007. Years ranging from 70 years ago +to 30 years in the future can also be written as 2-digit years." + (interactive "P") + (org-agenda-change-time-span 'week iso-week)) + +(defun org-agenda-fortnight-view (&optional iso-week) + "Switch to fortnightly view for agenda. +With argument ISO-WEEK, switch to the corresponding ISO week. +If ISO-WEEK has more then 2 digits, only the last two encode +the week. Any digits before this encode a year. So 200712 +means week 12 of year 2007. Years ranging from 70 years ago +to 30 years in the future can also be written as 2-digit years." + (interactive "P") + (org-agenda-change-time-span 'fortnight iso-week)) + +(defun org-agenda-month-view (&optional month) + "Switch to monthly view for agenda. +With argument MONTH, switch to that month. If MONTH has more +then 2 digits, only the last two encode the month. Any digits +before this encode a year. So 200712 means December year 2007. +Years ranging from 70 years ago to 30 years in the future can +also be written as 2-digit years." + (interactive "P") + (org-agenda-change-time-span 'month month)) + +(defun org-agenda-year-view (&optional year) + "Switch to yearly view for agenda. +With argument YEAR, switch to that year. Years ranging from 70 +years ago to 30 years in the future can also be written as +2-digit years." + (interactive "P") + (when year + (setq year (org-small-year-to-year year))) + (if (y-or-n-p "Are you sure you want to compute the agenda for an entire year? ") + (org-agenda-change-time-span 'year year) + (error "Abort"))) + +(defun org-agenda-change-time-span (span &optional n) + "Change the agenda view to SPAN. +SPAN may be `day', `week', `fortnight', `month', `year'." + (org-agenda-check-type t 'agenda) + (let* ((args (get-text-property (min (1- (point-max)) (point)) 'org-last-args)) + (curspan (nth 2 args))) + (when (and (not n) (equal curspan span)) + (error "Viewing span is already \"%s\"" span)) + (let* ((sd (or (org-get-at-bol 'day) + (nth 1 args) + org-starting-day)) + (sd (org-agenda-compute-starting-span sd span n)) + (org-agenda-overriding-cmd + (get-text-property (min (1- (point-max)) (point)) 'org-series-cmd)) + (org-agenda-overriding-arguments + (list (car args) sd span))) + (org-agenda-redo) + (org-agenda-find-same-or-today-or-agenda)) + (org-agenda-set-mode-name) + (message "Switched to %s view" span))) + +(defun org-agenda-compute-starting-span (sd span &optional n) + "Compute starting date for agenda. +SPAN may be `day', `week', `fortnight', `month', `year'. The return value +is a cons cell with the starting date and the number of days, +so that the date SD will be in that range." + (let* ((greg (calendar-gregorian-from-absolute sd)) + ;; (dg (nth 1 greg)) + (mg (car greg)) + (yg (nth 2 greg))) + (cond + ((eq span 'day) + (when n + (setq sd (+ (calendar-absolute-from-gregorian + (list mg 1 yg)) + n -1)))) + ((or (eq span 'week) (eq span 'fortnight)) + (let* ((nt (calendar-day-of-week + (calendar-gregorian-from-absolute sd))) + (d (if org-agenda-start-on-weekday + (- nt org-agenda-start-on-weekday) + 0)) + y1) + (setq sd (- sd (+ (if (< d 0) 7 0) d))) + (when n + (require 'cal-iso) + (when (> n 99) + (setq y1 (org-small-year-to-year (/ n 100)) + n (mod n 100))) + (setq sd + (calendar-iso-to-absolute + (list n 1 + (or y1 (nth 2 (calendar-iso-from-absolute sd))))))))) + ((eq span 'month) + (let (y1) + (when (and n (> n 99)) + (setq y1 (org-small-year-to-year (/ n 100)) + n (mod n 100))) + (setq sd (calendar-absolute-from-gregorian + (list (or n mg) 1 (or y1 yg)))))) + ((eq span 'year) + (setq sd (calendar-absolute-from-gregorian + (list 1 1 (or n yg)))))) + sd)) + +(defun org-agenda-next-date-line (&optional arg) + "Jump to the next line indicating a date in agenda buffer." + (interactive "p") + (org-agenda-check-type t 'agenda) + (beginning-of-line 1) + ;; This does not work if user makes date format that starts with a blank + (when (looking-at-p "^\\S-") (forward-char 1)) + (unless (re-search-forward "^\\S-" nil t arg) + (backward-char 1) + (error "No next date after this line in this buffer")) + (goto-char (match-beginning 0))) + +(defun org-agenda-previous-date-line (&optional arg) + "Jump to the previous line indicating a date in agenda buffer." + (interactive "p") + (org-agenda-check-type t 'agenda) + (beginning-of-line 1) + (unless (re-search-backward "^\\S-" nil t arg) + (error "No previous date before this line in this buffer"))) + +;; Initialize the highlight +(defvar org-hl (make-overlay 1 1)) +(overlay-put org-hl 'face 'highlight) + +(defun org-highlight (begin end &optional buffer) + "Highlight a region with overlay." + (move-overlay org-hl begin end (or buffer (current-buffer)))) + +(defun org-unhighlight () + "Detach overlay INDEX." + (delete-overlay org-hl)) + +(defun org-unhighlight-once () + "Remove the highlight from its position, and this function from the hook." + (remove-hook 'pre-command-hook #'org-unhighlight-once) + (org-unhighlight)) + +(defvar org-agenda-pre-follow-window-conf nil) +(defun org-agenda-follow-mode () + "Toggle follow mode in an agenda buffer." + (interactive) + (unless org-agenda-follow-mode + (setq org-agenda-pre-follow-window-conf + (current-window-configuration))) + (setq org-agenda-follow-mode (not org-agenda-follow-mode)) + (unless org-agenda-follow-mode + (set-window-configuration org-agenda-pre-follow-window-conf)) + (org-agenda-set-mode-name) + (org-agenda-do-context-action) + (message "Follow mode is %s" + (if org-agenda-follow-mode "on" "off"))) + +(defun org-agenda-entry-text-mode (&optional arg) + "Toggle entry text mode in an agenda buffer." + (interactive "P") + (if (or org-agenda-tag-filter + org-agenda-category-filter + org-agenda-regexp-filter + org-agenda-top-headline-filter) + (user-error "Can't show entry text in filtered views") + (setq org-agenda-entry-text-mode (or (integerp arg) + (not org-agenda-entry-text-mode))) + (org-agenda-entry-text-hide) + (and org-agenda-entry-text-mode + (let ((org-agenda-entry-text-maxlines + (if (integerp arg) arg org-agenda-entry-text-maxlines))) + (org-agenda-entry-text-show))) + (org-agenda-set-mode-name) + (message "Entry text mode is %s%s" + (if org-agenda-entry-text-mode "on" "off") + (if (not org-agenda-entry-text-mode) "" + (format " (maximum number of lines is %d)" + (if (integerp arg) arg org-agenda-entry-text-maxlines)))))) + +(defun org-agenda-clockreport-mode () + "Toggle clocktable mode in an agenda buffer." + (interactive) + (org-agenda-check-type t 'agenda) + (setq org-agenda-clockreport-mode (not org-agenda-clockreport-mode)) + (org-agenda-set-mode-name) + (org-agenda-redo) + (message "Clocktable mode is %s" + (if org-agenda-clockreport-mode "on" "off"))) + +(defun org-agenda-log-mode (&optional special) + "Toggle log mode in an agenda buffer. + +With argument SPECIAL, show all possible log items, not only the ones +configured in `org-agenda-log-mode-items'. + +With a `\\[universal-argument] \\[universal-argument]' prefix, show *only* \ +log items, nothing else." + (interactive "P") + (org-agenda-check-type t 'agenda) + (setq org-agenda-show-log + (cond + ((equal special '(16)) 'only) + ((eq special 'clockcheck) + (if (eq org-agenda-show-log 'clockcheck) + nil 'clockcheck)) + (special '(closed clock state)) + (t (not org-agenda-show-log)))) + (org-agenda-set-mode-name) + (org-agenda-redo) + (message "Log mode is %s" (if org-agenda-show-log "on" "off"))) + +(defun org-agenda-archives-mode (&optional with-files) + "Toggle inclusion of items in trees marked with :ARCHIVE:. +When called with a prefix argument, include all archive files as well." + (interactive "P") + (setq org-agenda-archives-mode + (cond ((and with-files (eq org-agenda-archives-mode t)) nil) + (with-files t) + (org-agenda-archives-mode nil) + (t 'trees))) + (org-agenda-set-mode-name) + (org-agenda-redo) + (message + "%s" + (cond + ((eq org-agenda-archives-mode nil) + "No archives are included") + ((eq org-agenda-archives-mode 'trees) + (format "Trees with :%s: tag are included" org-archive-tag)) + ((eq org-agenda-archives-mode t) + (format "Trees with :%s: tag and all active archive files are included" + org-archive-tag))))) + +(defun org-agenda-toggle-diary () + "Toggle diary inclusion in an agenda buffer." + (interactive) + (org-agenda-check-type t 'agenda) + (setq org-agenda-include-diary (not org-agenda-include-diary)) + (org-agenda-redo) + (org-agenda-set-mode-name) + (message "Diary inclusion turned %s" + (if org-agenda-include-diary "on" "off"))) + +(defun org-agenda-toggle-deadlines () + "Toggle inclusion of entries with a deadline in an agenda buffer." + (interactive) + (org-agenda-check-type t 'agenda) + (setq org-agenda-include-deadlines (not org-agenda-include-deadlines)) + (org-agenda-redo) + (org-agenda-set-mode-name) + (message "Deadlines inclusion turned %s" + (if org-agenda-include-deadlines "on" "off"))) + +(defun org-agenda-toggle-time-grid () + "Toggle time grid in an agenda buffer." + (interactive) + (org-agenda-check-type t 'agenda) + (setq org-agenda-use-time-grid (not org-agenda-use-time-grid)) + (org-agenda-redo) + (org-agenda-set-mode-name) + (message "Time-grid turned %s" + (if org-agenda-use-time-grid "on" "off"))) + +(defun org-agenda-set-mode-name () + "Set the mode name to indicate all the small mode settings." + (setq mode-name + (list "Org-Agenda" + (if (get 'org-agenda-files 'org-restrict) " []" "") + " " + '(:eval (org-agenda-span-name org-agenda-current-span)) + (if org-agenda-follow-mode " Follow" "") + (if org-agenda-entry-text-mode " ETxt" "") + (if org-agenda-include-diary " Diary" "") + (if org-agenda-include-deadlines " Ddl" "") + (if org-agenda-use-time-grid " Grid" "") + (if (and (boundp 'org-habit-show-habits) + org-habit-show-habits) + " Habit" "") + (cond + ((consp org-agenda-show-log) " LogAll") + ((eq org-agenda-show-log 'clockcheck) " ClkCk") + (org-agenda-show-log " Log") + (t "")) + (if (org-agenda-filter-any) " " "") + (if (or org-agenda-category-filter + (get 'org-agenda-category-filter :preset-filter)) + '(:eval (propertize + (concat "[" + (mapconcat + #'identity + (append + (get 'org-agenda-category-filter :preset-filter) + org-agenda-category-filter) + "") + "]") + 'face 'org-agenda-filter-category + 'help-echo "Category used in filtering")) + "") + (if (or org-agenda-tag-filter + (get 'org-agenda-tag-filter :preset-filter)) + '(:eval (propertize + (concat (mapconcat + #'identity + (append + (get 'org-agenda-tag-filter :preset-filter) + org-agenda-tag-filter) + "")) + 'face 'org-agenda-filter-tags + 'help-echo "Tags used in filtering")) + "") + (if (or org-agenda-effort-filter + (get 'org-agenda-effort-filter :preset-filter)) + '(:eval (propertize + (concat (mapconcat + #'identity + (append + (get 'org-agenda-effort-filter :preset-filter) + org-agenda-effort-filter) + "")) + 'face 'org-agenda-filter-effort + 'help-echo "Effort conditions used in filtering")) + "") + (if (or org-agenda-regexp-filter + (get 'org-agenda-regexp-filter :preset-filter)) + '(:eval (propertize + (concat (mapconcat + (lambda (x) (concat (substring x 0 1) "/" (substring x 1) "/")) + (append + (get 'org-agenda-regexp-filter :preset-filter) + org-agenda-regexp-filter) + "")) + 'face 'org-agenda-filter-regexp + 'help-echo "Regexp used in filtering")) + "") + (if org-agenda-archives-mode + (if (eq org-agenda-archives-mode t) + " Archives" + (format " :%s:" org-archive-tag)) + "") + (if org-agenda-clockreport-mode " Clock" ""))) + (force-mode-line-update)) + +(defun org-agenda-update-agenda-type () + "Update the agenda type after each command." + (setq org-agenda-type + (or (get-text-property (point) 'org-agenda-type) + (get-text-property (max (point-min) (1- (point))) 'org-agenda-type)))) + +(defun org-agenda-next-line () + "Move cursor to the next line, and show if follow mode is active." + (interactive) + (call-interactively 'next-line) + (org-agenda-do-context-action)) + +(defun org-agenda-previous-line () + "Move cursor to the previous line, and show if follow-mode is active." + (interactive) + (call-interactively 'previous-line) + (org-agenda-do-context-action)) + +(defun org-agenda-next-item (n) + "Move cursor to next agenda item." + (interactive "p") + (let ((col (current-column))) + (dotimes (_ n) + (when (next-single-property-change (point-at-eol) 'org-marker) + (move-end-of-line 1) + (goto-char (next-single-property-change (point) 'org-marker)))) + (org-move-to-column col)) + (org-agenda-do-context-action)) + +(defun org-agenda-previous-item (n) + "Move cursor to next agenda item." + (interactive "p") + (dotimes (_ n) + (let ((col (current-column)) + (goto (save-excursion + (move-end-of-line 0) + (previous-single-property-change (point) 'org-marker)))) + (when goto (goto-char goto)) + (org-move-to-column col))) + (org-agenda-do-context-action)) + +(defun org-agenda-do-context-action () + "Show outline path and, maybe, follow mode window." + (let ((m (org-get-at-bol 'org-marker))) + (when (and (markerp m) (marker-buffer m)) + (and org-agenda-follow-mode + (if org-agenda-follow-indirect + (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 t)))))) + +(defun org-agenda-show-tags () + "Show the tags applicable to the current item." + (interactive) + (let* ((tags (org-get-at-bol 'tags))) + (if tags + (message "Tags are :%s:" + (org-no-properties (mapconcat #'identity tags ":"))) + (message "No tags associated with this line")))) + +(defun org-agenda-goto (&optional highlight) + "Go to the entry at point in the corresponding Org file." + (interactive) + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker))) + ;; FIXME: use `org-switch-to-buffer-other-window'? + (switch-to-buffer-other-window buffer) + (widen) + (push-mark) + (goto-char pos) + (when (derived-mode-p 'org-mode) + (org-show-context 'agenda) + (recenter (/ (window-height) 2)) + (org-back-to-heading t) + (let ((case-fold-search nil)) + (when (re-search-forward org-complex-heading-regexp nil t) + (goto-char (match-beginning 4))))) + (run-hooks 'org-agenda-after-show-hook) + (and highlight (org-highlight (point-at-bol) (point-at-eol))))) + +(defvar org-agenda-after-show-hook nil + "Normal hook run after an item has been shown from the agenda. +Point is in the buffer where the item originated.") + +;; Defined later in org-agenda.el +(defvar org-agenda-loop-over-headlines-in-active-region nil) + +(defun org-agenda-do-in-region (beg end cmd &optional arg force-arg delete) + "Between region BEG and END, call agenda command CMD. +When optional argument ARG is non-nil or FORCE-ARG is t, pass +ARG to CMD. When optional argument DELETE is non-nil, assume CMD +deletes the agenda entry and don't move to the next entry." + (save-excursion + (goto-char beg) + (let ((mend (move-marker (make-marker) end)) + (all (eq org-agenda-loop-over-headlines-in-active-region t)) + (match (and (stringp org-agenda-loop-over-headlines-in-active-region) + org-agenda-loop-over-headlines-in-active-region)) + (level (and (eq org-agenda-loop-over-headlines-in-active-region 'start-level) + (org-get-at-bol 'level)))) + (while (< (point) mend) + (let ((ov (make-overlay (point) (point-at-eol)))) + (if (not (or all + (and match (looking-at-p match)) + (eq level (org-get-at-bol 'level)))) + (org-agenda-next-item 1) + (overlay-put ov 'face 'region) + (if (or arg force-arg) (funcall cmd arg) (funcall cmd)) + (when (not delete) (org-agenda-next-item 1)) + (delete-overlay ov))))))) + +;; org-agenda-[schedule,deadline,date-prompt,todo,[toggle]archive*, +;; kill,set-property,set-effort] commands may loop over agenda +;; entries. Commands `org-agenda-set-tags' and `org-agenda-bulk-mark' +;; use their own mechanisms on active regions. +(defmacro org-agenda-maybe-loop (cmd arg force-arg delete &rest body) + "Maybe loop over agenda entries and perform CMD. +Pass ARG, FORCE-ARG, DELETE and BODY to `org-agenda-do-in-region'." + (declare (debug t)) + `(if (and (called-interactively-p 'any) + org-agenda-loop-over-headlines-in-active-region + (org-region-active-p)) + (org-agenda-do-in-region + (region-beginning) (region-end) ,cmd ,arg ,force-arg ,delete) + ,@body)) + +(defun org-agenda-kill () + "Kill the entry or subtree belonging to the current agenda entry." + (interactive) + (or (eq major-mode 'org-agenda-mode) (user-error "Not in agenda")) + (org-agenda-maybe-loop + #'org-agenda-kill nil nil t + (let* ((bufname-orig (buffer-name)) + (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 (point-at-bol) + dend (min (point-max) (1+ (point-at-eol))))) + (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))) + (let ((win-conf (current-window-configuration))) + (unwind-protect + (and + (prog2 + (org-agenda-tree-to-indirect-buffer nil) + (not (y-or-n-p + (format "Delete entry with %d lines in buffer \"%s\"? " + n (buffer-name buffer)))) + (kill-buffer org-last-indirect-buffer)) + (error "Abort")) + (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)) + (message "Agenda item and source killed"))))) + +(defvar org-archive-default-command) ; defined in org-archive.el +(defun org-agenda-archive-default () + "Archive the entry or subtree belonging to the current agenda entry." + (interactive) + (require 'org-archive) + (funcall-interactively + #'org-agenda-archive-with org-archive-default-command)) + +(defun org-agenda-archive-default-with-confirmation () + "Archive the entry or subtree belonging to the current agenda entry." + (interactive) + (require 'org-archive) + (funcall-interactively + #'org-agenda-archive-with org-archive-default-command 'confirm)) + +(defun org-agenda-archive () + "Archive the entry or subtree belonging to the current agenda entry." + (interactive) + (funcall-interactively + #'org-agenda-archive-with 'org-archive-subtree)) + +(defun org-agenda-archive-to-archive-sibling () + "Move the entry to the archive sibling." + (interactive) + (funcall-interactively + #'org-agenda-archive-with 'org-archive-to-archive-sibling)) + +(defvar org-archive-from-agenda) + +(defun org-agenda-archive-with (cmd &optional confirm) + "Move the entry to the archive sibling." + (interactive) + (or (eq major-mode 'org-agenda-mode) (user-error "Not in agenda")) + (org-agenda-maybe-loop + #'org-agenda-archive-with cmd nil t + (let* ((bufname-orig (buffer-name)) + (marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker))) + (org-with-remote-undo buffer + (with-current-buffer buffer + (if (derived-mode-p 'org-mode) + (if (and confirm + (not (y-or-n-p "Archive this subtree or entry? "))) + (error "Abort") + (save-window-excursion + (goto-char pos) + (let ((org-agenda-buffer-name bufname-orig)) + (org-remove-subtree-entries-from-agenda)) + (org-back-to-heading t) + (let ((org-archive-from-agenda t)) + (funcall cmd)))) + (error "Archiving works only in Org files"))))))) + +(defun org-remove-subtree-entries-from-agenda (&optional buf beg end) + "Remove all lines in the agenda that correspond to a given subtree. +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)) + (beginning-of-line 1) + (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 (point-at-bol) (1+ (point-at-eol))))) + (beginning-of-line 0)))))) + +(defun org-agenda-refile (&optional goto rfloc no-update) + "Refile the item at point. + +When called with `\\[universal-argument] \\[universal-argument]', \ +go to the location of the last +refiled item. + +When called with `\\[universal-argument] \\[universal-argument] \ +\\[universal-argument]' prefix or when GOTO is 0, clear +the refile cache. + +RFLOC can be a refile location obtained in a different way. + +When NO-UPDATE is non-nil, don't redo the agenda buffer." + (interactive "P") + (cond + ((member goto '(0 (64))) + (org-refile-cache-clear)) + ((equal goto '(16)) + (org-refile-goto-last-stored)) + (t + (let* ((buffer-orig (buffer-name)) + (marker (or (org-get-at-bol 'org-hd-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + ;; (pos (marker-position marker)) + (rfloc (or rfloc + (org-refile-get-location + (if goto "Goto" "Refile to") buffer + org-refile-allow-creating-parent-nodes)))) + (with-current-buffer buffer + (org-with-wide-buffer + (goto-char marker) + (let ((org-agenda-buffer-name buffer-orig)) + (org-remove-subtree-entries-from-agenda)) + (org-refile goto buffer rfloc)))) + (unless no-update (org-agenda-redo))))) + +(defun org-agenda-open-link (&optional arg) + "Open the link(s) in the current entry, if any. +This looks for a link in the displayed line in the agenda. +It also looks at the text of the entry itself." + (interactive "P") + (let* ((marker (or (org-get-at-bol 'org-hd-marker) + (org-get-at-bol 'org-marker))) + (buffer (and marker (marker-buffer marker))) + (prefix (buffer-substring (point-at-bol) (point-at-eol))) + (lkall (and buffer (org-offer-links-in-entry + buffer marker arg prefix))) + (lk0 (car lkall)) + (lk (if (stringp lk0) (list lk0) lk0)) + (lkend (cdr lkall)) + trg) + (cond + ((and buffer lk) + (mapcar (lambda(l) + (with-current-buffer buffer + (setq trg (and (string-match org-link-bracket-re l) + (match-string 1 l))) + (if (or (not trg) (string-match org-link-any-re trg)) + ;; Don't use `org-with-wide-buffer' here as + ;; opening the link may result in moving the point + (save-restriction + (widen) + (goto-char marker) + (when (search-forward l nil lkend) + (goto-char (match-beginning 0)) + (org-open-at-point))) + ;; This is an internal link, widen the buffer + ;; FIXME: use `org-switch-to-buffer-other-window'? + (switch-to-buffer-other-window buffer) + (widen) + (goto-char marker) + (when (search-forward l nil lkend) + (goto-char (match-beginning 0)) + (org-open-at-point))))) + lk)) + ((or (org-in-regexp (concat "\\(" org-link-bracket-re "\\)")) + (save-excursion + (beginning-of-line 1) + (looking-at (concat ".*?\\(" org-link-bracket-re "\\)")))) + (org-link-open-from-string (match-string 1))) + (t (message "No link to open here"))))) + +(defun org-agenda-copy-local-variable (var) + "Get a variable from a referenced buffer and install it here." + (let ((m (org-get-at-bol 'org-marker))) + (when (and m (buffer-live-p (marker-buffer m))) + (set (make-local-variable var) + (with-current-buffer (marker-buffer m) + (symbol-value var)))))) + +(defun org-agenda-switch-to (&optional delete-other-windows) + "Go to the Org mode file which contains the item at point. +When optional argument DELETE-OTHER-WINDOWS is non-nil, the +displayed Org file fills the frame." + (interactive) + (if (and org-return-follows-link + (not (org-get-at-bol 'org-marker)) + (org-in-regexp org-link-bracket-re)) + (org-link-open-from-string (match-string 0)) + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker))) + (unless buffer (user-error "Trying to switch to non-existent buffer")) + (pop-to-buffer-same-window buffer) + (when delete-other-windows (delete-other-windows)) + (widen) + (goto-char pos) + (when (derived-mode-p 'org-mode) + (org-show-context 'agenda) + (run-hooks 'org-agenda-after-show-hook))))) + +(defun org-agenda-goto-mouse (ev) + "Go to the Org file which contains the item at the mouse click." + (interactive "e") + (mouse-set-point ev) + (org-agenda-goto)) + +(defun org-agenda-show (&optional full-entry) + "Display the Org file which contains the item at point. +With prefix argument FULL-ENTRY, make the entire entry visible +if it was hidden in the outline." + (interactive "P") + (let ((win (selected-window))) + (org-agenda-goto t) + (when full-entry (org-show-entry)) + (select-window win))) + +(defvar org-agenda-show-window nil) +(defun org-agenda-show-and-scroll-up (&optional arg) + "Display the Org file which contains the item at point. + +When called repeatedly, scroll the window that is displaying the buffer. + +With a `\\[universal-argument]' prefix argument, display the item, but \ +fold drawers." + (interactive "P") + (let ((win (selected-window))) + (if (and (window-live-p org-agenda-show-window) + (eq this-command last-command)) + (progn + (select-window org-agenda-show-window) + (ignore-errors (scroll-up))) + (org-agenda-goto t) + (org-show-entry) + (if arg (org-cycle-hide-drawers 'children) + (org-with-wide-buffer + (narrow-to-region (org-entry-beginning-position) + (org-entry-end-position)) + (org-show-all '(drawers)))) + (setq org-agenda-show-window (selected-window))) + (select-window win))) + +(defun org-agenda-show-scroll-down () + "Scroll down the window showing the agenda." + (interactive) + (let ((win (selected-window))) + (when (window-live-p org-agenda-show-window) + (select-window org-agenda-show-window) + (ignore-errors (scroll-down)) + (select-window win)))) + +(defun org-agenda-show-1 (&optional more) + "Display the Org file which contains the item at point. +The prefix arg selects the amount of information to display: + +0 hide the subtree +1 just show the entry according to defaults. +2 show the children view +3 show the subtree view +4 show the entire subtree and any drawers +With prefix argument FULL-ENTRY, make the entire entry visible +if it was hidden in the outline." + (interactive "p") + (let ((win (selected-window))) + (org-agenda-goto t) + (org-back-to-heading) + (set-window-start (selected-window) (point-at-bol)) + (cond + ((= more 0) + (org-flag-subtree t) + (save-excursion + (org-back-to-heading) + (run-hook-with-args 'org-cycle-hook 'folded)) + (message "Remote: FOLDED")) + ((and (called-interactively-p 'any) (= more 1)) + (message "Remote: show with default settings")) + ((= more 2) + (outline-show-entry) + (org-show-children) + (save-excursion + (org-back-to-heading) + (run-hook-with-args 'org-cycle-hook 'children)) + (message "Remote: CHILDREN")) + ((= more 3) + (outline-show-subtree) + (save-excursion + (org-back-to-heading) + (run-hook-with-args 'org-cycle-hook 'subtree)) + (message "Remote: SUBTREE")) + ((> more 3) + (outline-show-subtree) + (message "Remote: SUBTREE AND ALL DRAWERS"))) + (select-window win))) + +(defvar org-agenda-cycle-counter nil) +(defun org-agenda-cycle-show (&optional n) + "Show the current entry in another window, with default settings. + +Default settings are taken from `org-show-context-detail'. When +use repeatedly in immediate succession, the remote entry will +cycle through visibility + + children -> subtree -> folded + +When called with a numeric prefix arg, that arg will be passed through to +`org-agenda-show-1'. For the interpretation of that argument, see the +docstring of `org-agenda-show-1'." + (interactive "P") + (if (integerp n) + (setq org-agenda-cycle-counter n) + (if (not (eq last-command this-command)) + (setq org-agenda-cycle-counter 1) + (if (equal org-agenda-cycle-counter 0) + (setq org-agenda-cycle-counter 2) + (setq org-agenda-cycle-counter (1+ org-agenda-cycle-counter)) + (when (> org-agenda-cycle-counter 3) + (setq org-agenda-cycle-counter 0))))) + (org-agenda-show-1 org-agenda-cycle-counter)) + +(defun org-agenda-recenter (arg) + "Display the Org file which contains the item at point and recenter." + (interactive "P") + (let ((win (selected-window))) + (org-agenda-goto t) + (recenter arg) + (select-window win))) + +(defun org-agenda-show-mouse (ev) + "Display the Org file which contains the item at the mouse click." + (interactive "e") + (mouse-set-point ev) + (org-agenda-show)) + +(defun org-agenda-check-no-diary () + "Check if the entry is a diary link and abort if yes." + (when (org-get-at-bol 'org-agenda-diary-link) + (org-agenda-error))) + +(defun org-agenda-error () + "Throw an error when a command is not allowed in the agenda." + (user-error "Command not allowed in this line")) + +(defun org-agenda-tree-to-indirect-buffer (arg) + "Show the subtree corresponding to the current entry in an indirect buffer. +This calls the command `org-tree-to-indirect-buffer' from the original buffer. + +With a numerical prefix ARG, go up to this level and then take that tree. +With a negative numeric ARG, go up by this number of levels. + +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))) + (buffer (marker-buffer marker)) + (pos (marker-position marker))) + (with-current-buffer buffer + (save-excursion + (goto-char pos) + (org-tree-to-indirect-buffer arg))))) + +(defvar org-last-heading-marker (make-marker) + "Marker pointing to the headline that last changed its TODO state +by a remote command from the agenda.") + +(defun org-agenda-todo-nextset () + "Switch TODO entry to next sequence." + (interactive) + (org-agenda-todo 'nextset)) + +(defun org-agenda-todo-previousset () + "Switch TODO entry to previous sequence." + (interactive) + (org-agenda-todo 'previousset)) + +(defvar org-agenda-headline-snapshot-before-repeat) + +(defun org-agenda-todo (&optional arg) + "Cycle TODO state of line at point, also in Org file. +This changes the line at point, all other lines in the agenda referring to +the same tree node, and the headline of the tree node in the Org file." + (interactive "P") + (org-agenda-check-no-diary) + (org-agenda-maybe-loop + #'org-agenda-todo arg nil nil + (let* ((col (current-column)) + (marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker)) + (hdmarker (org-get-at-bol 'org-hd-marker)) + (todayp (org-agenda-today-p (org-get-at-bol 'day))) + (inhibit-read-only t) + org-loop-over-headlines-in-active-region + org-agenda-headline-snapshot-before-repeat newhead just-one) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (org-show-context 'agenda) + (let ((current-prefix-arg arg)) + (call-interactively 'org-todo) + ;; Make sure that log is recorded in current undo. + (when (and org-log-setup + (not (eq org-log-note-how 'note))) + (org-add-log-note))) + (and (bolp) (forward-char 1)) + (setq newhead (org-get-heading)) + (when (and org-agenda-headline-snapshot-before-repeat + (not (equal org-agenda-headline-snapshot-before-repeat + newhead)) + todayp) + (setq newhead org-agenda-headline-snapshot-before-repeat + just-one t)) + (save-excursion + (org-back-to-heading) + (move-marker org-last-heading-marker (point)))) + (beginning-of-line 1) + (save-window-excursion + (org-agenda-change-all-lines newhead hdmarker 'fixface just-one)) + (when (bound-and-true-p org-clock-out-when-done) + (string-match (concat "^" (regexp-opt org-done-keywords-for-agenda)) + newhead) + (org-agenda-unmark-clocking-task)) + (org-move-to-column col) + (org-agenda-mark-clocking-task))))) + +(defun org-agenda-add-note (&optional _arg) + "Add a time-stamped note to the entry at point." + (interactive) ;; "P" + (org-agenda-check-no-diary) + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker)) + (_hdmarker (org-get-at-bol 'org-hd-marker)) + (inhibit-read-only t)) + (with-current-buffer buffer + (widen) + (goto-char pos) + (org-show-context 'agenda) + (org-add-note)))) + +(defun org-agenda-change-all-lines (newhead hdmarker + &optional fixface just-this) + "Change all lines in the agenda buffer which match HDMARKER. +The new content of the line will be NEWHEAD (as modified by +`org-agenda-format-item'). HDMARKER is checked with +`equal' against all `org-hd-marker' text properties in the file. +If FIXFACE is non-nil, the face of each item is modified according to +the new TODO state. +If JUST-THIS is non-nil, change just the current line, not all. +If FORCE-TAGS is non-nil, the car of it returns the new tags." + (let* ((inhibit-read-only t) + (line (org-current-line)) + (org-agenda-buffer (current-buffer)) + (thetags (with-current-buffer (marker-buffer hdmarker) + (org-get-tags hdmarker))) + props m undone-face done-face finish new dotime level cat tags) ;; pl + (save-excursion + (goto-char (point-max)) + (beginning-of-line 1) + (while (not finish) + (setq finish (bobp)) + (when (and (setq m (org-get-at-bol 'org-hd-marker)) + (or (not just-this) (= (org-current-line) line)) + (equal m hdmarker)) + (setq props (text-properties-at (point)) + dotime (org-get-at-bol 'dotime) + cat (org-agenda-get-category) + level (org-get-at-bol 'level) + tags thetags + new + (let ((org-prefix-format-compiled + (or (get-text-property (min (1- (point-max)) (point)) 'format) + org-prefix-format-compiled)) + (extra (org-get-at-bol 'extra))) + (with-current-buffer (marker-buffer hdmarker) + (org-with-wide-buffer + (org-agenda-format-item extra newhead level cat tags dotime)))) + ;; pl (text-property-any (point-at-bol) (point-at-eol) 'org-heading t) + undone-face (org-get-at-bol 'undone-face) + done-face (org-get-at-bol 'done-face)) + (beginning-of-line 1) + (cond + ((equal new "") (delete-region (point) (line-beginning-position 2))) + ((looking-at ".*") + ;; When replacing the whole line, preserve bulk mark + ;; overlay, if any. + (let ((mark (catch :overlay + (dolist (o (overlays-in (point) (+ 2 (point)))) + (when (eq (overlay-get o 'type) + 'org-marked-entry-overlay) + (throw :overlay o)))))) + (replace-match new t t) + (beginning-of-line) + (when mark (move-overlay mark (point) (+ 2 (point))))) + (add-text-properties (point-at-bol) (point-at-eol) props) + (when fixface + (add-text-properties + (point-at-bol) (point-at-eol) + (list 'face + (if org-last-todo-state-is-todo + undone-face done-face)))) + (org-agenda-highlight-todo 'line) + (beginning-of-line 1)) + (t (error "Line update did not work"))) + (save-restriction + (narrow-to-region (point-at-bol) (point-at-eol)) + (org-agenda-finalize))) + (beginning-of-line 0))))) + +(defun org-agenda-align-tags (&optional line) + "Align all tags in agenda items to `org-agenda-tags-column'. +When optional argument LINE is non-nil, align tags only on the +current line." + (let ((inhibit-read-only t) + (org-agenda-tags-column (if (eq 'auto org-agenda-tags-column) + (- (window-text-width)) + org-agenda-tags-column)) + (end (and line (line-end-position))) + l c) + (save-excursion + (goto-char (if line (line-beginning-position) (point-min))) + (while (re-search-forward org-tag-group-re end t) + (add-text-properties + (match-beginning 1) (match-end 1) + (list 'face (delq nil (let ((prop (get-text-property + (match-beginning 1) 'face))) + (or (listp prop) (setq prop (list prop))) + (if (memq 'org-tag prop) + prop + (cons 'org-tag prop)))))) + (setq l (string-width (match-string 1)) + c (if (< org-agenda-tags-column 0) + (- (abs org-agenda-tags-column) l) + org-agenda-tags-column)) + (goto-char (match-beginning 1)) + (delete-region (save-excursion (skip-chars-backward " \t") (point)) + (point)) + (insert (org-add-props + (make-string (max 1 (- c (current-column))) ?\s) + (plist-put (copy-sequence (text-properties-at (point))) + 'face nil)))) + (goto-char (point-min)) + (org-font-lock-add-tag-faces (point-max))))) + +(defun org-agenda-priority-up () + "Increase the priority of line at point, also in Org file." + (interactive) + (org-agenda-priority 'up)) + +(defun org-agenda-priority-down () + "Decrease the priority of line at point, also in Org file." + (interactive) + (org-agenda-priority 'down)) + +(defun org-agenda-priority (&optional force-direction) + "Set the priority of line at point, also in Org file. +This changes the line at point, all other lines in the agenda +referring to the same tree node, and the headline of the tree +node in the Org file. + +Called with one universal prefix arg, show the priority instead +of setting it. + +When called programmatically, FORCE-DIRECTION can be `set', `up', +`down', or a character." + (interactive "P") + (unless org-priority-enable-commands + (user-error "Priority commands are disabled")) + (org-agenda-check-no-diary) + (let* ((col (current-column)) + (hdmarker (org-get-at-bol 'org-hd-marker)) + (buffer (marker-buffer hdmarker)) + (pos (marker-position hdmarker)) + (inhibit-read-only t) + newhead) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (org-show-context 'agenda) + (org-priority force-direction) + (end-of-line 1) + (setq newhead (org-get-heading))) + (org-agenda-change-all-lines newhead hdmarker) + (org-move-to-column col)))) + +;; FIXME: should fix the tags property of the agenda line. +(defun org-agenda-set-tags (&optional tag onoff) + "Set tags for the current headline." + (interactive) + (org-agenda-check-no-diary) + (if (and (org-region-active-p) (called-interactively-p 'any)) + (call-interactively 'org-change-tag-in-region) + (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker) + (org-agenda-error))) + (buffer (marker-buffer hdmarker)) + (pos (marker-position hdmarker)) + (inhibit-read-only t) + newhead) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (org-show-context 'agenda) + (if tag + (org-toggle-tag tag onoff) + (call-interactively #'org-set-tags-command)) + (end-of-line 1) + (setq newhead (org-get-heading))) + (org-agenda-change-all-lines newhead hdmarker) + (beginning-of-line 1))))) + +(defun org-agenda-set-property () + "Set a property for the current headline." + (interactive) + (org-agenda-check-no-diary) + (org-agenda-maybe-loop + #'org-agenda-set-property nil nil nil + (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker) + (org-agenda-error))) + (buffer (marker-buffer hdmarker)) + (pos (marker-position hdmarker)) + (inhibit-read-only t) + ) ;; newhead + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (org-show-context 'agenda) + (call-interactively 'org-set-property)))))) + +(defun org-agenda-set-effort () + "Set the effort property for the current headline." + (interactive) + (org-agenda-check-no-diary) + (org-agenda-maybe-loop + #'org-agenda-set-effort nil nil nil + (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker) + (org-agenda-error))) + (buffer (marker-buffer hdmarker)) + (pos (marker-position hdmarker)) + (inhibit-read-only t) + newhead) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (org-show-context 'agenda) + (call-interactively 'org-set-effort) + (end-of-line 1) + (setq newhead (org-get-heading))) + (org-agenda-change-all-lines newhead hdmarker))))) + +(defun org-agenda-toggle-archive-tag () + "Toggle the archive tag for the current entry." + (interactive) + (org-agenda-check-no-diary) + (org-agenda-maybe-loop + #'org-agenda-toggle-archive-tag nil nil nil + (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker) + (org-agenda-error))) + (buffer (marker-buffer hdmarker)) + (pos (marker-position hdmarker)) + (inhibit-read-only t) + newhead) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (org-show-context 'agenda) + (call-interactively 'org-toggle-archive-tag) + (end-of-line 1) + (setq newhead (org-get-heading))) + (org-agenda-change-all-lines newhead hdmarker) + (beginning-of-line 1))))) + +(defun org-agenda-do-date-later (arg) + (interactive "P") + (cond + ((or (equal arg '(16)) + (memq last-command + '(org-agenda-date-later-minutes org-agenda-date-earlier-minutes))) + (setq this-command 'org-agenda-date-later-minutes) + (org-agenda-date-later-minutes 1)) + ((or (equal arg '(4)) + (memq last-command + '(org-agenda-date-later-hours org-agenda-date-earlier-hours))) + (setq this-command 'org-agenda-date-later-hours) + (org-agenda-date-later-hours 1)) + (t + (org-agenda-date-later (prefix-numeric-value arg))))) + +(defun org-agenda-do-date-earlier (arg) + (interactive "P") + (cond + ((or (equal arg '(16)) + (memq last-command + '(org-agenda-date-later-minutes org-agenda-date-earlier-minutes))) + (setq this-command 'org-agenda-date-earlier-minutes) + (org-agenda-date-earlier-minutes 1)) + ((or (equal arg '(4)) + (memq last-command + '(org-agenda-date-later-hours org-agenda-date-earlier-hours))) + (setq this-command 'org-agenda-date-earlier-hours) + (org-agenda-date-earlier-hours 1)) + (t + (org-agenda-date-earlier (prefix-numeric-value arg))))) + +(defun org-agenda-date-later (arg &optional what) + "Change the date of this item to ARG day(s) later." + (interactive "p") + (org-agenda-check-type t 'agenda) + (org-agenda-check-no-diary) + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker)) + cdate today) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (unless (org-at-timestamp-p 'lax) (error "Cannot find time stamp")) + (when (and org-agenda-move-date-from-past-immediately-to-today + (equal arg 1) + (or (not what) (eq what 'day)) + (not (save-match-data (org-at-date-range-p)))) + (setq cdate (org-parse-time-string (match-string 0) 'nodefault) + cdate (calendar-absolute-from-gregorian + (list (nth 4 cdate) (nth 3 cdate) (nth 5 cdate))) + today (org-today)) + (when (> today cdate) + ;; immediately shift to today + (setq arg (- today cdate)))) + (org-timestamp-change arg (or what 'day)) + (when (and (org-at-date-range-p) + (re-search-backward org-tr-regexp-both (point-at-bol))) + (let ((end org-last-changed-timestamp)) + (org-timestamp-change arg (or what 'day)) + (setq org-last-changed-timestamp + (concat org-last-changed-timestamp "--" end))))) + (org-agenda-show-new-time marker org-last-changed-timestamp)) + (message "Time stamp changed to %s" org-last-changed-timestamp))) + +(defun org-agenda-date-earlier (arg &optional what) + "Change the date of this item to ARG day(s) earlier." + (interactive "p") + (org-agenda-date-later (- arg) what)) + +(defun org-agenda-date-later-minutes (arg) + "Change the time of this item, in units of `org-time-stamp-rounding-minutes'." + (interactive "p") + (setq arg (* arg (cadr org-time-stamp-rounding-minutes))) + (org-agenda-date-later arg 'minute)) + +(defun org-agenda-date-earlier-minutes (arg) + "Change the time of this item, in units of `org-time-stamp-rounding-minutes'." + (interactive "p") + (setq arg (* arg (cadr org-time-stamp-rounding-minutes))) + (org-agenda-date-earlier arg 'minute)) + +(defun org-agenda-date-later-hours (arg) + "Change the time of this item, in hour steps." + (interactive "p") + (org-agenda-date-later arg 'hour)) + +(defun org-agenda-date-earlier-hours (arg) + "Change the time of this item, in hour steps." + (interactive "p") + (org-agenda-date-earlier arg 'hour)) + +(defun org-agenda-show-new-time (marker stamp &optional prefix) + "Show new date stamp via text properties." + ;; We use text properties to make this undoable + (let ((inhibit-read-only t)) + (setq stamp (concat prefix " => " stamp " ")) + (save-excursion + (goto-char (point-max)) + (while (not (bobp)) + (when (equal marker (org-get-at-bol 'org-marker)) + (remove-text-properties (line-beginning-position) + (line-end-position) + '(display nil)) + (org-move-to-column + (- (if (fboundp 'window-font-width) + (/ (window-width nil t) (window-font-width)) + ;; Fall back to pre-9.3.3 behavior on Emacs <25. + (window-width)) + (length stamp)) + t) + (add-text-properties + (1- (point)) (point-at-eol) + (list 'display (org-add-props stamp nil + 'face '(secondary-selection default)))) + (beginning-of-line 1)) + (beginning-of-line 0))))) + +(defun org-agenda-date-prompt (arg) + "Change the date of this item. Date is prompted for, with default today. +The prefix ARG is passed to the `org-time-stamp' command and can therefore +be used to request time specification in the time stamp." + (interactive "P") + (org-agenda-check-type t 'agenda) + (org-agenda-check-no-diary) + (org-agenda-maybe-loop + #'org-agenda-date-prompt arg t nil + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker))) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (unless (org-at-timestamp-p 'lax) (error "Cannot find time stamp")) + (org-time-stamp arg (equal (char-after (match-beginning 0)) ?\[))) + (org-agenda-show-new-time marker org-last-changed-timestamp)) + (message "Time stamp changed to %s" org-last-changed-timestamp)))) + +(defun org-agenda-schedule (arg &optional time) + "Schedule the item at point. +ARG is passed through to `org-schedule'." + (interactive "P") + (org-agenda-check-type t 'agenda 'todo 'tags 'search) + (org-agenda-check-no-diary) + (org-agenda-maybe-loop + #'org-agenda-schedule arg t nil + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + ;; (type (marker-insertion-type marker)) + (buffer (marker-buffer marker)) + (pos (marker-position marker)) + ts) + (set-marker-insertion-type marker t) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (setq ts (org-schedule arg time))) + (org-agenda-show-new-time marker ts " S")) + (message "%s" ts)))) + +(defun org-agenda-deadline (arg &optional time) + "Schedule the item at point. +ARG is passed through to `org-deadline'." + (interactive "P") + (org-agenda-check-type t 'agenda 'todo 'tags 'search) + (org-agenda-check-no-diary) + (org-agenda-maybe-loop + #'org-agenda-deadline arg t nil + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker)) + ts) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (setq ts (org-deadline arg time))) + (org-agenda-show-new-time marker ts " D")) + (message "%s" ts)))) + +(defun org-agenda-clock-in (&optional arg) + "Start the clock on the currently selected item." + (interactive "P") + (org-agenda-check-no-diary) + (if (equal arg '(4)) + (org-clock-in arg) + (let* ((marker (or (org-get-at-bol 'org-marker) + (org-agenda-error))) + (hdmarker (or (org-get-at-bol 'org-hd-marker) marker)) + (pos (marker-position marker)) + (col (current-column)) + newhead) + (org-with-remote-undo (marker-buffer marker) + (with-current-buffer (marker-buffer marker) + (widen) + (goto-char pos) + (org-show-context 'agenda) + (org-clock-in arg) + (setq newhead (org-get-heading))) + (org-agenda-change-all-lines newhead hdmarker)) + (org-move-to-column col)))) + +(defun org-agenda-clock-out () + "Stop the currently running clock." + (interactive) + (unless (marker-buffer org-clock-marker) + (user-error "No running clock")) + (let ((marker (make-marker)) (col (current-column)) newhead) + (org-with-remote-undo (marker-buffer org-clock-marker) + (with-current-buffer (marker-buffer org-clock-marker) + (org-with-wide-buffer + (goto-char org-clock-marker) + (org-back-to-heading t) + (move-marker marker (point)) + (org-clock-out) + (setq newhead (org-get-heading))))) + (org-agenda-change-all-lines newhead marker) + (move-marker marker nil) + (org-move-to-column col) + (org-agenda-unmark-clocking-task))) + +(defun org-agenda-clock-cancel (&optional _arg) + "Cancel the currently running clock." + (interactive) ;; "P" + (unless (marker-buffer org-clock-marker) + (user-error "No running clock")) + (org-with-remote-undo (marker-buffer org-clock-marker) + (org-clock-cancel))) + +(defun org-agenda-clock-goto () + "Jump to the currently clocked in task within the agenda. +If the currently clocked in task is not listed in the agenda +buffer, display it in another window." + (interactive) + (let (pos) + (mapc (lambda (o) + (when (eq (overlay-get o 'type) 'org-agenda-clocking) + (setq pos (overlay-start o)))) + (overlays-in (point-min) (point-max))) + (cond (pos (goto-char pos)) + ;; If the currently clocked entry is not in the agenda + ;; buffer, we visit it in another window: + ((bound-and-true-p org-clock-current-task) + (org-switch-to-buffer-other-window (org-clock-goto))) + (t (message "No running clock, use `C-c C-x C-j' to jump to the most recent one"))))) + +(defun org-agenda-diary-entry-in-org-file () + "Make a diary entry in the file `org-agenda-diary-file'." + (let (d1 d2 char (text "") dp1 dp2) + (if (equal (buffer-name) "*Calendar*") + (setq d1 (calendar-cursor-to-date t) + d2 (car calendar-mark-ring)) + (setq dp1 (get-text-property (point-at-bol) 'day)) + (unless dp1 (user-error "No date defined in current line")) + (setq d1 (calendar-gregorian-from-absolute dp1) + d2 (and (ignore-errors (mark)) + (save-excursion + (goto-char (mark)) + (setq dp2 (get-text-property (point-at-bol) 'day))) + (calendar-gregorian-from-absolute dp2)))) + (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree") + (setq char (read-char-exclusive)) + (cond + ((equal char ?d) + (setq text (read-string "Day entry: ")) + (org-agenda-add-entry-to-org-agenda-diary-file 'day text d1) + (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo))) + ((equal char ?a) + (setq d1 (list (car d1) (nth 1 d1) + (read-number (format "Reference year [%d]: " (nth 2 d1)) + (nth 2 d1)))) + (setq text (read-string "Anniversary (use %d to show years): ")) + (org-agenda-add-entry-to-org-agenda-diary-file 'anniversary text d1) + (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo))) + ((equal char ?b) + (setq text (read-string "Block entry: ")) + (unless (and d1 d2 (not (equal d1 d2))) + (user-error "No block of days selected")) + (org-agenda-add-entry-to-org-agenda-diary-file 'block text d1 d2) + (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo))) + ((equal char ?j) + (org-switch-to-buffer-other-window + (find-file-noselect org-agenda-diary-file)) + (require 'org-datetree) + (org-datetree-find-date-create d1) + (org-reveal t)) + (t (user-error "Invalid selection character `%c'" char))))) + +(defcustom org-agenda-insert-diary-strategy 'date-tree + "Where in `org-agenda-diary-file' should new entries be added? +Valid values: + +date-tree in the date tree, as first child of the date +date-tree-last in the date tree, as last child of the date +top-level as top-level entries at the end of the file." + :group 'org-agenda + :type '(choice + (const :tag "first in a date tree" date-tree) + (const :tag "last in a date tree" date-tree-last) + (const :tag "as top level at end of file" top-level))) + +(defcustom org-agenda-insert-diary-extract-time nil + "Non-nil means extract any time specification from the diary entry." + :group 'org-agenda + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-bulk-mark-char ">" + "A single-character string to be used as the bulk mark." + :group 'org-agenda + :version "24.1" + :type 'string) + +(defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2) + "Add a diary entry with TYPE to `org-agenda-diary-file'. +If TEXT is not empty, it will become the headline of the new entry, and +the resulting entry will not be shown. When TEXT is empty, switch to +`org-agenda-diary-file' and let the user finish the entry there." + (let ((cw (current-window-configuration))) + (org-switch-to-buffer-other-window + (find-file-noselect org-agenda-diary-file)) + (widen) + (goto-char (point-min)) + (cl-case type + (anniversary + (or (re-search-forward "^\\*[ \t]+Anniversaries" nil t) + (progn + (or (org-at-heading-p t) + (progn + (outline-next-heading) + (insert "* Anniversaries\n\n") + (beginning-of-line -1))))) + (outline-next-heading) + (org-back-over-empty-lines) + (backward-char 1) + (insert "\n") + (insert (format "%%%%(org-anniversary %d %2d %2d) %s" + (nth 2 d1) (car d1) (nth 1 d1) text))) + (day + (let ((org-prefix-has-time t) + (org-agenda-time-leading-zero t) + fmt time time2) + (when org-agenda-insert-diary-extract-time + ;; Use org-agenda-format-item to parse text for a time-range and + ;; remove it. FIXME: This is a hack, we should refactor + ;; that function to make time extraction available separately + (setq fmt (org-agenda-format-item nil text nil nil nil t) + time (get-text-property 0 'time fmt) + time2 (if (> (length time) 0) + ;; split-string removes trailing ...... if + ;; no end time given. First space + ;; separates time from date. + (concat " " (car (split-string time "\\."))) + nil) + text (get-text-property 0 'txt fmt))) + (if (eq org-agenda-insert-diary-strategy 'top-level) + (org-agenda-insert-diary-as-top-level text) + (require 'org-datetree) + (org-datetree-find-date-create d1) + (org-agenda-insert-diary-make-new-entry text)) + (org-insert-time-stamp (org-time-from-absolute + (calendar-absolute-from-gregorian d1)) + nil nil nil nil time2)) + (end-of-line 0)) + ((block) ;; Wrap this in (strictly unnecessary) parens because + ;; otherwise the indentation gets confused by the + ;; special meaning of 'block + (when (> (calendar-absolute-from-gregorian d1) + (calendar-absolute-from-gregorian d2)) + (setq d1 (prog1 d2 (setq d2 d1)))) + (if (eq org-agenda-insert-diary-strategy 'top-level) + (org-agenda-insert-diary-as-top-level text) + (require 'org-datetree) + (org-datetree-find-date-create d1) + (org-agenda-insert-diary-make-new-entry text)) + (org-insert-time-stamp (org-time-from-absolute + (calendar-absolute-from-gregorian d1))) + (insert "--") + (org-insert-time-stamp (org-time-from-absolute + (calendar-absolute-from-gregorian d2))) + (end-of-line 0))) + (if (string-match "\\S-" text) + (progn + (set-window-configuration cw) + (message "%s entry added to %s" + (capitalize (symbol-name type)) + (abbreviate-file-name org-agenda-diary-file))) + (org-reveal t) + (message "Please finish entry here")))) + +(defun org-agenda-insert-diary-as-top-level (text) + "Make new entry as a top-level entry at the end of the file. +Add TEXT as headline, and position the cursor in the second line so that +a timestamp can be added there." + (widen) + (goto-char (point-max)) + (unless (bolp) (insert "\n")) + (org-insert-heading nil t t) + (insert text) + (org-end-of-meta-data) + (unless (bolp) (insert "\n")) + (when org-adapt-indentation (indent-to-column 2))) + +(defun org-agenda-insert-diary-make-new-entry (text) + "Make a new entry with TEXT as a child of the current subtree. +Position the point in the heading's first body line so that +a timestamp can be added there." + (cond + ((eq org-agenda-insert-diary-strategy 'date-tree-last) + (end-of-line) + (org-insert-heading '(4) t) + (org-do-demote)) + (t + (outline-next-heading) + (org-back-over-empty-lines) + (unless (looking-at "[ \t]*$") (save-excursion (insert "\n"))) + (org-insert-heading nil t) + (org-do-demote))) + (let ((col (current-column))) + (insert text) + (org-end-of-meta-data) + ;; Ensure point is left on a blank line, at proper indentation. + (unless (bolp) (insert "\n")) + (unless (looking-at-p "^[ \t]*$") (save-excursion (insert "\n"))) + (when org-adapt-indentation (indent-to-column col))) + (org-show-set-visibility 'lineage)) + +(defun org-agenda-diary-entry () + "Make a diary entry, like the `i' command from the calendar. +All the standard commands work: block, weekly etc. +When `org-agenda-diary-file' points to a file, +`org-agenda-diary-entry-in-org-file' is called instead to create +entries in that Org file." + (interactive) + (if (not (eq org-agenda-diary-file 'diary-file)) + (org-agenda-diary-entry-in-org-file) + (require 'diary-lib) + (let* ((char (read-char-exclusive + "Diary entry: [d]ay [w]eekly [m]onthly [y]early\ + [a]nniversary [b]lock [c]yclic")) + (cmd (cdr (assoc char + '((?d . diary-insert-entry) + (?w . diary-insert-weekly-entry) + (?m . diary-insert-monthly-entry) + (?y . diary-insert-yearly-entry) + (?a . diary-insert-anniversary-entry) + (?b . diary-insert-block-entry) + (?c . diary-insert-cyclic-entry))))) + (oldf (symbol-function 'calendar-cursor-to-date)) + ;; (buf (get-file-buffer (substitute-in-file-name diary-file))) + (point (point)) + (mark (or (mark t) (point)))) + (unless cmd + (user-error "No command associated with <%c>" char)) + (unless (and (get-text-property point 'day) + (or (not (equal ?b char)) + (get-text-property mark 'day))) + (user-error "Don't know which date to use for diary entry")) + ;; We implement this by hacking the `calendar-cursor-to-date' function + ;; and the `calendar-mark-ring' variable. Saves a lot of code. + (let ((calendar-mark-ring + (list (calendar-gregorian-from-absolute + (or (get-text-property mark 'day) + (get-text-property point 'day)))))) + (unwind-protect + (progn + (fset 'calendar-cursor-to-date + (lambda (&optional _error _dummy) + (calendar-gregorian-from-absolute + (get-text-property point 'day)))) + (call-interactively cmd)) + (fset 'calendar-cursor-to-date oldf)))))) + +(defun org-agenda-execute-calendar-command (cmd) + "Execute a calendar command from the agenda with date from cursor." + (org-agenda-check-type t 'agenda) + (require 'diary-lib) + (unless (get-text-property (min (1- (point-max)) (point)) 'day) + (user-error "Don't know which date to use for the calendar command")) + (let* ((oldf (symbol-function 'calendar-cursor-to-date)) + (point (point)) + (date (calendar-gregorian-from-absolute + (get-text-property point 'day)))) + ;; the following 2 vars are needed in the calendar + (org-dlet + ((displayed-month (car date)) + (displayed-year (nth 2 date))) + (unwind-protect + (progn + (fset 'calendar-cursor-to-date + (lambda (&optional _error _dummy) + (calendar-gregorian-from-absolute + (get-text-property point 'day)))) + (call-interactively cmd)) + (fset 'calendar-cursor-to-date oldf))))) + +(defun org-agenda-phases-of-moon () + "Display the phases of the moon for the 3 months around the cursor date." + (interactive) + (org-agenda-execute-calendar-command 'calendar-lunar-phases)) + +(defun org-agenda-holidays () + "Display the holidays for the 3 months around the cursor date." + (interactive) + (org-agenda-execute-calendar-command 'calendar-list-holidays)) + +(defvar calendar-longitude) ; defined in calendar.el +(defvar calendar-latitude) ; defined in calendar.el +(defvar calendar-location-name) ; defined in calendar.el + +(defun org-agenda-sunrise-sunset (arg) + "Display sunrise and sunset for the cursor date. +Latitude and longitude can be specified with the variables +`calendar-latitude' and `calendar-longitude'. When called with prefix +argument, latitude and longitude will be prompted for." + (interactive "P") + (require 'solar) + (let ((calendar-longitude (if arg nil calendar-longitude)) + (calendar-latitude (if arg nil calendar-latitude)) + (calendar-location-name + (if arg "the given coordinates" calendar-location-name))) + (org-agenda-execute-calendar-command 'calendar-sunrise-sunset))) + +(defun org-agenda-goto-calendar () + "Open the Emacs calendar with the date at the cursor." + (interactive) + (org-agenda-check-type t 'agenda) + (let* ((day (or (get-text-property (min (1- (point-max)) (point)) 'day) + (user-error "Don't know which date to open in calendar"))) + (date (calendar-gregorian-from-absolute day)) + (calendar-move-hook nil) + (calendar-view-holidays-initially-flag nil) + (calendar-view-diary-initially-flag nil)) + (calendar) + (calendar-goto-date date))) + +;;;###autoload +(defun org-calendar-goto-agenda () + "Compute the Org agenda for the calendar date displayed at the cursor. +This is a command that has to be installed in `calendar-mode-map'." + (interactive) + ;; Temporarily disable sticky agenda since user clearly wants to + ;; refresh view anyway. + (let ((org-agenda-buffer-tmp-name "*Org Agenda(a)*") + (org-agenda-sticky nil)) + (org-agenda-list nil (calendar-absolute-from-gregorian + (calendar-cursor-to-date)) + nil))) + +(defun org-agenda-convert-date () + (interactive) + (org-agenda-check-type t 'agenda) + (let ((day (get-text-property (min (1- (point-max)) (point)) 'day)) + date s) + (unless day + (user-error "Don't know which date to convert")) + (setq date (calendar-gregorian-from-absolute day)) + (setq s (concat + "Gregorian: " (calendar-date-string date) "\n" + "ISO: " (calendar-iso-date-string date) "\n" + "Day of Yr: " (calendar-day-of-year-string date) "\n" + "Julian: " (calendar-julian-date-string date) "\n" + "Astron. JD: " (calendar-astro-date-string date) + " (Julian date number at noon UTC)\n" + "Hebrew: " (calendar-hebrew-date-string date) " (until sunset)\n" + "Islamic: " (calendar-islamic-date-string date) " (until sunset)\n" + "French: " (calendar-french-date-string date) "\n" + "Bahá’í: " (calendar-bahai-date-string date) " (until sunset)\n" + "Mayan: " (calendar-mayan-date-string date) "\n" + "Coptic: " (calendar-coptic-date-string date) "\n" + "Ethiopic: " (calendar-ethiopic-date-string date) "\n" + "Persian: " (calendar-persian-date-string date) "\n" + "Chinese: " (calendar-chinese-date-string date) "\n")) + (with-output-to-temp-buffer "*Dates*" + (princ s)) + (org-fit-window-to-buffer (get-buffer-window "*Dates*")))) + +;;; Bulk commands + +(defun org-agenda-bulk-marked-p () + "Non-nil when current entry is marked for bulk action." + (eq (get-char-property (point-at-bol) 'type) + 'org-marked-entry-overlay)) + +(defun org-agenda-bulk-mark (&optional arg) + "Mark entries for future bulk action. + +When ARG is nil or one and region is not active then mark the +entry at point. + +When ARG is nil or one and region is active then mark the entries +in the region. + +When ARG is greater than one mark ARG lines." + (interactive "p") + (when (and (or (not arg) (= arg 1)) (use-region-p)) + (setq arg (count-lines (region-beginning) (region-end))) + (goto-char (region-beginning)) + (deactivate-mark)) + (dotimes (_ (or arg 1)) + (unless (org-get-at-bol 'org-agenda-diary-link) + (let* ((m (org-get-at-bol 'org-hd-marker)) + ov) + (unless (org-agenda-bulk-marked-p) + (unless m (user-error "Nothing to mark at point")) + (push m org-agenda-bulk-marked-entries) + (setq ov (make-overlay (point-at-bol) (+ 2 (point-at-bol)))) + (org-overlay-display ov (concat org-agenda-bulk-mark-char " ") + (org-get-todo-face "TODO") + 'evaporate) + (overlay-put ov 'type 'org-marked-entry-overlay)) + (end-of-line 1) + (or (ignore-errors + (goto-char (next-single-property-change (point) 'org-hd-marker))) + (beginning-of-line 2)) + (while (and (get-char-property (point) 'invisible) (not (eobp))) + (beginning-of-line 2))))) + (message "%d entries marked for bulk action" + (length org-agenda-bulk-marked-entries))) + +(defun org-agenda-bulk-mark-all () + "Mark all entries for future agenda bulk action." + (interactive) + (org-agenda-bulk-mark-regexp ".")) + +(defun org-agenda-bulk-mark-regexp (regexp) + "Mark entries matching REGEXP for future agenda bulk action." + (interactive "sMark entries matching regexp: ") + (let ((entries-marked 0) txt-at-point) + (save-excursion + (goto-char (point-min)) + (goto-char (next-single-property-change (point) 'org-hd-marker)) + (while (and (re-search-forward regexp nil t) + (setq txt-at-point + (get-text-property (match-beginning 0) 'txt))) + (if (get-char-property (point) 'invisible) + (beginning-of-line 2) + (when (string-match-p regexp txt-at-point) + (setq entries-marked (1+ entries-marked)) + (call-interactively 'org-agenda-bulk-mark))))) + (unless entries-marked + (message "No entry matching this regexp.")))) + +(defun org-agenda-bulk-unmark (&optional arg) + "Unmark the entry at point for future bulk action." + (interactive "P") + (if arg + (org-agenda-bulk-unmark-all) + (cond ((org-agenda-bulk-marked-p) + (org-agenda-bulk-remove-overlays + (point-at-bol) (+ 2 (point-at-bol))) + (setq org-agenda-bulk-marked-entries + (delete (org-get-at-bol 'org-hd-marker) + org-agenda-bulk-marked-entries)) + (end-of-line 1) + (or (ignore-errors + (goto-char (next-single-property-change (point) 'txt))) + (beginning-of-line 2)) + (while (and (get-char-property (point) 'invisible) (not (eobp))) + (beginning-of-line 2)) + (message "%d entries left marked for bulk action" + (length org-agenda-bulk-marked-entries))) + (t (message "No entry to unmark here"))))) + +(defun org-agenda-bulk-toggle-all () + "Toggle all marks for bulk action." + (interactive) + (save-excursion + (goto-char (point-min)) + (while (ignore-errors + (goto-char (next-single-property-change (point) 'org-hd-marker))) + (org-agenda-bulk-toggle)))) + +(defun org-agenda-bulk-toggle () + "Toggle the mark at point for bulk action." + (interactive) + (if (org-agenda-bulk-marked-p) + (org-agenda-bulk-unmark) + (org-agenda-bulk-mark))) + +(defun org-agenda-bulk-remove-overlays (&optional beg end) + "Remove the mark overlays between BEG and END in the agenda buffer. +BEG and END default to the buffer limits. + +This only removes the overlays, it does not remove the markers +from the list in `org-agenda-bulk-marked-entries'." + (interactive) + (mapc (lambda (ov) + (and (eq (overlay-get ov 'type) 'org-marked-entry-overlay) + (delete-overlay ov))) + (overlays-in (or beg (point-min)) (or end (point-max))))) + +(defun org-agenda-bulk-unmark-all () + "Remove all marks in the agenda buffer. +This will remove the markers and the overlays." + (interactive) + (if (null org-agenda-bulk-marked-entries) + (message "No entry to unmark") + (setq org-agenda-bulk-marked-entries nil) + (org-agenda-bulk-remove-overlays (point-min) (point-max)))) + +(defcustom org-agenda-persistent-marks nil + "Non-nil means marked items will stay marked after a bulk action. +You can toggle this interactively by typing `p' when prompted for a +bulk action." + :group 'org-agenda + :version "24.1" + :type 'boolean) + +(defcustom org-agenda-loop-over-headlines-in-active-region t + "Shall some commands act upon headlines in the active region? + +When set to t, some commands will be performed in all headlines +within the active region. + +When set to `start-level', some commands will be performed in all +headlines within the active region, provided that these headlines +are of the same level than the first one. + +When set to a regular expression, those commands will be +performed on the matching headlines within the active region. + +The list of commands is: `org-agenda-schedule', +`org-agenda-deadline', `org-agenda-date-prompt', +`org-agenda-todo', `org-agenda-archive*', `org-agenda-kill'. + +See `org-loop-over-headlines-in-active-region' for the equivalent +option for Org buffers." + :type '(choice (const :tag "Don't loop" nil) + (const :tag "All headlines in active region" t) + (const :tag "In active region, headlines at the same level than the first one" start-level) + (regexp :tag "Regular expression matcher")) + :version "27.1" + :package-version '(Org . "9.4") + :group 'org-agenda) + +(defun org-agenda-bulk-action (&optional arg) + "Execute an remote-editing action on all marked entries. +The prefix arg is passed through to the command if possible." + (interactive "P") + ;; When there is no mark, act on the agenda entry at point. + (if (not org-agenda-bulk-marked-entries) + (save-excursion (org-agenda-bulk-mark))) + (dolist (m org-agenda-bulk-marked-entries) + (unless (and (markerp m) + (marker-buffer m) + (buffer-live-p (marker-buffer m)) + (marker-position m)) + (user-error "Marker %s for bulk command is invalid" m))) + + ;; Prompt for the bulk command. + (org-unlogged-message + (concat "Bulk (" (if org-agenda-persistent-marks "" "don't ") "[p]ersist marks): " + "[$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [d]eadline [r]efile " + "[S]catter [f]unction " + (and org-agenda-bulk-custom-functions + (format " Custom: [%s]" + (mapconcat (lambda (f) (char-to-string (car f))) + org-agenda-bulk-custom-functions + ""))))) + (catch 'exit + (let* ((org-log-refile (if org-log-refile 'time nil)) + (entries (reverse org-agenda-bulk-marked-entries)) + (org-overriding-default-time + (and (get-text-property (point) 'org-agenda-date-header) + (org-get-cursor-date))) + redo-at-end + cmd) + (pcase (read-char-exclusive) + (?p + (let ((org-agenda-persistent-marks + (not org-agenda-persistent-marks))) + (org-agenda-bulk-action) + (throw 'exit nil))) + + (?$ + (setq cmd #'org-agenda-archive)) + + (?A + (setq cmd #'org-agenda-archive-to-archive-sibling)) + + ((or ?r ?w) + (let ((refile-location + (org-refile-get-location + "Refile to" + (marker-buffer (car entries)) + org-refile-allow-creating-parent-nodes))) + (when (nth 3 refile-location) + (setcar (nthcdr 3 refile-location) + (move-marker + (make-marker) + (nth 3 refile-location) + (or (get-file-buffer (nth 1 refile-location)) + (find-buffer-visiting (nth 1 refile-location)) + (error "This should not happen"))))) + + (setq cmd (lambda () (org-agenda-refile nil refile-location t))) + (setq redo-at-end t))) + + (?t + (let ((state (completing-read + "Todo state: " + (with-current-buffer (marker-buffer (car entries)) + (mapcar #'list org-todo-keywords-1))))) + (setq cmd (lambda () + (let ((org-inhibit-blocking t) + (org-inhibit-logging 'note)) + (org-agenda-todo state)))))) + + ((and (or ?- ?+) action) + (let ((tag (completing-read + (format "Tag to %s: " (if (eq action ?+) "add" "remove")) + (with-current-buffer (marker-buffer (car entries)) + (delq nil + (mapcar (lambda (x) (and (stringp (car x)) x)) + org-current-tag-alist)))))) + (setq cmd + (lambda () + (org-agenda-set-tags tag + (if (eq action ?+) 'on 'off)))))) + + ((and (or ?s ?d) c) + (let* ((schedule? (eq c ?s)) + (prompt (if schedule? "(Re)Schedule to" "(Re)Set Deadline to")) + (time + (and (not arg) + (let ((new (org-read-date + nil nil nil prompt org-overriding-default-time))) + ;; A "double plus" answer applies to every + ;; scheduled time. Do not turn it into + ;; a fixed date yet. + (if (string-match-p "\\`[ \t]*\\+\\+" + org-read-date-final-answer) + org-read-date-final-answer + new))))) + ;; Make sure to not prompt for a note when bulk + ;; rescheduling/resetting deadline as Org cannot cope with + ;; simultaneous notes. Besides, it could be annoying + ;; depending on the number of marked items. + (setq cmd + (if schedule? + (lambda () + (let ((org-log-reschedule + (and org-log-reschedule 'time))) + (org-agenda-schedule arg time))) + (lambda () + (let ((org-log-redeadline (and org-log-redeadline 'time))) + (org-agenda-deadline arg time))))))) + + (?S + (unless (org-agenda-check-type nil 'agenda 'todo) + (user-error "Can't scatter tasks in \"%s\" agenda view" org-agenda-type)) + (let ((days (read-number + (format "Scatter tasks across how many %sdays: " + (if arg "week" "")) + 7))) + (setq cmd + (lambda () + (let ((distance (1+ (random days)))) + (when arg + (let ((dist distance) + (day-of-week + (calendar-day-of-week + (calendar-gregorian-from-absolute (org-today))))) + (dotimes (_ (1+ dist)) + (while (member day-of-week org-agenda-weekend-days) + (cl-incf distance) + (cl-incf day-of-week) + (when (= day-of-week 7) + (setq day-of-week 0))) + (cl-incf day-of-week) + (when (= day-of-week 7) + (setq day-of-week 0))))) + ;; Silently fail when try to replan a sexp entry. + (ignore-errors + (let* ((date (calendar-gregorian-from-absolute + (+ (org-today) distance))) + (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) + (nth 2 date)))) + (org-agenda-schedule nil time)))))))) + + (?f + (setq cmd + (intern + (completing-read "Function: " obarray #'fboundp t nil nil)))) + + (action + (setq cmd + (pcase (assoc action org-agenda-bulk-custom-functions) + (`(,_ ,fn) + fn) + (`(,_ ,fn ,arg-fn) + (apply #'apply-partially fn (funcall arg-fn))) + (_ + (user-error "Invalid bulk action: %c" action)))) + (setq redo-at-end t))) + ;; Sort the markers, to make sure that parents are handled + ;; before children. + (setq entries (sort entries + (lambda (a b) + (cond + ((eq (marker-buffer a) (marker-buffer b)) + (< (marker-position a) (marker-position b))) + (t + (string< (buffer-name (marker-buffer a)) + (buffer-name (marker-buffer b)))))))) + + ;; Now loop over all markers and apply CMD. + (let ((processed 0) + (skipped 0)) + (dolist (e entries) + (let ((pos (text-property-any (point-min) (point-max) 'org-hd-marker e))) + (if (not pos) + (progn (message "Skipping removed entry at %s" e) + (cl-incf skipped)) + (goto-char pos) + (let (org-loop-over-headlines-in-active-region) (funcall cmd)) + ;; `post-command-hook' is not run yet. We make sure any + ;; pending log note is processed. + (when org-log-setup (org-add-log-note)) + (cl-incf processed)))) + (when redo-at-end (org-agenda-redo)) + (unless org-agenda-persistent-marks (org-agenda-bulk-unmark-all)) + (message "Acted on %d entries%s%s" + processed + (if (= skipped 0) + "" + (format ", skipped %d (disappeared before their turn)" + skipped)) + (if (not org-agenda-persistent-marks) "" " (kept marked)")))))) + +(defun org-agenda-capture (&optional with-time) + "Call `org-capture' with the date at point. +With a `C-1' prefix, use the HH:MM value at point (if any) or the +current HH:MM time." + (interactive "P") + (if (not (eq major-mode 'org-agenda-mode)) + (user-error "You cannot do this outside of agenda buffers") + (let ((org-overriding-default-time + (org-get-cursor-date (equal with-time 1)))) + (call-interactively 'org-capture)))) + +;;; Dragging agenda lines forward/backward + +(defun org-agenda-reapply-filters () + "Re-apply all agenda filters." + (mapcar + (lambda(f) (when (car f) (org-agenda-filter-apply (car f) (cadr f) t))) + `((,org-agenda-tag-filter tag) + (,org-agenda-category-filter category) + (,org-agenda-regexp-filter regexp) + (,org-agenda-effort-filter effort) + (,(get 'org-agenda-tag-filter :preset-filter) tag) + (,(get 'org-agenda-category-filter :preset-filter) category) + (,(get 'org-agenda-effort-filter :preset-filter) effort) + (,(get 'org-agenda-regexp-filter :preset-filter) regexp)))) + +(defun org-agenda-drag-line-forward (arg &optional backward) + "Drag an agenda line forward by ARG lines. +When the optional argument `backward' is non-nil, move backward." + (interactive "p") + (let ((inhibit-read-only t) lst line) + (if (or (not (get-text-property (point) 'txt)) + (save-excursion + (dotimes (_ arg) + (move-beginning-of-line (if backward 0 2)) + (push (not (get-text-property (point) 'txt)) lst)) + (delq nil lst))) + (message "Cannot move line forward") + (let ((end (save-excursion (move-beginning-of-line 2) (point)))) + (move-beginning-of-line 1) + (setq line (buffer-substring (point) end)) + (delete-region (point) end) + (move-beginning-of-line (funcall (if backward '1- '1+) arg)) + (insert line) + (org-agenda-reapply-filters) + (org-agenda-mark-clocking-task) + (move-beginning-of-line 0))))) + +(defun org-agenda-drag-line-backward (arg) + "Drag an agenda line backward by ARG lines." + (interactive "p") + (org-agenda-drag-line-forward arg t)) + +;;; Flagging notes + +(defun org-agenda-show-the-flagging-note () + "Display the flagging note in the other window. +When called a second time in direct sequence, offer to remove the FLAGGING +tag and (if present) the flagging note." + (interactive) + (let ((hdmarker (org-get-at-bol 'org-hd-marker)) + (win (selected-window)) + note) ;; heading newhead + (unless hdmarker + (user-error "No linked entry at point")) + (if (and (eq this-command last-command) + (y-or-n-p "Unflag and remove any flagging note? ")) + (progn + (org-agenda-remove-flag hdmarker) + (let ((win (get-buffer-window "*Flagging Note*"))) + (and win (delete-window win))) + (message "Entry unflagged")) + (setq note (org-entry-get hdmarker "THEFLAGGINGNOTE")) + (unless note + (user-error "No flagging note")) + (org-kill-new note) + (org-switch-to-buffer-other-window "*Flagging Note*") + (erase-buffer) + (insert note) + (goto-char (point-min)) + (while (re-search-forward "\\\\n" nil t) + (replace-match "\n" t t)) + (goto-char (point-min)) + (select-window win) + (message "%s" (substitute-command-keys "Flagging note pushed to \ +kill ring. Press `\\[org-agenda-show-the-flagging-note]' again to remove \ +tag and note"))))) + +(defun org-agenda-remove-flag (marker) + "Remove the FLAGGED tag and any flagging note in the entry." + (let ((newhead + (org-with-point-at marker + (org-toggle-tag "FLAGGED" 'off) + (org-entry-delete nil "THEFLAGGINGNOTE") + (org-get-heading)))) + (org-agenda-change-all-lines newhead marker) + (message "Entry unflagged"))) + +(defun org-agenda-get-any-marker (&optional pos) + (or (get-text-property (or pos (point-at-bol)) 'org-hd-marker) + (get-text-property (or pos (point-at-bol)) 'org-marker))) + +;;; Appointment reminders + +(defvar appt-time-msg-list) ; defined in appt.el + +;;;###autoload +(defun org-agenda-to-appt (&optional refresh filter &rest args) + "Activate appointments found in `org-agenda-files'. + +With a `\\[universal-argument]' prefix, refresh the list of \ +appointments. + +If FILTER is t, interactively prompt the user for a regular +expression, and filter out entries that don't match it. + +If FILTER is a string, use this string as a regular expression +for filtering entries out. + +If FILTER is a function, filter out entries against which +calling the function returns nil. This function takes one +argument: an entry from `org-agenda-get-day-entries'. + +FILTER can also be an alist with the car of each cell being +either `headline' or `category'. For example: + + \\='((headline \"IMPORTANT\") + (category \"Work\")) + +will only add headlines containing IMPORTANT or headlines +belonging to the \"Work\" category. + +ARGS are symbols indicating what kind of entries to consider. +By default `org-agenda-to-appt' will use :deadline*, :scheduled* +\(i.e., deadlines and scheduled items with a hh:mm specification) +and :timestamp entries. See the docstring of `org-diary' for +details and examples. + +If an entry has a APPT_WARNTIME property, its value will be used +to override `appt-message-warning-time'." + (interactive "P") + (when refresh (setq appt-time-msg-list nil)) + (when (eq filter t) + (setq filter (read-from-minibuffer "Regexp filter: "))) + (let* ((cnt 0) ; count added events + (scope (or args '(:deadline* :scheduled* :timestamp))) + (org-agenda-new-buffers nil) + (org-deadline-warning-days 0) + ;; Do not use `org-today' here because appt only takes + ;; time and without date as argument, so it may pass wrong + ;; information otherwise + (today (org-date-to-gregorian + (time-to-days nil))) + (org-agenda-restrict nil) + (files (org-agenda-files 'unrestricted)) entries file + (org-agenda-buffer nil)) + ;; Get all entries which may contain an appt + (org-agenda-prepare-buffers files) + (while (setq file (pop files)) + (setq entries + (delq nil + (append entries + (apply #'org-agenda-get-day-entries + file today scope))))) + ;; Map through entries and find if we should filter them out + (mapc + (lambda (x) + (let* ((evt (org-trim + (replace-regexp-in-string + org-link-bracket-re "\\2" + (or (get-text-property 1 'txt x) "")))) + (cat (get-text-property (1- (length x)) 'org-category x)) + (tod (get-text-property 1 'time-of-day x)) + (ok (or (null filter) + (and (stringp filter) (string-match filter evt)) + (and (functionp filter) (funcall filter x)) + (and (listp filter) + (let ((cat-filter (cadr (assq 'category filter))) + (evt-filter (cadr (assq 'headline filter)))) + (or (and (stringp cat-filter) + (string-match cat-filter cat)) + (and (stringp evt-filter) + (string-match evt-filter evt))))))) + (wrn (get-text-property 1 'warntime x))) + ;; FIXME: Shall we remove text-properties for the appt text? + ;; (setq evt (set-text-properties 0 (length evt) nil evt)) + (when (and ok tod (not (string-match "\\`DONE\\|CANCELLED" evt))) + (setq tod (concat "00" (number-to-string tod))) + (setq tod (when (string-match + "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)\\'" tod) + (concat (match-string 1 tod) ":" + (match-string 2 tod)))) + (when (appt-add tod evt wrn) + (setq cnt (1+ cnt)))))) + entries) + (org-release-buffers org-agenda-new-buffers) + (if (eq cnt 0) + (message "No event to add") + (message "Added %d event%s for today" cnt (if (> cnt 1) "s" ""))))) + +(defun org-agenda-today-p (date) + "Non-nil when DATE means today. +DATE is either a list of the form (month day year) or a number of +days as returned by `calendar-absolute-from-gregorian' or +`org-today'. This function considers `org-extend-today-until' +when defining today." + (eq (org-today) + (if (consp date) (calendar-absolute-from-gregorian date) date))) + +(defun org-agenda-todo-yesterday (&optional arg) + "Like `org-agenda-todo' but the time of change will be 23:59 of yesterday." + (interactive "P") + (let* ((org-use-effective-time t) + (hour (nth 2 (decode-time (org-current-time)))) + (org-extend-today-until (1+ hour))) + (org-agenda-todo arg))) + +(defun org-agenda-ctrl-c-ctrl-c () + "Set tags in agenda buffer." + (interactive) + (org-agenda-set-tags)) + +(provide 'org-agenda) + +;;; org-agenda.el ends here diff --git a/elpa/org-9.5.2/org-agenda.elc b/elpa/org-9.5.2/org-agenda.elc new file mode 100644 index 0000000..9aef299 Binary files /dev/null and b/elpa/org-9.5.2/org-agenda.elc differ diff --git a/elpa/org-9.5.2/org-archive.el b/elpa/org-9.5.2/org-archive.el new file mode 100644 index 0000000..0943869 --- /dev/null +++ b/elpa/org-9.5.2/org-archive.el @@ -0,0 +1,639 @@ +;;; org-archive.el --- Archiving for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the archive functionality for Org. + +;;; Code: + +(require 'org) +(require 'cl-lib) + +(declare-function org-element-type "org-element" (element)) +(declare-function org-datetree-find-date-create "org-datetree" (date &optional keep-restriction)) +(declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) + +(defcustom org-archive-default-command 'org-archive-subtree + "The default archiving command." + :group 'org-archive + :type '(choice + (const org-archive-subtree) + (const org-archive-to-archive-sibling) + (const org-archive-set-tag))) + +(defcustom org-archive-reversed-order nil + "Non-nil means make the tree first child under the archive heading, not last." + :group 'org-archive + :version "24.1" + :type 'boolean) + +(defcustom org-archive-sibling-heading "Archive" + "Name of the local archive sibling that is used to archive entries locally. +Locally means: in the tree, under a sibling. +See `org-archive-to-archive-sibling' for more information." + :group 'org-archive + :type 'string) + +(defcustom org-archive-mark-done nil + "Non-nil means mark entries as DONE when they are moved to the archive file. +This can be a string to set the keyword to use. When non-nil, Org will +use the first keyword in its list that means done." + :group 'org-archive + :type '(choice + (const :tag "No" nil) + (const :tag "Yes" t) + (string :tag "Use this keyword"))) + +(defcustom org-archive-stamp-time t + "Non-nil means add a time stamp to entries moved to an archive file. +This variable is obsolete and has no effect anymore, instead add or remove +`time' from the variable `org-archive-save-context-info'." + :group 'org-archive + :type 'boolean) + +(defcustom org-archive-file-header-format "\nArchived entries from file %s\n\n" + "The header format string for newly created archive files. +When nil, no header will be inserted. +When a string, a %s formatter will be replaced by the file name." + :group 'org-archive + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-archive-subtree-add-inherited-tags 'infile + "Non-nil means append inherited tags when archiving a subtree." + :group 'org-archive + :version "24.1" + :type '(choice + (const :tag "Never" nil) + (const :tag "When archiving a subtree to the same file" infile) + (const :tag "Always" t))) + +(defcustom org-archive-subtree-save-file-p 'from-org + "Conditionally save the archive file after archiving a subtree. +This variable can be any of the following symbols: + +t saves in all cases. +`from-org' prevents saving from an agenda-view. +`from-agenda' saves only when the archive is initiated from an agenda-view. +nil prevents saving in all cases. + +Note that, regardless of this value, the archive buffer is never +saved when archiving into a location in the current buffer." + :group 'org-archive + :package-version '(Org . "9.4") + :type '(choice + (const :tag "Save archive buffer" t) + (const :tag "Save when archiving from agenda" from-agenda) + (const :tag "Save when archiving from an Org buffer" from-org) + (const :tag "Do not save"))) + +(defcustom org-archive-save-context-info '(time file olpath category todo itags) + "Parts of context info that should be stored as properties when archiving. +When a subtree is moved to an archive file, it loses information given by +context, like inherited tags, the category, and possibly also the TODO +state (depending on the variable `org-archive-mark-done'). +This variable can be a list of any of the following symbols: + +time The time of archiving. +file The file where the entry originates. +ltags The local tags, in the headline of the subtree. +itags The tags the subtree inherits from further up the hierarchy. +todo The pre-archive TODO state. +category The category, taken from file name or #+CATEGORY lines. +olpath The outline path to the item. These are all headlines above + the current item, separated by /, like a file path. + +For each symbol present in the list, a property will be created in +the archived entry, with a prefix \"ARCHIVE_\", to remember this +information." + :group 'org-archive + :type '(set :greedy t + (const :tag "Time" time) + (const :tag "File" file) + (const :tag "Category" category) + (const :tag "TODO state" todo) + (const :tag "Priority" priority) + (const :tag "Inherited tags" itags) + (const :tag "Outline path" olpath) + (const :tag "Local tags" ltags))) + +(defvar org-archive-hook nil + "Hook run after successfully archiving a subtree. +Hook functions are called with point on the subtree in the +original file. At this stage, the subtree has been added to the +archive location, but not yet deleted from the original file.") + +;;;###autoload +(defun org-add-archive-files (files) + "Splice the archive files into the list of files. +This implies visiting all these files and finding out what the +archive file is." + (org-uniquify + (apply + 'append + (mapcar + (lambda (f) + (if (not (file-exists-p f)) + nil + (with-current-buffer (org-get-agenda-file-buffer f) + (cons f (org-all-archive-files))))) + files)))) + +(defun org-all-archive-files () + "List of all archive files used in the current buffer." + (let* ((case-fold-search t) + (files `(,(car (org-archive--compute-location org-archive-location))))) + (org-with-point-at 1 + (while (re-search-forward "^[ \t]*:ARCHIVE:" nil t) + (when (org-at-property-p) + (pcase (org-archive--compute-location (match-string 3)) + (`(,file . ,_) + (when (org-string-nw-p file) + (cl-pushnew file files :test #'file-equal-p)))))) + (cl-remove-if-not #'file-exists-p (nreverse files))))) + +(defun org-archive--compute-location (location) + "Extract and expand the location from archive LOCATION. +Return a pair (FILE . HEADING) where FILE is the file name and +HEADING the heading of the archive location, as strings. Raise +an error if LOCATION is not a valid archive location." + (unless (string-match "::" location) + (error "Invalid archive location: %S" location)) + (let ((current-file (buffer-file-name (buffer-base-buffer))) + (file-fmt (substring location 0 (match-beginning 0))) + (heading-fmt (substring location (match-end 0)))) + (cons + ;; File part. + (if (org-string-nw-p file-fmt) + (expand-file-name + (format file-fmt (file-name-nondirectory current-file))) + current-file) + ;; Heading part. + (format heading-fmt (file-name-nondirectory current-file))))) + +;;;###autoload +(defun org-archive-subtree (&optional find-done) + "Move the current subtree to the archive. +The archive can be a certain top-level heading in the current +file, or in a different file. The tree will be moved to that +location, the subtree heading be marked DONE, and the current +time will be added. + +When called with a single prefix argument FIND-DONE, find whole +trees without any open TODO items and archive them (after getting +confirmation from the user). When called with a double prefix +argument, find whole trees with timestamps before today and +archive them (after getting confirmation from the user). If the +cursor is not at a headline when these commands are called, try +all level 1 trees. If the cursor is on a headline, only try the +direct children of this heading." + (interactive "P") + (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level 'region)) + org-loop-over-headlines-in-active-region) + (org-map-entries + `(progn (setq org-map-continue-from (progn (org-back-to-heading) (point))) + (org-archive-subtree ,find-done)) + org-loop-over-headlines-in-active-region + cl (if (org-invisible-p) (org-end-of-subtree nil t)))) + (cond + ((equal find-done '(4)) (org-archive-all-done)) + ((equal find-done '(16)) (org-archive-all-old)) + (t + ;; Save all relevant TODO keyword-related variables. + (let* ((tr-org-todo-keywords-1 org-todo-keywords-1) + (tr-org-todo-kwd-alist org-todo-kwd-alist) + (tr-org-done-keywords org-done-keywords) + (tr-org-todo-regexp org-todo-regexp) + (tr-org-todo-line-regexp org-todo-line-regexp) + (tr-org-odd-levels-only org-odd-levels-only) + (this-buffer (current-buffer)) + (time (format-time-string + (substring (cdr org-time-stamp-formats) 1 -1))) + (file (abbreviate-file-name + (or (buffer-file-name (buffer-base-buffer)) + (error "No file associated to buffer")))) + (location (org-archive--compute-location + (or (org-entry-get nil "ARCHIVE" 'inherit) + org-archive-location))) + (afile (car location)) + (heading (cdr location)) + (infile-p (equal file (abbreviate-file-name (or afile "")))) + (newfile-p (and (org-string-nw-p afile) + (not (file-exists-p afile)))) + (buffer (cond ((not (org-string-nw-p afile)) this-buffer) + ((find-buffer-visiting afile)) + ((find-file-noselect afile)) + (t (error "Cannot access file \"%s\"" afile)))) + (org-odd-levels-only + (if (local-variable-p 'org-odd-levels-only (current-buffer)) + org-odd-levels-only + tr-org-odd-levels-only)) + level datetree-date datetree-subheading-p) + (when (string-match "\\`datetree/\\(\\**\\)" heading) + ;; "datetree/" corresponds to 3 levels of headings. + (let ((nsub (length (match-string 1 heading)))) + (setq heading (concat (make-string + (+ (if org-odd-levels-only 5 3) + (* (org-level-increment) nsub)) + ?*) + (substring heading (match-end 0)))) + (setq datetree-subheading-p (> nsub 0))) + (setq datetree-date (org-date-to-gregorian + (or (org-entry-get nil "CLOSED" t) time)))) + (if (and (> (length heading) 0) + (string-match "^\\*+" heading)) + (setq level (match-end 0)) + (setq heading nil level 0)) + (save-excursion + (org-back-to-heading t) + ;; Get context information that will be lost by moving the + ;; tree. See `org-archive-save-context-info'. + (let* ((all-tags (org-get-tags)) + (local-tags + (cl-remove-if (lambda (tag) + (get-text-property 0 'inherited tag)) + all-tags)) + (inherited-tags + (cl-remove-if-not (lambda (tag) + (get-text-property 0 'inherited tag)) + all-tags)) + (context + `((category . ,(org-get-category nil 'force-refresh)) + (file . ,file) + (itags . ,(mapconcat #'identity inherited-tags " ")) + (ltags . ,(mapconcat #'identity local-tags " ")) + (olpath . ,(mapconcat #'identity + (org-get-outline-path) + "/")) + (time . ,time) + (todo . ,(org-entry-get (point) "TODO"))))) + ;; We first only copy, in case something goes wrong + ;; we need to protect `this-command', to avoid kill-region sets it, + ;; which would lead to duplication of subtrees + (let (this-command) (org-copy-subtree 1 nil t)) + (set-buffer buffer) + ;; Enforce Org mode for the archive buffer + (if (not (derived-mode-p 'org-mode)) + ;; Force the mode for future visits. + (let ((org-insert-mode-line-in-empty-file t) + (org-inhibit-startup t)) + (call-interactively 'org-mode))) + (when (and newfile-p org-archive-file-header-format) + (goto-char (point-max)) + (insert (format org-archive-file-header-format + (buffer-file-name this-buffer)))) + (when datetree-date + (require 'org-datetree) + (org-datetree-find-date-create datetree-date) + (org-narrow-to-subtree)) + ;; Force the TODO keywords of the original buffer + (let ((org-todo-line-regexp tr-org-todo-line-regexp) + (org-todo-keywords-1 tr-org-todo-keywords-1) + (org-todo-kwd-alist tr-org-todo-kwd-alist) + (org-done-keywords tr-org-done-keywords) + (org-todo-regexp tr-org-todo-regexp) + (org-todo-line-regexp tr-org-todo-line-regexp)) + (goto-char (point-min)) + (org-show-all '(headings blocks)) + (if (and heading (not (and datetree-date (not datetree-subheading-p)))) + (progn + (if (re-search-forward + (concat "^" (regexp-quote heading) + "\\([ \t]+:\\(" org-tag-re ":\\)+\\)?[ \t]*$") + nil t) + (goto-char (match-end 0)) + ;; Heading not found, just insert it at the end + (goto-char (point-max)) + (or (bolp) (insert "\n")) + ;; datetrees don't need too much spacing + (insert (if datetree-date "" "\n") heading "\n") + (end-of-line 0)) + ;; Make the subtree visible + (outline-show-subtree) + (if org-archive-reversed-order + (progn + (org-back-to-heading t) + (outline-next-heading)) + (org-end-of-subtree t)) + (skip-chars-backward " \t\r\n") + (and (looking-at "[ \t\r\n]*") + ;; datetree archives don't need so much spacing. + (replace-match (if datetree-date "\n" "\n\n")))) + ;; No specific heading, just go to end of file, or to the + ;; beginning, depending on `org-archive-reversed-order'. + (if org-archive-reversed-order + (progn + (goto-char (point-min)) + (unless (org-at-heading-p) (outline-next-heading))) + (goto-char (point-max)) + ;; Subtree narrowing can let the buffer end on + ;; a headline. `org-paste-subtree' then deletes it. + ;; To prevent this, make sure visible part of buffer + ;; always terminates on a new line, while limiting + ;; number of blank lines in a date tree. + (unless (and datetree-date (bolp)) (insert "\n")))) + ;; Paste + (org-paste-subtree (org-get-valid-level level (and heading 1))) + ;; Shall we append inherited tags? + (and inherited-tags + (or (and (eq org-archive-subtree-add-inherited-tags 'infile) + infile-p) + (eq org-archive-subtree-add-inherited-tags t)) + (org-set-tags all-tags)) + ;; Mark the entry as done + (when (and org-archive-mark-done + (let ((case-fold-search nil)) + (looking-at org-todo-line-regexp)) + (or (not (match-end 2)) + (not (member (match-string 2) org-done-keywords)))) + (let (org-log-done org-todo-log-states) + (org-todo + (car (or (member org-archive-mark-done org-done-keywords) + org-done-keywords))))) + + ;; Add the context info. + (dolist (item org-archive-save-context-info) + (let ((value (cdr (assq item context)))) + (when (org-string-nw-p value) + (org-entry-put + (point) + (concat "ARCHIVE_" (upcase (symbol-name item))) + value)))) + ;; Save the buffer, if it is not the same buffer and + ;; depending on `org-archive-subtree-save-file-p'. + (unless (eq this-buffer buffer) + (when (or (eq org-archive-subtree-save-file-p t) + (eq org-archive-subtree-save-file-p + (if (boundp 'org-archive-from-agenda) + 'from-agenda + 'from-org))) + (save-buffer))) + (widen)))) + ;; Here we are back in the original buffer. Everything seems + ;; to have worked. So now run hooks, cut the tree and finish + ;; up. + (run-hooks 'org-archive-hook) + (let (this-command) (org-cut-subtree)) + (when (featurep 'org-inlinetask) + (org-inlinetask-remove-END-maybe)) + (setq org-markers-to-move nil) + (when org-provide-todo-statistics + (save-excursion + ;; Go to parent, even if no children exist. + (org-up-heading-safe) + ;; Update cookie of parent. + (org-update-statistics-cookies nil))) + (message "Subtree archived %s" + (if (eq this-buffer buffer) + (concat "under heading: " heading) + (concat "in file: " (abbreviate-file-name afile))))))) + (org-reveal) + (if (looking-at "^[ \t]*$") + (outline-next-visible-heading 1)))) + +;;;###autoload +(defun org-archive-to-archive-sibling () + "Archive the current heading by moving it under the archive sibling. + +The archive sibling is a sibling of the heading with the heading name +`org-archive-sibling-heading' and an `org-archive-tag' tag. If this +sibling does not exist, it will be created at the end of the subtree. + +Archiving time is retained in the ARCHIVE_TIME node property." + (interactive) + (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (let ((cl (when (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level 'region)) + org-loop-over-headlines-in-active-region) + (org-map-entries + '(progn (setq org-map-continue-from + (progn (org-back-to-heading) + (if (looking-at (concat "^.*:" org-archive-tag ":.*$")) + (org-end-of-subtree t) + (point)))) + (when (org-at-heading-p) + (org-archive-to-archive-sibling))) + org-loop-over-headlines-in-active-region + cl (if (org-invisible-p) (org-end-of-subtree nil t)))) + (save-restriction + (widen) + (let (b e pos leader level) + (org-back-to-heading t) + (looking-at org-outline-regexp) + (setq leader (match-string 0) + level (funcall outline-level)) + (setq pos (point-marker)) + (condition-case nil + (outline-up-heading 1 t) + (error (setq e (point-max)) (goto-char (point-min)))) + (setq b (point)) + (unless e + (condition-case nil + (org-end-of-subtree t t) + (error (goto-char (point-max)))) + (setq e (point))) + (goto-char b) + (unless (re-search-forward + (concat "^" (regexp-quote leader) + "[ \t]*" + org-archive-sibling-heading + "[ \t]*:" + org-archive-tag ":") e t) + (goto-char e) + (or (bolp) (newline)) + (insert leader org-archive-sibling-heading "\n") + (beginning-of-line 0) + (org-toggle-tag org-archive-tag 'on)) + (beginning-of-line 1) + (if org-archive-reversed-order + (outline-next-heading) + (org-end-of-subtree t t)) + (save-excursion + (goto-char pos) + (let ((this-command this-command)) (org-cut-subtree))) + (org-paste-subtree (org-get-valid-level level 1)) + (org-set-property + "ARCHIVE_TIME" + (format-time-string + (substring (cdr org-time-stamp-formats) 1 -1))) + (outline-up-heading 1 t) + (org-flag-subtree t) + (org-cycle-show-empty-lines 'folded) + (when org-provide-todo-statistics + ;; Update TODO statistics of parent. + (org-update-parent-todo-statistics)) + (goto-char pos))) + (org-reveal) + (if (looking-at "^[ \t]*$") + (outline-next-visible-heading 1)))) + +(defun org-archive-all-done (&optional tag) + "Archive sublevels of the current tree without open TODO items. +If the cursor is not on a headline, try all level 1 trees. If +it is on a headline, try all direct children. +When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag." + (org-archive-all-matches + (lambda (_beg end) + (let ((case-fold-search nil)) + (unless (re-search-forward org-not-done-heading-regexp end t) + "no open TODO items"))) + tag)) + +(defun org-archive-all-old (&optional tag) + "Archive sublevels of the current tree with timestamps prior to today. +If the cursor is not on a headline, try all level 1 trees. If +it is on a headline, try all direct children. +When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag." + (org-archive-all-matches + (lambda (_beg end) + (let (ts) + (and (re-search-forward org-ts-regexp end t) + (setq ts (match-string 0)) + (< (org-time-stamp-to-now ts) 0) + (if (not (looking-at + (concat "--\\(" org-ts-regexp "\\)"))) + (concat "old timestamp " ts) + (setq ts (concat "old timestamp " ts (match-string 0))) + (and (< (org-time-stamp-to-now (match-string 1)) 0) + ts))))) + tag)) + +(defun org-archive-all-matches (predicate &optional tag) + "Archive sublevels of the current tree that match PREDICATE. + +PREDICATE is a function of two arguments, BEG and END, which +specify the beginning and end of the headline being considered. +It is called with point positioned at BEG. The headline will be +archived if PREDICATE returns non-nil. If the return value of +PREDICATE is a string, it should describe the reason for +archiving the heading. + +If the cursor is not on a headline, try all level 1 trees. If it +is on a headline, try all direct children. When TAG is non-nil, +don't move trees, but mark them with the ARCHIVE tag." + (let ((rea (concat ".*:" org-archive-tag ":")) re1 + (begm (make-marker)) + (endm (make-marker)) + (question (if tag "Set ARCHIVE tag? " + "Move subtree to archive? ")) + reason beg end (cntarch 0)) + (if (org-at-heading-p) + (progn + (setq re1 (concat "^" (regexp-quote + (make-string + (+ (- (match-end 0) (match-beginning 0) 1) + (if org-odd-levels-only 2 1)) + ?*)) + " ")) + (move-marker begm (point)) + (move-marker endm (org-end-of-subtree t))) + (setq re1 "^* ") + (move-marker begm (point-min)) + (move-marker endm (point-max))) + (save-excursion + (goto-char begm) + (while (re-search-forward re1 endm t) + (setq beg (match-beginning 0) + end (save-excursion (org-end-of-subtree t) (point))) + (goto-char beg) + (if (not (setq reason (funcall predicate beg end))) + (goto-char end) + (goto-char beg) + (if (and (or (not tag) (not (looking-at rea))) + (y-or-n-p + (if (stringp reason) + (concat question "(" reason ")") + question))) + (progn + (if tag + (org-toggle-tag org-archive-tag 'on) + (org-archive-subtree)) + (setq cntarch (1+ cntarch))) + (goto-char end))))) + (message "%d trees archived" cntarch))) + +;;;###autoload +(defun org-toggle-archive-tag (&optional find-done) + "Toggle the archive tag for the current headline. +With prefix ARG, check all children of current headline and offer tagging +the children that do not contain any open TODO items." + (interactive "P") + (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level 'region)) + org-loop-over-headlines-in-active-region) + (org-map-entries + `(org-toggle-archive-tag ,find-done) + org-loop-over-headlines-in-active-region + cl (if (org-invisible-p) (org-end-of-subtree nil t)))) + (if find-done + (org-archive-all-done 'tag) + (let (set) + (save-excursion + (org-back-to-heading t) + (setq set (org-toggle-tag org-archive-tag)) + (when set (org-flag-subtree t))) + (and set (beginning-of-line 1)) + (message "Subtree %s" (if set "archived" "unarchived")))))) + +(defun org-archive-set-tag () + "Set the ARCHIVE tag." + (interactive) + (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level 'region)) + org-loop-over-headlines-in-active-region) + (org-map-entries + 'org-archive-set-tag + org-loop-over-headlines-in-active-region + cl (if (org-invisible-p) (org-end-of-subtree nil t)))) + (org-toggle-tag org-archive-tag 'on))) + +;;;###autoload +(defun org-archive-subtree-default () + "Archive the current subtree with the default command. +This command is set with the variable `org-archive-default-command'." + (interactive) + (call-interactively org-archive-default-command)) + +;;;###autoload +(defun org-archive-subtree-default-with-confirmation () + "Archive the current subtree with the default command. +This command is set with the variable `org-archive-default-command'." + (interactive) + (if (y-or-n-p "Archive this subtree or entry? ") + (call-interactively org-archive-default-command) + (error "Abort"))) + +(provide 'org-archive) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-archive.el ends here diff --git a/elpa/org-9.5.2/org-archive.elc b/elpa/org-9.5.2/org-archive.elc new file mode 100644 index 0000000..51f54e1 Binary files /dev/null and b/elpa/org-9.5.2/org-archive.elc differ diff --git a/elpa/org-9.5.2/org-attach-git.el b/elpa/org-9.5.2/org-attach-git.el new file mode 100644 index 0000000..4c6bdc9 --- /dev/null +++ b/elpa/org-9.5.2/org-attach-git.el @@ -0,0 +1,142 @@ +;;; org-attach-git.el --- Automatic git commit extension to org-attach -*- lexical-binding: t; -*- + +;; Copyright (C) 2019-2021 Free Software Foundation, Inc. + +;; Original Author: John Wiegley +;; Restructurer: Gustav Wikström +;; Keywords: org data git + +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; An extension to org-attach. If `org-attach-id-dir' is initialized +;; as a Git repository, then `org-attach-git' will automatically commit +;; changes when it sees them. Requires git-annex. + +;;; Code: + +(require 'org-attach) +(require 'vc-git) + +(defcustom org-attach-git-annex-cutoff (* 32 1024) + "If non-nil, files larger than this will be annexed instead of stored." + :group 'org-attach + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "None" nil) + (integer :tag "Bytes"))) + +(defcustom org-attach-git-annex-auto-get 'ask + "Confirmation preference for automatically getting annex files. +If \\='ask, prompt using `y-or-n-p'. If t, always get. If nil, never get." + :group 'org-attach + :package-version '(Org . "9.0") + :version "26.1" + :type '(choice + (const :tag "confirm with `y-or-n-p'" ask) + (const :tag "always get from annex if necessary" t) + (const :tag "never get from annex" nil))) + +(defcustom org-attach-git-dir 'default + "Attachment directory with the Git repository to use. +The default value is to use `org-attach-id-dir'. When set to +`individual-repository', then the directory attached to the +current node, if correctly initialized as a Git repository, will +be used instead." + :group 'org-attach + :package-version '(Org . "9.5") + :type '(choice + (const :tag "Default" default) + (const :tag "Individual repository" individual-repository))) + +(defun org-attach-git-use-annex () + "Return non-nil if git annex can be used." + (let ((git-dir (vc-git-root + (cond ((eq org-attach-git-dir 'default) + (expand-file-name org-attach-id-dir)) + ((eq org-attach-git-dir 'individual-repository) + (org-attach-dir)))))) + (and org-attach-git-annex-cutoff + (or (file-exists-p (expand-file-name "annex" git-dir)) + (file-exists-p (expand-file-name ".git/annex" git-dir)))))) + +(defun org-attach-git-annex-get-maybe (path) + "Call git annex get PATH (via shell) if using git annex. +Signals an error if the file content is not available and it was not retrieved." + (let* ((default-directory + (cond ((eq org-attach-git-dir 'default) + (expand-file-name org-attach-id-dir)) + ((eq org-attach-git-dir 'individual-repository) + (org-attach-dir)))) + (path-relative (file-relative-name path))) + (when (and (org-attach-git-use-annex) + (not + (string-equal + "found" + (shell-command-to-string + (format "git annex find --format=found --in=here %s" + (shell-quote-argument path-relative)))))) + (let ((should-get + (if (eq org-attach-git-annex-auto-get 'ask) + (y-or-n-p (format "Run git annex get %s? " path-relative)) + org-attach-git-annex-auto-get))) + (unless should-get + (error "File %s stored in git annex but unavailable" path)) + (message "Running git annex get \"%s\"." path-relative) + (call-process "git" nil nil nil "annex" "get" path-relative))))) + +(defun org-attach-git-commit (&optional _) + "Commit changes to git if `org-attach-id-dir' is properly initialized. +This checks for the existence of a \".git\" directory in that directory. + +Takes an unused optional argument for the sake of being compatible +with hook `org-attach-after-change-hook'." + (let* ((dir (cond ((eq org-attach-git-dir 'default) + (expand-file-name org-attach-id-dir)) + ((eq org-attach-git-dir 'individual-repository) + (org-attach-dir)))) + (git-dir (vc-git-root dir)) + (use-annex (org-attach-git-use-annex)) + (changes 0)) + (when (and git-dir (executable-find "git")) + (with-temp-buffer + (cd dir) + (dolist (new-or-modified + (split-string + (shell-command-to-string + "git ls-files -zmo --exclude-standard") "\0" t)) + (if (and use-annex + (>= (file-attribute-size (file-attributes new-or-modified)) + org-attach-git-annex-cutoff)) + (call-process "git" nil nil nil "annex" "add" new-or-modified) + (call-process "git" nil nil nil "add" new-or-modified)) + (cl-incf changes)) + (dolist (deleted + (split-string + (shell-command-to-string "git ls-files -z --deleted") "\0" t)) + (call-process "git" nil nil nil "rm" deleted) + (cl-incf changes)) + (when (> changes 0) + (shell-command "git commit -m 'Synchronized attachments'")))))) + +(add-hook 'org-attach-after-change-hook 'org-attach-git-commit) +(add-hook 'org-attach-open-hook 'org-attach-git-annex-get-maybe) + +(provide 'org-attach-git) + +;;; org-attach-git.el ends here diff --git a/elpa/org-9.5.2/org-attach-git.elc b/elpa/org-9.5.2/org-attach-git.elc new file mode 100644 index 0000000..e7c7f7e Binary files /dev/null and b/elpa/org-9.5.2/org-attach-git.elc differ diff --git a/elpa/org-9.5.2/org-attach.el b/elpa/org-9.5.2/org-attach.el new file mode 100644 index 0000000..75db69c --- /dev/null +++ b/elpa/org-9.5.2/org-attach.el @@ -0,0 +1,787 @@ +;;; org-attach.el --- Manage file attachments to Org outlines -*- lexical-binding: t; -*- + +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. + +;; Author: John Wiegley +;; Keywords: org data attachment +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; See the Org manual for information on how to use it. +;; +;; Attachments are managed either by using a custom property DIR or by +;; using property ID from org-id. When DIR is defined, a location in +;; the filesystem is directly attached to the outline node. When +;; org-id is used, attachments are stored in a folder named after the +;; ID, in a location defined by `org-attach-id-dir'. DIR has +;; precedence over ID when both parameters are defined for the current +;; outline node (also when inherited parameters are taken into +;; account). + +;;; Code: + +(require 'cl-lib) +(require 'org) +(require 'ol) +(require 'org-id) + +(declare-function dired-dwim-target-directory "dired-aux") +(declare-function dired-get-marked-files "dired" (&optional localp arg filter distinguish-one-marked error)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-inlinetask-goto-beginning "org-inlinetask" ()) +(declare-function org-inlinetask-in-task-p "org-inlinetask" ()) + +(defgroup org-attach nil + "Options concerning attachments in Org mode." + :tag "Org Attach" + :group 'org) + +(defcustom org-attach-id-dir "data/" + "The directory where attachments are stored. +If this is a relative path, it will be interpreted relative to the directory +where the Org file lives." + :group 'org-attach + :type 'directory + :safe #'stringp) + +(defcustom org-attach-dir-relative nil + "Non-nil means directories in DIR property are added as relative links. +Defaults to absolute location." + :group 'org-attach + :type 'boolean + :package-version '(Org . "9.3") + :safe #'booleanp) + +(defcustom org-attach-auto-tag "ATTACH" + "Tag that will be triggered automatically when an entry has an attachment." + :group 'org-attach + :type '(choice + (const :tag "None" nil) + (string :tag "Tag"))) + +(defcustom org-attach-preferred-new-method 'id + "Preferred way to attach to nodes without existing ID and DIR property. +This choice is used when adding attachments to nodes without ID +and DIR properties. + +Allowed values are: + +id Create and use an ID parameter +dir Create and use a DIR parameter +ask Ask the user for input of which method to choose +nil Prefer to not create a new parameter + + nil means that ID or DIR has to be created explicitly + before attaching files." + :group 'org-attach + :package-version '(org . "9.3") + :type '(choice + (const :tag "ID parameter" id) + (const :tag "DIR parameter" dir) + (const :tag "Ask user" ask) + (const :tag "Don't create" nil))) + +(defcustom org-attach-method 'cp + "The preferred method to attach a file. +Allowed values are: + +mv rename the file to move it into the attachment directory +cp copy the file +ln create a hard link. Note that this is not supported + on all systems, and then the result is not defined. +lns create a symbol link. Note that this is not supported + on all systems, and then the result is not defined." + :group 'org-attach + :type '(choice + (const :tag "Copy" cp) + (const :tag "Move/Rename" mv) + (const :tag "Hard Link" ln) + (const :tag "Symbol Link" lns))) + +(defcustom org-attach-expert nil + "Non-nil means do not show the splash buffer with the attach dispatcher." + :group 'org-attach + :type 'boolean) + +(defcustom org-attach-use-inheritance 'selective + "Attachment inheritance for the outline. + +Enabling inheritance for `org-attach' implies two things. First, +that attachment links will look through all parent headings until +it finds the linked attachment. Second, that running org-attach +inside a node without attachments will make org-attach operate on +the first parent heading it finds with an attachment. + +Selective means to respect the inheritance setting in +`org-use-property-inheritance'." + :group 'org-attach + :type '(choice + (const :tag "Don't use inheritance" nil) + (const :tag "Inherit parent node attachments" t) + (const :tag "Respect org-use-property-inheritance" selective))) + +(defcustom org-attach-store-link-p nil + "Non-nil means store a link to a file when attaching it." + :group 'org-attach + :version "24.1" + :type '(choice + (const :tag "Don't store link" nil) + (const :tag "Link to origin location" t) + (const :tag "Attachment link to the attach-dir location" attached) + (const :tag "File link to the attach-dir location" file))) + +(defcustom org-attach-archive-delete nil + "Non-nil means attachments are deleted upon archiving a subtree. +When set to `query', ask the user instead." + :group 'org-attach + :version "26.1" + :package-version '(Org . "8.3") + :type '(choice + (const :tag "Never delete attachments" nil) + (const :tag "Always delete attachments" t) + (const :tag "Query the user" query))) + +(defun org-attach-id-uuid-folder-format (id) + "Translate an UUID ID into a folder-path. +Default format for how Org translates ID properties to a path for +attachments. Useful if ID is generated with UUID." + (format "%s/%s" + (substring id 0 2) + (substring id 2))) + +(defun org-attach-id-ts-folder-format (id) + "Translate an ID based on a timestamp to a folder-path. +Useful way of translation if ID is generated based on ISO8601 +timestamp. Splits the attachment folder hierarchy into +year-month, the rest." + (format "%s/%s" + (substring id 0 6) + (substring id 6))) + +(defcustom org-attach-id-to-path-function-list '(org-attach-id-uuid-folder-format + org-attach-id-ts-folder-format) + "List of functions parsing an ID string into a folder-path. +The first function in this list defines the preferred function +which will be used when creating new attachment folders. All +functions of this list will be tried when looking for existing +attachment folders based on ID." + :group 'org-attach + :package-version '(Org . "9.3") + :type '(repeat (function :tag "Function with ID as input"))) + +(defvar org-attach-after-change-hook nil + "Hook called when files have been added or removed to the attachment folder.") + +(defvar org-attach-open-hook nil + "Hook that is invoked by `org-attach-open'. + +Created mostly to be compatible with org-attach-git after removing +git-functionality from this file.") + +(defcustom org-attach-commands + '(((?a ?\C-a) org-attach-attach + "Select a file and attach it to the task, using `org-attach-method'.") + ((?c ?\C-c) org-attach-attach-cp + "Attach a file using copy method.") + ((?m ?\C-m) org-attach-attach-mv + "Attach a file using move method.") + ((?l ?\C-l) org-attach-attach-ln + "Attach a file using link method.") + ((?y ?\C-y) org-attach-attach-lns + "Attach a file using symbolic-link method.") + ((?u ?\C-u) org-attach-url + "Attach a file from URL (downloading it).") + ((?b) org-attach-buffer + "Select a buffer and attach its contents to the task.") + ((?n ?\C-n) org-attach-new + "Create a new attachment, as an Emacs buffer.") + ((?z ?\C-z) org-attach-sync + "Synchronize the current node with its attachment\n directory, in case \ +you added attachments yourself.\n") + ((?o ?\C-o) org-attach-open + "Open current node's attachments.") + ((?O) org-attach-open-in-emacs + "Like \"o\", but force opening in Emacs.") + ((?f ?\C-f) org-attach-reveal + "Open current node's attachment directory. Create if missing.") + ((?F) org-attach-reveal-in-emacs + "Like \"f\", but force using Dired in Emacs.\n") + ((?d ?\C-d) org-attach-delete-one + "Delete one attachment, you will be prompted for a file name.") + ((?D) org-attach-delete-all + "Delete all of a node's attachments. A safer way is\n to open the \ +directory in dired and delete from there.\n") + ((?s ?\C-s) org-attach-set-directory + "Set a specific attachment directory for this entry. Sets DIR property.") + ((?S ?\C-S) org-attach-unset-directory + "Unset the attachment directory for this entry. Removes DIR property.") + ((?q) (lambda () (interactive) (message "Abort")) "Abort.")) + "The list of commands for the attachment dispatcher. +Each entry in this list is a list of three elements: +- A list of keys (characters) to select the command (the fist + character in the list is shown in the attachment dispatcher's + splash buffer and minibuffer prompt). +- A command that is called interactively when one of these keys + is pressed. +- A docstring for this command in the attachment dispatcher's + splash buffer." + :group 'org-attach + :package-version '(Org . "9.3") + :type '(repeat (list (repeat :tag "Keys" character) + (function :tag "Command") + (string :tag "Docstring")))) + +(defcustom org-attach-sync-delete-empty-dir 'query + "Determine what to do with an empty attachment directory on sync. +When set to nil, don't touch the directory. When set to `query', +ask the user instead, else remove without asking." + :group 'org-attach + :package-version '(Org . "9.5") + :type '(choice + (const :tag "Never delete" nil) + (const :tag "Always delete" t) + (const :tag "Query the user" query))) + +;;;###autoload +(defun org-attach () + "The dispatcher for attachment commands. +Shows a list of commands and prompts for another key to execute a command." + (interactive) + (let ((dir (org-attach-dir nil 'no-fs-check)) + c marker) + (when (eq major-mode 'org-agenda-mode) + (setq marker (or (get-text-property (point) 'org-hd-marker) + (get-text-property (point) 'org-marker))) + (unless marker + (error "No item in current line"))) + (org-with-point-at marker + (if (and (featurep 'org-inlinetask) + (not (org-inlinetask-in-task-p))) + (org-with-limited-levels + (org-back-to-heading-or-point-min t)) + (if (and (featurep 'org-inlinetask) + (org-inlinetask-in-task-p)) + (org-inlinetask-goto-beginning) + (org-back-to-heading-or-point-min t))) + (save-excursion + (save-window-excursion + (unless org-attach-expert + (org-switch-to-buffer-other-window "*Org Attach*") + (erase-buffer) + (setq cursor-type nil + header-line-format "Use C-v, M-v, C-n or C-p to navigate.") + (insert + (concat "Attachment folder:\n" + (or dir + "Can't find an existing attachment-folder") + (unless (and dir (file-directory-p dir)) + "\n(Not yet created)") + "\n\n" + (format "Select an Attachment Command:\n\n%s" + (mapconcat + (lambda (entry) + (pcase entry + (`((,key . ,_) ,_ ,docstring) + (format "%c %s" + key + (replace-regexp-in-string "\n\\([\t ]*\\)" + " " + docstring + nil nil 1))) + (_ + (user-error + "Invalid `org-attach-commands' item: %S" + entry)))) + org-attach-commands + "\n"))))) + (org-fit-window-to-buffer (get-buffer-window "*Org Attach*")) + (let ((msg (format "Select command: [%s]" + (concat (mapcar #'caar org-attach-commands))))) + (message msg) + (while (and (setq c (read-char-exclusive)) + (memq c '(14 16 22 134217846))) + (org-scroll c t))) + (and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*")))) + (let ((command (cl-some (lambda (entry) + (and (memq c (nth 0 entry)) (nth 1 entry))) + org-attach-commands))) + (if (commandp command t) + (call-interactively command) + (error "No such attachment command: %c" c)))))) + +(defun org-attach-dir (&optional create-if-not-exists-p no-fs-check) + "Return the directory associated with the current outline node. +First check for DIR property, then ID property. +`org-attach-use-inheritance' determines whether inherited +properties also will be considered. + +If an ID property is found the default mechanism using that ID +will be invoked to access the directory for the current entry. +Note that this method returns the directory as declared by ID or +DIR even if the directory doesn't exist in the filesystem. + +If CREATE-IF-NOT-EXIST-P is non-nil, `org-attach-dir-get-create' +is run. If NO-FS-CHECK is non-nil, the function returns the path +to the attachment even if it has not yet been initialized in the +filesystem. + +If no attachment directory can be derived, return nil." + (let (attach-dir id) + (cond + (create-if-not-exists-p + (setq attach-dir (org-attach-dir-get-create))) + ((setq attach-dir (org-entry-get nil "DIR" org-attach-use-inheritance)) + (org-attach-check-absolute-path attach-dir)) + ;; Deprecated and removed from documentation, but still + ;; works. FIXME: Remove after major nr change. + ((setq attach-dir (org-entry-get nil "ATTACH_DIR" org-attach-use-inheritance)) + (org-attach-check-absolute-path attach-dir)) + ((setq id (org-entry-get nil "ID" org-attach-use-inheritance)) + (org-attach-check-absolute-path nil) + (setq attach-dir (org-attach-dir-from-id id 'try-all)))) + (if no-fs-check + attach-dir + (when (and attach-dir (file-directory-p attach-dir)) + attach-dir)))) + +(defun org-attach-dir-get-create () + "Return existing or new directory associated with the current outline node. +`org-attach-preferred-new-method' decides how to attach new +directory if neither ID nor DIR property exist. + +If the attachment by some reason cannot be created an error will be raised." + (interactive) + (let ((attach-dir (org-attach-dir nil 'no-fs-check))) + (unless attach-dir + (let (answer) + (when (eq org-attach-preferred-new-method 'ask) + (message "Create new ID [1] property or DIR [2] property for attachments?") + (setq answer (read-char-exclusive))) + (cond + ((or (eq org-attach-preferred-new-method 'id) (eq answer ?1)) + (setq attach-dir (org-attach-dir-from-id (org-id-get nil t)))) + ((or (eq org-attach-preferred-new-method 'dir) (eq answer ?2)) + (setq attach-dir (org-attach-set-directory))) + ((eq org-attach-preferred-new-method 'nil) + (error "No existing directory. DIR or ID property has to be explicitly created"))))) + (unless attach-dir + (error "No attachment directory is associated with the current node")) + (unless (file-directory-p attach-dir) + (make-directory attach-dir t)) + attach-dir)) + +(defun org-attach-dir-from-id (id &optional try-all) + "Return a folder path based on `org-attach-id-dir' and ID. +If TRY-ALL is non-nil, try all id-to-path functions in +`org-attach-id-to-path-function-list' and return the first path +that exist in the filesystem, or the first one if none exist. +Otherwise only use the first function in that list." + (let ((attach-dir-preferred (expand-file-name + (funcall (car org-attach-id-to-path-function-list) id) + (expand-file-name org-attach-id-dir)))) + (if try-all + (let ((attach-dir attach-dir-preferred) + (fun-list (cdr org-attach-id-to-path-function-list))) + (while (and fun-list (not (file-directory-p attach-dir))) + (setq attach-dir (expand-file-name + (funcall (car fun-list) id) + (expand-file-name org-attach-id-dir))) + (setq fun-list (cdr fun-list))) + (if (file-directory-p attach-dir) + attach-dir + attach-dir-preferred)) + attach-dir-preferred))) + +(defun org-attach-check-absolute-path (dir) + "Check if we have enough information to root the attachment directory. +When DIR is given, check also if it is already absolute. Otherwise, +assume that it will be relative, and check if `org-attach-id-dir' is +absolute, or if at least the current buffer has a file name. +Throw an error if we cannot root the directory." + (or (and dir (file-name-absolute-p dir)) + (file-name-absolute-p org-attach-id-dir) + (buffer-file-name (buffer-base-buffer)) + (error "Need absolute `org-attach-id-dir' to attach in buffers without filename"))) + +(defun org-attach-set-directory () + "Set the DIR node property and ask to move files there. +The property defines the directory that is used for attachments +of the entry. Creates relative links if `org-attach-dir-relative' +is non-nil. + +Return the directory." + (interactive) + (let ((old (org-attach-dir)) + (new + (let* ((attach-dir (read-directory-name + "Attachment directory: " + (org-entry-get nil "DIR"))) + (current-dir (file-name-directory (or default-directory + buffer-file-name))) + (attach-dir-relative (file-relative-name attach-dir current-dir))) + (org-entry-put nil "DIR" (if org-attach-dir-relative + attach-dir-relative + attach-dir)) + attach-dir))) + (unless (or (string= old new) + (not old)) + (when (yes-or-no-p "Copy over attachments from old directory? ") + (copy-directory old new t t t)) + (when (yes-or-no-p (concat "Delete " old)) + (delete-directory old t))) + new)) + +(defun org-attach-unset-directory () + "Remove DIR node property. +If attachment folder is changed due to removal of DIR-property +ask to move attachments to new location and ask to delete old +attachment-folder. + +Change of attachment-folder due to unset might be if an ID +property is set on the node, or if a separate inherited +DIR-property exists (that is different from the unset one)." + (interactive) + (let ((old (org-attach-dir)) + (new + (progn + (org-entry-delete nil "DIR") + ;; ATTACH-DIR is deprecated and removed from documentation, + ;; but still works. Remove code for it after major nr change. + (org-entry-delete nil "ATTACH_DIR") + (org-attach-dir)))) + (unless (or (string= old new) + (not old)) + (when (and new (yes-or-no-p "Copy over attachments from old directory? ")) + (copy-directory old new t nil t)) + (when (yes-or-no-p (concat "Delete " old)) + (delete-directory old t))))) + +(defun org-attach-tag (&optional off) + "Turn the autotag on or (if OFF is set) off." + (when org-attach-auto-tag + (save-excursion + (org-back-to-heading t) + (org-toggle-tag org-attach-auto-tag (if off 'off 'on))))) + +(defun org-attach-untag () + "Turn the autotag off." + (org-attach-tag 'off)) + +(defun org-attach-url (url) + (interactive "MURL of the file to attach: \n") + (let ((org-attach-method 'url)) + (org-attach-attach url))) + +(defun org-attach-buffer (buffer-name) + "Attach BUFFER-NAME's contents to current outline node. +BUFFER-NAME is a string. Signals a `file-already-exists' error +if it would overwrite an existing filename." + (interactive "bBuffer whose contents should be attached: ") + (let* ((attach-dir (org-attach-dir 'get-create)) + (output (expand-file-name buffer-name attach-dir))) + (when (file-exists-p output) + (signal 'file-already-exists (list "File exists" output))) + (run-hook-with-args 'org-attach-after-change-hook attach-dir) + (org-attach-tag) + (with-temp-file output + (insert-buffer-substring buffer-name)))) + +(defun org-attach-attach (file &optional visit-dir method) + "Move/copy/link FILE into the attachment directory of the current outline node. +If VISIT-DIR is non-nil, visit the directory with dired. +METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from +`org-attach-method'." + (interactive + (list + (read-file-name "File to keep as an attachment: " + (or (progn + (require 'dired-aux) + (dired-dwim-target-directory)) + default-directory)) + current-prefix-arg + nil)) + (setq method (or method org-attach-method)) + (let ((basename (file-name-nondirectory file))) + (let* ((attach-dir (org-attach-dir 'get-create)) + (attach-file (expand-file-name basename attach-dir))) + (cond + ((eq method 'mv) (rename-file file attach-file)) + ((eq method 'cp) (copy-file file attach-file)) + ((eq method 'ln) (add-name-to-file file attach-file)) + ((eq method 'lns) (make-symbolic-link file attach-file)) + ((eq method 'url) (url-copy-file file attach-file))) + (run-hook-with-args 'org-attach-after-change-hook attach-dir) + (org-attach-tag) + (cond ((eq org-attach-store-link-p 'attached) + (push (list (concat "attachment:" (file-name-nondirectory attach-file)) + (file-name-nondirectory attach-file)) + org-stored-links)) + ((eq org-attach-store-link-p t) + (push (list (concat "file:" file) + (file-name-nondirectory file)) + org-stored-links)) + ((eq org-attach-store-link-p 'file) + (push (list (concat "file:" attach-file) + (file-name-nondirectory attach-file)) + org-stored-links))) + (if visit-dir + (dired attach-dir) + (message "File %S is now an attachment" basename))))) + +(defun org-attach-attach-cp () + "Attach a file by copying it." + (interactive) + (let ((org-attach-method 'cp)) (call-interactively 'org-attach-attach))) +(defun org-attach-attach-mv () + "Attach a file by moving (renaming) it." + (interactive) + (let ((org-attach-method 'mv)) (call-interactively 'org-attach-attach))) +(defun org-attach-attach-ln () + "Attach a file by creating a hard link to it. +Beware that this does not work on systems that do not support hard links. +On some systems, this apparently does copy the file instead." + (interactive) + (let ((org-attach-method 'ln)) (call-interactively 'org-attach-attach))) +(defun org-attach-attach-lns () + "Attach a file by creating a symbolic link to it. + +Beware that this does not work on systems that do not support symbolic links. +On some systems, this apparently does copy the file instead." + (interactive) + (let ((org-attach-method 'lns)) (call-interactively 'org-attach-attach))) + +(defun org-attach-new (file) + "Create a new attachment FILE for the current outline node. +The attachment is created as an Emacs buffer." + (interactive "sCreate attachment named: ") + (let ((attach-dir (org-attach-dir 'get-create))) + (org-attach-tag) + (find-file (expand-file-name file attach-dir)) + (message "New attachment %s" file))) + +(defun org-attach-delete-one (&optional file) + "Delete a single attachment." + (interactive) + (let* ((attach-dir (org-attach-dir)) + (files (org-attach-file-list attach-dir)) + (file (or file + (completing-read + "Delete attachment: " + (mapcar (lambda (f) + (list (file-name-nondirectory f))) + files))))) + (setq file (expand-file-name file attach-dir)) + (unless (file-exists-p file) + (error "No such attachment: %s" file)) + (delete-file file) + (run-hook-with-args 'org-attach-after-change-hook attach-dir))) + +(defun org-attach-delete-all (&optional force) + "Delete all attachments from the current outline node. +This actually deletes the entire attachment directory. +A safer way is to open the directory in dired and delete from there. + +With prefix argument FORCE, directory will be recursively deleted +with no prompts." + (interactive "P") + (let ((attach-dir (org-attach-dir))) + (when (and attach-dir + (or force + (yes-or-no-p "Really remove all attachments of this entry? "))) + (delete-directory attach-dir + (or force (yes-or-no-p "Recursive?")) + t) + (message "Attachment directory removed") + (run-hook-with-args 'org-attach-after-change-hook attach-dir) + (org-attach-untag)))) + +(defun org-attach-sync () + "Synchronize the current outline node with its attachments. +Useful after files have been added/removed externally. Option +`org-attach-sync-delete-empty-dir' controls the behavior for +empty attachment directories." + (interactive) + (let ((attach-dir (org-attach-dir))) + (if (not attach-dir) + (org-attach-tag 'off) + (run-hook-with-args 'org-attach-after-change-hook attach-dir) + (let ((files (org-attach-file-list attach-dir))) + (org-attach-tag (not files))) + (when org-attach-sync-delete-empty-dir + (when (and (org-directory-empty-p attach-dir) + (if (eq 'query org-attach-sync-delete-empty-dir) + (yes-or-no-p "Attachment directory is empty. Delete?") + t)) + (delete-directory attach-dir)))))) + +(defun org-attach-file-list (dir) + "Return a list of files in the attachment directory. +This ignores files ending in \"~\"." + (delq nil + (mapcar (lambda (x) (if (string-match "^\\.\\.?\\'" x) nil x)) + (directory-files dir nil "[^~]\\'")))) + +(defun org-attach-reveal () + "Show the attachment directory of the current outline node. +This will attempt to use an external program to show the +directory. Will create an attachment and folder if it doesn't +exist yet. Respects `org-attach-preferred-new-method'." + (interactive) + (org-open-file (org-attach-dir-get-create))) + +(defun org-attach-reveal-in-emacs () + "Show the attachment directory of the current outline node in dired. +Will create an attachment and folder if it doesn't exist yet. +Respects `org-attach-preferred-new-method'." + (interactive) + (dired (org-attach-dir-get-create))) + +(defun org-attach-open (&optional in-emacs) + "Open an attachment of the current outline node. +If there are more than one attachment, you will be prompted for the file name. +This command will open the file using the settings in `org-file-apps' +and in the system-specific variants of this variable. +If IN-EMACS is non-nil, force opening in Emacs." + (interactive "P") + (let ((attach-dir (org-attach-dir))) + (if attach-dir + (let* ((file (pcase (org-attach-file-list attach-dir) + (`(,file) file) + (files (completing-read "Open attachment: " + (mapcar #'list files) nil t)))) + (path (expand-file-name file attach-dir))) + (run-hook-with-args 'org-attach-open-hook path) + (org-open-file path in-emacs)) + (error "No attachment directory exist")))) + +(defun org-attach-open-in-emacs () + "Open attachment, force opening in Emacs. +See `org-attach-open'." + (interactive) + (org-attach-open 'in-emacs)) + +(defun org-attach-expand (file) + "Return the full path to the current entry's attachment file FILE. +Basically, this adds the path to the attachment directory." + (expand-file-name file (org-attach-dir))) + +(defun org-attach-expand-links (_) + "Expand links in current buffer. +It is meant to be added to `org-export-before-parsing-hook'." + (save-excursion + (while (re-search-forward "attachment:" nil t) + (let ((link (org-element-context))) + (when (and (eq 'link (org-element-type link)) + (string-equal "attachment" + (org-element-property :type link))) + (let* ((description (and (org-element-property :contents-begin link) + (buffer-substring-no-properties + (org-element-property :contents-begin link) + (org-element-property :contents-end link)))) + (file (org-element-property :path link)) + (new-link (org-link-make-string + (concat "file:" (org-attach-expand file)) + description))) + (goto-char (org-element-property :end link)) + (skip-chars-backward " \t") + (delete-region (org-element-property :begin link) (point)) + (insert new-link))))))) + +(defun org-attach-follow (file arg) + "Open FILE attachment. +See `org-open-file' for details about ARG." + (org-link-open-as-file (org-attach-expand file) arg)) + +(org-link-set-parameters "attachment" + :follow #'org-attach-follow + :complete #'org-attach-complete-link) + +(defun org-attach-complete-link () + "Advise the user with the available files in the attachment directory." + (let ((attach-dir (org-attach-dir))) + (if attach-dir + (let* ((attached-dir (expand-file-name attach-dir)) + (file (read-file-name "File: " attached-dir)) + (pwd (file-name-as-directory attached-dir)) + (pwd-relative (file-name-as-directory + (abbreviate-file-name attached-dir)))) + (cond + ((string-match (concat "^" (regexp-quote pwd-relative) "\\(.+\\)") file) + (concat "attachment:" (match-string 1 file))) + ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)") + (expand-file-name file)) + (concat "attachment:" (match-string 1 (expand-file-name file)))) + (t (concat "attachment:" file)))) + (error "No attachment directory exist")))) + +(defun org-attach-archive-delete-maybe () + "Maybe delete subtree attachments when archiving. +This function is called by `org-archive-hook'. The option +`org-attach-archive-delete' controls its behavior." + (when org-attach-archive-delete + (org-attach-delete-all (not (eq org-attach-archive-delete 'query))))) + + +;; Attach from dired. + +;; Add the following lines to the config file to get a binding for +;; dired-mode. + +;; (add-hook +;; 'dired-mode-hook +;; (lambda () +;; (define-key dired-mode-map (kbd "C-c C-x a") #'org-attach-dired-to-subtree)))) + +;;;###autoload +(defun org-attach-dired-to-subtree (files) + "Attach FILES marked or current file in dired to subtree in other window. +Takes the method given in `org-attach-method' for the attach action. +Precondition: Point must be in a dired buffer. +Idea taken from `gnus-dired-attach'." + (interactive + (list (dired-get-marked-files))) + (unless (eq major-mode 'dired-mode) + (user-error "This command must be triggered in a dired buffer")) + (let ((start-win (selected-window)) + (other-win + (get-window-with-predicate + (lambda (window) + (with-current-buffer (window-buffer window) + (eq major-mode 'org-mode)))))) + (unless other-win + (user-error + "Can't attach to subtree. No window displaying an Org buffer")) + (select-window other-win) + (dolist (file files) + (org-attach-attach file)) + (select-window start-win) + (when (eq 'mv org-attach-method) + (revert-buffer)))) + + + +(add-hook 'org-archive-hook 'org-attach-archive-delete-maybe) +(add-hook 'org-export-before-parsing-hook 'org-attach-expand-links) + +(provide 'org-attach) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-attach.el ends here diff --git a/elpa/org-9.5.2/org-attach.elc b/elpa/org-9.5.2/org-attach.elc new file mode 100644 index 0000000..7e375cf Binary files /dev/null and b/elpa/org-9.5.2/org-attach.elc differ diff --git a/elpa/org-9.5.2/org-autoloads.el b/elpa/org-9.5.2/org-autoloads.el new file mode 100644 index 0000000..ace0628 --- /dev/null +++ b/elpa/org-9.5.2/org-autoloads.el @@ -0,0 +1,1528 @@ +;;; org-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "ob-C" "ob-C.el" (0 0 0 0)) +;;; Generated autoloads from ob-C.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-C" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-R" "ob-R.el" (0 0 0 0)) +;;; Generated autoloads from ob-R.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-R" '("ob-" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-awk" "ob-awk.el" (0 0 0 0)) +;;; Generated autoloads from ob-awk.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-awk" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-calc" "ob-calc.el" (0 0 0 0)) +;;; Generated autoloads from ob-calc.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-calc" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-clojure" "ob-clojure.el" (0 0 0 0)) +;;; Generated autoloads from ob-clojure.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-clojure" '("ob-clojure-" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-comint" "ob-comint.el" (0 0 0 0)) +;;; Generated autoloads from ob-comint.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-comint" '("org-babel-comint-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ob-core" "ob-core.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ob-core.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-core" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ob-css" "ob-css.el" (0 0 0 0)) +;;; Generated autoloads from ob-css.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-css" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-ditaa" "ob-ditaa.el" (0 0 0 0)) +;;; Generated autoloads from ob-ditaa.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-ditaa" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ob-dot" "ob-dot.el" (0 0 0 0)) +;;; Generated autoloads from ob-dot.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-dot" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-emacs-lisp" "ob-emacs-lisp.el" (0 0 0 0)) +;;; Generated autoloads from ob-emacs-lisp.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-emacs-lisp" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-eshell" "ob-eshell.el" (0 0 0 0)) +;;; Generated autoloads from ob-eshell.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-eshell" '("ob-eshell-session-live-p" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-eval" "ob-eval.el" (0 0 0 0)) +;;; Generated autoloads from ob-eval.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-eval" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-exp" "ob-exp.el" (0 0 0 0)) +;;; Generated autoloads from ob-exp.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-exp" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ob-forth" "ob-forth.el" (0 0 0 0)) +;;; Generated autoloads from ob-forth.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-forth" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-fortran" "ob-fortran.el" (0 0 0 0)) +;;; Generated autoloads from ob-fortran.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-fortran" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-gnuplot" "ob-gnuplot.el" (0 0 0 0)) +;;; Generated autoloads from ob-gnuplot.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-gnuplot" '("*org-babel-gnuplot-" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-groovy" "ob-groovy.el" (0 0 0 0)) +;;; Generated autoloads from ob-groovy.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-groovy" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-haskell" "ob-haskell.el" (0 0 0 0)) +;;; Generated autoloads from ob-haskell.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-haskell" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-java" "ob-java.el" (0 0 0 0)) +;;; Generated autoloads from ob-java.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-java" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-js" "ob-js.el" (0 0 0 0)) +;;; Generated autoloads from ob-js.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-js" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-julia" "ob-julia.el" (0 0 0 0)) +;;; Generated autoloads from ob-julia.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-julia" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-latex" "ob-latex.el" (0 0 0 0)) +;;; Generated autoloads from ob-latex.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-latex" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-lilypond" "ob-lilypond.el" (0 0 0 0)) +;;; Generated autoloads from ob-lilypond.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-lilypond" '("lilypond-mode" "ob-lilypond-header-args" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-lisp" "ob-lisp.el" (0 0 0 0)) +;;; Generated autoloads from ob-lisp.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-lisp" '("org-babel-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ob-lob" "ob-lob.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ob-lob.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-lob" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-lua" "ob-lua.el" (0 0 0 0)) +;;; Generated autoloads from ob-lua.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-lua" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-makefile" "ob-makefile.el" (0 0 0 0)) +;;; Generated autoloads from ob-makefile.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-makefile" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-maxima" "ob-maxima.el" (0 0 0 0)) +;;; Generated autoloads from ob-maxima.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-maxima" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-ocaml" "ob-ocaml.el" (0 0 0 0)) +;;; Generated autoloads from ob-ocaml.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-ocaml" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-octave" "ob-octave.el" (0 0 0 0)) +;;; Generated autoloads from ob-octave.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-octave" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-org" "ob-org.el" (0 0 0 0)) +;;; Generated autoloads from ob-org.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-org" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-perl" "ob-perl.el" (0 0 0 0)) +;;; Generated autoloads from ob-perl.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-perl" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-plantuml" "ob-plantuml.el" (0 0 0 0)) +;;; Generated autoloads from ob-plantuml.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-plantuml" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ob-processing" "ob-processing.el" (0 0 0 0)) +;;; Generated autoloads from ob-processing.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-processing" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-python" "ob-python.el" (0 0 0 0)) +;;; Generated autoloads from ob-python.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-python" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-ref" "ob-ref.el" (0 0 0 0)) +;;; Generated autoloads from ob-ref.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-ref" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-ruby" "ob-ruby.el" (0 0 0 0)) +;;; Generated autoloads from ob-ruby.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-ruby" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-sass" "ob-sass.el" (0 0 0 0)) +;;; Generated autoloads from ob-sass.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sass" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-scheme" "ob-scheme.el" (0 0 0 0)) +;;; Generated autoloads from ob-scheme.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-scheme" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-screen" "ob-screen.el" (0 0 0 0)) +;;; Generated autoloads from ob-screen.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-screen" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-sed" "ob-sed.el" (0 0 0 0)) +;;; Generated autoloads from ob-sed.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sed" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-shell" "ob-shell.el" (0 0 0 0)) +;;; Generated autoloads from ob-shell.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-shell" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-sql" "ob-sql.el" (0 0 0 0)) +;;; Generated autoloads from ob-sql.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sql" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-sqlite" "ob-sqlite.el" (0 0 0 0)) +;;; Generated autoloads from ob-sqlite.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sqlite" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-table" "ob-table.el" (0 0 0 0)) +;;; Generated autoloads from ob-table.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-table" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ob-tangle" "ob-tangle.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ob-tangle.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-tangle" '("org-"))) + +;;;*** + +;;;### (autoloads nil "oc" "oc.el" (0 0 0 0)) +;;; Generated autoloads from oc.el + +(autoload 'org-cite-insert "oc" "\ +Insert a citation at point. +Insertion is done according to the processor set in `org-cite-insert-processor'. +ARG is the prefix argument received when calling interactively the function. + +\(fn ARG)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "oc" '("org-cite-"))) + +;;;*** + +;;;### (autoloads nil "oc-basic" "oc-basic.el" (0 0 0 0)) +;;; Generated autoloads from oc-basic.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "oc-basic" '("org-cite-basic-"))) + +;;;*** + +;;;### (autoloads nil "oc-biblatex" "oc-biblatex.el" (0 0 0 0)) +;;; Generated autoloads from oc-biblatex.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "oc-biblatex" '("org-cite-biblatex-"))) + +;;;*** + +;;;### (autoloads nil "oc-csl" "oc-csl.el" (0 0 0 0)) +;;; Generated autoloads from oc-csl.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "oc-csl" '("org-cite-csl-"))) + +;;;*** + +;;;### (autoloads nil "oc-natbib" "oc-natbib.el" (0 0 0 0)) +;;; Generated autoloads from oc-natbib.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "oc-natbib" '("org-cite-natbib-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ol" "ol.el" (0 +;;;;;; 0 0 0)) +;;; Generated autoloads from ol.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ol-bbdb" "ol-bbdb.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ol-bbdb.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-bbdb" '("org-bbdb-"))) + +;;;*** + +;;;### (autoloads nil "ol-bibtex" "ol-bibtex.el" (0 0 0 0)) +;;; Generated autoloads from ol-bibtex.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-bibtex" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ol-docview" "ol-docview.el" (0 0 0 0)) +;;; Generated autoloads from ol-docview.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-docview" '("org-docview-"))) + +;;;*** + +;;;### (autoloads nil "ol-doi" "ol-doi.el" (0 0 0 0)) +;;; Generated autoloads from ol-doi.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-doi" '("org-link-doi-"))) + +;;;*** + +;;;### (autoloads nil "ol-eshell" "ol-eshell.el" (0 0 0 0)) +;;; Generated autoloads from ol-eshell.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-eshell" '("org-eshell-"))) + +;;;*** + +;;;### (autoloads nil "ol-eww" "ol-eww.el" (0 0 0 0)) +;;; Generated autoloads from ol-eww.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-eww" '("org-eww-"))) + +;;;*** + +;;;### (autoloads nil "ol-gnus" "ol-gnus.el" (0 0 0 0)) +;;; Generated autoloads from ol-gnus.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-gnus" '("org-gnus-"))) + +;;;*** + +;;;### (autoloads nil "ol-info" "ol-info.el" (0 0 0 0)) +;;; Generated autoloads from ol-info.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-info" '("org-info-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ol-irc" "ol-irc.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ol-irc.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-irc" '("org-irc-"))) + +;;;*** + +;;;### (autoloads nil "ol-man" "ol-man.el" (0 0 0 0)) +;;; Generated autoloads from ol-man.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-man" '("org-man-"))) + +;;;*** + +;;;### (autoloads nil "ol-mhe" "ol-mhe.el" (0 0 0 0)) +;;; Generated autoloads from ol-mhe.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-mhe" '("org-mhe-"))) + +;;;*** + +;;;### (autoloads nil "ol-rmail" "ol-rmail.el" (0 0 0 0)) +;;; Generated autoloads from ol-rmail.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-rmail" '("org-rmail-"))) + +;;;*** + +;;;### (autoloads nil "ol-w3m" "ol-w3m.el" (0 0 0 0)) +;;; Generated autoloads from ol-w3m.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-w3m" '("org-w3m-"))) + +;;;*** + +;;;### (autoloads nil "org" "org.el" (0 0 0 0)) +;;; Generated autoloads from org.el + +(autoload 'org-babel-do-load-languages "org" "\ +Load the languages defined in `org-babel-load-languages'. + +\(fn SYM VALUE)" nil nil) + +(autoload 'org-babel-load-file "org" "\ +Load Emacs Lisp source code blocks in the Org FILE. +This function exports the source code using `org-babel-tangle' +and then loads the resulting file using `load-file'. With +optional prefix argument COMPILE, the tangled Emacs Lisp file is +byte-compiled before it is loaded. + +\(fn FILE &optional COMPILE)" t nil) + +(autoload 'org-version "org" "\ +Show the Org version. +Interactively, or when MESSAGE is non-nil, show it in echo area. +With prefix argument, or when HERE is non-nil, insert it at point. +In non-interactive uses, a reduced version string is output unless +FULL is given. + +\(fn &optional HERE FULL MESSAGE)" t nil) + +(autoload 'org-load-modules-maybe "org" "\ +Load all extensions listed in `org-modules'. + +\(fn &optional FORCE)" nil nil) + +(autoload 'org-clock-persistence-insinuate "org" "\ +Set up hooks for clock persistence." nil nil) + +(autoload 'org-mode "org" "\ +Outline-based notes management and organizer, alias +\"Carsten's outline-mode for keeping track of everything.\" + +Org mode develops organizational tasks around a NOTES file which +contains information about projects as plain text. Org mode is +implemented on top of Outline mode, which is ideal to keep the content +of large files well structured. It supports ToDo items, deadlines and +time stamps, which magically appear in the diary listing of the Emacs +calendar. Tables are easily created with a built-in table editor. +Plain text URL-like links connect to websites, emails (VM), Usenet +messages (Gnus), BBDB entries, and any files related to the project. +For printing and sharing of notes, an Org file (or a part of it) +can be exported as a structured ASCII or HTML file. + +The following commands are available: + +\\{org-mode-map} + +\(fn)" t nil) + +(autoload 'org-cycle "org" "\ +TAB-action and visibility cycling for Org mode. + +This is the command invoked in Org mode by the `TAB' key. Its main +purpose is outline visibility cycling, but it also invokes other actions +in special contexts. + +When this function is called with a `\\[universal-argument]' prefix, rotate the entire +buffer through 3 states (global cycling) + 1. OVERVIEW: Show only top-level headlines. + 2. CONTENTS: Show all headlines of all levels, but no body text. + 3. SHOW ALL: Show everything. + +With a `\\[universal-argument] \\[universal-argument]' prefix argument, switch to the startup visibility, +determined by the variable `org-startup-folded', and by any VISIBILITY +properties in the buffer. + +With a `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix argument, show the entire buffer, including +any drawers. + +When inside a table, re-align the table and move to the next field. + +When point is at the beginning of a headline, rotate the subtree started +by this line through 3 different states (local cycling) + 1. FOLDED: Only the main headline is shown. + 2. CHILDREN: The main headline and the direct children are shown. + From this state, you can move to one of the children + and zoom in further. + 3. SUBTREE: Show the entire subtree, including body text. +If there is no subtree, switch directly from CHILDREN to FOLDED. + +When point is at the beginning of an empty headline and the variable +`org-cycle-level-after-item/entry-creation' is set, cycle the level +of the headline by demoting and promoting it to likely levels. This +speeds up creation document structure by pressing `TAB' once or several +times right after creating a new headline. + +When there is a numeric prefix, go up to a heading with level ARG, do +a `show-subtree' and return to the previous cursor position. If ARG +is negative, go up that many levels. + +When point is not at the beginning of a headline, execute the global +binding for `TAB', which is re-indenting the line. See the option +`org-cycle-emulate-tab' for details. + +As a special case, if point is at the very beginning of the buffer, if +there is no headline there, and if the variable `org-cycle-global-at-bob' +is non-nil, this function acts as if called with prefix argument (`\\[universal-argument] TAB', +same as `S-TAB') also when called without prefix argument. + +\(fn &optional ARG)" t nil) + +(autoload 'org-global-cycle "org" "\ +Cycle the global visibility. For details see `org-cycle'. +With `\\[universal-argument]' prefix ARG, switch to startup visibility. +With a numeric prefix, show all headlines up to that level. + +\(fn &optional ARG)" t nil) + +(autoload 'org-run-like-in-org-mode "org" "\ +Run a command, pretending that the current buffer is in Org mode. +This will temporarily bind local variables that are typically bound in +Org mode to the values they have in Org mode, and then interactively +call CMD. + +\(fn CMD)" nil nil) + +(autoload 'org-open-file "org" "\ +Open the file at PATH. +First, this expands any special file name abbreviations. Then the +configuration variable `org-file-apps' is checked if it contains an +entry for this file type, and if yes, the corresponding command is launched. + +If no application is found, Emacs simply visits the file. + +With optional prefix argument IN-EMACS, Emacs will visit the file. +With a double \\[universal-argument] \\[universal-argument] prefix arg, Org tries to avoid opening in Emacs +and to use an external application to visit the file. + +Optional LINE specifies a line to go to, optional SEARCH a string +to search for. If LINE or SEARCH is given, the file will be +opened in Emacs, unless an entry from `org-file-apps' that makes +use of groups in a regexp matches. + +If you want to change the way frames are used when following a +link, please customize `org-link-frame-setup'. + +If the file does not exist, throw an error. + +\(fn PATH &optional IN-EMACS LINE SEARCH)" nil nil) + +(autoload 'org-open-at-point-global "org" "\ +Follow a link or a time-stamp like Org mode does. +Also follow links and emails as seen by `thing-at-point'. +This command can be called in any mode to follow an external +link or a time-stamp that has Org mode syntax. Its behavior +is undefined when called on internal links like fuzzy links. +Raise a user error when there is nothing to follow." t nil) + +(autoload 'org-offer-links-in-entry "org" "\ +Offer links in the current entry and return the selected link. +If there is only one link, return it. +If NTH is an integer, return the NTH link found. +If ZERO is a string, check also this string for a link, and if +there is one, return it. + +\(fn BUFFER MARKER &optional NTH ZERO)" nil nil) + +(autoload 'org-switchb "org" "\ +Switch between Org buffers. + +With `\\[universal-argument]' prefix, restrict available buffers to files. + +With `\\[universal-argument] \\[universal-argument]' prefix, restrict available buffers to agenda files. + +\(fn &optional ARG)" t nil) + +(autoload 'org-cycle-agenda-files "org" "\ +Cycle through the files in `org-agenda-files'. +If the current buffer visits an agenda file, find the next one in the list. +If the current buffer does not, find the first agenda file." t nil) + +(autoload 'org-submit-bug-report "org" "\ +Submit a bug report on Org via mail. + +Don't hesitate to report any problems or inaccurate documentation. + +If you don't have setup sending mail from (X)Emacs, please copy the +output buffer into your mail program, as it gives us important +information about your Org version and configuration." t nil) + +(autoload 'org-reload "org" "\ +Reload all Org Lisp files. +With prefix arg UNCOMPILED, load the uncompiled versions. + +\(fn &optional UNCOMPILED)" t nil) + +(autoload 'org-customize "org" "\ +Call the customize function with org as argument." t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org" '("org-" "turn-on-org-cdlatex"))) + +;;;*** + +;;;### (autoloads nil "org-agenda" "org-agenda.el" (0 0 0 0)) +;;; Generated autoloads from org-agenda.el + +(autoload 'org-toggle-sticky-agenda "org-agenda" "\ +Toggle `org-agenda-sticky'. + +\(fn &optional ARG)" t nil) + +(autoload 'org-agenda "org-agenda" "\ +Dispatch agenda commands to collect entries to the agenda buffer. +Prompts for a command to execute. Any prefix arg will be passed +on to the selected command. The default selections are: + +a Call `org-agenda-list' to display the agenda for current day or week. +t Call `org-todo-list' to display the global todo list. +T Call `org-todo-list' to display the global todo list, select only + entries with a specific TODO keyword (the user gets a prompt). +m Call `org-tags-view' to display headlines with tags matching + a condition (the user is prompted for the condition). +M Like `m', but select only TODO entries, no ordinary headlines. +e Export views to associated files. +s Search entries for keywords. +S Search entries for keywords, only with TODO keywords. +/ Multi occur across all agenda files and also files listed + in `org-agenda-text-search-extra-files'. +< Restrict agenda commands to buffer, subtree, or region. + Press several times to get the desired effect. +> Remove a previous restriction. +# List \"stuck\" projects. +! Configure what \"stuck\" means. +C Configure custom agenda commands. + +More commands can be added by configuring the variable +`org-agenda-custom-commands'. In particular, specific tags and TODO keyword +searches can be pre-defined in this way. + +If the current buffer is in Org mode and visiting a file, you can also +first press `<' once to indicate that the agenda should be temporarily +\(until the next use of `\\[org-agenda]') restricted to the current file. +Pressing `<' twice means to restrict to the current subtree or region +\(if active). + +\(fn &optional ARG KEYS RESTRICTION)" t nil) + +(autoload 'org-batch-agenda "org-agenda" "\ +Run an agenda command in batch mode and send the result to STDOUT. +If CMD-KEY is a string of length 1, it is used as a key in +`org-agenda-custom-commands' and triggers this command. If it is a +longer string it is used as a tags/todo match string. +Parameters are alternating variable names and values that will be bound +before running the agenda command. + +\(fn CMD-KEY &rest PARAMETERS)" nil t) + +(autoload 'org-batch-agenda-csv "org-agenda" "\ +Run an agenda command in batch mode and send the result to STDOUT. +If CMD-KEY is a string of length 1, it is used as a key in +`org-agenda-custom-commands' and triggers this command. If it is a +longer string it is used as a tags/todo match string. +Parameters are alternating variable names and values that will be bound +before running the agenda command. + +The output gives a line for each selected agenda item. Each +item is a list of comma-separated values, like this: + +category,head,type,todo,tags,date,time,extra,priority-l,priority-n + +category The category of the item +head The headline, without TODO kwd, TAGS and PRIORITY +type The type of the agenda entry, can be + todo selected in TODO match + tagsmatch selected in tags match + diary imported from diary + deadline a deadline on given date + scheduled scheduled on given date + timestamp entry has timestamp on given date + closed entry was closed on given date + upcoming-deadline warning about deadline + past-scheduled forwarded scheduled item + block entry has date block including g. date +todo The todo keyword, if any +tags All tags including inherited ones, separated by colons +date The relevant date, like 2007-2-14 +time The time, like 15:00-16:50 +extra String with extra planning info +priority-l The priority letter if any was given +priority-n The computed numerical priority +agenda-day The day in the agenda where this is listed + +\(fn CMD-KEY &rest PARAMETERS)" nil t) + +(autoload 'org-store-agenda-views "org-agenda" "\ +Store agenda views. + +\(fn &rest PARAMETERS)" t nil) + +(autoload 'org-batch-store-agenda-views "org-agenda" "\ +Run all custom agenda commands that have a file argument. + +\(fn &rest PARAMETERS)" nil t) + +(autoload 'org-agenda-list "org-agenda" "\ +Produce a daily/weekly view from all files in variable `org-agenda-files'. +The view will be for the current day or week, but from the overview buffer +you will be able to go to other days/weeks. + +With a numeric prefix argument in an interactive call, the agenda will +span ARG days. Lisp programs should instead specify SPAN to change +the number of days. SPAN defaults to `org-agenda-span'. + +START-DAY defaults to TODAY, or to the most recent match for the weekday +given in `org-agenda-start-on-weekday'. + +When WITH-HOUR is non-nil, only include scheduled and deadline +items if they have an hour specification like [h]h:mm. + +\(fn &optional ARG START-DAY SPAN WITH-HOUR)" t nil) + +(autoload 'org-search-view "org-agenda" "\ +Show all entries that contain a phrase or words or regular expressions. + +With optional prefix argument TODO-ONLY, only consider entries that are +TODO entries. The argument STRING can be used to pass a default search +string into this function. If EDIT-AT is non-nil, it means that the +user should get a chance to edit this string, with cursor at position +EDIT-AT. + +The search string can be viewed either as a phrase that should be found as +is, or it can be broken into a number of snippets, each of which must match +in a Boolean way to select an entry. The default depends on the variable +`org-agenda-search-view-always-boolean'. +Even if this is turned off (the default) you can always switch to +Boolean search dynamically by preceding the first word with \"+\" or \"-\". + +The default is a direct search of the whole phrase, where each space in +the search string can expand to an arbitrary amount of whitespace, +including newlines. + +If using a Boolean search, the search string is split on whitespace and +each snippet is searched separately, with logical AND to select an entry. +Words prefixed with a minus must *not* occur in the entry. Words without +a prefix or prefixed with a plus must occur in the entry. Matching is +case-insensitive. Words are enclosed by word delimiters (i.e. they must +match whole words, not parts of a word) if +`org-agenda-search-view-force-full-words' is set (default is nil). + +Boolean search snippets enclosed by curly braces are interpreted as +regular expressions that must or (when preceded with \"-\") must not +match in the entry. Snippets enclosed into double quotes will be taken +as a whole, to include whitespace. + +- If the search string starts with an asterisk, search only in headlines. +- If (possibly after the leading star) the search string starts with an + exclamation mark, this also means to look at TODO entries only, an effect + that can also be achieved with a prefix argument. +- If (possibly after star and exclamation mark) the search string starts + with a colon, this will mean that the (non-regexp) snippets of the + Boolean search must match as full words. + +This command searches the agenda files, and in addition the files +listed in `org-agenda-text-search-extra-files' unless a restriction lock +is active. + +\(fn &optional TODO-ONLY STRING EDIT-AT)" t nil) + +(autoload 'org-todo-list "org-agenda" "\ +Show all (not done) TODO entries from all agenda file in a single list. +The prefix arg can be used to select a specific TODO keyword and limit +the list to these. When using `\\[universal-argument]', you will be prompted +for a keyword. A numeric prefix directly selects the Nth keyword in +`org-todo-keywords-1'. + +\(fn &optional ARG)" t nil) + +(autoload 'org-tags-view "org-agenda" "\ +Show all headlines for all `org-agenda-files' matching a TAGS criterion. +The prefix arg TODO-ONLY limits the search to TODO entries. + +\(fn &optional TODO-ONLY MATCH)" t nil) + +(autoload 'org-agenda-list-stuck-projects "org-agenda" "\ +Create agenda view for projects that are stuck. +Stuck projects are project that have no next actions. For the definitions +of what a project is and how to check if it stuck, customize the variable +`org-stuck-projects'. + +\(fn &rest IGNORE)" t nil) + +(autoload 'org-diary "org-agenda" "\ +Return diary information from org files. +This function can be used in a \"sexp\" diary entry in the Emacs calendar. +It accesses org files and extracts information from those files to be +listed in the diary. The function accepts arguments specifying what +items should be listed. For a list of arguments allowed here, see the +variable `org-agenda-entry-types'. + +The call in the diary file should look like this: + + &%%(org-diary) ~/path/to/some/orgfile.org + +Use a separate line for each org file to check. Or, if you omit the file name, +all files listed in `org-agenda-files' will be checked automatically: + + &%%(org-diary) + +If you don't give any arguments (as in the example above), the default value +of `org-agenda-entry-types' is used: (:deadline :scheduled :timestamp :sexp). +So the example above may also be written as + + &%%(org-diary :deadline :timestamp :sexp :scheduled) + +The function expects the lisp variables `entry' and `date' to be provided +by the caller, because this is how the calendar works. Don't use this +function from a program - use `org-agenda-get-day-entries' instead. + +\(fn &rest ARGS)" nil nil) + +(autoload 'org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item "org-agenda" "\ +Do we have a reason to ignore this TODO entry because it has a time stamp? + +\(fn &optional END)" nil nil) + +(autoload 'org-agenda-set-restriction-lock "org-agenda" "\ +Set restriction lock for agenda to current subtree or file. +When in a restricted subtree, remove it. + +The restriction will span over the entire file if TYPE is `file', +or if type is '(4), or if the cursor is before the first headline +in the file. Otherwise, only apply the restriction to the current +subtree. + +\(fn &optional TYPE)" t nil) + +(autoload 'org-calendar-goto-agenda "org-agenda" "\ +Compute the Org agenda for the calendar date displayed at the cursor. +This is a command that has to be installed in `calendar-mode-map'." t nil) + +(autoload 'org-agenda-to-appt "org-agenda" "\ +Activate appointments found in `org-agenda-files'. + +With a `\\[universal-argument]' prefix, refresh the list of appointments. + +If FILTER is t, interactively prompt the user for a regular +expression, and filter out entries that don't match it. + +If FILTER is a string, use this string as a regular expression +for filtering entries out. + +If FILTER is a function, filter out entries against which +calling the function returns nil. This function takes one +argument: an entry from `org-agenda-get-day-entries'. + +FILTER can also be an alist with the car of each cell being +either `headline' or `category'. For example: + + \\='((headline \"IMPORTANT\") + (category \"Work\")) + +will only add headlines containing IMPORTANT or headlines +belonging to the \"Work\" category. + +ARGS are symbols indicating what kind of entries to consider. +By default `org-agenda-to-appt' will use :deadline*, :scheduled* +\(i.e., deadlines and scheduled items with a hh:mm specification) +and :timestamp entries. See the docstring of `org-diary' for +details and examples. + +If an entry has a APPT_WARNTIME property, its value will be used +to override `appt-message-warning-time'. + +\(fn &optional REFRESH FILTER &rest ARGS)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-agenda" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-archive" +;;;;;; "org-archive.el" (0 0 0 0)) +;;; Generated autoloads from org-archive.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-archive" '("org-a"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-attach" "org-attach.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-attach.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-attach" '("org-attach-"))) + +;;;*** + +;;;### (autoloads nil "org-attach-git" "org-attach-git.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from org-attach-git.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-attach-git" '("org-attach-git-"))) + +;;;*** + +;;;### (autoloads nil "org-capture" "org-capture.el" (0 0 0 0)) +;;; Generated autoloads from org-capture.el + +(autoload 'org-capture-string "org-capture" "\ +Capture STRING with the template selected by KEYS. + +\(fn STRING &optional KEYS)" t nil) + +(autoload 'org-capture "org-capture" "\ +Capture something. +\\ +This will let you select a template from `org-capture-templates', and +then file the newly captured information. The text is immediately +inserted at the target location, and an indirect buffer is shown where +you can edit it. Pressing `\\[org-capture-finalize]' brings you back to the previous +state of Emacs, so that you can continue your work. + +When called interactively with a `\\[universal-argument]' prefix argument GOTO, don't +capture anything, just go to the file/headline where the selected +template stores its notes. + +With a `\\[universal-argument] \\[universal-argument]' prefix argument, go to the last note stored. + +When called with a `C-0' (zero) prefix, insert a template at point. + +When called with a `C-1' (one) prefix, force prompting for a date when +a datetree entry is made. + +ELisp programs can set KEYS to a string associated with a template +in `org-capture-templates'. In this case, interactive selection +will be bypassed. + +If `org-capture-use-agenda-date' is non-nil, capturing from the +agenda will use the date at point as the default date. Then, a +`C-1' prefix will tell the capture process to use the HH:MM time +of the day at point (if any) or the current HH:MM time. + +\(fn &optional GOTO KEYS)" t nil) + +(autoload 'org-capture-import-remember-templates "org-capture" "\ +Set `org-capture-templates' to be similar to `org-remember-templates'." t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-capture" '("org-capture-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-clock" "org-clock.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-clock.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-clock" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-colview" +;;;;;; "org-colview.el" (0 0 0 0)) +;;; Generated autoloads from org-colview.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-colview" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-compat" "org-compat.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-compat.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-compat" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-crypt" "org-crypt.el" (0 0 0 0)) +;;; Generated autoloads from org-crypt.el + +(autoload 'org-encrypt-entry "org-crypt" "\ +Encrypt the content of the current headline." t nil) + +(autoload 'org-decrypt-entry "org-crypt" "\ +Decrypt the content of the current headline." t nil) + +(autoload 'org-encrypt-entries "org-crypt" "\ +Encrypt all top-level entries in the current buffer." t nil) + +(autoload 'org-decrypt-entries "org-crypt" "\ +Decrypt all entries in the current buffer." t nil) + +(autoload 'org-crypt-use-before-save-magic "org-crypt" "\ +Add a hook to automatically encrypt entries before a file is saved to disk." nil nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-crypt" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-ctags" "org-ctags.el" (0 0 0 0)) +;;; Generated autoloads from org-ctags.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-ctags" '("org-ctags-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-datetree" +;;;;;; "org-datetree.el" (0 0 0 0)) +;;; Generated autoloads from org-datetree.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-datetree" '("org-datetree-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-duration" +;;;;;; "org-duration.el" (0 0 0 0)) +;;; Generated autoloads from org-duration.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-duration" '("org-duration-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-element" +;;;;;; "org-element.el" (0 0 0 0)) +;;; Generated autoloads from org-element.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-element" '("org-element-"))) + +;;;*** + +;;;### (autoloads nil "org-entities" "org-entities.el" (0 0 0 0)) +;;; Generated autoloads from org-entities.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-entities" '("org-entit"))) + +;;;*** + +;;;### (autoloads nil "org-faces" "org-faces.el" (0 0 0 0)) +;;; Generated autoloads from org-faces.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-faces" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-feed" "org-feed.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-feed.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-feed" '("org-feed-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-footnote" +;;;;;; "org-footnote.el" (0 0 0 0)) +;;; Generated autoloads from org-footnote.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-footnote" '("org-footnote-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-goto" "org-goto.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-goto.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-goto" '("org-goto-"))) + +;;;*** + +;;;### (autoloads nil "org-habit" "org-habit.el" (0 0 0 0)) +;;; Generated autoloads from org-habit.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-habit" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-id" "org-id.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-id.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-id" '("org-id-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-indent" "org-indent.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-indent.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-indent" '("org-indent-"))) + +;;;*** + +;;;### (autoloads nil "org-inlinetask" "org-inlinetask.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from org-inlinetask.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-inlinetask" '("org-inlinetask-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-keys" "org-keys.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-keys.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-keys" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-lint" "org-lint.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-lint.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-lint" '("org-lint-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-list" "org-list.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-list.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-list" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-macro" "org-macro.el" (0 0 0 0)) +;;; Generated autoloads from org-macro.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-macro" '("org-macro-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-macs" "org-macs.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-macs.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-macs" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-mobile" "org-mobile.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-mobile.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-mobile" '("org-mobile-"))) + +;;;*** + +;;;### (autoloads nil "org-mouse" "org-mouse.el" (0 0 0 0)) +;;; Generated autoloads from org-mouse.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-mouse" '("org-mouse-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-num" "org-num.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-num.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-num" '("org-num-"))) + +;;;*** + +;;;### (autoloads nil "org-pcomplete" "org-pcomplete.el" (0 0 0 0)) +;;; Generated autoloads from org-pcomplete.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-pcomplete" '("org-" "pcomplete/org-mode/"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-plot" "org-plot.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-plot.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-plot" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-protocol" "org-protocol.el" (0 0 0 0)) +;;; Generated autoloads from org-protocol.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-protocol" '("org-protocol-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-refile" "org-refile.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-refile.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-refile" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-src" "org-src.el" (0 0 0 0)) +;;; Generated autoloads from org-src.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-src" '("org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-table" "org-table.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-table.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-table" '("org"))) + +;;;*** + +;;;### (autoloads nil "org-tempo" "org-tempo.el" (0 0 0 0)) +;;; Generated autoloads from org-tempo.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-tempo" '("org-tempo-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "org-timer" "org-timer.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-timer.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-timer" '("org-timer-"))) + +;;;*** + +;;;### (autoloads nil "org-version" "org-version.el" (0 0 0 0)) +;;; Generated autoloads from org-version.el + +(autoload 'org-release "org-version" "\ +The release version of Org. +Inserted by installing Org mode or when a release is made." nil nil) + +(autoload 'org-git-version "org-version" "\ +The Git version of Org mode. +Inserted by installing Org or when a release is made." nil nil) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox" "ox.el" (0 +;;;;;; 0 0 0)) +;;; Generated autoloads from ox.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox" '("org-export-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-ascii" "ox-ascii.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ox-ascii.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-ascii" '("org-ascii-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-beamer" "ox-beamer.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ox-beamer.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-beamer" '("org-beamer-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-html" "ox-html.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ox-html.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-html" '("org-html-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-icalendar" +;;;;;; "ox-icalendar.el" (0 0 0 0)) +;;; Generated autoloads from ox-icalendar.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-icalendar" '("org-icalendar-"))) + +;;;*** + +;;;### (autoloads nil "ox-koma-letter" "ox-koma-letter.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from ox-koma-letter.el + +(autoload 'org-koma-letter-export-as-latex "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org KOMA-LETTER Export*\". It +will be displayed if `org-export-show-temporary-export-buffer' is +non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-koma-letter-export-to-latex "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter (tex). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +When optional argument PUB-DIR is set, use it as the publishing +directory. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-koma-letter-export-to-pdf "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter (pdf). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return PDF file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-koma-letter" '("org-koma-letter-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-latex" "ox-latex.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ox-latex.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-latex" '("org-latex-"))) + +;;;*** + +;;;### (autoloads nil "ox-man" "ox-man.el" (0 0 0 0)) +;;; Generated autoloads from ox-man.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-man" '("org-man-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-md" "ox-md.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ox-md.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-md" '("org-md-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-odt" "ox-odt.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ox-odt.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-odt" '("org-odt-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-org" "ox-org.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ox-org.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-org" '("org-org-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-publish" "ox-publish.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ox-publish.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-publish" '("org-publish-"))) + +;;;*** + +;;;### (autoloads "actual autoloads are elsewhere" "ox-texinfo" "ox-texinfo.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from ox-texinfo.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-texinfo" '("org-texinfo-"))) + +;;;*** + +;;;### (autoloads nil nil ("ob-core.el" "ob-lob.el" "ob-matlab.el" +;;;;;; "ob-tangle.el" "ob.el" "ol-bbdb.el" "ol-irc.el" "ol.el" "org-archive.el" +;;;;;; "org-attach.el" "org-clock.el" "org-colview.el" "org-compat.el" +;;;;;; "org-datetree.el" "org-duration.el" "org-element.el" "org-feed.el" +;;;;;; "org-footnote.el" "org-goto.el" "org-id.el" "org-indent.el" +;;;;;; "org-keys.el" "org-lint.el" "org-list.el" "org-loaddefs.el" +;;;;;; "org-macs.el" "org-mobile.el" "org-num.el" "org-pkg.el" "org-plot.el" +;;;;;; "org-refile.el" "org-table.el" "org-timer.el" "ox-ascii.el" +;;;;;; "ox-beamer.el" "ox-html.el" "ox-icalendar.el" "ox-latex.el" +;;;;;; "ox-md.el" "ox-odt.el" "ox-org.el" "ox-publish.el" "ox-texinfo.el" +;;;;;; "ox.el") (0 0 0 0)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; org-autoloads.el ends here diff --git a/elpa/org-9.5.2/org-capture.el b/elpa/org-9.5.2/org-capture.el new file mode 100644 index 0000000..a9350c5 --- /dev/null +++ b/elpa/org-9.5.2/org-capture.el @@ -0,0 +1,1965 @@ +;;; org-capture.el --- Fast note taking in Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2010-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains an alternative implementation of the functionality +;; that used to be provided by org-remember.el. The implementation is more +;; streamlined, can produce more target types (e.g. plain list items or +;; table lines). Also, it does not use a temporary buffer for editing +;; the captured entry - instead it uses an indirect buffer that visits +;; the new entry already in the target buffer (this was an idea by Samuel +;; Wales). John Wiegley's excellent `remember.el' is not needed anymore +;; for this implementation, even though we borrow heavily from its ideas. + +;; This implementation heavily draws on ideas by James TD Smith and +;; Samuel Wales, and, of cause, uses John Wiegley's remember.el as inspiration. + +;;; TODO + +;; - find a clever way to not always insert an annotation maybe a +;; predicate function that can check for conditions for %a to be +;; used. This could be one of the properties. + +;; - Should there be plist members that arrange for properties to be +;; asked for, like James proposed in his RFC? + +;;; Code: + +(require 'cl-lib) +(require 'org) +(require 'org-refile) + +(declare-function org-at-encrypted-entry-p "org-crypt" ()) +(declare-function org-at-table-p "org-table" (&optional table-type)) +(declare-function org-clock-update-mode-line "org-clock" (&optional refresh)) +(declare-function org-datetree-find-date-create "org-datetree" (date &optional keep-restriction)) +(declare-function org-datetree-find-month-create (d &optional keep-restriction)) +(declare-function org-decrypt-entry "org-crypt" ()) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-lineage "org-element" (datum &optional types with-self)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-encrypt-entry "org-crypt" ()) +(declare-function org-insert-link "ol" (&optional complete-file link-location default-description)) +(declare-function org-link-make-string "ol" (link &optional description)) +(declare-function org-table-analyze "org-table" ()) +(declare-function org-table-current-dline "org-table" ()) +(declare-function org-table-fix-formulas "org-table" (key replace &optional limit delta remove)) +(declare-function org-table-goto-line "org-table" (N)) + +(defvar dired-buffers) +(defvar crm-separator) +(defvar org-end-time-was-given) +(defvar org-keyword-properties) +(defvar org-remember-default-headline) +(defvar org-remember-templates) +(defvar org-store-link-plist) +(defvar org-table-border-regexp) +(defvar org-table-current-begin-pos) +(defvar org-table-dataline-regexp) +(defvar org-table-fix-formulas-confirm) +(defvar org-table-hline-regexp) +(defvar org-table-hlines) + +(defvar org-capture-clock-was-started nil + "Internal flag, noting if the clock was started.") + +(defvar org-capture-last-stored-marker (make-marker) + "Marker pointing to the entry most recently stored with `org-capture'.") + +;; The following variable is scoped dynamically by org-protocol +;; to indicate that the link properties have already been stored +(defvar org-capture-link-is-already-stored nil) + +(defvar org-capture-is-refiling nil + "Non-nil when capture process is refiling an entry.") + +(defvar org-capture--prompt-history-table (make-hash-table :test #'equal) + "Hash table for all history lists per prompt.") + +(defvar org-capture--prompt-history nil + "History list for prompt placeholders.") + +(defgroup org-capture nil + "Options concerning capturing new entries." + :tag "Org Capture" + :group 'org) + +(defun org-capture-upgrade-templates (templates) + "Update the template list to the new format. +TEMPLATES is a template list, as in `org-capture-templates'. The +new format unifies all the date/week tree targets into one that +also allows for an optional outline path to specify a target." + (let ((modified-templates + (mapcar + (lambda (entry) + (pcase entry + ;; Match templates with an obsolete "tree" target type. Replace + ;; it with common `file+olp-datetree'. Add new properties + ;; (i.e., `:time-prompt' and `:tree-type') if needed. + (`(,key ,desc ,type (file+datetree . ,path) ,tpl . ,props) + `(,key ,desc ,type (file+olp+datetree ,@path) ,tpl ,@props)) + (`(,key ,desc ,type (file+datetree+prompt . ,path) ,tpl . ,props) + `(,key ,desc ,type (file+olp+datetree ,@path) ,tpl + :time-prompt t ,@props)) + (`(,key ,desc ,type (file+weektree . ,path) ,tpl . ,props) + `(,key ,desc ,type (file+olp+datetree ,@path) ,tpl + :tree-type week ,@props)) + (`(,key ,desc ,type (file+weektree+prompt . ,path) ,tpl . ,props) + `(,key ,desc ,type (file+olp+datetree ,@path) ,tpl + :tree-type week :time-prompt t ,@props)) + ;; Other templates are left unchanged. + (_ entry))) + templates))) + (unless (equal modified-templates templates) + (message "Deprecated date/weektree capture templates changed to `file+olp+datetree'.")) + modified-templates)) + +(defcustom org-capture-templates nil + "Templates for the creation of new entries. + +Each entry is a list with the following items: + +keys The keys that will select the template, as a string, characters + only, for example \"a\" for a template to be selected with a + single key, or \"bt\" for selection with two keys. When using + several keys, keys using the same prefix key must be together + in the list and preceded by a 2-element entry explaining the + prefix key, for example + + (\"b\" \"Templates for marking stuff to buy\") + + The \"C\" key is used by default for quick access to the + customization of the template variable. But if you want to use + that key for a template, you can. + +description A short string describing the template, will be shown during + selection. + +type The type of entry. Valid types are: + entry an Org node, with a headline. Will be filed + as the child of the target entry or as a + top-level entry. Its default template is: + \"* %?\n %a\" + item a plain list item, will be placed in the + first plain list at the target location. + Its default template is: + \"- %?\" + checkitem a checkbox item. This differs from the + plain list item only in so far as it uses a + different default template. Its default + template is: + \"- [ ] %?\" + table-line a new line in the first table at target location. + Its default template is: + \"| %? |\" + plain text to be inserted as it is. + +target Specification of where the captured item should be placed. + In Org files, targets usually define a node. Entries will + become children of this node, other types will be added to the + table or list in the body of this node. + + Most target specifications contain a file name. If that file + name is the empty string, it defaults to `org-default-notes-file'. + A file can also be given as a variable or as a function called + with no argument. When an absolute path is not specified for a + target, it is taken as relative to `org-directory'. + + Valid values are: + + (file \"path/to/file\") + Text will be placed at the beginning or end of that file + + (id \"id of existing Org entry\") + File as child of this entry, or in the body of the entry + + (file+headline \"path/to/file\" \"node headline\") + Fast configuration if the target heading is unique in the file + + (file+olp \"path/to/file\" \"Level 1 heading\" \"Level 2\" ...) + For non-unique headings, the full outline path is safer + + (file+regexp \"path/to/file\" \"regexp to find location\") + File to the entry matching regexp + + (file+olp+datetree \"path/to/file\" \"Level 1 heading\" ...) + Will create a heading in a date tree for today's date. + If no heading is given, the tree will be on top level. + To prompt for date instead of using TODAY, use the + :time-prompt property. To create a week-tree, use the + :tree-type property. + + (file+function \"path/to/file\" function-finding-location) + A function to find the right location in the file + + (clock) + File to the entry that is currently being clocked + + (function function-finding-location) + Most general way: write your own function which both visits + the file and moves point to the right location + +template The template for creating the capture item. + If it is an empty string or nil, a default template based on + the entry type will be used (see the \"type\" section above). + Instead of a string, this may also be one of: + + (file \"/path/to/template-file\") + (function function-returning-the-template) + + in order to get a template from a file, or dynamically + from a function. + +The rest of the entry is a property list of additional options. Recognized +properties are: + + :prepend Normally newly captured information will be appended at + the target location (last child, last table line, + last list item...). Setting this property will + change that. + + :immediate-finish When set, do not offer to edit the information, just + file it away immediately. This makes sense if the + template only needs information that can be added + automatically. + + :jump-to-captured When set, jump to the captured entry when finished. + + :refile-targets When exiting capture mode via `org-capture-refile', the + variable `org-refile-targets' will be temporarily bound + to the value of this property. + + :empty-lines Set this to the number of lines that should be inserted + before and after the new item. Default 0, only common + other value is 1. + + :empty-lines-before Set this to the number of lines that should be inserted + before the new item. Overrides :empty-lines for the + number lines inserted before. + + :empty-lines-after Set this to the number of lines that should be inserted + after the new item. Overrides :empty-lines for the + number of lines inserted after. + + :clock-in Start the clock in this item. + + :clock-keep Keep the clock running when filing the captured entry. + + :clock-resume Start the interrupted clock when finishing the capture. + Note that :clock-keep has precedence over :clock-resume. + When setting both to t, the current clock will run and + the previous one will not be resumed. + + :time-prompt Prompt for a date/time to be used for date/week trees + and when filling the template. + + :tree-type When `week', make a week tree instead of the month-day + tree. When `month', make a month tree instead of the + month-day tree. + + :unnarrowed Do not narrow the target buffer, simply show the + full buffer. Default is to narrow it so that you + only see the new stuff. + + :table-line-pos Specification of the location in the table where the + new line should be inserted. It should be a string like + \"II-3\", meaning that the new line should become the + third line before the second horizontal separator line. + + :kill-buffer If the target file was not yet visited by a buffer when + capture was invoked, kill the buffer again after capture + is finalized. + + :no-save Do not save the target file after finishing the capture. + +The template defines the text to be inserted. Often this is an +Org mode entry (so the first line should start with a star) that +will be filed as a child of the target headline. It can also be +freely formatted text. Furthermore, the following %-escapes will +be replaced with content and expanded: + + %[pathname] Insert the contents of the file given by + `pathname'. These placeholders are expanded at the very + beginning of the process so they can be used to extend the + current template. + %(sexp) Evaluate elisp `(sexp)' and replace it with the results. + Only placeholders pre-existing within the template, or + introduced with %[pathname] are expanded this way. + Since this happens after expanding non-interactive + %-escapes, those can be used to fill the expression. + %<...> The result of `format-time-string' on the ... format + specification. + %t Time stamp, date only. The time stamp is the current + time, except when called from agendas with + `\\[org-agenda-capture]' or with + `org-capture-use-agenda-date' set. + %T Time stamp as above, with date and time. + %u, %U Like the above, but inactive time stamps. + %i Initial content, copied from the active region. If + there is text before %i on the same line, such as + indentation, and %i is not inside a %(sexp), that prefix + will be added before every line in the inserted text. + %a Annotation, normally the link created with `org-store-link'. + %A Like %a, but prompt for the description part. + %l Like %a, but only insert the literal link. + %L Like %l, but without brackets (the link content itself). + %c Current kill ring head. + %x Content of the X clipboard. + %k Title of currently clocked task. + %K Link to currently clocked task. + %n User name (taken from the variable `user-full-name'). + %f File visited by current buffer when `org-capture' was called. + %F Full path of the file or directory visited by current buffer. + %:keyword Specific information for certain link types, see below. + %^g Prompt for tags, with completion on tags in target file. + %^G Prompt for tags, with completion on all tags in all agenda files. + %^t Like %t, but prompt for date. Similarly %^T, %^u, %^U. + You may define a prompt like: %^{Please specify birthday}t. + The default date is that of %t, see above. + %^C Interactive selection of which kill or clip to use. + %^L Like %^C, but insert as link. + %^{prop}p Prompt the user for a value for property `prop'. + A default value can be specified like this: + %^{prop|default}p. + %^{prompt} Prompt the user for a string and replace this sequence with it. + A default value and a completion table can be specified like this: + %^{prompt|default|completion2|completion3|...}. + %? 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. + +Apart from these general escapes, you can access information specific to +the link type that is created. For example, calling `org-capture' in emails +or in Gnus will record the author and the subject of the message, which you +can access with \"%:from\" and \"%:subject\", respectively. Here is a +complete list of what is recorded for each link type. + +Link type | Available information +------------------------+------------------------------------------------------ +bbdb | %:type %:name %:company +vm, wl, mh, mew, rmail, | %:type %:subject %:message-id +gnus | %:from %:fromname %:fromaddress + | %:to %:toname %:toaddress + | %:fromto (either \"to NAME\" or \"from NAME\") + | %:date %:date-timestamp (as active timestamp) + | %:date-timestamp-inactive (as inactive timestamp) +gnus | %:group, for messages also all email fields +eww, w3, w3m | %:type %:url +info | %:type %:file %:node +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.5") + :set (lambda (s v) (set s (org-capture-upgrade-templates v))) + :type + (let ((file-variants '(choice :tag "Filename " + (file :tag "Literal") + (function :tag "Function") + (variable :tag "Variable") + (sexp :tag "Form")))) + `(repeat + (choice :value ("" "" entry (file "~/org/notes.org") "") + (list :tag "Multikey description" + (string :tag "Keys ") + (string :tag "Description")) + (list :tag "Template entry" + (string :tag "Keys ") + (string :tag "Description ") + (choice :tag "Capture Type " :value entry + (const :tag "Org entry" entry) + (const :tag "Plain list item" item) + (const :tag "Checkbox item" checkitem) + (const :tag "Plain text" plain) + (const :tag "Table line" table-line)) + (choice :tag "Target location" + (list :tag "File" + (const :format "" file) + ,file-variants) + (list :tag "ID" + (const :format "" id) + (string :tag " ID")) + (list :tag "File & Headline" + (const :format "" file+headline) + ,file-variants + (string :tag " Headline")) + (list :tag "File & Outline path" + (const :format "" file+olp) + ,file-variants + (repeat :tag "Outline path" :inline t + (string :tag "Headline"))) + (list :tag "File & Regexp" + (const :format "" file+regexp) + ,file-variants + (regexp :tag " Regexp")) + (list :tag "File [ & Outline path ] & Date tree" + (const :format "" file+olp+datetree) + ,file-variants + (option (repeat :tag "Outline path" :inline t + (string :tag "Headline")))) + (list :tag "File & function" + (const :format "" file+function) + ,file-variants + (sexp :tag " Function")) + (list :tag "Current clocking task" + (const :format "" clock)) + (list :tag "Function" + (const :format "" function) + (sexp :tag " Function"))) + (choice :tag "Template " + (string) + (list :tag "File" + (const :format "" file) + (file :tag "Template file")) + (list :tag "Function" + (const :format "" function) + (function :tag "Template function"))) + (plist :inline t + ;; Give the most common options as checkboxes + :options (((const :format "%v " :prepend) (const t)) + ((const :format "%v " :immediate-finish) (const t)) + ((const :format "%v " :jump-to-captured) (const t)) + ((const :format "%v " :empty-lines) (const 1)) + ((const :format "%v " :empty-lines-before) (const 1)) + ((const :format "%v " :empty-lines-after) (const 1)) + ((const :format "%v " :clock-in) (const t)) + ((const :format "%v " :clock-keep) (const t)) + ((const :format "%v " :clock-resume) (const t)) + ((const :format "%v " :time-prompt) (const t)) + ((const :format "%v " :tree-type) (const week)) + ((const :format "%v " :unnarrowed) (const t)) + ((const :format "%v " :table-line-pos) (string)) + ((const :format "%v " :kill-buffer) (const t))))))))) + +(defcustom org-capture-before-finalize-hook nil + "Hook that is run right before a capture process is finalized. +The capture buffer is still current when this hook runs and it is +widened to the entire buffer." + :group 'org-capture + :version "24.1" + :type 'hook) + +(defcustom org-capture-after-finalize-hook nil + "Hook that is run right after a capture process is finalized. +Suitable for window cleanup." + :group 'org-capture + :version "24.1" + :type 'hook) + +(defcustom org-capture-prepare-finalize-hook nil + "Hook that is run before the finalization starts. +The capture buffer is current and still narrowed." + :group 'org-capture + :version "24.1" + :type 'hook) + +(defcustom org-capture-bookmark t + "When non-nil, add bookmark pointing at the last stored position when capturing." + :group 'org-capture + :version "24.3" + :type 'boolean) + +;;; The property list for keeping information about the capture process + +(defvar org-capture-plist nil + "Plist for the current capture process, global, to avoid having to pass it.") + +(defvar org-capture-current-plist nil + "Local variable holding the plist in a capture buffer. +This is used to store the plist for use when finishing a capture process +because another such process might have changed the global variable by then. + +Each time a new capture buffer has been set up, the global `org-capture-plist' +is copied to this variable, which is local in the indirect buffer.") + +(defvar org-capture-clock-keep nil + "Local variable to store the value of the :clock-keep parameter. +This is needed in case `org-capture-finalize' is called interactively.") + +(defun org-capture-put (&rest elements) + "Add ELEMENTS to the capture property list `org-capture-plist'." + (while elements + (setq org-capture-plist (plist-put org-capture-plist + (pop elements) (pop elements))))) +(defun org-capture-get (property &optional local) + "Get PROPERTY from the capture property list `org-capture-plist'. +When LOCAL is set, use the local variable `org-capture-current-plist', +this is necessary after initialization of the capture process, +to avoid conflicts with other active capture processes." + (plist-get (if local org-capture-current-plist org-capture-plist) property)) + +;;; The minor mode + +(defvar org-capture-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-c\C-c" #'org-capture-finalize) + (define-key map "\C-c\C-k" #'org-capture-kill) + (define-key map "\C-c\C-w" #'org-capture-refile) + map) + "Keymap for `org-capture-mode', a minor mode. +Use this map to set additional keybindings for when Org mode is used +for a capture buffer.") + +(defvar org-capture-mode-hook nil + "Hook for the `org-capture-mode' minor mode.") + +(define-minor-mode org-capture-mode + "Minor mode for special key bindings in a capture buffer. + +Turning on this mode runs the normal hook `org-capture-mode-hook'." + :lighter " Cap" + (setq-local + header-line-format + (substitute-command-keys + "\\Capture buffer. Finish \ +`\\[org-capture-finalize]', refile `\\[org-capture-refile]', \ +abort `\\[org-capture-kill]'."))) + +;;; The main commands + +(defvar org-capture-initial nil) +(defvar org-capture-entry nil) + +;;;###autoload +(defun org-capture-string (string &optional keys) + "Capture STRING with the template selected by KEYS." + (interactive "sInitial text: \n") + (let ((org-capture-initial string) + (org-capture-entry (org-capture-select-template keys))) + (org-capture))) + +(defcustom org-capture-templates-contexts nil + "Alist of capture templates and valid contexts. + +For example, if you have a capture template \"c\" and you want +this template to be accessible only from `message-mode' buffers, +use this: + + \\='((\"c\" ((in-mode . \"message-mode\")))) + +Here are the available contexts definitions: + + in-file: command displayed only in matching files + in-mode: command displayed only in matching modes + not-in-file: command not displayed in matching files + not-in-mode: command not displayed in matching modes + in-buffer: command displayed only in matching buffers +not-in-buffer: command not displayed in matching buffers + [function]: a custom function taking no argument + +If you define several checks, the agenda command will be +accessible if there is at least one valid check. + +You can also bind a key to another capture template depending on +contextual rules. + + \\='((\"c\" \"d\" ((in-mode . \"message-mode\")))) + +Here it means: in `message-mode buffers', use \"c\" as the +key for the capture template otherwise associated with \"d\". +\(The template originally associated with \"d\" is not displayed +to avoid duplicates.)" + :version "24.3" + :group 'org-capture + :type '(repeat (list :tag "Rule" + (string :tag " Capture key") + (string :tag "Replace by template") + (repeat :tag "Available when" + (choice + (cons :tag "Condition" + (choice + (const :tag "In file" in-file) + (const :tag "Not in file" not-in-file) + (const :tag "In buffer" in-buffer) + (const :tag "Not in buffer" not-in-buffer) + (const :tag "In mode" in-mode) + (const :tag "Not in mode" not-in-mode)) + (regexp)) + (function :tag "Custom function")))))) + +(defcustom org-capture-use-agenda-date nil + "Non-nil means use the date at point when capturing from agendas. +When nil, you can still capture using the date at point with +`\\[org-agenda-capture]'." + :group 'org-capture + :version "24.3" + :type 'boolean) + +;;;###autoload +(defun org-capture (&optional goto keys) + "Capture something. +\\ +This will let you select a template from `org-capture-templates', and +then file the newly captured information. The text is immediately +inserted at the target location, and an indirect buffer is shown where +you can edit it. Pressing `\\[org-capture-finalize]' brings you back to the \ +previous +state of Emacs, so that you can continue your work. + +When called interactively with a `\\[universal-argument]' prefix argument \ +GOTO, don't +capture anything, just go to the file/headline where the selected +template stores its notes. + +With a `\\[universal-argument] \\[universal-argument]' prefix argument, go to \ +the last note stored. + +When called with a `C-0' (zero) prefix, insert a template at point. + +When called with a `C-1' (one) prefix, force prompting for a date when +a datetree entry is made. + +ELisp programs can set KEYS to a string associated with a template +in `org-capture-templates'. In this case, interactive selection +will be bypassed. + +If `org-capture-use-agenda-date' is non-nil, capturing from the +agenda will use the date at point as the default date. Then, a +`C-1' prefix will tell the capture process to use the HH:MM time +of the day at point (if any) or the current HH:MM time." + (interactive "P") + (when (and org-capture-use-agenda-date + (eq major-mode 'org-agenda-mode)) + (setq org-overriding-default-time + (org-get-cursor-date (equal goto 1)))) + (cond + ((equal goto '(4)) (org-capture-goto-target keys)) + ((equal goto '(16)) (org-capture-goto-last-stored)) + (t + (let* ((orig-buf (current-buffer)) + (annotation (if (and (boundp 'org-capture-link-is-already-stored) + org-capture-link-is-already-stored) + (plist-get org-store-link-plist :annotation) + (ignore-errors (org-store-link nil)))) + (entry (or org-capture-entry (org-capture-select-template keys))) + initial) + (setq initial (or org-capture-initial + (and (org-region-active-p) + (buffer-substring (point) (mark))))) + (when (stringp initial) + (remove-text-properties 0 (length initial) '(read-only t) initial)) + (when (stringp annotation) + (remove-text-properties 0 (length annotation) + '(read-only t) annotation)) + (cond + ((equal entry "C") + (customize-variable 'org-capture-templates)) + ((equal entry "q") + (user-error "Abort")) + (t + (org-capture-set-plist entry) + (org-capture-get-template) + (org-capture-put :original-buffer orig-buf + :original-file (or (buffer-file-name orig-buf) + (and (featurep 'dired) + (car (rassq orig-buf + dired-buffers)))) + :original-file-nondirectory + (and (buffer-file-name orig-buf) + (file-name-nondirectory + (buffer-file-name orig-buf))) + :annotation annotation + :initial initial + :return-to-wconf (current-window-configuration) + :default-time (or org-overriding-default-time + (org-current-time))) + (org-capture-set-target-location (and (equal goto 0) 'here)) + (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)) + (condition-case error + (org-capture-place-template + (eq (car (org-capture-get :target)) 'function)) + ((error quit) + (when (and (buffer-base-buffer (current-buffer)) + (string-prefix-p "CAPTURE-" (buffer-name))) + (kill-buffer (current-buffer))) + (set-window-configuration (org-capture-get :return-to-wconf)) + (error "Capture template `%s': %s" + (org-capture-get :key) + (error-message-string error)))) + (when (and (derived-mode-p 'org-mode) (org-capture-get :clock-in)) + (condition-case nil + (progn + (when (org-clock-is-active) + (org-capture-put :interrupted-clock + (copy-marker org-clock-marker))) + (org-clock-in) + (setq-local org-capture-clock-was-started t)) + (error "Could not start the clock in this capture buffer"))) + (when (org-capture-get :immediate-finish) + (org-capture-finalize)))))))) + +(defun org-capture-get-template () + "Get the template from a file or a function if necessary." + (org-capture-put + :template + (pcase (org-capture-get :template) + (`nil "") + ((and (pred stringp) template) template) + (`(file ,file) + (let ((filename (expand-file-name file org-directory))) + (if (file-exists-p filename) (org-file-contents filename) + (format "* Template file %S not found" file)))) + (`(function ,f) + (if (functionp f) (funcall f) + (format "* Template function %S not found" f))) + (_ "* Invalid capture template")))) + +(defun org-capture-finalize (&optional stay-with-capture) + "Finalize the capture process. +With prefix argument STAY-WITH-CAPTURE, jump to the location of the +captured item after finalizing." + (interactive "P") + (when (org-capture-get :jump-to-captured) + (setq stay-with-capture t)) + (unless (and org-capture-mode + (buffer-base-buffer (current-buffer))) + (error "This does not seem to be a capture buffer for Org mode")) + + (run-hooks 'org-capture-prepare-finalize-hook) + + ;; Update `org-capture-plist' with the buffer-local value. Since + ;; captures can be run concurrently, this is to ensure that + ;; `org-capture-after-finalize-hook' accesses the proper plist. + (setq org-capture-plist org-capture-current-plist) + + ;; Did we start the clock in this capture buffer? + (when (and org-capture-clock-was-started + org-clock-marker + (eq (marker-buffer org-clock-marker) (buffer-base-buffer)) + (>= org-clock-marker (point-min)) + (< org-clock-marker (point-max))) + ;; Looks like the clock we started is still running. + (if org-capture-clock-keep + ;; User may have completed clocked heading from the template. + ;; Refresh clock mode line. + (org-clock-update-mode-line t) + ;; Clock out. Possibly resume interrupted clock. + (let (org-log-note-clock-out) (org-clock-out)) + (when (and (org-capture-get :clock-resume 'local) + (markerp (org-capture-get :interrupted-clock 'local)) + (buffer-live-p (marker-buffer + (org-capture-get :interrupted-clock 'local)))) + (let ((clock-in-task (org-capture-get :interrupted-clock 'local))) + (org-with-point-at clock-in-task (org-clock-in))) + (message "Interrupted clock has been resumed")))) + + (let ((abort-note nil)) + ;; Store the size of the capture buffer + (org-capture-put :captured-entry-size (- (point-max) (point-min))) + (widen) + ;; Store the insertion point in the target buffer + (org-capture-put :insertion-point (point)) + + (if org-note-abort + (let ((beg (org-capture-get :begin-marker 'local)) + (end (org-capture-get :end-marker 'local))) + (if (not (and beg end)) (setq abort-note 'dirty) + (setq abort-note t) + (org-with-wide-buffer (kill-region beg end)))) + + ;; Postprocessing: Update Statistics cookies, do the sorting + (when (derived-mode-p 'org-mode) + (save-excursion + (when (ignore-errors (org-back-to-heading)) + (org-update-parent-todo-statistics) + (org-update-checkbox-count))) + ;; FIXME Here we should do the sorting + ;; If we have added a table line, maybe recompute? + (when (and (eq (org-capture-get :type 'local) 'table-line) + (org-at-table-p)) + (if (not (org-table-get-stored-formulas)) (org-table-align) + ;; Adjust formulas, if necessary. We assume a non-nil + ;; `:immediate-finish' means that no confirmation is + ;; required. Else, obey `org-table-fix-formulas-confirm'. + ;; + ;; The delta required to fix formulas depends on the + ;; number of rows inserted by the template. + (when (or (org-capture-get :immediate-finish) + (not org-table-fix-formulas-confirm) + (funcall org-table-fix-formulas-confirm "Fix formulas? ")) + (org-table-fix-formulas + "@" nil (1- (org-table-current-dline)) + (count-lines (org-capture-get :begin-marker 'local) + (org-capture-get :end-marker 'local)))) + (org-table-recalculate 'all)))) ;FIXME: should we iterate? + ;; Store this place as the last one where we stored something + ;; Do the marking in the base buffer, so that it makes sense after + ;; the indirect buffer has been killed. + (org-capture-store-last-position) + + ;; Run the hook + (run-hooks 'org-capture-before-finalize-hook)) + + (when (org-capture-get :decrypted) + (save-excursion + (goto-char (org-capture-get :decrypted)) + (org-encrypt-entry))) + + (unless (org-capture-get :no-save) (save-buffer)) + + (let ((return-wconf (org-capture-get :return-to-wconf 'local)) + (new-buffer (org-capture-get :new-buffer 'local)) + (kill-buffer (org-capture-get :kill-buffer 'local)) + (base-buffer (buffer-base-buffer (current-buffer)))) + + ;; Kill the indirect buffer + (kill-buffer (current-buffer)) + + ;; Narrow back the target buffer to its previous state + (with-current-buffer (org-capture-get :buffer) + (let ((reg (org-capture-get :initial-target-region)) + (pos (org-capture-get :initial-target-position)) + (ipt (org-capture-get :insertion-point)) + (size (org-capture-get :captured-entry-size))) + (if (not reg) + (widen) + (cond ((< ipt (car reg)) + ;; insertion point is before the narrowed region + (narrow-to-region (+ size (car reg)) (+ size (cdr reg)))) + ((> ipt (cdr reg)) + ;; insertion point is after the narrowed region + (narrow-to-region (car reg) (cdr reg))) + (t + ;; insertion point is within the narrowed region + (narrow-to-region (car reg) (+ size (cdr reg))))) + ;; now place back the point at its original position + (if (< ipt (car reg)) + (goto-char (+ size pos)) + (goto-char (if (< ipt pos) (+ size pos) pos)))))) + + ;; Kill the target buffer if that is desired + (when (and base-buffer new-buffer kill-buffer) + (with-current-buffer base-buffer (save-buffer)) + (kill-buffer base-buffer)) + + ;; Restore the window configuration before capture + (set-window-configuration return-wconf)) + + (run-hooks 'org-capture-after-finalize-hook) + ;; Special cases + (cond + (abort-note + (cl-case abort-note + (clean + (message "Capture process aborted and target buffer cleaned up")) + (dirty + (error "Capture process aborted, but target buffer could not be \ +cleaned up correctly")))) + (stay-with-capture + (org-capture-goto-last-stored))) + ;; Return if we did store something + (not abort-note))) + +(defun org-capture-refile () + "Finalize the current capture and then refile the entry. +Refiling is done from the base buffer, because the indirect buffer is then +already gone. Any prefix argument will be passed to the refile command." + (interactive) + (unless (eq (org-capture-get :type 'local) 'entry) + (user-error "Refiling from a capture buffer makes only sense \ +for `entry'-type templates")) + (let* ((base (or (buffer-base-buffer) (current-buffer))) + (pos (make-marker)) + (org-capture-is-refiling t) + (kill-buffer (org-capture-get :kill-buffer 'local)) + (jump-to-captured (org-capture-get :jump-to-captured 'local)) + (refile-targets (org-capture-get :refile-targets 'local))) + ;; Since `org-capture-finalize' may alter buffer contents (e.g., + ;; empty lines) around entry, use a marker to refer to the + ;; headline to be refiled. Place the marker in the base buffer, + ;; as the current indirect one is going to be killed. + (set-marker pos (save-excursion (org-back-to-heading t) (point)) base) + ;; `org-capture-finalize' calls `org-capture-goto-last-stored' too + ;; early. We want to wait for the refiling to be over, so we + ;; control when the latter function is called. + (org-capture-put :kill-buffer nil :jump-to-captured nil) + (let ((org-refile-targets (or refile-targets org-refile-targets))) + (org-capture-finalize) + (save-window-excursion + (with-current-buffer base + (org-with-point-at pos + (call-interactively 'org-refile))))) + (when kill-buffer + (with-current-buffer base (save-buffer)) + (kill-buffer base)) + (when jump-to-captured (org-capture-goto-last-stored)))) + +(defun org-capture-kill () + "Abort the current capture process." + (interactive) + ;; FIXME: This does not do the right thing, we need to remove the + ;; new stuff by hand it is easy: undo, then kill the buffer + (let ((org-note-abort t) + (org-capture-before-finalize-hook nil)) + (org-capture-finalize))) + +(defun org-capture-goto-last-stored () + "Go to the location where the last capture note was stored." + (interactive) + (org-goto-marker-or-bmk org-capture-last-stored-marker + (plist-get org-bookmark-names-plist + :last-capture)) + (message "This is the last note stored by a capture process")) + +;;; Supporting functions for handling the process + +(defun org-capture-put-target-region-and-position () + "Store the initial region with `org-capture-put'." + (org-capture-put + :initial-target-region + ;; Check if the buffer is currently narrowed + (when (org-buffer-narrowed-p) + (cons (point-min) (point-max)))) + ;; store the current point + (org-capture-put :initial-target-position (point))) + +(defvar org-time-was-given) ; dynamically scoped parameter +(defun org-capture-set-target-location (&optional target) + "Find TARGET buffer and position. +Store them in the capture property list." + (let ((target-entry-p t)) + (save-excursion + (pcase (or target (org-capture-get :target)) + (`here + (org-capture-put :exact-position (point) :insert-here t)) + (`(file ,path) + (set-buffer (org-capture-target-buffer path)) + (org-capture-put-target-region-and-position) + (widen) + (setq target-entry-p nil)) + (`(id ,id) + (pcase (org-id-find id) + (`(,path . ,position) + (set-buffer (org-capture-target-buffer path)) + (widen) + (org-capture-put-target-region-and-position) + (goto-char position)) + (_ (error "Cannot find target ID \"%s\"" id)))) + (`(file+headline ,path ,headline) + (set-buffer (org-capture-target-buffer path)) + ;; Org expects the target file to be in Org mode, otherwise + ;; it throws an error. However, the default notes files + ;; should work out of the box. In this case, we switch it to + ;; Org mode. + (unless (derived-mode-p 'org-mode) + (org-display-warning + (format "Capture requirement: switching buffer %S to Org mode" + (current-buffer))) + (org-mode)) + (org-capture-put-target-region-and-position) + (widen) + (goto-char (point-min)) + (if (re-search-forward (format org-complex-heading-regexp-format + (regexp-quote headline)) + nil t) + (beginning-of-line) + (goto-char (point-max)) + (unless (bolp) (insert "\n")) + (insert "* " headline "\n") + (beginning-of-line 0))) + (`(file+olp ,path . ,outline-path) + (let ((m (org-find-olp (cons (org-capture-expand-file path) + outline-path)))) + (set-buffer (marker-buffer m)) + (org-capture-put-target-region-and-position) + (widen) + (goto-char m) + (set-marker m nil))) + (`(file+regexp ,path ,regexp) + (set-buffer (org-capture-target-buffer path)) + (org-capture-put-target-region-and-position) + (widen) + (goto-char (point-min)) + (if (not (re-search-forward regexp nil t)) + (error "No match for target regexp in file %s" path) + (goto-char (if (org-capture-get :prepend) + (match-beginning 0) + (match-end 0))) + (org-capture-put :exact-position (point)) + (setq target-entry-p + (and (derived-mode-p 'org-mode) (org-at-heading-p))))) + (`(file+olp+datetree ,path . ,outline-path) + (let ((m (if outline-path + (org-find-olp (cons (org-capture-expand-file path) + outline-path)) + (set-buffer (org-capture-target-buffer path)) + (point-marker)))) + (set-buffer (marker-buffer m)) + (org-capture-put-target-region-and-position) + (widen) + (goto-char m) + (set-marker m nil) + (require 'org-datetree) + (org-capture-put-target-region-and-position) + (widen) + ;; Make a date/week tree entry, with the current date (or + ;; yesterday, if we are extending dates for a couple of + ;; hours) + (funcall + (pcase (org-capture-get :tree-type) + (`week #'org-datetree-find-iso-week-create) + (`month #'org-datetree-find-month-create) + (_ #'org-datetree-find-date-create)) + (calendar-gregorian-from-absolute + (cond + (org-overriding-default-time + ;; Use the overriding default time. + (time-to-days org-overriding-default-time)) + ((or (org-capture-get :time-prompt) + (equal current-prefix-arg 1)) + ;; Prompt for date. Bind `org-end-time-was-given' so + ;; that `org-read-date-analyze' handles the time range + ;; case and returns `prompt-time' with the start value. + (let* ((org-time-was-given nil) + (org-end-time-was-given nil) + (prompt-time (org-read-date + nil t nil "Date for tree entry:"))) + (org-capture-put + :default-time + (if (or org-time-was-given + (= (time-to-days prompt-time) (org-today))) + prompt-time + ;; Use 00:00 when no time is given for another + ;; date than today? + (apply #'encode-time 0 0 + org-extend-today-until + (cl-cdddr (decode-time prompt-time))))) + (time-to-days prompt-time))) + (t + ;; Current date, possibly corrected for late night + ;; workers. + (org-today)))) + ;; the following is the keep-restriction argument for + ;; org-datetree-find-date-create + (when outline-path 'subtree-at-point)))) + (`(file+function ,path ,function) + (set-buffer (org-capture-target-buffer path)) + (org-capture-put-target-region-and-position) + (widen) + (funcall function) + (org-capture-put :exact-position (point)) + (setq target-entry-p + (and (derived-mode-p 'org-mode) (org-at-heading-p)))) + (`(function ,fun) + (funcall fun) + (org-capture-put :exact-position (point)) + (setq target-entry-p + (and (derived-mode-p 'org-mode) (org-at-heading-p)))) + (`(clock) + (if (and (markerp org-clock-hd-marker) + (marker-buffer org-clock-hd-marker)) + (progn (set-buffer (marker-buffer org-clock-hd-marker)) + (org-capture-put-target-region-and-position) + (widen) + (goto-char org-clock-hd-marker)) + (user-error "No running clock that could be used as capture target"))) + (target (error "Invalid capture target specification: %S" target))) + + (org-capture-put :buffer (current-buffer) + :pos (point) + :target-entry-p target-entry-p + :decrypted + (and (featurep 'org-crypt) + (org-at-encrypted-entry-p) + (save-excursion + (org-decrypt-entry) + (and (org-back-to-heading t) (point)))))))) + +(defun org-capture-expand-file (file) + "Expand functions, symbols and file names for FILE. +When FILE is a function, call it. When it is a form, evaluate +it. When it is a variable, return its value. When it is +a string, treat it as a file name, possibly expanding it +according to `org-directory', and return it. If it is the empty +string, however, return `org-default-notes-file'. In any other +case, raise an error." + (let ((location (cond ((equal file "") org-default-notes-file) + ((stringp file) (expand-file-name file org-directory)) + ((functionp file) (funcall file)) + ((and (symbolp file) (boundp file)) (symbol-value file)) + (t nil)))) + (or (org-string-nw-p location) + (error "Invalid file location: %S" location)))) + +(defun org-capture-target-buffer (file) + "Get a buffer for FILE. +FILE is a generalized file location, as handled by +`org-capture-expand-file'." + (let ((file (org-capture-expand-file file))) + (or (org-find-base-buffer-visiting file) + (progn (org-capture-put :new-buffer t) + (find-file-noselect file))))) + +(defun org-capture-place-template (&optional inhibit-wconf-store) + "Insert the template at the target location, and display the buffer. +When INHIBIT-WCONF-STORE is non-nil, don't store the window configuration, as it +may have been stored before." + (unless inhibit-wconf-store + (org-capture-put :return-to-wconf (current-window-configuration))) + (delete-other-windows) + (org-switch-to-buffer-other-window + (org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE")) + (widen) + (org-show-all) + (goto-char (org-capture-get :pos)) + (setq-local outline-level 'org-outline-level) + (pcase (org-capture-get :type) + ((or `nil `entry) (org-capture-place-entry)) + (`table-line (org-capture-place-table-line)) + (`plain (org-capture-place-plain-text)) + (`item (org-capture-place-item)) + (`checkitem (org-capture-place-item))) + (setq-local org-capture-current-plist org-capture-plist) + (org-capture-mode 1)) + +(defun org-capture-place-entry () + "Place the template as a new Org entry." + (let ((template (org-capture-get :template)) + (reversed? (org-capture-get :prepend)) + (exact-position (org-capture-get :exact-position)) + (insert-here? (org-capture-get :insert-here)) + (level 1)) + (org-capture-verify-tree template) + (when exact-position (goto-char exact-position)) + (cond + ;; Force insertion at point. + (insert-here? + ;; FIXME: level should probably set directly within (let ...). + (setq level (org-get-valid-level + (if (or (org-at-heading-p) + (ignore-errors + (save-excursion (org-back-to-heading t)))) + (org-outline-level) + 1)))) + ;; Insert as a child of the current entry. + ((org-capture-get :target-entry-p) + (setq level (org-get-valid-level + (if (org-at-heading-p) (org-outline-level) 1) + 1)) + (if reversed? (outline-next-heading) (org-end-of-subtree t t))) + ;; Insert as a top-level entry at the beginning of the file. + (reversed? + (goto-char (point-min)) + (unless (org-at-heading-p) (outline-next-heading))) + ;; Otherwise, insert as a top-level entry at the end of the file. + (t (goto-char (point-max)))) + (let ((origin (point))) + (unless (bolp) (insert "\n")) + (org-capture-empty-lines-before) + (let ((beg (point))) + (save-restriction + (when insert-here? (narrow-to-region beg beg)) + (org-paste-subtree level template 'for-yank)) + (org-capture-position-for-last-stored beg) + (org-capture-empty-lines-after) + (unless (org-at-heading-p) (outline-next-heading)) + (org-capture-mark-kill-region origin (point)) + (org-capture-narrow beg (if (eobp) (point) (1- (point)))) + (org-capture--position-cursor beg (point)))))) + +(defun org-capture-place-item () + "Place the template as a new plain list item." + (let ((prepend? (org-capture-get :prepend)) + (template (org-remove-indentation (org-capture-get :template))) + item) + ;; Make template suitable for insertion. In particular, add + ;; a main bullet if it is missing. + (unless (string-match-p (concat "\\`" (org-item-re)) template) + (setq template (concat "- " (mapconcat #'identity + (split-string template "\n") + "\n ")))) + ;; Delimit the area where we should look for a plain list. + (pcase-let ((`(,beg . ,end) + (cond ((org-capture-get :exact-position) + ;; User gave a specific position. Start + ;; looking for lists from here. + (org-with-point-at (org-capture-get :exact-position) + (cons (line-beginning-position) + (if (org-capture-get :insert-here) + (line-beginning-position) + (org-entry-end-position))))) + ((org-capture-get :target-entry-p) + ;; At a heading, limit search to its body. + (cons (line-beginning-position 2) + (org-entry-end-position))) + (t + ;; Table is not necessarily under a heading. + ;; Search whole buffer. + (cons (point-min) (point-max)))))) + ;; Find the first plain list in the delimited area. + (goto-char beg) + (let ((item-regexp (org-item-beginning-re))) + (catch :found + (while (re-search-forward item-regexp end t) + (when (setq item (org-element-lineage + (org-element-at-point) '(plain-list) t)) + (goto-char (org-element-property (if prepend? :post-affiliated + :contents-end) + item)) + (throw :found t))) + ;; No list found. Move to the location when to insert + ;; template. Skip planning info and properties drawers, if + ;; any. + (goto-char (cond ((org-capture-get :insert-here) beg) + ((not prepend?) end) + ((org-before-first-heading-p) beg) + (t (max (save-excursion + (org-end-of-meta-data) + (point)) + beg))))))) + ;; Insert template. + (let ((origin (point))) + (unless (bolp) (insert "\n")) + ;; When a new list is created, always obey to `:empty-lines' and + ;; friends. + ;; + ;; When capturing in an existing list, do not change blank lines + ;; above or below the list; consider it to be a stable + ;; structure. However, we can control how many blank lines + ;; separate items. So obey to `:empty-lines' between items as + ;; long as it does not insert more than one empty line. In the + ;; specific case of empty lines above, it means we only obey the + ;; parameter when appending an item. + (unless (and item prepend?) + (org-capture-empty-lines-before + (and item + (not prepend?) + (min 1 (or (org-capture-get :empty-lines-before) + (org-capture-get :empty-lines) + 0))))) + (org-capture-position-for-last-stored (point)) + (let ((beg (line-beginning-position)) + (end (progn + (insert (org-trim template) "\n") + (point-marker)))) + (when item + (let ((i (save-excursion + (goto-char (org-element-property :post-affiliated item)) + (current-indentation)))) + (save-excursion + (goto-char beg) + (save-excursion + (while (< (point) end) + (indent-to i) + (forward-line))) + ;; Pre-pending an item could change the type of the list + ;; if there is a mismatch. In this situation, + ;; prioritize the existing list. + (when prepend? + (let ((ordered? (eq 'ordered (org-element-property :type item)))) + (when (org-xor ordered? + (string-match-p "\\`[A-Za-z0-9]\\([.)]\\)" + template)) + (org-cycle-list-bullet (if ordered? "1." "-"))))) + ;; Eventually repair the list for proper indentation and + ;; bullets. + (org-list-repair)))) + ;; Limit number of empty lines. See above for details. + (unless (and item (not prepend?)) + (org-capture-empty-lines-after + (and item + prepend? + (min 1 (or (org-capture-get :empty-lines-after) + (org-capture-get :empty-lines) + 0))))) + (org-capture-mark-kill-region origin (point)) + ;; ITEM always end with a newline character. Make sure we do + ;; not narrow at the beginning of the next line, possibly + ;; altering its structure (e.g., when it is a headline). + (org-capture-narrow beg (1- end)) + (org-capture--position-cursor beg end))))) + +(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) + (cond + ((org-capture-get :exact-position) + (org-with-point-at (org-capture-get :exact-position) + (setq beg (line-beginning-position)) + (setq end (if (org-capture-get :insert-here) beg + (org-entry-end-position))))) + ((not (org-capture-get :target-entry-p)) + ;; Table is not necessarily under a heading. Find first table + ;; in the buffer. + (setq beg (point-min) end (point-max))) + (t + ;; We are at a heading, limit search to the body. + (setq beg (line-beginning-position 2)) + (setq end (save-excursion (outline-next-heading) (point))))) + (goto-char beg) + ;; Narrow to the table, possibly creating one if necessary. + (catch :found + (while (re-search-forward org-table-dataline-regexp end t) + (pcase (org-element-lineage (org-element-at-point) '(table) t) + (`nil nil) + ((pred (lambda (e) (eq 'table.el (org-element-property :type e)))) + nil) + (table + (goto-char (org-element-property :contents-end table)) + (narrow-to-region (org-element-property :post-affiliated table) + (point)) + (throw :found t)))) + ;; No table found. Create it with an empty header. + (goto-char end) + (unless (bolp) (insert "\n")) + (let ((origin (point))) + (insert "| |\n|---|\n") + (narrow-to-region origin (point)))) + ;; In the current table, find the appropriate location for TEXT. + (cond + ((org-capture-get :insert-here) nil) + ((and table-line-pos + (string-match "\\(I+\\)\\([-+][0-9]+\\)" table-line-pos)) + (goto-char (point-min)) + (let ((line + (condition-case _ + (progn + (save-match-data (org-table-analyze)) + (aref org-table-hlines + (- (match-end 1) (match-beginning 1)))) + (error + (error "Invalid table line specification %S" table-line-pos)))) + (delta (string-to-number (match-string 2 table-line-pos)))) + (forward-line (+ line delta (if (< delta 0) 0 -1))) + (forward-line))) ;insert below + ((org-capture-get :prepend) + (goto-char (point-min)) + (cond + ((not (re-search-forward org-table-hline-regexp nil t))) + ((re-search-forward org-table-dataline-regexp nil t) (beginning-of-line)) + (t (goto-char (org-table-end))))) + (t + (goto-char (org-table-end)))) + ;; Insert text and position point according to template. + (let ((origin (point))) + (unless (bolp) (insert "\n")) + (let ((beg (point)) + (end (save-excursion + (insert text) + (point)))) + (org-capture-position-for-last-stored 'table-line) + (org-capture-mark-kill-region origin end) + ;; TEXT is guaranteed to end with a newline character. Ignore + ;; it when narrowing so as to not alter data on the next line. + (org-capture-narrow beg (1- end)) + (org-capture--position-cursor beg (1- end)))))) + +(defun org-capture-place-plain-text () + "Place the template plainly. +If the target locator points at an Org node, place the template into +the text of the entry, before the first child. If not, place the +template at the beginning or end of the file. +Of course, if exact position has been required, just put it there." + (cond + ((org-capture-get :exact-position) + (goto-char (org-capture-get :exact-position))) + ((org-capture-get :target-entry-p) + ;; Place the text into this entry. + (if (org-capture-get :prepend) + ;; Skip meta data and drawers. + (org-end-of-meta-data t) + ;; Go to end of the entry text, before the next headline. + (outline-next-heading))) + (t + ;; Beginning or end of file. + (goto-char (if (org-capture-get :prepend) (point-min) (point-max))))) + (let ((origin (point))) + (unless (bolp) (insert "\n")) + (org-capture-empty-lines-before) + (org-capture-position-for-last-stored (point)) + (let ((beg (point))) + (insert (org-capture-get :template)) + (unless (bolp) (insert "\n")) + ;; Ignore the final newline character so as to not alter data + ;; after inserted text. Yet, if the template is empty, make + ;; sure END matches BEG instead of pointing before it. + (let ((end (max beg (1- (point))))) + (org-capture-empty-lines-after) + (org-capture-mark-kill-region origin (point)) + (org-capture-narrow beg end) + (org-capture--position-cursor beg end))))) + +(defun org-capture-mark-kill-region (beg end) + "Mark region between BEG and END to be killed on aborted capture." + (let ((m1 (copy-marker beg)) + (m2 (copy-marker end t))) + (org-capture-put :begin-marker m1) + (org-capture-put :end-marker m2))) + +(defun org-capture-position-for-last-stored (position) + "Put POSITION on `org-capture-plist' for future use as `last capture`." + (cond + ((integerp position) + (org-capture-put :position-for-last-stored + (move-marker (make-marker) position + (or (buffer-base-buffer (current-buffer)) + (current-buffer))))) + ((eq position 'table-line) + (org-capture-put :position-for-last-stored + (list 'table-line + (org-table-current-dline)))) + (t (error "This should not happen")))) + +(defun org-capture-store-last-position () + "Store the last-captured position." + (let* ((where (org-capture-get :position-for-last-stored 'local)) + (pos (cond + ((markerp where) + (prog1 (marker-position where) + (move-marker where nil))) + ((and (listp where) (eq (car where) 'table-line)) + (if (org-at-table-p) + (save-excursion + (org-table-goto-line (nth 1 where)) + (point-at-bol)) + (point)))))) + (with-current-buffer (buffer-base-buffer (current-buffer)) + (org-with-point-at pos + (when org-capture-bookmark + (let ((bookmark (plist-get org-bookmark-names-plist :last-capture))) + (when bookmark (with-demoted-errors (bookmark-set bookmark))))) + (move-marker org-capture-last-stored-marker (point)))))) + +(defun org-capture-narrow (beg end) + "Possibly narrow to region between BEG and END. +If configuration contains non-nil :unnarrowed property, do not narrow." + (unless (org-capture-get :unnarrowed) + (narrow-to-region beg end))) + +(defun org-capture--position-cursor (beg end) + "Move point to first \"%?\" location or at start of template. +BEG and END are buffer positions at the beginning and end position +of the template." + (goto-char beg) + (when (search-forward "%?" end t) + (replace-match ""))) + +(defun org-capture-empty-lines-before (&optional n) + "Insert N empty lines before the insertion point. +Point will be after the empty lines, so insertion can directly be done. +If N is nil, :empty-lines-before or :empty-lines are considered." + (setq n (or n (org-capture-get :empty-lines-before) + (org-capture-get :empty-lines) 0)) + (let ((pos (point))) + (org-back-over-empty-lines) + (delete-region (point) pos) + (when (> n 0) (newline n)))) + +(defun org-capture-empty-lines-after (&optional n) + "Set the correct number of empty lines after the inserted string. +Point will remain at the first line after the inserted text. +If N is nil, :empty-lines-after or :empty-lines are considered." + (setq n (or n (org-capture-get :empty-lines-after) + (org-capture-get :empty-lines) 0)) + (org-back-over-empty-lines) + (while (looking-at "[ \t]*\n") (replace-match "")) + (let ((pos (point))) + (when (> n 0) (newline n)) + (goto-char pos))) + +(defvar org-clock-marker) ; Defined in org.el + +(defun org-capture-set-plist (entry) + "Initialize the property list for ENTRY from the template definition." + (setq org-capture-plist (copy-sequence (nthcdr 5 entry))) + (org-capture-put :key (car entry) :description (nth 1 entry) + :target (nth 3 entry)) + (let ((txt (nth 4 entry)) (type (or (nth 2 entry) 'entry))) + (when (or (not txt) (and (stringp txt) (not (string-match "\\S-" txt)))) + ;; The template may be empty or omitted for special types. + ;; Here we insert the default templates for such cases. + (cond + ((eq type 'item) (setq txt "- %?")) + ((eq type 'checkitem) (setq txt "- [ ] %?")) + ((eq type 'table-line) (setq txt "| %? |")) + ((member type '(nil entry)) (setq txt "* %?\n %a")))) + (org-capture-put :template txt :type type))) + +(defun org-capture-goto-target (&optional template-key) + "Go to the target location of a capture template. +If TEMPLATE-KEY is nil, the user is queried for the template." + (interactive) + (let ((entry (org-capture-select-template template-key))) + (unless entry (error "No capture template selected")) + (org-capture-set-plist entry) + (org-capture-set-target-location) + (pop-to-buffer-same-window (org-capture-get :buffer)) + (goto-char (org-capture-get :pos)))) + +(defun org-capture-get-indirect-buffer (&optional buffer prefix) + "Make an indirect BUFFER for a capture process. +Use PREFIX as a prefix for the name of the indirect buffer." + (setq buffer (or buffer (current-buffer))) + (let ((n 1) (base (buffer-name buffer)) bname) + (setq bname (concat prefix "-" base)) + (while (buffer-live-p (get-buffer bname)) + (setq bname (concat prefix "-" (number-to-string (cl-incf n)) "-" base))) + (condition-case nil + (make-indirect-buffer buffer bname 'clone) + (error + (let ((buf (make-indirect-buffer buffer bname))) + (with-current-buffer buf (org-mode)) + buf))))) + +(defun org-capture-verify-tree (tree) + "Throw error if TREE is not a valid tree." + (unless (org-kill-is-subtree-p tree) + (error "Template is not a valid Org entry or tree"))) + +;;; The template code +(defun org-capture-select-template (&optional keys) + "Select a capture template. +Lisp programs can force the template by setting KEYS to a string." + (let ((org-capture-templates + (or (org-contextualize-keys + (org-capture-upgrade-templates org-capture-templates) + org-capture-templates-contexts) + '(("t" "Task" entry (file+headline "" "Tasks") + "* TODO %?\n %u\n %a"))))) + (if keys + (or (assoc keys org-capture-templates) + (error "No capture template referred to by \"%s\" keys" keys)) + (org-mks org-capture-templates + "Select a capture template\n=========================" + "Template key: " + '(("C" "Customize org-capture-templates") + ("q" "Abort")))))) + +(defvar org-capture--clipboards nil + "List various clipboards values.") + +(defun org-capture-fill-template (&optional template initial annotation) + "Fill a TEMPLATE and return the filled template as a string. +The template may still contain \"%?\" for cursor positioning. +INITIAL content and/or ANNOTATION may be specified, but will be overridden +by their respective `org-store-link-plist' properties if present." + (let* ((template (or template (org-capture-get :template))) + (buffer (org-capture-get :buffer)) + (file (buffer-file-name (or (buffer-base-buffer buffer) buffer))) + (time (let* ((c (or (org-capture-get :default-time) (current-time))) + (d (decode-time c))) + (if (< (nth 2 d) org-extend-today-until) + (encode-time 0 59 23 (1- (nth 3 d)) (nth 4 d) (nth 5 d)) + c))) + (v-t (format-time-string (org-time-stamp-format nil) time)) + (v-T (format-time-string (org-time-stamp-format t) time)) + (v-u (format-time-string (org-time-stamp-format nil t) time)) + (v-U (format-time-string (org-time-stamp-format t t) time)) + (v-c (and kill-ring (current-kill 0))) + (v-x (or (org-get-x-clipboard 'PRIMARY) + (org-get-x-clipboard 'CLIPBOARD) + (org-get-x-clipboard 'SECONDARY) + "")) ;ensure it is a string + ;; `initial' and `annotation' might have been passed. But if + ;; the property list has them, we prefer those values. + (v-i (or (plist-get org-store-link-plist :initial) + (and (stringp initial) (org-no-properties initial)) + (org-capture-get :initial) + "")) + (v-a + (let ((a (or (plist-get org-store-link-plist :annotation) + annotation + (org-capture-get :annotation) + ""))) + ;; Is the link empty? Then we do not want it... + (if (equal a "[[]]") "" a))) + (l-re "\\[\\[\\(.*?\\)\\]\\(\\[.*?\\]\\)?\\]") + (v-A (if (and v-a (string-match l-re v-a)) + (replace-match "[[\\1][%^{Link description}]]" nil nil v-a) + v-a)) + (v-l (if (and v-a (string-match l-re v-a)) + (replace-match "[[\\1]]" nil nil v-a) + v-a)) + (v-L (if (and v-a (string-match l-re v-a)) + (replace-match "\\1" nil nil v-a) + v-a)) + (v-n user-full-name) + (v-k (if (marker-buffer org-clock-marker) + (org-no-properties org-clock-heading) + "")) + (v-K (if (marker-buffer org-clock-marker) + (org-link-make-string + (format "%s::*%s" + (buffer-file-name (marker-buffer org-clock-marker)) + v-k) + v-k) + "")) + (v-f (or (org-capture-get :original-file-nondirectory) "")) + (v-F (or (org-capture-get :original-file) "")) + (org-capture--clipboards + (delq nil + (list v-i + (org-get-x-clipboard 'PRIMARY) + (org-get-x-clipboard 'CLIPBOARD) + (org-get-x-clipboard 'SECONDARY) + v-c)))) + (setq org-store-link-plist (plist-put org-store-link-plist :annotation v-a)) + (setq org-store-link-plist (plist-put org-store-link-plist :initial v-i)) + (unless template + (setq template "") + (message "no template") (ding) + (sit-for 1)) + (save-window-excursion + (org-switch-to-buffer-other-window (get-buffer-create "*Capture*")) + (erase-buffer) + (setq buffer-file-name nil) + (setq mark-active nil) + (insert template) + (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 "%%![couldn 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-time-stamp + 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 + (concat (or prompt "Enter string") + (and default (format " [%s]" 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)))))) + +(defun org-capture-escaped-% () + "Non-nil if % was escaped. +If yes, unescape it now. Assume `match-data' contains the +placeholder to check." + (save-excursion + (goto-char (match-beginning 0)) + (let ((n (abs (skip-chars-backward "\\\\")))) + (delete-char (/ (1+ n) 2)) + (= (% n 2) 1)))) + +(defun org-capture-expand-embedded-elisp (&optional mark) + "Evaluate embedded elisp %(sexp) and replace with the result. +When optional MARK argument is non-nil, mark Sexp with a text +property (`org-embedded-elisp') for later evaluation. Only +marked Sexp are evaluated when this argument is nil." + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "%(" nil t) + (cond + ((get-text-property (match-beginning 0) 'org-embedded-elisp) + (goto-char (match-beginning 0)) + (let ((template-start (point))) + (forward-char 1) + (let* ((sexp (read (current-buffer))) + (result (org-eval + (org-capture--expand-keyword-in-embedded-elisp + sexp)))) + (delete-region template-start (point)) + (cond + ((not result) nil) + ((stringp result) (insert result)) + (t (error + "Capture template sexp `%s' must evaluate to string or nil" + sexp)))))) + ((not mark) nil) + ;; Only mark valid and non-escaped sexp. + ((org-capture-escaped-%) nil) + (t + (let ((end (with-syntax-table emacs-lisp-mode-syntax-table + (ignore-errors (scan-sexps (1- (point)) 1))))) + (when end + (put-text-property (- (point) 2) end 'org-embedded-elisp t)))))))) + +(defun org-capture--expand-keyword-in-embedded-elisp (attr) + "Recursively replace capture link keywords in ATTR sexp. +Such keywords are prefixed with \"%:\". See +`org-capture-template' for more information." + (cond ((consp attr) + (mapcar 'org-capture--expand-keyword-in-embedded-elisp attr)) + ((symbolp attr) + (let* ((attr-symbol (symbol-name attr)) + (key (and (string-match "%\\(:.*\\)" attr-symbol) + (intern (match-string 1 attr-symbol))))) + (or (plist-get org-store-link-plist key) + attr))) + (t attr))) + +(defun org-capture-inside-embedded-elisp-p () + "Non-nil if point is inside of embedded elisp %(sexp). +Assume sexps have been marked with +`org-capture-expand-embedded-elisp' beforehand." + (get-text-property (point) 'org-embedded-elisp)) + +;;;###autoload +(defun org-capture-import-remember-templates () + "Set `org-capture-templates' to be similar to `org-remember-templates'." + (interactive) + (when (and (yes-or-no-p + "Import old remember templates into org-capture-templates? ") + (yes-or-no-p + "Note that this will remove any templates currently defined in `org-capture-templates'. Do you still want to go ahead? ")) + (require 'org-remember) + (setq org-capture-templates + (mapcar + (lambda (entry) + (let ((desc (car entry)) + (key (char-to-string (nth 1 entry))) + (template (nth 2 entry)) + (file (or (nth 3 entry) org-default-notes-file)) + (position (or (nth 4 entry) org-remember-default-headline)) + (type 'entry) + (prepend org-reverse-note-order) + immediate target jump-to-captured) + (cond + ((member position '(top bottom)) + (setq target (list 'file file) + prepend (eq position 'top))) + ((eq position 'date-tree) + (setq target (list 'file+datetree file) + prepend nil)) + (t (setq target (list 'file+headline file position)))) + + (when (string-match "%!" template) + (setq template (replace-match "" t t template) + immediate t)) + + (when (string-match "%&" template) + (setq jump-to-captured t)) + + (append (list key desc type target template) + (and prepend '(:prepend t)) + (and immediate '(:immediate-finish t)) + (and jump-to-captured '(:jump-to-captured t))))) + + org-remember-templates)))) + + +(provide 'org-capture) + +;;; org-capture.el ends here diff --git a/elpa/org-9.5.2/org-capture.elc b/elpa/org-9.5.2/org-capture.elc new file mode 100644 index 0000000..81e653c Binary files /dev/null and b/elpa/org-9.5.2/org-capture.elc differ diff --git a/elpa/org-9.5.2/org-clock.el b/elpa/org-9.5.2/org-clock.el new file mode 100644 index 0000000..143ed4f --- /dev/null +++ b/elpa/org-9.5.2/org-clock.el @@ -0,0 +1,3149 @@ +;;; org-clock.el --- The time clocking code for Org mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the time clocking code for Org mode + +;;; Code: + +(require 'cl-lib) +(require 'org) + +(declare-function calendar-iso-to-absolute "cal-iso" (date)) +(declare-function notifications-notify "notifications" (&rest params)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-inlinetask-at-task-p "org-inlinetask" ()) +(declare-function org-inlinetask-goto-beginning "org-inlinetask" ()) +(declare-function org-inlinetask-goto-end "org-inlinetask" ()) +(declare-function org-inlinetask-in-task-p "org-inlinetask" ()) +(declare-function org-link-display-format "ol" (s)) +(declare-function org-link-heading-search-string "ol" (&optional string)) +(declare-function org-link-make-string "ol" (link &optional description)) +(declare-function org-table-goto-line "org-table" (n)) +(declare-function org-dynamic-block-define "org" (type func)) +(declare-function w32-notification-notify "w32fns.c" (&rest params)) +(declare-function w32-notification-close "w32fns.c" (&rest params)) + +(defvar org-frame-title-format-backup nil) +(defvar org-state) +(defvar org-link-bracket-re) +(defvar org-time-stamp-formats) + +(defgroup org-clock nil + "Options concerning clocking working time in Org mode." + :tag "Org Clock" + :group 'org-progress) + +(defcustom org-clock-into-drawer t + "Non-nil when clocking info should be wrapped into a drawer. + +When non-nil, clocking info will be inserted into the same drawer +as log notes (see variable `org-log-into-drawer'), if it exists, +or \"LOGBOOK\" otherwise. If necessary, the drawer will be +created. + +When an integer, the drawer is created only when the number of +clocking entries in an item reaches or exceeds this value. + +When a string, it becomes the name of the drawer, ignoring the +log notes drawer altogether. + +Do not check directly this variable in a Lisp program. Call +function `org-clock-into-drawer' instead." + :group 'org-todo + :group 'org-clock + :version "26.1" + :package-version '(Org . "8.3") + :type '(choice + (const :tag "Always" t) + (const :tag "Only when drawer exists" nil) + (integer :tag "When at least N clock entries") + (const :tag "Into LOGBOOK drawer" "LOGBOOK") + (string :tag "Into Drawer named..."))) + +(defun org-clock-into-drawer () + "Value of `org-clock-into-drawer', but let properties overrule. + +If the current entry has or inherits a CLOCK_INTO_DRAWER +property, it will be used instead of the default value. + +Return value is either a string, an integer, or nil." + (let ((p (org-entry-get nil "CLOCK_INTO_DRAWER" 'inherit t))) + (cond ((equal p "nil") nil) + ((equal p "t") (or (org-log-into-drawer) "LOGBOOK")) + ((org-string-nw-p p) + (if (string-match-p "\\`[0-9]+\\'" p) (string-to-number p) p)) + ((org-string-nw-p org-clock-into-drawer)) + ((integerp org-clock-into-drawer) org-clock-into-drawer) + ((not org-clock-into-drawer) nil) + ((org-log-into-drawer)) + (t "LOGBOOK")))) + +(defcustom org-clock-out-when-done t + "When non-nil, clock will be stopped when the clocked entry is marked DONE. +\\\ +DONE here means any DONE-like state. +A nil value means clock will keep running until stopped explicitly with +`\\[org-clock-out]', or until the clock is started in a different item. +Instead of t, this can also be a list of TODO states that should trigger +clocking out." + :group 'org-clock + :type '(choice + (const :tag "No" nil) + (const :tag "Yes, when done" t) + (repeat :tag "State list" + (string :tag "TODO keyword")))) + +(defcustom org-clock-rounding-minutes 0 + "Rounding minutes when clocking in or out. +The default value is 0 so that no rounding is done. +When set to a non-integer value, use the car of +`org-time-stamp-rounding-minutes', like for setting a time-stamp. + +E.g. if `org-clock-rounding-minutes' is set to 5, time is 14:47 +and you clock in: then the clock starts at 14:45. If you clock +out within the next 5 minutes, the clock line will be removed; +if you clock out 8 minutes after your clocked in, the clock +out time will be 14:50." + :group 'org-clock + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (integer :tag "Minutes (0 for no rounding)") + (symbol :tag "Use `org-time-stamp-rounding-minutes'" 'same-as-time-stamp))) + +(defcustom org-clock-out-remove-zero-time-clocks nil + "Non-nil means remove the clock line when the resulting time is zero." + :group 'org-clock + :type 'boolean) + +(defcustom org-clock-in-switch-to-state nil + "Set task to a special todo state while clocking it. +The value should be the state to which the entry should be +switched. If the value is a function, it must take one +parameter (the current TODO state of the item) and return the +state to switch it to." + :group 'org-clock + :group 'org-todo + :type '(choice + (const :tag "Don't force a state" nil) + (string :tag "State") + (symbol :tag "Function"))) + +(defcustom org-clock-out-switch-to-state nil + "Set task to a special todo state after clocking out. +The value should be the state to which the entry should be +switched. If the value is a function, it must take one +parameter (the current TODO state of the item) and return the +state to switch it to." + :group 'org-clock + :group 'org-todo + :type '(choice + (const :tag "Don't force a state" nil) + (string :tag "State") + (symbol :tag "Function"))) + +(defcustom org-clock-history-length 5 + "Number of clock tasks to remember in history. +Clocking in using history works best if this is at most 35, in +which case all digits and capital letters are used up by the +*Clock Task Select* buffer." + :group 'org-clock + :type 'integer) + +(defcustom org-clock-goto-may-find-recent-task t + "Non-nil means `org-clock-goto' can go to recent task if no active clock." + :group 'org-clock + :type 'boolean) + +(defcustom org-clock-heading-function nil + "When non-nil, should be a function to create `org-clock-heading'. +This is the string shown in the mode line when a clock is running. +The function is called with point at the beginning of the headline." + :group 'org-clock + :type '(choice (const nil) (function))) + +(defcustom org-clock-string-limit 0 + "Maximum length of clock strings in the mode line. 0 means no limit." + :group 'org-clock + :type 'integer) + +(defcustom org-clock-in-resume nil + "If non-nil, resume clock when clocking into task with open clock. +When clocking into a task with a clock entry which has not been closed, +the clock can be resumed from that point." + :group 'org-clock + :type 'boolean) + +(defcustom org-clock-persist nil + "When non-nil, save the running clock when Emacs is closed. +The clock is resumed when Emacs restarts. +When this is t, both the running clock, and the entire clock +history are saved. When this is the symbol `clock', only the +running clock is saved. When this is the symbol `history', only +the clock history is saved. + +When Emacs restarts with saved clock information, the file containing +the running clock as well as all files mentioned in the clock history +will be visited. + +All this depends on running `org-clock-persistence-insinuate' in your +Emacs initialization file." + :group 'org-clock + :type '(choice + (const :tag "Just the running clock" clock) + (const :tag "Just the history" history) + (const :tag "Clock and history" t) + (const :tag "No persistence" nil))) + +(defcustom org-clock-persist-file (convert-standard-filename + (concat user-emacs-directory "org-clock-save.el")) + "File to save clock data to." + :group 'org-clock + :type 'string) + +(defcustom org-clock-persist-query-save nil + "When non-nil, ask before saving the current clock on exit." + :group 'org-clock + :type 'boolean) + +(defcustom org-clock-persist-query-resume t + "When non-nil, ask before resuming any stored clock during load." + :group 'org-clock + :type 'boolean) + +(defcustom org-clock-sound nil + "Sound to use for notifications. +Possible values are: + +nil No sound played +t Standard Emacs beep +file name Play this sound file, fall back to beep" + :group 'org-clock + :type '(choice + (const :tag "No sound" nil) + (const :tag "Standard beep" t) + (file :tag "Play sound file"))) + +(defcustom org-clock-mode-line-total 'auto + "Default setting for the time included for the mode line clock. +This can be overruled locally using the CLOCK_MODELINE_TOTAL property. +Allowed values are: + +current Only the time in the current instance of the clock +today All time clocked into this task today +repeat All time clocked into this task since last repeat +all All time ever recorded for this task +auto Automatically, either `all', or `repeat' for repeating tasks" + :group 'org-clock + :type '(choice + (const :tag "Current clock" current) + (const :tag "Today's task time" today) + (const :tag "Since last repeat" repeat) + (const :tag "All task time" all) + (const :tag "Automatically, `all' or since `repeat'" auto))) + +(defvaralias 'org-task-overrun-text 'org-clock-task-overrun-text) +(defcustom org-clock-task-overrun-text nil + "Extra mode line text to indicate that the clock is overrun. +The can be nil to indicate that instead of adding text, the clock time +should get a different face (`org-mode-line-clock-overrun'). +When this is a string, it is prepended to the clock string as an indication, +also using the face `org-mode-line-clock-overrun'." + :group 'org-clock + :version "24.1" + :type '(choice + (const :tag "Just mark the time string" nil) + (string :tag "Text to prepend"))) + +(defcustom org-show-notification-timeout 3 + "Number of seconds to wait before closing Org notifications. +This is applied to notifications sent with `notifications-notify' +and `w32-notification-notify' only, not other mechanisms possibly +set through `org-show-notification-handler'." + :group 'org-clock + :package-version '(Org . "9.4") + :type 'integer) + +(defcustom org-show-notification-handler nil + "Function or program to send notification with. +The function or program will be called with the notification +string as argument." + :group 'org-clock + :type '(choice + (const nil) + (string :tag "Program") + (function :tag "Function"))) + +(defgroup org-clocktable nil + "Options concerning the clock table in Org mode." + :tag "Org Clock Table" + :group 'org-clock) + +(defcustom org-clocktable-defaults + (list + :maxlevel 2 + :lang (or (bound-and-true-p org-export-default-language) "en") + :scope 'file + :block nil + :wstart 1 + :mstart 1 + :tstart nil + :tend nil + :step nil + :stepskip0 nil + :fileskip0 nil + :tags nil + :match nil + :emphasize nil + :link nil + :narrow '40! + :indent t + :hidefiles nil + :formula nil + :timestamp nil + :level nil + :tcolumns nil + :formatter nil) + "Default properties for clock tables." + :group 'org-clock + :version "24.1" + :type 'plist) + +(defcustom org-clock-clocktable-formatter 'org-clocktable-write-default + "Function to turn clocking data into a table. +For more information, see `org-clocktable-write-default'." + :group 'org-clocktable + :version "24.1" + :type 'function) + +;; FIXME: translate es and nl last string "Clock summary at" +(defcustom org-clock-clocktable-language-setup + '(("en" "File" "L" "Timestamp" "Headline" "Time" "ALL" "Total time" "File time" "Clock summary at") + ("es" "Archivo" "N" "Fecha y hora" "Tarea" "Tiempo" "TODO" "Tiempo total" "Tiempo archivo" "Clock summary at") + ("fr" "Fichier" "N" "Horodatage" "En-tête" "Durée" "TOUT" "Durée totale" "Durée fichier" "Horodatage sommaire à") + ("nl" "Bestand" "N" "Tijdstip" "Hoofding" "Duur" "ALLES" "Totale duur" "Bestandstijd" "Clock summary at") + ("de" "Datei" "E" "Zeitstempel" "Kopfzeile" "Dauer" "GESAMT" + "Gesamtdauer" "Dateizeit" "Erstellt am")) + "Terms used in clocktable, translated to different languages." + :group 'org-clocktable + :version "24.1" + :type 'alist) + +(defcustom org-clock-clocktable-default-properties '(:maxlevel 2) + "Default properties for new clocktables. +These will be inserted into the BEGIN line, to make it easy for users to +play with them." + :group 'org-clocktable + :package-version '(Org . "9.2") + :type 'plist) + +(defcustom org-clock-idle-time nil + "When non-nil, resolve open clocks if the user is idle more than X minutes." + :group 'org-clock + :type '(choice + (const :tag "Never" nil) + (integer :tag "After N minutes"))) + +(defcustom org-clock-auto-clock-resolution 'when-no-clock-is-running + "When to automatically resolve open clocks found in Org buffers." + :group 'org-clock + :type '(choice + (const :tag "Never" nil) + (const :tag "Always" t) + (const :tag "When no clock is running" when-no-clock-is-running))) + +(defcustom org-clock-report-include-clocking-task nil + "When non-nil, include the current clocking task time in clock reports." + :group 'org-clock + :version "24.1" + :type 'boolean) + +(defcustom org-clock-resolve-expert nil + "Non-nil means do not show the splash buffer with the clock resolver." + :group 'org-clock + :version "24.1" + :type 'boolean) + +(defcustom org-clock-continuously nil + "Non-nil means to start clocking from the last clock-out time, if any." + :type 'boolean + :version "24.1" + :group 'org-clock) + +(defcustom org-clock-total-time-cell-format "*%s*" + "Format string for the total time cells." + :group 'org-clock + :version "24.1" + :type 'string) + +(defcustom org-clock-file-time-cell-format "*%s*" + "Format string for the file time cells." + :group 'org-clock + :version "24.1" + :type 'string) + +(defcustom org-clock-clocked-in-display 'mode-line + "When clocked in for a task, Org can display the current +task and accumulated time in the mode line and/or frame title. +Allowed values are: + +both displays in both mode line and frame title +mode-line displays only in mode line (default) +frame-title displays only in frame title +nil current clock is not displayed" + :group 'org-clock + :type '(choice + (const :tag "Mode line" mode-line) + (const :tag "Frame title" frame-title) + (const :tag "Both" both) + (const :tag "None" nil))) + +(defcustom org-clock-frame-title-format '(t org-mode-line-string) + "The value for `frame-title-format' when clocking in. + +When `org-clock-clocked-in-display' is set to `frame-title' +or `both', clocking in will replace `frame-title-format' with +this value. Clocking out will restore `frame-title-format'. + +`org-frame-title-string' is a format string using the same +specifications than `frame-title-format', which see." + :version "24.1" + :group 'org-clock + :type 'sexp) + +(defcustom org-clock-x11idle-program-name "x11idle" + "Name of the program which prints X11 idle time in milliseconds. + +you can do \"~$ sudo apt-get install xprintidle\" if you are using +a Debian-based distribution. + +Alternatively, can find x11idle.c in the org-contrib repository at +https://git.sr.ht/~bzg/org-contrib" + :group 'org-clock + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-clock-goto-before-context 2 + "Number of lines of context to display before currently clocked-in entry. +This applies when using `org-clock-goto'." + :group 'org-clock + :type 'integer) + +(defcustom org-clock-display-default-range 'thisyear + "Default range when displaying clocks with `org-clock-display'. +Valid values are: `today', `yesterday', `thisweek', `lastweek', +`thismonth', `lastmonth', `thisyear', `lastyear' and `untilnow'." + :group 'org-clock + :type '(choice (const today) + (const yesterday) + (const thisweek) + (const lastweek) + (const thismonth) + (const lastmonth) + (const thisyear) + (const lastyear) + (const untilnow) + (const :tag "Select range interactively" interactive)) + :safe #'symbolp) + +(defcustom org-clock-auto-clockout-timer nil + "Timer for auto clocking out when Emacs is idle. +When set to a number, auto clock out the currently clocked in +task after this number of seconds of idle time. + +This is only effective when `org-clock-auto-clockout-insinuate' +is added to the user configuration." + :group 'org-clock + :package-version '(Org . "9.4") + :type '(choice + (integer :tag "Clock out after Emacs is idle for X seconds") + (const :tag "Never auto clock out" nil))) + +(defcustom org-clock-ask-before-exiting t + "If non-nil, ask if the user wants to clock out before exiting Emacs. +This variable only has effect if set with \\[customize]." + :set (lambda (symbol value) + (if value + (add-hook 'kill-emacs-query-functions #'org-clock-kill-emacs-query) + (remove-hook 'kill-emacs-query-functions #'org-clock-kill-emacs-query)) + (set symbol value)) + :type 'boolean + :package-version '(Org . "9.5")) + +(defvar org-clock-in-prepare-hook nil + "Hook run when preparing the clock. +This hook is run before anything happens to the task that +you want to clock in. For example, you can use this hook +to add an effort property.") +(defvar org-clock-in-hook nil + "Hook run when starting the clock.") +(defvar org-clock-out-hook nil + "Hook run when stopping the current clock.") + +(defvar org-clock-cancel-hook nil + "Hook run when canceling the current clock.") +(defvar org-clock-goto-hook nil + "Hook run when selecting the currently clocked-in entry.") +(defvar org-clock-has-been-used nil + "Has the clock been used during the current Emacs session?") + +(defvar org-clock-stored-history nil + "Clock history, populated by `org-clock-load'.") +(defvar org-clock-stored-resume-clock nil + "Clock to resume, saved by `org-clock-load'.") + +;;; The clock for measuring work time. + +(defvar org-mode-line-string "") +(put 'org-mode-line-string 'risky-local-variable t) + +(defvar org-clock-mode-line-timer nil) +(defvar org-clock-idle-timer nil) +(defvar org-clock-heading) ; defined in org.el +(defvar org-clock-start-time "") + +(defvar org-clock-leftover-time nil + "If non-nil, user canceled a clock; this is when leftover time started.") + +(defvar org-clock-effort "" + "Effort estimate of the currently clocking task.") + +(defvar org-clock-total-time nil + "Holds total time, spent previously on currently clocked item. +This does not include the time in the currently running clock.") + +(defvar org-clock-history nil + "List of marker pointing to recent clocked tasks.") + +(defvar org-clock-default-task (make-marker) + "Marker pointing to the default task that should clock time. +The clock can be made to switch to this task after clocking out +of a different task.") + +(defvar org-clock-interrupted-task (make-marker) + "Marker pointing to the task that has been interrupted by the current clock.") + +(defvar org-clock-mode-line-map (make-sparse-keymap)) +(define-key org-clock-mode-line-map [mode-line mouse-2] #'org-clock-goto) +(define-key org-clock-mode-line-map [mode-line mouse-1] #'org-clock-menu) + +(defun org-clock--translate (s language) + "Translate string S into using string LANGUAGE. +Assume S in the English term to translate. Return S as-is if it +cannot be translated." + (or (nth (pcase s + ("File" 1) ("L" 2) ("Timestamp" 3) ("Headline" 4) ("Time" 5) + ("ALL" 6) ("Total time" 7) ("File time" 8) ("Clock summary at" 9)) + (assoc-string language org-clock-clocktable-language-setup t)) + s)) + +(defun org-clock--mode-line-heading () + "Return currently clocked heading, formatted for mode line." + (cond ((functionp org-clock-heading-function) + (funcall org-clock-heading-function)) + ((org-before-first-heading-p) "???") + (t (org-link-display-format + (org-no-properties (org-get-heading t t t t)))))) + +(defun org-clock-menu () + (interactive) + (popup-menu + '("Clock" + ["Clock out" org-clock-out t] + ["Change effort estimate" org-clock-modify-effort-estimate t] + ["Go to clock entry" org-clock-goto t] + ["Switch task" (lambda () (interactive) (org-clock-in '(4))) :active t :keys "C-u C-c C-x C-i"]))) + +(defun org-clock-history-push (&optional pos buffer) + "Push a marker to the clock history." + (setq org-clock-history-length (max 1 org-clock-history-length)) + (let ((m (move-marker (make-marker) + (or pos (point)) (org-base-buffer + (or buffer (current-buffer))))) + n l) + (while (setq n (member m org-clock-history)) + (move-marker (car n) nil)) + (setq org-clock-history + (delq nil + (mapcar (lambda (x) (if (marker-buffer x) x nil)) + org-clock-history))) + (when (>= (setq l (length org-clock-history)) org-clock-history-length) + (setq org-clock-history + (nreverse + (nthcdr (- l org-clock-history-length -1) + (nreverse org-clock-history))))) + (push m org-clock-history))) + +(defun org-clock-save-markers-for-cut-and-paste (beg end) + "Save relative positions of markers in region." + (org-check-and-save-marker org-clock-marker beg end) + (org-check-and-save-marker org-clock-hd-marker beg end) + (org-check-and-save-marker org-clock-default-task beg end) + (org-check-and-save-marker org-clock-interrupted-task beg end) + (dolist (m org-clock-history) + (org-check-and-save-marker m beg end))) + +(defun org-clock-drawer-name () + "Return clock drawer's name for current entry, or nil." + (let ((drawer (org-clock-into-drawer))) + (cond ((integerp drawer) + (let ((log-drawer (org-log-into-drawer))) + (if (stringp log-drawer) log-drawer "LOGBOOK"))) + ((stringp drawer) drawer) + (t nil)))) + +(defun org-clocking-p () + "Return t when clocking a task." + (not (equal (org-clocking-buffer) nil))) + +(defvar org-clock-before-select-task-hook nil + "Hook called in task selection just before prompting the user.") + +(defun org-clock-select-task (&optional prompt) + "Select a task that was recently associated with clocking. +Return marker position of the selected task. Raise an error if +there is no recent clock to choose from." + (let (och chl sel-list rpl (i 0) s) + ;; Remove successive dups from the clock history to consider + (dolist (c org-clock-history) + (unless (equal c (car och)) (push c och))) + (setq och (reverse och) chl (length och)) + (if (zerop chl) + (user-error "No recent clock") + (save-window-excursion + (org-switch-to-buffer-other-window + (get-buffer-create "*Clock Task Select*")) + (erase-buffer) + (when (marker-buffer org-clock-default-task) + (insert (org-add-props "Default Task\n" nil 'face 'bold)) + (setq s (org-clock-insert-selection-line ?d org-clock-default-task)) + (push s sel-list)) + (when (marker-buffer org-clock-interrupted-task) + (insert (org-add-props "The task interrupted by starting the last one\n" nil 'face 'bold)) + (setq s (org-clock-insert-selection-line ?i org-clock-interrupted-task)) + (push s sel-list)) + (when (org-clocking-p) + (insert (org-add-props "Current Clocking Task\n" nil 'face 'bold)) + (setq s (org-clock-insert-selection-line ?c org-clock-marker)) + (push s sel-list)) + (insert (org-add-props "Recent Tasks\n" nil 'face 'bold)) + (dolist (m och) + (when (marker-buffer m) + (setq i (1+ i) + s (org-clock-insert-selection-line + (if (< i 10) + (+ i ?0) + (+ i (- ?A 10))) m)) + (if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s)))) + (push s sel-list))) + (run-hooks 'org-clock-before-select-task-hook) + (goto-char (point-min)) + ;; Set min-height relatively to circumvent a possible but in + ;; `fit-window-to-buffer' + (fit-window-to-buffer nil nil (if (< chl 10) chl (+ 5 chl))) + (message (or prompt "Select task for clocking:")) + (setq cursor-type nil rpl (read-char-exclusive)) + (kill-buffer) + (cond + ((eq rpl ?q) nil) + ((eq rpl ?x) nil) + ((assoc rpl sel-list) (cdr (assoc rpl sel-list))) + (t (user-error "Invalid task choice %c" rpl))))))) + +(defun org-clock-insert-selection-line (i marker) + "Insert a line for the clock selection menu. +And return a cons cell with the selection character integer and the marker +pointing to it." + (when (marker-buffer marker) + (let (cat task heading prefix) + (with-current-buffer (org-base-buffer (marker-buffer marker)) + (org-with-wide-buffer + (ignore-errors + (goto-char marker) + (setq cat (org-get-category) + heading (org-get-heading 'notags) + prefix (save-excursion + (org-back-to-heading t) + (looking-at org-outline-regexp) + (match-string 0)) + task (substring + (org-fontify-like-in-org-mode + (concat prefix heading) + org-odd-levels-only) + (length prefix)))))) + (when (and cat task) + (insert (format "[%c] %-12s %s\n" i cat task)) + (cons i marker))))) + +(defvar org-clock-task-overrun nil + "Internal flag indicating if the clock has overrun the planned time.") +(defvar org-clock-update-period 60 + "Number of seconds between mode line clock string updates.") + +(defun org-clock-get-clock-string () + "Form a clock-string, that will be shown in the mode line. +If an effort estimate was defined for the current item, use +01:30/01:50 format (clocked/estimated). +If not, show simply the clocked time like 01:50." + (let ((clocked-time (org-clock-get-clocked-time))) + (if org-clock-effort + (let* ((effort-in-minutes (org-duration-to-minutes org-clock-effort)) + (work-done-str + (propertize (org-duration-from-minutes clocked-time) + 'face + (if (and org-clock-task-overrun + (not org-clock-task-overrun-text)) + 'org-mode-line-clock-overrun + 'org-mode-line-clock))) + (effort-str (org-duration-from-minutes effort-in-minutes))) + (format (propertize " [%s/%s] (%s)" 'face 'org-mode-line-clock) + work-done-str effort-str org-clock-heading)) + (format (propertize " [%s] (%s)" 'face 'org-mode-line-clock) + (org-duration-from-minutes clocked-time) + org-clock-heading)))) + +(defun org-clock-get-last-clock-out-time () + "Get the last clock-out time for the current subtree." + (save-excursion + (let ((end (save-excursion (org-end-of-subtree)))) + (when (re-search-forward (concat org-clock-string + ".*\\]--\\(\\[[^]]+\\]\\)") + end t) + (org-time-string-to-time (match-string 1)))))) + +(defun org-clock-update-mode-line (&optional refresh) + "Update mode line with clock information. +When optional argument is non-nil, refresh cached heading." + (if org-clock-effort + (org-clock-notify-once-if-expired) + (setq org-clock-task-overrun nil)) + (when refresh (setq org-clock-heading (org-clock--mode-line-heading))) + (setq org-mode-line-string + (propertize + (let ((clock-string (org-clock-get-clock-string)) + (help-text "Org mode clock is running.\nmouse-1 shows a \ +menu\nmouse-2 will jump to task")) + (if (and (> org-clock-string-limit 0) + (> (length clock-string) org-clock-string-limit)) + (propertize + (substring clock-string 0 org-clock-string-limit) + 'help-echo (concat help-text ": " org-clock-heading)) + (propertize clock-string 'help-echo help-text))) + 'local-map org-clock-mode-line-map + 'mouse-face 'mode-line-highlight)) + (if (and org-clock-task-overrun org-clock-task-overrun-text) + (setq org-mode-line-string + (concat (propertize + org-clock-task-overrun-text + 'face 'org-mode-line-clock-overrun) + org-mode-line-string))) + (force-mode-line-update)) + +(defun org-clock-get-clocked-time () + "Get the clocked time for the current item in minutes. +The time returned includes the time spent on this task in +previous clocking intervals." + (let ((currently-clocked-time + (floor (org-time-convert-to-integer + (org-time-since org-clock-start-time)) + 60))) + (+ currently-clocked-time (or org-clock-total-time 0)))) + +(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. +When the string starts with a + or a - sign, the current value of the effort +property will be changed by that amount. If the effort value is expressed +as an unit defined in `org-duration-units' (e.g. \"3h\"), the modified +value will be converted to a hh:mm duration. + +This command will update the \"Effort\" property of the currently +clocked item, and the value displayed in the mode line." + (interactive) + (if (org-clock-is-active) + (let ((current org-clock-effort) sign) + (unless value + ;; Prompt user for a value or a change + (setq value + (read-string + (format "Set effort (hh:mm or mm%s): " + (if current + (format ", prefix + to add to %s" org-clock-effort) + ""))))) + (when (stringp value) + ;; A string. See if it is a delta + (setq sign (string-to-char value)) + (if (member sign '(?- ?+)) + (setq current (org-duration-to-minutes current) + value (substring value 1)) + (setq current 0)) + (setq value (org-duration-to-minutes value)) + (if (equal ?- sign) + (setq value (- current value)) + (if (equal ?+ sign) (setq value (+ current value))))) + (setq value (max 0 value) + org-clock-effort (org-duration-from-minutes value)) + (org-entry-put org-clock-marker "Effort" org-clock-effort) + (org-clock-update-mode-line) + (message "Effort is now %s" org-clock-effort)) + (message "Clock is not currently active"))) + +(defvar org-clock-notification-was-shown nil + "Shows if we have shown notification already.") + +(defun org-clock-notify-once-if-expired () + "Show notification if we spent more time than we estimated before. +Notification is shown only once." + (when (org-clocking-p) + (let ((effort-in-minutes (org-duration-to-minutes org-clock-effort)) + (clocked-time (org-clock-get-clocked-time))) + (if (setq org-clock-task-overrun + (if (or (null effort-in-minutes) (zerop effort-in-minutes)) + nil + (>= clocked-time effort-in-minutes))) + (unless org-clock-notification-was-shown + (setq org-clock-notification-was-shown t) + (org-notify + (format-message "Task `%s' should be finished by now. (%s)" + org-clock-heading org-clock-effort) + org-clock-sound)) + (setq org-clock-notification-was-shown nil))))) + +(defun org-notify (notification &optional play-sound) + "Send a NOTIFICATION and maybe PLAY-SOUND. +If PLAY-SOUND is non-nil, it overrides `org-clock-sound'." + (org-show-notification notification) + (if play-sound (org-clock-play-sound play-sound))) + +(defun org-show-notification (notification) + "Show notification. +Use `org-show-notification-handler' if defined, +use libnotify if available, or fall back on a message." + (ignore-errors (require 'notifications)) + (cond ((functionp org-show-notification-handler) + (funcall org-show-notification-handler notification)) + ((stringp org-show-notification-handler) + (start-process "emacs-timer-notification" nil + org-show-notification-handler notification)) + ((fboundp 'w32-notification-notify) + (let ((id (w32-notification-notify + :title "Org mode message" + :body notification + :urgency 'low))) + (run-with-timer + org-show-notification-timeout + nil + (lambda () (w32-notification-close id))))) + ((fboundp 'ns-do-applescript) + (ns-do-applescript + (format "display notification \"%s\" with title \"Org mode notification\"" + (replace-regexp-in-string "\"" "#" notification)))) + ((fboundp 'notifications-notify) + (notifications-notify + :title "Org mode message" + :body notification + :timeout (* org-show-notification-timeout 1000) + ;; FIXME how to link to the Org icon? + ;; :app-icon "~/.emacs.d/icons/mail.png" + :urgency 'low)) + ((executable-find "notify-send") + (start-process "emacs-timer-notification" nil + "notify-send" notification)) + ;; Maybe the handler will send a message, so only use message as + ;; a fall back option + (t (message "%s" notification)))) + +(defun org-clock-play-sound (&optional clock-sound) + "Play sound as configured by `org-clock-sound'. +Use alsa's aplay tool if available. +If CLOCK-SOUND is non-nil, it overrides `org-clock-sound'." + (let ((org-clock-sound (or clock-sound org-clock-sound))) + (cond + ((not org-clock-sound)) + ((eq org-clock-sound t) (beep t) (beep t)) + ((stringp org-clock-sound) + (let ((file (expand-file-name org-clock-sound))) + (if (file-exists-p file) + (if (executable-find "aplay") + (start-process "org-clock-play-notification" nil + "aplay" file) + (condition-case nil + (play-sound-file file) + (error (beep t) (beep t)))))))))) + +(defvar org-clock-mode-line-entry nil + "Information for the mode line about the running clock.") + +(defun org-find-open-clocks (file) + "Search through the given file and find all open clocks." + (let ((buf (or (get-file-buffer file) + (find-file-noselect file))) + (org-clock-re (concat org-clock-string " \\(\\[.*?\\]\\)$")) + clocks) + (with-current-buffer buf + (save-excursion + (goto-char (point-min)) + (while (re-search-forward org-clock-re nil t) + (push (cons (copy-marker (match-end 1) t) + (org-time-string-to-time (match-string 1))) + clocks)))) + clocks)) + +(defsubst org-is-active-clock (clock) + "Return t if CLOCK is the currently active clock." + (and (org-clock-is-active) + (= org-clock-marker (car clock)))) + +(defmacro org-with-clock-position (clock &rest forms) + "Evaluate FORMS with CLOCK as the current active clock." + (declare (indent 1) (debug t)) + `(with-current-buffer (marker-buffer (car ,clock)) + (org-with-wide-buffer + (goto-char (car ,clock)) + (beginning-of-line) + ,@forms))) + +(defmacro org-with-clock (clock &rest forms) + "Evaluate FORMS with CLOCK as the current active clock. +This macro also protects the current active clock from being altered." + (declare (indent 1) (debug t)) + `(org-with-clock-position ,clock + (let ((org-clock-start-time (cdr ,clock)) + (org-clock-total-time) + (org-clock-history) + (org-clock-effort) + (org-clock-marker (car ,clock)) + (org-clock-hd-marker (save-excursion + (org-back-to-heading t) + (point-marker)))) + ,@forms))) + +(defsubst org-clock-clock-in (clock &optional resume start-time) + "Clock in to the clock located by CLOCK. +If necessary, clock-out of the currently active clock." + (org-with-clock-position clock + (let ((org-clock-in-resume (or resume org-clock-in-resume))) + (org-clock-in nil start-time)))) + +(defsubst org-clock-clock-out (clock &optional fail-quietly at-time) + "Clock out of the clock located by CLOCK." + (let ((temp (copy-marker (car clock) + (marker-insertion-type (car clock))))) + (if (org-is-active-clock clock) + (org-clock-out nil fail-quietly at-time) + (org-with-clock clock + (org-clock-out nil fail-quietly at-time))) + (setcar clock temp))) + +(defsubst org-clock-clock-cancel (clock) + "Cancel the clock located by CLOCK." + (let ((temp (copy-marker (car clock) + (marker-insertion-type (car clock))))) + (if (org-is-active-clock clock) + (org-clock-cancel) + (org-with-clock clock + (org-clock-cancel))) + (setcar clock temp))) + +(defvar org-clock-clocking-in nil) +(defvar org-clock-resolving-clocks nil) +(defvar org-clock-resolving-clocks-due-to-idleness nil) + +(defun org-clock-resolve-clock + (clock resolve-to clock-out-time close restart fail-quietly) + "Resolve CLOCK given the time RESOLVE-TO, and the present. +CLOCK is a cons cell of the form (MARKER START-TIME)." + (let ((org-clock-resolving-clocks t) + ;; If the clocked entry contained only a clock and possibly + ;; the associated drawer, and we either cancel it or clock it + ;; out, `org-clock-out-remove-zero-time-clocks' may clear all + ;; contents, and leave point on the /next/ headline. We store + ;; the current entry location to be able to get back here when + ;; we need to clock in again the previously clocked task. + (heading (org-with-point-at (car clock) + (org-back-to-heading t) + (point-marker)))) + (pcase resolve-to + (`nil + (org-clock-clock-cancel clock) + (when (and restart (not org-clock-clocking-in)) + (org-with-point-at heading (org-clock-in)))) + (`now + (cond + (restart (error "RESTART is not valid here")) + ((or close org-clock-clocking-in) + (org-clock-clock-out clock fail-quietly)) + ((org-is-active-clock clock) nil) + (t (org-clock-clock-in clock t)))) + ((pred (org-time-less-p nil)) + (error "RESOLVE-TO must refer to a time in the past")) + (_ + (when restart (error "RESTART is not valid here")) + (org-clock-clock-out clock fail-quietly (or clock-out-time resolve-to)) + (cond + (org-clock-clocking-in nil) + (close + (setq org-clock-leftover-time (and (null clock-out-time) resolve-to))) + (t + (org-with-point-at heading + (org-clock-in nil (and clock-out-time resolve-to))))))))) + +(defun org-clock-jump-to-current-clock (&optional effective-clock) + "When an Org clock is running, jump to it." + (let ((drawer (org-clock-into-drawer)) + (clock (or effective-clock (cons org-clock-marker + org-clock-start-time)))) + (unless (marker-buffer (car clock)) + (user-error "No Org clock is currently running")) + (org-with-clock clock (org-clock-goto)) + (with-current-buffer (marker-buffer (car clock)) + (goto-char (car clock)) + (when drawer + (org-with-wide-buffer + (let ((drawer-re (format "^[ \t]*:%s:[ \t]*$" + (regexp-quote (if (stringp drawer) drawer "LOGBOOK")))) + (beg (save-excursion (org-back-to-heading t) (point)))) + (catch 'exit + (while (re-search-backward drawer-re beg t) + (let ((element (org-element-at-point))) + (when (eq (org-element-type element) 'drawer) + (when (> (org-element-property :end element) (car clock)) + (org-hide-drawer-toggle 'off nil element)) + (throw 'exit nil))))))))))) + +(defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly) + "Resolve an open Org clock. +An open clock was found, with `dangling' possibly being non-nil. +If this function was invoked with a prefix argument, non-dangling +open clocks are ignored. The given clock requires some sort of +user intervention to resolve it, either because a clock was left +dangling or due to an idle timeout. The clock resolution can +either be: + + (a) deleted, the user doesn't care about the clock + (b) restarted from the current time (if no other clock is open) + (c) closed, giving the clock X minutes + (d) closed and then restarted + (e) resumed, as if the user had never left + +The format of clock is (CONS MARKER START-TIME), where MARKER +identifies the buffer and position the clock is open at (and +thus, the heading it's under), and START-TIME is when the clock +was started." + (cl-assert clock) + (let* ((ch + (save-window-excursion + (save-excursion + (unless org-clock-resolving-clocks-due-to-idleness + (org-clock-jump-to-current-clock clock)) + (unless org-clock-resolve-expert + (with-output-to-temp-buffer "*Org Clock*" + (princ (format-message "Select a Clock Resolution Command: + +i/q Ignore this question; the same as keeping all the idle time. + +k/K Keep X minutes of the idle time (default is all). If this + amount is less than the default, you will be clocked out + that many minutes after the time that idling began, and then + clocked back in at the present time. + +t/T Like `k', but will ask you to specify a time (when you got + distracted away), instead of a number of minutes. + +g/G Indicate that you \"got back\" X minutes ago. This is quite + different from `k': it clocks you out from the beginning of + the idle period and clock you back in X minutes ago. + +s/S Subtract the idle time from the current clock. This is the + same as keeping 0 minutes. + +C Cancel the open timer altogether. It will be as though you + never clocked in. + +j/J Jump to the current clock, to make manual adjustments. + +For all these options, using uppercase makes your final state +to be CLOCKED OUT.")))) + (org-fit-window-to-buffer (get-buffer-window "*Org Clock*")) + (let (char-pressed) + (while (or (null char-pressed) + (and (not (memq char-pressed + '(?k ?K ?g ?G ?s ?S ?C + ?j ?J ?i ?q ?t ?T))) + (or (ding) t))) + (setq char-pressed + (read-char (concat (funcall prompt-fn clock) + " [jkKtTgGSscCiq]? ") + nil 45))) + (and (not (memq char-pressed '(?i ?q))) char-pressed))))) + (default + (floor (org-time-convert-to-integer (org-time-since last-valid)) + 60)) + (keep + (or (and (memq ch '(?k ?K)) + (read-number "Keep how many minutes? " default)) + (and (memq ch '(?t ?T)) + (floor + (/ (float-time + (org-time-subtract (org-read-date t t) last-valid)) + 60))))) + (gotback + (and (memq ch '(?g ?G)) + (read-number "Got back how many minutes ago? " default))) + (subtractp (memq ch '(?s ?S))) + (barely-started-p (org-time-less-p + (org-time-subtract last-valid (cdr clock)) + 45)) + (start-over (and subtractp barely-started-p))) + (cond + ((memq ch '(?j ?J)) + (if (eq ch ?J) + (org-clock-resolve-clock clock 'now nil t nil fail-quietly)) + (org-clock-jump-to-current-clock clock)) + ((or (null ch) + (not (memq ch '(?k ?K ?g ?G ?s ?S ?C ?t ?T)))) + (message "")) + (t + (org-clock-resolve-clock + clock (cond + ((or (eq ch ?C) + ;; If the time on the clock was less than a minute before + ;; the user went away, and they've ask to subtract all the + ;; time... + start-over) + nil) + ((or subtractp + (and gotback (= gotback 0))) + last-valid) + ((or (and keep (= keep default)) + (and gotback (= gotback default))) + 'now) + (keep + (org-time-add last-valid (* 60 keep))) + (gotback + (org-time-since (* 60 gotback))) + (t + (error "Unexpected, please report this as a bug"))) + (and gotback last-valid) + (memq ch '(?K ?G ?S ?T)) + (and start-over + (not (memq ch '(?K ?G ?S ?C)))) + fail-quietly))))) + +;;;###autoload +(defun org-resolve-clocks (&optional only-dangling-p prompt-fn last-valid) + "Resolve all currently open Org clocks. +If `only-dangling-p' is non-nil, only ask to resolve dangling +\(i.e., not currently open and valid) clocks." + (interactive "P") + (unless org-clock-resolving-clocks + (let ((org-clock-resolving-clocks t)) + (dolist (file (org-files-list)) + (let ((clocks (org-find-open-clocks file))) + (dolist (clock clocks) + (let ((dangling (or (not (org-clock-is-active)) + (/= (car clock) org-clock-marker)))) + (if (or (not only-dangling-p) dangling) + (org-clock-resolve + clock + (or prompt-fn + (lambda (clock) + (format + "Dangling clock started %d mins ago" + (floor (org-time-convert-to-integer + (org-time-since (cdr clock))) + 60)))) + (or last-valid + (cdr clock))))))))))) + +(defun org-emacs-idle-seconds () + "Return the current Emacs idle time in seconds, or nil if not idle." + (let ((idle-time (current-idle-time))) + (if idle-time + (float-time idle-time) + 0))) + +(defun org-mac-idle-seconds () + "Return the current Mac idle time in seconds." + (string-to-number (shell-command-to-string "ioreg -c IOHIDSystem | perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle; last}'"))) + +(defvar org-x11idle-exists-p + ;; Check that x11idle exists + (and (eq window-system 'x) + (eq 0 (call-process-shell-command + (format "command -v %s" org-clock-x11idle-program-name))) + ;; Check that x11idle can retrieve the idle time + ;; FIXME: Why "..-shell-command" rather than just `call-process'? + (eq 0 (call-process-shell-command org-clock-x11idle-program-name)))) + +(defun org-x11-idle-seconds () + "Return the current X11 idle time in seconds." + (/ (string-to-number (shell-command-to-string org-clock-x11idle-program-name)) 1000)) + +(defun org-user-idle-seconds () + "Return the number of seconds the user has been idle for. +This routine returns a floating point number." + (cond + ((eq system-type 'darwin) + (org-mac-idle-seconds)) + ((and (eq window-system 'x) org-x11idle-exists-p) + (org-x11-idle-seconds)) + (t + (org-emacs-idle-seconds)))) + +(defvar org-clock-user-idle-seconds) + +(defun org-resolve-clocks-if-idle () + "Resolve all currently open Org clocks. +This is performed after `org-clock-idle-time' minutes, to check +if the user really wants to stay clocked in after being idle for +so long." + (when (and org-clock-idle-time (not org-clock-resolving-clocks) + org-clock-marker (marker-buffer org-clock-marker)) + (let* ((org-clock-user-idle-seconds (org-user-idle-seconds)) + (org-clock-user-idle-start + (org-time-since org-clock-user-idle-seconds)) + (org-clock-resolving-clocks-due-to-idleness t)) + (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) + (org-clock-resolve + (cons org-clock-marker + org-clock-start-time) + (lambda (_) + (format "Clocked in & idle for %.1f mins" + (/ (float-time + (time-since org-clock-user-idle-start)) + 60))) + org-clock-user-idle-start))))) + +(defvar org-clock-current-task nil "Task currently clocked in.") +(defvar org-clock-out-time nil) ; store the time of the last clock-out +(defvar org--msg-extra) + +;;;###autoload +(defun org-clock-in (&optional select start-time) + "Start the clock on the current item. + +If necessary, clock-out of the currently active clock. + +With a `\\[universal-argument]' prefix argument SELECT, offer a list of \ +recently clocked +tasks to clock into. + +When SELECT is `\\[universal-argument] \ \\[universal-argument]', \ +clock into the current task and mark it as +the default task, a special task that will always be offered in the +clocking selection, associated with the letter `d'. + +When SELECT is `\\[universal-argument] \\[universal-argument] \ +\\[universal-argument]', clock in by using the last clock-out +time as the start time. See `org-clock-continuously' to make this +the default behavior." + (interactive "P") + (setq org-clock-notification-was-shown nil) + (org-refresh-effort-properties) + (catch 'abort + (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness) + (org-clocking-p))) + ts selected-task target-pos (org--msg-extra "") + (leftover (and (not org-clock-resolving-clocks) + org-clock-leftover-time))) + + (when (and org-clock-auto-clock-resolution + (or (not interrupting) + (eq t org-clock-auto-clock-resolution)) + (not org-clock-clocking-in) + (not org-clock-resolving-clocks)) + (setq org-clock-leftover-time nil) + (let ((org-clock-clocking-in t)) + (org-resolve-clocks))) ; check if any clocks are dangling + + (when (equal select '(64)) + ;; Set start-time to `org-clock-out-time' + (let ((org-clock-continuously t)) + (org-clock-in nil org-clock-out-time) + (throw 'abort nil))) + + (when (equal select '(4)) + (pcase (org-clock-select-task "Clock-in on task: ") + (`nil (error "Abort")) + (task (setq selected-task (copy-marker task))))) + + (when (equal select '(16)) + ;; Mark as default clocking task + (org-clock-mark-default-task)) + + (when interrupting + ;; We are interrupting the clocking of a different task. Save + ;; a marker to this task, so that we can go back. First check + ;; if we are trying to clock into the same task! + (when (or selected-task (derived-mode-p 'org-mode)) + (org-with-point-at selected-task + (unless selected-task (org-back-to-heading t)) + (when (and (eq (marker-buffer org-clock-hd-marker) + (org-base-buffer (current-buffer))) + (= (point) (marker-position org-clock-hd-marker)) + (equal org-clock-current-task (org-get-heading t t t t))) + (message "Clock continues in %S" org-clock-heading) + (throw 'abort nil)))) + (move-marker org-clock-interrupted-task + (marker-position org-clock-marker) + (marker-buffer org-clock-marker)) + (let ((org-clock-clocking-in t)) + (org-clock-out nil t))) + + ;; Clock in at which position? + (setq target-pos + (if (and (eobp) (not (org-at-heading-p))) + (point-at-bol 0) + (point))) + (save-excursion + (when (and selected-task (marker-buffer selected-task)) + ;; There is a selected task, move to the correct buffer + ;; and set the new target position. + (set-buffer (org-base-buffer (marker-buffer selected-task))) + (setq target-pos (marker-position selected-task)) + (move-marker selected-task nil)) + (org-with-wide-buffer + (goto-char target-pos) + (org-back-to-heading t) + (or interrupting (move-marker org-clock-interrupted-task nil)) + (run-hooks 'org-clock-in-prepare-hook) + (org-clock-history-push) + (setq org-clock-current-task (org-get-heading t t t t)) + (cond ((functionp org-clock-in-switch-to-state) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp)) + (let ((newstate (funcall org-clock-in-switch-to-state + (match-string 2)))) + (when newstate (org-todo newstate)))) + ((and org-clock-in-switch-to-state + (not (looking-at (concat org-outline-regexp "[ \t]*" + org-clock-in-switch-to-state + "\\>")))) + (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) + (cond + ((and org-clock-in-resume + (looking-at + (concat "^[ \t]*" org-clock-string + " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" + " *\\sw+.? +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$"))) + (message "Matched %s" (match-string 1)) + (setq ts (concat "[" (match-string 1) "]")) + (goto-char (match-end 1)) + (setq org-clock-start-time + (org-time-string-to-time (match-string 1))) + (setq org-clock-effort (org-entry-get (point) org-effort-property)) + (setq org-clock-total-time (org-clock-sum-current-item + (org-clock-get-sum-start)))) + ((eq org-clock-in-resume 'auto-restart) + ;; called from org-clock-load during startup, + ;; do not interrupt, but warn! + (message "Cannot restart clock because task does not contain unfinished clock") + (ding) + (sit-for 2) + (throw 'abort nil)) + (t + (insert-before-markers "\n") + (backward-char 1) + (when (and (save-excursion + (end-of-line 0) + (org-in-item-p))) + (beginning-of-line 1) + (indent-line-to (max 0 (- (current-indentation) 2)))) + (insert org-clock-string " ") + (setq org-clock-effort (org-entry-get (point) org-effort-property)) + (setq org-clock-total-time (org-clock-sum-current-item + (org-clock-get-sum-start))) + (setq org-clock-start-time + (or (and org-clock-continuously org-clock-out-time) + (and leftover + (y-or-n-p + (format + "You stopped another clock %d mins ago; start this one from then? " + (/ (org-time-convert-to-integer + (org-time-subtract + (org-current-time org-clock-rounding-minutes t) + leftover)) + 60))) + leftover) + start-time + (org-current-time org-clock-rounding-minutes t))) + (setq ts (org-insert-time-stamp org-clock-start-time + 'with-hm 'inactive)) + (org-indent-line))) + (move-marker org-clock-marker (point) (buffer-base-buffer)) + (move-marker org-clock-hd-marker + (save-excursion (org-back-to-heading t) (point)) + (buffer-base-buffer)) + (setq org-clock-has-been-used t) + ;; add to mode line + (when (or (eq org-clock-clocked-in-display 'mode-line) + (eq org-clock-clocked-in-display 'both)) + (or global-mode-string (setq global-mode-string '(""))) + (or (memq 'org-mode-line-string global-mode-string) + (setq global-mode-string + (append global-mode-string '(org-mode-line-string))))) + ;; add to frame title + (when (or (eq org-clock-clocked-in-display 'frame-title) + (eq org-clock-clocked-in-display 'both)) + (setq org-frame-title-format-backup frame-title-format) + (setq frame-title-format org-clock-frame-title-format)) + (org-clock-update-mode-line) + (when org-clock-mode-line-timer + (cancel-timer org-clock-mode-line-timer) + (setq org-clock-mode-line-timer nil)) + (when org-clock-clocked-in-display + (setq org-clock-mode-line-timer + (run-with-timer org-clock-update-period + org-clock-update-period + #'org-clock-update-mode-line))) + (when org-clock-idle-timer + (cancel-timer org-clock-idle-timer) + (setq org-clock-idle-timer nil)) + (setq org-clock-idle-timer + (run-with-timer 60 60 #'org-resolve-clocks-if-idle)) + (message "Clock starts at %s - %s" ts org--msg-extra) + (run-hooks 'org-clock-in-hook)))))) + +(defun org-clock-auto-clockout () + "Clock out the currently clocked in task if Emacs is idle. +See `org-clock-auto-clockout-timer' to set the idle time span. + +This is only effective when `org-clock-auto-clockout-insinuate' +is present in the user configuration." + (when (and (numberp org-clock-auto-clockout-timer) + org-clock-current-task) + (run-with-idle-timer + org-clock-auto-clockout-timer nil #'org-clock-out))) + +;;;###autoload +(defun org-clock-toggle-auto-clockout () + (interactive) + (if (memq 'org-clock-auto-clockout org-clock-in-hook) + (progn (remove-hook 'org-clock-in-hook #'org-clock-auto-clockout) + (message "Auto clock-out after idle time turned off")) + (add-hook 'org-clock-in-hook #'org-clock-auto-clockout t) + (message "Auto clock-out after idle time turned on"))) + +;;;###autoload +(defun org-clock-in-last (&optional arg) + "Clock in the last closed clocked item. +When already clocking in, send a warning. +With a universal prefix argument, select the task you want to +clock in from the last clocked in tasks. +With two universal prefix arguments, start clocking using the +last clock-out time, if any. +With three universal prefix arguments, interactively prompt +for a todo state to switch to, overriding the existing value +`org-clock-in-switch-to-state'." + (interactive "P") + (if (equal arg '(4)) (org-clock-in arg) + (let ((start-time (if (or org-clock-continuously (equal arg '(16))) + (or org-clock-out-time + (org-current-time org-clock-rounding-minutes t)) + (org-current-time org-clock-rounding-minutes t)))) + (if (null org-clock-history) + (message "No last clock") + (let ((org-clock-in-switch-to-state + (if (and (not org-clock-current-task) (equal arg '(64))) + (completing-read "Switch to state: " + (and org-clock-history + (with-current-buffer + (marker-buffer (car org-clock-history)) + org-todo-keywords-1))) + org-clock-in-switch-to-state)) + (already-clocking org-clock-current-task)) + (org-clock-clock-in (list (car org-clock-history)) nil start-time) + (or already-clocking + ;; Don't display a message if we are already clocking in + (message "Clocking back: %s (in %s)" + org-clock-current-task + (buffer-name (marker-buffer org-clock-marker))))))))) + +(defun org-clock-mark-default-task () + "Mark current task as default task." + (interactive) + (save-excursion + (org-back-to-heading t) + (move-marker org-clock-default-task (point)))) + +(defun org-clock-get-sum-start () + "Return the time from which clock times should be counted. + +This is for the currently running clock as it is displayed in the +mode line. This function looks at the properties LAST_REPEAT and +in particular CLOCK_MODELINE_TOTAL and the corresponding variable +`org-clock-mode-line-total' and then decides which time to use. + +The time is always returned as UTC." + (let ((cmt (or (org-entry-get nil "CLOCK_MODELINE_TOTAL" 'selective) + (symbol-name org-clock-mode-line-total))) + (lr (org-entry-get nil "LAST_REPEAT"))) + (cond + ((equal cmt "current") + (setq org--msg-extra "showing time in current clock instance") + (current-time)) + ((equal cmt "today") + (setq org--msg-extra "showing today's task time.") + (let* ((dt (decode-time)) + (hour (nth 2 dt)) + (day (nth 3 dt))) + (if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day))) + (setf (nth 2 dt) org-extend-today-until) + (apply #'encode-time 0 0 (nthcdr 2 dt)))) + ((or (equal cmt "all") + (and (or (not cmt) (equal cmt "auto")) + (not lr))) + (setq org--msg-extra "showing entire task time.") + nil) + ((or (equal cmt "repeat") + (and (or (not cmt) (equal cmt "auto")) + lr)) + (setq org--msg-extra "showing task time since last repeat.") + (and lr (org-time-string-to-time lr))) + (t nil)))) + +(defun org-clock-find-position (find-unclosed) + "Find the location where the next clock line should be inserted. +When FIND-UNCLOSED is non-nil, first check if there is an unclosed clock +line and position cursor in that line." + (org-back-to-heading t) + (catch 'exit + (let* ((beg (line-beginning-position)) + (end (save-excursion (outline-next-heading) (point))) + (org-clock-into-drawer (org-clock-into-drawer)) + (drawer (org-clock-drawer-name))) + ;; Look for a running clock if FIND-UNCLOSED in non-nil. + (when find-unclosed + (let ((open-clock-re + (concat "^[ \t]*" + org-clock-string + " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" + " *\\sw+ +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$"))) + (while (re-search-forward open-clock-re end t) + (let ((element (org-element-at-point))) + (when (and (eq (org-element-type element) 'clock) + (eq (org-element-property :status element) 'running)) + (beginning-of-line) + (throw 'exit t)))))) + ;; Look for an existing clock drawer. + (when drawer + (goto-char beg) + (let ((drawer-re (concat "^[ \t]*:" (regexp-quote drawer) ":[ \t]*$"))) + (while (re-search-forward drawer-re end t) + (let ((element (org-element-at-point))) + (when (eq (org-element-type element) 'drawer) + (let ((cend (org-element-property :contents-end element))) + (if (and (not org-log-states-order-reversed) cend) + (goto-char cend) + (forward-line)) + (throw 'exit t))))))) + (goto-char beg) + (let ((clock-re (concat "^[ \t]*" org-clock-string)) + (count 0) + positions) + ;; Count the CLOCK lines and store their positions. + (save-excursion + (while (re-search-forward clock-re end t) + (let ((element (org-element-at-point))) + (when (eq (org-element-type element) 'clock) + (setq positions (cons (line-beginning-position) positions) + count (1+ count)))))) + (cond + ((null positions) + ;; Skip planning line and property drawer, if any. + (org-end-of-meta-data) + (unless (bolp) (insert "\n")) + ;; Create a new drawer if necessary. + (when (and org-clock-into-drawer + (or (not (wholenump org-clock-into-drawer)) + (< org-clock-into-drawer 2))) + (let ((beg (point))) + (insert ":" drawer ":\n:END:\n") + (org-indent-region beg (point)) + (org-flag-region + (line-end-position -1) (1- (point)) t 'outline) + (forward-line -1)))) + ;; When a clock drawer needs to be created because of the + ;; number of clock items or simply if it is missing, collect + ;; all clocks in the section and wrap them within the drawer. + ((if (wholenump org-clock-into-drawer) + (>= (1+ count) org-clock-into-drawer) + drawer) + ;; Skip planning line and property drawer, if any. + (org-end-of-meta-data) + (let ((beg (point))) + (insert + (mapconcat + (lambda (p) + (save-excursion + (goto-char p) + (org-trim (delete-and-extract-region + (save-excursion (skip-chars-backward " \r\t\n") + (line-beginning-position 2)) + (line-beginning-position 2))))) + positions "\n") + "\n:END:\n") + (let ((end (point-marker))) + (goto-char beg) + (save-excursion (insert ":" drawer ":\n")) + (org-flag-region (line-end-position) (1- end) t 'outline) + (org-indent-region (point) end) + (forward-line) + (unless org-log-states-order-reversed + (goto-char end) + (beginning-of-line -1)) + (set-marker end nil)))) + (org-log-states-order-reversed (goto-char (car (last positions)))) + (t (goto-char (car positions)))))))) + +(defun org-clock-restore-frame-title-format () + "Restore `frame-title-format' from `org-frame-title-format-backup'. +`frame-title-format' is restored if `org-frame-title-format-backup' is not nil +and current `frame-title-format' is equal to `org-clock-frame-title-format'." + (when (and org-frame-title-format-backup + (equal frame-title-format org-clock-frame-title-format)) + (setq frame-title-format org-frame-title-format-backup))) + +;;;###autoload +(defun org-clock-out (&optional switch-to-state fail-quietly at-time) + "Stop the currently running clock. +Throw an error if there is no running clock and FAIL-QUIETLY is nil. +With a universal prefix, prompt for a state to switch the clocked out task +to, overriding the existing value of `org-clock-out-switch-to-state'." + (interactive "P") + (catch 'exit + (when (not (org-clocking-p)) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (org-clock-restore-frame-title-format) + (force-mode-line-update) + (if fail-quietly (throw 'exit t) (user-error "No active clock"))) + (let ((org-clock-out-switch-to-state + (if switch-to-state + (completing-read "Switch to state: " + (with-current-buffer + (marker-buffer org-clock-marker) + org-todo-keywords-1) + nil t "DONE") + org-clock-out-switch-to-state)) + (now (org-current-time org-clock-rounding-minutes)) + ts te s h m remove) + (setq org-clock-out-time (or at-time now)) + (save-excursion ; Do not replace this with `with-current-buffer'. + (with-no-warnings (set-buffer (org-clocking-buffer))) + (save-restriction + (widen) + (goto-char org-clock-marker) + (beginning-of-line 1) + (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp)) + (equal (match-string 1) org-clock-string)) + (setq ts (match-string 2)) + (if fail-quietly (throw 'exit nil) (error "Clock start time is gone"))) + (goto-char (match-end 0)) + (delete-region (point) (point-at-eol)) + (insert "--") + (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive)) + (setq s (org-time-convert-to-integer + (time-subtract + (org-time-string-to-time te) + (org-time-string-to-time ts))) + h (floor s 3600) + m (floor (mod s 3600) 60)) + (insert " => " (format "%2d:%02d" h m)) + (move-marker org-clock-marker nil) + (move-marker org-clock-hd-marker nil) + ;; Possibly remove zero time clocks. + (when (and org-clock-out-remove-zero-time-clocks + (= 0 h m)) + (setq remove t) + (delete-region (line-beginning-position) + (line-beginning-position 2))) + (org-clock-remove-empty-clock-drawer) + (when org-clock-mode-line-timer + (cancel-timer org-clock-mode-line-timer) + (setq org-clock-mode-line-timer nil)) + (when org-clock-idle-timer + (cancel-timer org-clock-idle-timer) + (setq org-clock-idle-timer nil)) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (org-clock-restore-frame-title-format) + (when org-clock-out-switch-to-state + (save-excursion + (org-back-to-heading t) + (let ((org-clock-out-when-done nil)) + (cond + ((functionp org-clock-out-switch-to-state) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp)) + (let ((newstate (funcall org-clock-out-switch-to-state + (match-string 2)))) + (when newstate (org-todo newstate)))) + ((and org-clock-out-switch-to-state + (not (looking-at (concat org-outline-regexp "[ \t]*" + org-clock-out-switch-to-state + "\\>")))) + (org-todo org-clock-out-switch-to-state)))))) + (force-mode-line-update) + (message (if remove + "Clock stopped at %s after %s => LINE REMOVED" + "Clock stopped at %s after %s") + te (org-duration-from-minutes (+ (* 60 h) m))) + (unless (org-clocking-p) + (setq org-clock-current-task nil)) + (run-hooks 'org-clock-out-hook) + ;; Add a note, but only if we didn't remove the clock line. + (when (and org-log-note-clock-out (not remove)) + (org-add-log-setup + 'clock-out nil nil nil + (concat "# Task: " (org-get-heading t) "\n\n")))))))) + +(defun org-clock-remove-empty-clock-drawer () + "Remove empty clock drawers in current subtree." + (save-excursion + (org-back-to-heading t) + (org-map-tree + (lambda () + (let ((drawer (org-clock-drawer-name)) + (case-fold-search t)) + (when drawer + (let ((re (format "^[ \t]*:%s:[ \t]*$" (regexp-quote drawer))) + (end (save-excursion (outline-next-heading)))) + (while (re-search-forward re end t) + (org-remove-empty-drawer-at (point)))))))))) + +(defun org-clock-timestamps-up (&optional n) + "Increase CLOCK timestamps at cursor. +Optional argument N tells to change by that many units." + (interactive "P") + (org-clock-timestamps-change 'up n)) + +(defun org-clock-timestamps-down (&optional n) + "Increase CLOCK timestamps at cursor. +Optional argument N tells to change by that many units." + (interactive "P") + (org-clock-timestamps-change 'down n)) + +(defun org-clock-timestamps-change (updown &optional n) + "Change CLOCK timestamps synchronously at cursor. +UPDOWN tells whether to change `up' or `down'. +Optional argument N tells to change by that many units." + (let ((tschange (if (eq updown 'up) 'org-timestamp-up + 'org-timestamp-down)) + (timestamp? (org-at-timestamp-p 'lax)) + ts1 begts1 ts2 begts2 updatets1 tdiff) + (when timestamp? + (save-excursion + (move-beginning-of-line 1) + (re-search-forward org-ts-regexp3 nil t) + (setq ts1 (match-string 0) begts1 (match-beginning 0)) + (when (re-search-forward org-ts-regexp3 nil t) + (setq ts2 (match-string 0) begts2 (match-beginning 0)))) + ;; Are we on the second timestamp? + (if (<= begts2 (point)) (setq updatets1 t)) + (if (not ts2) + ;; fall back on org-timestamp-up if there is only one + (funcall tschange n) + (funcall tschange n) + (let ((ts (if updatets1 ts2 ts1)) + (begts (if updatets1 begts1 begts2))) + (setq tdiff + (time-subtract + (org-time-string-to-time org-last-changed-timestamp) + (org-time-string-to-time ts))) + (save-excursion + (goto-char begts) + (org-timestamp-change + (round (/ (float-time tdiff) + (pcase timestamp? + (`minute 60) + (`hour 3600) + (`day (* 24 3600)) + (`month (* 24 3600 31)) + (`year (* 24 3600 365.2))))) + timestamp? 'updown))))))) + +;;;###autoload +(defun org-clock-cancel () + "Cancel the running clock by removing the start timestamp." + (interactive) + (when (not (org-clocking-p)) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (org-clock-restore-frame-title-format) + (force-mode-line-update) + (user-error "No active clock")) + (save-excursion ; Do not replace this with `with-current-buffer'. + (with-no-warnings (set-buffer (org-clocking-buffer))) + (goto-char org-clock-marker) + (if (looking-back (concat "^[ \t]*" org-clock-string ".*") + (line-beginning-position)) + (progn (delete-region (1- (point-at-bol)) (point-at-eol)) + (org-remove-empty-drawer-at (point))) + (message "Clock gone, cancel the timer anyway") + (sit-for 2))) + (move-marker org-clock-marker nil) + (move-marker org-clock-hd-marker nil) + (setq org-clock-current-task nil) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (org-clock-restore-frame-title-format) + (force-mode-line-update) + (message "Clock canceled") + (run-hooks 'org-clock-cancel-hook)) + +;;;###autoload +(defun org-clock-goto (&optional select) + "Go to the currently clocked-in entry, or to the most recently clocked one. +With prefix arg SELECT, offer recently clocked tasks for selection." + (interactive "@P") + (let* ((recent nil) + (m (cond + (select + (or (org-clock-select-task "Select task to go to: ") + (user-error "No task selected"))) + ((org-clocking-p) org-clock-marker) + ((and org-clock-goto-may-find-recent-task + (car org-clock-history) + (marker-buffer (car org-clock-history))) + (setq recent t) + (car org-clock-history)) + (t (user-error "No active or recent clock task"))))) + (pop-to-buffer-same-window (marker-buffer m)) + (if (or (< m (point-min)) (> m (point-max))) (widen)) + (goto-char m) + (org-show-entry) + (org-back-to-heading t) + (recenter org-clock-goto-before-context) + (org-reveal) + (if recent + (message "No running clock, this is the most recently clocked task")) + (run-hooks 'org-clock-goto-hook))) + +(defvar-local org-clock-file-total-minutes nil + "Holds the file total time in minutes, after a call to `org-clock-sum'.") + +;;;###autoload +(defun org-clock-sum-today (&optional headline-filter) + "Sum the times for each subtree for today." + (let ((range (org-clock-special-range 'today))) + (org-clock-sum (car range) (cadr range) + headline-filter :org-clock-minutes-today))) + +(defun org-clock-sum-custom (&optional headline-filter range propname) + "Sum the times for each subtree for today." + (let ((r (or (and (symbolp range) (org-clock-special-range range)) + (org-clock-special-range + (intern (completing-read + "Range: " + '("today" "yesterday" "thisweek" "lastweek" + "thismonth" "lastmonth" "thisyear" "lastyear" + "interactive") + nil t)))))) + (org-clock-sum (car r) (cadr r) + headline-filter (or propname :org-clock-minutes-custom)))) + +;;;###autoload +(defun org-clock-sum (&optional tstart tend headline-filter propname) + "Sum the times for each subtree. +Puts the resulting times in minutes as a text property on each headline. +TSTART and TEND can mark a time range to be considered. +HEADLINE-FILTER is a zero-arg function that, if specified, is called for +each headline in the time range with point at the headline. Headlines for +which HEADLINE-FILTER returns nil are excluded from the clock summation. +PROPNAME lets you set a custom text property instead of :org-clock-minutes." + (with-silent-modifications + (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" + org-clock-string + "[ \t]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \t]+\\([0-9]+\\):\\([0-9]+\\)\\)")) + (lmax 30) + (ltimes (make-vector lmax 0)) + (level 0) + (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart)) + ((consp tstart) (float-time tstart)) + (t tstart))) + (tend (cond ((stringp tend) (org-time-string-to-seconds tend)) + ((consp tend) (float-time tend)) + (t tend))) + (t1 0) + time) + (remove-text-properties (point-min) (point-max) + `(,(or propname :org-clock-minutes) t + :org-clock-force-headline-inclusion t)) + (save-excursion + (goto-char (point-max)) + (while (re-search-backward re nil t) + (cond + ((match-end 2) + ;; Two time stamps. + (let* ((ts (float-time + (apply #'encode-time + (save-match-data + (org-parse-time-string (match-string 2)))))) + (te (float-time + (apply #'encode-time + (org-parse-time-string (match-string 3))))) + (dt (- (if tend (min te tend) te) + (if tstart (max ts tstart) ts)))) + (when (> dt 0) (cl-incf t1 (floor dt 60))))) + ((match-end 4) + ;; A naked time. + (setq t1 (+ t1 (string-to-number (match-string 5)) + (* 60 (string-to-number (match-string 4)))))) + (t ;A headline + ;; Add the currently clocking item time to the total. + (when (and org-clock-report-include-clocking-task + (eq (org-clocking-buffer) (current-buffer)) + (eq (marker-position org-clock-hd-marker) (point)) + tstart + tend + (>= (float-time org-clock-start-time) tstart) + (<= (float-time org-clock-start-time) tend)) + (let ((time (floor (org-time-convert-to-integer + (org-time-since org-clock-start-time)) + 60))) + (setq t1 (+ t1 time)))) + (let* ((headline-forced + (get-text-property (point) + :org-clock-force-headline-inclusion)) + (headline-included + (or (null headline-filter) + (save-excursion + (save-match-data (funcall headline-filter)))))) + (setq level (- (match-end 1) (match-beginning 1))) + (when (>= level lmax) + (setq ltimes (vconcat ltimes (make-vector lmax 0)) lmax (* 2 lmax))) + (when (or (> t1 0) (> (aref ltimes level) 0)) + (when (or headline-included headline-forced) + (if headline-included + (cl-loop for l from 0 to level do + (aset ltimes l (+ (aref ltimes l) t1)))) + (setq time (aref ltimes level)) + (goto-char (match-beginning 0)) + (put-text-property (point) (point-at-eol) + (or propname :org-clock-minutes) time) + (when headline-filter + (save-excursion + (save-match-data + (while (org-up-heading-safe) + (put-text-property + (point) (line-end-position) + :org-clock-force-headline-inclusion t)))))) + (setq t1 0) + (cl-loop for l from level to (1- lmax) do + (aset ltimes l 0))))))) + (setq org-clock-file-total-minutes (aref ltimes 0)))))) + +(defun org-clock-sum-current-item (&optional tstart) + "Return time, clocked on current item in total." + (save-excursion + (save-restriction + (if (and (featurep 'org-inlinetask) + (or (org-inlinetask-at-task-p) + (org-inlinetask-in-task-p))) + (narrow-to-region (save-excursion (org-inlinetask-goto-beginning) (point)) + (save-excursion (org-inlinetask-goto-end) (point))) + (org-narrow-to-subtree)) + (org-clock-sum tstart) + org-clock-file-total-minutes))) + +;;;###autoload +(defun org-clock-display (&optional arg) + "Show subtree times in the entire buffer. + +By default, show the total time for the range defined in +`org-clock-display-default-range'. With `\\[universal-argument]' \ +prefix, show +the total time for today instead. + +With `\\[universal-argument] \\[universal-argument]' prefix, \ +use a custom range, entered at prompt. + +With `\\[universal-argument] \ \\[universal-argument] \ +\\[universal-argument]' prefix, display the total time in the +echo area. + +Use `\\[org-clock-remove-overlays]' to remove the subtree times." + (interactive "P") + (org-clock-remove-overlays) + (let* ((todayp (equal arg '(4))) + (customp (member arg '((16) today yesterday + thisweek lastweek thismonth + lastmonth thisyear lastyear + untilnow interactive))) + (prop (cond ((not arg) :org-clock-minutes-default) + (todayp :org-clock-minutes-today) + (customp :org-clock-minutes-custom) + (t :org-clock-minutes)))) + (cond ((not arg) (org-clock-sum-custom + nil org-clock-display-default-range prop)) + (todayp (org-clock-sum-today)) + (customp (org-clock-sum-custom nil arg)) + (t (org-clock-sum))) + (unless (equal arg '(64)) + (save-excursion + (goto-char (point-min)) + (let ((p nil)) + (while (or (and (equal (setq p (point)) (point-min)) + (get-text-property p prop)) + (setq p (next-single-property-change (point) prop))) + (goto-char p) + (let ((time (get-text-property p prop))) + (when time (org-clock-put-overlay time))))) + ;; Arrange to remove the overlays upon next change. + (when org-remove-highlights-with-change + (add-hook 'before-change-functions #'org-clock-remove-overlays + nil 'local)))) + (let* ((h (/ org-clock-file-total-minutes 60)) + (m (- org-clock-file-total-minutes (* 60 h)))) + (message (cond + (todayp + "Total file time for today: %s (%d hours and %d minutes)") + (customp + "Total file time (custom): %s (%d hours and %d minutes)") + (t + "Total file time: %s (%d hours and %d minutes)")) + (org-duration-from-minutes org-clock-file-total-minutes) + h m)))) + +(defvar-local org-clock-overlays nil) + +(defun org-clock-put-overlay (time) + "Put an overlay on the headline at point, displaying TIME. +Create a new overlay and store it in `org-clock-overlays', so +that it will be easy to remove. This function assumes point is +on a headline." + (org-match-line org-complex-heading-regexp) + (goto-char (match-beginning 4)) + (let* ((headline (match-string 4)) + (text (concat headline + (org-add-props + (make-string + (max (- (- 60 (current-column)) + (org-string-width headline) + (length (org-get-at-bol 'line-prefix))) + 0) + ?\·) + '(face shadow)) + (org-add-props + (format " %9s " (org-duration-from-minutes time)) + '(face org-clock-overlay)))) + (o (make-overlay (point) (line-end-position)))) + (org-overlay-display o text) + (push o org-clock-overlays))) + +;;;###autoload +(defun org-clock-remove-overlays (&optional _beg _end noremove) + "Remove the occur highlights from the buffer. +If NOREMOVE is nil, remove this function from the +`before-change-functions' in the current buffer." + (interactive) + (unless org-inhibit-highlight-removal + (mapc #'delete-overlay org-clock-overlays) + (setq org-clock-overlays nil) + (unless noremove + (remove-hook 'before-change-functions + #'org-clock-remove-overlays 'local)))) + +;;;###autoload +(defun org-clock-out-if-current () + "Clock out if the current entry contains the running clock. +This is used to stop the clock after a TODO entry is marked DONE, +and is only done if the variable `org-clock-out-when-done' is not nil." + (when (and (org-clocking-p) + org-clock-out-when-done + (marker-buffer org-clock-marker) + (or (and (eq t org-clock-out-when-done) + (member org-state org-done-keywords)) + (and (listp org-clock-out-when-done) + (member org-state org-clock-out-when-done))) + (equal (or (buffer-base-buffer (org-clocking-buffer)) + (org-clocking-buffer)) + (or (buffer-base-buffer (current-buffer)) + (current-buffer))) + (< (point) org-clock-marker) + (> (org-with-wide-buffer (org-entry-end-position)) + org-clock-marker)) + ;; Clock out, but don't accept a logging message for this. + (let ((org-log-note-clock-out nil) + (org-clock-out-switch-to-state nil)) + (org-clock-out)))) + +;;;###autoload +(defun org-clock-get-clocktable (&rest props) + "Get a formatted clocktable with parameters according to PROPS. +The table is created in a temporary buffer, fully formatted and +fontified, and then returned." + ;; Set the defaults + (setq props (plist-put props :name "clocktable")) + (unless (plist-member props :maxlevel) + (setq props (plist-put props :maxlevel 2))) + (unless (plist-member props :scope) + (setq props (plist-put props :scope 'agenda))) + (with-temp-buffer + (org-mode) + (org-create-dblock props) + (org-update-dblock) + (org-font-lock-ensure) + (forward-line 2) + (buffer-substring (point) (progn + (re-search-forward "^[ \t]*#\\+END" nil t) + (point-at-bol))))) + +;;;###autoload +(defun org-clock-report (&optional arg) + "Update or create a table containing a report about clocked time. + +If point is inside an existing clocktable block, update it. +Otherwise, insert a new one. + +The new table inherits its properties from the variable +`org-clock-clocktable-default-properties'. The scope of the +clocktable, when not specified in the previous variable, is +`subtree' when the function is called from within a subtree, and +`file' elsewhere. + +When called with a prefix argument, move to the first clock table +in the buffer and update it." + (interactive "P") + (org-clock-remove-overlays) + (when arg + (org-find-dblock "clocktable") + (org-show-entry)) + (pcase (org-in-clocktable-p) + (`nil + (org-create-dblock + (org-combine-plists + (list :scope (if (org-before-first-heading-p) 'file 'subtree)) + org-clock-clocktable-default-properties + '(:name "clocktable")))) + (start (goto-char start))) + (org-update-dblock)) + +;;;###autoload +(eval-after-load 'org + '(progn + (org-dynamic-block-define "clocktable" #'org-clock-report))) + +(defun org-day-of-week (day month year) + "Return the day of the week as an integer." + (nth 6 + (decode-time + (date-to-time + (format "%d-%02d-%02dT00:00:00" year month day))))) + +(defun org-quarter-to-date (quarter year) + "Get the date (week day year) of the first day of a given quarter." + (let (startday) + (cond + ((= quarter 1) + (setq startday (org-day-of-week 1 1 year)) + (cond + ((= startday 0) + (list 52 7 (- year 1))) + ((= startday 6) + (list 52 6 (- year 1))) + ((<= startday 4) + (list 1 startday year)) + ((> startday 4) + (list 53 startday (- year 1))) + ) + ) + ((= quarter 2) + (setq startday (org-day-of-week 1 4 year)) + (cond + ((= startday 0) + (list 13 startday year)) + ((< startday 4) + (list 14 startday year)) + ((>= startday 4) + (list 13 startday year)) + ) + ) + ((= quarter 3) + (setq startday (org-day-of-week 1 7 year)) + (cond + ((= startday 0) + (list 26 startday year)) + ((< startday 4) + (list 27 startday year)) + ((>= startday 4) + (list 26 startday year)) + ) + ) + ((= quarter 4) + (setq startday (org-day-of-week 1 10 year)) + (cond + ((= startday 0) + (list 39 startday year)) + ((<= startday 4) + (list 40 startday year)) + ((> startday 4) + (list 39 startday year))))))) + +(defun org-clock-special-range (key &optional time as-strings wstart mstart) + "Return two times bordering a special time range. + +KEY is a symbol specifying the range and can be one of `today', +`yesterday', `thisweek', `lastweek', `thismonth', `lastmonth', +`thisyear', `lastyear' or `untilnow'. If set to `interactive', +user is prompted for range boundaries. It can be a string or an +integer. + +By default, a week starts Monday 0:00 and ends Sunday 24:00. The +range is determined relative to TIME, which defaults to current +time. + +The return value is a list containing two internal times, one for +the beginning of the range and one for its end, like the ones +returned by `current-time' or `encode-time' and a string used to +display information. If AS-STRINGS is non-nil, the returned +times will be formatted strings. Note that the first element is +always nil when KEY is `untilnow'. + +If WSTART is non-nil, use this number to specify the starting day +of a week (monday is 1). If MSTART is non-nil, use this number +to specify the starting day of a month (1 is the first day of the +month). If you can combine both, the month starting day will +have priority." + (let* ((tm (decode-time time)) + (m (nth 1 tm)) + (h (nth 2 tm)) + (d (nth 3 tm)) + (month (nth 4 tm)) + (y (nth 5 tm)) + (dow (nth 6 tm)) + (skey (format "%s" key)) + (shift 0) + (q (cond ((>= month 10) 4) + ((>= month 7) 3) + ((>= month 4) 2) + (t 1))) + h1 d1 month1 y1 shiftedy shiftedm shiftedq) ;; m1 + (cond + ((string-match "\\`[0-9]+\\'" skey) + (setq y (string-to-number skey) month 1 d 1 key 'year)) + ((string-match "\\`\\([0-9]+\\)-\\([0-9]\\{1,2\\}\\)\\'" skey) + (setq y (string-to-number (match-string 1 skey)) + month (string-to-number (match-string 2 skey)) + d 1 + key 'month)) + ((string-match "\\`\\([0-9]+\\)-[wW]\\([0-9]\\{1,2\\}\\)\\'" skey) + (require 'cal-iso) + (let ((date (calendar-gregorian-from-absolute + (calendar-iso-to-absolute + (list (string-to-number (match-string 2 skey)) + 1 + (string-to-number (match-string 1 skey))))))) + (setq d (nth 1 date) + month (car date) + y (nth 2 date) + dow 1 + key 'week))) + ((string-match "\\`\\([0-9]+\\)-[qQ]\\([1-4]\\)\\'" skey) + (require 'cal-iso) + (setq q (string-to-number (match-string 2 skey))) + (let ((date (calendar-gregorian-from-absolute + (calendar-iso-to-absolute + (org-quarter-to-date + q (string-to-number (match-string 1 skey))))))) + (setq d (nth 1 date) + month (car date) + y (nth 2 date) + dow 1 + key 'quarter))) + ((string-match + "\\`\\([0-9]+\\)-\\([0-9]\\{1,2\\}\\)-\\([0-9]\\{1,2\\}\\)\\'" + skey) + (setq y (string-to-number (match-string 1 skey)) + month (string-to-number (match-string 2 skey)) + d (string-to-number (match-string 3 skey)) + key 'day)) + ((string-match "\\([-+][0-9]+\\)\\'" skey) + (setq shift (string-to-number (match-string 1 skey)) + key (intern (substring skey 0 (match-beginning 1)))) + (when (and (memq key '(quarter thisq)) (> shift 0)) + (error "Looking forward with quarters isn't implemented")))) + (when (= shift 0) + (pcase key + (`yesterday (setq key 'today shift -1)) + (`lastweek (setq key 'week shift -1)) + (`lastmonth (setq key 'month shift -1)) + (`lastyear (setq key 'year shift -1)) + (`lastq (setq key 'quarter shift -1)))) + ;; Prepare start and end times depending on KEY's type. + (pcase key + ((or `day `today) (setq m 0 + h org-extend-today-until + h1 (+ 24 org-extend-today-until) + d (+ d shift))) + ((or `week `thisweek) + (let* ((ws (or wstart 1)) + (diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws))))) + (setq m 0 h org-extend-today-until d (- d diff) d1 (+ 7 d)))) + ((or `month `thismonth) + (setq h org-extend-today-until m 0 d (or mstart 1) + month (+ month shift) month1 (1+ month))) + ((or `quarter `thisq) + ;; Compute if this shift remains in this year. If not, compute + ;; how many years and quarters we have to shift (via floor*) and + ;; compute the shifted years, months and quarters. + (cond + ((< (+ (- q 1) shift) 0) ; Shift not in this year. + (let* ((interval (* -1 (+ (- q 1) shift))) + ;; Set tmp to ((years to shift) (quarters to shift)). + (tmp (cl-floor interval 4))) + ;; Due to the use of floor, 0 quarters actually means 4. + (if (= 0 (nth 1 tmp)) + (setq shiftedy (- y (nth 0 tmp)) + shiftedm 1 + shiftedq 1) + (setq shiftedy (- y (+ 1 (nth 0 tmp))) + shiftedm (- 13 (* 3 (nth 1 tmp))) + shiftedq (- 5 (nth 1 tmp))))) + (setq m 0 h org-extend-today-until d 1 + month shiftedm month1 (+ 3 shiftedm) y shiftedy)) + ((> (+ q shift) 0) ; Shift is within this year. + (setq shiftedq (+ q shift)) + (setq shiftedy y) + (let ((qshift (* 3 (1- (+ q shift))))) + (setq m 0 h org-extend-today-until d 1 + month (+ 1 qshift) month1 (+ 4 qshift)))))) + ((or `year `thisyear) + (setq m 0 h org-extend-today-until d 1 month 1 y (+ y shift) y1 (1+ y))) + ((or `interactive `untilnow)) ; Special cases, ignore them. + (_ (user-error "No such time block %s" key))) + ;; Format start and end times according to AS-STRINGS. + (let* ((start (pcase key + (`interactive (org-read-date nil t nil "Range start? ")) + (`untilnow nil) + (_ (encode-time 0 m h d month y)))) + (end (pcase key + (`interactive (org-read-date nil t nil "Range end? ")) + (`untilnow (current-time)) + (_ (encode-time 0 + m ;; (or m1 m) + (or h1 h) + (or d1 d) + (or month1 month) + (or y1 y))))) + (text + (pcase key + ((or `day `today) (format-time-string "%A, %B %d, %Y" start)) + ((or `week `thisweek) (format-time-string "week %G-W%V" start)) + ((or `month `thismonth) (format-time-string "%B %Y" start)) + ((or `year `thisyear) (format-time-string "the year %Y" start)) + ((or `quarter `thisq) + (concat (org-count-quarter shiftedq) + " quarter of " (number-to-string shiftedy))) + (`interactive "(Range interactively set)") + (`untilnow "now")))) + (if (not as-strings) (list start end text) + (let ((f (cdr org-time-stamp-formats))) + (list (and start (format-time-string f start)) + (format-time-string f end) + text)))))) + +(defun org-count-quarter (n) + (cond + ((= n 1) "1st") + ((= n 2) "2nd") + ((= n 3) "3rd") + ((= n 4) "4th"))) + +;;;###autoload +(defun org-clocktable-shift (dir n) + "Try to shift the :block date of the clocktable at point. +Point must be in the #+BEGIN: line of a clocktable, or this function +will throw an error. +DIR is a direction, a symbol `left', `right', `up', or `down'. +Both `left' and `down' shift the block toward the past, `up' and `right' +push it toward the future. +N is the number of shift steps to take. The size of the step depends on +the currently selected interval size." + (setq n (prefix-numeric-value n)) + (and (memq dir '(left down)) (setq n (- n))) + (save-excursion + (goto-char (point-at-bol)) + (if (not (looking-at "^[ \t]*#\\+BEGIN:[ \t]+clocktable\\>.*?:block[ \t]+\\(\\S-+\\)")) + (user-error "Line needs a :block definition before this command works") + (let* ((b (match-beginning 1)) (e (match-end 1)) + (s (match-string 1)) + block shift ins y mw d date wp) ;; m + (cond + ((equal s "yesterday") (setq s "today-1")) + ((equal s "lastweek") (setq s "thisweek-1")) + ((equal s "lastmonth") (setq s "thismonth-1")) + ((equal s "lastyear") (setq s "thisyear-1")) + ((equal s "lastq") (setq s "thisq-1"))) + + (cond + ((string-match "^\\(today\\|thisweek\\|thismonth\\|thisyear\\|thisq\\)\\([-+][0-9]+\\)?$" s) + (setq block (match-string 1 s) + shift (if (match-end 2) + (string-to-number (match-string 2 s)) + 0)) + (setq shift (+ shift n)) + (setq ins (if (= shift 0) block (format "%s%+d" block shift)))) + ((string-match "\\([0-9]+\\)\\(-\\([wWqQ]?\\)\\([0-9]\\{1,2\\}\\)\\(-\\([0-9]\\{1,2\\}\\)\\)?\\)?" s) + ;; 1 1 2 3 3 4 4 5 6 6 5 2 + (setq y (string-to-number (match-string 1 s)) + wp (and (match-end 3) (match-string 3 s)) + mw (and (match-end 4) (string-to-number (match-string 4 s))) + d (and (match-end 6) (string-to-number (match-string 6 s)))) + (cond + (d (setq ins (format-time-string + "%Y-%m-%d" + (encode-time 0 0 0 (+ d n) nil y)))) ;; m + ((and wp (string-match "w\\|W" wp) mw (> (length wp) 0)) + (require 'cal-iso) + (setq date (calendar-gregorian-from-absolute + (calendar-iso-to-absolute (list (+ mw n) 1 y)))) + (setq ins (format-time-string + "%G-W%V" + (encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date))))) + ((and wp (string-match "q\\|Q" wp) mw (> (length wp) 0)) + (require 'cal-iso) + ; if the 4th + 1 quarter is requested we flip to the 1st quarter of the next year + (if (> (+ mw n) 4) + (setq mw 0 + y (+ 1 y)) + ()) + ; if the 1st - 1 quarter is requested we flip to the 4th quarter of the previous year + (if (= (+ mw n) 0) + (setq mw 5 + y (- y 1)) + ()) + (setq date (calendar-gregorian-from-absolute + (calendar-iso-to-absolute (org-quarter-to-date (+ mw n) y)))) + (setq ins (format-time-string + (concat (number-to-string y) "-Q" (number-to-string (+ mw n))) + (encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date))))) + (mw + (setq ins (format-time-string + "%Y-%m" + (encode-time 0 0 0 1 (+ mw n) y)))) + (y + (setq ins (number-to-string (+ y n)))))) + (t (user-error "Cannot shift clocktable block"))) + (when ins + (goto-char b) + (insert ins) + (delete-region (point) (+ (point) (- e b))) + (beginning-of-line 1) + (org-update-dblock) + t))))) + +;;;###autoload +(defun org-dblock-write:clocktable (params) + "Write the standard clocktable." + (setq params (org-combine-plists org-clocktable-defaults params)) + (catch 'exit + (let* ((scope (plist-get params :scope)) + (base-buffer (org-base-buffer (current-buffer))) + (files (pcase scope + (`agenda + (org-agenda-files t)) + (`agenda-with-archives + (org-add-archive-files (org-agenda-files t))) + (`file-with-archives + (let ((base-file (buffer-file-name base-buffer))) + (and base-file + (org-add-archive-files (list base-file))))) + ((or `nil `file `subtree `tree + (and (pred symbolp) + (guard (string-match "\\`tree\\([0-9]+\\)\\'" + (symbol-name scope))))) + base-buffer) + ((pred functionp) (funcall scope)) + ((pred consp) scope) + (_ (user-error "Unknown scope: %S" scope)))) + (block (plist-get params :block)) + (ts (plist-get params :tstart)) + (te (plist-get params :tend)) + (ws (plist-get params :wstart)) + (ms (plist-get params :mstart)) + (step (plist-get params :step)) + (hide-files (plist-get params :hidefiles)) + (formatter (or (plist-get params :formatter) + org-clock-clocktable-formatter + 'org-clocktable-write-default)) + cc) + ;; Check if we need to do steps + (when block + ;; Get the range text for the header + (setq cc (org-clock-special-range block nil t ws ms) + ts (car cc) + te (nth 1 cc))) + (when step + ;; Write many tables, in steps + (unless (or block (and ts te)) + (user-error "Clocktable `:step' can only be used with `:block' or `:tstart, :end'")) + (org-clocktable-steps params) + (throw 'exit nil)) + + (org-agenda-prepare-buffers (if (consp files) files (list files))) + + (let ((origin (point)) + (tables + (if (consp files) + (mapcar (lambda (file) + (with-current-buffer (find-buffer-visiting file) + (save-excursion + (save-restriction + (org-clock-get-table-data file params))))) + files) + ;; Get the right restriction for the scope. + (save-restriction + (cond + ((not scope)) ;use the restriction as it is now + ((eq scope 'file) (widen)) + ((eq scope 'subtree) (org-narrow-to-subtree)) + ((eq scope 'tree) + (while (org-up-heading-safe)) + (org-narrow-to-subtree)) + ((and (symbolp scope) + (string-match "\\`tree\\([0-9]+\\)\\'" + (symbol-name scope))) + (let ((level (string-to-number + (match-string 1 (symbol-name scope))))) + (catch 'exit + (while (org-up-heading-safe) + (looking-at org-outline-regexp) + (when (<= (org-reduced-level (funcall outline-level)) + level) + (throw 'exit nil)))) + (org-narrow-to-subtree)))) + (list (org-clock-get-table-data nil params))))) + (multifile + ;; Even though `file-with-archives' can consist of + ;; multiple files, we consider this is one extended file + ;; instead. + (and (not hide-files) + (consp files) + (not (eq scope 'file-with-archives))))) + + (funcall formatter + origin + tables + (org-combine-plists params `(:multifile ,multifile))))))) + +(defun org-clocktable-write-default (ipos tables params) + "Write out a clock table at position IPOS in the current buffer. +TABLES is a list of tables with clocking data as produced by +`org-clock-get-table-data'. PARAMS is the parameter property list obtained +from the dynamic block definition." + ;; This function looks quite complicated, mainly because there are a + ;; lot of options which can add or remove columns. I have massively + ;; commented this function, the I hope it is understandable. If + ;; someone wants to write their own special formatter, this maybe + ;; much easier because there can be a fixed format with a + ;; well-defined number of columns... + (let* ((lang (or (plist-get params :lang) "en")) + (multifile (plist-get params :multifile)) + (block (plist-get params :block)) + (sort (plist-get params :sort)) + (header (plist-get params :header)) + (link (plist-get params :link)) + (maxlevel (or (plist-get params :maxlevel) 3)) + (emph (plist-get params :emphasize)) + (compact? (plist-get params :compact)) + (narrow (or (plist-get params :narrow) (and compact? '40!))) + (level? (and (not compact?) (plist-get params :level))) + (timestamp (plist-get params :timestamp)) + (tags (plist-get params :tags)) + (properties (plist-get params :properties)) + (time-columns + (if (or compact? (< maxlevel 2)) 1 + ;; Deepest headline level is a hard limit for the number + ;; of time columns. + (let ((levels + (cl-mapcan + (lambda (table) + (pcase table + (`(,_ ,(and (pred wholenump) (pred (/= 0))) ,entries) + (mapcar #'car entries)))) + tables))) + (min maxlevel + (or (plist-get params :tcolumns) 100) + (if (null levels) 1 (apply #'max levels)))))) + (indent (or compact? (plist-get params :indent))) + (formula (plist-get params :formula)) + (case-fold-search t) + (total-time (apply #'+ (mapcar #'cadr tables))) + recalc narrow-cut-p) + + (when (and narrow (integerp narrow) link) + ;; We cannot have both integer narrow and link. + (message "Using hard narrowing in clocktable to allow for links") + (setq narrow (intern (format "%d!" narrow)))) + + (pcase narrow + ((or `nil (pred integerp)) nil) ;nothing to do + ((and (pred symbolp) + (guard (string-match-p "\\`[0-9]+!\\'" (symbol-name narrow)))) + (setq narrow-cut-p t) + (setq narrow (string-to-number (symbol-name narrow)))) + (_ (user-error "Invalid value %s of :narrow property in clock table" narrow))) + + ;; Now we need to output this table stuff. + (goto-char ipos) + + ;; Insert the text *before* the actual table. + (insert-before-markers + (or header + ;; Format the standard header. + (format "#+CAPTION: %s %s%s\n" + (org-clock--translate "Clock summary at" lang) + (format-time-string (org-time-stamp-format t t)) + (if block + (let ((range-text + (nth 2 (org-clock-special-range + block nil t + (plist-get params :wstart) + (plist-get params :mstart))))) + (format ", for %s." range-text)) + "")))) + + ;; Insert the narrowing line + (when (and narrow (integerp narrow) (not narrow-cut-p)) + (insert-before-markers + "|" ;table line starter + (if multifile "|" "") ;file column, maybe + (if level? "|" "") ;level column, maybe + (if timestamp "|" "") ;timestamp column, maybe + (if tags "|" "") ;tags columns, maybe + (if properties ;properties columns, maybe + (make-string (length properties) ?|) + "") + (format "<%d>| |\n" narrow))) ;headline and time columns + + ;; Insert the table header line + (insert-before-markers + "|" ;table line starter + (if multifile ;file column, maybe + (concat (org-clock--translate "File" lang) "|") + "") + (if level? ;level column, maybe + (concat (org-clock--translate "L" lang) "|") + "") + (if timestamp ;timestamp column, maybe + (concat (org-clock--translate "Timestamp" lang) "|") + "") + (if tags "Tags |" "") ;tags columns, maybe + + (if properties ;properties columns, maybe + (concat (mapconcat #'identity properties "|") "|") + "") + (concat (org-clock--translate "Headline" lang)"|") + (concat (org-clock--translate "Time" lang) "|") + (make-string (max 0 (1- time-columns)) ?|) ;other time columns + (if (eq formula '%) "%|\n" "\n")) + + ;; Insert the total time in the table + (insert-before-markers + "|-\n" ;a hline + "|" ;table line starter + (if multifile (format "| %s " (org-clock--translate "ALL" lang)) "") + ;file column, maybe + (if level? "|" "") ;level column, maybe + (if timestamp "|" "") ;timestamp column, maybe + (if tags "|" "") ;timestamp column, maybe + (make-string (length properties) ?|) ;properties columns, maybe + (concat (format org-clock-total-time-cell-format + (org-clock--translate "Total time" lang)) + "| ") + (format org-clock-total-time-cell-format + (org-duration-from-minutes (or total-time 0))) ;time + "|" + (make-string (max 0 (1- time-columns)) ?|) + (cond ((not (eq formula '%)) "") + ((or (not total-time) (= total-time 0)) "0.0|") + (t "100.0|")) + "\n") + + ;; Now iterate over the tables and insert the data but only if any + ;; time has been collected. + (when (and total-time (> total-time 0)) + (pcase-dolist (`(,file-name ,file-time ,entries) tables) + (when (or (and file-time (> file-time 0)) + (not (plist-get params :fileskip0))) + (insert-before-markers "|-\n") ;hline at new file + ;; First the file time, if we have multiple files. + (when multifile + ;; Summarize the time collected from this file. + (insert-before-markers + (format (concat "| %s %s | %s%s%s" + (format org-clock-file-time-cell-format + (org-clock--translate "File time" lang)) + + ;; The file-time rollup value goes in the first time + ;; column (of which there is always at least one)... + " | *%s*|" + ;; ...and the remaining file time cols (if any) are blank. + (make-string (max 0 (1- time-columns)) ?|) + + ;; Optionally show the percentage contribution of "this" + ;; file time to the total time. + (if (eq formula '%) " %s |" "") + "\n") + + (file-name-nondirectory file-name) + (if level? "| " "") ;level column, maybe + (if timestamp "| " "") ;timestamp column, maybe + (if tags "| " "") ;tags column, maybe + (if properties ;properties columns, maybe + (make-string (length properties) ?|) + "") + (org-duration-from-minutes file-time) ;time + + (cond ((not (eq formula '%)) "") ;time percentage, maybe + ((or (not total-time) (= total-time 0)) "0.0") + (t + (format "%.1f" (* 100 (/ file-time (float total-time))))))))) + + ;; Get the list of node entries and iterate over it + (when (> maxlevel 0) + (pcase-dolist (`(,level ,headline ,tgs ,ts ,time ,props) entries) + (when narrow-cut-p + (setq headline + (if (and (string-match + (format "\\`%s\\'" org-link-bracket-re) + headline) + (match-end 2)) + (format "[[%s][%s]]" + (match-string 1 headline) + (org-shorten-string (match-string 2 headline) + narrow)) + (org-shorten-string headline narrow)))) + (cl-flet ((format-field (f) (format (cond ((not emph) "%s |") + ((= level 1) "*%s* |") + ((= level 2) "/%s/ |") + (t "%s |")) + f))) + (insert-before-markers + "|" ;start the table line + (if multifile "|" "") ;free space for file name column? + (if level? (format "%d|" level) "") ;level, maybe + (if timestamp (concat ts "|") "") ;timestamp, maybe + (if tags (concat (mapconcat #'identity tgs ", ") "|") "") ;tags, maybe + (if properties ;properties columns, maybe + (concat (mapconcat (lambda (p) (or (cdr (assoc p props)) "")) + properties + "|") + "|") + "") + (if indent ;indentation + (org-clocktable-indent-string level) + "") + (format-field headline) + ;; Empty fields for higher levels. + (make-string (max 0 (1- (min time-columns level))) ?|) + (format-field (org-duration-from-minutes time)) + (make-string (max 0 (- time-columns level)) ?|) + (if (eq formula '%) + (format "%.1f |" (* 100 (/ time (float total-time)))) + "") + "\n"))))))) + (delete-char -1) + (cond + ;; Possibly rescue old formula? + ((or (not formula) (eq formula '%)) + (let ((contents (org-string-nw-p (plist-get params :content)))) + (when (and contents (string-match "^\\([ \t]*#\\+tblfm:.*\\)" contents)) + (setq recalc t) + (insert "\n" (match-string 1 contents)) + (beginning-of-line 0)))) + ;; Insert specified formula line. + ((stringp formula) + (insert "\n#+TBLFM: " formula) + (setq recalc t)) + (t + (user-error "Invalid :formula parameter in clocktable"))) + ;; Back to beginning, align the table, recalculate if necessary. + (goto-char ipos) + (skip-chars-forward "^|") + (org-table-align) + (when org-hide-emphasis-markers + ;; We need to align a second time. + (org-table-align)) + (when sort + (save-excursion + (org-table-goto-line 3) + (org-table-goto-column (car sort)) + (org-table-sort-lines nil (cdr sort)))) + (when recalc (org-table-recalculate 'all)) + total-time)) + +(defun org-clocktable-indent-string (level) + "Return indentation string according to LEVEL. +LEVEL is an integer. Indent by two spaces per level above 1." + (if (= level 1) "" + (concat "\\_" (make-string (* 2 (1- level)) ?\s)))) + +(defun org-clocktable-steps (params) + "Create one or more clock tables, according to PARAMS. +Step through the range specifications in plist PARAMS to make +a number of clock tables." + (let* ((ignore-empty-tables (plist-get params :stepskip0)) + (step (plist-get params :step)) + (step-header + (pcase step + (`day "Daily report: ") + (`week "Weekly report starting on: ") + (`semimonth "Semimonthly report starting on: ") + (`month "Monthly report starting on: ") + (`year "Annual report starting on: ") + (_ (user-error "Unknown `:step' specification: %S" step)))) + (week-start (or (plist-get params :wstart) 1)) + (month-start (or (plist-get params :mstart) 1)) + (range + (pcase (plist-get params :block) + (`nil nil) + (range + (org-clock-special-range range nil t week-start month-start)))) + ;; For both START and END, any number is an absolute day + ;; number from Agenda. Otherwise, consider value to be an Org + ;; timestamp string. The `:block' property has precedence + ;; over `:tstart' and `:tend'. + (start + (pcase (if range (car range) (plist-get params :tstart)) + ((and (pred numberp) n) + (pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n))) + (apply #'encode-time (list 0 0 org-extend-today-until d m y)))) + (timestamp + (seconds-to-time + (org-matcher-time (or timestamp + ;; The year Org was born. + "<2003-01-01 Thu 00:00>")))))) + (end + (pcase (if range (nth 1 range) (plist-get params :tend)) + ((and (pred numberp) n) + (pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n))) + (apply #'encode-time (list 0 0 org-extend-today-until d m y)))) + (timestamp (seconds-to-time (org-matcher-time timestamp)))))) + (while (time-less-p start end) + (unless (bolp) (insert "\n")) + ;; Insert header before each clock table. + (insert "\n" + step-header + (format-time-string (org-time-stamp-format nil t) start) + "\n") + ;; Compute NEXT, which is the end of the current clock table, + ;; according to step. + (let* ((next + (apply #'encode-time + (pcase-let + ((`(,_ ,_ ,_ ,d ,m ,y ,dow . ,_) (decode-time start))) + (pcase step + (`day (list 0 0 org-extend-today-until (1+ d) m y)) + (`week + (let ((offset (if (= dow week-start) 7 + (mod (- week-start dow) 7)))) + (list 0 0 org-extend-today-until (+ d offset) m y))) + (`semimonth (list 0 0 0 + (if (< d 16) 16 1) + (if (< d 16) m (1+ m)) y)) + (`month (list 0 0 0 month-start (1+ m) y)) + (`year (list 0 0 org-extend-today-until 1 1 (1+ y))))))) + (table-begin (line-beginning-position 0)) + (step-time + ;; Write clock table between START and NEXT. + (org-dblock-write:clocktable + (org-combine-plists + params (list :header "" + :step nil + :block nil + :tstart (format-time-string + (org-time-stamp-format t t) + start) + :tend (format-time-string + (org-time-stamp-format t t) + ;; Never include clocks past END. + (if (time-less-p end next) end next))))))) + (let ((case-fold-search t)) (re-search-forward "^[ \t]*#\\+END:")) + ;; Remove the table if it is empty and `:stepskip0' is + ;; non-nil. + (when (and ignore-empty-tables (equal step-time 0)) + (delete-region (line-beginning-position) table-begin)) + (setq start next)) + (end-of-line 0)))) + +(defun org-clock-get-table-data (file params) + "Get the clocktable data for file FILE, with parameters PARAMS. +FILE is only for identification - this function assumes that +the correct buffer is current, and that the wanted restriction is +in place. +The return value will be a list with the file name and the total +file time (in minutes) as 1st and 2nd elements. The third element +of this list will be a list of headline entries. Each entry has the +following structure: + + (LEVEL HEADLINE TAGS TIMESTAMP TIME PROPERTIES) + +LEVEL: The level of the headline, as an integer. This will be + the reduced level, so 1,2,3,... even if only odd levels + are being used. +HEADLINE: The text of the headline. Depending on PARAMS, this may + already be formatted like a link. +TAGS: The list of tags of the headline. +TIMESTAMP: If PARAMS require it, this will be a time stamp found in the + entry, any of SCHEDULED, DEADLINE, NORMAL, or first inactive, + in this sequence. +TIME: The sum of all time spend in this tree, in minutes. This time + will of cause be restricted to the time block and tags match + specified in PARAMS. +PROPERTIES: The list properties specified in the `:properties' parameter + along with their value, as an alist following the pattern + (NAME . VALUE)." + (let* ((maxlevel (or (plist-get params :maxlevel) 3)) + (timestamp (plist-get params :timestamp)) + (ts (plist-get params :tstart)) + (te (plist-get params :tend)) + (ws (plist-get params :wstart)) + (ms (plist-get params :mstart)) + (block (plist-get params :block)) + (link (plist-get params :link)) + (tags (plist-get params :tags)) + (match (plist-get params :match)) + (properties (plist-get params :properties)) + (inherit-property-p (plist-get params :inherit-props)) + (matcher (and match (cdr (org-make-tags-matcher match)))) + cc st p tbl) + + (setq org-clock-file-total-minutes nil) + (when block + (setq cc (org-clock-special-range block nil t ws ms) + ts (car cc) + te (nth 1 cc))) + (when (integerp ts) (setq ts (calendar-gregorian-from-absolute ts))) + (when (integerp te) (setq te (calendar-gregorian-from-absolute te))) + (when (and ts (listp ts)) + (setq ts (format "%4d-%02d-%02d" (nth 2 ts) (car ts) (nth 1 ts)))) + (when (and te (listp te)) + (setq te (format "%4d-%02d-%02d" (nth 2 te) (car te) (nth 1 te)))) + ;; Now the times are strings we can parse. + (if ts (setq ts (org-matcher-time ts))) + (if te (setq te (org-matcher-time te))) + (save-excursion + (org-clock-sum ts te + (when matcher + (lambda () + (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))))) + (goto-char (point-min)) + (setq st t) + (while (or (and (bobp) (prog1 st (setq st nil)) + (get-text-property (point) :org-clock-minutes) + (setq p (point-min))) + (setq p (next-single-property-change + (point) :org-clock-minutes))) + (goto-char p) + (let ((time (get-text-property p :org-clock-minutes))) + (when (and time (> time 0) (org-at-heading-p)) + (let ((level (org-reduced-level (org-current-level)))) + (when (<= level maxlevel) + (let* ((headline (org-get-heading t t t t)) + (hdl + (if (not link) headline + (let ((search + (org-link-heading-search-string headline))) + (org-link-make-string + (if (not (buffer-file-name)) search + (format "file:%s::%s" (buffer-file-name) search)) + ;; Prune statistics cookies. Replace + ;; links with their description, or + ;; a plain link if there is none. + (org-trim + (org-link-display-format + (replace-regexp-in-string + "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" "" + headline))))))) + (tgs (and tags (org-get-tags))) + (tsp + (and timestamp + (cl-some (lambda (p) (org-entry-get (point) p)) + '("SCHEDULED" "DEADLINE" "TIMESTAMP" + "TIMESTAMP_IA")))) + (props + (and properties + (delq nil + (mapcar + (lambda (p) + (let ((v (org-entry-get + (point) p inherit-property-p))) + (and v (cons p v)))) + properties))))) + (push (list level hdl tgs tsp time props) tbl))))))) + (list file org-clock-file-total-minutes (nreverse tbl))))) + +;; Saving and loading the clock + +(defvar org-clock-loaded nil + "Was the clock file loaded?") + +;;;###autoload +(defun org-clock-update-time-maybe () + "If this is a CLOCK line, update it and return t. +Otherwise, return nil." + (interactive) + (save-excursion + (beginning-of-line 1) + (skip-chars-forward " \t") + (when (looking-at org-clock-string) + (let ((re (concat "[ \t]*" org-clock-string + " *[[<]\\([^]>]+\\)[]>]\\(-+[[<]\\([^]>]+\\)[]>]" + "\\([ \t]*=>.*\\)?\\)?")) + ts te h m s neg) + (cond + ((not (looking-at re)) + nil) + ((not (match-end 2)) + (when (and (equal (marker-buffer org-clock-marker) (current-buffer)) + (> org-clock-marker (point)) + (<= org-clock-marker (point-at-eol))) + ;; The clock is running here + (setq org-clock-start-time + (org-time-string-to-time (match-string 1))) + (org-clock-update-mode-line))) + (t + (and (match-end 4) (delete-region (match-beginning 4) (match-end 4))) + (end-of-line 1) + (setq ts (match-string 1) + te (match-string 3)) + (setq s (- (float-time + (apply #'encode-time (org-parse-time-string te))) + (float-time + (apply #'encode-time (org-parse-time-string ts)))) + neg (< s 0) + s (abs s) + h (floor (/ s 3600)) + s (- s (* 3600 h)) + m (floor (/ s 60)) + s (- s (* 60 s))) + (insert " => " (format (if neg "-%d:%02d" "%2d:%02d") h m)) + t)))))) + +(defun org-clock-save () + "Persist various clock-related data to disk. +The details of what will be saved are regulated by the variable +`org-clock-persist'." + (when (and org-clock-persist + (or org-clock-loaded + org-clock-has-been-used + (not (file-exists-p org-clock-persist-file)))) + (with-temp-file org-clock-persist-file + (insert (format ";; %s - %s at %s\n" + (file-name-nondirectory org-clock-persist-file) + (system-name) + (format-time-string (org-time-stamp-format t)))) + ;; Store clock to be resumed. + (when (and (memq org-clock-persist '(t clock)) + (let ((b (org-base-buffer (org-clocking-buffer)))) + (and (buffer-live-p b) + (buffer-file-name b) + (or (not org-clock-persist-query-save) + (y-or-n-p (format "Save current clock (%s) " + org-clock-heading)))))) + (insert + (format "(setq org-clock-stored-resume-clock '(%S . %d))\n" + (buffer-file-name (org-base-buffer (org-clocking-buffer))) + (marker-position org-clock-marker)))) + ;; Store clocked task history. Tasks are stored reversed to + ;; make reading simpler. + (when (and (memq org-clock-persist '(t history)) + org-clock-history) + (insert + (format "(setq org-clock-stored-history '(%s))\n" + (mapconcat + (lambda (m) + (let ((b (org-base-buffer (marker-buffer m)))) + (when (and (buffer-live-p b) + (buffer-file-name b)) + (format "(%S . %d)" + (buffer-file-name b) + (marker-position m))))) + (reverse org-clock-history) + " "))))))) + +(defun org-clock-load () + "Load clock-related data from disk, maybe resuming a stored clock." + (when (and org-clock-persist (not org-clock-loaded)) + (if (not (file-readable-p org-clock-persist-file)) + (message "Not restoring clock data; %S not found" org-clock-persist-file) + (message "Restoring clock data") + ;; Load history. + (load-file org-clock-persist-file) + (setq org-clock-loaded t) + (pcase-dolist (`(,(and file (pred file-exists-p)) . ,position) + org-clock-stored-history) + (org-clock-history-push position (find-file-noselect file))) + ;; Resume clock. + (pcase org-clock-stored-resume-clock + (`(,(and file (pred file-exists-p)) . ,position) + (with-current-buffer (find-file-noselect file) + (when (or (not org-clock-persist-query-resume) + (y-or-n-p (format "Resume clock (%s) " + (save-excursion + (goto-char position) + (org-get-heading t t))))) + (goto-char position) + (let ((org-clock-in-resume 'auto-restart) + (org-clock-auto-clock-resolution nil)) + (org-clock-in) + (when (org-invisible-p) (org-show-context)))))) + (_ nil))))) + +(defun org-clock-kill-emacs-query () + "Query user when killing Emacs. +This function is added to `kill-emacs-query-functions'." + (let ((buf (org-clocking-buffer))) + (when (and buf (yes-or-no-p "Clock out and save? ")) + (with-current-buffer buf + (org-clock-out) + (save-buffer)))) + ;; Unconditionally return t for `kill-emacs-query-functions'. + t) + +;; Suggested bindings +(org-defkey org-mode-map "\C-c\C-x\C-e" 'org-clock-modify-effort-estimate) + +(provide 'org-clock) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; coding: utf-8 +;; End: + +;;; org-clock.el ends here diff --git a/elpa/org-9.5.2/org-clock.elc b/elpa/org-9.5.2/org-clock.elc new file mode 100644 index 0000000..413b4f5 Binary files /dev/null and b/elpa/org-9.5.2/org-clock.elc differ diff --git a/elpa/org-9.5.2/org-colview.el b/elpa/org-9.5.2/org-colview.el new file mode 100644 index 0000000..9794382 --- /dev/null +++ b/elpa/org-9.5.2/org-colview.el @@ -0,0 +1,1738 @@ +;;; org-colview.el --- Column View in Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the column view for Org. + +;;; Code: + +(require 'cl-lib) +(require 'org) + +(declare-function org-agenda-redo "org-agenda" (&optional all)) +(declare-function org-agenda-do-context-action "org-agenda" ()) +(declare-function org-clock-sum-today "org-clock" (&optional headline-filter)) +(declare-function org-element-extract-element "org-element" (element)) +(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)) +(declare-function org-element-parse-secondary-string "org-element" (string restriction &optional parent)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-restriction "org-element" (element)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-dynamic-block-define "org" (type func)) +(declare-function org-link-display-format "ol" (s)) +(declare-function org-link-open-from-string "ol" (s &optional arg)) +(declare-function face-remap-remove-relative "face-remap" (cookie)) +(declare-function face-remap-add-relative "face-remap" (face &rest specs)) + +(defvar org-agenda-columns-add-appointments-to-effort-sum) +(defvar org-agenda-columns-compute-summary-properties) +(defvar org-agenda-columns-show-summaries) +(defvar org-agenda-view-columns-initially) +(defvar org-inlinetask-min-level) + + +;;; Configuration + +(defcustom org-columns-modify-value-for-display-function nil + "Function that modifies values for display in column view. +For example, it can be used to cut out a certain part from a time stamp. +The function must take 2 arguments: + +column-title The title of the column (*not* the property name) +value The value that should be modified. + +The function should return the value that should be displayed, +or nil if the normal value should be used." + :group 'org-properties + :type '(choice (const nil) (function))) + +(defcustom org-columns-summary-types nil + "Alist between operators and summarize functions. + +Each association follows the pattern (LABEL . SUMMARIZE), +or (LABEL SUMMARIZE COLLECT) where + + LABEL is a string used in #+COLUMNS definition describing the + summary type. It can contain any character but \"}\". It is + case-sensitive. + + SUMMARIZE is a function called with two arguments. The first + argument is a non-empty list of values, as non-empty strings. + The second one is a format string or nil. It has to return + a string summarizing the list of values. + + COLLECT is a function called with one argument, a property + name. It is called in the context of a headline and must + return the collected property, or the empty string. You can + use this to only collect a property if a related conditional + properties is set, e.g., to return VACATION_DAYS only if + CONFIRMED is true. + +Note that the return value can become one value for an higher +order summary, so the function is expected to handle its own +output. + +Types defined in this variable take precedence over those defined +in `org-columns-summary-types-default', which see." + :group 'org-properties + :version "26.1" + :package-version '(Org . "9.0") + :type '(alist :key-type (string :tag " Label") + :value-type + (choice (function :tag "Summarize") + (list :tag "Collect and summarize" + (function :tag "Summarize") + (function :tag "Collect"))))) + + + +;;; Column View + +(defvar-local org-columns-overlays nil + "Holds the list of current column overlays.") + +(defvar-local org-columns-current-fmt nil + "Local variable, holds the currently active column format.") + +(defvar-local org-columns-current-fmt-compiled nil + "Local variable, holds the currently active column format. +This is the compiled version of the format.") + +(defvar-local org-columns-current-maxwidths nil + "Currently active maximum column widths, as a vector.") + +(defvar-local org-columns-begin-marker nil + "Points to the position where last a column creation command was called.") + +(defvar-local org-columns-top-level-marker nil + "Points to the position where current columns region starts.") + +(defvar org-columns--time 0.0 + "Number of seconds since the epoch, as a floating point number.") + +(defvar org-columns-map (make-sparse-keymap) + "The keymap valid in column display.") + +(defconst org-columns-summary-types-default + '(("+" . org-columns--summary-sum) + ("$" . org-columns--summary-currencies) + ("X" . org-columns--summary-checkbox) + ("X/" . org-columns--summary-checkbox-count) + ("X%" . org-columns--summary-checkbox-percent) + ("max" . org-columns--summary-max) + ("mean" . org-columns--summary-mean) + ("min" . org-columns--summary-min) + (":" . org-columns--summary-sum-times) + (":max" . org-columns--summary-max-time) + (":mean" . org-columns--summary-mean-time) + (":min" . org-columns--summary-min-time) + ("@max" . org-columns--summary-max-age) + ("@mean" . org-columns--summary-mean-age) + ("@min" . org-columns--summary-min-age) + ("est+" . org-columns--summary-estimate)) + "Map operators to summarize functions. +See `org-columns-summary-types' for details.") + +(defun org-columns-content () + "Switch to contents view while in columns view." + (interactive) + (org-overview) + (org-content)) + +(org-defkey org-columns-map "c" #'org-columns-content) +(org-defkey org-columns-map "o" #'org-overview) +(org-defkey org-columns-map "e" #'org-columns-edit-value) +(org-defkey org-columns-map "\C-c\C-t" #'org-columns-todo) +(org-defkey org-columns-map "\C-c\C-c" #'org-columns-toggle-or-columns-quit) +(org-defkey org-columns-map "\C-c\C-o" #'org-columns-open-link) +(org-defkey org-columns-map "v" #'org-columns-show-value) +(org-defkey org-columns-map "q" #'org-columns-quit) +(org-defkey org-columns-map "r" #'org-columns-redo) +(org-defkey org-columns-map "g" #'org-columns-redo) +(org-defkey org-columns-map [left] #'backward-char) +(org-defkey org-columns-map "\M-b" #'backward-char) +(org-defkey org-columns-map "a" #'org-columns-edit-allowed) +(org-defkey org-columns-map "s" #'org-columns-edit-attributes) +(org-defkey org-columns-map "\M-f" + (lambda () (interactive) (goto-char (1+ (point))))) +(org-defkey org-columns-map [right] + (lambda () (interactive) (goto-char (1+ (point))))) +(org-defkey org-columns-map [down] + (lambda () (interactive) + (let ((col (current-column))) + (beginning-of-line 2) + (while (and (org-invisible-p2) (not (eobp))) + (beginning-of-line 2)) + (move-to-column col) + (if (derived-mode-p 'org-agenda-mode) + (org-agenda-do-context-action))))) +(org-defkey org-columns-map [up] + (lambda () (interactive) + (let ((col (current-column))) + (beginning-of-line 0) + (while (and (org-invisible-p2) (not (bobp))) + (beginning-of-line 0)) + (move-to-column col) + (if (eq major-mode 'org-agenda-mode) + (org-agenda-do-context-action))))) +(org-defkey org-columns-map [(shift right)] #'org-columns-next-allowed-value) +(org-defkey org-columns-map "n" #'org-columns-next-allowed-value) +(org-defkey org-columns-map [(shift left)] #'org-columns-previous-allowed-value) +(org-defkey org-columns-map "p" #'org-columns-previous-allowed-value) +(org-defkey org-columns-map "<" #'org-columns-narrow) +(org-defkey org-columns-map ">" #'org-columns-widen) +(org-defkey org-columns-map [(meta right)] #'org-columns-move-right) +(org-defkey org-columns-map [(meta left)] #'org-columns-move-left) +(org-defkey org-columns-map [(shift meta right)] #'org-columns-new) +(org-defkey org-columns-map [(shift meta left)] #'org-columns-delete) +(dotimes (i 10) + (org-defkey org-columns-map (number-to-string i) + (lambda () (interactive) + (org-columns-next-allowed-value nil i)))) + +(easy-menu-define org-columns-menu org-columns-map "Org Column Menu." + '("Column" + ["Edit property" org-columns-edit-value t] + ["Next allowed value" org-columns-next-allowed-value t] + ["Previous allowed value" org-columns-previous-allowed-value t] + ["Show full value" org-columns-show-value t] + ["Edit allowed values" org-columns-edit-allowed t] + "--" + ["Edit column attributes" org-columns-edit-attributes t] + ["Increase column width" org-columns-widen t] + ["Decrease column width" org-columns-narrow t] + "--" + ["Move column right" org-columns-move-right t] + ["Move column left" org-columns-move-left t] + ["Add column" org-columns-new t] + ["Delete column" org-columns-delete t] + "--" + ["CONTENTS" org-columns-content t] + ["OVERVIEW" org-overview t] + ["Refresh columns display" org-columns-redo t] + "--" + ["Open link" org-columns-open-link t] + "--" + ["Quit" org-columns-quit t])) + +(defun org-columns--displayed-value (spec value &optional no-star) + "Return displayed value for specification SPEC in current entry. + +SPEC is a column format specification as stored in +`org-columns-current-fmt-compiled'. VALUE is the real value to +display, as a string. + +When NO-STAR is non-nil, do not add asterisks before displayed +value for ITEM property." + (or (and (functionp org-columns-modify-value-for-display-function) + (funcall org-columns-modify-value-for-display-function + (nth 1 spec) ;column name + value)) + (pcase spec + (`("ITEM" . ,_) + (let ((stars + (and (not no-star) + (concat (make-string (1- (org-current-level)) + (if org-hide-leading-stars ?\s ?*)) + "* ")))) + (concat stars (org-link-display-format value)))) + (`(,(or "DEADLINE" "SCHEDULED" "TIMESTAMP") . ,_) + (replace-regexp-in-string org-ts-regexp "[\\1]" value)) + (`(,_ ,_ ,_ ,_ nil) value) + ;; If PRINTF is set, assume we are displaying a number and + ;; obey to the format string. + (`(,_ ,_ ,_ ,_ ,printf) (format printf (string-to-number value))) + (_ (error "Invalid column specification format: %S" spec))))) + +(defun org-columns--collect-values (&optional compiled-fmt) + "Collect values for columns on the current line. + +Return a list of triplets (SPEC VALUE DISPLAYED) suitable for +`org-columns--display-here'. + +This function assumes `org-columns-current-fmt-compiled' is +initialized is set in the current buffer. However, it is +possible to override it with optional argument COMPILED-FMT." + (let ((summaries (get-text-property (point) 'org-summaries))) + (mapcar + (lambda (spec) + (pcase spec + (`(,p . ,_) + (let* ((v (or (cdr (assoc spec summaries)) + (org-entry-get (point) p 'selective t) + (and compiled-fmt ;assume `org-agenda-columns' + ;; Effort property is not defined. Try + ;; to use appointment duration. + org-agenda-columns-add-appointments-to-effort-sum + (string= p (upcase org-effort-property)) + (get-text-property (point) 'duration) + (propertize (org-duration-from-minutes + (get-text-property (point) 'duration)) + 'face 'org-warning)) + ""))) + ;; A non-nil COMPILED-FMT means we're calling from Org + ;; Agenda mode, where we do not want leading stars for + ;; ITEM. Hence the optional argument for + ;; `org-columns--displayed-value'. + (list spec v (org-columns--displayed-value spec v compiled-fmt)))))) + (or compiled-fmt org-columns-current-fmt-compiled)))) + +(defun org-columns--set-widths (cache) + "Compute the maximum column widths from the format and CACHE. +This function sets `org-columns-current-maxwidths' as a vector of +integers greater than 0." + (setq org-columns-current-maxwidths + (apply #'vector + (mapcar + (lambda (spec) + (pcase spec + (`(,_ ,_ ,(and width (pred wholenump)) . ,_) width) + (`(,_ ,name . ,_) + ;; No width is specified in the columns format. + ;; Compute it by checking all possible values for + ;; PROPERTY. + (let ((width (length name))) + (dolist (entry cache width) + (let ((value (nth 2 (assoc spec (cdr entry))))) + (setq width (max (length value) width)))))))) + org-columns-current-fmt-compiled)))) + +(defun org-columns--new-overlay (beg end &optional string face) + "Create a new column overlay and add it to the list." + (let ((ov (make-overlay beg end))) + (overlay-put ov 'face (or face 'secondary-selection)) + (org-overlay-display ov string face) + (push ov org-columns-overlays) + ov)) + +(defun org-columns--summarize (operator) + "Return summary function associated to string OPERATOR." + (pcase (or (assoc operator org-columns-summary-types) + (assoc operator org-columns-summary-types-default)) + (`nil (error "Unknown %S operator" operator)) + (`(,_ . ,(and (pred functionp) summarize)) summarize) + (`(,_ ,summarize ,_) summarize) + (_ (error "Invalid definition for operator %S" operator)))) + +(defun org-columns--collect (operator) + "Return collect function associated to string OPERATOR. +Return nil if no collect function is associated to OPERATOR." + (pcase (or (assoc operator org-columns-summary-types) + (assoc operator org-columns-summary-types-default)) + (`nil (error "Unknown %S operator" operator)) + (`(,_ . ,(pred functionp)) nil) ;default value + (`(,_ ,_ ,collect) collect) + (_ (error "Invalid definition for operator %S" operator)))) + +(defun org-columns--overlay-text (value fmt width property original) + "Return decorated VALUE string for columns overlay display. +FMT is a format string. WIDTH is the width of the column, as an +integer. PROPERTY is the property being displayed, as a string. +ORIGINAL is the real string, i.e., before it is modified by +`org-columns--displayed-value'." + (format fmt + (let ((v (org-columns-add-ellipses value width))) + (pcase property + ("PRIORITY" + (propertize v 'face (org-get-priority-face original))) + ("TAGS" + (if (not org-tags-special-faces-re) + (propertize v 'face 'org-tag) + (replace-regexp-in-string + org-tags-special-faces-re + (lambda (m) (propertize m 'face (org-get-tag-face m))) + v nil nil 1))) + ("TODO" (propertize v 'face (org-get-todo-face original))) + (_ v))))) + +(defvar org-columns-header-line-remap nil + "Store the relative remapping of column header-line. +This is needed to later remove this relative remapping.") + +(defun org-columns--display-here (columns &optional dateline) + "Overlay the current line with column display. +COLUMNS is an alist (SPEC VALUE DISPLAYED). Optional argument +DATELINE is non-nil when the face used should be +`org-agenda-column-dateline'." + (when (ignore-errors (require 'face-remap)) + (setq org-columns-header-line-remap + (face-remap-add-relative 'header-line '(:inherit default)))) + (save-excursion + (beginning-of-line) + (let* ((level-face (and (looking-at "\\(\\**\\)\\(\\* \\)") + (org-get-level-face 2))) + (ref-face (or level-face + (and (eq major-mode 'org-agenda-mode) + (org-get-at-bol 'face)) + 'default)) + (color (list :foreground (face-attribute ref-face :foreground))) + (font (list :family (face-attribute 'default :family))) + (face (list color font 'org-column ref-face)) + (face1 (list color font 'org-agenda-column-dateline ref-face))) + ;; Each column is an overlay on top of a character. So there has + ;; to be at least as many characters available on the line as + ;; columns to display. + (let ((columns (length org-columns-current-fmt-compiled)) + (chars (- (line-end-position) (line-beginning-position)))) + (when (> columns chars) + (save-excursion + (end-of-line) + (let ((inhibit-read-only t)) + (insert (make-string (- columns chars) ?\s)))))) + ;; Display columns. Create and install the overlay for the + ;; current column on the next character. + (let ((i 0) + (last (1- (length columns)))) + (dolist (column columns) + (pcase column + (`(,spec ,original ,value) + (let* ((property (car spec)) + (width (aref org-columns-current-maxwidths i)) + (fmt (format (if (= i last) "%%-%d.%ds |" + "%%-%d.%ds | ") + width width)) + (ov (org-columns--new-overlay + (point) (1+ (point)) + (org-columns--overlay-text + value fmt width property original) + (if dateline face1 face)))) + (overlay-put ov 'keymap org-columns-map) + (overlay-put ov 'org-columns-key property) + (overlay-put ov 'org-columns-value original) + (overlay-put ov 'org-columns-value-modified value) + (overlay-put ov 'org-columns-format fmt) + (overlay-put ov 'line-prefix "") + (overlay-put ov 'wrap-prefix "") + (forward-char)))) + (cl-incf i))) + ;; Make the rest of the line disappear. + (let ((ov (org-columns--new-overlay (point) (line-end-position)))) + (overlay-put ov 'invisible t) + (overlay-put ov 'keymap org-columns-map) + (overlay-put ov 'line-prefix "") + (overlay-put ov 'wrap-prefix "")) + (let ((ov (make-overlay (1- (line-end-position)) + (line-beginning-position 2)))) + (overlay-put ov 'keymap org-columns-map) + (push ov org-columns-overlays)) + (with-silent-modifications + (let ((inhibit-read-only t)) + (put-text-property + (line-end-position 0) + (line-beginning-position 2) + 'read-only + (substitute-command-keys + "Type \\`\\[org-columns-edit-value]' \ +to edit property"))))))) + +(defun org-columns-add-ellipses (string width) + "Truncate STRING with WIDTH characters, with ellipses." + (cond + ((<= (length string) width) string) + ((<= width (length org-columns-ellipses)) + (substring org-columns-ellipses 0 width)) + (t (concat (substring string 0 (- width (length org-columns-ellipses))) + org-columns-ellipses)))) + +(defvar org-columns-full-header-line-format nil + "The full header line format, will be shifted by horizontal scrolling." ) +(defvar org-previous-header-line-format nil + "The header line format before column view was turned on.") +(defvar org-columns-inhibit-recalculation nil + "Inhibit recomputing of columns on column view startup.") +(defvar org-columns-flyspell-was-active nil + "Remember the state of `flyspell-mode' before column view. +Flyspell-mode can cause problems in columns view, so it is turned off +for the duration of the command.") + +(defvar header-line-format) +(defvar org-columns-previous-hscroll 0) + +(defun org-columns--display-here-title () + "Overlay the newline before the current line with the table title." + (interactive) + (let ((title "") + (linum-offset (org-line-number-display-width 'columns)) + (i 0)) + (dolist (column org-columns-current-fmt-compiled) + (pcase column + (`(,property ,name . ,_) + (let* ((width (aref org-columns-current-maxwidths i)) + (fmt (format "%%-%d.%ds | " width width))) + (setq title (concat title (format fmt (or name property))))))) + (cl-incf i)) + (setq-local org-previous-header-line-format header-line-format) + (setq org-columns-full-header-line-format + (concat + (org-add-props " " nil 'display `(space :align-to ,linum-offset)) + (org-add-props (substring title 0 -1) nil 'face 'org-column-title))) + (setq org-columns-previous-hscroll -1) + (add-hook 'post-command-hook #'org-columns-hscroll-title nil 'local))) + +(defun org-columns-hscroll-title () + "Set the `header-line-format' so that it scrolls along with the table." + (sit-for .0001) ; need to force a redisplay to update window-hscroll + (let ((hscroll (window-hscroll))) + (when (/= org-columns-previous-hscroll hscroll) + (setq header-line-format + (concat (substring org-columns-full-header-line-format 0 1) + (substring org-columns-full-header-line-format + (min (length org-columns-full-header-line-format) + (1+ hscroll)))) + org-columns-previous-hscroll hscroll) + (force-mode-line-update)))) + +(defvar org-colview-initial-truncate-line-value nil + "Remember the value of `truncate-lines' across colview.") + +;;;###autoload +(defun org-columns-remove-overlays () + "Remove all currently active column overlays." + (interactive) + (when (and (fboundp 'face-remap-remove-relative) + org-columns-header-line-remap) + (face-remap-remove-relative org-columns-header-line-remap)) + (when org-columns-overlays + (when (local-variable-p 'org-previous-header-line-format) + (setq header-line-format org-previous-header-line-format) + (kill-local-variable 'org-previous-header-line-format) + (remove-hook 'post-command-hook #'org-columns-hscroll-title 'local)) + (set-marker org-columns-begin-marker nil) + (when (markerp org-columns-top-level-marker) + (set-marker org-columns-top-level-marker nil)) + (with-silent-modifications + (mapc #'delete-overlay org-columns-overlays) + (setq org-columns-overlays nil) + (let ((inhibit-read-only t)) + (remove-text-properties (point-min) (point-max) '(read-only t)))) + (when org-columns-flyspell-was-active + (flyspell-mode 1)) + (when (local-variable-p 'org-colview-initial-truncate-line-value) + (setq truncate-lines org-colview-initial-truncate-line-value)))) + +(defun org-columns-show-value () + "Show the full value of the property." + (interactive) + (let ((value (get-char-property (point) 'org-columns-value))) + (message "Value is: %s" (or value "")))) + +(defvar org-agenda-columns-active) ;; defined in org-agenda.el + +(defun org-columns-quit () + "Remove the column overlays and in this way exit column editing." + (interactive) + (with-silent-modifications + (org-columns-remove-overlays) + (let ((inhibit-read-only t)) + (remove-text-properties (point-min) (point-max) '(read-only t)))) + (if (not (eq major-mode 'org-agenda-mode)) + (setq org-columns-current-fmt nil) + (setq org-agenda-columns-active nil) + (message + "Modification not yet reflected in Agenda buffer, use `r' to refresh"))) + +(defun org-columns-check-computed () + "Throw an error if current column value is computed." + (let ((spec (nth (current-column) org-columns-current-fmt-compiled))) + (and + (nth 3 spec) + (assoc spec (get-text-property (line-beginning-position) 'org-summaries)) + (error "This value is computed from the entry's children")))) + +(defun org-columns-todo (&optional _arg) + "Change the TODO state during column view." + (interactive "P") + (org-columns-edit-value "TODO")) + +(defun org-columns-toggle-or-columns-quit () + "Toggle checkbox at point, or quit column view." + (interactive) + (or (org-columns--toggle) + (org-columns-quit))) + +(defun org-columns--toggle () + "Toggle checkbox at point. Return non-nil if toggle happened, else nil. +See info documentation about realizing a suitable checkbox." + (when (string-match "\\`\\[[ xX-]\\]\\'" + (get-char-property (point) 'org-columns-value)) + (org-columns-next-allowed-value) + t)) + +(defvar org-overriding-columns-format nil + "When set, overrides any other format definition for the agenda. +Don't set this, this is meant for dynamic scoping. Set +`org-columns-default-format' and `org-columns-default-format-for-agenda' +instead. You should use this variable only in the local settings +section for a custom agenda view.") + +(defvar-local org-local-columns-format nil + "When set, overrides any other format definition for the agenda. +This can be set as a buffer local value to avoid interfering with +dynamic scoping for `org-overriding-columns-format'.") + +(defun org-columns-edit-value (&optional key) + "Edit the value of the property at point in column view. +Where possible, use the standard interface for changing this line." + (interactive) + (org-columns-check-computed) + (let* ((col (current-column)) + (bol (line-beginning-position)) + (eol (line-end-position)) + (pom (or (get-text-property bol 'org-hd-marker) (point))) + (key (or key (get-char-property (point) 'org-columns-key))) + (org-columns--time (float-time)) + (action + (pcase key + ("CLOCKSUM" + (user-error "This special column cannot be edited")) + ("ITEM" + (lambda () (org-with-point-at pom (org-edit-headline)))) + ("TODO" + (lambda () + (org-with-point-at pom (call-interactively #'org-todo)))) + ("PRIORITY" + (lambda () + (org-with-point-at pom + (call-interactively #'org-priority)))) + ("TAGS" + (lambda () + (org-with-point-at pom + (let ((org-fast-tag-selection-single-key + (if (eq org-fast-tag-selection-single-key 'expert) + t + org-fast-tag-selection-single-key))) + (call-interactively #'org-set-tags-command))))) + ("DEADLINE" + (lambda () + (org-with-point-at pom (call-interactively #'org-deadline)))) + ("SCHEDULED" + (lambda () + (org-with-point-at pom (call-interactively #'org-schedule)))) + ("BEAMER_ENV" + (lambda () + (org-with-point-at pom + (call-interactively #'org-beamer-select-environment)))) + (_ + (let* ((allowed (org-property-get-allowed-values pom key 'table)) + (value (get-char-property (point) 'org-columns-value)) + (nval (org-trim + (if (null allowed) (read-string "Edit: " value) + (completing-read + "Value: " allowed nil + (not (get-text-property + 0 'org-unrestricted (caar allowed)))))))) + (and (not (equal nval value)) + (lambda () (org-entry-put pom key nval)))))))) + (cond + ((null action)) + ((eq major-mode 'org-agenda-mode) + (org-columns--call action) + ;; The following let preserves the current format, and makes + ;; sure that in only a single file things need to be updated. + (let* ((org-overriding-columns-format org-columns-current-fmt) + (buffer (marker-buffer pom)) + (org-agenda-contributing-files + (list (with-current-buffer buffer + (buffer-file-name (buffer-base-buffer)))))) + (org-agenda-columns))) + (t + (let ((inhibit-read-only t)) + (with-silent-modifications + (remove-text-properties (max (point-min) (1- bol)) eol '(read-only t))) + (org-columns--call action)) + ;; Some properties can modify headline (e.g., "TODO"), and + ;; possible shuffle overlays. Make sure they are still all at + ;; the right place on the current line. + (let ((org-columns-inhibit-recalculation)) (org-columns-redo)) + (org-columns-update key) + (org-move-to-column col))))) + +(defun org-columns-edit-allowed () + "Edit the list of allowed values for the current property." + (interactive) + (let* ((pom (or (org-get-at-bol 'org-marker) + (org-get-at-bol 'org-hd-marker) + (point))) + (key (concat (or (get-char-property (point) 'org-columns-key) + (user-error "No column to edit at point")) + "_ALL")) + (allowed (org-entry-get pom key t)) + (new-value (read-string "Allowed: " allowed))) + ;; FIXME: Cover editing TODO, TAGS etc in-buffer settings.???? + ;; FIXME: Write back to #+PROPERTY setting if that is needed. + (org-entry-put + (cond ((marker-position org-entry-property-inherited-from) + org-entry-property-inherited-from) + ((marker-position org-columns-top-level-marker) + org-columns-top-level-marker) + (t pom)) + key new-value))) + +(defun org-columns--call (fun) + "Call function FUN while preserving heading visibility. +FUN is a function called with no argument." + (let ((hide-body (and (/= (line-end-position) (point-max)) + (save-excursion + (move-beginning-of-line 2) + (org-at-heading-p t))))) + (unwind-protect (funcall fun) + (when hide-body (outline-hide-entry))))) + +(defun org-columns-previous-allowed-value () + "Switch to the previous allowed value for this column." + (interactive) + (org-columns-next-allowed-value t)) + +(defun org-columns-next-allowed-value (&optional previous nth) + "Switch to the next allowed value for this column. +When PREVIOUS is set, go to the previous value. When NTH is +an integer, select that value." + (interactive) + (org-columns-check-computed) + (let* ((column (current-column)) + (key (get-char-property (point) 'org-columns-key)) + (value (get-char-property (point) 'org-columns-value)) + (pom (or (get-text-property (line-beginning-position) 'org-hd-marker) + (point))) + (allowed + (let ((all + (or (org-property-get-allowed-values pom key) + (pcase (nth column org-columns-current-fmt-compiled) + (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]"))) + (org-colview-construct-allowed-dates value)))) + (if previous (reverse all) all)))) + (when (equal key "ITEM") (error "Cannot edit item headline from here")) + (unless (or allowed (member key '("SCHEDULED" "DEADLINE" "CLOCKSUM"))) + (error "Allowed values for this property have not been defined")) + (let* ((l (length allowed)) + (new + (cond + ((member key '("SCHEDULED" "DEADLINE" "CLOCKSUM")) + (if previous 'earlier 'later)) + ((integerp nth) + (when (> (abs nth) l) + (user-error "Only %d allowed values for property `%s'" l key)) + (nth (mod (1- nth) l) allowed)) + ((member value allowed) + (when (= l 1) (error "Only one allowed value for this property")) + (or (nth 1 (member value allowed)) (car allowed))) + (t (car allowed)))) + (action (lambda () (org-entry-put pom key new)))) + (cond + ((eq major-mode 'org-agenda-mode) + (org-columns--call action) + ;; The following let preserves the current format, and makes + ;; sure that in only a single file things need to be updated. + (let* ((org-overriding-columns-format org-columns-current-fmt) + (buffer (marker-buffer pom)) + (org-agenda-contributing-files + (list (with-current-buffer buffer + (buffer-file-name (buffer-base-buffer)))))) + (org-agenda-columns))) + (t + (let ((inhibit-read-only t)) + (remove-text-properties (line-end-position 0) (line-end-position) + '(read-only t)) + (org-columns--call action)) + ;; Some properties can modify headline (e.g., "TODO"), and + ;; possible shuffle overlays. Make sure they are still all at + ;; the right place on the current line. + (let ((org-columns-inhibit-recalculation)) (org-columns-redo)) + (org-columns-update key) + (org-move-to-column column)))))) + +(defun org-colview-construct-allowed-dates (s) + "Construct a list of three dates around the date in S. +This respects the format of the time stamp in S, active or non-active, +and also including time or not. S must be just a time stamp, no text +around it." + (when (and s (string-match (concat "^" org-ts-regexp3 "$") s)) + (let* ((time (org-parse-time-string s 'nodefaults)) + (active (equal (string-to-char s) ?<)) + (fmt (funcall (if (nth 1 time) 'cdr 'car) org-time-stamp-formats)) + time-before time-after) + (unless active (setq fmt (concat "[" (substring fmt 1 -1) "]"))) + (setf (car time) (or (car time) 0)) + (setf (nth 1 time) (or (nth 1 time) 0)) + (setf (nth 2 time) (or (nth 2 time) 0)) + (setq time-before (copy-sequence time)) + (setq time-after (copy-sequence time)) + (setf (nth 3 time-before) (1- (nth 3 time))) + (setf (nth 3 time-after) (1+ (nth 3 time))) + (mapcar (lambda (x) (format-time-string fmt (apply #'encode-time x))) + (list time-before time time-after))))) + +(defun org-columns-open-link (&optional arg) + (interactive "P") + (let ((value (get-char-property (point) 'org-columns-value))) + (org-link-open-from-string value arg))) + +;;;###autoload +(defun org-columns-get-format-and-top-level () + (let ((fmt (org-columns-get-format))) + (org-columns-goto-top-level) + fmt)) + +(defun org-columns-get-format (&optional fmt-string) + "Return columns format specifications. +When optional argument FMT-STRING is non-nil, use it as the +current specifications. This function also sets +`org-columns-current-fmt-compiled' and +`org-columns-current-fmt'." + (interactive) + (let ((format + (or fmt-string + (org-entry-get nil "COLUMNS" t) + (org-with-wide-buffer + (goto-char (point-min)) + (catch :found + (let ((case-fold-search t)) + (while (re-search-forward "^[ \t]*#\\+COLUMNS: .+$" nil t) + (let ((element (org-element-at-point))) + (when (eq (org-element-type element) 'keyword) + (throw :found (org-element-property :value element))))) + nil))) + org-columns-default-format))) + (setq org-columns-current-fmt format) + (org-columns-compile-format format) + format)) + +(defun org-columns-goto-top-level () + "Move to the beginning of the column view area. +Also sets `org-columns-top-level-marker' to the new position." + (unless (markerp org-columns-top-level-marker) + (setq org-columns-top-level-marker (make-marker))) + (goto-char + (move-marker + org-columns-top-level-marker + (cond ((org-before-first-heading-p) (point-min)) + ((org-entry-get nil "COLUMNS" t) org-entry-property-inherited-from) + (t (org-back-to-heading) (point)))))) + +;;;###autoload +(defun org-columns (&optional global columns-fmt-string) + "Turn on column view on an Org mode file. + +Column view applies to the whole buffer if point is before the first +headline. Otherwise, it applies to the first ancestor setting +\"COLUMNS\" property. If there is none, it defaults to the current +headline. With a `\\[universal-argument]' prefix \ argument, GLOBAL, +turn on column view for the whole buffer unconditionally. + +When COLUMNS-FMT-STRING is non-nil, use it as the column format." + (interactive "P") + (org-columns-remove-overlays) + (save-excursion + (when global (goto-char (point-min))) + (if (markerp org-columns-begin-marker) + (move-marker org-columns-begin-marker (point)) + (setq org-columns-begin-marker (point-marker))) + (org-columns-goto-top-level) + ;; Initialize `org-columns-current-fmt' and + ;; `org-columns-current-fmt-compiled'. + (let ((org-columns--time (float-time))) + (org-columns-get-format columns-fmt-string) + (unless org-columns-inhibit-recalculation (org-columns-compute-all)) + (save-restriction + (when (and (not global) (org-at-heading-p)) + (narrow-to-region (point) (org-end-of-subtree t t))) + (when (assoc "CLOCKSUM" org-columns-current-fmt-compiled) + (org-clock-sum)) + (when (assoc "CLOCKSUM_T" org-columns-current-fmt-compiled) + (org-clock-sum-today)) + (let ((cache + ;; Collect contents of columns ahead of time so as to + ;; compute their maximum width. + (org-scan-tags + (lambda () (cons (point) (org-columns--collect-values))) t org--matcher-tags-todo-only))) + (when cache + (org-columns--set-widths cache) + (org-columns--display-here-title) + (when (setq-local org-columns-flyspell-was-active + (bound-and-true-p flyspell-mode)) + (flyspell-mode 0)) + (unless (local-variable-p 'org-colview-initial-truncate-line-value) + (setq-local org-colview-initial-truncate-line-value + truncate-lines)) + (if (not global-visual-line-mode) + (setq truncate-lines t)) + (dolist (entry cache) + (goto-char (car entry)) + (org-columns--display-here (cdr entry))))))))) + +(defun org-columns-new (&optional spec &rest attributes) + "Insert a new column, to the left of the current column. +Interactively fill attributes for new column. When column format +specification SPEC is provided, edit it instead. + +When optional argument attributes can be a list of columns +specifications attributes to create the new column +non-interactively. See `org-columns-compile-format' for +details." + (interactive) + (let ((new (or attributes + (let ((prop + (completing-read + "Property: " + (mapcar #'list (org-buffer-property-keys t nil t)) + nil nil (nth 0 spec)))) + (list prop + (read-string (format "Column title [%s]: " prop) + (nth 1 spec)) + ;; Use `read-string' instead of `read-number' + ;; to allow empty width. + (let ((w (read-string + "Column width: " + (and (nth 2 spec) + (number-to-string (nth 2 spec)))))) + (and (org-string-nw-p w) (string-to-number w))) + (org-string-nw-p + (completing-read + "Summary: " + (delete-dups + (cons '("") ;Allow empty operator. + (mapcar (lambda (x) (list (car x))) + (append + org-columns-summary-types + org-columns-summary-types-default)))) + nil t (nth 3 spec))) + (org-string-nw-p + (read-string "Format: " (nth 4 spec)))))))) + (if spec + (progn (setcar spec (car new)) + (setcdr spec (cdr new))) + (push new (nthcdr (current-column) org-columns-current-fmt-compiled))) + (org-columns-store-format) + (org-columns-redo))) + +(defun org-columns-delete () + "Delete the column at point from columns view." + (interactive) + (let ((spec (nth (current-column) org-columns-current-fmt-compiled))) + (when (y-or-n-p (format "Are you sure you want to remove column %S? " + (nth 1 spec))) + (setq org-columns-current-fmt-compiled + (delq spec org-columns-current-fmt-compiled)) + (org-columns-store-format) + ;; This may leave a now wrong value in a node property. However + ;; updating it may prove counter-intuitive. See comments in + ;; `org-columns-move-right' for details. + (let ((org-columns-inhibit-recalculation t)) (org-columns-redo)) + (when (>= (current-column) (length org-columns-current-fmt-compiled)) + (backward-char))))) + +(defun org-columns-edit-attributes () + "Edit the attributes of the current column." + (interactive) + (org-columns-new (nth (current-column) org-columns-current-fmt-compiled))) + +(defun org-columns-widen (arg) + "Make the column wider by ARG characters." + (interactive "p") + (let* ((n (current-column)) + (entry (nth n org-columns-current-fmt-compiled)) + (width (aref org-columns-current-maxwidths n))) + (setq width (max 1 (+ width arg))) + (setcar (nthcdr 2 entry) width) + (org-columns-store-format) + (let ((org-columns-inhibit-recalculation t)) (org-columns-redo)))) + +(defun org-columns-narrow (arg) + "Make the column narrower by ARG characters." + (interactive "p") + (org-columns-widen (- arg))) + +(defun org-columns-move-right () + "Swap this column with the one to the right." + (interactive) + (let* ((n (current-column)) + (cell (nthcdr n org-columns-current-fmt-compiled)) + e) + (when (>= n (1- (length org-columns-current-fmt-compiled))) + (error "Cannot shift this column further to the right")) + (setq e (car cell)) + (setcar cell (car (cdr cell))) + (setcdr cell (cons e (cdr (cdr cell)))) + (org-columns-store-format) + ;; Do not compute again properties, since we're just moving + ;; columns around. It can put a property value a bit off when + ;; switching between an non-computed and a computed value for the + ;; same property, e.g. from "%A %A{+}" to "%A{+} %A". + ;; + ;; In this case, the value needs to be updated since the first + ;; column related to a property determines how its value is + ;; computed. However, (correctly) updating the value could be + ;; surprising, so we leave it as-is nonetheless. + (let ((org-columns-inhibit-recalculation t)) (org-columns-redo)) + (forward-char 1))) + +(defun org-columns-move-left () + "Swap this column with the one to the left." + (interactive) + (let* ((n (current-column))) + (when (= n 0) + (error "Cannot shift this column further to the left")) + (backward-char 1) + (org-columns-move-right) + (backward-char 1))) + +(defun org-columns-store-format () + "Store the text version of the current columns format. +The format is stored either in the COLUMNS property of the node +starting the current column display, or in a #+COLUMNS line of +the current buffer." + (let ((fmt (org-columns-uncompile-format org-columns-current-fmt-compiled))) + (setq-local org-columns-current-fmt fmt) + (when org-columns-overlays + (org-with-point-at org-columns-top-level-marker + (if (and (org-at-heading-p) (org-entry-get nil "COLUMNS")) + (org-entry-put nil "COLUMNS" fmt) + (goto-char (point-min)) + (let ((case-fold-search t)) + ;; Try to replace the first COLUMNS keyword available. + (catch :found + (while (re-search-forward "^[ \t]*#\\+COLUMNS:\\(.*\\)" nil t) + (let ((element (save-match-data (org-element-at-point)))) + (when (and (eq (org-element-type element) 'keyword) + (equal (org-element-property :key element) + "COLUMNS")) + (replace-match (concat " " fmt) t t nil 1) + (throw :found nil)))) + ;; No COLUMNS keyword in the buffer. Insert one at the + ;; beginning, right before the first heading, if any. + (goto-char (point-min)) + (unless (org-at-heading-p t) (outline-next-heading)) + (let ((inhibit-read-only t)) + (insert-before-markers "#+COLUMNS: " fmt "\n")))) + (setq-local org-columns-default-format fmt)))))) + +(defun org-columns-update (property) + "Recompute PROPERTY, and update the columns display for it." + (org-columns-compute property) + (org-with-wide-buffer + (let ((p (upcase property))) + (dolist (ov org-columns-overlays) + (let ((key (overlay-get ov 'org-columns-key))) + (when (and key (equal key p) (overlay-start ov)) + (goto-char (overlay-start ov)) + (let* ((spec (nth (current-column) org-columns-current-fmt-compiled)) + (value + (or (cdr (assoc spec + (get-text-property (line-beginning-position) + 'org-summaries))) + (org-entry-get (point) key)))) + (when value + (let ((displayed (org-columns--displayed-value spec value)) + (format (overlay-get ov 'org-columns-format)) + (width + (aref org-columns-current-maxwidths (current-column)))) + (overlay-put ov 'org-columns-value value) + (overlay-put ov 'org-columns-value-modified displayed) + (overlay-put ov + 'display + (org-columns--overlay-text + displayed format width property value))))))))))) + +(defun org-columns-redo () + "Construct the column display again." + (interactive) + (when org-columns-overlays + (message "Recomputing columns...") + (org-with-point-at org-columns-begin-marker + (org-columns-remove-overlays) + (if (derived-mode-p 'org-mode) + ;; Since we already know the columns format, provide it + ;; instead of computing again. + (call-interactively #'org-columns org-columns-current-fmt) + (org-agenda-redo) + (call-interactively #'org-agenda-columns))) + (message "Recomputing columns...done"))) + +(defun org-columns-uncompile-format (compiled) + "Turn the compiled columns format back into a string representation. + +COMPILED is an alist, as returned by `org-columns-compile-format'." + (mapconcat + (lambda (spec) + (pcase spec + (`(,prop ,title ,width ,op ,printf) + (concat "%" + (and width (number-to-string width)) + prop + (and title (not (equal prop title)) (format "(%s)" title)) + (cond ((not op) nil) + (printf (format "{%s;%s}" op printf)) + (t (format "{%s}" op))))))) + compiled " ")) + +(defun org-columns-compile-format (fmt) + "Turn a column format string FMT into an alist of specifications. + +The alist has one entry for each column in the format. The elements of +that list are: +property the property name, as an upper-case string +title the title field for the columns, as a string +width the column width in characters, can be nil for automatic width +operator the summary operator, as a string, or nil +printf a printf format for computed values, as a string, or nil + +This function updates `org-columns-current-fmt-compiled'." + (setq org-columns-current-fmt-compiled nil) + (let ((start 0)) + (while (string-match + "%\\([0-9]+\\)?\\([[:alnum:]_-]+\\)\\(?:(\\([^)]+\\))\\)?\ +\\(?:{\\([^}]+\\)}\\)?\\s-*" + fmt start) + (setq start (match-end 0)) + (let* ((width (and (match-end 1) (string-to-number (match-string 1 fmt)))) + (prop (match-string-no-properties 2 fmt)) + (title (or (match-string-no-properties 3 fmt) prop)) + (operator (match-string-no-properties 4 fmt))) + (push (if (not operator) (list (upcase prop) title width nil nil) + (let (printf) + (when (string-match ";" operator) + (setq printf (substring operator (match-end 0))) + (setq operator (substring operator 0 (match-beginning 0)))) + (list (upcase prop) title width operator printf))) + org-columns-current-fmt-compiled))) + (setq org-columns-current-fmt-compiled + (nreverse org-columns-current-fmt-compiled)))) + + +;;;; Column View Summary + +(defun org-columns--age-to-minutes (s) + "Turn age string S into a number of minutes. +An age is either computed from a given time-stamp, or indicated +as a canonical duration, i.e., using units defined in +`org-duration-canonical-units'." + (cond + ((string-match-p org-ts-regexp s) + (/ (- org-columns--time + (float-time (org-time-string-to-time s))) + 60)) + ((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units + (t (user-error "Invalid age: %S" s)))) + +(defun org-columns--format-age (minutes) + "Format MINUTES float as an age string." + (org-duration-from-minutes minutes + '(("d" . nil) ("h" . nil) ("min" . nil)) + t)) ;ignore user's custom units + +(defun org-columns--summary-apply-times (fun times) + "Apply FUN to time values TIMES. +Return the result as a duration." + (org-duration-from-minutes + (apply fun (mapcar #'org-duration-to-minutes times)) + (org-duration-h:mm-only-p times))) + +(defun org-columns--compute-spec (spec &optional update) + "Update tree according to SPEC. +SPEC is a column format specification. When optional argument +UPDATE is non-nil, summarized values can replace existing ones in +properties drawers." + (let* ((lmax (if (bound-and-true-p org-inlinetask-min-level) + org-inlinetask-min-level + 29)) ;Hard-code deepest level. + (lvals (make-vector (1+ lmax) nil)) + (level 0) + (inminlevel lmax) + (last-level lmax) + (property (car spec)) + (printf (nth 4 spec)) + ;; Special properties cannot be collected nor summarized, as + ;; they have their own way to be computed. Therefore, ignore + ;; any operator attached to them. + (operator (and (not (member property org-special-properties)) + (nth 3 spec))) + (collect (and operator (org-columns--collect operator))) + (summarize (and operator (org-columns--summarize operator)))) + (org-with-wide-buffer + ;; Find the region to compute. + (goto-char org-columns-top-level-marker) + (goto-char (condition-case nil (org-end-of-subtree t) (error (point-max)))) + ;; Walk the tree from the back and do the computations. + (while (re-search-backward + org-outline-regexp-bol org-columns-top-level-marker t) + (unless (or (= level 0) (eq level inminlevel)) + (setq last-level level)) + (setq level (org-reduced-level (org-outline-level))) + (let* ((pos (match-beginning 0)) + (value (if collect (funcall collect property) + (org-entry-get (point) property))) + (value-set (org-string-nw-p value))) + (cond + ((< level last-level) + ;; Collect values from lower levels and inline tasks here + ;; and summarize them using SUMMARIZE. Store them in text + ;; property `org-summaries', in alist whose key is SPEC. + (let* ((summary + (and summarize + (let ((values (append (and (/= last-level inminlevel) + (aref lvals last-level)) + (aref lvals inminlevel)))) + (and values (funcall summarize values printf)))))) + ;; Leaf values are not summaries: do not mark them. + (when summary + (let* ((summaries-alist (get-text-property pos 'org-summaries)) + (old (assoc spec summaries-alist))) + (if old (setcdr old summary) + (push (cons spec summary) summaries-alist) + (with-silent-modifications + (add-text-properties + pos (1+ pos) (list 'org-summaries summaries-alist))))) + ;; When PROPERTY exists in current node, even if empty, + ;; but its value doesn't match the one computed, use + ;; the latter instead. + ;; + ;; Ignore leading or trailing white spaces that might + ;; have been introduced in summary, since those are not + ;; significant in properties value. + (let ((new-value (org-trim summary))) + (when (and update value (not (equal value new-value))) + (org-entry-put (point) property new-value)))) + ;; Add current to current level accumulator. + (when (or summary value-set) + (push (or summary value) (aref lvals level))) + ;; Clear accumulators for deeper levels. + (cl-loop for l from (1+ level) to lmax do (aset lvals l nil)))) + (value-set (push value (aref lvals level))) + (t nil))))))) + +;;;###autoload +(defun org-columns-compute (property) + "Summarize the values of PROPERTY hierarchically. +Also update existing values for PROPERTY according to the first +column specification." + (interactive) + (let ((main-flag t) + (upcase-prop (upcase property))) + (dolist (spec org-columns-current-fmt-compiled) + (pcase spec + (`(,(pred (equal upcase-prop)) . ,_) + (org-columns--compute-spec spec main-flag) + ;; Only the first summary can update the property value. + (when main-flag (setq main-flag nil))))))) + +(defun org-columns-compute-all () + "Compute all columns that have operators defined." + (with-silent-modifications + (remove-text-properties (point-min) (point-max) '(org-summaries t))) + (let ((org-columns--time (float-time)) + seen) + (dolist (spec org-columns-current-fmt-compiled) + (let ((property (car spec))) + ;; Property value is updated only the first time a given + ;; property is encountered. + (org-columns--compute-spec spec (not (member property seen))) + (push property seen))))) + +(defun org-columns--summary-sum (values printf) + "Compute the sum of VALUES. +When PRINTF is non-nil, use it to format the result." + (format (or printf "%s") (apply #'+ (mapcar #'string-to-number values)))) + +(defun org-columns--summary-currencies (values _) + "Compute the sum of VALUES, with two decimals." + (format "%.2f" (apply #'+ (mapcar #'string-to-number values)))) + +(defun org-columns--summary-checkbox (check-boxes _) + "Summarize CHECK-BOXES with a check-box." + (let ((done (cl-count "[X]" check-boxes :test #'equal)) + (all (length check-boxes))) + (cond ((= done all) "[X]") + ((> done 0) "[-]") + (t "[ ]")))) + +(defun org-columns--summary-checkbox-count (check-boxes _) + "Summarize CHECK-BOXES with a check-box cookie." + (format "[%d/%d]" + (cl-count-if (lambda (b) (or (equal b "[X]") + (string-match-p "\\[\\([1-9]\\)/\\1\\]" b))) + check-boxes) + (length check-boxes))) + +(defun org-columns--summary-checkbox-percent (check-boxes _) + "Summarize CHECK-BOXES with a check-box percent." + (format "[%d%%]" + (round (* 100.0 (cl-count-if (lambda (b) (member b '("[X]" "[100%]"))) + check-boxes)) + (length check-boxes)))) + +(defun org-columns--summary-min (values printf) + "Compute the minimum of VALUES. +When PRINTF is non-nil, use it to format the result." + (format (or printf "%s") + (apply #'min (mapcar #'string-to-number values)))) + +(defun org-columns--summary-max (values printf) + "Compute the maximum of VALUES. +When PRINTF is non-nil, use it to format the result." + (format (or printf "%s") + (apply #'max (mapcar #'string-to-number values)))) + +(defun org-columns--summary-mean (values printf) + "Compute the mean of VALUES. +When PRINTF is non-nil, use it to format the result." + (format (or printf "%s") + (/ (apply #'+ (mapcar #'string-to-number values)) + (float (length values))))) + +(defun org-columns--summary-sum-times (times _) + "Sum TIMES." + (org-columns--summary-apply-times #'+ times)) + +(defun org-columns--summary-min-time (times _) + "Compute the minimum time among TIMES." + (org-columns--summary-apply-times #'min times)) + +(defun org-columns--summary-max-time (times _) + "Compute the maximum time among TIMES." + (org-columns--summary-apply-times #'max times)) + +(defun org-columns--summary-mean-time (times _) + "Compute the mean time among TIMES." + (org-columns--summary-apply-times + (lambda (&rest values) (/ (apply #'+ values) (float (length values)))) + times)) + +(defun org-columns--summary-min-age (ages _) + "Compute the minimum age among AGES." + (org-columns--format-age + (apply #'min (mapcar #'org-columns--age-to-minutes ages)))) + +(defun org-columns--summary-max-age (ages _) + "Compute the maximum age among AGES." + (org-columns--format-age + (apply #'max (mapcar #'org-columns--age-to-minutes ages)))) + +(defun org-columns--summary-mean-age (ages _) + "Compute the mean age among AGES." + (org-columns--format-age + (/ (apply #'+ (mapcar #'org-columns--age-to-minutes ages)) + (float (length ages))))) + +(defun org-columns--summary-estimate (estimates _) + "Combine a list of estimates, using mean and variance. +The mean and variance of the result will be the sum of the means +and variances (respectively) of the individual estimates." + (let ((mean 0) + (var 0)) + (dolist (e estimates) + (pcase (mapcar #'string-to-number (split-string e "-")) + (`(,low ,high) + (let ((m (/ (+ low high) 2.0))) + (cl-incf mean m) + (cl-incf var (- (/ (+ (* low low) (* high high)) 2.0) (* m m))))) + (`(,value) (cl-incf mean value)))) + (let ((sd (sqrt var))) + (format "%s-%s" + (format "%.0f" (- mean sd)) + (format "%.0f" (+ mean sd)))))) + + + +;;; Dynamic block for Column view + +(defun org-columns--capture-view (maxlevel match skip-empty exclude-tags format local) + "Get the column view of the current buffer. + +MAXLEVEL sets the level limit. SKIP-EMPTY tells whether to skip +empty rows, an empty row being one where all the column view +specifiers but ITEM are empty. EXCLUDE-TAGS is a list of tags +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'." + (org-columns (not local) format) + (goto-char org-columns-top-level-marker) + (let ((columns (length org-columns-current-fmt-compiled)) + (has-item (assoc "ITEM" org-columns-current-fmt-compiled)) + table) + (org-map-entries + (lambda () + (when (get-char-property (point) 'org-columns-key) + (let (row) + (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))) + row))) + (unless (or + (and skip-empty + (let ((r (delete-dups (remove "" row)))) + (or (null r) (and has-item (= (length r) 1))))) + (and exclude-tags + (cl-some (lambda (tag) (member tag exclude-tags)) + (org-get-tags)))) + (push (cons (org-reduced-level (org-current-level)) (nreverse row)) + table))))) + (if match + (concat match (and maxlevel (format "+LEVEL<=%d" maxlevel))) + (and maxlevel (format "LEVEL<=%d" maxlevel))) + (and local 'tree) + 'archive 'comment) + (org-columns-quit) + ;; Add column titles and a horizontal rule in front of the table. + (cons (mapcar #'cadr org-columns-current-fmt-compiled) + (cons 'hline (nreverse table))))) + +(defun org-columns--clean-item (item) + "Remove sensitive contents from string ITEM. +This includes objects that may not be duplicated within +a document, e.g., a target, or those forbidden in tables, e.g., +an inline src-block." + (let ((data (org-element-parse-secondary-string + item (org-element-restriction 'headline)))) + (org-element-map data + '(footnote-reference inline-babel-call inline-src-block target + radio-target statistics-cookie) + #'org-element-extract-element) + (org-no-properties (org-element-interpret-data data)))) + +;;;###autoload +(defun org-dblock-write:columnview (params) + "Write the column view table. + +PARAMS is a property list of parameters: + +`:id' (mandatory) + + The ID property of the entry where the columns view should be + built. When the symbol `local', call locally. When `global' + call column view with the cursor at the beginning of the + buffer (usually this means that the whole buffer switches to + column view). When \"file:path/to/file.org\", invoke column + view at the start of that file. Otherwise, the ID is located + using `org-id-find'. + +`:exclude-tags' + + List of tags to exclude from column view table. + +`:format' + + When non-nil, specify the column view format to use. + +`:hlines' + + When non-nil, insert a hline before each item. When + a number, insert a hline before each level inferior or equal + to that number. + +`:indent' + + When non-nil, indent each ITEM field according to its level. + +`:match' + + When set to a string, use this as a tags/property match filter. + +`:maxlevel' + + When set to a number, don't capture headlines below this level. + +`:skip-empty-rows' + + When non-nil, skip rows where all specifiers other than ITEM + are empty. + +`:vlines' + + When non-nil, make each column a column group to enforce + vertical lines." + (let ((table + (let ((id (plist-get params :id)) + view-file view-pos) + (pcase id + (`global nil) + ((or `local `nil) (setq view-pos (point))) + ((and (let id-string (format "%s" id)) + (guard (string-match "^file:\\(.*\\)" id-string))) + (setq view-file (match-string-no-properties 1 id-string)) + (unless (file-exists-p view-file) + (user-error "No such file: %S" id-string))) + ((and (let idpos (org-find-entry-with-id id)) (guard idpos)) + (setq view-pos idpos)) + ((let `(,filename . ,position) (org-id-find id)) + (setq view-file filename) + (setq view-pos position)) + (_ (user-error "Cannot find entry with :ID: %s" id))) + (with-current-buffer (if view-file (get-file-buffer view-file) + (current-buffer)) + (org-with-wide-buffer + (when view-pos (goto-char view-pos)) + (org-columns--capture-view (plist-get params :maxlevel) + (plist-get params :match) + (plist-get params :skip-empty-rows) + (plist-get params :exclude-tags) + (plist-get params :format) + view-pos)))))) + (when table + ;; Prune level information from the table. Also normalize + ;; headings: remove stars, add indentation entities, if + ;; required, and possibly precede some of them with a horizontal + ;; rule. + (let ((item-index + (let ((p (assoc "ITEM" org-columns-current-fmt-compiled))) + (and p (cl-position p + org-columns-current-fmt-compiled + :test #'equal)))) + (hlines (plist-get params :hlines)) + (indent (plist-get params :indent)) + new-table) + ;; Copy header and first rule. + (push (pop table) new-table) + (push (pop table) new-table) + (dolist (row table (setq table (nreverse new-table))) + (let ((level (car row))) + (when (and (not (eq (car new-table) 'hline)) + (or (eq hlines t) + (and (numberp hlines) (<= level hlines)))) + (push 'hline new-table)) + (when item-index + (let ((item (org-columns--clean-item (nth item-index (cdr row))))) + (setf (nth item-index (cdr row)) + (if (and indent (> level 1)) + (concat "\\_" (make-string (* 2 (1- level)) ?\s) item) + item)))) + (push (cdr row) new-table)))) + (when (plist-get params :vlines) + (setq table + (let ((size (length org-columns-current-fmt-compiled))) + (append (mapcar (lambda (x) (if (eq 'hline x) x (cons "" x))) + table) + (list (cons "/" (make-list size "<>"))))))) + (let ((content-lines (org-split-string (plist-get params :content) "\n")) + recalc) + ;; Insert affiliated keywords before the table. + (when content-lines + (while (string-match-p "\\`[ \t]*#\\+" (car content-lines)) + (insert (pop content-lines) "\n"))) + (save-excursion + ;; Insert table at point. + (insert + (mapconcat (lambda (row) + (if (eq row 'hline) "|-|" + (format "|%s|" (mapconcat #'identity row "|")))) + table + "\n")) + ;; Insert TBLFM lines following table. + (let ((case-fold-search t)) + (dolist (line content-lines) + (when (string-match-p "\\`[ \t]*#\\+TBLFM:" line) + (insert "\n" line) + (unless recalc (setq recalc t)))))) + (when recalc (org-table-recalculate 'all t)) + (org-table-align))))) + +;;;###autoload +(defun org-columns-insert-dblock () + "Create a dynamic block capturing a column view table." + (interactive) + (let ((id (completing-read + "Capture columns (local, global, entry with :ID: property) [local]: " + (append '(("global") ("local")) + (mapcar #'list (org-property-values "ID")))))) + (org-create-dblock + (list :name "columnview" + :hlines 1 + :id (cond ((string= id "global") 'global) + ((member id '("" "local")) 'local) + (id))))) + (org-update-dblock)) + +;;;###autoload +(eval-after-load 'org + '(progn + (org-dynamic-block-define "columnview" #'org-columns-insert-dblock))) + + +;;; Column view in the agenda + +;;;###autoload +(defun org-agenda-columns () + "Turn on or update column view in the agenda." + (interactive) + (org-columns-remove-overlays) + (if (markerp org-columns-begin-marker) + (move-marker org-columns-begin-marker (point)) + (setq org-columns-begin-marker (point-marker))) + (let* ((org-columns--time (float-time)) + (org-done-keywords org-done-keywords-for-agenda) + (fmt + (cond + ((bound-and-true-p org-overriding-columns-format)) + ((bound-and-true-p org-local-columns-format)) + ((bound-and-true-p org-columns-default-format-for-agenda)) + ((let ((m (org-get-at-bol 'org-hd-marker))) + (and m + (or (org-entry-get m "COLUMNS" t) + (with-current-buffer (marker-buffer m) + org-columns-default-format))))) + ((and (local-variable-p 'org-columns-current-fmt) + org-columns-current-fmt)) + ((let ((m (next-single-property-change (point-min) 'org-hd-marker))) + (and m + (let ((m (get-text-property m 'org-hd-marker))) + (or (org-entry-get m "COLUMNS" t) + (with-current-buffer (marker-buffer m) + org-columns-default-format)))))) + (t org-columns-default-format))) + (compiled-fmt (org-columns-compile-format fmt))) + (setq org-columns-current-fmt fmt) + (when org-agenda-columns-compute-summary-properties + (org-agenda-colview-compute org-columns-current-fmt-compiled)) + (save-excursion + ;; Collect properties for each headline in current view. + (goto-char (point-min)) + (let (cache) + (while (not (eobp)) + (let ((m (org-get-at-bol 'org-hd-marker))) + (when m + (push (cons (line-beginning-position) + ;; `org-columns-current-fmt-compiled' is + ;; initialized but only set locally to the + ;; agenda buffer. Since current buffer is + ;; changing, we need to force the original + ;; compiled-fmt there. + (org-with-point-at m + (org-columns--collect-values compiled-fmt))) + cache))) + (forward-line)) + (when cache + (org-columns--set-widths cache) + (org-columns--display-here-title) + (when (setq-local org-columns-flyspell-was-active + (bound-and-true-p flyspell-mode)) + (flyspell-mode 0)) + (dolist (entry cache) + (goto-char (car entry)) + (org-columns--display-here (cdr entry))) + (setq-local org-agenda-columns-active t) + (when org-agenda-columns-show-summaries + (org-agenda-colview-summarize cache))))))) + +(defun org-agenda-colview-summarize (cache) + "Summarize the summarizable columns in column view in the agenda. +This will add overlays to the date lines, to show the summary for each day." + (let ((fmt (mapcar + (lambda (spec) + (pcase spec + (`(,property ,title ,width . ,_) + (if (member property '("CLOCKSUM" "CLOCKSUM_T")) + (list property title width ":" nil) + spec)))) + org-columns-current-fmt-compiled))) + ;; Ensure there's at least one summation column. + (when (cl-some (lambda (spec) (nth 3 spec)) fmt) + (goto-char (point-max)) + (catch :complete + (while t + (when (or (get-text-property (point) 'org-date-line) + (eq (get-text-property (point) 'face) + 'org-agenda-structure)) + ;; OK, this is a date line that should be used. + (let (entries) + (let (rest) + (dolist (c cache) + (if (> (car c) (point)) + (push c entries) + (push c rest))) + (setq cache rest)) + ;; ENTRIES contains entries below the current one. + ;; CACHE is the rest. Compute the summaries for the + ;; properties we want, set nil properties for the rest. + (when (setq entries (mapcar #'cdr entries)) + (org-columns--display-here + (mapcar + (lambda (spec) + (pcase spec + (`("ITEM" . ,_) + ;; Replace ITEM with current date. Preserve + ;; properties for fontification. + (let ((date (buffer-substring + (line-beginning-position) + (line-end-position)))) + (list spec date date))) + (`(,_ ,_ ,_ nil ,_) (list spec "" "")) + (`(,_ ,_ ,_ ,operator ,printf) + (let* ((summarize (org-columns--summarize operator)) + (values + ;; Use real values for summary, not + ;; those prepared for display. + (delq nil + (mapcar + (lambda (e) (org-string-nw-p + (nth 1 (assoc spec e)))) + entries))) + (final (if values + (funcall summarize values printf) + ""))) + (unless (equal final "") + (put-text-property 0 (length final) + 'face 'bold final)) + (list spec final final))))) + fmt) + 'dateline)))) + (if (bobp) (throw :complete t) (forward-line -1))))))) + +(defun org-agenda-colview-compute (fmt) + "Compute the relevant columns in the contributing source buffers." + (dolist (file org-agenda-contributing-files) + (let ((b (find-buffer-visiting file))) + (with-current-buffer (or (buffer-base-buffer b) b) + (org-with-wide-buffer + (with-silent-modifications + (remove-text-properties (point-min) (point-max) '(org-summaries t))) + (goto-char (point-min)) + (org-columns-get-format-and-top-level) + (dolist (spec fmt) + (let ((prop (car spec))) + (cond + ((equal prop "CLOCKSUM") (org-clock-sum)) + ((equal prop "CLOCKSUM_T") (org-clock-sum-today)) + ((and (nth 3 spec) + (let ((a (assoc prop org-columns-current-fmt-compiled))) + (equal (nth 3 a) (nth 3 spec)))) + (org-columns-compute prop)))))))))) + + +(provide 'org-colview) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-colview.el ends here diff --git a/elpa/org-9.5.2/org-colview.elc b/elpa/org-9.5.2/org-colview.elc new file mode 100644 index 0000000..e0474b8 Binary files /dev/null and b/elpa/org-9.5.2/org-colview.elc differ diff --git a/elpa/org-9.5.2/org-compat.el b/elpa/org-9.5.2/org-compat.el new file mode 100644 index 0000000..d230ee2 --- /dev/null +++ b/elpa/org-9.5.2/org-compat.el @@ -0,0 +1,1256 @@ +;;; org-compat.el --- Compatibility Code for Older Emacsen -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains code needed for compatibility with older +;; versions of GNU Emacs and integration with other packages. + +;;; Code: + +(require 'cl-lib) +(require 'org-macs) + +(declare-function org-agenda-diary-entry "org-agenda") +(declare-function org-agenda-maybe-redo "org-agenda" ()) +(declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type)) +(declare-function org-agenda-remove-restriction-lock "org-agenda" (&optional noupdate)) +(declare-function org-calendar-goto-agenda "org-agenda" ()) +(declare-function org-align-tags "org" (&optional all)) +(declare-function org-at-heading-p "org" (&optional ignored)) +(declare-function org-at-table.el-p "org" ()) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-context "org-element" (&optional element)) +(declare-function org-element-lineage "org-element" (blob &optional types with-self)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) +(declare-function org-get-heading "org" (&optional no-tags no-todo no-priority no-comment)) +(declare-function org-get-tags "org" (&optional pos local)) +(declare-function org-hide-block-toggle "org" (&optional force no-error element)) +(declare-function org-link-display-format "ol" (s)) +(declare-function org-link-set-parameters "ol" (type &rest rest)) +(declare-function org-log-into-drawer "org" ()) +(declare-function org-make-tag-string "org" (tags)) +(declare-function org-reduced-level "org" (l)) +(declare-function org-return "org" (&optional indent arg interactive)) +(declare-function org-show-context "org" (&optional key)) +(declare-function org-table-end "org-table" (&optional table-type)) +(declare-function outline-next-heading "outline" ()) +(declare-function speedbar-line-directory "speedbar" (&optional depth)) +(declare-function table--at-cell-p "table" (position &optional object at-column)) + +(defvar calendar-mode-map) +(defvar org-complex-heading-regexp) +(defvar org-agenda-diary-file) +(defvar org-agenda-overriding-restriction) +(defvar org-agenda-restriction-lock-overlay) +(defvar org-table-any-border-regexp) +(defvar org-table-dataline-regexp) +(defvar org-table-tab-recognizes-table.el) +(defvar org-table1-hline-regexp) + + +;;; Emacs < 28.1 compatibility + +(if (fboundp 'directory-empty-p) + (defalias 'org-directory-empty-p #'directory-empty-p) + (defun org-directory-empty-p (dir) + "Return t if DIR names an existing directory containing no other files." + (and (file-directory-p dir) + (null (directory-files dir nil directory-files-no-dot-files-regexp t))))) + + +;;; Emacs < 27.1 compatibility + +(unless (fboundp 'proper-list-p) + ;; `proper-list-p' was added in Emacs 27.1. The function below is + ;; taken from Emacs subr.el 200195e824b^. + (defun proper-list-p (object) + "Return OBJECT's length if it is a proper list, nil otherwise. +A proper list is neither circular nor dotted (i.e., its last cdr +is nil)." + (and (listp object) (ignore-errors (length object))))) + +(if (fboundp 'xor) + ;; `xor' was added in Emacs 27.1. + (defalias 'org-xor #'xor) + (defsubst org-xor (a b) + "Exclusive `or'." + (if a (not b) b))) + +(unless (fboundp 'pcomplete-uniquify-list) + ;; The misspelled variant was made obsolete in Emacs 27.1 + (defalias 'pcomplete-uniquify-list 'pcomplete-uniqify-list)) + +(if (fboundp 'time-convert) + (progn + (defsubst org-time-convert-to-integer (time) + (time-convert time 'integer)) + (defsubst org-time-convert-to-list (time) + (time-convert time 'list))) + (defun org-time-convert-to-integer (time) + (floor (float-time time))) + (defun org-time-convert-to-list (time) + (seconds-to-time (float-time time)))) + +;; `newline-and-indent' did not take a numeric argument before 27.1. +(if (version< emacs-version "27") + (defsubst org-newline-and-indent (&optional _arg) + (newline-and-indent)) + (defalias 'org-newline-and-indent #'newline-and-indent)) + +(defun org--set-faces-extend (faces extend-p) + "Set the :extend attribute of FACES to EXTEND-P. + +This is a no-op for Emacs versions lower than 27, since face +extension beyond end of line was not controllable." + (when (fboundp 'set-face-extend) + (mapc (lambda (f) (set-face-extend f extend-p)) faces))) + +(if (fboundp 'string-distance) + (defalias 'org-string-distance 'string-distance) + (defun org-string-distance (s1 s2) + "Return the edit (levenshtein) distance between strings S1 S2." + (let* ((l1 (length s1)) + (l2 (length s2)) + (dist (vconcat (mapcar (lambda (_) (make-vector (1+ l2) nil)) + (number-sequence 1 (1+ l1))))) + (in (lambda (i j) (aref (aref dist i) j)))) + (setf (aref (aref dist 0) 0) 0) + (dolist (j (number-sequence 1 l2)) + (setf (aref (aref dist 0) j) j)) + (dolist (i (number-sequence 1 l1)) + (setf (aref (aref dist i) 0) i) + (dolist (j (number-sequence 1 l2)) + (setf (aref (aref dist i) j) + (min + (1+ (funcall in (1- i) j)) + (1+ (funcall in i (1- j))) + (+ (if (equal (aref s1 (1- i)) (aref s2 (1- j))) 0 1) + (funcall in (1- i) (1- j))))))) + (funcall in l1 l2)))) + +(define-obsolete-function-alias 'org-babel-edit-distance 'org-string-distance + "9.5") + + +;;; Emacs < 26.1 compatibility + +(if (fboundp 'line-number-display-width) + (defalias 'org-line-number-display-width 'line-number-display-width) + (defun org-line-number-display-width (&rest _) 0)) + +(if (fboundp 'buffer-hash) + (defalias 'org-buffer-hash 'buffer-hash) + (defun org-buffer-hash () (md5 (current-buffer)))) + +(unless (fboundp 'file-attribute-modification-time) + (defsubst file-attribute-modification-time (attributes) + "The modification time in ATTRIBUTES returned by `file-attributes'. +This is the time of the last change to the file's contents, and +is a list of integers (HIGH LOW USEC PSEC) in the same style +as (current-time)." + (nth 5 attributes))) + +(unless (fboundp 'file-attribute-size) + (defsubst file-attribute-size (attributes) + "The size (in bytes) in ATTRIBUTES returned by `file-attributes'. +This is a floating point number if the size is too large for an integer." + (nth 7 attributes))) + + +;;; Emacs < 25.1 compatibility + +(when (< emacs-major-version 25) + (defalias 'outline-hide-entry 'hide-entry) + (defalias 'outline-hide-sublevels 'hide-sublevels) + (defalias 'outline-hide-subtree 'hide-subtree) + (defalias 'outline-show-branches 'show-branches) + (defalias 'outline-show-children 'show-children) + (defalias 'outline-show-entry 'show-entry) + (defalias 'outline-show-subtree 'show-subtree) + (defalias 'xref-find-definitions 'find-tag) + (defalias 'format-message 'format) + (defalias 'gui-get-selection 'x-get-selection)) + +(unless (fboundp 'directory-name-p) + (defun directory-name-p (name) + "Return non-nil if NAME ends with a directory separator character." + (let ((len (length name)) + (lastc ?.)) + (if (> len 0) + (setq lastc (aref name (1- len)))) + (or (= lastc ?/) + (and (memq system-type '(windows-nt ms-dos)) + (= lastc ?\\)))))) + +;; `string-collate-lessp' is new in Emacs 25. +(if (fboundp 'string-collate-lessp) + (defalias 'org-string-collate-lessp + 'string-collate-lessp) + (defun org-string-collate-lessp (s1 s2 &rest _) + "Return non-nil if STRING1 is less than STRING2 in lexicographic order. +Case is significant." + (string< s1 s2))) + +;; The time- functions below translate nil to 'current-time' and +;; accept an integer as of Emacs 25. 'decode-time' and +;; 'format-time-string' accept nil on Emacs 24 but don't accept an +;; integer until Emacs 25. +(if (< emacs-major-version 25) + (let ((convert + (lambda (time) + (cond ((not time) (current-time)) + ((numberp time) (seconds-to-time time)) + (t time))))) + (defun org-decode-time (&optional time) + (decode-time (funcall convert time))) + (defun org-format-time-string (format-string &optional time universal) + (format-time-string format-string (funcall convert time) universal)) + (defun org-time-add (a b) + (time-add (funcall convert a) (funcall convert b))) + (defun org-time-subtract (a b) + (time-subtract (funcall convert a) (funcall convert b))) + (defun org-time-since (time) + (time-since (funcall convert time))) + (defun org-time-less-p (t1 t2) + (time-less-p (funcall convert t1) (funcall convert t2)))) + (defalias 'org-decode-time 'decode-time) + (defalias 'org-format-time-string 'format-time-string) + (defalias 'org-time-add 'time-add) + (defalias 'org-time-subtract 'time-subtract) + (defalias 'org-time-since 'time-since) + (defalias 'org-time-less-p 'time-less-p)) + + +;;; Obsolete aliases (remove them after the next major release). + +;;;; XEmacs compatibility, now removed. +(define-obsolete-function-alias 'org-activate-mark 'activate-mark "9.0") +(define-obsolete-function-alias 'org-add-hook 'add-hook "9.0") +(define-obsolete-function-alias 'org-bound-and-true-p 'bound-and-true-p "9.0") +(define-obsolete-function-alias 'org-decompose-region 'decompose-region "9.0") +(define-obsolete-function-alias 'org-defvaralias 'defvaralias "9.0") +(define-obsolete-function-alias 'org-detach-overlay 'delete-overlay "9.0") +(define-obsolete-function-alias 'org-file-equal-p 'file-equal-p "9.0") +(define-obsolete-function-alias 'org-float-time 'float-time "9.0") +(define-obsolete-function-alias 'org-indent-line-to 'indent-line-to "9.0") +(define-obsolete-function-alias 'org-indent-to-column 'indent-to-column "9.0") +(define-obsolete-function-alias 'org-looking-at-p 'looking-at-p "9.0") +(define-obsolete-function-alias 'org-looking-back 'looking-back "9.0") +(define-obsolete-function-alias 'org-match-string-no-properties 'match-string-no-properties "9.0") +(define-obsolete-function-alias 'org-propertize 'propertize "9.0") +(define-obsolete-function-alias 'org-select-frame-set-input-focus 'select-frame-set-input-focus "9.0") +(define-obsolete-function-alias 'org-file-remote-p 'file-remote-p "9.2") + +(defmacro org-re (s) + "Replace posix classes in regular expression S." + (declare (debug (form)) + (obsolete "you can safely remove it." "9.0")) + s) + +;;;; Functions from cl-lib that Org used to have its own implementation of. +(define-obsolete-function-alias 'org-count 'cl-count "9.0") +(define-obsolete-function-alias 'org-every 'cl-every "9.0") +(define-obsolete-function-alias 'org-find-if 'cl-find-if "9.0") +(define-obsolete-function-alias 'org-reduce 'cl-reduce "9.0") +(define-obsolete-function-alias 'org-remove-if 'cl-remove-if "9.0") +(define-obsolete-function-alias 'org-remove-if-not 'cl-remove-if-not "9.0") +(define-obsolete-function-alias 'org-some 'cl-some "9.0") +(define-obsolete-function-alias 'org-floor* 'cl-floor "9.0") + +(defun org-sublist (list start end) + "Return a section of LIST, from START to END. +Counting starts at 1." + (cl-subseq list (1- start) end)) +(make-obsolete 'org-sublist + "use cl-subseq (note the 0-based counting)." + "9.0") + + +;;;; Functions available since Emacs 24.3 +(define-obsolete-function-alias 'org-buffer-narrowed-p 'buffer-narrowed-p "9.0") +(define-obsolete-function-alias 'org-called-interactively-p 'called-interactively-p "9.0") +(define-obsolete-function-alias 'org-char-to-string 'char-to-string "9.0") +(define-obsolete-function-alias 'org-delete-directory 'delete-directory "9.0") +(define-obsolete-function-alias 'org-format-seconds 'format-seconds "9.0") +(define-obsolete-function-alias 'org-link-escape-browser 'url-encode-url "9.0") +(define-obsolete-function-alias 'org-no-warnings 'with-no-warnings "9.0") +(define-obsolete-function-alias 'org-number-sequence 'number-sequence "9.0") +(define-obsolete-function-alias 'org-pop-to-buffer-same-window 'pop-to-buffer-same-window "9.0") +(define-obsolete-function-alias 'org-string-match-p 'string-match-p "9.0") + +;;;; Functions and variables from previous releases now obsolete. +(define-obsolete-function-alias 'org-element-remove-indentation + 'org-remove-indentation "9.0") +(define-obsolete-variable-alias 'org-latex-create-formula-image-program + 'org-preview-latex-default-process "9.0") +(define-obsolete-variable-alias 'org-latex-preview-ltxpng-directory + 'org-preview-latex-image-directory "9.0") +(define-obsolete-function-alias 'org-table-p 'org-at-table-p "9.0") +(define-obsolete-function-alias 'org-on-heading-p 'org-at-heading-p "9.0") +(define-obsolete-function-alias 'org-at-regexp-p 'org-in-regexp "8.3") +(define-obsolete-function-alias 'org-image-file-name-regexp + 'image-file-name-regexp "9.0") +(define-obsolete-function-alias 'org-completing-read-no-i + 'completing-read "9.0") +(define-obsolete-function-alias 'org-icompleting-read + 'completing-read "9.0") +(define-obsolete-function-alias 'org-iread-file-name 'read-file-name "9.0") +(define-obsolete-function-alias 'org-days-to-time + 'org-time-stamp-to-now "8.2") +(define-obsolete-variable-alias 'org-agenda-ignore-drawer-properties + 'org-agenda-ignore-properties "9.0") +(define-obsolete-function-alias 'org-preview-latex-fragment + 'org-toggle-latex-fragment "8.3") +(define-obsolete-function-alias 'org-export-get-genealogy + 'org-element-lineage "9.0") +(define-obsolete-variable-alias 'org-latex-with-hyperref + 'org-latex-hyperref-template "9.0") +(define-obsolete-variable-alias 'hfy-optimisations 'hfy-optimizations "9.0") +(define-obsolete-variable-alias 'org-export-htmlized-org-css-url + 'org-org-htmlized-css-url "8.2") +(define-obsolete-function-alias 'org-list-parse-list 'org-list-to-lisp "9.0") +(define-obsolete-function-alias 'org-agenda-todayp + 'org-agenda-today-p "9.0") +(define-obsolete-function-alias 'org-babel-examplize-region + 'org-babel-examplify-region "9.0") +(define-obsolete-variable-alias 'org-babel-capitalize-example-region-markers + 'org-babel-uppercase-example-markers "9.1") + +(define-obsolete-function-alias 'org-babel-trim 'org-trim "9.0") +(define-obsolete-variable-alias 'org-html-style 'org-html-head "24.4") +(define-obsolete-function-alias 'org-insert-columns-dblock + 'org-columns-insert-dblock "9.0") +(define-obsolete-variable-alias 'org-export-babel-evaluate + 'org-export-use-babel "9.1") +(define-obsolete-function-alias 'org-activate-bracket-links + 'org-activate-links "9.0") +(define-obsolete-function-alias 'org-activate-plain-links 'ignore "9.0") +(define-obsolete-function-alias 'org-activate-angle-links 'ignore "9.0") +(define-obsolete-function-alias 'org-remove-double-quotes 'org-strip-quotes "9.0") +(define-obsolete-function-alias 'org-get-indentation + 'current-indentation "9.2") +(define-obsolete-function-alias 'org-capture-member 'org-capture-get "9.2") +(define-obsolete-function-alias 'org-remove-from-invisibility-spec + 'remove-from-invisibility-spec "9.2") + +(define-obsolete-variable-alias 'org-effort-durations 'org-duration-units + "9.2") + +(define-obsolete-function-alias 'org-toggle-latex-fragment 'org-latex-preview + "9.3") + +(define-obsolete-function-alias 'org-remove-latex-fragment-image-overlays + 'org-clear-latex-preview "9.3") + +(define-obsolete-variable-alias 'org-attach-directory + 'org-attach-id-dir "9.3") +(make-obsolete 'org-attach-store-link "No longer used" "9.4") +(make-obsolete 'org-attach-expand-link "No longer used" "9.4") + +(define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.5") + +(defun org-in-fixed-width-region-p () + "Non-nil if point in a fixed-width region." + (save-match-data + (eq 'fixed-width (org-element-type (org-element-at-point))))) +(make-obsolete 'org-in-fixed-width-region-p + "use `org-element' library" + "9.0") + +(defun org-compatible-face (inherits specs) + "Make a compatible face specification. +If INHERITS is an existing face and if the Emacs version supports +it, just inherit the face. If INHERITS is not given and SPECS +is, use SPECS to define the face." + (declare (indent 1)) + (if (facep inherits) + (list (list t :inherit inherits)) + specs)) +(make-obsolete 'org-compatible-face "you can remove it." "9.0") + +(defun org-add-link-type (type &optional follow export) + "Add a new TYPE link. +FOLLOW and EXPORT are two functions. + +FOLLOW should take the link path as the single argument and do whatever +is necessary to follow the link, for example find a file or display +a mail message. + +EXPORT should format the link path for export to one of the export formats. +It should be a function accepting three arguments: + + path the path of the link, the text after the prefix (like \"http:\") + desc the description of the link, if any + format the export format, a symbol like `html' or `latex' or `ascii'. + +The function may use the FORMAT information to return different values +depending on the format. The return value will be put literally into +the exported file. If the return value is nil, this means Org should +do what it normally does with links which do not have EXPORT defined. + +Org mode has a built-in default for exporting links. If you are happy with +this default, there is no need to define an export function for the link +type. For a simple example of an export function, see `org-bbdb.el'. + +If TYPE already exists, update it with the arguments. +See `org-link-parameters' for documentation on the other parameters." + (org-link-set-parameters type :follow follow :export export) + (message "Created %s link." type)) + +(make-obsolete 'org-add-link-type "use `org-link-set-parameters' instead." "9.0") + +;;;; Functions unused in Org core. +(defun org-table-recognize-table.el () + "If there is a table.el table nearby, recognize it and move into it." + (when (org-at-table.el-p) + (beginning-of-line) + (unless (or (looking-at org-table-dataline-regexp) + (not (looking-at org-table1-hline-regexp))) + (forward-line) + (when (looking-at org-table-any-border-regexp) + (forward-line -2))) + (if (re-search-forward "|" (org-table-end t) t) + (progn + (require 'table) + (if (table--at-cell-p (point)) t + (message "recognizing table.el table...") + (table-recognize-table) + (message "recognizing table.el table...done"))) + (error "This should not happen")))) + +;; Not used since commit 6d1e3082, Feb 2010. +(make-obsolete 'org-table-recognize-table.el + "please notify Org mailing list if you use this function." + "9.0") + +(defmacro org-preserve-lc (&rest body) + (declare (debug (body)) + (obsolete "please notify Org mailing list if you use this function." + "9.2")) + (org-with-gensyms (line col) + `(let ((,line (org-current-line)) + (,col (current-column))) + (unwind-protect + (progn ,@body) + (org-goto-line ,line) + (org-move-to-column ,col))))) + +(defun org-version-check (version &rest _) + "Non-nil if VERSION is lower (older) than `emacs-version'." + (declare (obsolete "use `version<' or `fboundp' instead." + "9.2")) + (version< version emacs-version)) + +(defun org-remove-angle-brackets (s) + (org-unbracket-string "<" ">" s)) +(make-obsolete 'org-remove-angle-brackets 'org-unbracket-string "9.0") + +(defcustom org-publish-sitemap-file-entry-format "%t" + "Format string for site-map file entry. +You could use brackets to delimit on what part the link will be. + +%t is the title. +%a is the author. +%d is the date formatted using `org-publish-sitemap-date-format'." + :group 'org-export-publish + :type 'string) +(make-obsolete-variable + 'org-publish-sitemap-file-entry-format + "set `:sitemap-format-entry' in `org-publish-project-alist' instead." + "9.1") + +(defvar org-agenda-skip-regexp) +(defun org-agenda-skip-entry-when-regexp-matches () + "Check if the current entry contains match for `org-agenda-skip-regexp'. +If yes, it returns the end position of this entry, causing agenda commands +to skip the entry but continuing the search in the subtree. This is a +function that can be put into `org-agenda-skip-function' for the duration +of a command." + (declare (obsolete "use `org-agenda-skip-if' instead." "9.1")) + (let ((end (save-excursion (org-end-of-subtree t))) + skip) + (save-excursion + (setq skip (re-search-forward org-agenda-skip-regexp end t))) + (and skip end))) + +(defun org-agenda-skip-subtree-when-regexp-matches () + "Check if the current subtree contains match for `org-agenda-skip-regexp'. +If yes, it returns the end position of this tree, causing agenda commands +to skip this subtree. This is a function that can be put into +`org-agenda-skip-function' for the duration of a command." + (declare (obsolete "use `org-agenda-skip-if' instead." "9.1")) + (let ((end (save-excursion (org-end-of-subtree t))) + skip) + (save-excursion + (setq skip (re-search-forward org-agenda-skip-regexp end t))) + (and skip end))) + +(defun org-agenda-skip-entry-when-regexp-matches-in-subtree () + "Check if the current subtree contains match for `org-agenda-skip-regexp'. +If yes, it returns the end position of the current entry (NOT the tree), +causing agenda commands to skip the entry but continuing the search in +the subtree. This is a function that can be put into +`org-agenda-skip-function' for the duration of a command. An important +use of this function is for the stuck project list." + (declare (obsolete "use `org-agenda-skip-if' instead." "9.1")) + (let ((end (save-excursion (org-end-of-subtree t))) + (entry-end (save-excursion (outline-next-heading) (1- (point)))) + skip) + (save-excursion + (setq skip (re-search-forward org-agenda-skip-regexp end t))) + (and skip entry-end))) + +(define-obsolete-function-alias 'org-minutes-to-clocksum-string + 'org-duration-from-minutes "9.1") + +(define-obsolete-function-alias 'org-hh:mm-string-to-minutes + 'org-duration-to-minutes "9.1") + +(define-obsolete-function-alias 'org-duration-string-to-minutes + 'org-duration-to-minutes "9.1") + +(make-obsolete-variable 'org-time-clocksum-format + "set `org-duration-format' instead." "9.1") + +(make-obsolete-variable 'org-time-clocksum-use-fractional + "set `org-duration-format' instead." "9.1") + +(make-obsolete-variable 'org-time-clocksum-fractional-format + "set `org-duration-format' instead." "9.1") + +(make-obsolete-variable 'org-time-clocksum-use-effort-durations + "set `org-duration-units' instead." "9.1") + +(define-obsolete-function-alias 'org-babel-number-p + 'org-babel--string-to-number "9.0") + +(define-obsolete-variable-alias 'org-usenet-links-prefer-google + 'org-gnus-prefer-web-links "9.1") + +(define-obsolete-variable-alias 'org-texinfo-def-table-markup + 'org-texinfo-table-default-markup "9.1") + +(define-obsolete-variable-alias 'org-agenda-overriding-columns-format + 'org-overriding-columns-format "9.2.2") + +(define-obsolete-variable-alias 'org-doi-server-url + 'org-link-doi-server-url "9.3") + +(define-obsolete-variable-alias 'org-email-link-description-format + 'org-link-email-description-format "9.3") + +(define-obsolete-variable-alias 'org-make-link-description-function + 'org-link-make-description-function "9.3") + +(define-obsolete-variable-alias 'org-from-is-user-regexp + 'org-link-from-user-regexp "9.3") + +(define-obsolete-variable-alias 'org-descriptive-links + 'org-link-descriptive "9.3") + +(define-obsolete-variable-alias 'org-context-in-file-links + 'org-link-context-for-files "9.3") + +(define-obsolete-variable-alias 'org-keep-stored-link-after-insertion + 'org-link-keep-stored-after-insertion "9.3") + +(define-obsolete-variable-alias 'org-display-internal-link-with-indirect-buffer + 'org-link-use-indirect-buffer-for-internals "9.3") + +(define-obsolete-variable-alias 'org-confirm-shell-link-function + 'org-link-shell-confirm-function "9.3") + +(define-obsolete-variable-alias 'org-confirm-shell-link-not-regexp + 'org-link-shell-skip-confirm-regexp "9.3") + +(define-obsolete-variable-alias 'org-confirm-elisp-link-function + 'org-link-elisp-confirm-function "9.3") + +(define-obsolete-variable-alias 'org-confirm-elisp-link-not-regexp + 'org-link-elisp-skip-confirm-regexp "9.3") + +(define-obsolete-function-alias 'org-file-complete-link + 'org-link-complete-file "9.3") + +(define-obsolete-function-alias 'org-email-link-description + 'org-link-email-description "9.3") + +(define-obsolete-function-alias 'org-make-link-string + 'org-link-make-string "9.3") + +(define-obsolete-function-alias 'org-store-link-props + 'org-link-store-props "9.3") + +(define-obsolete-function-alias 'org-add-link-props + 'org-link-add-props "9.3") + +(define-obsolete-function-alias 'org-make-org-heading-search-string + 'org-link-heading-search-string "9.3") + +(define-obsolete-function-alias 'org-make-link-regexps + 'org-link-make-regexps "9.3") + +(define-obsolete-function-alias 'org-property-global-value + 'org-property-global-or-keyword-value "9.3") + +(make-obsolete-variable 'org-file-properties 'org-keyword-properties "9.3") + +(define-obsolete-variable-alias 'org-angle-link-re + 'org-link-angle-re "9.3") + +(define-obsolete-variable-alias 'org-plain-link-re + 'org-link-plain-re "9.3") + +(define-obsolete-variable-alias 'org-bracket-link-regexp + 'org-link-bracket-re "9.3") + +(define-obsolete-variable-alias 'org-bracket-link-analytic-regexp + 'org-link-bracket-re "9.3") + +(define-obsolete-variable-alias 'org-any-link-re + 'org-link-any-re "9.3") + +(define-obsolete-function-alias 'org-open-link-from-string + 'org-link-open-from-string "9.3") + +(define-obsolete-function-alias 'org-add-angle-brackets + 'org-link-add-angle-brackets "9.3") + +;; The function was made obsolete by commit 65399674d5 of 2013-02-22. +;; This make-obsolete call was added 2016-09-01. +(make-obsolete 'org-capture-import-remember-templates + "use the `org-capture-templates' variable instead." + "9.0") + +(defun org-show-block-all () + "Unfold all blocks in the current buffer." + (interactive) + (remove-overlays nil nil 'invisible 'org-hide-block)) + +(make-obsolete 'org-show-block-all + "use `org-show-all' instead." + "9.2") + +(define-obsolete-function-alias 'org-get-tags-at 'org-get-tags "9.2") + +(defun org-get-local-tags () + "Get a list of tags defined in the current headline." + (declare (obsolete "use `org-get-tags' instead." "9.2")) + (org-get-tags nil 'local)) + +(defun org-get-local-tags-at (&optional pos) + "Get a list of tags defined in the current headline." + (declare (obsolete "use `org-get-tags' instead." "9.2")) + (org-get-tags pos 'local)) + +(defun org-get-tags-string () + "Get the TAGS string in the current headline." + (declare (obsolete "use `org-make-tag-string' instead." "9.2")) + (org-make-tag-string (org-get-tags nil t))) + +(define-obsolete-function-alias 'org-set-tags-to 'org-set-tags "9.2") + +(defun org-align-all-tags () + "Align the tags in all headings." + (declare (obsolete "use `org-align-tags' instead." "9.2")) + (org-align-tags t)) + +(define-obsolete-function-alias + 'org-at-property-block-p 'org-at-property-drawer-p "9.4") + +(defun org-flag-drawer (flag &optional element beg end) + "When FLAG is non-nil, hide the drawer we are at. +Otherwise make it visible. + +When optional argument ELEMENT is a parsed drawer, as returned by +`org-element-at-point', hide or show that drawer instead. + +When buffer positions BEG and END are provided, hide or show that +region as a drawer without further ado." + (declare (obsolete "use `org-hide-drawer-toggle' instead." "9.4")) + (if (and beg end) (org-flag-region beg end flag 'outline) + (let ((drawer + (or element + (and (save-excursion + (beginning-of-line) + (looking-at-p "^[ \t]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ \t]*$")) + (org-element-at-point))))) + (when (memq (org-element-type drawer) '(drawer property-drawer)) + (let ((post (org-element-property :post-affiliated drawer))) + (org-flag-region + (save-excursion (goto-char post) (line-end-position)) + (save-excursion (goto-char (org-element-property :end drawer)) + (skip-chars-backward " \t\n") + (line-end-position)) + flag 'outline) + ;; When the drawer is hidden away, make sure point lies in + ;; a visible part of the buffer. + (when (invisible-p (max (1- (point)) (point-min))) + (goto-char post))))))) + +(defun org-hide-block-toggle-maybe () + "Toggle visibility of block at point. +Unlike to `org-hide-block-toggle', this function does not throw +an error. Return a non-nil value when toggling is successful." + (declare (obsolete "use `org-hide-block-toggle' instead." "9.4")) + (interactive) + (org-hide-block-toggle nil t)) + +(defun org-hide-block-toggle-all () + "Toggle the visibility of all blocks in the current buffer." + (declare (obsolete "please notify Org mailing list if you use this function." + "9.4")) + (let ((start (point-min)) + (end (point-max))) + (save-excursion + (goto-char start) + (while (and (< (point) end) + (re-search-forward "^[ \t]*#\\+begin_?\ +\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$" end t)) + (save-excursion + (save-match-data + (goto-char (match-beginning 0)) + (org-hide-block-toggle))))))) + +(defun org-return-indent () + "Goto next table row or insert a newline and indent. +Calls `org-table-next-row' or `newline-and-indent', depending on +context. See the individual commands for more information." + (declare (obsolete "use `org-return' with INDENT set to t instead." + "9.4")) + (interactive) + (org-return t)) + +(defmacro org-with-silent-modifications (&rest body) + (declare (obsolete "use `with-silent-modifications' instead." "9.2") + (debug (body))) + `(with-silent-modifications ,@body)) + +(define-obsolete-function-alias 'org-babel-strip-quotes + 'org-strip-quotes "9.2") + +(define-obsolete-variable-alias 'org-sort-agenda-notime-is-late + 'org-agenda-sort-notime-is-late "9.4") + +(define-obsolete-variable-alias 'org-sort-agenda-noeffort-is-high + 'org-agenda-sort-noeffort-is-high "9.4") + +(defconst org-maybe-keyword-time-regexp + (concat "\\(\\<\\(\\(?:CLO\\(?:CK\\|SED\\)\\|DEADLINE\\|SCHEDULED\\):\\)\\)?" + " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*[]>]" + "\\|" + "<%%([^\r\n>]*>\\)") + "Matches a timestamp, possibly preceded by a keyword.") +(make-obsolete-variable + 'org-maybe-keyword-time-regexp + "use `org-planning-line-re', followed by `org-ts-regexp-both' instead." + "9.4") + +(define-obsolete-function-alias 'org-copy 'org-refile-copy "9.4") + +(define-obsolete-function-alias 'org-get-last-sibling 'org-get-previous-sibling "9.4") + +;;;; Obsolete link types + +(eval-after-load 'ol + '(progn + (org-link-set-parameters "file+emacs") ;since Org 9.0 + (org-link-set-parameters "file+sys"))) ;since Org 9.0 + + + +;;; Miscellaneous functions + +(defun org-get-x-clipboard (value) + "Get the value of the X or Windows clipboard." + (cond ((and (eq window-system 'x) + (fboundp 'gui-get-selection)) ;Silence byte-compiler. + (org-no-properties + (ignore-errors + (or (gui-get-selection value 'UTF8_STRING) + (gui-get-selection value 'COMPOUND_TEXT) + (gui-get-selection value 'STRING) + (gui-get-selection value 'TEXT))))) + ((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data)) + (w32-get-clipboard-data)))) + +;; `set-transient-map' is only in Emacs >= 24.4 +(defalias 'org-set-transient-map + (if (fboundp 'set-transient-map) + 'set-transient-map + 'set-temporary-overlay-map)) + + +;;; Region compatibility + +(defvar org-ignore-region nil + "Non-nil means temporarily disable the active region.") + +(defun org-region-active-p () + "Non-nil when the region active. +Unlike to `use-region-p', this function also checks +`org-ignore-region'." + (and (not org-ignore-region) (use-region-p))) + +(defun org-cursor-to-region-beginning () + (when (and (org-region-active-p) + (> (point) (region-beginning))) + (exchange-point-and-mark))) + + +;;; Invisibility compatibility + +(defun org-in-invisibility-spec-p (arg) + "Is ARG a member of `buffer-invisibility-spec'?" + (when (consp buffer-invisibility-spec) + (member arg buffer-invisibility-spec))) + +(defun org-move-to-column (column &optional force _buffer) + "Move to column COLUMN. +Pass COLUMN and FORCE to `move-to-column'." + (let ((buffer-invisibility-spec + (if (listp buffer-invisibility-spec) + (remove '(org-filtered) buffer-invisibility-spec) + buffer-invisibility-spec))) + (move-to-column column force))) + +(defmacro org-find-library-dir (library) + `(file-name-directory (or (locate-library ,library) ""))) + +(defun org-count-lines (s) + "How many lines in string S?" + (let ((start 0) (n 1)) + (while (string-match "\n" s start) + (setq start (match-end 0) n (1+ n))) + (when (and (> (length s) 0) (= (aref s (1- (length s))) ?\n)) + (setq n (1- n))) + n)) + +(defun org-kill-new (string &rest args) + (remove-text-properties 0 (length string) '(line-prefix t wrap-prefix t) + string) + (apply 'kill-new string args)) + +;; `font-lock-ensure' is only available from 24.4.50 on +(defalias 'org-font-lock-ensure + (if (fboundp 'font-lock-ensure) + #'font-lock-ensure + (lambda (&optional _beg _end) + (with-no-warnings (font-lock-fontify-buffer))))) + +;; `file-local-name' was added in Emacs 26.1. +(defalias 'org-babel-local-file-name + (if (fboundp 'file-local-name) + 'file-local-name + (lambda (file) + "Return the local name component of FILE." + (or (file-remote-p file 'localname) file)))) + +;;;###autoload +(defmacro org-check-version () + "Try very hard to provide sensible version strings." + (let* ((org-dir (org-find-library-dir "org")) + (org-version.el (concat org-dir "org-version.el")) + (org-fixup.el (concat org-dir "../mk/org-fixup.el"))) + (if (require 'org-version org-version.el 'noerror) + '(progn + (autoload 'org-release "org-version.el") + (autoload 'org-git-version "org-version.el")) + (if (require 'org-fixup org-fixup.el 'noerror) + '(org-fixup) + ;; provide fallback definitions and complain + (warn "Could not define org version correctly. Check installation!") + '(progn + (defun org-release () "N/A") + (defun org-git-version () "N/A !!check installation!!")))))) + + + +;;; Functions for Emacs < 24.4 compatibility + +(defun org-define-error (name message) + "Define NAME as a new error signal. +MESSAGE is a string that will be output to the echo area if such +an error is signaled without being caught by a `condition-case'. +Implements `define-error' for older emacsen." + (if (fboundp 'define-error) (define-error name message) + (put name 'error-conditions + (copy-sequence (cons name (get 'error 'error-conditions)))))) + +(unless (fboundp 'string-suffix-p) + ;; From Emacs subr.el. + (defun string-suffix-p (suffix string &optional ignore-case) + "Return non-nil if SUFFIX is a suffix of STRING. +If IGNORE-CASE is non-nil, the comparison is done without paying +attention to case differences." + (let ((start-pos (- (length string) (length suffix)))) + (and (>= start-pos 0) + (eq t (compare-strings suffix nil nil + string start-pos nil ignore-case)))))) + + +;;; Integration with and fixes for other packages + +(defgroup org-imenu-and-speedbar nil + "Options concerning imenu and speedbar in Org mode." + :tag "Org Imenu and Speedbar" + :group 'org-structure) + +(defcustom org-imenu-depth 2 + "The maximum level for Imenu access to Org headlines. +This also applied for speedbar access." + :group 'org-imenu-and-speedbar + :type 'integer) + +;;;; Imenu + +(defvar-local org-imenu-markers nil + "All markers currently used by Imenu.") + +(defun org-imenu-get-tree () + "Produce the index for Imenu." + (dolist (x org-imenu-markers) (move-marker x nil)) + (setq org-imenu-markers nil) + (org-with-wide-buffer + (goto-char (point-max)) + (let* ((re (concat "^" (org-get-limited-outline-regexp))) + (subs (make-vector (1+ org-imenu-depth) nil)) + (last-level 0)) + (while (re-search-backward re nil t) + (let ((level (org-reduced-level (funcall outline-level))) + (headline (org-no-properties + (org-link-display-format (org-get-heading t t t t))))) + (when (and (<= level org-imenu-depth) (org-string-nw-p headline)) + (let* ((m (point-marker)) + (item (propertize headline 'org-imenu-marker m 'org-imenu t))) + (push m org-imenu-markers) + (if (>= level last-level) + (push (cons item m) (aref subs level)) + (push (cons item + (cl-mapcan #'identity (cl-subseq subs (1+ level)))) + (aref subs level)) + (cl-loop for i from (1+ level) to org-imenu-depth + do (aset subs i nil))) + (setq last-level level))))) + (aref subs 1)))) + +(eval-after-load 'imenu + '(progn + (add-hook 'imenu-after-jump-hook + (lambda () + (when (derived-mode-p 'org-mode) + (org-show-context 'org-goto)))) + (add-hook 'org-mode-hook + (lambda () + (setq imenu-create-index-function 'org-imenu-get-tree))))) + +;;;; Speedbar + +(defvar org-speedbar-restriction-lock-overlay (make-overlay 1 1) + "Overlay marking the agenda restriction line in speedbar.") +(overlay-put org-speedbar-restriction-lock-overlay + 'face 'org-agenda-restriction-lock) +(overlay-put org-speedbar-restriction-lock-overlay + 'help-echo "Agendas are currently limited to this item.") +(delete-overlay org-speedbar-restriction-lock-overlay) + +(defun org-speedbar-set-agenda-restriction () + "Restrict future agenda commands to the location at point in speedbar. +If there is already a restriction lock at the location, remove it. + +To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'." + (interactive) + (require 'org-agenda) + (let (p m tp np dir txt) + (cond + ((setq p (text-property-any (point-at-bol) (point-at-eol) + 'org-imenu t)) + (setq m (get-text-property p 'org-imenu-marker)) + (with-current-buffer (marker-buffer m) + (goto-char m) + (if (and org-agenda-overriding-restriction + (member org-agenda-restriction-lock-overlay + (overlays-at (point)))) + (org-agenda-remove-restriction-lock 'noupdate) + (org-agenda-set-restriction-lock 'subtree)))) + ((setq p (text-property-any (point-at-bol) (point-at-eol) + 'speedbar-function 'speedbar-find-file)) + (setq tp (previous-single-property-change + (1+ p) 'speedbar-function) + np (next-single-property-change + tp 'speedbar-function) + dir (speedbar-line-directory) + txt (buffer-substring-no-properties (or tp (point-min)) + (or np (point-max)))) + (with-current-buffer (find-file-noselect + (let ((default-directory dir)) + (expand-file-name txt))) + (unless (derived-mode-p 'org-mode) + (user-error "Cannot restrict to non-Org mode file")) + (org-agenda-set-restriction-lock 'file))) + (t (user-error "Don't know how to restrict Org mode agenda"))) + (move-overlay org-speedbar-restriction-lock-overlay + (point-at-bol) (point-at-eol)) + (setq current-prefix-arg nil) + (org-agenda-maybe-redo))) + +(defvar speedbar-file-key-map) +(declare-function speedbar-add-supported-extension "speedbar" (extension)) +(eval-after-load 'speedbar + '(progn + (speedbar-add-supported-extension ".org") + (define-key speedbar-file-key-map "<" 'org-speedbar-set-agenda-restriction) + (define-key speedbar-file-key-map "\C-c\C-x<" 'org-speedbar-set-agenda-restriction) + (define-key speedbar-file-key-map ">" 'org-agenda-remove-restriction-lock) + (define-key speedbar-file-key-map "\C-c\C-x>" 'org-agenda-remove-restriction-lock) + (add-hook 'speedbar-visiting-tag-hook + (lambda () (and (derived-mode-p 'org-mode) (org-show-context 'org-goto)))))) + +;;;; Add Log + +(defun org-add-log-current-headline () + "Return current headline or nil. +This function ignores inlinetasks. It is meant to be used as +`add-log-current-defun-function' value." + (org-with-limited-levels (org-get-heading t t t t))) + +;;;; Flyspell + +(defun org--flyspell-object-check-p (element) + "Non-nil when Flyspell can check object at point. +ELEMENT is the element at point." + (let ((object (save-excursion + (when (looking-at-p "\\>") (backward-char)) + (org-element-context element)))) + (cl-case (org-element-type object) + ;; Prevent checks in links due to keybinding conflict with + ;; Flyspell. + ((code entity export-snippet inline-babel-call + inline-src-block line-break latex-fragment link macro + statistics-cookie target timestamp verbatim) + nil) + (footnote-reference + ;; Only in inline footnotes, within the definition. + (and (eq (org-element-property :type object) 'inline) + (< (save-excursion + (goto-char (org-element-property :begin object)) + (search-forward ":" nil t 2)) + (point)))) + (otherwise t)))) + +(defun org-mode-flyspell-verify () + "Function used for `flyspell-generic-check-word-predicate'." + (if (org-at-heading-p) + ;; At a headline or an inlinetask, check title only. + (and (save-excursion (beginning-of-line) + (and (let ((case-fold-search t)) + (not (looking-at-p "\\*+ END[ \t]*$"))) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp)))) + (match-beginning 4) + (>= (point) (match-beginning 4)) + (or (not (match-beginning 5)) + (< (point) (match-beginning 5))) + ;; Ignore checks in code, verbatim and others. + (org--flyspell-object-check-p (org-element-at-point))) + (let* ((element (org-element-at-point)) + (post-affiliated (org-element-property :post-affiliated element))) + (cond + ;; Ignore checks in all affiliated keywords but captions. + ((< (point) post-affiliated) + (and (save-excursion + (beginning-of-line) + (let ((case-fold-search t)) (looking-at "[ \t]*#\\+CAPTION:"))) + (> (point) (match-end 0)) + (org--flyspell-object-check-p element))) + ;; Ignore checks in LOGBOOK (or equivalent) drawer. + ((let ((log (org-log-into-drawer))) + (and log + (let ((drawer (org-element-lineage element '(drawer)))) + (and drawer + (eq (compare-strings + log nil nil + (org-element-property :drawer-name drawer) nil nil t) + t))))) + nil) + (t + (cl-case (org-element-type element) + ((comment quote-section) t) + (comment-block + ;; Allow checks between block markers, not on them. + (and (> (line-beginning-position) post-affiliated) + (save-excursion + (end-of-line) + (skip-chars-forward " \r\t\n") + (< (point) (org-element-property :end element))))) + ;; Arbitrary list of keywords where checks are meaningful. + ;; Make sure point is on the value part of the element. + (keyword + (and (member (org-element-property :key element) + '("DESCRIPTION" "TITLE")) + (save-excursion + (search-backward ":" (line-beginning-position) t)))) + ;; Check is globally allowed in paragraphs verse blocks and + ;; table rows (after affiliated keywords) but some objects + ;; must not be affected. + ((paragraph table-row verse-block) + (let ((cbeg (org-element-property :contents-begin element)) + (cend (org-element-property :contents-end element))) + (and cbeg (>= (point) cbeg) (< (point) cend) + (org--flyspell-object-check-p element)))))))))) +(put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) + +(defun org-remove-flyspell-overlays-in (beg end) + "Remove flyspell overlays in region." + (and (bound-and-true-p flyspell-mode) + (fboundp 'flyspell-delete-region-overlays) + (flyspell-delete-region-overlays beg end))) + +(defvar flyspell-delayed-commands) +(eval-after-load 'flyspell + '(add-to-list 'flyspell-delayed-commands 'org-self-insert-command)) + +;;;; Bookmark + +(defun org-bookmark-jump-unhide () + "Unhide the current position, to show the bookmark location." + (and (derived-mode-p 'org-mode) + (or (org-invisible-p) + (save-excursion (goto-char (max (point-min) (1- (point)))) + (org-invisible-p))) + (org-show-context 'bookmark-jump))) + +;; Make `bookmark-jump' shows the jump location if it was hidden. +(add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide) + +;;;; Calendar + +(defcustom org-calendar-to-agenda-key 'default + "Key to be installed in `calendar-mode-map' for switching to the agenda. + +The command `org-calendar-goto-agenda' will be bound to this key. + +When set to `default', bind the function to `c', but only if it is +available in the Calendar keymap. This is the default choice because +`c' can then be used to switch back and forth between agenda and calendar. + +When nil, `org-calendar-goto-agenda' is not bound to any key." + :group 'org-agenda + :type '(choice + (const :tag "Bind to `c' if available" default) + (key-sequence :tag "Other binding") + (const :tag "No binding" nil)) + :safe (lambda (v) (or (symbolp v) (stringp v))) + :package-version '(Org . "9.2")) + +(defcustom org-calendar-insert-diary-entry-key [?i] + "The key to be installed in `calendar-mode-map' for adding diary entries. +This option is irrelevant until `org-agenda-diary-file' has been configured +to point to an Org file. When that is the case, the command +`org-agenda-diary-entry' will be bound to the key given here, by default +`i'. In the calendar, `i' normally adds entries to `diary-file'. So +if you want to continue doing this, you need to change this to a different +key." + :group 'org-agenda + :type 'sexp) + +(defun org--setup-calendar-bindings () + "Bind Org functions in Calendar keymap." + (pcase org-calendar-to-agenda-key + (`nil nil) + ((and key (pred stringp)) + (local-set-key (kbd key) #'org-calendar-goto-agenda)) + ((guard (not (lookup-key calendar-mode-map "c"))) + (local-set-key "c" #'org-calendar-goto-agenda)) + (_ nil)) + (when (and (boundp 'org-agenda-diary-file) + (not (eq org-agenda-diary-file 'diary-file))) + (local-set-key org-calendar-insert-diary-entry-key + #'org-agenda-diary-entry))) + +(eval-after-load 'calendar + '(add-hook 'calendar-mode-hook #'org--setup-calendar-bindings)) + +;;;; Saveplace + +;; Make sure saveplace shows the location if it was hidden +(eval-after-load 'saveplace + '(defadvice save-place-find-file-hook (after org-make-visible activate) + "Make the position visible." + (org-bookmark-jump-unhide))) + +;;;; Ecb + +;; Make sure ecb shows the location if it was hidden +(eval-after-load 'ecb + '(defadvice ecb-method-clicked (after esf/org-show-context activate) + "Make hierarchy visible when jumping into location from ECB tree buffer." + (when (derived-mode-p 'org-mode) + (org-show-context)))) + +;;;; Simple + +(defun org-mark-jump-unhide () + "Make the point visible with `org-show-context' after jumping to the mark." + (when (and (derived-mode-p 'org-mode) + (org-invisible-p)) + (org-show-context 'mark-goto))) + +(eval-after-load 'simple + '(defadvice pop-to-mark-command (after org-make-visible activate) + "Make the point visible with `org-show-context'." + (org-mark-jump-unhide))) + +(eval-after-load 'simple + '(defadvice exchange-point-and-mark (after org-make-visible activate) + "Make the point visible with `org-show-context'." + (org-mark-jump-unhide))) + +(eval-after-load 'simple + '(defadvice pop-global-mark (after org-make-visible activate) + "Make the point visible with `org-show-context'." + (org-mark-jump-unhide))) + +;;;; Session + +;; Make "session.el" ignore our circular variable. +(defvar session-globals-exclude) +(eval-after-load 'session + '(add-to-list 'session-globals-exclude 'org-mark-ring)) + +;;;; Speed commands + +(make-obsolete-variable 'org-speed-commands-user + "configure `org-speed-commands' instead." "9.5") + +(provide 'org-compat) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-compat.el ends here diff --git a/elpa/org-9.5.2/org-compat.elc b/elpa/org-9.5.2/org-compat.elc new file mode 100644 index 0000000..9d984bc Binary files /dev/null and b/elpa/org-9.5.2/org-compat.elc differ diff --git a/elpa/org-9.5.2/org-crypt.el b/elpa/org-9.5.2/org-crypt.el new file mode 100644 index 0000000..48f76b7 --- /dev/null +++ b/elpa/org-9.5.2/org-crypt.el @@ -0,0 +1,320 @@ +;;; org-crypt.el --- Public Key Encryption for Org Entries -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2007-2021 Free Software Foundation, Inc. + +;; Author: John Wiegley + +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; Right now this is just a set of functions to play with. It depends +;; on the epg library. Here's how you would use it: +;; +;; 1. To mark an entry for encryption, tag the heading with "crypt". +;; You can change the tag to any complex tag matching string by +;; setting the `org-crypt-tag-matcher' variable. +;; +;; 2. Set the encryption key to use in the `org-crypt-key' variable, +;; or use `M-x org-set-property' to set the property CRYPTKEY to +;; any address in your public keyring. The text of the entry (but +;; not its properties or headline) will be encrypted for this user. +;; For them to read it, the corresponding secret key must be +;; located in the secret key ring of the account where you try to +;; decrypt it. This makes it possible to leave secure notes that +;; only the intended recipient can read in a shared-org-mode-files +;; scenario. +;; If the key is not set, org-crypt will default to symmetric encryption. +;; +;; 3. To later decrypt an entry, use `org-decrypt-entries' or +;; `org-decrypt-entry'. It might be useful to bind this to a key, +;; like C-c C-/. +;; +;; 4. To automatically encrypt all necessary entries when saving a +;; file, call `org-crypt-use-before-save-magic' after loading +;; org-crypt.el. + +;;; Thanks: + +;; - Carsten Dominik +;; - Vitaly Ostanin + +;;; Code: + +(require 'org-macs) +(require 'org-compat) + +(declare-function epg-decrypt-string "epg" (context cipher)) +(declare-function epg-list-keys "epg" (context &optional name mode)) +(declare-function epg-make-context "epg" + (&optional protocol armor textmode include-certs + cipher-algorithm digest-algorithm + compress-algorithm)) +(declare-function epg-encrypt-string "epg" + (context plain recipients &optional sign always-trust)) +(defvar epg-context) + +(declare-function org-back-over-empty-lines "org" ()) +(declare-function org-back-to-heading "org" (&optional invisible-ok)) +(declare-function org-before-first-heading-p "org" ()) +(declare-function org-end-of-meta-data "org" (&optional full)) +(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) +(declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) +(declare-function org-flag-subtree "org" (flag)) +(declare-function org-make-tags-matcher "org" (match)) +(declare-function org-previous-visible-heading "org" (arg)) +(declare-function org-scan-tags "org" (action matcher todo-only &optional start-level)) +(declare-function org-set-property "org" (property value)) + +(defgroup org-crypt nil + "Org Crypt." + :tag "Org Crypt" + :group 'org) + +(defcustom org-crypt-tag-matcher "crypt" + "The tag matcher used to find headings whose contents should be encrypted. + +See the \"Match syntax\" section of the org manual for more details." + :type 'string + :group 'org-crypt) + +(defcustom org-crypt-key "" + "The default key to use when encrypting the contents of a heading. + +If this variable is nil, always use symmetric encryption, unconditionally. + +Otherwise, The string is matched against all keys in the key ring. +In particular, the empty string matches no key. If no key is found, +look for the `epa-file-encrypt-to' local variable. Ultimately fall back +to symmetric encryption. + +This setting can be overridden in the CRYPTKEY property." + :group 'org-crypt + :type '(choice + (string :tag "Public key(s) matching") + (const :tag "Symmetric encryption" nil))) + +(defcustom org-crypt-disable-auto-save 'ask + "What org-decrypt should do if `auto-save-mode' is enabled. + +t : Disable auto-save-mode for the current buffer + prior to decrypting an entry. + +nil : Leave auto-save-mode enabled. + This may cause data to be written to disk unencrypted! + +`ask' : Ask user whether or not to disable auto-save-mode + for the current buffer. + +`encrypt': Leave auto-save-mode enabled for the current buffer, + but automatically re-encrypt all decrypted entries + *before* auto-saving. + NOTE: This only works for entries which have a tag + that matches `org-crypt-tag-matcher'." + :group 'org-crypt + :version "24.1" + :type '(choice (const :tag "Always" t) + (const :tag "Never" nil) + (const :tag "Ask" ask) + (const :tag "Encrypt" encrypt))) + +(defun org-crypt--encrypted-text (beg end) + "Return encrypted text in between BEG and END." + ;; Ignore indentation. + (replace-regexp-in-string + "^[ \t]*" "" + (buffer-substring-no-properties beg end))) + +(defun org-at-encrypted-entry-p () + "Is the current entry encrypted? +When the entry is encrypted, return a pair (BEG . END) where BEG +and END are buffer positions delimiting the encrypted area." + (org-with-wide-buffer + (unless (org-before-first-heading-p) + (org-back-to-heading t) + (org-end-of-meta-data 'standard) + (let ((case-fold-search nil) + (banner-start (rx (seq bol + (zero-or-more (any "\t ")) + "-----BEGIN PGP MESSAGE-----" + eol)))) + (when (looking-at banner-start) + (let ((start (point)) + (banner-end (rx (seq bol + (or (group (zero-or-more (any "\t ")) + "-----END PGP MESSAGE-----" + eol) + (seq (one-or-more "*") " ")))))) + (when (and (re-search-forward banner-end nil t) (match-string 1)) + (cons start (line-beginning-position 2))))))))) + +(defun org-crypt-check-auto-save () + "Check whether auto-save-mode is enabled for the current buffer. + +`auto-save-mode' may cause leakage when decrypting entries, so +check whether it's enabled, and decide what to do about it. + +See `org-crypt-disable-auto-save'." + (when buffer-auto-save-file-name + (cond + ((or + (eq org-crypt-disable-auto-save t) + (and + (eq org-crypt-disable-auto-save 'ask) + (y-or-n-p "org-decrypt: auto-save-mode may cause leakage. Disable it for current buffer? "))) + (message "org-decrypt: Disabling auto-save-mode for %s" + (or (buffer-file-name) (current-buffer))) + ;; The argument to auto-save-mode has to be "-1", since + ;; giving a "nil" argument toggles instead of disabling. + (auto-save-mode -1)) + ((eq org-crypt-disable-auto-save nil) + (message "org-decrypt: Decrypting entry with auto-save-mode enabled. This may cause leakage.")) + ((eq org-crypt-disable-auto-save 'encrypt) + (message "org-decrypt: Enabling re-encryption on auto-save.") + (add-hook 'auto-save-hook + (lambda () + (message "org-crypt: Re-encrypting all decrypted entries due to auto-save.") + (org-encrypt-entries)) + nil t)) + (t nil)))) + +(defun org-crypt-key-for-heading () + "Return the encryption key(s) for the current heading. +Assume `epg-context' is set." + (and org-crypt-key + (or (epg-list-keys epg-context + (or (org-entry-get nil "CRYPTKEY" 'selective) + org-crypt-key)) + (bound-and-true-p epa-file-encrypt-to) + (progn + (message "No crypt key set, using symmetric encryption.") + nil)))) + +;;;###autoload +(defun org-encrypt-entry () + "Encrypt the content of the current headline." + (interactive) + (unless (org-at-encrypted-entry-p) + (require 'epg) + (setq-local epg-context (epg-make-context nil t t)) + (org-with-wide-buffer + (org-back-to-heading t) + (let ((start-heading (point)) + (crypt-key (org-crypt-key-for-heading)) + (folded? (org-invisible-p (line-beginning-position)))) + (org-end-of-meta-data 'standard) + (let ((beg (point)) + (folded-heading + (and folded? + (save-excursion + (org-previous-visible-heading 1) + (point))))) + (goto-char start-heading) + (org-end-of-subtree t t) + (org-back-over-empty-lines) + (let* ((contents (delete-and-extract-region beg (point))) + (key (get-text-property 0 'org-crypt-key contents)) + (checksum (get-text-property 0 'org-crypt-checksum contents))) + (condition-case err + (insert + ;; Text and key have to be identical, otherwise we + ;; re-crypt. + (if (and (equal crypt-key key) + (string= checksum (sha1 contents))) + (get-text-property 0 'org-crypt-text contents) + (epg-encrypt-string epg-context contents crypt-key))) + ;; If encryption failed, make sure to insert back entry + ;; contents in the buffer. + (error + (insert contents) + (error (error-message-string err))))) + (when folded-heading + (goto-char folded-heading) + (org-flag-subtree t)) + nil))))) + +;;;###autoload +(defun org-decrypt-entry () + "Decrypt the content of the current headline." + (interactive) + (pcase (org-at-encrypted-entry-p) + (`(,beg . ,end) + (require 'epg) + (setq-local epg-context (epg-make-context nil t t)) + (org-with-point-at beg + (org-crypt-check-auto-save) + (let* ((folded-heading + (and (org-invisible-p) + (save-excursion + (org-previous-visible-heading 1) + (point)))) + (encrypted-text (org-crypt--encrypted-text beg end)) + (decrypted-text + (decode-coding-string + (epg-decrypt-string epg-context encrypted-text) + 'utf-8))) + ;; Delete region starting just before point, because the + ;; outline property starts at the \n of the heading. + (delete-region (1- (point)) end) + ;; Store a checksum of the decrypted and the encrypted text + ;; value. This allows reusing the same encrypted text if the + ;; text does not change, and therefore avoid a re-encryption + ;; process. + (insert "\n" + (propertize decrypted-text + 'org-crypt-checksum (sha1 decrypted-text) + 'org-crypt-key (org-crypt-key-for-heading) + 'org-crypt-text encrypted-text)) + (when folded-heading + (goto-char folded-heading) + (org-flag-subtree t)) + nil))) + (_ nil))) + +(defvar org--matcher-tags-todo-only) + +;;;###autoload +(defun org-encrypt-entries () + "Encrypt all top-level entries in the current buffer." + (interactive) + (let ((org--matcher-tags-todo-only nil)) + (org-scan-tags + 'org-encrypt-entry + (cdr (org-make-tags-matcher org-crypt-tag-matcher)) + org--matcher-tags-todo-only))) + +;;;###autoload +(defun org-decrypt-entries () + "Decrypt all entries in the current buffer." + (interactive) + (let ((org--matcher-tags-todo-only nil)) + (org-scan-tags + 'org-decrypt-entry + (cdr (org-make-tags-matcher org-crypt-tag-matcher)) + org--matcher-tags-todo-only))) + +;;;###autoload +(defun org-crypt-use-before-save-magic () + "Add a hook to automatically encrypt entries before a file is saved to disk." + (add-hook + 'org-mode-hook + (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) + +(add-hook 'org-reveal-start-hook 'org-decrypt-entry) + +(provide 'org-crypt) + +;;; org-crypt.el ends here diff --git a/elpa/org-9.5.2/org-crypt.elc b/elpa/org-9.5.2/org-crypt.elc new file mode 100644 index 0000000..8602773 Binary files /dev/null and b/elpa/org-9.5.2/org-crypt.elc differ diff --git a/elpa/org-9.5.2/org-ctags.el b/elpa/org-9.5.2/org-ctags.el new file mode 100644 index 0000000..7876c6e --- /dev/null +++ b/elpa/org-9.5.2/org-ctags.el @@ -0,0 +1,534 @@ +;;; org-ctags.el --- Integrate Emacs "tags" Facility with Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2007-2021 Free Software Foundation, Inc. + +;; Author: Paul Sexton +;; Keywords: org, wp + +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; +;; Synopsis +;; ======== +;; +;; Allows Org mode to make use of the Emacs `etags' system. Defines +;; tag destinations in Org files as any text between <>. This allows the tags-generation program `exuberant +;; ctags' to parse these files and create tag tables that record where +;; these destinations are found. Plain [[links]] in org mode files +;; which do not have <> within the same file +;; will then be interpreted as links to these 'tagged' destinations, +;; allowing seamless navigation between multiple Org files. Topics +;; can be created in any org mode file and will always be found by +;; plain links from other files. Other file types recognized by ctags +;; (source code files, latex files, etc) will also be available as +;; destinations for plain links, and similarly, Org links will be +;; available as tags from source files. Finally, the function +;; `org-ctags-find-tag-interactive' lets you choose any known tag, +;; using autocompletion, and quickly jump to it. +;; +;; Installation +;; ============ +;; +;; Install org mode +;; Ensure org-ctags.el is somewhere in your emacs load path. +;; Download and install Exuberant ctags -- "http://ctags.sourceforge.net/" +;; Edit your .emacs file (see next section) and load emacs. + +;; To put in your init file (.emacs): +;; ================================== +;; +;; Assuming you already have org mode installed and set up: +;; +;; (setq org-ctags-path-to-ctags "/path/to/ctags/executable") +;; (add-hook 'org-mode-hook +;; (lambda () +;; (define-key org-mode-map "\C-co" 'org-ctags-find-tag-interactive))) +;; +;; 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 +;; he/she wants to rebuild the 'TAGS' database and try again; then ask if +;; the user wishes to append 'tag' as a new toplevel heading at the end of +;; the buffer; and finally, defer to org's default behavior which is to +;; search the entire text of the current buffer for 'tag'. +;; +;; This behavior can be modified by changing the value of +;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my +;; .emacs, which describes the same behavior as the above paragraph with +;; one difference: +;; +;; (setq org-ctags-open-link-functions +;; '(org-ctags-find-tag +;; org-ctags-ask-rebuild-tags-file-then-find-tag +;; org-ctags-ask-append-topic +;; org-ctags-fail-silently)) ; <-- prevents org default behavior +;; +;; +;; Usage +;; ===== +;; +;; When you click on a link "[[foo]]" and org cannot find a matching "<>" +;; in the current buffer, the tags facility will take over. The file TAGS in +;; the active directory is examined to see if the tags facility knows about +;; "<>" in any other files. If it does, the matching file will be opened +;; and the cursor will jump to the position of "<>" in that file. +;; +;; User-visible functions: +;; - `org-ctags-find-tag-interactive': type a tag (plain link) name and visit +;; it. With autocompletion. Bound to ctrl-O in the above setup. +;; - All the etags functions should work. These include: +;; +;; M-. `find-tag' -- finds the tag at point +;; +;; C-M-. find-tag based on regular expression +;; +;; M-x tags-search RET -- like C-M-. but searches through ENTIRE TEXT +;; of ALL the files referenced in the TAGS file. A quick way to +;; search through an entire 'project'. +;; +;; M-* "go back" from a tag jump. Like `org-mark-ring-goto'. +;; You may need to bind this key yourself with (eg) +;; (global-set-key (kbd "") 'pop-tag-mark) +;; +;; (see etags chapter in Emacs manual for more) +;; +;; +;; Keeping the TAGS file up to date +;; ================================ +;; +;; Tags mode has no way of knowing that you have created new tags by +;; typing in your Org buffer. New tags make it into the TAGS file in +;; 3 ways: +;; +;; 1. You re-run (org-ctags-create-tags "directory") to rebuild the file. +;; 2. You put the function `org-ctags-ask-rebuild-tags-file-then-find-tag' in +;; your `org-open-link-functions' list, as is done in the setup +;; above. This will cause the TAGS file to be rebuilt whenever a link +;; cannot be found. This may be slow with large file collections however. +;; 3. You run the following from the command line (all 1 line): +;; +;; ctags --langdef=orgmode --langmap=orgmode:.org +;; --regex-orgmode="/<<([^>]+)>>/\1/d,definition/" +;; -f /your/path/TAGS -e -R /your/path/*.org +;; +;; If you are paranoid, you might want to run (org-ctags-create-tags +;; "/path/to/org/files") at startup, by including the following toplevel form +;; in .emacs. However this can cause a pause of several seconds if ctags has +;; to scan lots of files. +;; +;; (progn +;; (message "-- rebuilding tags tables...") +;; (mapc 'org-ctags-create-tags tags-table-list)) + +;;; Code: + +(eval-when-compile (require 'cl-lib)) +(require 'org) + +(defgroup org-ctags nil + "Options concerning use of ctags within org mode." + :tag "Org-Ctags" + :group 'org-link) + +(defvar org-ctags-enabled-p t + "Activate ctags support in org mode?") + +(defvar org-ctags-tag-regexp "/<<([^>]+)>>/\\1/d,definition/" + "Regexp expression used by ctags external program. +The regexp matches tag destinations in Org files. +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") + "Name of the ctags executable file." + :group 'org-ctags + :version "24.1" + :type 'file) + +(defcustom org-ctags-open-link-functions + '(org-ctags-find-tag + org-ctags-ask-rebuild-tags-file-then-find-tag + org-ctags-ask-append-topic) + "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS by ORG-CTAGS." + :group '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)) + + +(defvar org-ctags-tag-list nil + "List of all tags in the active TAGS file. +Created as a local variable in each buffer.") + +(defcustom org-ctags-new-topic-template + "* <<%t>>\n\n\n\n\n\n" + "Text to insert when creating a new org file via opening a hyperlink. +The following patterns are replaced in the string: + `%t' - replaced with the capitalized title of the hyperlink" + :group 'org-ctags + :version "24.1" + :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)))))) + + +(defadvice visit-tags-table (after org-ctags-load-tag-list activate compile) + (when (and org-ctags-enabled-p tags-file-name) + (setq-local org-ctags-tag-list + (org-ctags-all-tags-in-current-tags-table)))) + + +(defun org-ctags-enable () + (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))) + + +;;; General utility functions. =============================================== +;; These work outside org-ctags mode. + +(defun org-ctags-get-filename-for-tag (tag) + "TAG is a string. Search the active TAGS file for a matching tag. +If the tag is found, return a list containing the filename, line number, and +buffer position where the tag is found." + (interactive "sTag: ") + (unless tags-file-name + (call-interactively (visit-tags-table))) + (save-excursion + (visit-tags-table-buffer 'same) + (when tags-file-name + (with-current-buffer (get-file-buffer tags-file-name) + (goto-char (point-min)) + (cond + ((re-search-forward (format "^.*\^?%s\^A\\([0-9]+\\),\\([0-9]+\\)$" + (regexp-quote tag)) nil t) + (let ((line (string-to-number (match-string 1))) + (pos (string-to-number (match-string 2)))) + (cond + ((re-search-backward " \n\\(.*\\),[0-9]+\n") + (list (match-string 1) line pos)) + (t ; can't find a file name preceding the matched + ; tag?? + (error "Malformed TAGS file: %s" (buffer-name)))))) + (t ; tag not found + nil)))))) + + +(defun org-ctags-all-tags-in-current-tags-table () + "Read all tags defined in the active TAGS file, into a list of strings. +Return the list." + (interactive) + (let ((taglist nil)) + (unless tags-file-name + (call-interactively (visit-tags-table))) + (save-excursion + (visit-tags-table-buffer 'same) + (with-current-buffer (get-file-buffer tags-file-name) + (goto-char (point-min)) + (while (re-search-forward "^.*\^?\\(.*\\)\^A\\([0-9]+\\),\\([0-9]+\\)$" + nil t) + (push (substring-no-properties (match-string 1)) taglist))) + taglist))) + + +(defun org-ctags-string-search-and-replace (search replace string) + "Replace all instances of SEARCH with REPLACE in STRING." + (replace-regexp-in-string (regexp-quote search) replace string t t)) + + +;;; Internal functions ======================================================= + + +(defun org-ctags-open-file (name &optional title) + "Visit or create a file called `NAME.org', and insert a new topic. +The new topic will be titled NAME (or TITLE if supplied)." + (interactive "sFile name: ") + (condition-case v + (progn + (org-open-file name t) + (message "Opened file OK") + (goto-char (point-max)) + (insert (org-ctags-string-search-and-replace + "%t" (capitalize (or title name)) + org-ctags-new-topic-template)) + (message "Inserted new file text OK") + (org-mode-restart)) + (error (error "Error %S in org-ctags-open-file" v)))) + + +;;;; Misc interoperability with etags system ================================= + + +(defadvice xref-find-definitions + (before org-ctags-set-org-mark-before-finding-tag activate compile) + "Before trying to find a tag, save our current position on org mark ring." + (save-excursion + (when (and (derived-mode-p 'org-mode) org-ctags-enabled-p) + (org-mark-ring-push)))) + + + +(defun org-ctags-find-tag-at-point () + "Determine default tag to search for, based on text at point. +If there is no plausible default, return nil." + (let (from to bound) + (when (or (ignore-errors + ;; Look for hyperlink around `point'. + (save-excursion + (search-backward "[[") (setq from (+ 2 (point)))) + (save-excursion + (goto-char from) + (search-forward "]") (setq to (- (point) 1))) + (and (> to from) (>= (point) from) (<= (point) to))) + (progn + ;; Look at text around `point'. + (save-excursion + (skip-syntax-backward "w_") (setq from (point))) + (save-excursion + (skip-syntax-forward "w_") (setq to (point))) + (> to from)) + ;; Look between `line-beginning-position' and `point'. + (save-excursion + (and (setq bound (line-beginning-position)) + (skip-syntax-backward "^w_" bound) + (> (setq to (point)) bound) + (skip-syntax-backward "w_") + (setq from (point)))) + ;; Look between `point' and `line-end-position'. + (save-excursion + (and (setq bound (line-end-position)) + (skip-syntax-forward "^w_" bound) + (< (setq from (point)) bound) + (skip-syntax-forward "w_") + (setq to (point))))) + (buffer-substring-no-properties from to)))) + + +;;; Functions for use with 'org-open-link-functions' hook ================= + + +(defun org-ctags-find-tag (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Look for a tag called `NAME' in the current TAGS table. If it is found, +visit the file and location where the tag is found." + (interactive "sTag: ") + (let ((old-buf (current-buffer)) + (old-pnt (point-marker)) + (old-mark (copy-marker (mark-marker)))) + (condition-case nil + (progn (xref-find-definitions name) + t) + (error + ;; only restore old location if find-tag raises error + (set-buffer old-buf) + (goto-char old-pnt) + (set-marker (mark-marker) old-mark) + nil)))) + + +(defun org-ctags-visit-buffer-or-file (name &optional create) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Visit buffer named `NAME.org'. If there is no such buffer, visit the file +with the same name if it exists. If the file does not exist, then behavior +depends on the value of CREATE. + +If CREATE is nil (default), then return nil. Do not create a new file. +If CREATE is t, create the new file and visit it. +If CREATE is the symbol `ask', then ask the user if they wish to create +the new file." + (interactive) + (let ((filename (concat (substitute-in-file-name + (expand-file-name name)) + ".org"))) + (cond + ((get-buffer (concat name ".org")) + ;; Buffer is already open + (pop-to-buffer-same-window (get-buffer (concat name ".org")))) + ((file-exists-p filename) + ;; File exists but is not open --> open it + (message "Opening existing org file `%S'..." + filename) + (org-open-file filename t)) + ((or (eql create t) + (and (eql create 'ask) + (y-or-n-p (format-message + "File `%s.org' not found; create?" name)))) + (org-ctags-open-file filename name)) + (t ;; File does not exist, and we don't want to create it. + nil)))) + + +(defun org-ctags-ask-visit-buffer-or-file (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Wrapper for org-ctags-visit-buffer-or-file, which ensures the user is +asked before creating a new file." + (org-ctags-visit-buffer-or-file name 'ask)) + + +(defun org-ctags-append-topic (name &optional narrowp) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Append a new toplevel heading to the end of the current buffer. The +heading contains NAME surrounded by <>, thus making +the heading a destination for the tag `NAME'." + (interactive "sTopic: ") + (widen) + (goto-char (point-max)) + (newline 2) + (message "Adding topic in buffer %s" (buffer-name)) + (insert (org-ctags-string-search-and-replace + "%t" (capitalize name) org-ctags-new-topic-template)) + (backward-char 4) + (end-of-line) + (forward-line 2) + (when narrowp + ;;(org-tree-to-indirect-buffer 1) ;; opens new frame + (org-narrow-to-subtree)) + t) + + +(defun org-ctags-ask-append-topic (name &optional narrowp) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Wrapper for org-ctags-append-topic, which first asks the user if they want +to append a new topic." + (if (y-or-n-p (format-message + "Topic `%s' not found; append to end of buffer?" name)) + (org-ctags-append-topic name narrowp) + nil)) + + +(defun org-ctags-rebuild-tags-file-then-find-tag (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Like ORG-CTAGS-FIND-TAG, but calls the external ctags program first, +to rebuild (update) the TAGS file." + (unless tags-file-name + (call-interactively (visit-tags-table))) + (when (buffer-file-name) + (org-ctags-create-tags)) + (org-ctags-find-tag name)) + + +(defun org-ctags-ask-rebuild-tags-file-then-find-tag (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Wrapper for org-ctags-rebuild-tags-file-then-find-tag." + (if (and (buffer-file-name) + (y-or-n-p + (format-message + "Tag `%s' not found. Rebuild table `%s/TAGS' and look again?" + name + (file-name-directory (buffer-file-name))))) + (org-ctags-rebuild-tags-file-then-find-tag name) + nil)) + + +(defun org-ctags-fail-silently (_name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Put as the last function in the list if you want to prevent Org's +default behavior of free text search." + t) + + +;;; User-visible functions =================================================== + + +(defun org-ctags-create-tags (&optional directory-name) + "(Re)create tags file in the directory of the active buffer. +The file will contain tag definitions for all the files in the +directory and its subdirectories which are recognized by ctags. +This will include files ending in `.org' as well as most other +source files (.C, .H, .EL, .LISP, etc). All the resulting tags +end up in one file, called TAGS, located in the directory. This +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)))) + (exitcode nil)) + (save-excursion + (setq exitcode + (shell-command + (format (concat "%s --langdef=orgmode --langmap=orgmode:.org " + "--regex-orgmode=\"%s\" -f \"%s\" -e -R \"%s\"") + org-ctags-path-to-ctags + org-ctags-tag-regexp + (expand-file-name (concat dir-name "/TAGS")) + (expand-file-name (concat dir-name "/*"))))) + (cond + ((eql 0 exitcode) + (setq-local org-ctags-tag-list + (org-ctags-all-tags-in-current-tags-table))) + (t + ;; This seems to behave differently on Linux, so just ignore + ;; error codes for now + ;;(error "Calling ctags executable resulted in error code: %s" + ;; exitcode) + nil))))) + + +(defvar org-ctags-find-tag-history nil + "History of tags visited by org-ctags-find-tag-interactive.") + +(defun org-ctags-find-tag-interactive () + "Prompt for the name of a tag, with autocompletion, then visit the named tag. +Uses `ido-mode' if available. +If the user enters a string that does not match an existing tag, create +a new topic." + (interactive) + (let* ((completing-read-fn (if (fboundp 'ido-completing-read) + 'ido-completing-read + 'completing-read)) + (tag (funcall completing-read-fn "Topic: " org-ctags-tag-list + nil 'confirm nil 'org-ctags-find-tag-history))) + (when tag + (cond + ((member tag org-ctags-tag-list) + ;; Existing tag + (push tag org-ctags-find-tag-history) + (xref-find-definitions tag)) + (t + ;; New tag + (run-hook-with-args-until-success + 'org-open-link-functions tag)))))) + + +(org-ctags-enable) + +(provide 'org-ctags) + +;;; org-ctags.el ends here diff --git a/elpa/org-9.5.2/org-ctags.elc b/elpa/org-9.5.2/org-ctags.elc new file mode 100644 index 0000000..fbcc974 Binary files /dev/null and b/elpa/org-9.5.2/org-ctags.elc differ diff --git a/elpa/org-9.5.2/org-datetree.el b/elpa/org-9.5.2/org-datetree.el new file mode 100644 index 0000000..74442b0 --- /dev/null +++ b/elpa/org-9.5.2/org-datetree.el @@ -0,0 +1,270 @@ +;;; org-datetree.el --- Create date entries in a tree -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains code to create entries in a tree where the top-level +;; nodes represent years, the level 2 nodes represent the months, and the +;; level 1 entries days. + +;;; Code: + +(require 'org) + +(defvar org-datetree-base-level 1 + "The level at which years should be placed in the date tree. +This is normally one, but if the buffer has an entry with a +DATE_TREE (or WEEK_TREE for ISO week entries) property (any +value), the date tree will become a subtree under that entry, so +the base level will be properly adjusted.") + +(defcustom org-datetree-add-timestamp nil + "When non-nil, add a time stamp matching date of entry. +Added time stamp is active unless value is `inactive'." + :group 'org-capture + :version "24.3" + :type '(choice + (const :tag "Do not add a time stamp" nil) + (const :tag "Add an inactive time stamp" inactive) + (const :tag "Add an active time stamp" active))) + +;;;###autoload +(defun org-datetree-find-date-create (d &optional keep-restriction) + "Find or create a day entry for date D. +If KEEP-RESTRICTION is non-nil, do not widen the buffer. +When it is nil, the buffer will be widened to make sure an existing date +tree can be found. If it is the symbol `subtree-at-point', then the tree +will be built under the headline at point." + (org-datetree--find-create-group d 'day keep-restriction)) + +;;;###autoload +(defun org-datetree-find-month-create (d &optional keep-restriction) + "Find or create a month entry for date D. +Compared to `org-datetree-find-date-create' this function creates +entries grouped by month instead of days. +If KEEP-RESTRICTION is non-nil, do not widen the buffer. +When it is nil, the buffer will be widened to make sure an existing date +tree can be found. If it is the symbol `subtree-at-point', then the tree +will be built under the headline at point." + (org-datetree--find-create-group d 'month keep-restriction)) + +(defun org-datetree--find-create-group + (d time-grouping &optional keep-restriction) + "Find or create an entry for date D. +If time-period is day, group entries by day. +If time-period is month, then group entries by month." + (setq-local org-datetree-base-level 1) + (save-restriction + (if (eq keep-restriction 'subtree-at-point) + (progn + (unless (org-at-heading-p) (error "Not at heading")) + (widen) + (org-narrow-to-subtree) + (setq-local org-datetree-base-level + (org-get-valid-level (org-current-level) 1))) + (unless keep-restriction (widen)) + ;; Support the old way of tree placement, using a property + (let ((prop (org-find-property "DATE_TREE"))) + (when prop + (goto-char prop) + (setq-local org-datetree-base-level + (org-get-valid-level (org-current-level) 1)) + (org-narrow-to-subtree)))) + (goto-char (point-min)) + (let ((year (calendar-extract-year d)) + (month (calendar-extract-month d)) + (day (calendar-extract-day d))) + (org-datetree--find-create + "^\\*+[ \t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\ +\\([ \t]:[[:alnum:]:_@#%%]+:\\)?\\s-*$\\)" + year) + (org-datetree--find-create + "^\\*+[ \t]+%d-\\([01][0-9]\\) \\w+$" + year month) + (when (eq time-grouping 'day) + (org-datetree--find-create + "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" + year month day))))) + +;;;###autoload +(defun org-datetree-find-iso-week-create (d &optional keep-restriction) + "Find or create an ISO week entry for date D. +Compared to `org-datetree-find-date-create' this function creates +entries ordered by week instead of months. +When it is nil, the buffer will be widened to make sure an existing date +tree can be found. If it is the symbol `subtree-at-point', then the tree +will be built under the headline at point." + (setq-local org-datetree-base-level 1) + (save-restriction + (if (eq keep-restriction 'subtree-at-point) + (progn + (unless (org-at-heading-p) (error "Not at heading")) + (widen) + (org-narrow-to-subtree) + (setq-local org-datetree-base-level + (org-get-valid-level (org-current-level) 1))) + (unless keep-restriction (widen)) + ;; Support the old way of tree placement, using a property + (let ((prop (org-find-property "WEEK_TREE"))) + (when prop + (goto-char prop) + (setq-local org-datetree-base-level + (org-get-valid-level (org-current-level) 1)) + (org-narrow-to-subtree)))) + (goto-char (point-min)) + (require 'cal-iso) + (let* ((year (calendar-extract-year d)) + (month (calendar-extract-month d)) + (day (calendar-extract-day d)) + (time (encode-time 0 0 0 day month year)) + (iso-date (calendar-iso-from-absolute + (calendar-absolute-from-gregorian d))) + (weekyear (nth 2 iso-date)) + (week (nth 0 iso-date))) + ;; ISO 8601 week format is %G-W%V(-%u) + (org-datetree--find-create + "^\\*+[ \t]+\\([12][0-9]\\{3\\}\\)\\(\\s-*?\ +\\([ \t]:[[:alnum:]:_@#%%]+:\\)?\\s-*$\\)" + weekyear nil nil + (format-time-string "%G" time)) + (org-datetree--find-create + "^\\*+[ \t]+%d-W\\([0-5][0-9]\\)$" + weekyear week nil + (format-time-string "%G-W%V" time)) + ;; For the actual day we use the regular date instead of ISO week. + (org-datetree--find-create + "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" + year month day)))) + +(defun org-datetree--find-create + (regex-template year &optional month day insert) + "Find the datetree matched by REGEX-TEMPLATE for YEAR, MONTH, or DAY. +REGEX-TEMPLATE is passed to `format' with YEAR, MONTH, and DAY as +arguments. Match group 1 is compared against the specified date +component. If INSERT is non-nil and there is no match then it is +inserted into the buffer." + (when (or month day) + (org-narrow-to-subtree)) + (let ((re (format regex-template year month day)) + match) + (goto-char (point-min)) + (while (and (setq match (re-search-forward re nil t)) + (goto-char (match-beginning 1)) + (< (string-to-number (match-string 1)) (or day month year)))) + (cond + ((not match) + (goto-char (point-max)) + (unless (bolp) (insert "\n")) + (org-datetree-insert-line year month day insert)) + ((= (string-to-number (match-string 1)) (or day month year)) + (beginning-of-line)) + (t + (beginning-of-line) + (org-datetree-insert-line year month day insert))))) + +(defun org-datetree-insert-line (year &optional month day text) + (delete-region (save-excursion (skip-chars-backward " \t\n") (point)) (point)) + (when (assq 'heading org-blank-before-new-entry) + (insert "\n")) + (insert "\n" (make-string org-datetree-base-level ?*) " \n") + (backward-char) + (when month (org-do-demote)) + (when day (org-do-demote)) + (if text + (insert text) + (insert (format "%d" year)) + (when month + (insert + (if day + (format-time-string "-%m-%d %A" (encode-time 0 0 0 day month year)) + (format-time-string "-%m %B" (encode-time 0 0 0 1 month year)))))) + (when (and day org-datetree-add-timestamp) + (save-excursion + (insert "\n") + (org-indent-line) + (org-insert-time-stamp + (encode-time 0 0 0 day month year) + nil + (eq org-datetree-add-timestamp 'inactive)))) + (beginning-of-line)) + +(defun org-datetree-file-entry-under (txt d) + "Insert a node TXT into the date tree under date D." + (org-datetree-find-date-create d) + (let ((level (org-get-valid-level (funcall outline-level) 1))) + (org-end-of-subtree t t) + (org-back-over-empty-lines) + (org-paste-subtree level txt))) + +(defun org-datetree-cleanup () + "Make sure all entries in the current tree are under the correct date. +It may be useful to restrict the buffer to the applicable portion +before running this command, even though the command tries to be smart." + (interactive) + (goto-char (point-min)) + (let ((dre (concat "\\<" org-deadline-string "\\>[ \t]*\\'")) + (sre (concat "\\<" org-scheduled-string "\\>[ \t]*\\'"))) + (while (re-search-forward org-ts-regexp nil t) + (catch 'next + (let ((tmp (buffer-substring + (max (line-beginning-position) + (- (match-beginning 0) org-ds-keyword-length)) + (match-beginning 0)))) + (when (or (string-suffix-p "-" tmp) + (string-match dre tmp) + (string-match sre tmp)) + (throw 'next nil)) + (let* ((dct (decode-time (org-time-string-to-time (match-string 0)))) + (date (list (nth 4 dct) (nth 3 dct) (nth 5 dct))) + (year (nth 2 date)) + (month (car date)) + (day (nth 1 date)) + (pos (point)) + (hdl-pos (progn (org-back-to-heading t) (point)))) + (unless (org-up-heading-safe) + ;; No parent, we are not in a date tree. + (goto-char pos) + (throw 'next nil)) + (unless (looking-at "\\*+[ \t]+[0-9]+-[0-1][0-9]-[0-3][0-9]") + ;; Parent looks wrong, we are not in a date tree. + (goto-char pos) + (throw 'next nil)) + (when (looking-at (format "\\*+[ \t]+%d-%02d-%02d" year month day)) + ;; At correct date already, do nothing. + (goto-char pos) + (throw 'next nil)) + ;; OK, we need to refile this entry. + (goto-char hdl-pos) + (org-cut-subtree) + (save-excursion + (save-restriction + (org-datetree-file-entry-under (current-kill 0) date))))))))) + +(provide 'org-datetree) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-datetree.el ends here diff --git a/elpa/org-9.5.2/org-datetree.elc b/elpa/org-9.5.2/org-datetree.elc new file mode 100644 index 0000000..ddf4d62 Binary files /dev/null and b/elpa/org-9.5.2/org-datetree.elc differ diff --git a/elpa/org-9.5.2/org-duration.el b/elpa/org-9.5.2/org-duration.el new file mode 100644 index 0000000..e627d09 --- /dev/null +++ b/elpa/org-9.5.2/org-duration.el @@ -0,0 +1,460 @@ +;;; org-duration.el --- Library handling durations -*- lexical-binding: t; -*- + +;; Copyright (C) 2017-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;; This library provides tools to manipulate durations. A duration +;; can have multiple formats: +;; +;; - 3:12 +;; - 1:23:45 +;; - 1y 3d 3h 4min +;; - 1d3h5min +;; - 3d 13:35 +;; - 2.35h +;; +;; More accurately, it consists of numbers and units, as defined in +;; variable `org-duration-units', possibly separated with white +;; spaces, and an optional "H:MM" or "H:MM:SS" part, which always +;; comes last. White spaces are tolerated between the number and its +;; relative unit. Variable `org-duration-format' controls durations +;; default representation. +;; +;; The library provides functions allowing to convert a duration to, +;; and from, a number of minutes: `org-duration-to-minutes' and +;; `org-duration-from-minutes'. It also provides two lesser tools: +;; `org-duration-p', and `org-duration-h:mm-only-p'. +;; +;; Users can set the number of minutes per unit, or define new units, +;; in `org-duration-units'. The library also supports canonical +;; duration, i.e., a duration that doesn't depend on user's settings, +;; through optional arguments. + +;;; Code: + +(require 'cl-lib) +(require 'org-macs) + + +;;; Public variables + +(defconst org-duration-canonical-units + `(("min" . 1) + ("h" . 60) + ("d" . ,(* 60 24))) + "Canonical time duration units. +See `org-duration-units' for details.") + +(defcustom org-duration-units + `(("min" . 1) + ("h" . 60) + ("d" . ,(* 60 24)) + ("w" . ,(* 60 24 7)) + ("m" . ,(* 60 24 30)) + ("y" . ,(* 60 24 365.25))) + "Conversion factor to minutes for a duration. + +Each entry has the form (UNIT . MODIFIER). + +In a duration string, a number followed by UNIT is multiplied by +the specified number of MODIFIER to obtain a duration in minutes. + +For example, the following value + + \\=`((\"min\" . 1) + (\"h\" . 60) + (\"d\" . ,(* 60 8)) + (\"w\" . ,(* 60 8 5)) + (\"m\" . ,(* 60 8 5 4)) + (\"y\" . ,(* 60 8 5 4 10))) + +is meaningful if you work an average of 8 hours per day, 5 days +a week, 4 weeks a month and 10 months a year. + +When setting this variable outside the Customize interface, make +sure to call the following command: + + \\[org-duration-set-regexps]" + :group 'org-agenda + :version "26.1" + :package-version '(Org . "9.1") + :set (lambda (var val) + (set-default var val) + ;; Avoid recursive load at startup. + (when (featurep 'org-duration) + (org-duration-set-regexps))) + :initialize 'custom-initialize-changed + :type '(choice + (const :tag "H:MM" h:mm) + (const :tag "H:MM:SS" h:mm:ss) + (alist :key-type (string :tag "Unit") + :value-type (number :tag "Modifier")))) + +(defcustom org-duration-format '(("d" . nil) (special . h:mm)) + "Format definition for a duration. + +The value can be set to, respectively, the symbols `h:mm:ss' or +`h:mm', which means a duration is expressed as, respectively, +a \"H:MM:SS\" or \"H:MM\" string. + +Alternatively, the value can be a list of entries following the +pattern: + + (UNIT . REQUIRED?) + +UNIT is a unit string, as defined in `org-duration-units'. The +time duration is formatted using only the time components that +are specified here. + +Units with a zero value are skipped, unless REQUIRED? is non-nil. +In that case, the unit is always used. + +The list can also contain one of the following special entries: + + (special . h:mm) + (special . h:mm:ss) + + Units shorter than an hour are ignored. The hours and + minutes part of the duration is expressed unconditionally + with H:MM, or H:MM:SS, pattern. + + (special . PRECISION) + + A duration is expressed with a single unit, PRECISION being + the number of decimal places to show. The unit chosen is the + first one required or with a non-zero integer part. If there + is no such unit, the smallest one is used. + +Eventually, if the list contains the symbol `compact', the +duration is expressed in a compact form, without any white space +between units. + +For example, + + ((\"d\" . nil) (\"h\" . t) (\"min\" . t)) + +means a duration longer than a day is expressed in days, hours +and minutes, whereas a duration shorter than a day is always +expressed in hours and minutes, even when shorter than an hour. + +On the other hand, the value + + ((\"d\" . nil) (\"min\" . nil)) + +means a duration longer than a day is expressed in days and +minutes, whereas a duration shorter than a day is expressed +entirely in minutes, even when longer than an hour. + +The following format + + ((\"d\" . nil) (special . h:mm)) + +means that any duration longer than a day is expressed with both +a \"d\" unit and a \"H:MM\" part, whereas a duration shorter than +a day is expressed only as a \"H:MM\" string. + +Eventually, + + ((\"d\" . nil) (\"h\" . nil) (special . 2)) + +expresses a duration longer than a day as a decimal number, with +a 2-digits fractional part, of \"d\" unit. A duration shorter +than a day uses \"h\" unit instead." + :group 'org-time + :group 'org-clock + :package-version '(Org . "9.1") + :type '(choice + (const :tag "Use H:MM" h:mm) + (const :tag "Use H:MM:SS" h:mm:ss) + (repeat :tag "Use units" + (choice + (cons :tag "Use units" + (string :tag "Unit") + (choice (const :tag "Skip when zero" nil) + (const :tag "Always used" t))) + (cons :tag "Use a single decimal unit" + (const special) + (integer :tag "Number of decimals")) + (cons :tag "Use both units and H:MM" + (const special) + (const h:mm)) + (cons :tag "Use both units and H:MM:SS" + (const special) + (const h:mm:ss)) + (const :tag "Use compact form" compact))))) + + +;;; Internal variables and functions + +(defconst org-duration--h:mm-re + "\\`[ \t]*[0-9]+\\(?::[0-9]\\{2\\}\\)\\{1,2\\}[ \t]*\\'" + "Regexp matching a duration expressed with H:MM or H:MM:SS format. +See `org-duration--h:mm:ss-re' to only match the latter. Hours +can use any number of digits.") + +(defconst org-duration--h:mm:ss-re + "\\`[ \t]*[0-9]+\\(?::[0-9]\\{2\\}\\)\\{2\\}[ \t]*\\'" + "Regexp matching a duration expressed H:MM:SS format. +See `org-duration--h:mm-re' to also support H:MM format. Hours +can use any number of digits.") + +(defvar org-duration--unit-re nil + "Regexp matching a duration with an unit. +Allowed units are defined in `org-duration-units'. Match group +1 contains the bare number. Match group 2 contains the unit.") + +(defvar org-duration--full-re nil + "Regexp matching a duration expressed with units. +Allowed units are defined in `org-duration-units'.") + +(defvar org-duration--mixed-re nil + "Regexp matching a duration expressed with units and H:MM or H:MM:SS format. +Allowed units are defined in `org-duration-units'. Match group +1 contains units part. Match group 2 contains H:MM or H:MM:SS +part.") + +(defun org-duration--modifier (unit &optional canonical) + "Return modifier associated to string UNIT. +When optional argument CANONICAL is non-nil, refer to +`org-duration-canonical-units' instead of `org-duration-units'." + (or (cdr (assoc unit (if canonical + org-duration-canonical-units + org-duration-units))) + (error "Unknown unit: %S" unit))) + + +;;; Public functions + +;;;###autoload +(defun org-duration-set-regexps () + "Set duration related regexps." + (interactive) + (setq org-duration--unit-re + (concat "\\([0-9]+\\(?:\\.[0-9]*\\)?\\)[ \t]*" + ;; Since user-defined units in `org-duration-units' + ;; can differ from canonical units in + ;; `org-duration-canonical-units', include both in + ;; regexp. + (regexp-opt (mapcar #'car (append org-duration-canonical-units + org-duration-units)) + t))) + (setq org-duration--full-re + (format "\\`\\(?:[ \t]*%s\\)+[ \t]*\\'" org-duration--unit-re)) + (setq org-duration--mixed-re + (format "\\`\\(?1:\\([ \t]*%s\\)+\\)[ \t]*\ +\\(?2:[0-9]+\\(?::[0-9][0-9]\\)\\{1,2\\}\\)[ \t]*\\'" + org-duration--unit-re))) + +;;;###autoload +(defun org-duration-p (s) + "Non-nil when string S is a time duration." + (and (stringp s) + (or (string-match-p org-duration--full-re s) + (string-match-p org-duration--mixed-re s) + (string-match-p org-duration--h:mm-re s)))) + +;;;###autoload +(defun org-duration-to-minutes (duration &optional canonical) + "Return number of minutes of DURATION string. + +When optional argument CANONICAL is non-nil, ignore +`org-duration-units' and use standard time units value. + +A bare number is translated into minutes. The empty string is +translated into 0.0. + +Return value as a float. Raise an error if duration format is +not recognized." + (cond + ((equal duration "") 0.0) + ((numberp duration) (float duration)) + ((string-match-p org-duration--h:mm-re duration) + (pcase-let ((`(,hours ,minutes ,seconds) + (mapcar #'string-to-number (split-string duration ":")))) + (+ (/ (or seconds 0) 60.0) minutes (* 60 hours)))) + ((string-match-p org-duration--full-re duration) + (let ((minutes 0) + (s 0)) + (while (string-match org-duration--unit-re duration s) + (setq s (match-end 0)) + (let ((value (string-to-number (match-string 1 duration))) + (unit (match-string 2 duration))) + (cl-incf minutes (* value (org-duration--modifier unit canonical))))) + (float minutes))) + ((string-match org-duration--mixed-re duration) + (let ((units-part (match-string 1 duration)) + (hms-part (match-string 2 duration))) + (+ (org-duration-to-minutes units-part) + (org-duration-to-minutes hms-part)))) + ((string-match-p "\\`[0-9]+\\(\\.[0-9]*\\)?\\'" duration) + (float (string-to-number duration))) + (t (error "Invalid duration format: %S" duration)))) + +;;;###autoload +(defun org-duration-from-minutes (minutes &optional fmt canonical) + "Return duration string for a given number of MINUTES. + +Format duration according to `org-duration-format' or FMT, when +non-nil. + +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)))))))) + +;;;###autoload +(defun org-duration-h:mm-only-p (times) + "Non-nil when every duration in TIMES has \"H:MM\" or \"H:MM:SS\" format. + +TIMES is a list of duration strings. + +Return nil if any duration is expressed with units, as defined in +`org-duration-units'. Otherwise, if any duration is expressed +with \"H:MM:SS\" format, return `h:mm:ss'. Otherwise, return +`h:mm'." + (let (hms-flag) + (catch :exit + (dolist (time times) + (cond ((string-match-p org-duration--full-re time) + (throw :exit nil)) + ((string-match-p org-duration--mixed-re time) + (throw :exit nil)) + (hms-flag nil) + ((string-match-p org-duration--h:mm:ss-re time) + (setq hms-flag 'h:mm:ss)))) + (or hms-flag 'h:mm)))) + + +;;; Initialization + +(org-duration-set-regexps) + +(provide 'org-duration) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-duration.el ends here diff --git a/elpa/org-9.5.2/org-duration.elc b/elpa/org-9.5.2/org-duration.elc new file mode 100644 index 0000000..f5b1ac3 Binary files /dev/null and b/elpa/org-9.5.2/org-duration.elc differ diff --git a/elpa/org-9.5.2/org-element.el b/elpa/org-9.5.2/org-element.el new file mode 100644 index 0000000..f8334cc --- /dev/null +++ b/elpa/org-9.5.2/org-element.el @@ -0,0 +1,6265 @@ +;;; org-element.el --- Parser for Org Syntax -*- lexical-binding: t; -*- + +;; Copyright (C) 2012-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: +;; +;; See for details about +;; Org syntax. +;; +;; Lisp-wise, a syntax object can be represented as a list. +;; It follows the pattern (TYPE PROPERTIES CONTENTS), where: +;; TYPE is a symbol describing the object. +;; PROPERTIES is the property list attached to it. See docstring of +;; appropriate parsing function to get an exhaustive list. +;; CONTENTS is a list of syntax objects or raw strings contained +;; in the current object, when applicable. +;; +;; For the whole document, TYPE is `org-data' and PROPERTIES is nil. +;; +;; The first part of this file defines constants for the Org syntax, +;; while the second one provide accessors and setters functions. +;; +;; The next part implements a parser and an interpreter for each +;; element and object type in Org syntax. +;; +;; The following part creates a fully recursive buffer parser. It +;; also provides a tool to map a function to elements or objects +;; matching some criteria in the parse tree. Functions of interest +;; are `org-element-parse-buffer', `org-element-map' and, to a lesser +;; extent, `org-element-parse-secondary-string'. +;; +;; The penultimate part is the cradle of an interpreter for the +;; obtained parse tree: `org-element-interpret-data'. +;; +;; The library ends by furnishing `org-element-at-point' function, and +;; a way to give information about document structure around point +;; with `org-element-context'. A cache mechanism is also provided for +;; these functions. + + +;;; Code: + +(require 'avl-tree) +(require 'cl-lib) +(require 'ol) +(require 'org) +(require 'org-compat) +(require 'org-entities) +(require 'org-footnote) +(require 'org-list) +(require 'org-macs) +(require 'org-table) + +(declare-function org-at-heading-p "org" (&optional _)) +(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) +(declare-function org-escape-code-in-string "org-src" (s)) +(declare-function org-macro-escape-arguments "org-macro" (&rest args)) +(declare-function org-macro-extract-arguments "org-macro" (s)) +(declare-function org-reduced-level "org" (l)) +(declare-function org-unescape-code-in-string "org-src" (s)) +(declare-function outline-next-heading "outline" ()) +(declare-function outline-previous-heading "outline" ()) + +(defvar org-archive-tag) +(defvar org-clock-line-re) +(defvar org-closed-string) +(defvar org-comment-string) +(defvar org-complex-heading-regexp) +(defvar org-dblock-start-re) +(defvar org-deadline-string) +(defvar org-done-keywords) +(defvar org-drawer-regexp) +(defvar org-edit-src-content-indentation) +(defvar org-emph-re) +(defvar org-emphasis-regexp-components) +(defvar org-keyword-time-not-clock-regexp) +(defvar org-match-substring-regexp) +(defvar org-odd-levels-only) +(defvar org-outline-regexp-bol) +(defvar org-planning-line-re) +(defvar org-property-drawer-re) +(defvar org-property-format) +(defvar org-property-re) +(defvar org-scheduled-string) +(defvar org-src-preserve-indentation) +(defvar org-tags-column) +(defvar org-time-stamp-formats) +(defvar org-todo-regexp) +(defvar org-ts-regexp-both) +(defvar org-verbatim-re) + + +;;; Definitions And Rules +;; +;; Define elements, greater elements and specify recursive objects, +;; along with the affiliated keywords recognized. Also set up +;; restrictions on recursive objects combinations. +;; +;; `org-element-update-syntax' builds proper syntax regexps according +;; to current setup. + +(defconst org-element-citation-key-re + (rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%~")))) + "Regexp matching a citation key. +Key is located in match group 1.") + +(defconst org-element-citation-prefix-re + (rx "[cite" + (opt "/" (group (one-or-more (any "/_-" alnum)))) ;style + ":" + (zero-or-more (any "\t\n "))) + "Regexp matching a citation prefix. +Style, if any, is located in match group 1.") + +(defvar org-element-paragraph-separate nil + "Regexp to separate paragraphs in an Org buffer. +In the case of lines starting with \"#\" and \":\", this regexp +is not sufficient to know if point is at a paragraph ending. See +`org-element-paragraph-parser' for more information.") + +(defvar org-element--object-regexp nil + "Regexp possibly matching the beginning of an object. +This regexp allows false positives. Dedicated parser (e.g., +`org-export-bold-parser') will take care of further filtering. +Radio links are not matched by this regexp, as they are treated +specially in `org-element--object-lex'.") + +(defun org-element--set-regexps () + "Build variable syntax regexps." + (setq org-element-paragraph-separate + (concat "^\\(?:" + ;; Headlines, inlinetasks. + "\\*+ " "\\|" + ;; Footnote definitions. + "\\[fn:[-_[:word:]]+\\]" "\\|" + ;; Diary sexps. + "%%(" "\\|" + "[ \t]*\\(?:" + ;; Empty lines. + "$" "\\|" + ;; Tables (any type). + "|" "\\|" + "\\+\\(?:-+\\+\\)+[ \t]*$" "\\|" + ;; Comments, keyword-like or block-like constructs. + ;; Blocks and keywords with dual values need to be + ;; double-checked. + "#\\(?: \\|$\\|\\+\\(?:" + "BEGIN_\\S-+" "\\|" + "\\S-+\\(?:\\[.*\\]\\)?:[ \t]*\\)\\)" + "\\|" + ;; Drawers (any type) and fixed-width areas. Drawers + ;; need to be double-checked. + ":\\(?: \\|$\\|[-_[:word:]]+:[ \t]*$\\)" "\\|" + ;; Horizontal rules. + "-\\{5,\\}[ \t]*$" "\\|" + ;; LaTeX environments. + "\\\\begin{\\([A-Za-z0-9*]+\\)}" "\\|" + ;; Clock lines. + "CLOCK:" "\\|" + ;; Lists. + (let ((term (pcase org-plain-list-ordered-item-terminator + (?\) ")") (?. "\\.") (_ "[.)]"))) + (alpha (and org-list-allow-alphabetical "\\|[A-Za-z]"))) + (concat "\\(?:[-+*]\\|\\(?:[0-9]+" alpha "\\)" term "\\)" + "\\(?:[ \t]\\|$\\)")) + "\\)\\)") + org-element--object-regexp + (mapconcat #'identity + (let ((link-types (regexp-opt (org-link-types)))) + (list + ;; Sub/superscript. + "\\(?:[_^][-{(*+.,[:alnum:]]\\)" + ;; Bold, code, italic, strike-through, underline + ;; and verbatim. + (concat "[*~=+_/]" + (format "[^%s]" + (nth 2 org-emphasis-regexp-components))) + ;; Plain links. + (concat "\\<" link-types ":") + ;; Objects starting with "[": citations, + ;; footnote reference, statistics cookie, + ;; timestamp (inactive) and regular link. + (format "\\[\\(?:%s\\)" + (mapconcat + #'identity + (list "cite[:/]" + "fn:" + "\\(?:[0-9]\\|\\(?:%\\|/[0-9]*\\)\\]\\)" + "\\[") + "\\|")) + ;; Objects starting with "@": export snippets. + "@@" + ;; Objects starting with "{": macro. + "{{{" + ;; Objects starting with "<" : timestamp + ;; (active, diary), target, radio target and + ;; angular links. + (concat "<\\(?:%%\\|<\\|[0-9]\\|" link-types "\\)") + ;; Objects starting with "$": latex fragment. + "\\$" + ;; Objects starting with "\": line break, + ;; entity, latex fragment. + "\\\\\\(?:[a-zA-Z[(]\\|\\\\[ \t]*$\\|_ +\\)" + ;; Objects starting with raw text: inline Babel + ;; source block, inline Babel call. + "\\(?:call\\|src\\)_")) + "\\|"))) + +(org-element--set-regexps) + +;;;###autoload +(defun org-element-update-syntax () + "Update parser internals." + (interactive) + (org-element--set-regexps) + (org-element-cache-reset 'all)) + +(defconst org-element-all-elements + '(babel-call center-block clock comment comment-block diary-sexp drawer + dynamic-block example-block export-block fixed-width + footnote-definition headline horizontal-rule inlinetask item + keyword latex-environment node-property paragraph plain-list + planning property-drawer quote-block section + special-block src-block table table-row verse-block) + "Complete list of element types.") + +(defconst org-element-greater-elements + '(center-block drawer dynamic-block footnote-definition headline inlinetask + item plain-list property-drawer quote-block section + special-block table) + "List of recursive element types aka Greater Elements.") + +(defconst org-element-all-objects + '(bold citation citation-reference code entity export-snippet + footnote-reference inline-babel-call inline-src-block italic line-break + latex-fragment link macro radio-target statistics-cookie strike-through + subscript superscript table-cell target timestamp underline verbatim) + "Complete list of object types.") + +(defconst org-element-recursive-objects + '(bold citation footnote-reference italic link subscript radio-target + strike-through superscript table-cell underline) + "List of recursive object types.") + +(defconst org-element-object-containers + (append org-element-recursive-objects '(paragraph table-row verse-block)) + "List of object or element types that can directly contain objects.") + +(defconst org-element-affiliated-keywords + '("CAPTION" "DATA" "HEADER" "HEADERS" "LABEL" "NAME" "PLOT" "RESNAME" "RESULT" + "RESULTS" "SOURCE" "SRCNAME" "TBLNAME") + "List of affiliated keywords as strings. +By default, all keywords setting attributes (e.g., \"ATTR_LATEX\") +are affiliated keywords and need not to be in this list.") + +(defconst org-element-keyword-translation-alist + '(("DATA" . "NAME") ("LABEL" . "NAME") ("RESNAME" . "NAME") + ("SOURCE" . "NAME") ("SRCNAME" . "NAME") ("TBLNAME" . "NAME") + ("RESULT" . "RESULTS") ("HEADERS" . "HEADER")) + "Alist of usual translations for keywords. +The key is the old name and the value the new one. The property +holding their value will be named after the translated name.") + +(defconst org-element-multiple-keywords '("CAPTION" "HEADER") + "List of affiliated keywords that can occur more than once in an element. + +Their value will be consed into a list of strings, which will be +returned as the value of the property. + +This list is checked after translations have been applied. See +`org-element-keyword-translation-alist'. + +By default, all keywords setting attributes (e.g., \"ATTR_LATEX\") +allow multiple occurrences and need not to be in this list.") + +(defconst org-element-parsed-keywords '("CAPTION") + "List of affiliated keywords whose value can be parsed. + +Their value will be stored as a secondary string: a list of +strings and objects. + +This list is checked after translations have been applied. See +`org-element-keyword-translation-alist'.") + +(defconst org-element--parsed-properties-alist + (mapcar (lambda (k) (cons k (intern (concat ":" (downcase k))))) + org-element-parsed-keywords) + "Alist of parsed keywords and associated properties. +This is generated from `org-element-parsed-keywords', which +see.") + +(defconst org-element-dual-keywords '("CAPTION" "RESULTS") + "List of affiliated keywords which can have a secondary value. + +In Org syntax, they can be written with optional square brackets +before the colons. For example, RESULTS keyword can be +associated to a hash value with the following: + + #+RESULTS[hash-string]: some-source + +This list is checked after translations have been applied. See +`org-element-keyword-translation-alist'.") + +(defconst org-element--affiliated-re + (format "[ \t]*#\\+\\(?:%s\\):[ \t]*" + (concat + ;; Dual affiliated keywords. + (format "\\(?1:%s\\)\\(?:\\[\\(.*\\)\\]\\)?" + (regexp-opt org-element-dual-keywords)) + "\\|" + ;; Regular affiliated keywords. + (format "\\(?1:%s\\)" + (regexp-opt + (cl-remove-if + (lambda (k) (member k org-element-dual-keywords)) + org-element-affiliated-keywords))) + "\\|" + ;; Export attributes. + "\\(?1:ATTR_[-_A-Za-z0-9]+\\)")) + "Regexp matching any affiliated keyword. + +Keyword name is put in match group 1. Moreover, if keyword +belongs to `org-element-dual-keywords', put the dual value in +match group 2. + +Don't modify it, set `org-element-affiliated-keywords' instead.") + +(defconst org-element-object-restrictions + (let* ((minimal-set '(bold code entity italic latex-fragment strike-through + subscript superscript underline verbatim)) + (standard-set + (remq 'citation-reference (remq 'table-cell org-element-all-objects))) + (standard-set-no-line-break (remq 'line-break standard-set))) + `((bold ,@standard-set) + (citation citation-reference) + (citation-reference ,@minimal-set) + (footnote-reference ,@standard-set) + (headline ,@standard-set-no-line-break) + (inlinetask ,@standard-set-no-line-break) + (italic ,@standard-set) + (item ,@standard-set-no-line-break) + (keyword ,@(remq 'footnote-reference standard-set)) + ;; Ignore all links in a link description. Also ignore + ;; radio-targets and line breaks. + (link export-snippet inline-babel-call inline-src-block macro + statistics-cookie ,@minimal-set) + (paragraph ,@standard-set) + ;; Remove any variable object from radio target as it would + ;; prevent it from being properly recognized. + (radio-target ,@minimal-set) + (strike-through ,@standard-set) + (subscript ,@standard-set) + (superscript ,@standard-set) + ;; Ignore inline babel call and inline source block as formulas + ;; are possible. Also ignore line breaks and statistics + ;; cookies. + (table-cell citation export-snippet footnote-reference link macro + radio-target target timestamp ,@minimal-set) + (table-row table-cell) + (underline ,@standard-set) + (verse-block ,@standard-set))) + "Alist of objects restrictions. + +key is an element or object type containing objects and value is +a list of types that can be contained within an element or object +of such type. + +This alist also applies to secondary string. For example, an +`headline' type element doesn't directly contain objects, but +still has an entry since one of its properties (`:title') does.") + +(defconst org-element-secondary-value-alist + '((citation :prefix :suffix) + (headline :title) + (inlinetask :title) + (item :tag) + (citation-reference :prefix :suffix)) + "Alist between element types and locations of secondary values.") + +(defconst org-element--pair-round-table + (let ((table (make-syntax-table))) + (modify-syntax-entry ?\( "()" table) + (modify-syntax-entry ?\) ")(" table) + (dolist (char '(?\{ ?\} ?\[ ?\] ?\< ?\>) table) + (modify-syntax-entry char " " table))) + "Table used internally to pair only round brackets. +Other brackets are treated as spaces.") + +(defconst org-element--pair-square-table + (let ((table (make-syntax-table))) + (modify-syntax-entry ?\[ "(]" table) + (modify-syntax-entry ?\] ")[" table) + (dolist (char '(?\{ ?\} ?\( ?\) ?\< ?\>) table) + (modify-syntax-entry char " " table))) + "Table used internally to pair only square brackets. +Other brackets are treated as spaces.") + +(defconst org-element--pair-curly-table + (let ((table (make-syntax-table))) + (modify-syntax-entry ?\{ "(}" table) + (modify-syntax-entry ?\} "){" table) + (dolist (char '(?\[ ?\] ?\( ?\) ?\< ?\>) table) + (modify-syntax-entry char " " table))) + "Table used internally to pair only curly brackets. +Other brackets are treated as spaces.") + +(defun org-element--parse-paired-brackets (char) + "Parse paired brackets at point. +CHAR is the opening bracket to consider, as a character. Return +contents between brackets, as a string, or nil. Also move point +past the brackets." + (when (eq char (char-after)) + (let ((syntax-table (pcase char + (?\{ org-element--pair-curly-table) + (?\[ org-element--pair-square-table) + (?\( org-element--pair-round-table) + (_ nil))) + (pos (point))) + (when syntax-table + (with-syntax-table syntax-table + (let ((end (ignore-errors (scan-lists pos 1 0)))) + (when end + (goto-char end) + (buffer-substring-no-properties (1+ pos) (1- end))))))))) + + +;;; Accessors and Setters +;; +;; Provide four accessors: `org-element-type', `org-element-property' +;; `org-element-contents' and `org-element-restriction'. +;; +;; Setter functions allow modification of elements by side effect. +;; There is `org-element-put-property', `org-element-set-contents'. +;; These low-level functions are useful to build a parse tree. +;; +;; `org-element-adopt-elements', `org-element-set-element', +;; `org-element-extract-element' and `org-element-insert-before' are +;; high-level functions useful to modify a parse tree. +;; +;; `org-element-secondary-p' is a predicate used to know if a given +;; object belongs to a secondary string. `org-element-class' tells if +;; some parsed data is an element or an object, handling pseudo +;; elements and objects. `org-element-copy' returns an element or +;; object, stripping its parent property in the process. + +(defsubst org-element-type (element) + "Return type of ELEMENT. + +The function returns the type of the element or object provided. +It can also return the following special value: + `plain-text' for a string + `org-data' for a complete document + nil in any other case." + (cond + ((not (consp element)) (and (stringp element) 'plain-text)) + ((symbolp (car element)) (car element)))) + +(defsubst org-element-property (property element) + "Extract the value from the PROPERTY of an ELEMENT." + (if (stringp element) (get-text-property 0 property element) + (plist-get (nth 1 element) property))) + +(defsubst org-element-contents (element) + "Extract contents from an ELEMENT." + (cond ((not (consp element)) nil) + ((symbolp (car element)) (nthcdr 2 element)) + (t element))) + +(defsubst org-element-restriction (element) + "Return restriction associated to ELEMENT. +ELEMENT can be an element, an object or a symbol representing an +element or object type." + (cdr (assq (if (symbolp element) element (org-element-type element)) + org-element-object-restrictions))) + +(defsubst org-element-put-property (element property value) + "In ELEMENT set PROPERTY to VALUE. +Return modified element." + (if (stringp element) (org-add-props element nil property value) + (setcar (cdr element) (plist-put (nth 1 element) property value)) + element)) + +(defsubst org-element-set-contents (element &rest contents) + "Set ELEMENT's contents to CONTENTS. +Return ELEMENT." + (cond ((null element) contents) + ((not (symbolp (car element))) contents) + ((cdr element) (setcdr (cdr element) contents) element) + (t (nconc element contents)))) + +(defun org-element-secondary-p (object) + "Non-nil when OBJECT directly belongs to a secondary string. +Return value is the property name, as a keyword, or nil." + (let* ((parent (org-element-property :parent object)) + (properties (cdr (assq (org-element-type parent) + org-element-secondary-value-alist)))) + (catch 'exit + (dolist (p properties) + (and (memq object (org-element-property p parent)) + (throw 'exit p)))))) + +(defsubst org-element-class (datum &optional parent) + "Return class for ELEMENT, as a symbol. +Class is either `element' or `object'. Optional argument PARENT +is the element or object containing DATUM. It defaults to the +value of DATUM `:parent' property." + (let ((type (org-element-type datum)) + (parent (or parent (org-element-property :parent datum)))) + (cond + ;; Trivial cases. + ((memq type org-element-all-objects) 'object) + ((memq type org-element-all-elements) 'element) + ;; Special cases. + ((eq type 'org-data) 'element) + ((eq type 'plain-text) 'object) + ((not type) 'object) + ;; Pseudo object or elements. Make a guess about its class. + ;; Basically a pseudo object is contained within another object, + ;; a secondary string or a container element. + ((not parent) 'element) + (t + (let ((parent-type (org-element-type parent))) + (cond ((not parent-type) 'object) + ((memq parent-type org-element-object-containers) 'object) + ((org-element-secondary-p datum) 'object) + (t 'element))))))) + +(defsubst org-element-adopt-elements (parent &rest children) + "Append elements to the contents of another element. + +PARENT is an element or object. CHILDREN can be elements, +objects, or a strings. + +The function takes care of setting `:parent' property for CHILD. +Return parent element." + (declare (indent 1)) + (if (not children) parent + ;; Link every child to PARENT. If PARENT is nil, it is a secondary + ;; string: parent is the list itself. + (dolist (child children) + (org-element-put-property child :parent (or parent children))) + ;; Add CHILDREN at the end of PARENT contents. + (when parent + (apply #'org-element-set-contents + parent + (nconc (org-element-contents parent) children))) + ;; Return modified PARENT element. + (or parent children))) + +(defun org-element-extract-element (element) + "Extract ELEMENT from parse tree. +Remove element from the parse tree by side-effect, and return it +with its `:parent' property stripped out." + (let ((parent (org-element-property :parent element)) + (secondary (org-element-secondary-p element))) + (if secondary + (org-element-put-property + parent secondary + (delq element (org-element-property secondary parent))) + (apply #'org-element-set-contents + parent + (delq element (org-element-contents parent)))) + ;; Return ELEMENT with its :parent removed. + (org-element-put-property element :parent nil))) + +(defun org-element-insert-before (element location) + "Insert ELEMENT before LOCATION in parse tree. +LOCATION is an element, object or string within the parse tree. +Parse tree is modified by side effect." + (let* ((parent (org-element-property :parent location)) + (property (org-element-secondary-p location)) + (siblings (if property (org-element-property property parent) + (org-element-contents parent))) + ;; Special case: LOCATION is the first element of an + ;; independent secondary string (e.g. :title property). Add + ;; ELEMENT in-place. + (specialp (and (not property) + (eq siblings parent) + (eq (car parent) location)))) + ;; Install ELEMENT at the appropriate LOCATION within SIBLINGS. + (cond (specialp) + ((or (null siblings) (eq (car siblings) location)) + (push element siblings)) + ((null location) (nconc siblings (list element))) + (t + (let ((index (cl-position location siblings))) + (unless index (error "No location found to insert element")) + (push element (cdr (nthcdr (1- index) siblings)))))) + ;; Store SIBLINGS at appropriate place in parse tree. + (cond + (specialp (setcdr parent (copy-sequence parent)) (setcar parent element)) + (property (org-element-put-property parent property siblings)) + (t (apply #'org-element-set-contents parent siblings))) + ;; Set appropriate :parent property. + (org-element-put-property element :parent parent))) + +(defun org-element-set-element (old new) + "Replace element or object OLD with element or object NEW. +The function takes care of setting `:parent' property for NEW." + ;; Ensure OLD and NEW have the same parent. + (org-element-put-property new :parent (org-element-property :parent old)) + (if (or (memq (org-element-type old) '(plain-text nil)) + (memq (org-element-type new) '(plain-text nil))) + ;; We cannot replace OLD with NEW since one of them is not an + ;; object or element. We take the long path. + (progn (org-element-insert-before new old) + (org-element-extract-element old)) + ;; Since OLD is going to be changed into NEW by side-effect, first + ;; make sure that every element or object within NEW has OLD as + ;; parent. + (dolist (blob (org-element-contents new)) + (org-element-put-property blob :parent old)) + ;; Transfer contents. + (apply #'org-element-set-contents old (org-element-contents new)) + ;; Overwrite OLD's properties with NEW's. + (setcar (cdr old) (nth 1 new)) + ;; Transfer type. + (setcar old (car new)))) + +(defun org-element-create (type &optional props &rest children) + "Create a new element of type TYPE. +Optional argument PROPS, when non-nil, is a plist defining the +properties of the element. CHILDREN can be elements, objects or +strings." + (apply #'org-element-adopt-elements (list type props) children)) + +(defun org-element-copy (datum) + "Return a copy of DATUM. +DATUM is an element, object, string or nil. `:parent' property +is cleared and contents are removed in the process." + (when datum + (let ((type (org-element-type datum))) + (pcase type + (`org-data (list 'org-data nil)) + (`plain-text (substring-no-properties datum)) + (`nil (copy-sequence datum)) + (_ + (list type (plist-put (copy-sequence (nth 1 datum)) :parent nil))))))) + + + +;;; Greater elements +;; +;; For each greater element type, we define a parser and an +;; interpreter. +;; +;; A parser returns the element or object as the list described above. +;; Most of them accepts no argument. Though, exceptions exist. Hence +;; every element containing a secondary string (see +;; `org-element-secondary-value-alist') will accept an optional +;; argument to toggle parsing of these secondary strings. Moreover, +;; `item' parser requires current list's structure as its first +;; element. +;; +;; An interpreter accepts two arguments: the list representation of +;; the element or object, and its contents. The latter may be nil, +;; depending on the element or object considered. It returns the +;; appropriate Org syntax, as a string. +;; +;; Parsing functions must follow the naming convention: +;; org-element-TYPE-parser, where TYPE is greater element's type, as +;; defined in `org-element-greater-elements'. +;; +;; Similarly, interpreting functions must follow the naming +;; convention: org-element-TYPE-interpreter. +;; +;; With the exception of `headline' and `item' types, greater elements +;; cannot contain other greater elements of their own type. +;; +;; Beside implementing a parser and an interpreter, adding a new +;; greater element requires tweaking `org-element--current-element'. +;; Moreover, the newly defined type must be added to both +;; `org-element-all-elements' and `org-element-greater-elements'. + + +;;;; Center Block + +(defun org-element-center-block-parser (limit affiliated) + "Parse a center block. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `center-block' and CDR is a plist +containing `:begin', `:end', `:contents-begin', `:contents-end', +`:post-blank' and `:post-affiliated' keywords. + +Assume point is at the beginning of the block." + (let ((case-fold-search t)) + (if (not (save-excursion + (re-search-forward "^[ \t]*#\\+END_CENTER[ \t]*$" limit t))) + ;; Incomplete block: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (let ((block-end-line (match-beginning 0))) + (let* ((begin (car affiliated)) + (post-affiliated (point)) + ;; Empty blocks have no contents. + (contents-begin (progn (forward-line) + (and (< (point) block-end-line) + (point)))) + (contents-end (and contents-begin block-end-line)) + (pos-before-blank (progn (goto-char block-end-line) + (forward-line) + (point))) + (end (save-excursion + (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'center-block + (nconc + (list :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated)))))))) + +(defun org-element-center-block-interpreter (_ contents) + "Interpret a center-block element as Org syntax. +CONTENTS is the contents of the element." + (format "#+begin_center\n%s#+end_center" contents)) + + +;;;; Drawer + +(defun org-element-drawer-parser (limit affiliated) + "Parse a drawer. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `drawer' and CDR is a plist containing +`:drawer-name', `:begin', `:end', `:contents-begin', +`:contents-end', `:post-blank' and `:post-affiliated' keywords. + +Assume point is at beginning of drawer." + (let ((case-fold-search t)) + (if (not (save-excursion + (goto-char (min limit (line-end-position))) + (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))) + ;; Incomplete drawer: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (save-excursion + (let* ((drawer-end-line (match-beginning 0)) + (name (progn (looking-at org-drawer-regexp) + (match-string-no-properties 1))) + (begin (car affiliated)) + (post-affiliated (point)) + ;; Empty drawers have no contents. + (contents-begin (progn (forward-line) + (and (< (point) drawer-end-line) + (point)))) + (contents-end (and contents-begin drawer-end-line)) + (pos-before-blank (progn (goto-char drawer-end-line) + (forward-line) + (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'drawer + (nconc + (list :begin begin + :end end + :drawer-name name + :contents-begin contents-begin + :contents-end contents-end + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated)))))))) + +(defun org-element-drawer-interpreter (drawer contents) + "Interpret DRAWER element as Org syntax. +CONTENTS is the contents of the element." + (format ":%s:\n%s:END:" + (org-element-property :drawer-name drawer) + contents)) + + +;;;; Dynamic Block + +(defun org-element-dynamic-block-parser (limit affiliated) + "Parse a dynamic block. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `dynamic-block' and CDR is a plist +containing `:block-name', `:begin', `:end', `:contents-begin', +`:contents-end', `:arguments', `:post-blank' and +`:post-affiliated' keywords. + +Assume point is at beginning of dynamic block." + (let ((case-fold-search t)) + (if (not (save-excursion + (re-search-forward "^[ \t]*#\\+END:?[ \t]*$" limit t))) + ;; Incomplete block: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (let ((block-end-line (match-beginning 0))) + (save-excursion + (let* ((name (progn (looking-at org-dblock-start-re) + (match-string-no-properties 1))) + (arguments (match-string-no-properties 3)) + (begin (car affiliated)) + (post-affiliated (point)) + ;; Empty blocks have no contents. + (contents-begin (progn (forward-line) + (and (< (point) block-end-line) + (point)))) + (contents-end (and contents-begin block-end-line)) + (pos-before-blank (progn (goto-char block-end-line) + (forward-line) + (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'dynamic-block + (nconc + (list :begin begin + :end end + :block-name name + :arguments arguments + :contents-begin contents-begin + :contents-end contents-end + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated))))))))) + +(defun org-element-dynamic-block-interpreter (dynamic-block contents) + "Interpret DYNAMIC-BLOCK element as Org syntax. +CONTENTS is the contents of the element." + (format "#+begin: %s%s\n%s#+end:" + (org-element-property :block-name dynamic-block) + (let ((args (org-element-property :arguments dynamic-block))) + (if args (concat " " args) "")) + contents)) + + +;;;; Footnote Definition + +(defconst org-element--footnote-separator + (concat org-outline-regexp-bol "\\|" + org-footnote-definition-re "\\|" + "^\\([ \t]*\n\\)\\{2,\\}") + "Regexp used as a footnote definition separator.") + +(defun org-element-footnote-definition-parser (limit affiliated) + "Parse a footnote definition. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `footnote-definition' and CDR is +a plist containing `:label', `:begin' `:end', `:contents-begin', +`:contents-end', `:pre-blank',`:post-blank' and +`:post-affiliated' keywords. + +Assume point is at the beginning of the footnote definition." + (save-excursion + (let* ((label (progn (looking-at org-footnote-definition-re) + (match-string-no-properties 1))) + (begin (car affiliated)) + (post-affiliated (point)) + (end + (save-excursion + (end-of-line) + (cond + ((not + (re-search-forward org-element--footnote-separator limit t)) + limit) + ((eq ?\[ (char-after (match-beginning 0))) + ;; At a new footnote definition, make sure we end + ;; before any affiliated keyword above. + (forward-line -1) + (while (and (> (point) post-affiliated) + (looking-at-p org-element--affiliated-re)) + (forward-line -1)) + (line-beginning-position 2)) + ((eq ?* (char-after (match-beginning 0))) (match-beginning 0)) + (t (skip-chars-forward " \r\t\n" limit) + (if (= limit (point)) limit (line-beginning-position)))))) + (pre-blank 0) + (contents-begin + (progn (search-forward "]") + (skip-chars-forward " \r\t\n" end) + (cond ((= (point) end) nil) + ((= (line-beginning-position) post-affiliated) (point)) + (t + (setq pre-blank + (count-lines (line-beginning-position) begin)) + (line-beginning-position))))) + (contents-end + (progn (goto-char end) + (skip-chars-backward " \r\t\n") + (line-beginning-position 2)))) + (list 'footnote-definition + (nconc + (list :label label + :begin begin + :end end + :contents-begin contents-begin + :contents-end (and contents-begin contents-end) + :pre-blank pre-blank + :post-blank (count-lines contents-end end) + :post-affiliated post-affiliated) + (cdr affiliated)))))) + +(defun org-element-footnote-definition-interpreter (footnote-definition contents) + "Interpret FOOTNOTE-DEFINITION element as Org syntax. +CONTENTS is the contents of the footnote-definition." + (let ((pre-blank + (min (or (org-element-property :pre-blank footnote-definition) + ;; 0 is specific to paragraphs at the beginning of + ;; the footnote definition, so we use 1 as + ;; a fall-back value, which is more universal. + 1) + ;; Footnote ends after more than two consecutive empty + ;; lines: limit ourselves to 2 newline characters. + 2))) + (concat (format "[fn:%s]" (org-element-property :label footnote-definition)) + (if (= pre-blank 0) (concat " " (org-trim contents)) + (concat (make-string pre-blank ?\n) contents))))) + + +;;;; Headline + +(defun org-element--get-node-properties () + "Return node properties associated to headline at point. +Upcase property names. It avoids confusion between properties +obtained through property drawer and default properties from the +parser (e.g. `:end' and :END:). Return value is a plist." + (save-excursion + (forward-line) + (when (looking-at-p org-planning-line-re) (forward-line)) + (when (looking-at org-property-drawer-re) + (forward-line) + (let ((end (match-end 0)) properties) + (while (< (line-end-position) end) + (looking-at org-property-re) + (push (match-string-no-properties 3) properties) + (push (intern (concat ":" (upcase (match-string 2)))) properties) + (forward-line)) + properties)))) + +(defun org-element--get-time-properties () + "Return time properties associated to headline at point. +Return value is a plist." + (save-excursion + (when (progn (forward-line) (looking-at org-planning-line-re)) + (let ((end (line-end-position)) plist) + (while (re-search-forward org-keyword-time-not-clock-regexp end t) + (goto-char (match-end 1)) + (skip-chars-forward " \t") + (let ((keyword (match-string 1)) + (time (org-element-timestamp-parser))) + (cond ((equal keyword org-scheduled-string) + (setq plist (plist-put plist :scheduled time))) + ((equal keyword org-deadline-string) + (setq plist (plist-put plist :deadline time))) + (t (setq plist (plist-put plist :closed time)))))) + plist)))) + +(defun org-element-headline-parser (limit &optional raw-secondary-p) + "Parse a headline. + +Return a list whose CAR is `headline' and CDR is a plist +containing `:raw-value', `:title', `:begin', `:end', +`:pre-blank', `:contents-begin' and `:contents-end', `:level', +`:priority', `:tags', `:todo-keyword', `:todo-type', `:scheduled', +`:deadline', `:closed', `:archivedp', `:commentedp' +`:footnote-section-p', `:post-blank' and `:post-affiliated' +keywords. + +The plist also contains any property set in the property drawer, +with its name in upper cases and colons added at the +beginning (e.g., `:CUSTOM_ID'). + +LIMIT is a buffer position bounding the search. + +When RAW-SECONDARY-P is non-nil, headline's title will not be +parsed as a secondary string, but as a plain string instead. + +Assume point is at beginning of the headline." + (save-excursion + (let* ((begin (point)) + (level (prog1 (org-reduced-level (skip-chars-forward "*")) + (skip-chars-forward " \t"))) + (todo (and org-todo-regexp + (let (case-fold-search) (looking-at (concat org-todo-regexp " "))) + (progn (goto-char (match-end 0)) + (skip-chars-forward " \t") + (match-string 1)))) + (todo-type + (and todo (if (member todo org-done-keywords) 'done 'todo))) + (priority (and (looking-at "\\[#.\\][ \t]*") + (progn (goto-char (match-end 0)) + (aref (match-string 0) 2)))) + (commentedp + (and (let (case-fold-search) (looking-at org-comment-string)) + (goto-char (match-end 0)))) + (title-start (prog1 (point) + (unless (or todo priority commentedp) + ;; Headline like "* :tag:" + (skip-chars-backward " \t")))) + (tags (when (re-search-forward + "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$" + (line-end-position) + 'move) + (goto-char (match-beginning 0)) + (org-split-string (match-string 1) ":"))) + (title-end (point)) + (raw-value (org-trim + (buffer-substring-no-properties title-start title-end))) + (archivedp (member org-archive-tag tags)) + (footnote-section-p (and org-footnote-section + (string= org-footnote-section raw-value))) + (standard-props (org-element--get-node-properties)) + (time-props (org-element--get-time-properties)) + (end (min (save-excursion (org-end-of-subtree t t)) limit)) + (contents-begin (save-excursion + (forward-line) + (skip-chars-forward " \r\t\n" end) + (and (/= (point) end) (line-beginning-position)))) + (contents-end (and contents-begin + (progn (goto-char end) + (skip-chars-backward " \r\t\n") + (line-beginning-position 2))))) + (let ((headline + (list 'headline + (nconc + (list :raw-value raw-value + :begin begin + :end end + :pre-blank + (if (not contents-begin) 0 + (1- (count-lines begin contents-begin))) + :contents-begin contents-begin + :contents-end contents-end + :level level + :priority priority + :tags tags + :todo-keyword todo + :todo-type todo-type + :post-blank + (if contents-end + (count-lines contents-end end) + (1- (count-lines begin end))) + :footnote-section-p footnote-section-p + :archivedp archivedp + :commentedp commentedp + :post-affiliated begin) + time-props + standard-props)))) + (org-element-put-property + headline :title + (if raw-secondary-p raw-value + (org-element--parse-objects + (progn (goto-char title-start) + (skip-chars-forward " \t") + (point)) + (progn (goto-char title-end) + (skip-chars-backward " \t") + (point)) + nil + (org-element-restriction 'headline) + headline))))))) + +(defun org-element-headline-interpreter (headline contents) + "Interpret HEADLINE element as Org syntax. +CONTENTS is the contents of the element." + (let* ((level (org-element-property :level headline)) + (todo (org-element-property :todo-keyword headline)) + (priority (org-element-property :priority headline)) + (title (org-element-interpret-data + (org-element-property :title headline))) + (tags (let ((tag-list (org-element-property :tags headline))) + (and tag-list + (format ":%s:" (mapconcat #'identity tag-list ":"))))) + (commentedp (org-element-property :commentedp headline)) + (pre-blank (or (org-element-property :pre-blank headline) 0)) + (heading + (concat (make-string (if org-odd-levels-only (1- (* level 2)) level) + ?*) + (and todo (concat " " todo)) + (and commentedp (concat " " org-comment-string)) + (and priority (format " [#%c]" priority)) + " " + (if (and org-footnote-section + (org-element-property :footnote-section-p headline)) + org-footnote-section + title)))) + (concat + heading + ;; Align tags. + (when tags + (cond + ((zerop org-tags-column) (format " %s" tags)) + ((< org-tags-column 0) + (concat + (make-string + (max (- (+ org-tags-column (length heading) (length tags))) 1) + ?\s) + tags)) + (t + (concat + (make-string (max (- org-tags-column (length heading)) 1) ?\s) + tags)))) + (make-string (1+ pre-blank) ?\n) + contents))) + + +;;;; Inlinetask + +(defun org-element-inlinetask-parser (limit &optional raw-secondary-p) + "Parse an inline task. + +Return a list whose CAR is `inlinetask' and CDR is a plist +containing `:title', `:begin', `:end', `:pre-blank', +`:contents-begin' and `:contents-end', `:level', `:priority', +`:raw-value', `:tags', `:todo-keyword', `:todo-type', +`:scheduled', `:deadline', `:closed', `:post-blank' and +`:post-affiliated' keywords. + +The plist also contains any property set in the property drawer, +with its name in upper cases and colons added at the +beginning (e.g., `:CUSTOM_ID'). + +When optional argument RAW-SECONDARY-P is non-nil, inline-task's +title will not be parsed as a secondary string, but as a plain +string instead. + +Assume point is at beginning of the inline task." + (save-excursion + (let* ((begin (point)) + (level (prog1 (org-reduced-level (skip-chars-forward "*")) + (skip-chars-forward " \t"))) + (todo (and org-todo-regexp + (let (case-fold-search) (looking-at org-todo-regexp)) + (progn (goto-char (match-end 0)) + (skip-chars-forward " \t") + (match-string 0)))) + (todo-type (and todo + (if (member todo org-done-keywords) 'done 'todo))) + (priority (and (looking-at "\\[#.\\][ \t]*") + (progn (goto-char (match-end 0)) + (aref (match-string 0) 2)))) + (title-start (point)) + (tags (when (re-search-forward + "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$" + (line-end-position) + 'move) + (goto-char (match-beginning 0)) + (org-split-string (match-string 1) ":"))) + (title-end (point)) + (raw-value (org-trim + (buffer-substring-no-properties title-start title-end))) + (task-end (save-excursion + (end-of-line) + (and (re-search-forward org-outline-regexp-bol limit t) + (looking-at-p "[ \t]*END[ \t]*$") + (line-beginning-position)))) + (standard-props (and task-end (org-element--get-node-properties))) + (time-props (and task-end (org-element--get-time-properties))) + (contents-begin (and task-end + (< (point) task-end) + (progn + (forward-line) + (skip-chars-forward " \t\n") + (line-beginning-position)))) + (contents-end (and contents-begin task-end)) + (end (progn (when task-end (goto-char task-end)) + (forward-line) + (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position)))) + (inlinetask + (list 'inlinetask + (nconc + (list :raw-value raw-value + :begin begin + :end end + :pre-blank + (if (not contents-begin) 0 + (1- (count-lines begin contents-begin))) + :contents-begin contents-begin + :contents-end contents-end + :level level + :priority priority + :tags tags + :todo-keyword todo + :todo-type todo-type + :post-blank (1- (count-lines (or task-end begin) end)) + :post-affiliated begin) + time-props + standard-props)))) + (org-element-put-property + inlinetask :title + (if raw-secondary-p raw-value + (org-element--parse-objects + (progn (goto-char title-start) + (skip-chars-forward " \t") + (point)) + (progn (goto-char title-end) + (skip-chars-backward " \t") + (point)) + nil + (org-element-restriction 'inlinetask) + inlinetask)))))) + +(defun org-element-inlinetask-interpreter (inlinetask contents) + "Interpret INLINETASK element as Org syntax. +CONTENTS is the contents of inlinetask." + (let* ((level (org-element-property :level inlinetask)) + (todo (org-element-property :todo-keyword inlinetask)) + (priority (org-element-property :priority inlinetask)) + (title (org-element-interpret-data + (org-element-property :title inlinetask))) + (tags (let ((tag-list (org-element-property :tags inlinetask))) + (and tag-list + (format ":%s:" (mapconcat 'identity tag-list ":"))))) + (task (concat (make-string level ?*) + (and todo (concat " " todo)) + (and priority (format " [#%c]" priority)) + (and title (concat " " title))))) + (concat task + ;; Align tags. + (when tags + (cond + ((zerop org-tags-column) (format " %s" tags)) + ((< org-tags-column 0) + (concat + (make-string + (max (- (+ org-tags-column (length task) (length tags))) 1) + ?\s) + tags)) + (t + (concat + (make-string (max (- org-tags-column (length task)) 1) ?\s) + tags)))) + ;; Prefer degenerate inlinetasks when there are no + ;; contents. + (when contents + (concat "\n" + contents + (make-string level ?*) " end"))))) + + +;;;; Item + +(defun org-element-item-parser (_ struct &optional raw-secondary-p) + "Parse an item. + +STRUCT is the structure of the plain list. + +Return a list whose CAR is `item' and CDR is a plist containing +`:bullet', `:begin', `:end', `:contents-begin', `:contents-end', +`:checkbox', `:counter', `:tag', `:structure', `:pre-blank', +`:post-blank' and `:post-affiliated' keywords. + +When optional argument RAW-SECONDARY-P is non-nil, item's tag, if +any, will not be parsed as a secondary string, but as a plain +string instead. + +Assume point is at the beginning of the item." + (save-excursion + (beginning-of-line) + (looking-at org-list-full-item-re) + (let* ((begin (point)) + (bullet (match-string-no-properties 1)) + (checkbox (let ((box (match-string 3))) + (cond ((equal "[ ]" box) 'off) + ((equal "[X]" box) 'on) + ((equal "[-]" box) 'trans)))) + (counter (let ((c (match-string 2))) + (save-match-data + (cond + ((not c) nil) + ((string-match "[A-Za-z]" c) + (- (string-to-char (upcase (match-string 0 c))) + 64)) + ((string-match "[0-9]+" c) + (string-to-number (match-string 0 c))))))) + (end (progn (goto-char (nth 6 (assq (point) struct))) + (if (bolp) (point) (line-beginning-position 2)))) + (pre-blank 0) + (contents-begin + (progn + (goto-char + ;; Ignore tags in un-ordered lists: they are just + ;; a part of item's body. + (if (and (match-beginning 4) + (save-match-data (string-match "[.)]" bullet))) + (match-beginning 4) + (match-end 0))) + (skip-chars-forward " \r\t\n" end) + (cond ((= (point) end) nil) + ;; If first line isn't empty, contents really + ;; start at the text after item's meta-data. + ((= (line-beginning-position) begin) (point)) + (t + (setq pre-blank + (count-lines (line-beginning-position) begin)) + (line-beginning-position))))) + (contents-end (and contents-begin + (progn (goto-char end) + (skip-chars-backward " \r\t\n") + (line-beginning-position 2)))) + (item + (list 'item + (list :bullet bullet + :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :checkbox checkbox + :counter counter + :structure struct + :pre-blank pre-blank + :post-blank (count-lines (or contents-end begin) end) + :post-affiliated begin)))) + (org-element-put-property + item :tag + (let ((raw (org-list-get-tag begin struct))) + (when raw + (if raw-secondary-p raw + (org-element--parse-objects + (match-beginning 4) (match-end 4) nil + (org-element-restriction 'item) + item)))))))) + +(defun org-element-item-interpreter (item contents) + "Interpret ITEM element as Org syntax. +CONTENTS is the contents of the element." + (let ((tag (pcase (org-element-property :tag item) + (`nil nil) + (tag (format "%s :: " (org-element-interpret-data tag))))) + (bullet + (org-list-bullet-string + (cond + ((not (string-match-p "[0-9a-zA-Z]" + (org-element-property :bullet item))) "- ") + ((eq org-plain-list-ordered-item-terminator ?\)) "1)") + (t "1."))))) + (concat + bullet + (pcase (org-element-property :counter item) + (`nil nil) + (counter (format "[@%d] " counter))) + (pcase (org-element-property :checkbox item) + (`on "[X] ") + (`off "[ ] ") + (`trans "[-] ") + (_ nil)) + tag + (when contents + (let* ((ind (make-string (if tag 5 (length bullet)) ?\s)) + (pre-blank + (min (or (org-element-property :pre-blank item) + ;; 0 is specific to paragraphs at the + ;; beginning of the item, so we use 1 as + ;; a fall-back value, which is more universal. + 1) + ;; Lists ends after more than two consecutive + ;; empty lines: limit ourselves to 2 newline + ;; characters. + 2)) + (contents (replace-regexp-in-string + "\\(^\\)[ \t]*\\S-" ind contents nil nil 1))) + (if (= pre-blank 0) (org-trim contents) + (concat (make-string pre-blank ?\n) contents))))))) + + +;;;; Plain List + +(defun org-element--list-struct (limit) + ;; Return structure of list at point. Internal function. See + ;; `org-list-struct' for details. + (let ((case-fold-search t) + (top-ind limit) + (item-re (org-item-re)) + (inlinetask-re (and (featurep 'org-inlinetask) "^\\*+ ")) + items struct) + (save-excursion + (catch :exit + (while t + (cond + ;; At limit: end all items. + ((>= (point) limit) + (let ((end (progn (skip-chars-backward " \r\t\n") + (line-beginning-position 2)))) + (dolist (item items) (setcar (nthcdr 6 item) end))) + (throw :exit (sort (nconc items struct) #'car-less-than-car))) + ;; At list end: end all items. + ((looking-at org-list-end-re) + (dolist (item items) (setcar (nthcdr 6 item) (point))) + (throw :exit (sort (nconc items struct) #'car-less-than-car))) + ;; At a new item: end previous sibling. + ((looking-at item-re) + (let ((ind (save-excursion (skip-chars-forward " \t") + (current-column)))) + (setq top-ind (min top-ind ind)) + (while (and items (<= ind (nth 1 (car items)))) + (let ((item (pop items))) + (setcar (nthcdr 6 item) (point)) + (push item struct))) + (push (progn (looking-at org-list-full-item-re) + (let ((bullet (match-string-no-properties 1))) + (list (point) + ind + bullet + (match-string-no-properties 2) ; counter + (match-string-no-properties 3) ; checkbox + ;; Description tag. + (and (save-match-data + (string-match "[-+*]" bullet)) + (match-string-no-properties 4)) + ;; Ending position, unknown so far. + nil))) + items)) + (forward-line)) + ;; Skip empty lines. + ((looking-at "^[ \t]*$") (forward-line)) + ;; Skip inline tasks and blank lines along the way. + ((and inlinetask-re (looking-at inlinetask-re)) + (forward-line) + (let ((origin (point))) + (when (re-search-forward inlinetask-re limit t) + (if (looking-at-p "END[ \t]*$") (forward-line) + (goto-char origin))))) + ;; At some text line. Check if it ends any previous item. + (t + (let ((ind (save-excursion + (skip-chars-forward " \t") + (current-column))) + (end (save-excursion + (skip-chars-backward " \r\t\n") + (line-beginning-position 2)))) + (while (<= ind (nth 1 (car items))) + (let ((item (pop items))) + (setcar (nthcdr 6 item) end) + (push item struct) + (unless items + (throw :exit (sort struct #'car-less-than-car)))))) + ;; Skip blocks (any type) and drawers contents. + (cond + ((and (looking-at "[ \t]*#\\+BEGIN\\(:\\|_\\S-+\\)") + (re-search-forward + (format "^[ \t]*#\\+END%s[ \t]*$" (match-string 1)) + limit t))) + ((and (looking-at org-drawer-regexp) + (re-search-forward "^[ \t]*:END:[ \t]*$" limit t)))) + (forward-line)))))))) + +(defun org-element-plain-list-parser (limit affiliated structure) + "Parse a plain list. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. STRUCTURE is the structure of the plain list being +parsed. + +Return a list whose CAR is `plain-list' and CDR is a plist +containing `:type', `:begin', `:end', `:contents-begin' and +`:contents-end', `:structure', `:post-blank' and +`:post-affiliated' keywords. + +Assume point is at the beginning of the list." + (save-excursion + (let* ((struct (or structure (org-element--list-struct limit))) + (type (cond ((looking-at-p "[ \t]*[A-Za-z0-9]") 'ordered) + ((nth 5 (assq (point) struct)) 'descriptive) + (t 'unordered))) + (contents-begin (point)) + (begin (car affiliated)) + (contents-end (let* ((item (assq contents-begin struct)) + (ind (nth 1 item)) + (pos (nth 6 item))) + (while (and (setq item (assq pos struct)) + (= (nth 1 item) ind)) + (setq pos (nth 6 item))) + pos)) + (end (progn (goto-char contents-end) + (skip-chars-forward " \r\t\n" limit) + (if (= (point) limit) limit (line-beginning-position))))) + ;; Return value. + (list 'plain-list + (nconc + (list :type type + :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :structure struct + :post-blank (count-lines contents-end end) + :post-affiliated contents-begin) + (cdr affiliated)))))) + +(defun org-element-plain-list-interpreter (_ contents) + "Interpret plain-list element as Org syntax. +CONTENTS is the contents of the element." + (with-temp-buffer + (insert contents) + (goto-char (point-min)) + (org-list-repair) + (buffer-string))) + + +;;;; Property Drawer + +(defun org-element-property-drawer-parser (limit) + "Parse a property drawer. + +LIMIT bounds the search. + +Return a list whose car is `property-drawer' and cdr is a plist +containing `:begin', `:end', `:contents-begin', `:contents-end', +`:post-blank' and `:post-affiliated' keywords. + +Assume point is at the beginning of the property drawer." + (save-excursion + (let ((case-fold-search t) + (begin (point)) + (contents-begin (line-beginning-position 2))) + (re-search-forward "^[ \t]*:END:[ \t]*$" limit t) + (let ((contents-end (and (> (match-beginning 0) contents-begin) + (match-beginning 0))) + (before-blank (progn (forward-line) (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'property-drawer + (list :begin begin + :end end + :contents-begin (and contents-end contents-begin) + :contents-end contents-end + :post-blank (count-lines before-blank end) + :post-affiliated begin)))))) + +(defun org-element-property-drawer-interpreter (_ contents) + "Interpret property-drawer element as Org syntax. +CONTENTS is the properties within the drawer." + (format ":PROPERTIES:\n%s:END:" contents)) + + +;;;; Quote Block + +(defun org-element-quote-block-parser (limit affiliated) + "Parse a quote block. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `quote-block' and CDR is a plist +containing `:begin', `:end', `:contents-begin', `:contents-end', +`:post-blank' and `:post-affiliated' keywords. + +Assume point is at the beginning of the block." + (let ((case-fold-search t)) + (if (not (save-excursion + (re-search-forward "^[ \t]*#\\+END_QUOTE[ \t]*$" limit t))) + ;; Incomplete block: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (let ((block-end-line (match-beginning 0))) + (save-excursion + (let* ((begin (car affiliated)) + (post-affiliated (point)) + ;; Empty blocks have no contents. + (contents-begin (progn (forward-line) + (and (< (point) block-end-line) + (point)))) + (contents-end (and contents-begin block-end-line)) + (pos-before-blank (progn (goto-char block-end-line) + (forward-line) + (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'quote-block + (nconc + (list :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated))))))))) + +(defun org-element-quote-block-interpreter (_ contents) + "Interpret quote-block element as Org syntax. +CONTENTS is the contents of the element." + (format "#+begin_quote\n%s#+end_quote" contents)) + + +;;;; Section + +(defun org-element-section-parser (_) + "Parse a section. + +Return a list whose CAR is `section' and CDR is a plist +containing `:begin', `:end', `:contents-begin', `contents-end', +`:post-blank' and `:post-affiliated' keywords." + (save-excursion + ;; Beginning of section is the beginning of the first non-blank + ;; line after previous headline. + (let ((begin (point)) + (end (progn (org-with-limited-levels (outline-next-heading)) + (point))) + (pos-before-blank (progn (skip-chars-backward " \r\t\n") + (line-beginning-position 2)))) + (list 'section + (list :begin begin + :end end + :contents-begin begin + :contents-end pos-before-blank + :post-blank (count-lines pos-before-blank end) + :post-affiliated begin))))) + +(defun org-element-section-interpreter (_ contents) + "Interpret section element as Org syntax. +CONTENTS is the contents of the element." + contents) + + +;;;; Special Block + +(defun org-element-special-block-parser (limit affiliated) + "Parse a special block. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `special-block' and CDR is a plist +containing `:type', `:begin', `:end', `:contents-begin', +`:contents-end', `:post-blank' and `:post-affiliated' keywords. + +Assume point is at the beginning of the block." + (let* ((case-fold-search t) + (type (progn (looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)") + (match-string-no-properties 1)))) + (if (not (save-excursion + (re-search-forward + (format "^[ \t]*#\\+END_%s[ \t]*$" (regexp-quote type)) + limit t))) + ;; Incomplete block: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (let ((block-end-line (match-beginning 0))) + (save-excursion + (let* ((begin (car affiliated)) + (post-affiliated (point)) + ;; Empty blocks have no contents. + (contents-begin (progn (forward-line) + (and (< (point) block-end-line) + (point)))) + (contents-end (and contents-begin block-end-line)) + (pos-before-blank (progn (goto-char block-end-line) + (forward-line) + (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'special-block + (nconc + (list :type type + :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated))))))))) + +(defun org-element-special-block-interpreter (special-block contents) + "Interpret SPECIAL-BLOCK element as Org syntax. +CONTENTS is the contents of the element." + (let ((block-type (org-element-property :type special-block))) + (format "#+begin_%s\n%s#+end_%s" block-type contents block-type))) + + + +;;; Elements +;; +;; For each element, a parser and an interpreter are also defined. +;; Both follow the same naming convention used for greater elements. +;; +;; Also, as for greater elements, adding a new element type is done +;; through the following steps: implement a parser and an interpreter, +;; tweak `org-element--current-element' so that it recognizes the new +;; type and add that new type to `org-element-all-elements'. + + +;;;; Babel Call + +(defun org-element-babel-call-parser (limit affiliated) + "Parse a babel call. + +LIMIT bounds the search. AFFILIATED is a list of which car is +the buffer position at the beginning of the first affiliated +keyword and cdr is a plist of affiliated keywords along with +their value. + +Return a list whose car is `babel-call' and cdr is a plist +containing `:call', `:inside-header', `:arguments', +`:end-header', `:begin', `:end', `:value', `:post-blank' and +`:post-affiliated' as keywords." + (save-excursion + (let* ((begin (car affiliated)) + (post-affiliated (point)) + (before-blank (line-beginning-position 2)) + (value (progn (search-forward ":" before-blank t) + (skip-chars-forward " \t") + (org-trim + (buffer-substring-no-properties + (point) (line-end-position))))) + (call + (or (org-string-nw-p + (buffer-substring-no-properties + (point) (progn (skip-chars-forward "^[]()" before-blank) + (point)))))) + (inside-header (org-element--parse-paired-brackets ?\[)) + (arguments (org-string-nw-p + (org-element--parse-paired-brackets ?\())) + (end-header + (org-string-nw-p + (org-trim + (buffer-substring-no-properties (point) (line-end-position))))) + (end (progn (forward-line) + (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'babel-call + (nconc + (list :call call + :inside-header inside-header + :arguments arguments + :end-header end-header + :begin begin + :end end + :value value + :post-blank (count-lines before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated)))))) + +(defun org-element-babel-call-interpreter (babel-call _) + "Interpret BABEL-CALL element as Org syntax." + (concat "#+call: " + (org-element-property :call babel-call) + (let ((h (org-element-property :inside-header babel-call))) + (and h (format "[%s]" h))) + (concat "(" (org-element-property :arguments babel-call) ")") + (let ((h (org-element-property :end-header babel-call))) + (and h (concat " " h))))) + + +;;;; Clock + +(defun org-element-clock-parser (limit) + "Parse a clock. + +LIMIT bounds the search. + +Return a list whose CAR is `clock' and CDR is a plist containing +`:status', `:value', `:time', `:begin', `:end', `:post-blank' and +`:post-affiliated' as keywords." + (save-excursion + (let* ((case-fold-search nil) + (begin (point)) + (value (progn (search-forward "CLOCK:" (line-end-position) t) + (skip-chars-forward " \t") + (org-element-timestamp-parser))) + (duration (and (search-forward " => " (line-end-position) t) + (progn (skip-chars-forward " \t") + (looking-at "\\(\\S-+\\)[ \t]*$")) + (match-string-no-properties 1))) + (status (if duration 'closed 'running)) + (post-blank (let ((before-blank (progn (forward-line) (point)))) + (skip-chars-forward " \r\t\n" limit) + (skip-chars-backward " \t") + (unless (bolp) (end-of-line)) + (count-lines before-blank (point)))) + (end (point))) + (list 'clock + (list :status status + :value value + :duration duration + :begin begin + :end end + :post-blank post-blank + :post-affiliated begin))))) + +(defun org-element-clock-interpreter (clock _) + "Interpret CLOCK element as Org syntax." + (concat "CLOCK: " + (org-element-timestamp-interpreter + (org-element-property :value clock) nil) + (let ((duration (org-element-property :duration clock))) + (and duration + (concat " => " + (apply 'format + "%2s:%02s" + (org-split-string duration ":"))))))) + + +;;;; Comment + +(defun org-element-comment-parser (limit) + "Parse a comment. + +LIMIT bounds the search. + +Return a list whose CAR is `comment' and CDR is a plist +containing `:begin', `:end', `:value', `:post-blank', +`:post-affiliated' keywords. + +Assume point is at comment beginning." + (save-excursion + (let* ((begin (point)) + (value (prog2 (looking-at "[ \t]*# ?") + (buffer-substring-no-properties + (match-end 0) (line-end-position)) + (forward-line))) + (com-end + ;; Get comments ending. + (progn + (while (and (< (point) limit) (looking-at "[ \t]*#\\( \\|$\\)")) + ;; Accumulate lines without leading hash and first + ;; whitespace. + (setq value + (concat value + "\n" + (buffer-substring-no-properties + (match-end 0) (line-end-position)))) + (forward-line)) + (point))) + (end (progn (goto-char com-end) + (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'comment + (list :begin begin + :end end + :value value + :post-blank (count-lines com-end end) + :post-affiliated begin))))) + +(defun org-element-comment-interpreter (comment _) + "Interpret COMMENT element as Org syntax. +CONTENTS is nil." + (replace-regexp-in-string "^" "# " (org-element-property :value comment))) + + +;;;; Comment Block + +(defun org-element-comment-block-parser (limit affiliated) + "Parse an export block. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `comment-block' and CDR is a plist +containing `:begin', `:end', `:value', `:post-blank' and +`:post-affiliated' keywords. + +Assume point is at comment block beginning." + (let ((case-fold-search t)) + (if (not (save-excursion + (re-search-forward "^[ \t]*#\\+END_COMMENT[ \t]*$" limit t))) + ;; Incomplete block: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (let ((contents-end (match-beginning 0))) + (save-excursion + (let* ((begin (car affiliated)) + (post-affiliated (point)) + (contents-begin (progn (forward-line) (point))) + (pos-before-blank (progn (goto-char contents-end) + (forward-line) + (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position)))) + (value (buffer-substring-no-properties + contents-begin contents-end))) + (list 'comment-block + (nconc + (list :begin begin + :end end + :value value + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated))))))))) + +(defun org-element-comment-block-interpreter (comment-block _) + "Interpret COMMENT-BLOCK element as Org syntax." + (format "#+begin_comment\n%s#+end_comment" + (org-element-normalize-string + (org-remove-indentation + (org-element-property :value comment-block))))) + + +;;;; Diary Sexp + +(defun org-element-diary-sexp-parser (limit affiliated) + "Parse a diary sexp. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `diary-sexp' and CDR is a plist +containing `:begin', `:end', `:value', `:post-blank' and +`:post-affiliated' keywords." + (save-excursion + (let ((begin (car affiliated)) + (post-affiliated (point)) + (value (progn (looking-at "\\(%%(.*\\)[ \t]*$") + (match-string-no-properties 1))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'diary-sexp + (nconc + (list :value value + :begin begin + :end end + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated)))))) + +(defun org-element-diary-sexp-interpreter (diary-sexp _) + "Interpret DIARY-SEXP as Org syntax." + (org-element-property :value diary-sexp)) + + +;;;; Example Block + +(defun org-element-example-block-parser (limit affiliated) + "Parse an example block. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `example-block' and CDR is a plist +containing `:begin', `:end', `:number-lines', `:preserve-indent', +`:retain-labels', `:use-labels', `:label-fmt', `:switches', +`:value', `:post-blank' and `:post-affiliated' keywords." + (let ((case-fold-search t)) + (if (not (save-excursion + (re-search-forward "^[ \t]*#\\+END_EXAMPLE[ \t]*$" limit t))) + ;; Incomplete block: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (let ((contents-end (match-beginning 0))) + (save-excursion + (let* ((switches + (progn + (looking-at "^[ \t]*#\\+BEGIN_EXAMPLE\\(?: +\\(.*\\)\\)?") + (match-string-no-properties 1))) + ;; Switches analysis. + (number-lines + (and switches + (string-match "\\([-+]\\)n\\(?: *\\([0-9]+\\)\\)?\\>" + switches) + (cons + (if (equal (match-string 1 switches) "-") + 'new + 'continued) + (if (not (match-end 2)) 0 + ;; Subtract 1 to give number of lines before + ;; first line. + (1- (string-to-number (match-string 2 switches))))))) + (preserve-indent + (and switches (string-match "-i\\>" switches))) + ;; Should labels be retained in (or stripped from) example + ;; blocks? + (retain-labels + (or (not switches) + (not (string-match "-r\\>" switches)) + (and number-lines (string-match "-k\\>" switches)))) + ;; What should code-references use - labels or + ;; line-numbers? + (use-labels + (or (not switches) + (and retain-labels + (not (string-match "-k\\>" switches))))) + (label-fmt + (and switches + (string-match "-l +\"\\([^\"\n]+\\)\"" switches) + (match-string 1 switches))) + ;; Standard block parsing. + (begin (car affiliated)) + (post-affiliated (point)) + (contents-begin (line-beginning-position 2)) + (value (org-unescape-code-in-string + (buffer-substring-no-properties + contents-begin contents-end))) + (pos-before-blank (progn (goto-char contents-end) + (forward-line) + (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'example-block + (nconc + (list :begin begin + :end end + :value value + :switches switches + :number-lines number-lines + :preserve-indent preserve-indent + :retain-labels retain-labels + :use-labels use-labels + :label-fmt label-fmt + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated))))))))) + +(defun org-element-example-block-interpreter (example-block _) + "Interpret EXAMPLE-BLOCK element as Org syntax." + (let ((switches (org-element-property :switches example-block)) + (value + (let ((val (org-element-property :value example-block))) + (cond + ((or org-src-preserve-indentation + (org-element-property :preserve-indent example-block)) + val) + ((= 0 org-edit-src-content-indentation) + (org-remove-indentation val)) + (t + (let ((ind (make-string org-edit-src-content-indentation ?\s))) + (replace-regexp-in-string "^[ \t]*\\S-" + (concat ind "\\&") + (org-remove-indentation val)))))))) + (concat "#+begin_example" (and switches (concat " " switches)) "\n" + (org-element-normalize-string (org-escape-code-in-string value)) + "#+end_example"))) + + +;;;; Export Block + +(defun org-element-export-block-parser (limit affiliated) + "Parse an export block. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `export-block' and CDR is a plist +containing `:begin', `:end', `:type', `:value', `:post-blank' and +`:post-affiliated' keywords. + +Assume point is at export-block beginning." + (let* ((case-fold-search t)) + (if (not (save-excursion + (re-search-forward "^[ \t]*#\\+END_EXPORT[ \t]*$" limit t))) + ;; Incomplete block: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (save-excursion + (let* ((contents-end (match-beginning 0)) + (backend + (progn + (looking-at + "[ \t]*#\\+BEGIN_EXPORT\\(?:[ \t]+\\(\\S-+\\)\\)?[ \t]*$") + (match-string-no-properties 1))) + (begin (car affiliated)) + (post-affiliated (point)) + (contents-begin (progn (forward-line) (point))) + (pos-before-blank (progn (goto-char contents-end) + (forward-line) + (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position)))) + (value (org-unescape-code-in-string + (buffer-substring-no-properties contents-begin + contents-end)))) + (list 'export-block + (nconc + (list :type (and backend (upcase backend)) + :begin begin + :end end + :value value + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated)))))))) + +(defun org-element-export-block-interpreter (export-block _) + "Interpret EXPORT-BLOCK element as Org syntax." + (format "#+begin_export %s\n%s#+end_export" + (org-element-property :type export-block) + (org-element-property :value export-block))) + + +;;;; Fixed-width + +(defun org-element-fixed-width-parser (limit affiliated) + "Parse a fixed-width section. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `fixed-width' and CDR is a plist +containing `:begin', `:end', `:value', `:post-blank' and +`:post-affiliated' keywords. + +Assume point is at the beginning of the fixed-width area." + (save-excursion + (let* ((begin (car affiliated)) + (post-affiliated (point)) + (end-area + (progn + (while (and (< (point) limit) + (looking-at "[ \t]*:\\( \\|$\\)")) + (forward-line)) + (if (bolp) (line-end-position 0) (point)))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'fixed-width + (nconc + (list :begin begin + :end end + :value (replace-regexp-in-string + "^[ \t]*: ?" "" + (buffer-substring-no-properties post-affiliated + end-area)) + :post-blank (count-lines end-area end) + :post-affiliated post-affiliated) + (cdr affiliated)))))) + +(defun org-element-fixed-width-interpreter (fixed-width _) + "Interpret FIXED-WIDTH element as Org syntax." + (let ((value (org-element-property :value fixed-width))) + (and value (replace-regexp-in-string "^" ": " value)))) + + +;;;; Horizontal Rule + +(defun org-element-horizontal-rule-parser (limit affiliated) + "Parse an horizontal rule. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `horizontal-rule' and CDR is a plist +containing `:begin', `:end', `:post-blank' and `:post-affiliated' +keywords." + (save-excursion + (let ((begin (car affiliated)) + (post-affiliated (point)) + (post-hr (progn (forward-line) (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'horizontal-rule + (nconc + (list :begin begin + :end end + :post-blank (count-lines post-hr end) + :post-affiliated post-affiliated) + (cdr affiliated)))))) + +(defun org-element-horizontal-rule-interpreter (&rest _) + "Interpret HORIZONTAL-RULE element as Org syntax." + "-----") + + +;;;; Keyword + +(defun org-element-keyword-parser (limit affiliated) + "Parse a keyword at point. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is a normalized `keyword' (uppercase) and +CDR is a plist containing `:key', `:value', `:begin', `:end', +`:post-blank' and `:post-affiliated' keywords." + (save-excursion + ;; An orphaned affiliated keyword is considered as a regular + ;; keyword. In this case AFFILIATED is nil, so we take care of + ;; this corner case. + (let ((begin (or (car affiliated) (point))) + (post-affiliated (point)) + (key (progn (looking-at "[ \t]*#\\+\\(\\S-*\\):") + (upcase (match-string-no-properties 1)))) + (value (org-trim (buffer-substring-no-properties + (match-end 0) (point-at-eol)))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'keyword + (nconc + (list :key key + :value value + :begin begin + :end end + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated)))))) + +(defun org-element-keyword-interpreter (keyword _) + "Interpret KEYWORD element as Org syntax." + (format "#+%s: %s" + (downcase (org-element-property :key keyword)) + (org-element-property :value keyword))) + + +;;;; Latex Environment + +(defconst org-element--latex-begin-environment + "^[ \t]*\\\\begin{\\([A-Za-z0-9*]+\\)}" + "Regexp matching the beginning of a LaTeX environment. +The environment is captured by the first group. + +See also `org-element--latex-end-environment'.") + +(defconst org-element--latex-end-environment + "\\\\end{%s}[ \t]*$" + "Format string matching the ending of a LaTeX environment. +See also `org-element--latex-begin-environment'.") + +(defun org-element-latex-environment-parser (limit affiliated) + "Parse a LaTeX environment. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `latex-environment' and CDR is a plist +containing `:begin', `:end', `:value', `:post-blank' and +`:post-affiliated' keywords. + +Assume point is at the beginning of the latex environment." + (save-excursion + (let ((case-fold-search t) + (code-begin (point))) + (looking-at org-element--latex-begin-environment) + (if (not (re-search-forward (format org-element--latex-end-environment + (regexp-quote (match-string 1))) + limit t)) + ;; Incomplete latex environment: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (let* ((code-end (progn (forward-line) (point))) + (begin (car affiliated)) + (value (buffer-substring-no-properties code-begin code-end)) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'latex-environment + (nconc + (list :begin begin + :end end + :value value + :post-blank (count-lines code-end end) + :post-affiliated code-begin) + (cdr affiliated)))))))) + +(defun org-element-latex-environment-interpreter (latex-environment _) + "Interpret LATEX-ENVIRONMENT element as Org syntax." + (org-element-property :value latex-environment)) + + +;;;; Node Property + +(defun org-element-node-property-parser (limit) + "Parse a node-property at point. + +LIMIT bounds the search. + +Return a list whose CAR is `node-property' and CDR is a plist +containing `:key', `:value', `:begin', `:end', `:post-blank' and +`:post-affiliated' keywords." + (looking-at org-property-re) + (let ((case-fold-search t) + (begin (point)) + (key (match-string-no-properties 2)) + (value (match-string-no-properties 3)) + (end (save-excursion + (end-of-line) + (if (re-search-forward org-property-re limit t) + (line-beginning-position) + limit)))) + (list 'node-property + (list :key key + :value value + :begin begin + :end end + :post-blank 0 + :post-affiliated begin)))) + +(defun org-element-node-property-interpreter (node-property _) + "Interpret NODE-PROPERTY element as Org syntax." + (format org-property-format + (format ":%s:" (org-element-property :key node-property)) + (or (org-element-property :value node-property) ""))) + + +;;;; Paragraph + +(defun org-element-paragraph-parser (limit affiliated) + "Parse a paragraph. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `paragraph' and CDR is a plist +containing `:begin', `:end', `:contents-begin' and +`:contents-end', `:post-blank' and `:post-affiliated' keywords. + +Assume point is at the beginning of the paragraph." + (save-excursion + (let* ((begin (car affiliated)) + (contents-begin (point)) + (before-blank + (let ((case-fold-search t)) + (end-of-line) + ;; A matching `org-element-paragraph-separate' is not + ;; necessarily the end of the paragraph. In particular, + ;; drawers, blocks or LaTeX environments opening lines + ;; must be closed. Moreover keywords with a secondary + ;; value must belong to "dual keywords". + (while (not + (cond + ((not (and (re-search-forward + org-element-paragraph-separate limit 'move) + (progn (beginning-of-line) t)))) + ((looking-at org-drawer-regexp) + (save-excursion + (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))) + ((looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)") + (save-excursion + (re-search-forward + (format "^[ \t]*#\\+END_%s[ \t]*$" + (regexp-quote (match-string 1))) + limit t))) + ((looking-at org-element--latex-begin-environment) + (save-excursion + (re-search-forward + (format org-element--latex-end-environment + (regexp-quote (match-string 1))) + limit t))) + ((looking-at "[ \t]*#\\+\\(\\S-+\\)\\[.*\\]:") + (member-ignore-case (match-string 1) + org-element-dual-keywords)) + ;; Everything else is unambiguous. + (t))) + (end-of-line)) + (if (= (point) limit) limit + (goto-char (line-beginning-position))))) + (contents-end (save-excursion + (skip-chars-backward " \r\t\n" contents-begin) + (line-beginning-position 2))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'paragraph + (nconc + (list :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank (count-lines before-blank end) + :post-affiliated contents-begin) + (cdr affiliated)))))) + +(defun org-element-paragraph-interpreter (_ contents) + "Interpret paragraph element as Org syntax. +CONTENTS is the contents of the element." + contents) + + +;;;; Planning + +(defun org-element-planning-parser (limit) + "Parse a planning. + +LIMIT bounds the search. + +Return a list whose CAR is `planning' and CDR is a plist +containing `:closed', `:deadline', `:scheduled', `:begin', +`:end', `:post-blank' and `:post-affiliated' keywords." + (save-excursion + (let* ((case-fold-search nil) + (begin (point)) + (post-blank (let ((before-blank (progn (forward-line) (point)))) + (skip-chars-forward " \r\t\n" limit) + (skip-chars-backward " \t") + (unless (bolp) (end-of-line)) + (count-lines before-blank (point)))) + (end (point)) + closed deadline scheduled) + (goto-char begin) + (while (re-search-forward org-keyword-time-not-clock-regexp end t) + (goto-char (match-end 1)) + (skip-chars-forward " \t" end) + (let ((keyword (match-string 1)) + (time (org-element-timestamp-parser))) + (cond ((equal keyword org-closed-string) (setq closed time)) + ((equal keyword org-deadline-string) (setq deadline time)) + (t (setq scheduled time))))) + (list 'planning + (list :closed closed + :deadline deadline + :scheduled scheduled + :begin begin + :end end + :post-blank post-blank + :post-affiliated begin))))) + +(defun org-element-planning-interpreter (planning _) + "Interpret PLANNING element as Org syntax." + (mapconcat + #'identity + (delq nil + (list (let ((deadline (org-element-property :deadline planning))) + (when deadline + (concat org-deadline-string " " + (org-element-timestamp-interpreter deadline nil)))) + (let ((scheduled (org-element-property :scheduled planning))) + (when scheduled + (concat org-scheduled-string " " + (org-element-timestamp-interpreter scheduled nil)))) + (let ((closed (org-element-property :closed planning))) + (when closed + (concat org-closed-string " " + (org-element-timestamp-interpreter closed nil)))))) + " ")) + + +;;;; Src Block + +(defun org-element-src-block-parser (limit affiliated) + "Parse a source block. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `src-block' and CDR is a plist +containing `:language', `:switches', `:parameters', `:begin', +`:end', `:number-lines', `:retain-labels', `:use-labels', +`:label-fmt', `:preserve-indent', `:value', `:post-blank' and +`:post-affiliated' keywords. + +Assume point is at the beginning of the block." + (let ((case-fold-search t)) + (if (not (save-excursion (re-search-forward "^[ \t]*#\\+END_SRC[ \t]*$" + limit t))) + ;; Incomplete block: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (let ((contents-end (match-beginning 0))) + (save-excursion + (let* ((begin (car affiliated)) + (post-affiliated (point)) + ;; Get language as a string. + (language + (progn + (looking-at + "^[ \t]*#\\+BEGIN_SRC\ +\\(?: +\\(\\S-+\\)\\)?\ +\\(\\(?: +\\(?:-\\(?:l \".+\"\\|[ikr]\\)\\|[-+]n\\(?: *[0-9]+\\)?\\)\\)+\\)?\ +\\(.*\\)[ \t]*$") + (match-string-no-properties 1))) + ;; Get switches. + (switches (match-string-no-properties 2)) + ;; Get parameters. + (parameters (match-string-no-properties 3)) + ;; Switches analysis. + (number-lines + (and switches + (string-match "\\([-+]\\)n\\(?: *\\([0-9]+\\)\\)?\\>" + switches) + (cons + (if (equal (match-string 1 switches) "-") + 'new + 'continued) + (if (not (match-end 2)) 0 + ;; Subtract 1 to give number of lines before + ;; first line. + (1- (string-to-number (match-string 2 switches))))))) + (preserve-indent (and switches + (string-match "-i\\>" switches))) + (label-fmt + (and switches + (string-match "-l +\"\\([^\"\n]+\\)\"" switches) + (match-string 1 switches))) + ;; Should labels be retained in (or stripped from) + ;; source blocks? + (retain-labels + (or (not switches) + (not (string-match "-r\\>" switches)) + (and number-lines (string-match "-k\\>" switches)))) + ;; What should code-references use - labels or + ;; line-numbers? + (use-labels + (or (not switches) + (and retain-labels + (not (string-match "-k\\>" switches))))) + ;; Retrieve code. + (value (org-unescape-code-in-string + (buffer-substring-no-properties + (line-beginning-position 2) contents-end))) + (pos-before-blank (progn (goto-char contents-end) + (forward-line) + (point))) + ;; Get position after ending blank lines. + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'src-block + (nconc + (list :language language + :switches (and (org-string-nw-p switches) + (org-trim switches)) + :parameters (and (org-string-nw-p parameters) + (org-trim parameters)) + :begin begin + :end end + :number-lines number-lines + :preserve-indent preserve-indent + :retain-labels retain-labels + :use-labels use-labels + :label-fmt label-fmt + :value value + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated))))))))) + +(defun org-element-src-block-interpreter (src-block _) + "Interpret SRC-BLOCK element as Org syntax." + (let ((lang (org-element-property :language src-block)) + (switches (org-element-property :switches src-block)) + (params (org-element-property :parameters src-block)) + (value + (let ((val (org-element-property :value src-block))) + (cond + ((or org-src-preserve-indentation + (org-element-property :preserve-indent src-block)) + val) + ((zerop org-edit-src-content-indentation) + (org-remove-indentation val)) + (t + (let ((ind (make-string org-edit-src-content-indentation ?\s))) + (replace-regexp-in-string "^[ \t]*\\S-" + (concat ind "\\&") + (org-remove-indentation val)))))))) + (format "#+begin_src%s\n%s#+end_src" + (concat (and lang (concat " " lang)) + (and switches (concat " " switches)) + (and params (concat " " params))) + (org-element-normalize-string (org-escape-code-in-string value))))) + + +;;;; Table + +(defun org-element-table-parser (limit affiliated) + "Parse a table at point. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `table' and CDR is a plist containing +`:begin', `:end', `:tblfm', `:type', `:contents-begin', +`:contents-end', `:value', `:post-blank' and `:post-affiliated' +keywords. + +Assume point is at the beginning of the table." + (save-excursion + (let* ((case-fold-search t) + (table-begin (point)) + (type (if (looking-at "[ \t]*|") 'org 'table.el)) + (end-re (format "^[ \t]*\\($\\|[^| \t%s]\\)" + (if (eq type 'org) "" "+"))) + (begin (car affiliated)) + (table-end + (if (re-search-forward end-re limit 'move) + (goto-char (match-beginning 0)) + (point))) + (tblfm (let (acc) + (while (looking-at "[ \t]*#\\+TBLFM: +\\(.*\\)[ \t]*$") + (push (match-string-no-properties 1) acc) + (forward-line)) + acc)) + (pos-before-blank (point)) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'table + (nconc + (list :begin begin + :end end + :type type + :tblfm tblfm + ;; Only `org' tables have contents. `table.el' tables + ;; use a `:value' property to store raw table as + ;; a string. + :contents-begin (and (eq type 'org) table-begin) + :contents-end (and (eq type 'org) table-end) + :value (and (eq type 'table.el) + (buffer-substring-no-properties + table-begin table-end)) + :post-blank (count-lines pos-before-blank end) + :post-affiliated table-begin) + (cdr affiliated)))))) + +(defun org-element-table-interpreter (table contents) + "Interpret TABLE element as Org syntax. +CONTENTS is a string, if table's type is `org', or nil." + (if (eq (org-element-property :type table) 'table.el) + (org-remove-indentation (org-element-property :value table)) + (concat (with-temp-buffer (insert contents) + (org-table-align) + (buffer-string)) + (mapconcat (lambda (fm) (concat "#+TBLFM: " fm)) + (reverse (org-element-property :tblfm table)) + "\n")))) + + +;;;; Table Row + +(defun org-element-table-row-parser (_) + "Parse table row at point. + +Return a list whose CAR is `table-row' and CDR is a plist +containing `:begin', `:end', `:contents-begin', `:contents-end', +`:type', `:post-blank' and `:post-affiliated' keywords." + (save-excursion + (let* ((type (if (looking-at "^[ \t]*|-") 'rule 'standard)) + (begin (point)) + ;; A table rule has no contents. In that case, ensure + ;; CONTENTS-BEGIN matches CONTENTS-END. + (contents-begin (and (eq type 'standard) (search-forward "|"))) + (contents-end (and (eq type 'standard) + (progn + (end-of-line) + (skip-chars-backward " \t") + (point)))) + (end (line-beginning-position 2))) + (list 'table-row + (list :type type + :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank 0 + :post-affiliated begin))))) + +(defun org-element-table-row-interpreter (table-row contents) + "Interpret TABLE-ROW element as Org syntax. +CONTENTS is the contents of the table row." + (if (eq (org-element-property :type table-row) 'rule) "|-" + (concat "|" contents))) + + +;;;; Verse Block + +(defun org-element-verse-block-parser (limit affiliated) + "Parse a verse block. + +LIMIT bounds the search. AFFILIATED is a list of which CAR is +the buffer position at the beginning of the first affiliated +keyword and CDR is a plist of affiliated keywords along with +their value. + +Return a list whose CAR is `verse-block' and CDR is a plist +containing `:begin', `:end', `:contents-begin', `:contents-end', +`:post-blank' and `:post-affiliated' keywords. + +Assume point is at beginning of the block." + (let ((case-fold-search t)) + (if (not (save-excursion + (re-search-forward "^[ \t]*#\\+END_VERSE[ \t]*$" limit t))) + ;; Incomplete block: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (let ((contents-end (match-beginning 0))) + (save-excursion + (let* ((begin (car affiliated)) + (post-affiliated (point)) + (contents-begin (progn (forward-line) (point))) + (pos-before-blank (progn (goto-char contents-end) + (forward-line) + (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'verse-block + (nconc + (list :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated))))))))) + +(defun org-element-verse-block-interpreter (_ contents) + "Interpret verse-block element as Org syntax. +CONTENTS is verse block contents." + (format "#+begin_verse\n%s#+end_verse" contents)) + + + +;;; Objects +;; +;; Unlike to elements, raw text can be found between objects. Hence, +;; `org-element--object-lex' is provided to find the next object in +;; buffer. +;; +;; Some object types (e.g., `italic') are recursive. Restrictions on +;; object types they can contain will be specified in +;; `org-element-object-restrictions'. +;; +;; Creating a new type of object requires to alter +;; `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'. + +;;;; Bold + +(defun org-element-bold-parser () + "Parse bold object at point, if any. + +When at a bold object, return a list whose car is `bold' and cdr +is a plist with `:begin', `:end', `:contents-begin' and +`:contents-end' and `:post-blank' keywords. Otherwise, return +nil. + +Assume point is at the first star marker." + (save-excursion + (unless (bolp) (backward-char 1)) + (when (looking-at org-emph-re) + (let ((begin (match-beginning 2)) + (contents-begin (match-beginning 4)) + (contents-end (match-end 4)) + (post-blank (progn (goto-char (match-end 2)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'bold + (list :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank post-blank)))))) + +(defun org-element-bold-interpreter (_ contents) + "Interpret bold object as Org syntax. +CONTENTS is the contents of the object." + (format "*%s*" contents)) + + +;;;; Citation + +(defun org-element-citation-parser () + "Parse citation object at point, if any. + +When at a citation object, return a list whose car is `citation' +and cdr is a plist with `:style', `:prefix', `:suffix', `:begin', +`:end', `:contents-begin', `:contents-end', and `:post-blank' +keywords. Otherwise, return nil. + +Assume point is at the beginning of the citation." + (when (looking-at org-element-citation-prefix-re) + (let* ((begin (point)) + (style (and (match-end 1) + (match-string-no-properties 1))) + ;; Ignore blanks between cite type and prefix or key. + (start (match-end 0)) + (closing (with-syntax-table org-element--pair-square-table + (ignore-errors (scan-lists begin 1 0))))) + (save-excursion + (when (and closing + (re-search-forward org-element-citation-key-re closing t)) + ;; Find prefix, if any. + (let ((first-key-end (match-end 0)) + (types (org-element-restriction 'citation-reference)) + (cite + (list 'citation + (list :style style + :begin begin + :post-blank (progn + (goto-char closing) + (skip-chars-forward " \t")) + :end (point))))) + ;; `:contents-begin' depends on the presence of + ;; a non-empty common prefix. + (goto-char first-key-end) + (if (not (search-backward ";" start t)) + (org-element-put-property cite :contents-begin start) + (when (< start (point)) + (org-element-put-property + cite :prefix + (org-element--parse-objects start (point) nil types cite))) + (forward-char) + (org-element-put-property cite :contents-begin (point))) + ;; `:contents-end' depends on the presence of a non-empty + ;; common suffix. + (goto-char (1- closing)) + (skip-chars-backward " \r\t\n") + (let ((end (point))) + (if (or (not (search-backward ";" first-key-end t)) + (re-search-forward org-element-citation-key-re end t)) + (org-element-put-property cite :contents-end end) + (forward-char) + (when (< (point) end) + (org-element-put-property + cite :suffix + (org-element--parse-objects (point) end nil types cite))) + (org-element-put-property cite :contents-end (point)))) + cite)))))) + +(defun org-element-citation-interpreter (citation contents) + "Interpret CITATION object as Org syntax. +CONTENTS is the contents of the object, as a string." + (let ((prefix (org-element-property :prefix citation)) + (suffix (org-element-property :suffix citation)) + (style (org-element-property :style citation))) + (concat "[cite" + (and style (concat "/" style)) + ":" + (and prefix (concat (org-element-interpret-data prefix) ";")) + (if suffix + (concat contents (org-element-interpret-data suffix)) + ;; Remove spurious semicolon. + (substring contents nil -1)) + "]"))) + + +;;;; Citation Reference + +(defun org-element-citation-reference-parser () + "Parse citation reference object at point, if any. + +When at a reference, return a list whose car is +`citation-reference', and cdr is a plist with `:key', +`:prefix', `:suffix', `:begin', `:end', and `:post-blank' keywords. + +Assume point is at the beginning of the reference." + (save-excursion + (let ((begin (point))) + (when (re-search-forward org-element-citation-key-re nil t) + (let* ((key (match-string-no-properties 1)) + (key-start (match-beginning 0)) + (key-end (match-end 0)) + (separator (search-forward ";" nil t)) + (end (or separator (point-max))) + (suffix-end (if separator (1- end) end)) + (types (org-element-restriction 'citation-reference)) + (reference + (list 'citation-reference + (list :key key + :begin begin + :end end + :post-blank 0)))) + (when (< begin key-start) + (org-element-put-property + reference :prefix + (org-element--parse-objects begin key-start nil types reference))) + (when (< key-end suffix-end) + (org-element-put-property + reference :suffix + (org-element--parse-objects key-end suffix-end nil types reference))) + reference))))) + +(defun org-element-citation-reference-interpreter (citation-reference _) + "Interpret CITATION-REFERENCE object as Org syntax." + (concat (org-element-interpret-data + (org-element-property :prefix citation-reference)) + "@" (org-element-property :key citation-reference) + (org-element-interpret-data + (org-element-property :suffix citation-reference)) + ";")) + + +;;;; Code + +(defun org-element-code-parser () + "Parse code object at point, if any. + +When at a code object, return a list whose car is `code' and cdr +is a plist with `:value', `:begin', `:end' and `:post-blank' +keywords. Otherwise, return nil. + +Assume point is at the first tilde marker." + (save-excursion + (unless (bolp) (backward-char 1)) + (when (looking-at org-verbatim-re) + (let ((begin (match-beginning 2)) + (value (match-string-no-properties 4)) + (post-blank (progn (goto-char (match-end 2)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'code + (list :value value + :begin begin + :end end + :post-blank post-blank)))))) + +(defun org-element-code-interpreter (code _) + "Interpret CODE object as Org syntax." + (format "~%s~" (org-element-property :value code))) + + +;;;; Entity + +(defun org-element-entity-parser () + "Parse entity at point, if any. + +When at an entity, return a list whose car is `entity' and cdr +a plist with `:begin', `:end', `:latex', `:latex-math-p', +`:html', `:latin1', `:utf-8', `:ascii', `:use-brackets-p' and +`:post-blank' as keywords. Otherwise, return nil. + +Assume point is at the beginning of the entity." + (catch 'no-object + (when (looking-at "\\\\\\(?:\\(?1:_ +\\)\\|\\(?1:there4\\|sup[123]\\|frac[13][24]\\|[a-zA-Z]+\\)\\(?2:$\\|{}\\|[^[:alpha:]]\\)\\)") + (save-excursion + (let* ((value (or (org-entity-get (match-string 1)) + (throw 'no-object nil))) + (begin (match-beginning 0)) + (bracketsp (string= (match-string 2) "{}")) + (post-blank (progn (goto-char (match-end 1)) + (when bracketsp (forward-char 2)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'entity + (list :name (car value) + :latex (nth 1 value) + :latex-math-p (nth 2 value) + :html (nth 3 value) + :ascii (nth 4 value) + :latin1 (nth 5 value) + :utf-8 (nth 6 value) + :begin begin + :end end + :use-brackets-p bracketsp + :post-blank post-blank))))))) + +(defun org-element-entity-interpreter (entity _) + "Interpret ENTITY object as Org syntax." + (concat "\\" + (org-element-property :name entity) + (when (org-element-property :use-brackets-p entity) "{}"))) + + +;;;; Export Snippet + +(defun org-element-export-snippet-parser () + "Parse export snippet at point. + +When at an export snippet, return a list whose car is +`export-snippet' and cdr a plist with `:begin', `:end', +`:back-end', `:value' and `:post-blank' as keywords. Otherwise, +return nil. + +Assume point is at the beginning of the snippet." + (save-excursion + (let (contents-end) + (when (and (looking-at "@@\\([-A-Za-z0-9]+\\):") + (setq contents-end + (save-match-data (goto-char (match-end 0)) + (re-search-forward "@@" nil t) + (match-beginning 0)))) + (let* ((begin (match-beginning 0)) + (back-end (match-string-no-properties 1)) + (value (buffer-substring-no-properties + (match-end 0) contents-end)) + (post-blank (skip-chars-forward " \t")) + (end (point))) + (list 'export-snippet + (list :back-end back-end + :value value + :begin begin + :end end + :post-blank post-blank))))))) + +(defun org-element-export-snippet-interpreter (export-snippet _) + "Interpret EXPORT-SNIPPET object as Org syntax." + (format "@@%s:%s@@" + (org-element-property :back-end export-snippet) + (org-element-property :value export-snippet))) + + +;;;; Footnote Reference + +(defun org-element-footnote-reference-parser () + "Parse footnote reference at point, if any. + +When at a footnote reference, return a list whose car is +`footnote-reference' and cdr a plist with `:label', `:type', +`:begin', `:end', `:contents-begin', `:contents-end' and +`:post-blank' as keywords. Otherwise, return nil." + (when (looking-at org-footnote-re) + (let ((closing (with-syntax-table org-element--pair-square-table + (ignore-errors (scan-lists (point) 1 0))))) + (when closing + (save-excursion + (let* ((begin (point)) + (label (match-string-no-properties 1)) + (inner-begin (match-end 0)) + (inner-end (1- closing)) + (type (if (match-end 2) 'inline 'standard)) + (post-blank (progn (goto-char closing) + (skip-chars-forward " \t"))) + (end (point))) + (list 'footnote-reference + (list :label label + :type type + :begin begin + :end end + :contents-begin (and (eq type 'inline) inner-begin) + :contents-end (and (eq type 'inline) inner-end) + :post-blank post-blank)))))))) + +(defun org-element-footnote-reference-interpreter (footnote-reference contents) + "Interpret FOOTNOTE-REFERENCE object as Org syntax. +CONTENTS is its definition, when inline, or nil." + (format "[fn:%s%s]" + (or (org-element-property :label footnote-reference) "") + (if contents (concat ":" contents) ""))) + + +;;;; Inline Babel Call + +(defun org-element-inline-babel-call-parser () + "Parse inline babel call at point, if any. + +When at an inline babel call, return a list whose car is +`inline-babel-call' and cdr a plist with `:call', +`:inside-header', `:arguments', `:end-header', `:begin', `:end', +`:value' and `:post-blank' as keywords. Otherwise, return nil. + +Assume point is at the beginning of the babel call." + (save-excursion + (catch :no-object + (when (let ((case-fold-search nil)) + (looking-at "\\. Unlike to + ;; bracket links, follow RFC 3986 and remove any extra + ;; whitespace in URI. + ((looking-at org-link-angle-re) + (setq format 'angle) + (setq type (match-string-no-properties 1)) + (setq link-end (match-end 0)) + (setq raw-link + (buffer-substring-no-properties + (match-beginning 1) (match-end 2))) + (setq path (replace-regexp-in-string + "[ \t]*\n[ \t]*" "" (match-string-no-properties 2)))) + (t (throw 'no-object nil))) + ;; In any case, deduce end point after trailing white space from + ;; LINK-END variable. + (save-excursion + (setq post-blank + (progn (goto-char link-end) (skip-chars-forward " \t"))) + (setq end (point))) + ;; Special "file"-type link processing. Extract opening + ;; application and search option, if any. Also normalize URI. + (when (string-match "\\`file\\(?:\\+\\(.+\\)\\)?\\'" type) + (setq application (match-string 1 type)) + (setq type "file") + (when (string-match "::\\(.*\\)\\'" path) + (setq search-option (match-string 1 path)) + (setq path (replace-match "" nil nil path))) + (setq path (replace-regexp-in-string "\\`///*\\(.:\\)?/" "\\1/" path))) + ;; Translate link, if `org-link-translation-function' is set. + (let ((trans (and (functionp org-link-translation-function) + (funcall org-link-translation-function type path)))) + (when trans + (setq type (car trans)) + (setq path (cdr trans)))) + (list 'link + (list :type type + :path path + :format format + :raw-link (or raw-link path) + :application application + :search-option search-option + :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank post-blank))))) + +(defun org-element-link-interpreter (link contents) + "Interpret LINK object as Org syntax. +CONTENTS is the contents of the object, or nil." + (let ((type (org-element-property :type link)) + (path (org-element-property :path link))) + (if (string= type "radio") path + (let ((fmt (pcase (org-element-property :format link) + ;; Links with contents and internal links have to + ;; use bracket syntax. Ignore `:format' in these + ;; cases. This is also the default syntax when the + ;; property is not defined, e.g., when the object + ;; was crafted by the user. + ((guard contents) + (format "[[%%s][%s]]" + ;; Since this is going to be used as + ;; a format string, escape percent signs + ;; in description. + (replace-regexp-in-string "%" "%%" contents))) + ((or `bracket + `nil + (guard (member type '("coderef" "custom-id" "fuzzy")))) + "[[%s]]") + ;; Otherwise, just obey to `:format'. + (`angle "<%s>") + (`plain "%s") + (f (error "Wrong `:format' value: %s" f))))) + (format fmt + (pcase type + ("coderef" (format "(%s)" path)) + ("custom-id" (concat "#" path)) + ("file" + (let ((app (org-element-property :application link)) + (opt (org-element-property :search-option link))) + (concat type (and app (concat "+" app)) ":" + path + (and opt (concat "::" opt))))) + ("fuzzy" path) + (_ (concat type ":" path)))))))) + + +;;;; Macro + +(defun org-element-macro-parser () + "Parse macro at point, if any. + +When at a macro, return a list whose car is `macro' and cdr +a plist with `:key', `:args', `:begin', `:end', `:value' and +`:post-blank' as keywords. Otherwise, return nil. + +Assume point is at the macro." + (save-excursion + (when (looking-at "{{{\\([a-zA-Z][-a-zA-Z0-9_]*\\)\\((\\([^\000]*?\\))\\)?}}}") + (let ((begin (point)) + (key (downcase (match-string-no-properties 1))) + (value (match-string-no-properties 0)) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point)) + (args (pcase (match-string-no-properties 3) + (`nil nil) + (a (org-macro-extract-arguments + (replace-regexp-in-string + "[ \t\r\n]+" " " (org-trim a))))))) + (list 'macro + (list :key key + :value value + :args args + :begin begin + :end end + :post-blank post-blank)))))) + +(defun org-element-macro-interpreter (macro _) + "Interpret MACRO object as Org syntax." + (format "{{{%s%s}}}" + (org-element-property :key macro) + (pcase (org-element-property :args macro) + (`nil "") + (args (format "(%s)" (apply #'org-macro-escape-arguments args)))))) + + +;;;; Radio-target + +(defun org-element-radio-target-parser () + "Parse radio target at point, if any. + +When at a radio target, return a list whose car is `radio-target' +and cdr a plist with `:begin', `:end', `:contents-begin', +`:contents-end', `:value' and `:post-blank' as keywords. +Otherwise, return nil. + +Assume point is at the radio target." + (save-excursion + (when (looking-at org-radio-target-regexp) + (let ((begin (point)) + (contents-begin (match-beginning 1)) + (contents-end (match-end 1)) + (value (match-string-no-properties 1)) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'radio-target + (list :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank post-blank + :value value)))))) + +(defun org-element-radio-target-interpreter (_ contents) + "Interpret target object as Org syntax. +CONTENTS is the contents of the object." + (concat "<<<" contents ">>>")) + + +;;;; Statistics Cookie + +(defun org-element-statistics-cookie-parser () + "Parse statistics cookie at point, if any. + +When at a statistics cookie, return a list whose car is +`statistics-cookie', and cdr a plist with `:begin', `:end', +`:value' and `:post-blank' keywords. Otherwise, return nil. + +Assume point is at the beginning of the statistics-cookie." + (save-excursion + (when (looking-at "\\[[0-9]*\\(%\\|/[0-9]*\\)\\]") + (let* ((begin (point)) + (value (buffer-substring-no-properties + (match-beginning 0) (match-end 0))) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'statistics-cookie + (list :begin begin + :end end + :value value + :post-blank post-blank)))))) + +(defun org-element-statistics-cookie-interpreter (statistics-cookie _) + "Interpret STATISTICS-COOKIE object as Org syntax." + (org-element-property :value statistics-cookie)) + + +;;;; Strike-Through + +(defun org-element-strike-through-parser () + "Parse strike-through object at point, if any. + +When at a strike-through object, return a list whose car is +`strike-through' and cdr is a plist with `:begin', `:end', +`:contents-begin' and `:contents-end' and `:post-blank' keywords. +Otherwise, return nil. + +Assume point is at the first plus sign marker." + (save-excursion + (unless (bolp) (backward-char 1)) + (when (looking-at org-emph-re) + (let ((begin (match-beginning 2)) + (contents-begin (match-beginning 4)) + (contents-end (match-end 4)) + (post-blank (progn (goto-char (match-end 2)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'strike-through + (list :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank post-blank)))))) + +(defun org-element-strike-through-interpreter (_ contents) + "Interpret strike-through object as Org syntax. +CONTENTS is the contents of the object." + (format "+%s+" contents)) + + +;;;; Subscript + +(defun org-element-subscript-parser () + "Parse subscript at point, if any. + +When at a subscript object, return a list whose car is +`subscript' and cdr a plist with `:begin', `:end', +`:contents-begin', `:contents-end', `:use-brackets-p' and +`:post-blank' as keywords. Otherwise, return nil. + +Assume point is at the underscore." + (save-excursion + (unless (bolp) (backward-char)) + (when (looking-at org-match-substring-regexp) + (let ((bracketsp (match-beginning 4)) + (begin (match-beginning 2)) + (contents-begin (or (match-beginning 4) + (match-beginning 3))) + (contents-end (or (match-end 4) (match-end 3))) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'subscript + (list :begin begin + :end end + :use-brackets-p bracketsp + :contents-begin contents-begin + :contents-end contents-end + :post-blank post-blank)))))) + +(defun org-element-subscript-interpreter (subscript contents) + "Interpret SUBSCRIPT object as Org syntax. +CONTENTS is the contents of the object." + (format + (if (org-element-property :use-brackets-p subscript) "_{%s}" "_%s") + contents)) + + +;;;; Superscript + +(defun org-element-superscript-parser () + "Parse superscript at point, if any. + +When at a superscript object, return a list whose car is +`superscript' and cdr a plist with `:begin', `:end', +`:contents-begin', `:contents-end', `:use-brackets-p' and +`:post-blank' as keywords. Otherwise, return nil. + +Assume point is at the caret." + (save-excursion + (unless (bolp) (backward-char)) + (when (looking-at org-match-substring-regexp) + (let ((bracketsp (match-beginning 4)) + (begin (match-beginning 2)) + (contents-begin (or (match-beginning 4) + (match-beginning 3))) + (contents-end (or (match-end 4) (match-end 3))) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'superscript + (list :begin begin + :end end + :use-brackets-p bracketsp + :contents-begin contents-begin + :contents-end contents-end + :post-blank post-blank)))))) + +(defun org-element-superscript-interpreter (superscript contents) + "Interpret SUPERSCRIPT object as Org syntax. +CONTENTS is the contents of the object." + (format + (if (org-element-property :use-brackets-p superscript) "^{%s}" "^%s") + contents)) + + +;;;; Table Cell + +(defun org-element-table-cell-parser () + "Parse table cell at point. +Return a list whose car is `table-cell' and cdr is a plist +containing `:begin', `:end', `:contents-begin', `:contents-end' +and `:post-blank' keywords." + (looking-at "[ \t]*\\(.*?\\)[ \t]*\\(?:|\\|$\\)") + (let* ((begin (match-beginning 0)) + (end (match-end 0)) + (contents-begin (match-beginning 1)) + (contents-end (match-end 1))) + (list 'table-cell + (list :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank 0)))) + +(defun org-element-table-cell-interpreter (_ contents) + "Interpret table-cell element as Org syntax. +CONTENTS is the contents of the cell, or nil." + (concat " " contents " |")) + + +;;;; Target + +(defun org-element-target-parser () + "Parse target at point, if any. + +When at a target, return a list whose car is `target' and cdr +a plist with `:begin', `:end', `:value' and `:post-blank' as +keywords. Otherwise, return nil. + +Assume point is at the target." + (save-excursion + (when (looking-at org-target-regexp) + (let ((begin (point)) + (value (match-string-no-properties 1)) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'target + (list :begin begin + :end end + :value value + :post-blank post-blank)))))) + +(defun org-element-target-interpreter (target _) + "Interpret TARGET object as Org syntax." + (format "<<%s>>" (org-element-property :value target))) + + +;;;; Timestamp + +(defconst org-element--timestamp-regexp + (concat org-ts-regexp-both + "\\|" + "\\(?:<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)" + "\\|" + "\\(?:<%%\\(?:([^>\n]+)\\)>\\)") + "Regexp matching any timestamp type object.") + +(defun org-element-timestamp-parser () + "Parse time stamp at point, if any. + +When at a time stamp, return a list whose car is `timestamp', and +cdr a plist with `:type', `:raw-value', `:year-start', +`:month-start', `:day-start', `:hour-start', `:minute-start', +`:year-end', `:month-end', `:day-end', `:hour-end', +`:minute-end', `:repeater-type', `:repeater-value', +`:repeater-unit', `:warning-type', `:warning-value', +`:warning-unit', `:begin', `:end' and `:post-blank' keywords. +Otherwise, return nil. + +Assume point is at the beginning of the timestamp." + (when (looking-at-p org-element--timestamp-regexp) + (save-excursion + (let* ((begin (point)) + (activep (eq (char-after) ?<)) + (raw-value + (progn + (looking-at "\\([<[]\\(%%\\)?.*?\\)[]>]\\(?:--\\([<[].*?[]>]\\)\\)?") + (match-string-no-properties 0))) + (date-start (match-string-no-properties 1)) + (date-end (match-string 3)) + (diaryp (match-beginning 2)) + (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))))) + (type (cond (diaryp 'diary) + ((and activep (or date-end time-range)) 'active-range) + (activep 'active) + ((or date-end time-range) 'inactive-range) + (t 'inactive))) + (repeater-props + (and (not diaryp) + (string-match "\\([.+]?\\+\\)\\([0-9]+\\)\\([hdwmy]\\)" + raw-value) + (list + :repeater-type + (let ((type (match-string 1 raw-value))) + (cond ((equal "++" type) 'catch-up) + ((equal ".+" type) 'restart) + (t 'cumulate))) + :repeater-value (string-to-number (match-string 2 raw-value)) + :repeater-unit + (pcase (string-to-char (match-string 3 raw-value)) + (?h 'hour) (?d 'day) (?w 'week) (?m 'month) (_ 'year))))) + (warning-props + (and (not diaryp) + (string-match "\\(-\\)?-\\([0-9]+\\)\\([hdwmy]\\)" raw-value) + (list + :warning-type (if (match-string 1 raw-value) 'first 'all) + :warning-value (string-to-number (match-string 2 raw-value)) + :warning-unit + (pcase (string-to-char (match-string 3 raw-value)) + (?h 'hour) (?d 'day) (?w 'week) (?m 'month) (_ 'year))))) + year-start month-start day-start hour-start minute-start year-end + month-end day-end hour-end minute-end) + ;; Parse date-start. + (unless diaryp + (let ((date (org-parse-time-string date-start t))) + (setq year-start (nth 5 date) + month-start (nth 4 date) + day-start (nth 3 date) + hour-start (nth 2 date) + minute-start (nth 1 date)))) + ;; Compute date-end. It can be provided directly in time-stamp, + ;; or extracted from time range. Otherwise, it defaults to the + ;; same values as date-start. + (unless diaryp + (let ((date (and date-end (org-parse-time-string date-end t)))) + (setq year-end (or (nth 5 date) year-start) + month-end (or (nth 4 date) month-start) + 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)))) + (list 'timestamp + (nconc (list :type type + :raw-value raw-value + :year-start year-start + :month-start month-start + :day-start day-start + :hour-start hour-start + :minute-start minute-start + :year-end year-end + :month-end month-end + :day-end day-end + :hour-end hour-end + :minute-end minute-end + :begin begin + :end end + :post-blank post-blank) + repeater-props + warning-props)))))) + +(defun org-element-timestamp-interpreter (timestamp _) + "Interpret TIMESTAMP object as Org syntax." + (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")))) + (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")))) + (build-ts-string + ;; Build an Org timestamp string from TIME. ACTIVEP is + ;; non-nil when time stamp is active. If WITH-TIME-P is + ;; non-nil, add a time part. HOUR-END and MINUTE-END + ;; specify a time range in the timestamp. REPEAT-STRING is + ;; the repeater string, if any. + (lambda (time activep &optional with-time-p hour-end minute-end) + (let ((ts (format-time-string + (funcall (if with-time-p #'cdr #'car) + org-time-stamp-formats) + time))) + (when (and hour-end minute-end) + (string-match "[012]?[0-9]:[0-5][0-9]" ts) + (setq ts + (replace-match + (format "\\&-%02d:%02d" hour-end minute-end) + nil nil ts))) + (unless activep (setq ts (format "[%s]" (substring ts 1 -1)))) + (dolist (s (list repeat-string warning-string)) + (when (org-string-nw-p s) + (setq ts (concat (substring ts 0 -1) + " " + s + (substring ts -1))))) + ;; Return value. + ts))) + (type (org-element-property :type timestamp))) + (pcase type + ((or `active `inactive) + (let* ((minute-start (org-element-property :minute-start timestamp)) + (minute-end (org-element-property :minute-end timestamp)) + (hour-start (org-element-property :hour-start timestamp)) + (hour-end (org-element-property :hour-end timestamp)) + (time-range-p (and hour-start hour-end minute-start minute-end + (or (/= hour-start hour-end) + (/= minute-start minute-end))))) + (funcall + build-ts-string + (encode-time 0 + (or minute-start 0) + (or hour-start 0) + (org-element-property :day-start timestamp) + (org-element-property :month-start timestamp) + (org-element-property :year-start timestamp)) + (eq type 'active) + (and hour-start minute-start) + (and time-range-p hour-end) + (and time-range-p minute-end)))) + ((or `active-range `inactive-range) + (let ((minute-start (org-element-property :minute-start timestamp)) + (minute-end (org-element-property :minute-end timestamp)) + (hour-start (org-element-property :hour-start timestamp)) + (hour-end (org-element-property :hour-end timestamp))) + (concat + (funcall + build-ts-string (encode-time + 0 + (or minute-start 0) + (or hour-start 0) + (org-element-property :day-start timestamp) + (org-element-property :month-start timestamp) + (org-element-property :year-start timestamp)) + (eq type 'active-range) + (and hour-start minute-start)) + "--" + (funcall build-ts-string + (encode-time 0 + (or minute-end 0) + (or hour-end 0) + (org-element-property :day-end timestamp) + (org-element-property :month-end timestamp) + (org-element-property :year-end timestamp)) + (eq type 'active-range) + (and hour-end minute-end))))) + (_ (org-element-property :raw-value timestamp))))) + + +;;;; Underline + +(defun org-element-underline-parser () + "Parse underline object at point, if any. + +When at an underline object, return a list whose car is +`underline' and cdr is a plist with `:begin', `:end', +`:contents-begin' and `:contents-end' and `:post-blank' keywords. +Otherwise, return nil. + +Assume point is at the first underscore marker." + (save-excursion + (unless (bolp) (backward-char 1)) + (when (looking-at org-emph-re) + (let ((begin (match-beginning 2)) + (contents-begin (match-beginning 4)) + (contents-end (match-end 4)) + (post-blank (progn (goto-char (match-end 2)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'underline + (list :begin begin + :end end + :contents-begin contents-begin + :contents-end contents-end + :post-blank post-blank)))))) + +(defun org-element-underline-interpreter (_ contents) + "Interpret underline object as Org syntax. +CONTENTS is the contents of the object." + (format "_%s_" contents)) + + +;;;; Verbatim + +(defun org-element-verbatim-parser () + "Parse verbatim object at point, if any. + +When at a verbatim object, return a list whose car is `verbatim' +and cdr is a plist with `:value', `:begin', `:end' and +`:post-blank' keywords. Otherwise, return nil. + +Assume point is at the first equal sign marker." + (save-excursion + (unless (bolp) (backward-char 1)) + (when (looking-at org-verbatim-re) + (let ((begin (match-beginning 2)) + (value (match-string-no-properties 4)) + (post-blank (progn (goto-char (match-end 2)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'verbatim + (list :value value + :begin begin + :end end + :post-blank post-blank)))))) + +(defun org-element-verbatim-interpreter (verbatim _) + "Interpret VERBATIM object as Org syntax." + (format "=%s=" (org-element-property :value verbatim))) + + + +;;; Parsing Element Starting At Point +;; +;; `org-element--current-element' is the core function of this section. +;; It returns the Lisp representation of the element starting at +;; point. + +(defun org-element--current-element (limit &optional granularity mode structure) + "Parse the element starting at point. + +Return value is a list like (TYPE PROPS) where TYPE is the type +of the element and PROPS a plist of properties associated to the +element. + +Possible types are defined in `org-element-all-elements'. + +LIMIT bounds the search. + +Optional argument GRANULARITY determines the depth of the +recursion. Allowed values are `headline', `greater-element', +`element', `object' or nil. When it is broader than `object' (or +nil), secondary values will not be parsed, since they only +contain objects. + +Optional argument MODE, when non-nil, can be either +`first-section', `item', `node-property', `planning', +`property-drawer', `section', `table-row', or `top-comment'. + + +If STRUCTURE isn't provided but MODE is set to `item', it will be +computed. + +This function assumes point is always at the beginning of the +element it has to parse." + (save-excursion + (let ((case-fold-search t) + ;; Determine if parsing depth allows for secondary strings + ;; parsing. It only applies to elements referenced in + ;; `org-element-secondary-value-alist'. + (raw-secondary-p (and granularity (not (eq granularity 'object))))) + (cond + ;; Item. + ((eq mode 'item) + (org-element-item-parser limit structure raw-secondary-p)) + ;; Table Row. + ((eq mode 'table-row) (org-element-table-row-parser limit)) + ;; Node Property. + ((eq mode 'node-property) (org-element-node-property-parser limit)) + ;; Headline. + ((org-with-limited-levels (org-at-heading-p)) + (org-element-headline-parser limit raw-secondary-p)) + ;; Sections (must be checked after headline). + ((eq mode 'section) (org-element-section-parser limit)) + ((eq mode 'first-section) + (org-element-section-parser + (or (save-excursion (org-with-limited-levels (outline-next-heading))) + limit))) + ;; Comments. + ((looking-at "^[ \t]*#\\(?: \\|$\\)") + (org-element-comment-parser limit)) + ;; Planning. + ((and (eq mode 'planning) + (eq ?* (char-after (line-beginning-position 0))) + (looking-at org-planning-line-re)) + (org-element-planning-parser limit)) + ;; Property drawer. + ((and (pcase mode + (`planning (eq ?* (char-after (line-beginning-position 0)))) + ((or `property-drawer `top-comment) + (save-excursion + (beginning-of-line 0) + (not (looking-at "[[:blank:]]*$")))) + (_ nil)) + (looking-at org-property-drawer-re)) + (org-element-property-drawer-parser limit)) + ;; When not at bol, point is at the beginning of an item or + ;; a footnote definition: next item is always a paragraph. + ((not (bolp)) (org-element-paragraph-parser limit (list (point)))) + ;; Clock. + ((looking-at org-clock-line-re) (org-element-clock-parser limit)) + ;; Inlinetask. + ((looking-at "^\\*+ ") + (org-element-inlinetask-parser limit raw-secondary-p)) + ;; From there, elements can have affiliated keywords. + (t (let ((affiliated (org-element--collect-affiliated-keywords + limit (memq granularity '(nil object))))) + (cond + ;; Jumping over affiliated keywords put point off-limits. + ;; Parse them as regular keywords. + ((and (cdr affiliated) (>= (point) limit)) + (goto-char (car affiliated)) + (org-element-keyword-parser limit nil)) + ;; LaTeX Environment. + ((looking-at org-element--latex-begin-environment) + (org-element-latex-environment-parser limit affiliated)) + ;; Drawer. + ((looking-at org-drawer-regexp) + (org-element-drawer-parser limit affiliated)) + ;; Fixed Width + ((looking-at "[ \t]*:\\( \\|$\\)") + (org-element-fixed-width-parser limit affiliated)) + ;; Inline Comments, Blocks, Babel Calls, Dynamic Blocks and + ;; Keywords. + ((looking-at "[ \t]*#\\+") + (goto-char (match-end 0)) + (cond + ((looking-at "BEGIN_\\(\\S-+\\)") + (beginning-of-line) + (funcall (pcase (upcase (match-string 1)) + ("CENTER" #'org-element-center-block-parser) + ("COMMENT" #'org-element-comment-block-parser) + ("EXAMPLE" #'org-element-example-block-parser) + ("EXPORT" #'org-element-export-block-parser) + ("QUOTE" #'org-element-quote-block-parser) + ("SRC" #'org-element-src-block-parser) + ("VERSE" #'org-element-verse-block-parser) + (_ #'org-element-special-block-parser)) + limit + affiliated)) + ((looking-at "CALL:") + (beginning-of-line) + (org-element-babel-call-parser limit affiliated)) + ((looking-at "BEGIN:? ") + (beginning-of-line) + (org-element-dynamic-block-parser limit affiliated)) + ((looking-at "\\S-+:") + (beginning-of-line) + (org-element-keyword-parser limit affiliated)) + (t + (beginning-of-line) + (org-element-paragraph-parser limit affiliated)))) + ;; Footnote Definition. + ((looking-at org-footnote-definition-re) + (org-element-footnote-definition-parser limit affiliated)) + ;; Horizontal Rule. + ((looking-at "[ \t]*-\\{5,\\}[ \t]*$") + (org-element-horizontal-rule-parser limit affiliated)) + ;; Diary Sexp. + ((looking-at "%%(") + (org-element-diary-sexp-parser limit affiliated)) + ;; Table. + ((or (looking-at "[ \t]*|") + ;; There is no strict definition of a table.el + ;; table. Try to prevent false positive while being + ;; quick. + (let ((rule-regexp + (rx (zero-or-more (any " \t")) + "+" + (one-or-more (one-or-more "-") "+") + (zero-or-more (any " \t")) + eol)) + (non-table.el-line + (rx bol + (zero-or-more (any " \t")) + (or eol (not (any "+| \t"))))) + (next (line-beginning-position 2))) + ;; Start with a full rule. + (and + (looking-at rule-regexp) + (< next limit) ;no room for a table.el table + (save-excursion + (end-of-line) + (cond + ;; Must end with a full rule. + ((not (re-search-forward non-table.el-line limit 'move)) + (if (bolp) (forward-line -1) (beginning-of-line)) + (looking-at rule-regexp)) + ;; Ignore pseudo-tables with a single + ;; rule. + ((= next (line-beginning-position)) + nil) + ;; Must end with a full rule. + (t + (forward-line -1) + (looking-at rule-regexp))))))) + (org-element-table-parser limit affiliated)) + ;; List. + ((looking-at (org-item-re)) + (org-element-plain-list-parser + limit affiliated + (or structure (org-element--list-struct limit)))) + ;; Default element: Paragraph. + (t (org-element-paragraph-parser limit affiliated))))))))) + + +;; Most elements can have affiliated keywords. When looking for an +;; element beginning, we want to move before them, as they belong to +;; that element, and, in the meantime, collect information they give +;; into appropriate properties. Hence the following function. + +(defun org-element--collect-affiliated-keywords (limit parse) + "Collect affiliated keywords from point down to LIMIT. + +Return a list whose CAR is the position at the first of them and +CDR a plist of keywords and values and move point to the +beginning of the first line after them. + +As a special case, if element doesn't start at the beginning of +the line (e.g., a paragraph starting an item), CAR is current +position of point and CDR is nil. + +When PARSE is non-nil, values from keywords belonging to +`org-element-parsed-keywords' are parsed as secondary strings." + (if (not (bolp)) (list (point)) + (let ((case-fold-search t) + (origin (point)) + ;; RESTRICT is the list of objects allowed in parsed + ;; keywords value. If PARSE is nil, no object is allowed. + (restrict (and parse (org-element-restriction 'keyword))) + output) + (while (and (< (point) limit) (looking-at org-element--affiliated-re)) + (let* ((raw-kwd (upcase (match-string 1))) + ;; Apply translation to RAW-KWD. From there, KWD is + ;; the official keyword. + (kwd (or (cdr (assoc raw-kwd + org-element-keyword-translation-alist)) + raw-kwd)) + ;; PARSED? is non-nil when keyword should have its + ;; value parsed. + (parsed? (member kwd org-element-parsed-keywords)) + ;; Find main value for any keyword. + (value + (let ((beg (match-end 0)) + (end (save-excursion + (end-of-line) + (skip-chars-backward " \t") + (point)))) + (if parsed? + (save-match-data + (org-element--parse-objects beg end nil restrict)) + (org-trim (buffer-substring-no-properties beg end))))) + ;; If KWD is a dual keyword, find its secondary value. + ;; Maybe parse it. + (dual? (member kwd org-element-dual-keywords)) + (dual-value + (and dual? + (let ((sec (match-string-no-properties 2))) + (cond + ((and sec parsed?) + (save-match-data + (org-element--parse-objects + (match-beginning 2) (match-end 2) nil restrict))) + (sec sec))))) + ;; Attribute a property name to KWD. + (kwd-sym (and kwd (intern (concat ":" (downcase kwd)))))) + ;; Now set final shape for VALUE. + (when dual? + (setq value (and (or value dual-value) (cons value dual-value)))) + (when (or (member kwd org-element-multiple-keywords) + ;; Attributes can always appear on multiple lines. + (string-match "^ATTR_" kwd)) + (setq value (cons value (plist-get output kwd-sym)))) + ;; Eventually store the new value in OUTPUT. + (setq output (plist-put output kwd-sym value)) + ;; Move to next keyword. + (forward-line))) + ;; If affiliated keywords are orphaned: move back to first one. + ;; They will be parsed as a paragraph. + (when (looking-at "[ \t]*$") (goto-char origin) (setq output nil)) + ;; Return value. + (cons origin output)))) + + + +;;; The Org Parser +;; +;; The two major functions here are `org-element-parse-buffer', which +;; parses Org syntax inside the current buffer, taking into account +;; region, narrowing, or even visibility if specified, and +;; `org-element-parse-secondary-string', which parses objects within +;; a given string. +;; +;; The (almost) almighty `org-element-map' allows applying a function +;; on elements or objects matching some type, and accumulating the +;; resulting values. In an export situation, it also skips unneeded +;; parts of the parse tree. + +(defun org-element-parse-buffer (&optional granularity visible-only) + "Recursively parse the buffer and return structure. +If narrowing is in effect, only parse the visible part of the +buffer. + +Optional argument GRANULARITY determines the depth of the +recursion. It can be set to the following symbols: + +`headline' Only parse headlines. +`greater-element' Don't recurse into greater elements except + headlines and sections. Thus, elements + parsed are the top-level ones. +`element' Parse everything but objects and plain text. +`object' Parse the complete buffer (default). + +When VISIBLE-ONLY is non-nil, don't parse contents of hidden +elements. + +An element or object is represented as a list with the +pattern (TYPE PROPERTIES CONTENTS), where : + + TYPE is a symbol describing the element or object. See + `org-element-all-elements' and `org-element-all-objects' for an + exhaustive list of such symbols. One can retrieve it with + `org-element-type' function. + + PROPERTIES is the list of attributes attached to the element or + object, as a plist. Although most of them are specific to the + element or object type, all types share `:begin', `:end', + `:post-blank' and `:parent' properties, which respectively + refer to buffer position where the element or object starts, + ends, the number of white spaces or blank lines after it, and + the element or object containing it. Properties values can be + obtained by using `org-element-property' function. + + CONTENTS is a list of elements, objects or raw strings + contained in the current element or object, when applicable. + One can access them with `org-element-contents' function. + +The Org buffer has `org-data' as type and nil as properties. +`org-element-map' function can be used to find specific elements +or objects within the parse tree. + +This function assumes that current major mode is `org-mode'." + (save-excursion + (goto-char (point-min)) + (org-skip-whitespace) + (org-element--parse-elements + (point-at-bol) (point-max) + ;; Start in `first-section' mode so text before the first + ;; headline belongs to a section. + 'first-section nil granularity visible-only (list 'org-data nil)))) + +(defun org-element-parse-secondary-string (string restriction &optional parent) + "Recursively parse objects in STRING and return structure. + +RESTRICTION is a symbol limiting the object types that will be +looked after. + +Optional argument PARENT, when non-nil, is the element or object +containing the secondary string. It is used to set correctly +`:parent' property within the string. + +If STRING is the empty string or nil, return nil." + (cond + ((not string) nil) + ((equal string "") nil) + (t (let ((local-variables (buffer-local-variables))) + (with-temp-buffer + (dolist (v local-variables) + (ignore-errors + (if (symbolp v) (makunbound v) + ;; Don't set file name to avoid mishandling hooks (bug#44524) + (unless (memq (car v) '(buffer-file-name buffer-file-truename)) + (set (make-local-variable (car v)) (cdr v)))))) + ;; Transferring local variables may put the temporary buffer + ;; into a read-only state. Make sure we can insert STRING. + (let ((inhibit-read-only t)) (insert string)) + ;; Prevent "Buffer *temp* modified; kill anyway?". + (restore-buffer-modified-p nil) + (org-element--parse-objects + (point-min) (point-max) nil restriction parent)))))) + +(defun org-element-map + (data types fun &optional info first-match no-recursion with-affiliated) + "Map a function on selected elements or objects. + +DATA is a parse tree, an element, an object, a string, or a list +of such constructs. TYPES is a symbol or list of symbols of +elements or objects types (see `org-element-all-elements' and +`org-element-all-objects' for a complete list of types). FUN is +the function called on the matching element or object. It has to +accept one argument: the element or object itself. + +When optional argument INFO is non-nil, it should be a plist +holding export options. In that case, parts of the parse tree +not exportable according to that property list will be skipped. + +When optional argument FIRST-MATCH is non-nil, stop at the first +match for which FUN doesn't return nil, and return that value. + +Optional argument NO-RECURSION is a symbol or a list of symbols +representing elements or objects types. `org-element-map' won't +enter any recursive element or object whose type belongs to that +list. Though, FUN can still be applied on them. + +When optional argument WITH-AFFILIATED is non-nil, FUN will also +apply to matching objects within parsed affiliated keywords (see +`org-element-parsed-keywords'). + +Nil values returned from FUN do not appear in the results. + + +Examples: +--------- + +Assuming TREE is a variable containing an Org buffer parse tree, +the following example will return a flat list of all `src-block' +and `example-block' elements in it: + + (org-element-map tree \\='(example-block src-block) #\\='identity) + +The following snippet will find the first headline with a level +of 1 and a \"phone\" tag, and will return its beginning position: + + (org-element-map tree \\='headline + (lambda (hl) + (and (= (org-element-property :level hl) 1) + (member \"phone\" (org-element-property :tags hl)) + (org-element-property :begin hl))) + nil t) + +The next example will return a flat list of all `plain-list' type +elements in TREE that are not a sub-list themselves: + + (org-element-map tree \\='plain-list #\\='identity nil nil \\='plain-list) + +Eventually, this example will return a flat list of all `bold' +type objects containing a `latex-snippet' type object, even +looking into captions: + + (org-element-map tree \\='bold + (lambda (b) + (and (org-element-map b \\='latex-snippet #\\='identity nil t) b)) + nil nil nil t)" + (declare (indent 2)) + ;; Ensure TYPES and NO-RECURSION are a list, even of one element. + (let* ((types (if (listp types) types (list types))) + (no-recursion (if (listp no-recursion) no-recursion + (list no-recursion))) + ;; Recursion depth is determined by --CATEGORY. + (--category + (catch :--found + (let ((category 'greater-elements) + (all-objects (cons 'plain-text org-element-all-objects))) + (dolist (type types category) + (cond ((memq type all-objects) + ;; If one object is found, the function has + ;; to recurse into every object. + (throw :--found 'objects)) + ((not (memq type org-element-greater-elements)) + ;; If one regular element is found, the + ;; function has to recurse, at least, into + ;; every element it encounters. + (and (not (eq category 'elements)) + (setq category 'elements)))))))) + --acc) + (letrec ((--walk-tree + (lambda (--data) + ;; Recursively walk DATA. INFO, if non-nil, is a plist + ;; holding contextual information. + (let ((--type (org-element-type --data))) + (cond + ((not --data)) + ;; Ignored element in an export context. + ((and info (memq --data (plist-get info :ignore-list)))) + ;; List of elements or objects. + ((not --type) (mapc --walk-tree --data)) + ;; Unconditionally enter parse trees. + ((eq --type 'org-data) + (mapc --walk-tree (org-element-contents --data))) + (t + ;; Check if TYPE is matching among TYPES. If so, + ;; apply FUN to --DATA and accumulate return value + ;; into --ACC (or exit if FIRST-MATCH is non-nil). + (when (memq --type types) + (let ((result (funcall fun --data))) + (cond ((not result)) + (first-match (throw :--map-first-match result)) + (t (push result --acc))))) + ;; If --DATA has a secondary string that can contain + ;; objects with their type among TYPES, look inside. + (when (and (eq --category 'objects) (not (stringp --data))) + (dolist (p (cdr (assq --type + org-element-secondary-value-alist))) + (funcall --walk-tree (org-element-property p --data)))) + ;; If --DATA has any parsed affiliated keywords and + ;; WITH-AFFILIATED is non-nil, look for objects in + ;; them. + (when (and with-affiliated + (eq --category 'objects) + (eq (org-element-class --data) 'element)) + (dolist (kwd-pair org-element--parsed-properties-alist) + (let ((kwd (car kwd-pair)) + (value (org-element-property (cdr kwd-pair) --data))) + ;; Pay attention to the type of parsed + ;; keyword. In particular, preserve order for + ;; multiple keywords. + (cond + ((not value)) + ((member kwd org-element-dual-keywords) + (if (member kwd org-element-multiple-keywords) + (dolist (line (reverse value)) + (funcall --walk-tree (cdr line)) + (funcall --walk-tree (car line))) + (funcall --walk-tree (cdr value)) + (funcall --walk-tree (car value)))) + ((member kwd org-element-multiple-keywords) + (mapc --walk-tree (reverse value))) + (t (funcall --walk-tree value)))))) + ;; Determine if a recursion into --DATA is possible. + (cond + ;; --TYPE is explicitly removed from recursion. + ((memq --type no-recursion)) + ;; --DATA has no contents. + ((not (org-element-contents --data))) + ;; Looking for greater elements but --DATA is + ;; simply an element or an object. + ((and (eq --category 'greater-elements) + (not (memq --type org-element-greater-elements)))) + ;; Looking for elements but --DATA is an object. + ((and (eq --category 'elements) + (eq (org-element-class --data) 'object))) + ;; In any other case, map contents. + (t (mapc --walk-tree (org-element-contents --data)))))))))) + (catch :--map-first-match + (funcall --walk-tree data) + ;; Return value in a proper order. + (nreverse --acc))))) + +;; The following functions are internal parts of the parser. +;; +;; The first one, `org-element--parse-elements' acts at the element's +;; level. +;; +;; The second one, `org-element--parse-objects' applies on all objects +;; of a paragraph or a secondary string. It calls +;; `org-element--object-lex' to find the next object in the current +;; container. + +(defsubst org-element--next-mode (mode type parent?) + "Return next mode according to current one. + +MODE is a symbol representing the expectation about the next +element or object. Meaningful values are `first-section', +`item', `node-property', `planning', `property-drawer', +`section', `table-row', `top-comment', and nil. + +TYPE is the type of the current element or object. + +If PARENT? is non-nil, assume the next element or object will be +located inside the current one." + (if parent? + (pcase type + (`headline 'section) + ((and (guard (eq mode 'first-section)) `section) 'top-comment) + (`inlinetask 'planning) + (`plain-list 'item) + (`property-drawer 'node-property) + (`section 'planning) + (`table 'table-row)) + (pcase mode + (`item 'item) + (`node-property 'node-property) + ((and `planning (guard (eq type 'planning))) 'property-drawer) + (`table-row 'table-row) + ((and `top-comment (guard (eq type 'comment))) 'property-drawer)))) + +(defun org-element--parse-elements + (beg end mode structure granularity visible-only acc) + "Parse elements between BEG and END positions. + +MODE prioritizes some elements over the others. It can be set to +`first-section', `item', `node-property', `planning', +`property-drawer', `section', `table-row', `top-comment', or nil. + +When value is `item', STRUCTURE will be used as the current list +structure. + +GRANULARITY determines the depth of the recursion. See +`org-element-parse-buffer' for more information. + +When VISIBLE-ONLY is non-nil, don't parse contents of hidden +elements. + +Elements are accumulated into ACC." + (save-excursion + (goto-char beg) + ;; When parsing only headlines, skip any text before first one. + (when (and (eq granularity 'headline) (not (org-at-heading-p))) + (org-with-limited-levels (outline-next-heading))) + (let (elements) + (while (< (point) end) + ;; Visible only: skip invisible parts due to folding. + (if (and visible-only (org-invisible-p nil t)) + (progn + (goto-char (org-find-visible)) + (when (and (eolp) (not (eobp))) (forward-char))) + ;; Find current element's type and parse it accordingly to + ;; its category. + (let* ((element (org-element--current-element + end granularity mode structure)) + (type (org-element-type element)) + (cbeg (org-element-property :contents-begin element))) + (goto-char (org-element-property :end element)) + ;; Fill ELEMENT contents by side-effect. + (cond + ;; If element has no contents, don't modify it. + ((not cbeg)) + ;; Greater element: parse it between `contents-begin' and + ;; `contents-end'. Ensure GRANULARITY allows recursion, + ;; or ELEMENT is a headline, in which case going inside + ;; is mandatory, in order to get sub-level headings. + ((and (memq type org-element-greater-elements) + (or (memq granularity '(element object nil)) + (and (eq granularity 'greater-element) + (eq type 'section)) + (eq type 'headline))) + (org-element--parse-elements + cbeg (org-element-property :contents-end element) + ;; Possibly switch to a special mode. + (org-element--next-mode mode type t) + (and (memq type '(item plain-list)) + (org-element-property :structure element)) + granularity visible-only element)) + ;; ELEMENT has contents. Parse objects inside, if + ;; GRANULARITY allows it. + ((memq granularity '(object nil)) + (org-element--parse-objects + cbeg (org-element-property :contents-end element) element + (org-element-restriction type)))) + (push (org-element-put-property element :parent acc) elements) + ;; Update mode. + (setq mode (org-element--next-mode mode type nil))))) + ;; Return result. + (apply #'org-element-set-contents acc (nreverse elements))))) + +(defun org-element--object-lex (restriction) + "Return next object in current buffer or nil. +RESTRICTION is a list of object types, as symbols, that should be +looked after. This function assumes that the buffer is narrowed +to an appropriate container (e.g., a paragraph)." + (cond + ((memq 'table-cell restriction) (org-element-table-cell-parser)) + ((memq 'citation-reference restriction) + (org-element-citation-reference-parser)) + (t + (let* ((start (point)) + (limit + ;; Object regexp sometimes needs to have a peek at + ;; a character ahead. Therefore, when there is a hard + ;; limit, make it one more than the true beginning of the + ;; radio target. + (save-excursion + (cond ((not org-target-link-regexp) nil) + ((not (memq 'link restriction)) nil) + ((progn + (unless (bolp) (forward-char -1)) + (not (re-search-forward org-target-link-regexp nil t))) + nil) + ;; Since we moved backward, we do not want to + ;; match again an hypothetical 1-character long + ;; radio link before us. Realizing that this can + ;; only happen if such a radio link starts at + ;; beginning of line, we prevent this here. + ((and (= start (1+ (line-beginning-position))) + (= start (match-end 1))) + (and (re-search-forward org-target-link-regexp nil t) + (1+ (match-beginning 1)))) + (t (1+ (match-beginning 1)))))) + found) + (save-excursion + (while (and (not found) + (re-search-forward org-element--object-regexp limit 'move)) + (goto-char (match-beginning 0)) + (let ((result (match-string 0))) + (setq found + (cond + ((string-prefix-p "call_" result t) + (and (memq 'inline-babel-call restriction) + (org-element-inline-babel-call-parser))) + ((string-prefix-p "src_" result t) + (and (memq 'inline-src-block restriction) + (org-element-inline-src-block-parser))) + (t + (pcase (char-after) + (?^ (and (memq 'superscript restriction) + (org-element-superscript-parser))) + (?_ (or (and (memq 'subscript restriction) + (org-element-subscript-parser)) + (and (memq 'underline restriction) + (org-element-underline-parser)))) + (?* (and (memq 'bold restriction) + (org-element-bold-parser))) + (?/ (and (memq 'italic restriction) + (org-element-italic-parser))) + (?~ (and (memq 'code restriction) + (org-element-code-parser))) + (?= (and (memq 'verbatim restriction) + (org-element-verbatim-parser))) + (?+ (and (memq 'strike-through restriction) + (org-element-strike-through-parser))) + (?@ (and (memq 'export-snippet restriction) + (org-element-export-snippet-parser))) + (?{ (and (memq 'macro restriction) + (org-element-macro-parser))) + (?$ (and (memq 'latex-fragment restriction) + (org-element-latex-fragment-parser))) + (?< + (if (eq (aref result 1) ?<) + (or (and (memq 'radio-target restriction) + (org-element-radio-target-parser)) + (and (memq 'target restriction) + (org-element-target-parser))) + (or (and (memq 'timestamp restriction) + (org-element-timestamp-parser)) + (and (memq 'link restriction) + (org-element-link-parser))))) + (?\\ + (if (eq (aref result 1) ?\\) + (and (memq 'line-break restriction) + (org-element-line-break-parser)) + (or (and (memq 'entity restriction) + (org-element-entity-parser)) + (and (memq 'latex-fragment restriction) + (org-element-latex-fragment-parser))))) + (?\[ + (pcase (aref result 1) + ((and ?\[ + (guard (memq 'link restriction))) + (org-element-link-parser)) + ((and ?f + (guard (memq 'footnote-reference restriction))) + (org-element-footnote-reference-parser)) + ((and ?c + (guard (memq 'citation restriction))) + (org-element-citation-parser)) + ((and (or ?% ?/) + (guard (memq 'statistics-cookie restriction))) + (org-element-statistics-cookie-parser)) + (_ + (or (and (memq 'timestamp restriction) + (org-element-timestamp-parser)) + (and (memq 'statistics-cookie restriction) + (org-element-statistics-cookie-parser)))))) + ;; This is probably a plain link. + (_ (and (memq 'link restriction) + (org-element-link-parser))))))) + (or (eobp) (forward-char)))) + (cond (found) + (limit (forward-char -1) + (org-element-link-parser)) ;radio link + (t nil))))))) + +(defun org-element--parse-objects (beg end acc restriction &optional parent) + "Parse objects between BEG and END and return recursive structure. + +Objects are accumulated in ACC. RESTRICTION is a list of object +successors which are allowed in the current object. + +ACC becomes the parent for all parsed objects. However, if ACC +is nil (i.e., a secondary string is being parsed) and optional +argument PARENT is non-nil, use it as the parent for all objects. +Eventually, if both ACC and PARENT are nil, the common parent is +the list of objects itself." + (save-excursion + (save-restriction + (narrow-to-region beg end) + (goto-char (point-min)) + (let (next-object contents) + (while (and (not (eobp)) + (setq next-object (org-element--object-lex restriction))) + ;; Text before any object. + (let ((obj-beg (org-element-property :begin next-object))) + (unless (= (point) obj-beg) + (let ((text (buffer-substring-no-properties (point) obj-beg))) + (push (if acc (org-element-put-property text :parent acc) text) + contents)))) + ;; Object... + (let ((obj-end (org-element-property :end next-object)) + (cont-beg (org-element-property :contents-begin next-object))) + (when acc (org-element-put-property next-object :parent acc)) + (push (if cont-beg + ;; Fill contents of NEXT-OBJECT if possible. + (org-element--parse-objects + cont-beg + (org-element-property :contents-end next-object) + next-object + (org-element-restriction next-object)) + next-object) + contents) + (goto-char obj-end))) + ;; Text after last object. + (unless (eobp) + (let ((text (buffer-substring-no-properties (point) end))) + (push (if acc (org-element-put-property text :parent acc) text) + contents))) + ;; Result. Set appropriate parent. + (if acc (apply #'org-element-set-contents acc (nreverse contents)) + (let* ((contents (nreverse contents)) + (parent (or parent contents))) + (dolist (datum contents contents) + (org-element-put-property datum :parent parent)))))))) + + + +;;; Towards A Bijective Process +;; +;; The parse tree obtained with `org-element-parse-buffer' is really +;; a snapshot of the corresponding Org buffer. Therefore, it can be +;; interpreted and expanded into a string with canonical Org syntax. +;; Hence `org-element-interpret-data'. +;; +;; The function relies internally on +;; `org-element--interpret-affiliated-keywords'. + +;;;###autoload +(defun org-element-interpret-data (data) + "Interpret DATA as Org syntax. +DATA is a parse tree, an element, an object or a secondary string +to interpret. Return Org syntax as a string." + (letrec ((fun + (lambda (data parent) + (let* ((type (org-element-type data)) + ;; Find interpreter for current object or + ;; element. If it doesn't exist (e.g. this is + ;; a pseudo object or element), return contents, + ;; if any. + (interpret + (let ((fun (intern + (format "org-element-%s-interpreter" type)))) + (if (fboundp fun) fun (lambda (_ contents) contents)))) + (results + (cond + ;; Secondary string. + ((not type) + (mapconcat (lambda (obj) (funcall fun obj parent)) + data + "")) + ;; Full Org document. + ((eq type 'org-data) + (mapconcat (lambda (obj) (funcall fun obj parent)) + (org-element-contents data) + "")) + ;; Plain text: return it. + ((stringp data) data) + ;; Element or object without contents. + ((not (org-element-contents data)) + (funcall interpret data nil)) + ;; Element or object with contents. + (t + (funcall + interpret + data + ;; Recursively interpret contents. + (mapconcat + (lambda (datum) (funcall fun datum data)) + (org-element-contents + (if (not (memq type '(paragraph verse-block))) + data + ;; Fix indentation of elements containing + ;; objects. We ignore `table-row' + ;; elements as they are one line long + ;; anyway. + (org-element-normalize-contents + data + ;; When normalizing first paragraph of + ;; an item or a footnote-definition, + ;; ignore first line's indentation. + (and (eq type 'paragraph) + (memq (org-element-type parent) + '(footnote-definition item)) + (eq data (car (org-element-contents parent))) + (eq (org-element-property :pre-blank parent) + 0))))) + "")))))) + (if (memq type '(org-data nil)) results + ;; Build white spaces. If no `:post-blank' property + ;; is specified, assume its value is 0. + (let ((blank (or (org-element-property :post-blank data) 0))) + (if (eq (org-element-class data parent) 'object) + (concat results (make-string blank ?\s)) + (concat (org-element--interpret-affiliated-keywords data) + (org-element-normalize-string results) + (make-string blank ?\n))))))))) + (funcall fun data nil))) + +(defun org-element--interpret-affiliated-keywords (element) + "Return ELEMENT's affiliated keywords as Org syntax. +If there is no affiliated keyword, return the empty string." + (let ((keyword-to-org + (lambda (key value) + (let (dual) + (when (member key org-element-dual-keywords) + (setq dual (cdr value) value (car value))) + (concat "#+" (downcase key) + (and dual + (format "[%s]" (org-element-interpret-data dual))) + ": " + (if (member key org-element-parsed-keywords) + (org-element-interpret-data value) + value) + "\n"))))) + (mapconcat + (lambda (prop) + (let ((value (org-element-property prop element)) + (keyword (upcase (substring (symbol-name prop) 1)))) + (when value + (if (or (member keyword org-element-multiple-keywords) + ;; All attribute keywords can have multiple lines. + (string-match "^ATTR_" keyword)) + (mapconcat (lambda (line) (funcall keyword-to-org keyword line)) + (reverse value) + "") + (funcall keyword-to-org keyword value))))) + ;; List all ELEMENT's properties matching an attribute line or an + ;; affiliated keyword, but ignore translated keywords since they + ;; cannot belong to the property list. + (cl-loop for prop in (nth 1 element) by 'cddr + when (let ((keyword (upcase (substring (symbol-name prop) 1)))) + (or (string-match "^ATTR_" keyword) + (and + (member keyword org-element-affiliated-keywords) + (not (assoc keyword + org-element-keyword-translation-alist))))) + collect prop) + ""))) + +;; Because interpretation of the parse tree must return the same +;; number of blank lines between elements and the same number of white +;; space after objects, some special care must be given to white +;; spaces. +;; +;; The first function, `org-element-normalize-string', ensures any +;; string different from the empty string will end with a single +;; newline character. +;; +;; The second function, `org-element-normalize-contents', removes +;; global indentation from the contents of the current element. + +(defun org-element-normalize-string (s) + "Ensure string S ends with a single newline character. + +If S isn't a string return it unchanged. If S is the empty +string, return it. Otherwise, return a new string with a single +newline character at its end." + (cond + ((not (stringp s)) s) + ((string= "" s) "") + (t (and (string-match "\\(\n[ \t]*\\)*\\'" s) + (replace-match "\n" nil nil s))))) + +(defun org-element-normalize-contents (element &optional ignore-first) + "Normalize plain text in ELEMENT's contents. + +ELEMENT must only contain plain text and objects. + +If optional argument IGNORE-FIRST is non-nil, ignore first line's +indentation to compute maximal common indentation. + +Return the normalized element that is element with global +indentation removed from its contents." + (letrec ((find-min-ind + ;; Return minimal common indentation within BLOB. This is + ;; done by walking recursively BLOB and updating MIN-IND + ;; along the way. FIRST-FLAG is non-nil when the next + ;; object is expected to be a string that doesn't start + ;; with a newline character. It happens for strings at + ;; the beginnings of the contents or right after a line + ;; break. + (lambda (blob first-flag min-ind) + (dolist (datum (org-element-contents blob) min-ind) + (when first-flag + (setq first-flag nil) + (cond + ;; Objects cannot start with spaces: in this + ;; case, indentation is 0. + ((not (stringp datum)) (throw :zero 0)) + ((not (string-match + "\\`\\([ \t]+\\)\\([^ \t\n]\\|\n\\|\\'\\)" datum)) + (throw :zero 0)) + ((equal (match-string 2 datum) "\n") + (put-text-property + (match-beginning 1) (match-end 1) 'org-ind 'empty datum)) + (t + (let ((i (string-width (match-string 1 datum)))) + (put-text-property + (match-beginning 1) (match-end 1) 'org-ind i datum) + (setq min-ind (min i min-ind)))))) + (cond + ((stringp datum) + (let ((s 0)) + (while (string-match + "\n\\([ \t]*\\)\\([^ \t\n]\\|\n\\|\\'\\)" datum s) + (setq s (match-end 1)) + (cond + ((equal (match-string 1 datum) "") + (unless (member (match-string 2 datum) '("" "\n")) + (throw :zero 0))) + ((equal (match-string 2 datum) "\n") + (put-text-property (match-beginning 1) (match-end 1) + 'org-ind 'empty datum)) + (t + (let ((i (string-width (match-string 1 datum)))) + (put-text-property (match-beginning 1) (match-end 1) + 'org-ind i datum) + (setq min-ind (min i min-ind)))))))) + ((eq (org-element-type datum) 'line-break) + (setq first-flag t)) + ((memq (org-element-type datum) org-element-recursive-objects) + (setq min-ind + (funcall find-min-ind datum first-flag min-ind))))))) + (min-ind + (catch :zero + (funcall find-min-ind + element (not ignore-first) most-positive-fixnum)))) + (if (or (zerop min-ind) (= min-ind most-positive-fixnum)) element + ;; Build ELEMENT back, replacing each string with the same + ;; string minus common indentation. + (letrec ((build + (lambda (datum) + ;; Return DATUM with all its strings indentation + ;; shortened from MIN-IND white spaces. + (setcdr + (cdr datum) + (mapcar + (lambda (object) + (cond + ((stringp object) + (with-temp-buffer + (insert object) + (let ((s (point-min))) + (while (setq s (text-property-not-all + s (point-max) 'org-ind nil)) + (goto-char s) + (let ((i (get-text-property s 'org-ind))) + (delete-region s (progn + (skip-chars-forward " \t") + (point))) + (when (integerp i) (indent-to (- i min-ind)))))) + (buffer-string))) + ((memq (org-element-type object) + org-element-recursive-objects) + (funcall build object)) + (t object))) + (org-element-contents datum))) + datum))) + (funcall build element))))) + + + +;;; Cache +;; +;; Implement a caching mechanism for `org-element-at-point' and +;; `org-element-context', which see. +;; +;; A single public function is provided: `org-element-cache-reset'. +;; +;; Cache is disabled by default for now because it sometimes triggers +;; freezes, but it can be enabled globally with +;; `org-element-use-cache'. `org-element-cache-sync-idle-time', +;; `org-element-cache-sync-duration' and +;; `org-element-cache-sync-break' can be tweaked to control caching +;; behavior. +;; +;; Internally, parsed elements are stored in an AVL tree, +;; `org-element--cache'. This tree is updated lazily: whenever +;; a change happens to the buffer, a synchronization request is +;; registered in `org-element--cache-sync-requests' (see +;; `org-element--cache-submit-request'). During idle time, requests +;; are processed by `org-element--cache-sync'. Synchronization also +;; happens when an element is required from the cache. In this case, +;; the process stops as soon as the needed element is up-to-date. +;; +;; A synchronization request can only apply on a synchronized part of +;; the cache. Therefore, the cache is updated at least to the +;; location where the new request applies. Thus, requests are ordered +;; from left to right and all elements starting before the first +;; request are correct. This property is used by functions like +;; `org-element--cache-find' to retrieve elements in the part of the +;; cache that can be trusted. +;; +;; A request applies to every element, starting from its original +;; location (or key, see below). When a request is processed, it +;; moves forward and may collide the next one. In this case, both +;; requests are merged into a new one that starts from that element. +;; As a consequence, the whole synchronization complexity does not +;; depend on the number of pending requests, but on the number of +;; elements the very first request will be applied on. +;; +;; Elements cannot be accessed through their beginning position, which +;; may or may not be up-to-date. Instead, each element in the tree is +;; associated to a key, obtained with `org-element--cache-key'. This +;; mechanism is robust enough to preserve total order among elements +;; even when the tree is only partially synchronized. + + +(defvar org-element-use-cache nil + "Non-nil when Org parser should cache its results. + +WARNING: for the time being, using cache sometimes triggers +freezes. Therefore, it is disabled by default. Activate it if +you want to help debugging the issue.") + +(defvar org-element-cache-sync-idle-time 0.6 + "Length, in seconds, of idle time before syncing cache.") + +(defvar org-element-cache-sync-duration 0.04 + "Maximum duration, as a time value, for a cache synchronization. +If the synchronization is not over after this delay, the process +pauses and resumes after `org-element-cache-sync-break' +seconds.") + +(defvar org-element-cache-sync-break 0.3 + "Duration, as a time value, of the pause between synchronizations. +See `org-element-cache-sync-duration' for more information.") + + +;;;; Data Structure + +(defvar org-element--cache nil + "AVL tree used to cache elements. +Each node of the tree contains an element. Comparison is done +with `org-element--cache-compare'. This cache is used in +`org-element-at-point'.") + +(defvar org-element--cache-sync-requests nil + "List of pending synchronization requests. + +A request is a vector with the following pattern: + + [NEXT BEG END OFFSET PARENT PHASE] + +Processing a synchronization request consists of three phases: + + 0. Delete modified elements, + 1. Fill missing area in cache, + 2. Shift positions and re-parent elements after the changes. + +During phase 0, NEXT is the key of the first element to be +removed, BEG and END is buffer position delimiting the +modifications. Elements starting between them (inclusive) are +removed. So are elements whose parent is removed. PARENT, when +non-nil, is the parent of the first element to be removed. + +During phase 1, NEXT is the key of the next known element in +cache and BEG its beginning position. Parse buffer between that +element and the one before it in order to determine the parent of +the next element. Set PARENT to the element containing NEXT. + +During phase 2, NEXT is the key of the next element to shift in +the parse tree. All elements starting from this one have their +properties relatives to buffer positions shifted by integer +OFFSET and, if they belong to element PARENT, are adopted by it. + +PHASE specifies the phase number, as an integer.") + +(defvar org-element--cache-sync-timer nil + "Timer used for cache synchronization.") + +(defvar org-element--cache-sync-keys nil + "Hash table used to store keys during synchronization. +See `org-element--cache-key' for more information.") + +(defsubst org-element--cache-key (element) + "Return a unique key for ELEMENT in cache tree. + +Keys are used to keep a total order among elements in the cache. +Comparison is done with `org-element--cache-key-less-p'. + +When no synchronization is taking place, a key is simply the +beginning position of the element, or that position plus one in +the case of an first item (respectively row) in +a list (respectively a table). + +During a synchronization, the key is the one the element had when +the cache was synchronized for the last time. Elements added to +cache during the synchronization get a new key generated with +`org-element--cache-generate-key'. + +Such keys are stored in `org-element--cache-sync-keys'. The hash +table is cleared once the synchronization is complete." + (or (gethash element org-element--cache-sync-keys) + (let* ((begin (org-element-property :begin element)) + ;; Increase beginning position of items (respectively + ;; table rows) by one, so the first item can get + ;; a different key from its parent list (respectively + ;; table). + (key (if (memq (org-element-type element) '(item table-row)) + (1+ begin) + begin))) + (if org-element--cache-sync-requests + (puthash element key org-element--cache-sync-keys) + key)))) + +(defun org-element--cache-generate-key (lower upper) + "Generate a key between LOWER and UPPER. + +LOWER and UPPER are fixnums or lists of same, possibly empty. + +If LOWER and UPPER are equals, return LOWER. Otherwise, return +a unique key, as an integer or a list of integers, according to +the following rules: + + - LOWER and UPPER are compared level-wise until values differ. + + - If, at a given level, LOWER and UPPER differ from more than + 2, the new key shares all the levels above with LOWER and + gets a new level. Its value is the mean between LOWER and + UPPER: + + (1 2) + (1 4) --> (1 3) + + - If LOWER has no value to compare with, it is assumed that its + value is `most-negative-fixnum'. E.g., + + (1 1) + (1 1 2) + + is equivalent to + + (1 1 m) + (1 1 2) + + where m is `most-negative-fixnum'. Likewise, if UPPER is + short of levels, the current value is `most-positive-fixnum'. + + - If they differ from only one, the new key inherits from + current LOWER level and fork it at the next level. E.g., + + (2 1) + (3 3) + + is equivalent to + + (2 1) + (2 M) + + where M is `most-positive-fixnum'. + + - If the key is only one level long, it is returned as an + integer: + + (1 2) + (3 2) --> 2 + +When they are not equals, the function assumes that LOWER is +lesser than UPPER, per `org-element--cache-key-less-p'." + (if (equal lower upper) lower + (let ((lower (if (integerp lower) (list lower) lower)) + (upper (if (integerp upper) (list upper) upper)) + skip-upper key) + (catch 'exit + (while t + (let ((min (or (car lower) most-negative-fixnum)) + (max (cond (skip-upper most-positive-fixnum) + ((car upper)) + (t most-positive-fixnum)))) + (if (< (1+ min) max) + (let ((mean (+ (ash min -1) (ash max -1) (logand min max 1)))) + (throw 'exit (if key (nreverse (cons mean key)) mean))) + (when (and (< min max) (not skip-upper)) + ;; When at a given level, LOWER and UPPER differ from + ;; 1, ignore UPPER altogether. Instead create a key + ;; between LOWER and the greatest key with the same + ;; prefix as LOWER so far. + (setq skip-upper t)) + (push min key) + (setq lower (cdr lower) upper (cdr upper))))))))) + +(defsubst org-element--cache-key-less-p (a b) + "Non-nil if key A is less than key B. +A and B are either integers or lists of integers, as returned by +`org-element--cache-key'." + (if (integerp a) (if (integerp b) (< a b) (<= a (car b))) + (if (integerp b) (< (car a) b) + (catch 'exit + (while (and a b) + (cond ((car-less-than-car a b) (throw 'exit t)) + ((car-less-than-car b a) (throw 'exit nil)) + (t (setq a (cdr a) b (cdr b))))) + ;; If A is empty, either keys are equal (B is also empty) and + ;; we return nil, or A is lesser than B (B is longer) and we + ;; return a non-nil value. + ;; + ;; If A is not empty, B is necessarily empty and A is greater + ;; than B (A is longer). Therefore, return nil. + (and (null a) b))))) + +(defun org-element--cache-compare (a b) + "Non-nil when element A is located before element B." + (org-element--cache-key-less-p (org-element--cache-key a) + (org-element--cache-key b))) + +(defsubst org-element--cache-root () + "Return root value in cache. +This function assumes `org-element--cache' is a valid AVL tree." + (avl-tree--node-left (avl-tree--dummyroot org-element--cache))) + + +;;;; Tools + +(defsubst org-element--cache-active-p () + "Non-nil when cache is active in current buffer." + (and org-element-use-cache + org-element--cache + (derived-mode-p 'org-mode))) + +(defun org-element--cache-find (pos &optional side) + "Find element in cache starting at POS or before. + +POS refers to a buffer position. + +When optional argument SIDE is non-nil, the function checks for +elements starting at or past POS instead. If SIDE is `both', the +function returns a cons cell where car is the first element +starting at or before POS and cdr the first element starting +after POS. + +The function can only find elements in the synchronized part of +the cache." + (let ((limit (and org-element--cache-sync-requests + (aref (car org-element--cache-sync-requests) 0))) + (node (org-element--cache-root)) + lower upper) + (while node + (let* ((element (avl-tree--node-data node)) + (begin (org-element-property :begin element))) + (cond + ((and limit + (not (org-element--cache-key-less-p + (org-element--cache-key element) limit))) + (setq node (avl-tree--node-left node))) + ((> begin pos) + (setq upper element + node (avl-tree--node-left node))) + ((< begin pos) + (setq lower element + node (avl-tree--node-right node))) + ;; We found an element in cache starting at POS. If `side' + ;; is `both' we also want the next one in order to generate + ;; a key in-between. + ;; + ;; If the element is the first row or item in a table or + ;; a plain list, we always return the table or the plain + ;; list. + ;; + ;; In any other case, we return the element found. + ((eq side 'both) + (setq lower element) + (setq node (avl-tree--node-right node))) + ((and (memq (org-element-type element) '(item table-row)) + (let ((parent (org-element-property :parent element))) + (and (= (org-element-property :begin element) + (org-element-property :contents-begin parent)) + (setq node nil + lower parent + upper parent))))) + (t + (setq node nil + lower element + upper element))))) + (pcase side + (`both (cons lower upper)) + (`nil lower) + (_ upper)))) + +(defun org-element--cache-put (element) + "Store ELEMENT in current buffer's cache, if allowed." + (when (org-element--cache-active-p) + (when org-element--cache-sync-requests + ;; During synchronization, first build an appropriate key for + ;; the new element so `avl-tree-enter' can insert it at the + ;; right spot in the cache. + (let ((keys (org-element--cache-find + (org-element-property :begin element) 'both))) + (puthash element + (org-element--cache-generate-key + (and (car keys) (org-element--cache-key (car keys))) + (cond ((cdr keys) (org-element--cache-key (cdr keys))) + (org-element--cache-sync-requests + (aref (car org-element--cache-sync-requests) 0)))) + org-element--cache-sync-keys))) + (avl-tree-enter org-element--cache element))) + +(defsubst org-element--cache-remove (element) + "Remove ELEMENT from cache. +Assume ELEMENT belongs to cache and that a cache is active." + (avl-tree-delete org-element--cache element)) + + +;;;; Synchronization + +(defsubst org-element--cache-set-timer (buffer) + "Set idle timer for cache synchronization in BUFFER." + (when org-element--cache-sync-timer + (cancel-timer org-element--cache-sync-timer)) + (setq org-element--cache-sync-timer + (run-with-idle-timer + (let ((idle (current-idle-time))) + (if idle (org-time-add idle org-element-cache-sync-break) + org-element-cache-sync-idle-time)) + nil + #'org-element--cache-sync + buffer))) + +(defsubst org-element--cache-interrupt-p (time-limit) + "Non-nil when synchronization process should be interrupted. +TIME-LIMIT is a time value or nil." + (and time-limit + (or (input-pending-p) + (org-time-less-p time-limit nil)))) + +(defsubst org-element--cache-shift-positions (element offset &optional props) + "Shift ELEMENT properties relative to buffer positions by OFFSET. + +Properties containing buffer positions are `:begin', `:end', +`:contents-begin', `:contents-end' and `:structure'. When +optional argument PROPS is a list of keywords, only shift +properties provided in that list. + +Properties are modified by side-effect." + (let ((properties (nth 1 element))) + ;; Shift `:structure' property for the first plain list only: it + ;; is the only one that really matters and it prevents from + ;; shifting it more than once. + (when (and (or (not props) (memq :structure props)) + (eq (org-element-type element) 'plain-list) + (not (eq (org-element-type (plist-get properties :parent)) + 'item))) + (dolist (item (plist-get properties :structure)) + (cl-incf (car item) offset) + (cl-incf (nth 6 item) offset))) + (dolist (key '(:begin :contents-begin :contents-end :end :post-affiliated)) + (let ((value (and (or (not props) (memq key props)) + (plist-get properties key)))) + (and value (plist-put properties key (+ offset value))))))) + +(defun org-element--cache-sync (buffer &optional threshold future-change) + "Synchronize cache with recent modification in BUFFER. + +When optional argument THRESHOLD is non-nil, do the +synchronization for all elements starting before or at threshold, +then exit. Otherwise, synchronize cache for as long as +`org-element-cache-sync-duration' or until Emacs leaves idle +state. + +FUTURE-CHANGE, when non-nil, is a buffer position where changes +not registered yet in the cache are going to happen. It is used +in `org-element--cache-submit-request', where cache is partially +updated before current modification are actually submitted." + (when (buffer-live-p buffer) + (with-current-buffer buffer + (let ((inhibit-quit t) request next) + (when org-element--cache-sync-timer + (cancel-timer org-element--cache-sync-timer)) + (catch 'interrupt + (while org-element--cache-sync-requests + (setq request (car org-element--cache-sync-requests) + next (nth 1 org-element--cache-sync-requests)) + (org-element--cache-process-request + request + (and next (aref next 0)) + threshold + (and (not threshold) + (org-time-add nil + org-element-cache-sync-duration)) + future-change) + ;; Request processed. Merge current and next offsets and + ;; transfer ending position. + (when next + (cl-incf (aref next 3) (aref request 3)) + (aset next 2 (aref request 2))) + (setq org-element--cache-sync-requests + (cdr org-element--cache-sync-requests)))) + ;; If more requests are awaiting, set idle timer accordingly. + ;; Otherwise, reset keys. + (if org-element--cache-sync-requests + (org-element--cache-set-timer buffer) + (clrhash org-element--cache-sync-keys)))))) + +(defun org-element--cache-process-request + (request next threshold time-limit future-change) + "Process synchronization REQUEST for all entries before NEXT. + +REQUEST is a vector, built by `org-element--cache-submit-request'. + +NEXT is a cache key, as returned by `org-element--cache-key'. + +When non-nil, THRESHOLD is a buffer position. Synchronization +stops as soon as a shifted element begins after it. + +When non-nil, TIME-LIMIT is a time value. Synchronization stops +after this time or when Emacs exits idle state. + +When non-nil, FUTURE-CHANGE is a buffer position where changes +not registered yet in the cache are going to happen. See +`org-element--cache-submit-request' for more information. + +Throw `interrupt' if the process stops before completing the +request." + (catch 'quit + (when (= (aref request 5) 0) + ;; Phase 0. + ;; + ;; Delete all elements starting after BEG, but not after buffer + ;; position END or past element with key NEXT. Also delete + ;; elements contained within a previously removed element + ;; (stored in `last-container'). + ;; + ;; At each iteration, we start again at tree root since + ;; a deletion modifies structure of the balanced tree. + (catch 'end-phase + (while t + (when (org-element--cache-interrupt-p time-limit) + (throw 'interrupt nil)) + ;; Find first element in cache with key BEG or after it. + (let ((beg (aref request 0)) + (end (aref request 2)) + (node (org-element--cache-root)) + data data-key last-container) + (while node + (let* ((element (avl-tree--node-data node)) + (key (org-element--cache-key element))) + (cond + ((org-element--cache-key-less-p key beg) + (setq node (avl-tree--node-right node))) + ((org-element--cache-key-less-p beg key) + (setq data element + data-key key + node (avl-tree--node-left node))) + (t (setq data element + data-key key + node nil))))) + (if data + (let ((pos (org-element-property :begin data))) + (if (if (or (not next) + (org-element--cache-key-less-p data-key next)) + (<= pos end) + (and last-container + (let ((up data)) + (while (and up (not (eq up last-container))) + (setq up (org-element-property :parent up))) + up))) + (progn (when (and (not last-container) + (> (org-element-property :end data) + end)) + (setq last-container data)) + (org-element--cache-remove data)) + (aset request 0 data-key) + (aset request 1 pos) + (aset request 5 1) + (throw 'end-phase nil))) + ;; No element starting after modifications left in + ;; cache: further processing is futile. + (throw 'quit t)))))) + (when (= (aref request 5) 1) + ;; Phase 1. + ;; + ;; Phase 0 left a hole in the cache. Some elements after it + ;; could have parents within. For example, in the following + ;; buffer: + ;; + ;; - item + ;; + ;; + ;; Paragraph1 + ;; + ;; Paragraph2 + ;; + ;; if we remove a blank line between "item" and "Paragraph1", + ;; everything down to "Paragraph2" is removed from cache. But + ;; the paragraph now belongs to the list, and its `:parent' + ;; property no longer is accurate. + ;; + ;; Therefore we need to parse again elements in the hole, or at + ;; least in its last section, so that we can re-parent + ;; subsequent elements, during phase 2. + ;; + ;; Note that we only need to get the parent from the first + ;; element in cache after the hole. + ;; + ;; When next key is lesser or equal to the current one, delegate + ;; phase 1 processing to next request in order to preserve key + ;; order among requests. + (let ((key (aref request 0))) + (when (and next (not (org-element--cache-key-less-p key next))) + (let ((next-request (nth 1 org-element--cache-sync-requests))) + (aset next-request 0 key) + (aset next-request 1 (aref request 1)) + (aset next-request 5 1)) + (throw 'quit t))) + ;; Next element will start at its beginning position plus + ;; offset, since it hasn't been shifted yet. Therefore, LIMIT + ;; contains the real beginning position of the first element to + ;; shift and re-parent. + (let ((limit (+ (aref request 1) (aref request 3)))) + (cond ((and threshold (> limit threshold)) (throw 'interrupt nil)) + ((and future-change (>= limit future-change)) + ;; Changes are going to happen around this element and + ;; they will trigger another phase 1 request. Skip the + ;; current one. + (aset request 5 2)) + (t + (let ((parent (org-element--parse-to limit t time-limit))) + (aset request 4 parent) + (aset request 5 2)))))) + ;; Phase 2. + ;; + ;; Shift all elements starting from key START, but before NEXT, by + ;; OFFSET, and re-parent them when appropriate. + ;; + ;; Elements are modified by side-effect so the tree structure + ;; remains intact. + ;; + ;; Once THRESHOLD, if any, is reached, or once there is an input + ;; pending, exit. Before leaving, the current synchronization + ;; request is updated. + (let ((start (aref request 0)) + (offset (aref request 3)) + (parent (aref request 4)) + (node (org-element--cache-root)) + (stack (list nil)) + (leftp t) + exit-flag) + ;; No re-parenting nor shifting planned: request is over. + (when (and (not parent) (zerop offset)) (throw 'quit t)) + (while node + (let* ((data (avl-tree--node-data node)) + (key (org-element--cache-key data))) + (if (and leftp (avl-tree--node-left node) + (not (org-element--cache-key-less-p key start))) + (progn (push node stack) + (setq node (avl-tree--node-left node))) + (unless (org-element--cache-key-less-p key start) + ;; We reached NEXT. Request is complete. + (when (equal key next) (throw 'quit t)) + ;; Handle interruption request. Update current request. + (when (or exit-flag (org-element--cache-interrupt-p time-limit)) + (aset request 0 key) + (aset request 4 parent) + (throw 'interrupt nil)) + ;; Shift element. + (unless (zerop offset) + (org-element--cache-shift-positions data offset)) + (let ((begin (org-element-property :begin data))) + ;; Update PARENT and re-parent DATA, only when + ;; necessary. Propagate new structures for lists. + (while (and parent + (<= (org-element-property :end parent) begin)) + (setq parent (org-element-property :parent parent))) + (cond ((and (not parent) (zerop offset)) (throw 'quit nil)) + ((and parent + (let ((p (org-element-property :parent data))) + (or (not p) + (< (org-element-property :begin p) + (org-element-property :begin parent))))) + (org-element-put-property data :parent parent) + (let ((s (org-element-property :structure parent))) + (when (and s (org-element-property :structure data)) + (org-element-put-property data :structure s))))) + ;; Cache is up-to-date past THRESHOLD. Request + ;; interruption. + (when (and threshold (> begin threshold)) (setq exit-flag t)))) + (setq node (if (setq leftp (avl-tree--node-right node)) + (avl-tree--node-right node) + (pop stack)))))) + ;; We reached end of tree: synchronization complete. + t))) + +(defun org-element--parse-to (pos &optional syncp time-limit) + "Parse elements in current section, down to POS. + +Start parsing from the closest between the last known element in +cache or headline above. Return the smallest element containing +POS. + +When optional argument SYNCP is non-nil, return the parent of the +element containing POS instead. In that case, it is also +possible to provide TIME-LIMIT, which is a time value specifying +when the parsing should stop. The function throws `interrupt' if +the process stopped before finding the expected result." + (catch 'exit + (org-with-wide-buffer + (goto-char pos) + (let* ((cached (and (org-element--cache-active-p) + (org-element--cache-find pos nil))) + (begin (org-element-property :begin cached)) + element next mode) + (cond + ;; Nothing in cache before point: start parsing from first + ;; element following headline above, or first element in + ;; buffer. + ((not cached) + (if (org-with-limited-levels (outline-previous-heading)) + (progn + (setq mode 'planning) + (forward-line)) + (setq mode 'top-comment)) + (skip-chars-forward " \r\t\n") + (beginning-of-line)) + ;; Cache returned exact match: return it. + ((= pos begin) + (throw 'exit (if syncp (org-element-property :parent cached) cached))) + ;; There's a headline between cached value and POS: cached + ;; value is invalid. Start parsing from first element + ;; following the headline. + ((re-search-backward + (org-with-limited-levels org-outline-regexp-bol) begin t) + (forward-line) + (skip-chars-forward " \r\t\n") + (beginning-of-line) + (setq mode 'planning)) + ;; Check if CACHED or any of its ancestors contain point. + ;; + ;; If there is such an element, we inspect it in order to know + ;; if we return it or if we need to parse its contents. + ;; Otherwise, we just start parsing from current location, + ;; which is right after the top-most element containing + ;; CACHED. + ;; + ;; As a special case, if POS is at the end of the buffer, we + ;; want to return the innermost element ending there. + ;; + ;; Also, if we find an ancestor and discover that we need to + ;; parse its contents, make sure we don't start from + ;; `:contents-begin', as we would otherwise go past CACHED + ;; again. Instead, in that situation, we will resume parsing + ;; from NEXT, which is located after CACHED or its higher + ;; ancestor not containing point. + (t + (let ((up cached) + (pos (if (= (point-max) pos) (1- pos) pos))) + (goto-char (or (org-element-property :contents-begin cached) begin)) + (while (let ((end (org-element-property :end up))) + (and (<= end pos) + (goto-char end) + (setq up (org-element-property :parent up))))) + (cond ((not up)) + ((eobp) (setq element up)) + (t (setq element up next (point))))))) + ;; Parse successively each element until we reach POS. + (let ((end (or (org-element-property :end element) + (save-excursion + (org-with-limited-levels (outline-next-heading)) + (point)))) + (parent element)) + (while t + (when syncp + (cond ((= (point) pos) (throw 'exit parent)) + ((org-element--cache-interrupt-p time-limit) + (throw 'interrupt nil)))) + (unless element + (setq element (org-element--current-element + end 'element mode + (org-element-property :structure parent))) + (org-element-put-property element :parent parent) + (org-element--cache-put element)) + (let ((elem-end (org-element-property :end element)) + (type (org-element-type element))) + (cond + ;; Skip any element ending before point. Also skip + ;; element ending at point (unless it is also the end of + ;; buffer) since we're sure that another element begins + ;; after it. + ((and (<= elem-end pos) (/= (point-max) elem-end)) + (goto-char elem-end) + (setq mode (org-element--next-mode mode type nil))) + ;; A non-greater element contains point: return it. + ((not (memq type org-element-greater-elements)) + (throw 'exit element)) + ;; Otherwise, we have to decide if ELEMENT really + ;; contains POS. In that case we start parsing from + ;; contents' beginning. + ;; + ;; If POS is at contents' beginning but it is also at + ;; the beginning of the first item in a list or a table. + ;; In that case, we need to create an anchor for that + ;; list or table, so return it. + ;; + ;; Also, if POS is at the end of the buffer, no element + ;; can start after it, but more than one may end there. + ;; Arbitrarily, we choose to return the innermost of + ;; such elements. + ((let ((cbeg (org-element-property :contents-begin element)) + (cend (org-element-property :contents-end element))) + (when (or syncp + (and cbeg cend + (or (< cbeg pos) + (and (= cbeg pos) + (not (memq type '(plain-list table))))) + (or (> cend pos) + (and (= cend pos) (= (point-max) pos))))) + (goto-char (or next cbeg)) + (setq next nil + mode (org-element--next-mode mode type t) + parent element + end cend)))) + ;; Otherwise, return ELEMENT as it is the smallest + ;; element containing POS. + (t (throw 'exit element)))) + (setq element nil))))))) + + +;;;; Staging Buffer Changes + +(defconst org-element--cache-sensitive-re + (concat + "^\\*+ " "\\|" + "\\\\end{[A-Za-z0-9*]+}[ \t]*$" "\\|" + "^[ \t]*\\(?:" + "#\\+\\(?:BEGIN[:_]\\|END\\(?:_\\|:?[ \t]*$\\)\\)" "\\|" + "\\\\begin{[A-Za-z0-9*]+}" "\\|" + ":\\(?:\\w\\|[-_]\\)+:[ \t]*$" + "\\)") + "Regexp matching a sensitive line, structure wise. +A sensitive line is a headline, inlinetask, block, drawer, or +latex-environment boundary. When such a line is modified, +structure changes in the document may propagate in the whole +section, possibly making cache invalid.") + +(defvar org-element--cache-change-warning nil + "Non-nil when a sensitive line is about to be changed. +It is a symbol among nil, t and `headline'.") + +(defun org-element--cache-before-change (beg end) + "Request extension of area going to be modified if needed. +BEG and END are the beginning and end of the range of changed +text. See `before-change-functions' for more information." + (when (org-element--cache-active-p) + (org-with-wide-buffer + (goto-char beg) + (beginning-of-line) + (let ((bottom (save-excursion (goto-char end) (line-end-position)))) + (setq org-element--cache-change-warning + (save-match-data + (if (and (org-with-limited-levels (org-at-heading-p)) + (= (line-end-position) bottom)) + 'headline + (let ((case-fold-search t)) + (re-search-forward + org-element--cache-sensitive-re bottom t))))))))) + +(defun org-element--cache-after-change (beg end pre) + "Update buffer modifications for current buffer. +BEG and END are the beginning and end of the range of changed +text, and the length in bytes of the pre-change text replaced by +that range. See `after-change-functions' for more information." + (when (org-element--cache-active-p) + (org-with-wide-buffer + (goto-char beg) + (beginning-of-line) + (save-match-data + (let ((top (point)) + (bottom (save-excursion (goto-char end) (line-end-position)))) + ;; Determine if modified area needs to be extended, according + ;; to both previous and current state. We make a special + ;; case for headline editing: if a headline is modified but + ;; not removed, do not extend. + (when (pcase org-element--cache-change-warning + (`t t) + (`headline + (not (and (org-with-limited-levels (org-at-heading-p)) + (= (line-end-position) bottom)))) + (_ + (let ((case-fold-search t)) + (re-search-forward + org-element--cache-sensitive-re bottom t)))) + ;; Effectively extend modified area. + (org-with-limited-levels + (setq top (progn (goto-char top) + (when (outline-previous-heading) (forward-line)) + (point))) + (setq bottom (progn (goto-char bottom) + (if (outline-next-heading) (1- (point)) + (point)))))) + ;; Store synchronization request. + (let ((offset (- end beg pre))) + (org-element--cache-submit-request top (- bottom offset) offset))))) + ;; Activate a timer to process the request during idle time. + (org-element--cache-set-timer (current-buffer)))) + +(defun org-element--cache-for-removal (beg end offset) + "Return first element to remove from cache. + +BEG and END are buffer positions delimiting buffer modifications. +OFFSET is the size of the changes. + +Returned element is usually the first element in cache containing +any position between BEG and END. As an exception, greater +elements around the changes that are robust to contents +modifications are preserved and updated according to the +changes." + (let* ((elements (org-element--cache-find (1- beg) 'both)) + (before (car elements)) + (after (cdr elements))) + (if (not before) after + (let ((up before) + (robust-flag t)) + (while up + (if (let ((type (org-element-type up))) + (and (or (memq type '(center-block dynamic-block quote-block + special-block)) + ;; Drawers named "PROPERTIES" are probably + ;; a properties drawer being edited. Force + ;; parsing to check if editing is over. + (and (eq type 'drawer) + (not (string= + (org-element-property :drawer-name up) + "PROPERTIES")))) + (let ((cbeg (org-element-property :contents-begin up))) + (and cbeg + (<= cbeg beg) + (> (org-element-property :contents-end up) end))))) + ;; UP is a robust greater element containing changes. + ;; We only need to extend its ending boundaries. + (org-element--cache-shift-positions + up offset '(:contents-end :end)) + (setq before up) + (when robust-flag (setq robust-flag nil))) + (setq up (org-element-property :parent up))) + ;; We're at top level element containing ELEMENT: if it's + ;; altered by buffer modifications, it is first element in + ;; cache to be removed. Otherwise, that first element is the + ;; following one. + ;; + ;; As a special case, do not remove BEFORE if it is a robust + ;; container for current changes. + (if (or (< (org-element-property :end before) beg) robust-flag) after + before))))) + +(defun org-element--cache-submit-request (beg end offset) + "Submit a new cache synchronization request for current buffer. +BEG and END are buffer positions delimiting the minimal area +where cache data should be removed. OFFSET is the size of the +change, as an integer." + (let ((next (car org-element--cache-sync-requests)) + delete-to delete-from) + (if (and next + (zerop (aref next 5)) + (> (setq delete-to (+ (aref next 2) (aref next 3))) end) + (<= (setq delete-from (aref next 1)) end)) + ;; Current changes can be merged with first sync request: we + ;; can save a partial cache synchronization. + (progn + (cl-incf (aref next 3) offset) + ;; If last change happened within area to be removed, extend + ;; boundaries of robust parents, if any. Otherwise, find + ;; first element to remove and update request accordingly. + (if (> beg delete-from) + (let ((up (aref next 4))) + (while up + (org-element--cache-shift-positions + up offset '(:contents-end :end)) + (setq up (org-element-property :parent up)))) + (let ((first (org-element--cache-for-removal beg delete-to offset))) + (when first + (aset next 0 (org-element--cache-key first)) + (aset next 1 (org-element-property :begin first)) + (aset next 4 (org-element-property :parent first)))))) + ;; Ensure cache is correct up to END. Also make sure that NEXT, + ;; if any, is no longer a 0-phase request, thus ensuring that + ;; phases are properly ordered. We need to provide OFFSET as + ;; optional parameter since current modifications are not known + ;; yet to the otherwise correct part of the cache (i.e, before + ;; the first request). + (when next (org-element--cache-sync (current-buffer) end beg)) + (let ((first (org-element--cache-for-removal beg end offset))) + (if first + (push (let ((beg (org-element-property :begin first)) + (key (org-element--cache-key first))) + (cond + ;; When changes happen before the first known + ;; element, re-parent and shift the rest of the + ;; cache. + ((> beg end) (vector key beg nil offset nil 1)) + ;; Otherwise, we find the first non robust + ;; element containing END. All elements between + ;; FIRST and this one are to be removed. + ((let ((first-end (org-element-property :end first))) + (and (> first-end end) + (vector key beg first-end offset first 0)))) + (t + (let* ((element (org-element--cache-find end)) + (end (org-element-property :end element)) + (up element)) + (while (and (setq up (org-element-property :parent up)) + (>= (org-element-property :begin up) beg)) + (setq end (org-element-property :end up) + element up)) + (vector key beg end offset element 0))))) + org-element--cache-sync-requests) + ;; No element to remove. No need to re-parent either. + ;; Simply shift additional elements, if any, by OFFSET. + (when org-element--cache-sync-requests + (cl-incf (aref (car org-element--cache-sync-requests) 3) + offset))))))) + + +;;;; Public Functions + +;;;###autoload +(defun org-element-cache-reset (&optional all) + "Reset cache in current buffer. +When optional argument ALL is non-nil, reset cache in all Org +buffers." + (interactive "P") + (dolist (buffer (if all (buffer-list) (list (current-buffer)))) + (with-current-buffer buffer + (when (and org-element-use-cache (derived-mode-p 'org-mode)) + (setq-local org-element--cache + (avl-tree-create #'org-element--cache-compare)) + (setq-local org-element--cache-sync-keys + (make-hash-table :weakness 'key :test #'eq)) + (setq-local org-element--cache-change-warning nil) + (setq-local org-element--cache-sync-requests nil) + (setq-local org-element--cache-sync-timer nil) + (add-hook 'before-change-functions + #'org-element--cache-before-change nil t) + (add-hook 'after-change-functions + #'org-element--cache-after-change nil t))))) + +;;;###autoload +(defun org-element-cache-refresh (pos) + "Refresh cache at position POS." + (when (org-element--cache-active-p) + (org-element--cache-sync (current-buffer) pos) + (org-element--cache-submit-request pos pos 0) + (org-element--cache-set-timer (current-buffer)))) + + + +;;; The Toolbox +;; +;; The first move is to implement a way to obtain the smallest element +;; containing point. This is the job of `org-element-at-point'. It +;; basically jumps back to the beginning of section containing point +;; and proceed, one element after the other, with +;; `org-element--current-element' until the container is found. Note: +;; When using `org-element-at-point', secondary values are never +;; parsed since the function focuses on elements, not on objects. +;; +;; At a deeper level, `org-element-context' lists all elements and +;; objects containing point. +;; +;; `org-element-nested-p' and `org-element-swap-A-B' may be used +;; internally by navigation and manipulation tools. + + +;;;###autoload +(defun org-element-at-point () + "Determine closest element around point. + +Return value is a list like (TYPE PROPS) where TYPE is the type +of the element and PROPS a plist of properties associated to the +element. + +Possible types are defined in `org-element-all-elements'. +Properties depend on element or object type, but always include +`:begin', `:end', and `:post-blank' properties. + +As a special case, if point is at the very beginning of the first +item in a list or sub-list, returned element will be that list +instead of the item. Likewise, if point is at the beginning of +the first row of a table, returned element will be the table +instead of the first row. + +When point is at the end of the buffer, return the innermost +element ending there." + (org-with-wide-buffer + (let ((origin (point))) + (end-of-line) + (skip-chars-backward " \r\t\n") + (cond + ;; Within blank lines at the beginning of buffer, return nil. + ((bobp) nil) + ;; Within blank lines right after a headline, return that + ;; headline. + ((org-with-limited-levels (org-at-heading-p)) + (beginning-of-line) + (org-element-headline-parser (point-max) t)) + ;; Otherwise parse until we find element containing ORIGIN. + (t + (when (org-element--cache-active-p) + (if (not org-element--cache) (org-element-cache-reset) + (org-element--cache-sync (current-buffer) origin))) + (org-element--parse-to origin)))))) + +;;;###autoload +(defun org-element-context (&optional element) + "Return smallest element or object around point. + +Return value is a list like (TYPE PROPS) where TYPE is the type +of the element or object and PROPS a plist of properties +associated to it. + +Possible types are defined in `org-element-all-elements' and +`org-element-all-objects'. Properties depend on element or +object type, but always include `:begin', `:end', `:parent' and +`:post-blank'. + +As a special case, if point is right after an object and not at +the beginning of any other object, return that object. + +Optional argument ELEMENT, when non-nil, is the closest element +containing point, as returned by `org-element-at-point'. +Providing it allows for quicker computation." + (catch 'objects-forbidden + (org-with-wide-buffer + (let* ((pos (point)) + (element (or element (org-element-at-point))) + (type (org-element-type element)) + (post (org-element-property :post-affiliated element))) + ;; If point is inside an element containing objects or + ;; a secondary string, narrow buffer to the container and + ;; proceed with parsing. Otherwise, return ELEMENT. + (cond + ;; At a parsed affiliated keyword, check if we're inside main + ;; or dual value. + ((and post (< pos post)) + (beginning-of-line) + (let ((case-fold-search t)) (looking-at org-element--affiliated-re)) + (cond + ((not (member-ignore-case (match-string 1) + org-element-parsed-keywords)) + (throw 'objects-forbidden element)) + ((< (match-end 0) pos) + (narrow-to-region (match-end 0) (line-end-position))) + ((and (match-beginning 2) + (>= pos (match-beginning 2)) + (< pos (match-end 2))) + (narrow-to-region (match-beginning 2) (match-end 2))) + (t (throw 'objects-forbidden element))) + ;; Also change type to retrieve correct restrictions. + (setq type 'keyword)) + ;; At an item, objects can only be located within tag, if any. + ((eq type 'item) + (let ((tag (org-element-property :tag element))) + (if (or (not tag) (/= (line-beginning-position) post)) + (throw 'objects-forbidden element) + (beginning-of-line) + (search-forward tag (line-end-position)) + (goto-char (match-beginning 0)) + (if (and (>= pos (point)) (< pos (match-end 0))) + (narrow-to-region (point) (match-end 0)) + (throw 'objects-forbidden element))))) + ;; At an headline or inlinetask, objects are in title. + ((memq type '(headline inlinetask)) + (let ((case-fold-search nil)) + (goto-char (org-element-property :begin element)) + (looking-at org-complex-heading-regexp) + (let ((end (match-end 4))) + (if (not end) (throw 'objects-forbidden element) + (goto-char (match-beginning 4)) + (when (looking-at org-comment-string) + (goto-char (match-end 0))) + (if (>= (point) end) (throw 'objects-forbidden element) + (narrow-to-region (point) end)))))) + ;; At a paragraph, a table-row or a verse block, objects are + ;; located within their contents. + ((memq type '(paragraph table-row verse-block)) + (let ((cbeg (org-element-property :contents-begin element)) + (cend (org-element-property :contents-end element))) + ;; CBEG is nil for table rules. + (if (and cbeg cend (>= pos cbeg) + (or (< pos cend) (and (= pos cend) (eobp)))) + (narrow-to-region cbeg cend) + (throw 'objects-forbidden element)))) + (t (throw 'objects-forbidden element))) + (goto-char (point-min)) + (let ((restriction (org-element-restriction type)) + (parent element) + last) + (catch 'exit + (while t + (let ((next (org-element--object-lex restriction))) + (when next (org-element-put-property next :parent parent)) + ;; Process NEXT, if any, in order to know if we need to + ;; skip it, return it or move into it. + (if (or (not next) (> (org-element-property :begin next) pos)) + (throw 'exit (or last parent)) + (let ((end (org-element-property :end next)) + (cbeg (org-element-property :contents-begin next)) + (cend (org-element-property :contents-end next))) + (cond + ;; Skip objects ending before point. Also skip + ;; objects ending at point unless it is also the + ;; end of buffer, since we want to return the + ;; innermost object. + ((and (<= end pos) (/= (point-max) end)) + (goto-char end) + ;; For convenience, when object ends at POS, + ;; without any space, store it in LAST, as we + ;; will return it if no object starts here. + (when (and (= end pos) + (not (memq (char-before) '(?\s ?\t)))) + (setq last next))) + ;; If POS is within a container object, move into + ;; that object. + ((and cbeg cend + (>= pos cbeg) + (or (< pos cend) + ;; At contents' end, if there is no + ;; space before point, also move into + ;; object, for consistency with + ;; convenience feature above. + (and (= pos cend) + (or (= (point-max) pos) + (not (memq (char-before pos) + '(?\s ?\t))))))) + (goto-char cbeg) + (narrow-to-region (point) cend) + (setq parent next) + (setq restriction (org-element-restriction next))) + ;; Otherwise, return NEXT. + (t (throw 'exit next))))))))))))) + +(defun org-element-lineage (datum &optional types with-self) + "List all ancestors of a given element or object. + +DATUM is an object or element. + +Return ancestors from the closest to the farthest. When optional +argument TYPES is a list of symbols, return the first element or +object in the lineage whose type belongs to that list instead. + +When optional argument WITH-SELF is non-nil, lineage includes +DATUM itself as the first element, and TYPES, if provided, also +apply to it. + +When DATUM is obtained through `org-element-context' or +`org-element-at-point', only ancestors from its section can be +found. There is no such limitation when DATUM belongs to a full +parse tree." + (let ((up (if with-self datum (org-element-property :parent datum))) + ancestors) + (while (and up (not (memq (org-element-type up) types))) + (unless types (push up ancestors)) + (setq up (org-element-property :parent up))) + (if types up (nreverse ancestors)))) + +(defun org-element-nested-p (elem-A elem-B) + "Non-nil when elements ELEM-A and ELEM-B are nested." + (let ((beg-A (org-element-property :begin elem-A)) + (beg-B (org-element-property :begin elem-B)) + (end-A (org-element-property :end elem-A)) + (end-B (org-element-property :end elem-B))) + (or (and (>= beg-A beg-B) (<= end-A end-B)) + (and (>= beg-B beg-A) (<= end-B end-A))))) + +(defun org-element-swap-A-B (elem-A elem-B) + "Swap elements ELEM-A and ELEM-B. +Assume ELEM-B is after ELEM-A in the buffer. Leave point at the +end of ELEM-A." + (goto-char (org-element-property :begin elem-A)) + ;; There are two special cases when an element doesn't start at bol: + ;; the first paragraph in an item or in a footnote definition. + (let ((specialp (not (bolp)))) + ;; Only a paragraph without any affiliated keyword can be moved at + ;; ELEM-A position in such a situation. Note that the case of + ;; a footnote definition is impossible: it cannot contain two + ;; paragraphs in a row because it cannot contain a blank line. + (when (and specialp + (or (not (eq (org-element-type elem-B) 'paragraph)) + (/= (org-element-property :begin elem-B) + (org-element-property :contents-begin elem-B)))) + (error "Cannot swap elements")) + ;; In a special situation, ELEM-A will have no indentation. We'll + ;; give it ELEM-B's (which will in, in turn, have no indentation). + (let* ((ind-B (when specialp + (goto-char (org-element-property :begin elem-B)) + (current-indentation))) + (beg-A (org-element-property :begin elem-A)) + (end-A (save-excursion + (goto-char (org-element-property :end elem-A)) + (skip-chars-backward " \r\t\n") + (point-at-eol))) + (beg-B (org-element-property :begin elem-B)) + (end-B (save-excursion + (goto-char (org-element-property :end elem-B)) + (skip-chars-backward " \r\t\n") + (point-at-eol))) + ;; Store inner overlays responsible for visibility status. + ;; We also need to store their boundaries as they will be + ;; removed from buffer. + (overlays + (cons + (delq nil + (mapcar (lambda (o) + (and (>= (overlay-start o) beg-A) + (<= (overlay-end o) end-A) + (list o (overlay-start o) (overlay-end o)))) + (overlays-in beg-A end-A))) + (delq nil + (mapcar (lambda (o) + (and (>= (overlay-start o) beg-B) + (<= (overlay-end o) end-B) + (list o (overlay-start o) (overlay-end o)))) + (overlays-in beg-B end-B))))) + ;; Get contents. + (body-A (buffer-substring beg-A end-A)) + (body-B (delete-and-extract-region beg-B end-B))) + (goto-char beg-B) + (when specialp + (setq body-B (replace-regexp-in-string "\\`[ \t]*" "" body-B)) + (indent-to-column ind-B)) + (insert body-A) + ;; Restore ex ELEM-A overlays. + (let ((offset (- beg-B beg-A))) + (dolist (o (car overlays)) + (move-overlay (car o) (+ (nth 1 o) offset) (+ (nth 2 o) offset))) + (goto-char beg-A) + (delete-region beg-A end-A) + (insert body-B) + ;; Restore ex ELEM-B overlays. + (dolist (o (cdr overlays)) + (move-overlay (car o) (- (nth 1 o) offset) (- (nth 2 o) offset)))) + (goto-char (org-element-property :end elem-B))))) + + +(provide 'org-element) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-element.el ends here diff --git a/elpa/org-9.5.2/org-element.elc b/elpa/org-9.5.2/org-element.elc new file mode 100644 index 0000000..71ad8df Binary files /dev/null and b/elpa/org-9.5.2/org-element.elc differ diff --git a/elpa/org-9.5.2/org-entities.el b/elpa/org-9.5.2/org-entities.el new file mode 100644 index 0000000..9c5f626 --- /dev/null +++ b/elpa/org-9.5.2/org-entities.el @@ -0,0 +1,602 @@ +;;; org-entities.el --- Support for Special Entities -*- lexical-binding: t; -*- + +;; Copyright (C) 2010-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik , +;; Ulf Stegemann +;; Keywords: outlines, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;;; Code: + +(declare-function org-mode "org" ()) +(declare-function org-toggle-pretty-entities "org" ()) +(declare-function org-table-align "org-table" ()) + +(defgroup org-entities nil + "Options concerning entities in Org mode." + :tag "Org Entities" + :group 'org) + +(defun org-entities--user-safe-p (v) + "Non-nil if V is a safe value for `org-entities-user'." + (pcase v + (`nil t) + (`(,(and (pred stringp) + (pred (string-match-p "\\`[a-zA-Z][a-zA-Z0-9]*\\'"))) + ,(pred stringp) ,(pred booleanp) ,(pred stringp) + ,(pred stringp) ,(pred stringp) ,(pred stringp)) + t) + (_ nil))) + +(defcustom org-entities-user nil + "User-defined entities used in Org to produce special characters. +Each entry in this list is a list of strings. It associates the name +of the entity that can be inserted into an Org file as \\name with the +appropriate replacements for the different export backends. The order +of the fields is the following + +name As a string, without the leading backslash. +LaTeX replacement In ready LaTeX, no further processing will take place. +LaTeX mathp Either t or nil. When t this entity needs to be in + math mode. +HTML replacement In ready HTML, no further processing will take place. + Usually this will be an &...; entity. +ASCII replacement Plain ASCII, no extensions. +Latin1 replacement Use the special characters available in latin1. +utf-8 replacement Use the special characters available in utf-8. + +If you define new entities here that require specific LaTeX +packages to be loaded, add these packages to `org-latex-packages-alist'." + :group 'org-entities + :version "24.1" + :type '(repeat + (list + (string :tag "name ") + (string :tag "LaTeX ") + (boolean :tag "Require LaTeX math?") + (string :tag "HTML ") + (string :tag "ASCII ") + (string :tag "Latin1") + (string :tag "utf-8 "))) + :safe #'org-entities--user-safe-p) + +(defconst org-entities + (append + '("* Letters" + "** Latin" + ("Agrave" "\\`{A}" nil "À" "A" "À" "À") + ("agrave" "\\`{a}" nil "à" "a" "à" "à") + ("Aacute" "\\'{A}" nil "Á" "A" "Á" "Á") + ("aacute" "\\'{a}" nil "á" "a" "á" "á") + ("Acirc" "\\^{A}" nil "Â" "A" "Â" "Â") + ("acirc" "\\^{a}" nil "â" "a" "â" "â") + ("Amacr" "\\bar{A}" nil "Ā" "A" "Ã" "Ã") + ("amacr" "\\bar{a}" nil "ā" "a" "ã" "ã") + ("Atilde" "\\~{A}" nil "Ã" "A" "Ã" "Ã") + ("atilde" "\\~{a}" nil "ã" "a" "ã" "ã") + ("Auml" "\\\"{A}" nil "Ä" "Ae" "Ä" "Ä") + ("auml" "\\\"{a}" nil "ä" "ae" "ä" "ä") + ("Aring" "\\AA{}" nil "Å" "A" "Å" "Å") + ("AA" "\\AA{}" nil "Å" "A" "Å" "Å") + ("aring" "\\aa{}" nil "å" "a" "å" "å") + ("AElig" "\\AE{}" nil "Æ" "AE" "Æ" "Æ") + ("aelig" "\\ae{}" nil "æ" "ae" "æ" "æ") + ("Ccedil" "\\c{C}" nil "Ç" "C" "Ç" "Ç") + ("ccedil" "\\c{c}" nil "ç" "c" "ç" "ç") + ("Egrave" "\\`{E}" nil "È" "E" "È" "È") + ("egrave" "\\`{e}" nil "è" "e" "è" "è") + ("Eacute" "\\'{E}" nil "É" "E" "É" "É") + ("eacute" "\\'{e}" nil "é" "e" "é" "é") + ("Ecirc" "\\^{E}" nil "Ê" "E" "Ê" "Ê") + ("ecirc" "\\^{e}" nil "ê" "e" "ê" "ê") + ("Euml" "\\\"{E}" nil "Ë" "E" "Ë" "Ë") + ("euml" "\\\"{e}" nil "ë" "e" "ë" "ë") + ("Igrave" "\\`{I}" nil "Ì" "I" "Ì" "Ì") + ("igrave" "\\`{i}" nil "ì" "i" "ì" "ì") + ("Iacute" "\\'{I}" nil "Í" "I" "Í" "Í") + ("iacute" "\\'{i}" nil "í" "i" "í" "í") + ("Idot" "\\.{I}" nil "&idot;" "I" "İ" "İ") + ("inodot" "\\i" nil "ı" "i" "ı" "ı") + ("Icirc" "\\^{I}" nil "Î" "I" "Î" "Î") + ("icirc" "\\^{i}" nil "î" "i" "î" "î") + ("Iuml" "\\\"{I}" nil "Ï" "I" "Ï" "Ï") + ("iuml" "\\\"{i}" nil "ï" "i" "ï" "ï") + ("Ntilde" "\\~{N}" nil "Ñ" "N" "Ñ" "Ñ") + ("ntilde" "\\~{n}" nil "ñ" "n" "ñ" "ñ") + ("Ograve" "\\`{O}" nil "Ò" "O" "Ò" "Ò") + ("ograve" "\\`{o}" nil "ò" "o" "ò" "ò") + ("Oacute" "\\'{O}" nil "Ó" "O" "Ó" "Ó") + ("oacute" "\\'{o}" nil "ó" "o" "ó" "ó") + ("Ocirc" "\\^{O}" nil "Ô" "O" "Ô" "Ô") + ("ocirc" "\\^{o}" nil "ô" "o" "ô" "ô") + ("Otilde" "\\~{O}" nil "Õ" "O" "Õ" "Õ") + ("otilde" "\\~{o}" nil "õ" "o" "õ" "õ") + ("Ouml" "\\\"{O}" nil "Ö" "Oe" "Ö" "Ö") + ("ouml" "\\\"{o}" nil "ö" "oe" "ö" "ö") + ("Oslash" "\\O" nil "Ø" "O" "Ø" "Ø") + ("oslash" "\\o{}" nil "ø" "o" "ø" "ø") + ("OElig" "\\OE{}" nil "Œ" "OE" "OE" "Œ") + ("oelig" "\\oe{}" nil "œ" "oe" "oe" "œ") + ("Scaron" "\\v{S}" nil "Š" "S" "S" "Š") + ("scaron" "\\v{s}" nil "š" "s" "s" "š") + ("szlig" "\\ss{}" nil "ß" "ss" "ß" "ß") + ("Ugrave" "\\`{U}" nil "Ù" "U" "Ù" "Ù") + ("ugrave" "\\`{u}" nil "ù" "u" "ù" "ù") + ("Uacute" "\\'{U}" nil "Ú" "U" "Ú" "Ú") + ("uacute" "\\'{u}" nil "ú" "u" "ú" "ú") + ("Ucirc" "\\^{U}" nil "Û" "U" "Û" "Û") + ("ucirc" "\\^{u}" nil "û" "u" "û" "û") + ("Uuml" "\\\"{U}" nil "Ü" "Ue" "Ü" "Ü") + ("uuml" "\\\"{u}" nil "ü" "ue" "ü" "ü") + ("Yacute" "\\'{Y}" nil "Ý" "Y" "Ý" "Ý") + ("yacute" "\\'{y}" nil "ý" "y" "ý" "ý") + ("Yuml" "\\\"{Y}" nil "Ÿ" "Y" "Y" "Ÿ") + ("yuml" "\\\"{y}" nil "ÿ" "y" "ÿ" "ÿ") + + "** Latin (special face)" + ("fnof" "\\textit{f}" nil "ƒ" "f" "f" "ƒ") + ("real" "\\Re" t "ℜ" "R" "R" "ℜ") + ("image" "\\Im" t "ℑ" "I" "I" "ℑ") + ("weierp" "\\wp" t "℘" "P" "P" "℘") + ("ell" "\\ell" t "ℓ" "ell" "ell" "ℓ") + ("imath" "\\imath" t "ı" "[dotless i]" "dotless i" "ı") + ("jmath" "\\jmath" t "ȷ" "[dotless j]" "dotless j" "ȷ") + + "** Greek" + ("Alpha" "A" nil "Α" "Alpha" "Alpha" "Α") + ("alpha" "\\alpha" t "α" "alpha" "alpha" "α") + ("Beta" "B" nil "Β" "Beta" "Beta" "Β") + ("beta" "\\beta" t "β" "beta" "beta" "β") + ("Gamma" "\\Gamma" t "Γ" "Gamma" "Gamma" "Γ") + ("gamma" "\\gamma" t "γ" "gamma" "gamma" "γ") + ("Delta" "\\Delta" t "Δ" "Delta" "Delta" "Δ") + ("delta" "\\delta" t "δ" "delta" "delta" "δ") + ("Epsilon" "E" nil "Ε" "Epsilon" "Epsilon" "Ε") + ("epsilon" "\\epsilon" t "ε" "epsilon" "epsilon" "ε") + ("varepsilon" "\\varepsilon" t "ε" "varepsilon" "varepsilon" "ε") + ("Zeta" "Z" nil "Ζ" "Zeta" "Zeta" "Ζ") + ("zeta" "\\zeta" t "ζ" "zeta" "zeta" "ζ") + ("Eta" "H" nil "Η" "Eta" "Eta" "Η") + ("eta" "\\eta" t "η" "eta" "eta" "η") + ("Theta" "\\Theta" t "Θ" "Theta" "Theta" "Θ") + ("theta" "\\theta" t "θ" "theta" "theta" "θ") + ("thetasym" "\\vartheta" t "ϑ" "theta" "theta" "ϑ") + ("vartheta" "\\vartheta" t "ϑ" "theta" "theta" "ϑ") + ("Iota" "I" nil "Ι" "Iota" "Iota" "Ι") + ("iota" "\\iota" t "ι" "iota" "iota" "ι") + ("Kappa" "K" nil "Κ" "Kappa" "Kappa" "Κ") + ("kappa" "\\kappa" t "κ" "kappa" "kappa" "κ") + ("Lambda" "\\Lambda" t "Λ" "Lambda" "Lambda" "Λ") + ("lambda" "\\lambda" t "λ" "lambda" "lambda" "λ") + ("Mu" "M" nil "Μ" "Mu" "Mu" "Μ") + ("mu" "\\mu" t "μ" "mu" "mu" "μ") + ("nu" "\\nu" t "ν" "nu" "nu" "ν") + ("Nu" "N" nil "Ν" "Nu" "Nu" "Ν") + ("Xi" "\\Xi" t "Ξ" "Xi" "Xi" "Ξ") + ("xi" "\\xi" t "ξ" "xi" "xi" "ξ") + ("Omicron" "O" nil "Ο" "Omicron" "Omicron" "Ο") + ("omicron" "\\textit{o}" nil "ο" "omicron" "omicron" "ο") + ("Pi" "\\Pi" t "Π" "Pi" "Pi" "Π") + ("pi" "\\pi" t "π" "pi" "pi" "π") + ("Rho" "P" nil "Ρ" "Rho" "Rho" "Ρ") + ("rho" "\\rho" t "ρ" "rho" "rho" "ρ") + ("Sigma" "\\Sigma" t "Σ" "Sigma" "Sigma" "Σ") + ("sigma" "\\sigma" t "σ" "sigma" "sigma" "σ") + ("sigmaf" "\\varsigma" t "ς" "sigmaf" "sigmaf" "ς") + ("varsigma" "\\varsigma" t "ς" "varsigma" "varsigma" "ς") + ("Tau" "T" nil "Τ" "Tau" "Tau" "Τ") + ("Upsilon" "\\Upsilon" t "Υ" "Upsilon" "Upsilon" "Υ") + ("upsih" "\\Upsilon" t "ϒ" "upsilon" "upsilon" "ϒ") + ("upsilon" "\\upsilon" t "υ" "upsilon" "upsilon" "υ") + ("Phi" "\\Phi" t "Φ" "Phi" "Phi" "Φ") + ("phi" "\\phi" t "φ" "phi" "phi" "ɸ") + ("varphi" "\\varphi" t "ϕ" "varphi" "varphi" "φ") + ("Chi" "X" nil "Χ" "Chi" "Chi" "Χ") + ("chi" "\\chi" t "χ" "chi" "chi" "χ") + ("acutex" "\\acute x" t "´x" "'x" "'x" "𝑥́") + ("Psi" "\\Psi" t "Ψ" "Psi" "Psi" "Ψ") + ("psi" "\\psi" t "ψ" "psi" "psi" "ψ") + ("tau" "\\tau" t "τ" "tau" "tau" "τ") + ("Omega" "\\Omega" t "Ω" "Omega" "Omega" "Ω") + ("omega" "\\omega" t "ω" "omega" "omega" "ω") + ("piv" "\\varpi" t "ϖ" "omega-pi" "omega-pi" "ϖ") + ("varpi" "\\varpi" t "ϖ" "omega-pi" "omega-pi" "ϖ") + ("partial" "\\partial" t "∂" "[partial differential]" "[partial differential]" "∂") + + "** Hebrew" + ("alefsym" "\\aleph" t "ℵ" "aleph" "aleph" "ℵ") + ("aleph" "\\aleph" t "ℵ" "aleph" "aleph" "ℵ") + ("gimel" "\\gimel" t "ℷ" "gimel" "gimel" "ℷ") + ("beth" "\\beth" t "ℶ" "beth" "beth" "ב") + ("dalet" "\\daleth" t "ℸ" "dalet" "dalet" "ד") + + "** Icelandic" + ("ETH" "\\DH{}" nil "Ð" "D" "Ð" "Ð") + ("eth" "\\dh{}" nil "ð" "dh" "ð" "ð") + ("THORN" "\\TH{}" nil "Þ" "TH" "Þ" "Þ") + ("thorn" "\\th{}" nil "þ" "th" "þ" "þ") + + "* Punctuation" + "** Dots and Marks" + ("dots" "\\dots{}" nil "…" "..." "..." "…") + ("cdots" "\\cdots{}" t "⋯" "..." "..." "⋯") + ("hellip" "\\dots{}" nil "…" "..." "..." "…") + ("middot" "\\textperiodcentered{}" nil "·" "." "·" "·") + ("iexcl" "!`" nil "¡" "!" "¡" "¡") + ("iquest" "?`" nil "¿" "?" "¿" "¿") + + "** Dash-like" + ("shy" "\\-" nil "­" "" "" "") + ("ndash" "--" nil "–" "-" "-" "–") + ("mdash" "---" nil "—" "--" "--" "—") + + "** Quotations" + ("quot" "\\textquotedbl{}" nil """ "\"" "\"" "\"") + ("acute" "\\textasciiacute{}" nil "´" "'" "´" "´") + ("ldquo" "\\textquotedblleft{}" nil "“" "\"" "\"" "“") + ("rdquo" "\\textquotedblright{}" nil "”" "\"" "\"" "”") + ("bdquo" "\\quotedblbase{}" nil "„" "\"" "\"" "„") + ("lsquo" "\\textquoteleft{}" nil "‘" "`" "`" "‘") + ("rsquo" "\\textquoteright{}" nil "’" "'" "'" "’") + ("sbquo" "\\quotesinglbase{}" nil "‚" "," "," "‚") + ("laquo" "\\guillemotleft{}" nil "«" "<<" "«" "«") + ("raquo" "\\guillemotright{}" nil "»" ">>" "»" "»") + ("lsaquo" "\\guilsinglleft{}" nil "‹" "<" "<" "‹") + ("rsaquo" "\\guilsinglright{}" nil "›" ">" ">" "›") + + "* Other" + "** Misc. (often used)" + ("circ" "\\^{}" nil "ˆ" "^" "^" "∘") + ("vert" "\\vert{}" t "|" "|" "|" "|") + ("vbar" "|" nil "|" "|" "|" "|") + ("brvbar" "\\textbrokenbar{}" nil "¦" "|" "¦" "¦") + ("S" "\\S" nil "§" "paragraph" "§" "§") + ("sect" "\\S" nil "§" "paragraph" "§" "§") + ("amp" "\\&" nil "&" "&" "&" "&") + ("lt" "\\textless{}" nil "<" "<" "<" "<") + ("gt" "\\textgreater{}" nil ">" ">" ">" ">") + ("tilde" "\\textasciitilde{}" nil "~" "~" "~" "~") + ("slash" "/" nil "/" "/" "/" "/") + ("plus" "+" nil "+" "+" "+" "+") + ("under" "\\_" nil "_" "_" "_" "_") + ("equal" "=" nil "=" "=" "=" "=") + ("asciicirc" "\\textasciicircum{}" nil "^" "^" "^" "^") + ("dagger" "\\textdagger{}" nil "†" "[dagger]" "[dagger]" "†") + ("dag" "\\dag{}" nil "†" "[dagger]" "[dagger]" "†") + ("Dagger" "\\textdaggerdbl{}" nil "‡" "[doubledagger]" "[doubledagger]" "‡") + ("ddag" "\\ddag{}" nil "‡" "[doubledagger]" "[doubledagger]" "‡") + + "** Whitespace" + ("nbsp" "~" nil " " " " "\x00A0" "\x00A0") + ("ensp" "\\hspace*{.5em}" nil " " " " " " " ") + ("emsp" "\\hspace*{1em}" nil " " " " " " " ") + ("thinsp" "\\hspace*{.2em}" nil " " " " " " " ") + + "** Currency" + ("curren" "\\textcurrency{}" nil "¤" "curr." "¤" "¤") + ("cent" "\\textcent{}" nil "¢" "cent" "¢" "¢") + ("pound" "\\pounds{}" nil "£" "pound" "£" "£") + ("yen" "\\textyen{}" nil "¥" "yen" "¥" "¥") + ("euro" "\\texteuro{}" nil "€" "EUR" "EUR" "€") + ("EUR" "\\texteuro{}" nil "€" "EUR" "EUR" "€") + ("dollar" "\\$" nil "$" "$" "$" "$") + ("USD" "\\$" nil "$" "$" "$" "$") + + "** Property Marks" + ("copy" "\\textcopyright{}" nil "©" "(c)" "©" "©") + ("reg" "\\textregistered{}" nil "®" "(r)" "®" "®") + ("trade" "\\texttrademark{}" nil "™" "TM" "TM" "™") + + "** Science et al." + ("minus" "\\minus" t "−" "-" "-" "−") + ("pm" "\\textpm{}" nil "±" "+-" "±" "±") + ("plusmn" "\\textpm{}" nil "±" "+-" "±" "±") + ("times" "\\texttimes{}" nil "×" "*" "×" "×") + ("frasl" "/" nil "⁄" "/" "/" "⁄") + ("colon" "\\colon" t ":" ":" ":" ":") + ("div" "\\textdiv{}" nil "÷" "/" "÷" "÷") + ("frac12" "\\textonehalf{}" nil "½" "1/2" "½" "½") + ("frac14" "\\textonequarter{}" nil "¼" "1/4" "¼" "¼") + ("frac34" "\\textthreequarters{}" nil "¾" "3/4" "¾" "¾") + ("permil" "\\textperthousand{}" nil "‰" "per thousand" "per thousand" "‰") + ("sup1" "\\textonesuperior{}" nil "¹" "^1" "¹" "¹") + ("sup2" "\\texttwosuperior{}" nil "²" "^2" "²" "²") + ("sup3" "\\textthreesuperior{}" nil "³" "^3" "³" "³") + ("radic" "\\sqrt{\\,}" t "√" "[square root]" "[square root]" "√") + ("sum" "\\sum" t "∑" "[sum]" "[sum]" "∑") + ("prod" "\\prod" t "∏" "[product]" "[n-ary product]" "∏") + ("micro" "\\textmu{}" nil "µ" "micro" "µ" "µ") + ("macr" "\\textasciimacron{}" nil "¯" "[macron]" "¯" "¯") + ("deg" "\\textdegree{}" nil "°" "degree" "°" "°") + ("prime" "\\prime" t "′" "'" "'" "′") + ("Prime" "\\prime{}\\prime" t "″" "''" "''" "″") + ("infin" "\\infty" t "∞" "[infinity]" "[infinity]" "∞") + ("infty" "\\infty" t "∞" "[infinity]" "[infinity]" "∞") + ("prop" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") + ("propto" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") + ("not" "\\textlnot{}" nil "¬" "[angled dash]" "¬" "¬") + ("neg" "\\neg{}" t "¬" "[angled dash]" "¬" "¬") + ("land" "\\land" t "∧" "[logical and]" "[logical and]" "∧") + ("wedge" "\\wedge" t "∧" "[logical and]" "[logical and]" "∧") + ("lor" "\\lor" t "∨" "[logical or]" "[logical or]" "∨") + ("vee" "\\vee" t "∨" "[logical or]" "[logical or]" "∨") + ("cap" "\\cap" t "∩" "[intersection]" "[intersection]" "∩") + ("cup" "\\cup" t "∪" "[union]" "[union]" "∪") + ("smile" "\\smile" t "⌣" "[cup product]" "[cup product]" "⌣") + ("frown" "\\frown" t "⌢" "[Cap product]" "[cap product]" "⌢") + ("int" "\\int" t "∫" "[integral]" "[integral]" "∫") + ("therefore" "\\therefore" t "∴" "[therefore]" "[therefore]" "∴") + ("there4" "\\therefore" t "∴" "[therefore]" "[therefore]" "∴") + ("because" "\\because" t "∵" "[because]" "[because]" "∵") + ("sim" "\\sim" t "∼" "~" "~" "∼") + ("cong" "\\cong" t "≅" "[approx. equal to]" "[approx. equal to]" "≅") + ("simeq" "\\simeq" t "≅" "[approx. equal to]" "[approx. equal to]" "≅") + ("asymp" "\\asymp" t "≈" "[almost equal to]" "[almost equal to]" "≈") + ("approx" "\\approx" t "≈" "[almost equal to]" "[almost equal to]" "≈") + ("ne" "\\ne" t "≠" "[not equal to]" "[not equal to]" "≠") + ("neq" "\\neq" t "≠" "[not equal to]" "[not equal to]" "≠") + ("equiv" "\\equiv" t "≡" "[identical to]" "[identical to]" "≡") + + ("triangleq" "\\triangleq" t "≜" "[defined to]" "[defined to]" "≜") + ("le" "\\le" t "≤" "<=" "<=" "≤") + ("leq" "\\le" t "≤" "<=" "<=" "≤") + ("ge" "\\ge" t "≥" ">=" ">=" "≥") + ("geq" "\\ge" t "≥" ">=" ">=" "≥") + ("lessgtr" "\\lessgtr" t "≶" "[less than or greater than]" "[less than or greater than]" "≶") + ("lesseqgtr" "\\lesseqgtr" t "⋚" "[less than or equal or greater than or equal]" "[less than or equal or greater than or equal]" "⋚") + ("ll" "\\ll" t "≪" "<<" "<<" "≪") + ("Ll" "\\lll" t "⋘" "<<<" "<<<" "⋘") + ("lll" "\\lll" t "⋘" "<<<" "<<<" "⋘") + ("gg" "\\gg" t "≫" ">>" ">>" "≫") + ("Gg" "\\ggg" t "⋙" ">>>" ">>>" "⋙") + ("ggg" "\\ggg" t "⋙" ">>>" ">>>" "⋙") + ("prec" "\\prec" t "≺" "[precedes]" "[precedes]" "≺") + ("preceq" "\\preceq" t "≼" "[precedes or equal]" "[precedes or equal]" "≼") + ("preccurlyeq" "\\preccurlyeq" t "≼" "[precedes or equal]" "[precedes or equal]" "≼") + ("succ" "\\succ" t "≻" "[succeeds]" "[succeeds]" "≻") + ("succeq" "\\succeq" t "≽" "[succeeds or equal]" "[succeeds or equal]" "≽") + ("succcurlyeq" "\\succcurlyeq" t "≽" "[succeeds or equal]" "[succeeds or equal]" "≽") + ("sub" "\\subset" t "⊂" "[subset of]" "[subset of]" "⊂") + ("subset" "\\subset" t "⊂" "[subset of]" "[subset of]" "⊂") + ("sup" "\\supset" t "⊃" "[superset of]" "[superset of]" "⊃") + ("supset" "\\supset" t "⊃" "[superset of]" "[superset of]" "⊃") + ("nsub" "\\not\\subset" t "⊄" "[not a subset of]" "[not a subset of" "⊄") + ("sube" "\\subseteq" t "⊆" "[subset of or equal to]" "[subset of or equal to]" "⊆") + ("nsup" "\\not\\supset" t "⊅" "[not a superset of]" "[not a superset of]" "⊅") + ("supe" "\\supseteq" t "⊇" "[superset of or equal to]" "[superset of or equal to]" "⊇") + ("setminus" "\\setminus" t "∖" "\" "\" "⧵") + ("forall" "\\forall" t "∀" "[for all]" "[for all]" "∀") + ("exist" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") + ("exists" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") + ("nexist" "\\nexists" t "∃" "[there does not exists]" "[there does not exists]" "∄") + ("nexists" "\\nexists" t "∃" "[there does not exists]" "[there does not exists]" "∄") + ("empty" "\\emptyset" t "∅" "[empty set]" "[empty set]" "∅") + ("emptyset" "\\emptyset" t "∅" "[empty set]" "[empty set]" "∅") + ("isin" "\\in" t "∈" "[element of]" "[element of]" "∈") + ("in" "\\in" t "∈" "[element of]" "[element of]" "∈") + ("notin" "\\notin" t "∉" "[not an element of]" "[not an element of]" "∉") + ("ni" "\\ni" t "∋" "[contains as member]" "[contains as member]" "∋") + ("nabla" "\\nabla" t "∇" "[nabla]" "[nabla]" "∇") + ("ang" "\\angle" t "∠" "[angle]" "[angle]" "∠") + ("angle" "\\angle" t "∠" "[angle]" "[angle]" "∠") + ("perp" "\\perp" t "⊥" "[up tack]" "[up tack]" "⊥") + ("parallel" "\\parallel" t "∥" "||" "||" "∥") + ("sdot" "\\cdot" t "⋅" "[dot]" "[dot]" "⋅") + ("cdot" "\\cdot" t "⋅" "[dot]" "[dot]" "⋅") + ("lceil" "\\lceil" t "⌈" "[left ceiling]" "[left ceiling]" "⌈") + ("rceil" "\\rceil" t "⌉" "[right ceiling]" "[right ceiling]" "⌉") + ("lfloor" "\\lfloor" t "⌊" "[left floor]" "[left floor]" "⌊") + ("rfloor" "\\rfloor" t "⌋" "[right floor]" "[right floor]" "⌋") + ("lang" "\\langle" t "⟨" "<" "<" "⟨") + ("rang" "\\rangle" t "⟩" ">" ">" "⟩") + ("langle" "\\langle" t "⟨" "<" "<" "⟨") + ("rangle" "\\rangle" t "⟩" ">" ">" "⟩") + ("hbar" "\\hbar" t "ℏ" "hbar" "hbar" "ℏ") + ("mho" "\\mho" t "℧" "mho" "mho" "℧") + + "** Arrows" + ("larr" "\\leftarrow" t "←" "<-" "<-" "←") + ("leftarrow" "\\leftarrow" t "←" "<-" "<-" "←") + ("gets" "\\gets" t "←" "<-" "<-" "←") + ("lArr" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") + ("Leftarrow" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") + ("uarr" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") + ("uparrow" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") + ("uArr" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") + ("Uparrow" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") + ("rarr" "\\rightarrow" t "→" "->" "->" "→") + ("to" "\\to" t "→" "->" "->" "→") + ("rightarrow" "\\rightarrow" t "→" "->" "->" "→") + ("rArr" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") + ("Rightarrow" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") + ("darr" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") + ("downarrow" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") + ("dArr" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") + ("Downarrow" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") + ("harr" "\\leftrightarrow" t "↔" "<->" "<->" "↔") + ("leftrightarrow" "\\leftrightarrow" t "↔" "<->" "<->" "↔") + ("hArr" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") + ("Leftrightarrow" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") + ("crarr" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") + ("hookleftarrow" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") + + "** Function names" + ("arccos" "\\arccos" t "arccos" "arccos" "arccos" "arccos") + ("arcsin" "\\arcsin" t "arcsin" "arcsin" "arcsin" "arcsin") + ("arctan" "\\arctan" t "arctan" "arctan" "arctan" "arctan") + ("arg" "\\arg" t "arg" "arg" "arg" "arg") + ("cos" "\\cos" t "cos" "cos" "cos" "cos") + ("cosh" "\\cosh" t "cosh" "cosh" "cosh" "cosh") + ("cot" "\\cot" t "cot" "cot" "cot" "cot") + ("coth" "\\coth" t "coth" "coth" "coth" "coth") + ("csc" "\\csc" t "csc" "csc" "csc" "csc") + ("deg" "\\deg" t "°" "deg" "deg" "deg") + ("det" "\\det" t "det" "det" "det" "det") + ("dim" "\\dim" t "dim" "dim" "dim" "dim") + ("exp" "\\exp" t "exp" "exp" "exp" "exp") + ("gcd" "\\gcd" t "gcd" "gcd" "gcd" "gcd") + ("hom" "\\hom" t "hom" "hom" "hom" "hom") + ("inf" "\\inf" t "inf" "inf" "inf" "inf") + ("ker" "\\ker" t "ker" "ker" "ker" "ker") + ("lg" "\\lg" t "lg" "lg" "lg" "lg") + ("lim" "\\lim" t "lim" "lim" "lim" "lim") + ("liminf" "\\liminf" t "liminf" "liminf" "liminf" "liminf") + ("limsup" "\\limsup" t "limsup" "limsup" "limsup" "limsup") + ("ln" "\\ln" t "ln" "ln" "ln" "ln") + ("log" "\\log" t "log" "log" "log" "log") + ("max" "\\max" t "max" "max" "max" "max") + ("min" "\\min" t "min" "min" "min" "min") + ("Pr" "\\Pr" t "Pr" "Pr" "Pr" "Pr") + ("sec" "\\sec" t "sec" "sec" "sec" "sec") + ("sin" "\\sin" t "sin" "sin" "sin" "sin") + ("sinh" "\\sinh" t "sinh" "sinh" "sinh" "sinh") + ("sup" "\\sup" t "⊃" "sup" "sup" "sup") + ("tan" "\\tan" t "tan" "tan" "tan" "tan") + ("tanh" "\\tanh" t "tanh" "tanh" "tanh" "tanh") + + "** Signs & Symbols" + ("bull" "\\textbullet{}" nil "•" "*" "*" "•") + ("bullet" "\\textbullet{}" nil "•" "*" "*" "•") + ("star" "\\star" t "*" "*" "*" "⋆") + ("lowast" "\\ast" t "∗" "*" "*" "∗") + ("ast" "\\ast" t "∗" "*" "*" "*") + ("odot" "\\odot" t "o" "[circled dot]" "[circled dot]" "ʘ") + ("oplus" "\\oplus" t "⊕" "[circled plus]" "[circled plus]" "⊕") + ("otimes" "\\otimes" t "⊗" "[circled times]" "[circled times]" "⊗") + ("check" "\\checkmark" t "✓" "[checkmark]" "[checkmark]" "✓") + ("checkmark" "\\checkmark" t "✓" "[checkmark]" "[checkmark]" "✓") + + "** Miscellaneous (seldom used)" + ("para" "\\P{}" nil "¶" "[pilcrow]" "¶" "¶") + ("ordf" "\\textordfeminine{}" nil "ª" "_a_" "ª" "ª") + ("ordm" "\\textordmasculine{}" nil "º" "_o_" "º" "º") + ("cedil" "\\c{}" nil "¸" "[cedilla]" "¸" "¸") + ("oline" "\\overline{~}" t "‾" "[overline]" "¯" "‾") + ("uml" "\\textasciidieresis{}" nil "¨" "[diaeresis]" "¨" "¨") + ("zwnj" "\\/{}" nil "‌" "" "" "‌") + ("zwj" "" nil "‍" "" "" "‍") + ("lrm" "" nil "‎" "" "" "‎") + ("rlm" "" nil "‏" "" "" "‏") + + "** Smilies" + ("smiley" "\\ddot\\smile" t "☺" ":-)" ":-)" "☺") + ("blacksmile" "\\ddot\\smile" t "☻" ":-)" ":-)" "☻") + ("sad" "\\ddot\\frown" t "☹" ":-(" ":-(" "☹") + ("frowny" "\\ddot\\frown" t "☹" ":-(" ":-(" "☹") + + "** Suits" + ("clubs" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") + ("clubsuit" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") + ("spades" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") + ("spadesuit" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") + ("hearts" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") + ("heartsuit" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") + ("diams" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "◆") + ("diamondsuit" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "◆") + ("diamond" "\\diamondsuit" t "⋄" "[diamond]" "[diamond]" "◆") + ("Diamond" "\\diamondsuit" t "⋄" "[diamond]" "[diamond]" "◆") + ("loz" "\\lozenge" t "◊" "[lozenge]" "[lozenge]" "⧫")) + ;; Add "\_ "-entity family for spaces. + (let (space-entities html-spaces (entity "_")) + (dolist (n (number-sequence 1 20) (nreverse space-entities)) + (let ((spaces (make-string n ?\s))) + (push (list (setq entity (concat entity " ")) + (format "\\hspace*{%sem}" (* n .5)) + nil + (setq html-spaces (concat " " html-spaces)) + spaces + spaces + (make-string n ?\x2002)) + space-entities))))) + "Default entities used in Org mode to produce special characters. +For details see `org-entities-user'.") + +(defsubst org-entity-get (name) + "Get the proper association for NAME from the entity lists. +This first checks the user list, then the built-in list." + (or (assoc name org-entities-user) + (assoc name org-entities))) + +;; Helpfunctions to create a table for orgmode.org/worg/org-symbols.org + +(defun org-entities-create-table () + "Create an Org mode table with all entities." + (interactive) + (let ((pos (point))) + (insert "|Name|LaTeX code|LaTeX|HTML code |HTML|ASCII|Latin1|UTF-8\n|-\n") + (dolist (e org-entities) + (pcase e + (`(,name ,latex ,mathp ,html ,ascii ,latin ,utf8) + (when (equal ascii "|") (setq ascii "\\vert")) + (when (equal latin "|") (setq latin "\\vert")) + (when (equal utf8 "|") (setq utf8 "\\vert")) + (when (equal ascii "=>") (setq ascii "= >")) + (when (equal latin "=>") (setq latin "= >")) + (insert "|" name + "|" (format "=%s=" latex) + "|" (format (if mathp "$%s$" "$\\mbox{%s}$") latex) + "|" (format "=%s=" html) "|" html + "|" ascii "|" latin "|" utf8 + "|\n")))) + (goto-char pos) + (org-table-align))) + +(defvar org-pretty-entities) ;; declare defcustom from org +(defun org-entities-help () + "Create a Help buffer with all available entities." + (interactive) + (with-output-to-temp-buffer "*Org Entity Help*" + (princ "Org mode entities\n=================\n\n") + (let ((ll (append '("* User-defined additions (variable org-entities-user)") + org-entities-user + org-entities)) + (lastwasstring t) + (head (concat + "\n" + " Symbol Org entity LaTeX code HTML code\n" + " -----------------------------------------------------------\n"))) + (dolist (e ll) + (pcase e + (`(,name ,latex ,_ ,html ,_ ,_ ,utf8) + (when lastwasstring + (princ head) + (setq lastwasstring nil)) + (princ (format " %-8s \\%-16s %-22s %-13s\n" + utf8 name latex html))) + ((pred stringp) + (princ e) + (princ "\n") + (setq lastwasstring t)))))) + (with-current-buffer "*Org Entity Help*" + (org-mode) + (when org-pretty-entities + (org-toggle-pretty-entities))) + (select-window (get-buffer-window "*Org Entity Help*"))) + + +(provide 'org-entities) + +;; Local variables: +;; coding: utf-8 +;; End: + +;;; org-entities.el ends here diff --git a/elpa/org-9.5.2/org-entities.elc b/elpa/org-9.5.2/org-entities.elc new file mode 100644 index 0000000..f43ecfa Binary files /dev/null and b/elpa/org-9.5.2/org-entities.elc differ diff --git a/elpa/org-9.5.2/org-faces.el b/elpa/org-9.5.2/org-faces.el new file mode 100644 index 0000000..b151045 --- /dev/null +++ b/elpa/org-9.5.2/org-faces.el @@ -0,0 +1,730 @@ +;;; org-faces.el --- Face definitions -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the face definitions for Org. + +;;; Code: + +(defgroup org-faces nil + "Faces in Org mode." + :tag "Org Faces" + :group 'org-appearance) + +(defface org-default '((t :inherit default)) + "Face used for default text." + :group 'org-faces) + +(defface org-hide + '((default :inherit fixed-pitch) + (((background light)) (:foreground "white")) + (((background dark)) (:foreground "black"))) + "Face used to hide leading stars in headlines. +The foreground color of this face should be equal to the background +color of the frame." + :group 'org-faces) + +(defface org-dispatcher-highlight + '((default :weight bold) + (((class color) (min-colors 88) (background dark)) + :background "gray20" :foreground "gold1") + (((class color) (min-colors 88) (background light)) + :background "SlateGray1" :foreground "DarkBlue") + (((class color) (min-colors 16) (background dark)) + :foreground "yellow") + (((class color) (min-colors 16) (background light)) + :foreground "blue") + (t :inverse-video t)) + "Face for highlighted keys in the dispatcher." + :group 'org-faces) + +(defface org-level-1 '((t :inherit outline-1)) + "Face used for level 1 headlines." + :group 'org-faces) + +(defface org-level-2 '((t :inherit outline-2)) + "Face used for level 2 headlines." + :group 'org-faces) + +(defface org-level-3 '((t :inherit outline-3)) + "Face used for level 3 headlines." + :group 'org-faces) + +(defface org-level-4 '((t :inherit outline-4)) + "Face used for level 4 headlines." + :group 'org-faces) + +(defface org-level-5 '((t :inherit outline-5)) + "Face used for level 5 headlines." + :group 'org-faces) + +(defface org-level-6 '((t :inherit outline-6)) + "Face used for level 6 headlines." + :group 'org-faces) + +(defface org-level-7 '((t :inherit outline-7)) + "Face used for level 7 headlines." + :group 'org-faces) + +(defface org-level-8 '((t :inherit outline-8)) + "Face used for level 8 headlines." + :group 'org-faces) + +(defface org-special-keyword '((t :inherit font-lock-keyword-face)) + "Face used for special keywords." + :group 'org-faces) + +(defface org-drawer ;Copied from `font-lock-function-name-face' + '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) + (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) + (((class color) (min-colors 16) (background light)) (:foreground "Blue")) + (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue")) + (((class color) (min-colors 8)) (:foreground "blue" :bold t)) + (t (:bold t))) + "Face used for drawers." + :group 'org-faces) + +(defface org-property-value nil + "Face used for the value of a property." + :group 'org-faces) + +(defface org-column + '((((class color) (min-colors 16) (background light)) + (:background "grey90" :weight normal :slant normal :strike-through nil + :underline nil)) + (((class color) (min-colors 16) (background dark)) + (:background "grey30" :weight normal :slant normal :strike-through nil + :underline nil)) + (((class color) (min-colors 8)) + (:background "cyan" :foreground "black" + :weight normal :slant normal :strike-through nil + :underline nil)) + (t (:inverse-video t))) + "Face for column display of entry properties. +This is actually only part of the face definition for the text in column view. +The following faces apply, with this priority. + +1. The color of the reference face. This is normally the level fact that + is used in the outline. In agenda-mode, it will be the face of the + first character in the line. The color is explicitly retained to + make sure that the column line still looks a bit like the structure + line it is masking. + +2. The `org-column' face. + +3. The remaining properties of the reference face. + +Since column view works by putting overlays with a display property +over individual characters in the buffer, the face of the underlining +character (this might for example be the a TODO keyword) might still +shine through in some properties. So when your column view looks +funny, with \"random\" colors, weight, strike-through, try to explicitly +set the properties in the `org-column' face. For example, set +:underline to nil, or the :slant to `normal'." + :group 'org-faces) + +(defface org-column-title + '((((class color) (min-colors 16) (background light)) + (:background "grey90" :underline t :weight bold)) + (((class color) (min-colors 16) (background dark)) + (:background "grey30" :underline t :weight bold)) + (((class color) (min-colors 8)) + (:background "cyan" :foreground "black" :underline t :weight bold)) + (t (:inverse-video t))) + "Face for column display of entry properties." + :group 'org-faces) + +(defface org-agenda-column-dateline '((t :inherit org-column)) + "Face used in agenda column view for datelines with summaries." + :group 'org-faces) + +(defface org-warning '((t :inherit font-lock-warning-face)) + "Face for deadlines and TODO keywords." + :group 'org-faces) + +(defface org-archived '((t :inherit shadow)) + "Face for headline with the ARCHIVE tag." + :group 'org-faces) + +(defface org-cite '((t :inherit link)) + "Face for citations." + :group 'org-faces) + +(defface org-cite-key '((t :inherit link)) + "Face for citation keys." + :group 'org-faces) + +(defface org-link '((t :inherit link)) + "Face for links." + :group 'org-faces) + +(defface org-footnote + '((((class color) (background light)) (:foreground "Purple" :underline t)) + (((class color) (background dark)) (:foreground "Cyan" :underline t)) + (t (:underline t))) + "Face for footnotes." + :group 'org-faces) + +(defface org-ellipsis + '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t)) + (((class color) (background dark)) (:foreground "LightGoldenrod" :underline t)) + (t (:strike-through t))) + "Face for the ellipsis in folded text." + :group 'org-faces) + +(defface org-target + '((((class color) (background light)) (:underline t)) + (((class color) (background dark)) (:underline t)) + (t (:underline t))) + "Face for link targets." + :group 'org-faces) + +(defface org-date + '((default :inherit fixed-pitch) + (((class color) (background light)) (:foreground "Purple" :underline t)) + (((class color) (background dark)) (:foreground "Cyan" :underline t)) + (t (:underline t))) + "Face for date/time stamps." + :group 'org-faces) + +(defface org-date-selected + '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :inverse-video t)) + (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :inverse-video t)) + (((class color) (min-colors 8) (background light)) (:foreground "red" :inverse-video t)) + (((class color) (min-colors 8) (background dark)) (:foreground "red" :inverse-video t)) + (t (:inverse-video t))) + "Face for highlighting the calendar day when using `org-read-date'. +Using a bold face here might cause discrepancies while displaying the +calendar." + :group 'org-faces) + +(defface org-sexp-date + '((((class color) (background light)) (:foreground "Purple")) + (((class color) (background dark)) (:foreground "Cyan")) + (t (:underline t))) + "Face for diary-like sexp date specifications." + :group 'org-faces) + +(defface org-tag '((t (:bold t))) + "Default face for tags. +Note that the variable `org-tag-faces' can be used to overrule this face for +specific tags." + :group 'org-faces) + +(defface org-list-dt '((t (:bold t))) + "Default face for definition terms in lists." + :group 'org-faces) + +(defface org-todo ;Copied from `font-lock-warning-face' + '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t)) + (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t)) + (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t)) + (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t)) + (t (:inverse-video t :bold t))) + "Face for TODO keywords." + :group 'org-faces) + +(defface org-done ;Copied from `font-lock-type-face' + '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t)) + (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t)) + (((class color) (min-colors 8)) (:foreground "green")) + (t (:bold t))) + "Face used for todo keywords that indicate DONE items." + :group 'org-faces) + +(defface org-agenda-done ;Copied from `font-lock-type-face' + '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen")) + (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen")) + (((class color) (min-colors 8)) (:foreground "green")) + (t (:bold nil))) + "Face used in agenda, to indicate lines switched to DONE. +This face is used to de-emphasize items that where brightly colored in the +agenda because they were things to do, or overdue. The DONE state itself +is of course immediately visible, but for example a passed deadline is +\(by default) very bright read. This face could be simply the default face +of the frame, for example." + :group 'org-faces) + +(defface org-headline-todo ;Copied from `font-lock-string-face' + '((((class color) (min-colors 16) (background light)) (:foreground "Red4")) + (((class color) (min-colors 16) (background dark)) (:foreground "Pink2")) + (((class color) (min-colors 8) (background light)) (:bold t))) + "Face used to indicate that a headline is marked as TODO. +This face is only used if `org-fontify-todo-headline' is set. If applies +to the part of the headline after the TODO keyword." + :group 'org-faces) + +(defface org-headline-done ;Copied from `font-lock-string-face' + '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown")) + (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon")) + (((class color) (min-colors 8) (background light)) (:bold nil))) + "Face used to indicate that a headline is DONE. +This face is only used if `org-fontify-done-headline' is set. If applies +to the part of the headline after the DONE keyword." + :group 'org-faces) + +(defcustom org-faces-easy-properties + '((todo . :foreground) (tag . :foreground) (priority . :foreground)) + "The property changes by easy faces. +This is an alist, the keys show the area of application, the values +can be `:foreground' or `:background'. A color string for special +keywords will then be interpreted as either foreground or background +color." + :group 'org-faces + :group 'org-todo + :version "24.1" + :type '(repeat + (cons (choice (const todo) (const tag) (const priority)) + (choice (const :foreground) (const :background))))) + +(defcustom org-todo-keyword-faces nil + "Faces for specific TODO keywords. +This is a list of cons cells, with TODO keywords in the car +and faces in the cdr. The face can be a symbol, a color +as a string (in which case the rest is inherited from the `org-todo' face), +or a property list of attributes, like + (:foreground \"blue\" :weight bold :underline t). +If it is a color string, the variable `org-faces-easy-properties' +determines if it is a foreground or a background color." + :group 'org-faces + :group 'org-todo + :type '(repeat + (cons + (string :tag "Keyword") + (choice :tag "Face " + (string :tag "Color") + (sexp :tag "Face"))))) + +(defface org-priority '((t :inherit font-lock-keyword-face)) + "Face used for priority cookies." + :group 'org-faces) + +(defcustom org-priority-faces nil + "Faces for specific Priorities. +This is a list of cons cells, with priority character in the car +and faces in the cdr. The face can be a symbol, a color +as a string, or a property list of attributes, like + (:foreground \"blue\" :weight bold :underline t). +If it is a color string, the variable `org-faces-easy-properties' +determines if it is a foreground or a background color." + :group 'org-faces + :group 'org-todo + :type '(repeat + (cons + (character :tag "Priority") + (choice :tag "Face " + (string :tag "Color") + (sexp :tag "Face"))))) + +(defvar org-tags-special-faces-re nil) +(defun org-set-tag-faces (var value) + (set var value) + (if (not value) + (setq org-tags-special-faces-re nil) + (setq org-tags-special-faces-re + (concat ":" (regexp-opt (mapcar #'car value) t) ":")))) + +(defface org-checkbox '((t :inherit bold)) + "Face for checkboxes." + :group 'org-faces) + +(defface org-checkbox-statistics-todo '((t (:inherit org-todo))) + "Face used for unfinished checkbox statistics." + :group 'org-faces) + +(defface org-checkbox-statistics-done '((t (:inherit org-done))) + "Face used for finished checkbox statistics." + :group 'org-faces) + +(defcustom org-tag-faces nil + "Faces for specific tags. +This is a list of cons cells, with tags in the car and faces in the cdr. +The face can be a symbol, a foreground color (in which case the rest is +inherited from the `org-tag' face) or a property list of attributes, +like (:foreground \"blue\" :weight bold :underline t). +If you set this variable through customize, it will immediately be effective +in new buffers and in modified lines. +If you set it with Lisp, a restart of Emacs is required to activate the +changes." + :group 'org-faces + :group 'org-tags + :set 'org-set-tag-faces + :type '(repeat + (cons + (string :tag "Tag ") + (choice :tag "Face" + (string :tag "Foreground color") + (sexp :tag "Face"))))) + +(defface org-table ;Copied from `font-lock-function-name-face' + '((default :inherit fixed-pitch) + (((class color) (min-colors 88) (background light)) (:foreground "Blue1")) + (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) + (((class color) (min-colors 16) (background light)) (:foreground "Blue")) + (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue")) + (((class color) (min-colors 8) (background light)) (:foreground "blue")) + (((class color) (min-colors 8) (background dark)))) + "Face used for tables." + :group 'org-faces) + +(defface org-table-header '((t :inherit org-table + :background "LightGray" + :foreground "Black")) + "Face for table header." + :group 'org-faces) + +(defface org-formula + '((default :inherit fixed-pitch) + (((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) + (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) + (((class color) (min-colors 8) (background light)) (:foreground "red")) + (((class color) (min-colors 8) (background dark)) (:foreground "red")) + (t (:bold t :italic t))) + "Face for formulas." + :group 'org-faces) + +(defface org-code '((t :inherit (fixed-pitch shadow))) + "Face for fixed-width text like code snippets." + :group 'org-faces + :version "22.1") + +(defface org-meta-line '((t :inherit (fixed-pitch font-lock-comment-face))) + "Face for meta lines starting with \"#+\"." + :group 'org-faces + :version "22.1") + +(defface org-document-title + '((((class color) (background light)) (:foreground "midnight blue" :weight bold)) + (((class color) (background dark)) (:foreground "pale turquoise" :weight bold)) + (t (:weight bold))) + "Face for document title, i.e. that which follows the #+TITLE: keyword." + :group 'org-faces) + +(defface org-document-info + '((((class color) (background light)) (:foreground "midnight blue")) + (((class color) (background dark)) (:foreground "pale turquoise")) + (t nil)) + "Face for document information such as the author and date. +This applies to the text that follows a #+SUBTITLE:, #+DATE:, +#+AUTHOR: or #+EMAIL: keyword." + :group 'org-faces) + +(defface org-document-info-keyword '((t :inherit shadow)) + "Face for document information keywords. +This face applies to the #+TITLE:, #+SUBTITLE:, #+AUTHOR:, +#+EMAIL: and #+DATE: keywords." + :group 'org-faces) + +(defface org-block `((t :inherit (fixed-pitch shadow) + ,@(and (>= emacs-major-version 27) '(:extend t)))) + "Face used for text inside various blocks. + +It is always used for source blocks. You can refine what face +should be used depending on the source block language by setting, +`org-src-block-faces', which takes precedence. + +When `org-fontify-quote-and-verse-blocks' is not nil, text inside +verse and quote blocks are fontified using the `org-verse' and +`org-quote' faces, which inherit from `org-block'." + :group 'org-faces + :version "26.1") + +(defface org-block-begin-line '((t (:inherit org-meta-line))) + "Face used for the line delimiting the begin of source blocks." + :group 'org-faces) + +(defface org-block-end-line '((t (:inherit org-block-begin-line))) + "Face used for the line delimiting the end of source blocks." + :group 'org-faces) + +(defface org-verbatim '((t (:inherit (fixed-pitch shadow)))) + "Face for fixed-with text like code snippets." + :group 'org-faces + :version "22.1") + +(defface org-quote '((t (:inherit org-block))) + "Face for #+BEGIN_QUOTE ... #+END_QUOTE blocks. +Active when `org-fontify-quote-and-verse-blocks' is set." + :group 'org-faces) + +(defface org-verse '((t (:inherit org-block))) + "Face for #+BEGIN_VERSE ... #+END_VERSE blocks. +Active when `org-fontify-quote-and-verse-blocks' is set." + :group 'org-faces) + +(defcustom org-fontify-quote-and-verse-blocks nil + "Non-nil means, add a special face to #+begin_quote and #+begin_verse block. +When nil, format these as normal Org. This is the default, because the +content of these blocks will still be treated as Org syntax." + :group 'org-faces + :version "24.1" + :type 'boolean) + +(defface org-clock-overlay ;Copied from `secondary-selection' + '((((class color) (min-colors 88) (background light)) + (:background "LightGray" :foreground "black")) + (((class color) (min-colors 88) (background dark)) + (:background "SkyBlue4" :foreground "white")) + (((class color) (min-colors 16) (background light)) + (:background "gray" :foreground "black")) + (((class color) (min-colors 16) (background dark)) + (:background "SkyBlue4" :foreground "white")) + (((class color) (min-colors 8)) + (:background "cyan" :foreground "black")) + (t (:inverse-video t))) + "Basic face for displaying the secondary selection." + :group 'org-faces) + +(defface org-agenda-structure ;Copied from `font-lock-function-name-face' + '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) + (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) + (((class color) (min-colors 16) (background light)) (:foreground "Blue")) + (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue")) + (((class color) (min-colors 8)) (:foreground "blue" :bold t)) + (t (:bold t))) + "Face used in agenda for captions and dates." + :group 'org-faces) + +(defface org-agenda-structure-secondary '((t (:inherit org-agenda-structure))) + "Face used for secondary information in agenda block headers." + :group 'org-faces) + +(defface org-agenda-structure-filter '((t (:inherit (org-warning org-agenda-structure)))) + "Face used for the current type of task filter in the agenda. +It inherits from `org-agenda-structure' so it can adapt to +it (e.g. if that is assigned a diffent font height or family)." + :group 'org-faces) + +(defface org-agenda-date '((t (:inherit org-agenda-structure))) + "Face used in agenda for normal days." + :group 'org-faces) + +(defface org-agenda-date-today + '((t (:inherit org-agenda-date :weight bold :italic t))) + "Face used in agenda for today." + :group 'org-faces) + +(defface org-agenda-date-weekend-today '((t (:inherit org-agenda-date-today))) + "Face used in agenda for today during weekends." + :group 'org-faces) + +(defface org-agenda-clocking '((t (:inherit secondary-selection))) + "Face marking the current clock item in the agenda." + :group 'org-faces) + +(defface org-agenda-date-weekend '((t (:inherit org-agenda-date :weight bold))) + "Face used in agenda for weekend days. + +See the variable `org-agenda-weekend-days' for a definition of +which days belong to the weekend." + :group 'org-faces) + +(defface org-scheduled + '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen")) + (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen")) + (((class color) (min-colors 8)) (:foreground "green")) + (t (:bold t :italic t))) + "Face for items scheduled for a certain day." + :group 'org-faces) + +(defface org-scheduled-today + '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen")) + (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen")) + (((class color) (min-colors 8)) (:foreground "green")) + (t (:bold t :italic t))) + "Face for items scheduled for a certain day." + :group 'org-faces) + +(defface org-agenda-dimmed-todo-face + '((((background light)) (:foreground "grey50")) + (((background dark)) (:foreground "grey50"))) + "Face used to dim blocked tasks in the agenda." + :group 'org-faces) + +(defface org-scheduled-previously + '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) + (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) + (((class color) (min-colors 8) (background light)) (:foreground "red")) + (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t)) + (t (:bold t))) + "Face for items scheduled previously, and not yet done." + :group 'org-faces) + +(defface org-imminent-deadline '((t :inherit org-warning)) + "Face for current deadlines in the agenda. +See also `org-agenda-deadline-faces'." + :group 'org-faces) + +(defface org-upcoming-deadline + '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) + (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) + (((class color) (min-colors 8) (background light)) (:foreground "red")) + (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t)) + (t (:bold t))) + "Face for items scheduled previously, and not yet done. +See also `org-agenda-deadline-faces'." + :group 'org-faces) + +(defface org-upcoming-distant-deadline '((t :inherit org-default)) + "Face for items scheduled previously, not done, and have a distant deadline. +See also `org-agenda-deadline-faces'.") + +(defcustom org-agenda-deadline-faces + '((1.0 . org-imminent-deadline) + (0.5 . org-upcoming-deadline) + (0.0 . org-upcoming-distant-deadline)) + "Faces for showing deadlines in the agenda. +This is a list of cons cells. The cdr of each cell is a face to be used, +and it can also just be like \\='(:foreground \"yellow\"). +Each car is a fraction of the head-warning time that must have passed for +this the face in the cdr to be used for display. The numbers must be +given in descending order. The head-warning time is normally taken +from `org-deadline-warning-days', but can also be specified in the deadline +timestamp itself, like this: + + DEADLINE: <2007-08-13 Mon -8d> + +You may use d for days, w for weeks, m for months and y for years. Months +and years will only be treated in an approximate fashion (30.4 days for a +month and 365.24 days for a year)." + :group 'org-faces + :group 'org-agenda-daily/weekly + :type '(repeat + (cons + (number :tag "Fraction of head-warning time passed") + (sexp :tag "Face")))) + +(defface org-agenda-restriction-lock + '((((class color) (min-colors 88) (background light)) (:background "#eeeeee")) + (((class color) (min-colors 88) (background dark)) (:background "#1C1C1C")) + (((class color) (min-colors 16) (background light)) (:background "#eeeeee")) + (((class color) (min-colors 16) (background dark)) (:background "#1C1C1C")) + (((class color) (min-colors 8)) (:background "cyan" :foreground "black")) + (t (:inverse-video t))) + "Face for showing the agenda restriction lock." + :group 'org-faces) + +(defface org-agenda-filter-tags '((t :inherit mode-line)) + "Face for tag(s) in the mode-line when filtering the agenda." + :group 'org-faces) + +(defface org-agenda-filter-category '((t :inherit mode-line)) + "Face for categories in the mode-line when filtering the agenda." + :group 'org-faces) + +(defface org-agenda-filter-effort '((t :inherit mode-line)) + "Face for effort in the mode-line when filtering the agenda." + :group 'org-faces) + +(defface org-agenda-filter-regexp '((t :inherit mode-line)) + "Face for regexp(s) in the mode-line when filtering the agenda." + :group 'org-faces) + +(defface org-time-grid ;Copied from `font-lock-variable-name-face' + '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) + (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod")) + (((class color) (min-colors 8)) (:foreground "yellow" :weight light))) + "Face used for time grids." + :group 'org-faces) + +(defface org-agenda-current-time '((t (:inherit org-time-grid))) + "Face used to show the current time in the time grid." + :group 'org-faces) + +(defface org-agenda-diary '((t :inherit default)) + "Face used for agenda entries that come from the Emacs diary." + :group 'org-faces) + +(defface org-agenda-calendar-event '((t :inherit default)) + "Face used to show events and appointments in the agenda." + :group 'org-faces) + +(defface org-agenda-calendar-sexp '((t :inherit default)) + "Face used to show events computed from a S-expression." + :group 'org-faces) + +(defconst org-level-faces + '(org-level-1 org-level-2 org-level-3 org-level-4 + org-level-5 org-level-6 org-level-7 org-level-8)) + +(defcustom org-n-level-faces (length org-level-faces) + "The number of different faces to be used for headlines. +Org mode defines 8 different headline faces, so this can be at most 8. +If it is less than 8, the level-1 face gets re-used for level N+1 etc." + :type 'integer + :group 'org-faces) + +(defcustom org-cycle-level-faces t + "Non-nil means level styles cycle after level `org-n-level-faces'. +Then so level org-n-level-faces+1 is styled like level 1. +If nil, then all levels >= org-n-level-faces are styled like +level org-n-level-faces." + :group 'org-appearance + :group 'org-faces + :version "24.1" + :type 'boolean) + +(defface org-latex-and-related + (let ((font (cond ((assq :inherit custom-face-attributes) + '(:inherit underline)) + (t '(:underline t))))) + `((((class grayscale) (background light)) + (:foreground "DimGray" ,@font)) + (((class grayscale) (background dark)) + (:foreground "LightGray" ,@font)) + (((class color) (background light)) + (:foreground "SaddleBrown")) + (((class color) (background dark)) + (:foreground "burlywood")) + (t (,@font)))) + "Face used to highlight LaTeX data, entities and sub/superscript." + :group 'org-faces + :version "24.4" + :package-version '(Org . "8.0")) + +(defface org-macro '((t :inherit org-latex-and-related)) + "Face for macros." + :group 'org-faces + :version "24.4" + :package-version '(Org . "8.0")) + +(defface org-tag-group '((t :inherit org-tag)) + "Face for group tags." + :group 'org-faces + :version "24.4" + :package-version '(Org . "8.0")) + +(defface org-mode-line-clock '((t (:inherit mode-line))) + "Face used for clock display in mode line." + :group 'org-faces) + +(defface org-mode-line-clock-overrun + '((t (:inherit mode-line :background "red"))) + "Face used for clock display for overrun tasks in mode line." + :group 'org-faces) + +(provide 'org-faces) + +;;; org-faces.el ends here diff --git a/elpa/org-9.5.2/org-faces.elc b/elpa/org-9.5.2/org-faces.elc new file mode 100644 index 0000000..607a866 Binary files /dev/null and b/elpa/org-9.5.2/org-faces.elc differ diff --git a/elpa/org-9.5.2/org-feed.el b/elpa/org-9.5.2/org-feed.el new file mode 100644 index 0000000..5df3b69 --- /dev/null +++ b/elpa/org-9.5.2/org-feed.el @@ -0,0 +1,719 @@ +;;; org-feed.el --- Add RSS feed items to Org files -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; This module allows entries to be created and changed in an Org mode +;; file triggered by items in an RSS feed. The basic functionality +;; is geared toward simply adding new items found in a feed as +;; outline nodes to an Org file. Using hooks, arbitrary actions can +;; be triggered for new or changed items. +;; +;; Selecting feeds and target locations +;; ------------------------------------ +;; +;; This module is configured through a single variable, `org-feed-alist'. +;; Here is an example, using a notes/tasks feed from reQall.com. +;; +;; (setq org-feed-alist +;; '(("ReQall" +;; "http://www.reqall.com/user/feeds/rss/a1b2c3....." +;; "~/org/feeds.org" "ReQall Entries") +;; +;; With this setup, the command `M-x org-feed-update-all' will +;; collect new entries in the feed at the given URL and create +;; entries as subheadings under the "ReQall Entries" heading in the +;; file "~/org/feeds.org". Each feed should normally have its own +;; heading - however see the `:drawer' parameter. +;; +;; Besides these standard elements that need to be specified for each +;; feed, keyword-value pairs can set additional options. For example, +;; to de-select transitional entries with a title containing +;; +;; "reQall is typing what you said", +;; +;; you could use the `:filter' argument: +;; +;; (setq org-feed-alist +;; '(("ReQall" +;; "http://www.reqall.com/user/feeds/rss/a1b2c3....." +;; "~/org/feeds.org" "ReQall Entries" +;; :filter my-reqall-filter))) +;; +;; (defun my-reqall-filter (e) +;; (if (string-match "reQall is typing what you said" +;; (plist-get e :title)) +;; nil +;; e)) +;; +;; See the docstring for `org-feed-alist' for more details. +;; +;; +;; Keeping track of previously added entries +;; ----------------------------------------- +;; +;; Since Org allows you to delete, archive, or move outline nodes, +;; org-feed.el needs to keep track of which feed items have been handled +;; before, so that they will not be handled again. For this, org-feed.el +;; stores information in a special drawer, FEEDSTATUS, under the heading +;; that received the input of the feed. +;; +;; +;; Acknowledgments +;; --------------- +;; +;; org-feed.el is based on ideas by Brad Bozarth who implemented a +;; similar mechanism using shell and awk scripts. + +;;; Code: + +(require 'org) +(require 'sha1) + +(declare-function url-retrieve-synchronously "url" + (url &optional silent inhibit-cookies timeout)) +(declare-function xml-node-children "xml" (node)) +(declare-function xml-get-children "xml" (node child-name)) +(declare-function xml-get-attribute "xml" (node attribute)) +(declare-function xml-get-attribute-or-nil "xml" (node attribute)) +(declare-function xml-substitute-special "xml" (string)) + +(declare-function org-capture-escaped-% "org-capture" ()) +(declare-function org-capture-expand-embedded-elisp "org-capture" (&optional mark)) +(declare-function org-capture-inside-embedded-elisp-p "org-capture" ()) + +(defgroup org-feed nil + "Options concerning RSS feeds as inputs for Org files." + :tag "Org Feed" + :group 'org) + +(defcustom org-feed-alist nil + "Alist specifying RSS feeds that should create inputs for Org. +Each entry in this list specified an RSS feed tat should be queried +to create inbox items in Org. Each entry is a list with the following items: + +name a custom name for this feed +URL the Feed URL +file the target Org file where entries should be listed, when + nil the target becomes the current buffer (may be an + indirect buffer) each time the feed update is invoked +headline the headline under which entries should be listed + +Additional arguments can be given using keyword-value pairs. Many of these +specify functions that receive one or a list of \"entries\" as their single +argument. An entry is a property list that describes a feed item. The +property list has properties for each field in the item, for example `:title' +for the `' field and `:pubDate' for the publication date. In addition, +it contains the following properties: + +`:item-full-text' the full text in the <item> tag +`:guid-permalink' t when the guid property is a permalink + +Here are the keyword-value pair allows in `org-feed-alist'. + +:drawer drawer-name + The name of the drawer for storing feed information. The default is + \"FEEDSTATUS\". Using different drawers for different feeds allows + several feeds to target the same inbox heading. + +:filter filter-function + A function to select interesting entries in the feed. It gets a single + entry as parameter. It should return the entry if it is relevant, or + nil if it is not. + +:template template-string + The default action on new items in the feed is to add them as children + under the headline for the feed. The template describes how the entry + should be formatted. If not given, it defaults to + `org-feed-default-template'. + +:formatter formatter-function + Instead of relying on a template, you may specify a function to format + the outline node to be inserted as a child. This function gets passed + a property list describing a single feed item, and it should return a + string that is a properly formatted Org outline node of level 1. + +:new-handler function + If adding new items as children to the outline is not what you want + to do with new items, define a handler function that is called with + a list of all new items in the feed, each one represented as a property + list. The handler should do what needs to be done, and org-feed will + mark all items given to this handler as \"handled\", i.e. they will not + be passed to this handler again in future readings of the feed. + When the handler is called, point will be at the feed headline. + +:changed-handler function + This function gets passed a list of all entries that have been + handled before, but are now still in the feed and have *changed* + since last handled (as evidenced by a different sha1 hash). + When the handler is called, point will be at the feed headline. + +:parse-feed function + This function gets passed a buffer, and should return a list + of entries, each being a property list containing the + `:guid' and `:item-full-text' keys. The default is + `org-feed-parse-rss-feed'; `org-feed-parse-atom-feed' is an + alternative. + +:parse-entry function + This function gets passed an entry as returned by the parse-feed + function, and should return the entry with interesting properties added. + The default is `org-feed-parse-rss-entry'; `org-feed-parse-atom-entry' + is an alternative." + :group 'org-feed + :type '(repeat + (list :value ("" "http://" "" "") + (string :tag "Name") + (string :tag "Feed URL") + (file :tag "File for inbox") + (string :tag "Headline for inbox") + (repeat :inline t + (choice + (list :inline t :tag "Filter" + (const :filter) + (symbol :tag "Filter Function")) + (list :inline t :tag "Template" + (const :template) + (string :tag "Template")) + (list :inline t :tag "Formatter" + (const :formatter) + (symbol :tag "Formatter Function")) + (list :inline t :tag "New items handler" + (const :new-handler) + (symbol :tag "Handler Function")) + (list :inline t :tag "Changed items" + (const :changed-handler) + (symbol :tag "Handler Function")) + (list :inline t :tag "Parse Feed" + (const :parse-feed) + (symbol :tag "Parse Feed Function")) + (list :inline t :tag "Parse Entry" + (const :parse-entry) + (symbol :tag "Parse Entry Function")) + ))))) + +(defcustom org-feed-drawer "FEEDSTATUS" + "The name of the drawer for feed status information. +Each feed may also specify its own drawer name using the `:drawer' +parameter in `org-feed-alist'." + :group 'org-feed + :type '(string :tag "Drawer Name")) + +(defcustom org-feed-default-template "\n* %h\n %U\n %description\n %a\n" + "Template for the Org node created from RSS feed items. +This is just the default, each feed can specify its own. +Any fields from the feed item can be interpolated into the template with +%name, for example %title, %description, %pubDate etc. In addition, the +following special escapes are valid as well: + +%h The title, or the first line of the description +%t The date as a stamp, either from <pubDate> (if present), or + the current date +%T Date and time +%u,%U Like %t,%T, but inactive time stamps +%a A link, from <guid> if that is a permalink, else from <link> +%(sexp) Evaluate elisp `(sexp)' and replace with the result, the simple + %-escapes above can be used as arguments, e.g. %(capitalize \\\"%h\\\")" + :group 'org-feed + :type '(string :tag "Template")) + +(defcustom org-feed-save-after-adding t + "Non-nil means save buffer after adding new feed items." + :group 'org-feed + :type 'boolean) + +(defcustom org-feed-retrieve-method 'url-retrieve-synchronously + "The method to be used to retrieve a feed URL. +This can be `curl' or `wget' to call these external programs, or it can be +an Emacs Lisp function that will return a buffer containing the content +of the file pointed to by the URL." + :group 'org-feed + :type '(choice + (const :tag "Internally with url.el" url-retrieve-synchronously) + (const :tag "Externally with curl" curl) + (const :tag "Externally with wget" wget) + (function :tag "Function"))) + +(defcustom org-feed-before-adding-hook nil + "Hook that is run before adding new feed items to a file. +You might want to commit the file in its current state to version control, +for example." + :group 'org-feed + :type 'hook) + +(defcustom org-feed-after-adding-hook nil + "Hook that is run after new items have been added to a file. +Depending on `org-feed-save-after-adding', the buffer will already +have been saved." + :group 'org-feed + :type 'hook) + +(defvar org-feed-buffer "*Org feed*" + "The buffer used to retrieve a feed.") + +;;;###autoload +(defun org-feed-update-all () + "Get inbox items from all feeds in `org-feed-alist'." + (interactive) + (let ((entries 0) + (errors 0) + (total-feeds (length org-feed-alist))) + (dolist (feed org-feed-alist) + (let ((items (ignore-errors (org-feed-update feed)))) + (if items (cl-incf entries items) + (cl-incf errors)))) + (message "%s from %d %s%s" + (pcase entries + (0 "No new entries") + (1 "1 new entry") + (_ (format "%d new entries" entries))) + total-feeds + (if (= total-feeds 1) "feed" "feeds") + (if (= 0 errors) "" (format " (unavailable feeds: %d)" errors))))) + +;;;###autoload +(defun org-feed-update (feed &optional retrieve-only) + "Get inbox items from FEED. +FEED can be a string with an association in `org-feed-alist', or +it can be a list structured like an entry in `org-feed-alist'." + (interactive (list (org-completing-read "Feed name: " org-feed-alist))) + (if (stringp feed) (setq feed (assoc feed org-feed-alist))) + (unless feed + (error "No such feed in `org-feed-alist")) + (catch 'exit + (let ((name (car feed)) + (url (nth 1 feed)) + (file (or (nth 2 feed) (buffer-file-name (or (buffer-base-buffer) + (current-buffer))))) + (headline (nth 3 feed)) + (filter (nth 1 (memq :filter feed))) + (formatter (nth 1 (memq :formatter feed))) + (new-handler (nth 1 (memq :new-handler feed))) + (changed-handler (nth 1 (memq :changed-handler feed))) + (template (or (nth 1 (memq :template feed)) + org-feed-default-template)) + (drawer (or (nth 1 (memq :drawer feed)) + org-feed-drawer)) + (parse-feed (or (nth 1 (memq :parse-feed feed)) + 'org-feed-parse-rss-feed)) + (parse-entry (or (nth 1 (memq :parse-entry feed)) + 'org-feed-parse-rss-entry)) + feed-buffer inbox-pos new-formatted + entries old-status status new changed guid-alist guid olds) + (setq feed-buffer (org-feed-get-feed url)) + (unless (and feed-buffer (bufferp (get-buffer feed-buffer))) + (error "Cannot get feed %s" name)) + (when retrieve-only + (throw 'exit feed-buffer)) + (setq entries (funcall parse-feed feed-buffer)) + (ignore-errors (kill-buffer feed-buffer)) + (save-excursion + (save-window-excursion + (setq inbox-pos (org-feed-goto-inbox-internal file headline)) + (setq old-status (org-feed-read-previous-status inbox-pos drawer)) + ;; Add the "handled" status to the appropriate entries + (setq entries (mapcar (lambda (e) + (setq e + (plist-put e :handled + (nth 1 (assoc + (plist-get e :guid) + old-status))))) + entries)) + ;; Find out which entries are new and which are changed + (dolist (e entries) + (if (not (plist-get e :handled)) + (push e new) + (setq olds (nth 2 (assoc (plist-get e :guid) old-status))) + (if (and olds + (not (string= (sha1 + (plist-get e :item-full-text)) + olds))) + (push e changed)))) + + ;; Parse the relevant entries fully + (setq new (mapcar parse-entry new) + changed (mapcar parse-entry changed)) + + ;; Run the filter + (when filter + (setq new (delq nil (mapcar filter new)) + changed (delq nil (mapcar filter new)))) + + (when (not (or new changed)) + (message "No new items in feed %s" name) + (throw 'exit 0)) + + ;; Get alist based on guid, to look up entries + (setq guid-alist + (append + (mapcar (lambda (e) (list (plist-get e :guid) e)) new) + (mapcar (lambda (e) (list (plist-get e :guid) e)) changed))) + + ;; Construct the new status + (setq status + (mapcar + (lambda (e) + (setq guid (plist-get e :guid)) + (list guid + ;; things count as handled if we handle them now, + ;; or if they were handled previously + (if (assoc guid guid-alist) t (plist-get e :handled)) + ;; A hash, to detect changes + (sha1 (plist-get e :item-full-text)))) + entries)) + + ;; Handle new items in the feed + (when new + (if new-handler + (progn + (goto-char inbox-pos) + (funcall new-handler new)) + ;; No custom handler, do the default adding + ;; Format the new entries into an alist with GUIDs in the car + (setq new-formatted + (mapcar + (lambda (e) (org-feed-format-entry e template formatter)) + new))) + + ;; Insert the new items + (org-feed-add-items inbox-pos new-formatted)) + + ;; Handle changed items in the feed + (when (and changed-handler changed) + (goto-char inbox-pos) + (funcall changed-handler changed)) + + ;; Write the new status + ;; We do this only now, in case something goes wrong above, so + ;; that would would end up with a status that does not reflect + ;; which items truly have been handled + (org-feed-write-status inbox-pos drawer status) + + ;; Normalize the visibility of the inbox tree + (goto-char inbox-pos) + (org-flag-subtree t) + (org-show-children) + + ;; Hooks and messages + (when org-feed-save-after-adding (save-buffer)) + (message "Added %d new item%s from feed %s to file %s, heading %s" + (length new) (if (> (length new) 1) "s" "") + name + (file-name-nondirectory file) headline) + (run-hooks 'org-feed-after-adding-hook) + (length new)))))) + +;;;###autoload +(defun org-feed-goto-inbox (feed) + "Go to the inbox that captures the feed named FEED." + (interactive + (list (if (= (length org-feed-alist) 1) + (car org-feed-alist) + (org-completing-read "Feed name: " org-feed-alist)))) + (if (stringp feed) (setq feed (assoc feed org-feed-alist))) + (unless feed + (error "No such feed in `org-feed-alist")) + (org-feed-goto-inbox-internal (nth 2 feed) (nth 3 feed))) + +;;;###autoload +(defun org-feed-show-raw-feed (feed) + "Show the raw feed buffer of a feed." + (interactive + (list (if (= (length org-feed-alist) 1) + (car org-feed-alist) + (org-completing-read "Feed name: " org-feed-alist)))) + (if (stringp feed) (setq feed (assoc feed org-feed-alist))) + (unless feed + (error "No such feed in `org-feed-alist")) + (pop-to-buffer-same-window + (org-feed-update feed 'retrieve-only)) + (goto-char (point-min))) + +(defun org-feed-goto-inbox-internal (file heading) + "Find or create HEADING in FILE. +Switch to that buffer, and return the position of that headline." + (find-file file) + (widen) + (goto-char (point-min)) + (if (re-search-forward + (concat "^\\*+[ \t]+" heading "[ \t]*\\(:.*?:[ \t]*\\)?$") + nil t) + (goto-char (match-beginning 0)) + (goto-char (point-max)) + (insert "\n\n* " heading "\n\n") + (org-back-to-heading t)) + (point)) + +(defun org-feed-read-previous-status (pos drawer) + "Get the alist of old GUIDs from the entry at POS. +This will find DRAWER and extract the alist." + (save-excursion + (goto-char pos) + (let ((end (save-excursion (org-end-of-subtree t t)))) + (if (re-search-forward + (concat "^[ \t]*:" drawer ":[ \t]*\n\\([^\000]*?\\)\n[ \t]*:END:") + end t) + (read (match-string 1)) + nil)))) + +(defun org-feed-write-status (pos drawer status) + "Write the feed STATUS to DRAWER in entry at POS." + (save-excursion + (goto-char pos) + (let ((end (save-excursion (org-end-of-subtree t t)))) + (if (re-search-forward (concat "^[ \t]*:" drawer ":[ \t]*\n") + end t) + (progn + (goto-char (match-end 0)) + (delete-region (point) + (save-excursion + (and (re-search-forward "^[ \t]*:END:" nil t) + (match-beginning 0))))) + (outline-next-heading) + (insert " :" drawer ":\n :END:\n") + (beginning-of-line 0)) + (insert (pp-to-string status))))) + +(defun org-feed-add-items (pos entries) + "Add the formatted items to the headline as POS." + (let (entry level) + (save-excursion + (goto-char pos) + (unless (looking-at org-complex-heading-regexp) + (error "Wrong position")) + (setq level (org-get-valid-level (length (match-string 1)) 1)) + (org-end-of-subtree t t) + (skip-chars-backward " \t\n") + (beginning-of-line 2) + (setq pos (point)) + (while (setq entry (pop entries)) + (org-paste-subtree level entry 'yank)) + (org-mark-ring-push pos)))) + +(defun org-feed-format-entry (entry template formatter) + "Format ENTRY so that it can be inserted into an Org file. +ENTRY is a property list. This function adds a `:formatted-for-org' property +and returns the full property list. +If that property is already present, nothing changes." + (require 'org-capture) + (if formatter (funcall formatter entry) + (let* ((dlines + (org-split-string (or (plist-get entry :description) "???") + "\n")) + (time (or (if (plist-get entry :pubDate) + (org-read-date t t (plist-get entry :pubDate))) + (current-time))) + (v-h (or (plist-get entry :title) (car dlines) "???")) + (v-t (format-time-string (org-time-stamp-format nil nil) time)) + (v-T (format-time-string (org-time-stamp-format t nil) time)) + (v-u (format-time-string (org-time-stamp-format nil t) time)) + (v-U (format-time-string (org-time-stamp-format t t) time)) + (v-a (let ((tmp (or (and (plist-get entry :guid-permalink) + (plist-get entry :guid)) + (plist-get entry :link)))) + (if tmp (format "[[%s]]\n" tmp ) "")))) + (with-temp-buffer + (insert template) + (goto-char (point-min)) + + ;; Mark %() embedded elisp for later evaluation. + (org-capture-expand-embedded-elisp 'mark) + + ;; Simple %-escapes. `org-capture-escaped-%' may modify + ;; buffer and cripple match-data. Use markers instead. + (while (re-search-forward "%\\([a-zA-Z]+\\)" nil t) + (let ((key (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) + (let ((replacement + (pcase key + ("h" v-h) + ("t" v-t) + ("T" v-T) + ("u" v-u) + ("U" v-U) + ("a" v-a) + (name + (let ((v (plist-get entry (intern (concat ":" name))))) + (save-excursion + (save-match-data + (beginning-of-line) + (if (looking-at + (concat "^\\([ \t]*\\)%" name "[ \t]*$")) + (org-feed-make-indented-block + v (current-indentation)) + v)))))))) + (when replacement + (insert + ;; Escape string delimiters within embedded lisp. + (if (org-capture-inside-embedded-elisp-p) + (replace-regexp-in-string "\"" "\\\\\"" replacement) + replacement))))))) + + ;; %() embedded elisp + (org-capture-expand-embedded-elisp) + + (decode-coding-string + (buffer-string) (detect-coding-region (point-min) (point-max) t)))))) + +(defun org-feed-make-indented-block (s n) + "Add indentation of N spaces to a multiline string S." + (if (not (string-match "\n" s)) + s + (mapconcat 'identity + (org-split-string s "\n") + (concat "\n" (make-string n ?\ ))))) + +(defun org-feed-skip-http-headers (buffer) + "Remove HTTP headers from BUFFER, and return it. +Assumes headers are indeed present!" + (with-current-buffer buffer + (widen) + (goto-char (point-min)) + (search-forward "\n\n") + (delete-region (point-min) (point)) + buffer)) + +(defun org-feed-get-feed (url) + "Get the RSS feed file at URL and return the buffer." + (cond + ((eq org-feed-retrieve-method 'url-retrieve-synchronously) + (org-feed-skip-http-headers (url-retrieve-synchronously url))) + ((eq org-feed-retrieve-method 'curl) + (ignore-errors (kill-buffer org-feed-buffer)) + (call-process "curl" nil org-feed-buffer nil "--silent" url) + org-feed-buffer) + ((eq org-feed-retrieve-method 'wget) + (ignore-errors (kill-buffer org-feed-buffer)) + (call-process "wget" nil org-feed-buffer nil "-q" "-O" "-" url) + org-feed-buffer) + ((functionp org-feed-retrieve-method) + (funcall org-feed-retrieve-method url)))) + +(defun org-feed-parse-rss-feed (buffer) + "Parse BUFFER for RSS feed entries. +Returns a list of entries, with each entry a property list, +containing the properties `:guid' and `:item-full-text'." + (require 'xml) + (let ((case-fold-search t) + entries beg end item guid entry) + (with-current-buffer buffer + (widen) + (goto-char (point-min)) + (while (re-search-forward "<item\\>.*?>" nil t) + (setq beg (point) + end (and (re-search-forward "</item>" nil t) + (match-beginning 0))) + (setq item (buffer-substring beg end) + guid (if (string-match "<guid\\>.*?>\\([^\000]*?\\)</guid>" item) + (xml-substitute-special (match-string-no-properties 1 item)))) + (setq entry (list :guid guid :item-full-text item)) + (push entry entries) + (widen) + (goto-char end)) + (nreverse entries)))) + +(defun org-feed-parse-rss-entry (entry) + "Parse the `:item-full-text' field for xml tags and create new properties." + (require 'xml) + (with-temp-buffer + (insert (plist-get entry :item-full-text)) + (goto-char (point-min)) + (while (re-search-forward "<\\([a-zA-Z]+\\>\\).*?>\\([^\000]*?\\)</\\1>" + nil t) + (setq entry (plist-put entry + (intern (concat ":" (match-string 1))) + (xml-substitute-special (match-string 2))))) + (goto-char (point-min)) + (unless (re-search-forward "isPermaLink[ \t]*=[ \t]*\"false\"" nil t) + (setq entry (plist-put entry :guid-permalink t)))) + entry) + +(defun org-feed-parse-atom-feed (buffer) + "Parse BUFFER for Atom feed entries. +Returns a list of entries, with each entry a property list, +containing the properties `:guid' and `:item-full-text'. + +The `:item-full-text' property actually contains the sexp +formatted as a string, not the original XML data." + (require 'xml) + (with-current-buffer buffer + (widen) + (let ((feed (car (xml-parse-region (point-min) (point-max))))) + (mapcar + (lambda (entry) + (list + :guid (car (xml-node-children (car (xml-get-children entry 'id)))) + :item-full-text (prin1-to-string entry))) + (xml-get-children feed 'entry))))) + +(defun org-feed-parse-atom-entry (entry) + "Parse the `:item-full-text' as a sexp and create new properties." + (let ((xml (car (read-from-string (plist-get entry :item-full-text))))) + ;; Get first <link href='foo'/>. + (setq entry (plist-put entry :link + (xml-get-attribute + (car (xml-get-children xml 'link)) + 'href))) + ;; Add <title/> as :title. + (setq entry (plist-put entry :title + (xml-substitute-special + (car (xml-node-children + (car (xml-get-children xml 'title))))))) + (let* ((content (car (xml-get-children xml 'content))) + (type (xml-get-attribute-or-nil content 'type))) + (when content + (cond + ((string= type "text") + ;; We like plain text. + (setq entry (plist-put entry :description + (xml-substitute-special + (car (xml-node-children content)))))) + ((string= type "html") + ;; TODO: convert HTML to Org markup. + (setq entry (plist-put entry :description + (xml-substitute-special + (car (xml-node-children content)))))) + ((string= type "xhtml") + ;; TODO: convert XHTML to Org markup. + (setq entry (plist-put entry :description + (prin1-to-string + (xml-node-children content))))) + (t + (setq entry (plist-put entry :description + (format-message + "Unknown `%s' content." type))))))) + entry)) + +(provide 'org-feed) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-feed.el ends here diff --git a/elpa/org-9.5.2/org-feed.elc b/elpa/org-9.5.2/org-feed.elc new file mode 100644 index 0000000..cde50ff Binary files /dev/null and b/elpa/org-9.5.2/org-feed.elc differ diff --git a/elpa/org-9.5.2/org-footnote.el b/elpa/org-9.5.2/org-footnote.el new file mode 100644 index 0000000..fcc7579 --- /dev/null +++ b/elpa/org-9.5.2/org-footnote.el @@ -0,0 +1,1023 @@ +;;; org-footnote.el --- Footnote support in Org -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the code dealing with footnotes in Org mode. + +;;; Code: + +;;;; Declarations + +(require 'cl-lib) +(require 'org-macs) +(require 'org-compat) + +(declare-function org-at-comment-p "org" ()) +(declare-function org-at-heading-p "org" (&optional ignored)) +(declare-function org-back-over-empty-lines "org" ()) +(declare-function org-end-of-meta-data "org" (&optional full)) +(declare-function org-edit-footnote-reference "org-src" ()) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-class "org-element" (datum &optional parent)) +(declare-function org-element-context "org-element" (&optional element)) +(declare-function org-element-lineage "org-element" (blob &optional types with-self)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) +(declare-function org-fill-paragraph "org" (&optional justify region)) +(declare-function org-in-block-p "org" (names)) +(declare-function org-in-verbatim-emphasis "org" ()) +(declare-function org-inside-LaTeX-fragment-p "org" ()) +(declare-function org-inside-latex-macro-p "org" ()) +(declare-function org-mark-ring-push "org" (&optional pos buffer)) +(declare-function org-show-context "org" (&optional key)) +(declare-function outline-next-heading "outline") + +(defvar electric-indent-mode) +(defvar org-blank-before-new-entry) ; defined in org.el +(defvar org-link-bracket-re) ; defined in org.el +(defvar org-complex-heading-regexp) ; defined in org.el +(defvar org-odd-levels-only) ; defined in org.el +(defvar org-outline-regexp) ; defined in org.el +(defvar org-outline-regexp-bol) ; defined in org.el + + +;;;; Constants + +(defconst org-footnote-re + "\\[fn:\\(?:\\(?1:[-_[:word:]]+\\)?\\(:\\)\\|\\(?1:[-_[:word:]]+\\)\\]\\)" + "Regular expression for matching footnotes. +Match group 1 contains footnote's label. It is nil for anonymous +footnotes. Match group 2 is non-nil only when footnote is +inline, i.e., it contains its own definition.") + +(defconst org-footnote-definition-re "^\\[fn:\\([-_[:word:]]+\\)\\]" + "Regular expression matching the definition of a footnote. +Match group 1 contains definition's label.") + +(defconst org-footnote-forbidden-blocks '("comment" "example" "export" "src") + "Names of blocks where footnotes are not allowed.") + + +;;;; Customization + +(defgroup org-footnote nil + "Footnotes in Org mode." + :tag "Org Footnote" + :group 'org) + +(defcustom org-footnote-section "Footnotes" + "Outline heading containing footnote definitions. + +This can be nil, to place footnotes locally at the end of the +current outline node. If can also be the name of a special +outline heading under which footnotes should be put. + +This variable defines the place where Org puts the definition +automatically, i.e. when creating the footnote, and when sorting +the notes. However, by hand you may place definitions +*anywhere*. + +If this is a string, during export, all subtrees starting with +this heading will be ignored. + +If you don't use the customize interface to change this variable, +you will need to run the following command after the change: + + `\\[universal-argument] \\[org-element-cache-reset]'" + :group 'org-footnote + :initialize 'custom-initialize-default + :set (lambda (var val) + (set var val) + (when (fboundp 'org-element-cache-reset) + (org-element-cache-reset 'all))) + :type '(choice + (string :tag "Collect footnotes under heading") + (const :tag "Define footnotes locally" nil)) + :safe #'string-or-null-p) + +(defcustom org-footnote-define-inline nil + "Non-nil means define footnotes inline, at reference location. +When nil, footnotes will be defined in a special section near +the end of the document. When t, the [fn:label:definition] notation +will be used to define the footnote at the reference position." + :group 'org-footnote + :type 'boolean + :safe #'booleanp) + +(defcustom org-footnote-auto-label t + "Non-nil means define automatically new labels for footnotes. +Possible values are: + +nil Prompt the user for each label. +t Create unique labels of the form [fn:1], [fn:2], etc. +confirm Like t, but let the user edit the created value. + The label can be removed from the minibuffer to create + an anonymous footnote. +random Automatically generate a unique, random label." + :group 'org-footnote + :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 a random label" random)) + :safe #'symbolp) + +(defcustom org-footnote-auto-adjust nil + "Non-nil means automatically adjust footnotes after insert/delete. +When this is t, after each insertion or deletion of a footnote, +simple fn:N footnotes will be renumbered, and all footnotes will be sorted. +If you want to have just sorting or just renumbering, set this variable +to `sort' or `renumber'. + +The main values of this variable can be set with in-buffer options: + +#+STARTUP: fnadjust +#+STARTUP: nofnadjust" + :group 'org-footnote + :type '(choice + (const :tag "No adjustment" nil) + (const :tag "Renumber" renumber) + (const :tag "Sort" sort) + (const :tag "Renumber and Sort" t)) + :safe #'symbolp) + +(defcustom org-footnote-fill-after-inline-note-extraction nil + "Non-nil means fill paragraphs after extracting footnotes. +When extracting inline footnotes, the lengths of lines can change a lot. +When this option is set, paragraphs from which an inline footnote has been +extracted will be filled again." + :group 'org-footnote + :type 'boolean + :safe #'booleanp) + + +;;;; Predicates + +(defun org-footnote-in-valid-context-p () + "Is point in a context where footnotes are allowed?" + (save-match-data + (not (or (org-at-comment-p) + (org-inside-LaTeX-fragment-p) + ;; Avoid literal example. + (org-in-verbatim-emphasis) + (save-excursion + (beginning-of-line) + (looking-at "[ \t]*:[ \t]+")) + ;; Avoid forbidden blocks. + (org-in-block-p org-footnote-forbidden-blocks))))) + +(defun org-footnote-at-reference-p () + "Non-nil if point is at a footnote reference. +If so, return a list containing its label, beginning and ending +positions, and the definition, when inline." + (let ((reference (org-element-context))) + (when (eq 'footnote-reference (org-element-type reference)) + (let ((end (save-excursion + (goto-char (org-element-property :end reference)) + (skip-chars-backward " \t") + (point)))) + (when (< (point) end) + (list (org-element-property :label reference) + (org-element-property :begin reference) + end + (and (eq 'inline (org-element-property :type reference)) + (buffer-substring-no-properties + (org-element-property :contents-begin reference) + (org-element-property :contents-end + reference))))))))) + +(defun org-footnote-at-definition-p () + "Non-nil if point is within a footnote definition. + +This matches only pure definitions like [fn:name] at the +beginning of a line. It does not match references like +\[fn:name:definition], where the footnote text is included and +defined locally. + +The return value is nil if not at a footnote definition, and +a list with label, start, end and definition of the footnote +otherwise." + (pcase (org-element-lineage (org-element-at-point) '(footnote-definition) t) + (`nil nil) + (definition + (let* ((label (org-element-property :label definition)) + (begin (org-element-property :post-affiliated definition)) + (end (save-excursion + (goto-char (org-element-property :end definition)) + (skip-chars-backward " \r\t\n") + (line-beginning-position 2))) + (contents-begin (org-element-property :contents-begin definition)) + (contents-end (org-element-property :contents-end definition)) + (contents + (if (not contents-begin) "" + (org-trim + (buffer-substring-no-properties contents-begin + contents-end))))) + (list label begin end contents))))) + + +;;;; Internal functions + +(defun org-footnote--allow-reference-p () + "Non-nil when a footnote reference can be inserted at point." + ;; XXX: This is similar to `org-footnote-in-valid-context-p' but + ;; more accurate and usually faster, except in some corner cases. + ;; It may replace it after doing proper benchmarks as it would be + ;; used in fontification. + (unless (bolp) + (let* ((context (org-element-context)) + (type (org-element-type context))) + (cond + ;; No footnote reference in attributes. + ((let ((post (org-element-property :post-affiliated context))) + (and post (< (point) post))) + nil) + ;; Paragraphs and blank lines at top of document are fine. + ((memq type '(nil paragraph))) + ;; So are contents of verse blocks. + ((eq type 'verse-block) + (and (>= (point) (org-element-property :contents-begin context)) + (< (point) (org-element-property :contents-end context)))) + ;; In an headline or inlinetask, point must be either on the + ;; heading itself or on the blank lines below. + ((memq type '(headline inlinetask)) + (or (not (org-at-heading-p)) + (and (save-excursion + (beginning-of-line) + (and (let ((case-fold-search t)) + (not (looking-at-p "\\*+ END[ \t]*$"))) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp)))) + (match-beginning 4) + (>= (point) (match-beginning 4)) + (or (not (match-beginning 5)) + (< (point) (match-beginning 5)))))) + ;; White spaces after an object or blank lines after an element + ;; are OK. + ((>= (point) + (save-excursion (goto-char (org-element-property :end context)) + (skip-chars-backward " \r\t\n") + (if (eq (org-element-class context) 'object) (point) + (line-beginning-position 2))))) + ;; At the beginning of a footnote definition, right after the + ;; label, is OK. + ((eq type 'footnote-definition) (looking-at (rx space))) + ;; Other elements are invalid. + ((eq (org-element-class context) 'element) nil) + ;; Just before object is fine. + ((= (point) (org-element-property :begin context))) + ;; Within recursive object too, but not in a link. + ((eq type 'link) nil) + ((eq type 'table-cell) + ;; :contents-begin is not reliable on empty cells, so special + ;; case it. + (<= (save-excursion (skip-chars-backward " \t") (point)) + (org-element-property :contents-end context))) + ((let ((cbeg (org-element-property :contents-begin context)) + (cend (org-element-property :contents-end context))) + (and cbeg (>= (point) cbeg) (<= (point) cend)))))))) + +(defun org-footnote--clear-footnote-section () + "Remove all footnote sections in buffer and create a new one. +New section is created at the end of the buffer. Leave point +within the new section." + (when org-footnote-section + (goto-char (point-min)) + (let ((regexp (format "^\\*+ +%s[ \t]*$" + (regexp-quote org-footnote-section)))) + (while (re-search-forward regexp nil t) + (delete-region + (match-beginning 0) + (org-end-of-subtree t t)))) + (goto-char (point-max)) + ;; Clean-up blank lines at the end of the buffer. + (skip-chars-backward " \r\t\n") + (unless (bobp) + (forward-line) + (when (eolp) (insert "\n"))) + (delete-region (point) (point-max)) + (when (and (cdr (assq 'heading org-blank-before-new-entry)) + (zerop (save-excursion (org-back-over-empty-lines)))) + (insert "\n")) + (insert "* " org-footnote-section "\n"))) + +(defun org-footnote--set-label (label) + "Set label of footnote at point to string LABEL. +Assume point is at the beginning of the reference or definition +to rename." + (forward-char 4) + (cond ((eq (char-after) ?:) (insert label)) + ((looking-at "\\([-_[:word:]]+\\)") (replace-match label nil nil nil 1)) + (t nil))) + +(defun org-footnote--collect-references (&optional anonymous) + "Collect all labeled footnote references in current buffer. + +Return an alist where associations follow the pattern + + (LABEL MARKER TOP-LEVEL SIZE) + +with + + LABEL the label of the of the definition, + MARKER a marker pointing to its beginning, + TOP-LEVEL a boolean, nil when the footnote is contained within + another one, + SIZE the length of the inline definition, in characters, + or nil for non-inline references. + +When optional ANONYMOUS is non-nil, also collect anonymous +references. In such cases, LABEL is nil. + +References are sorted according to a deep-reading order." + (org-with-wide-buffer + (goto-char (point-min)) + (let ((regexp (if anonymous org-footnote-re "\\[fn:[-_[:word:]]+[]:]")) + references nested) + (save-excursion + (while (re-search-forward regexp nil t) + ;; Ignore definitions. + (unless (and (eq (char-before) ?\]) + (= (line-beginning-position) (match-beginning 0))) + ;; Ensure point is within the reference before parsing it. + (backward-char) + (let ((object (org-element-context))) + (when (eq (org-element-type object) 'footnote-reference) + (let* ((label (org-element-property :label object)) + (begin (org-element-property :begin object)) + (size + (and (eq (org-element-property :type object) 'inline) + (- (org-element-property :contents-end object) + (org-element-property :contents-begin object))))) + (let ((d (org-element-lineage object '(footnote-definition)))) + (push (list label (copy-marker begin) (not d) size) + references) + (when d + ;; Nested references are stored in alist NESTED. + ;; Associations there follow the pattern + ;; + ;; (DEFINITION-LABEL . REFERENCES) + (let* ((def-label (org-element-property :label d)) + (labels (assoc def-label nested))) + (if labels (push label (cdr labels)) + (push (list def-label label) nested))))))))))) + ;; Sort the list of references. Nested footnotes have priority + ;; over top-level ones. + (letrec ((ordered nil) + (add-reference + (lambda (ref allow-nested) + (when (or allow-nested (nth 2 ref)) + (push ref ordered) + (dolist (r (mapcar (lambda (l) (assoc l references)) + (reverse + (cdr (assoc (nth 0 ref) nested))))) + (funcall add-reference r t)))))) + (dolist (r (reverse references) (nreverse ordered)) + (funcall add-reference r nil)))))) + +(defun org-footnote--collect-definitions (&optional delete) + "Collect all footnote definitions in current buffer. + +Return an alist where associations follow the pattern + + (LABEL . DEFINITION) + +with LABEL and DEFINITION being, respectively, the label and the +definition of the footnote, as strings. + +When optional argument DELETE is non-nil, delete the definition +while collecting them." + (org-with-wide-buffer + (goto-char (point-min)) + (let (definitions seen) + (while (re-search-forward org-footnote-definition-re nil t) + (backward-char) + (let ((element (org-element-at-point))) + (let ((label (org-element-property :label element))) + (when (and (eq (org-element-type element) 'footnote-definition) + (not (member label seen))) + (push label seen) + (let* ((beg (progn + (goto-char (org-element-property :begin element)) + (skip-chars-backward " \r\t\n") + (if (bobp) (point) (line-beginning-position 2)))) + (end (progn + (goto-char (org-element-property :end element)) + (skip-chars-backward " \r\t\n") + (line-beginning-position 2))) + (def (org-trim (buffer-substring-no-properties beg end)))) + (push (cons label def) definitions) + (when delete (delete-region beg end))))))) + definitions))) + +(defun org-footnote--goto-local-insertion-point () + "Find insertion point for footnote, just before next outline heading. +Assume insertion point is within currently accessible part of the buffer." + (org-with-limited-levels (outline-next-heading)) + (skip-chars-backward " \t\n") + (unless (bobp) (forward-line)) + (unless (bolp) (insert "\n"))) + + +;;;; Navigation + +(defun org-footnote-get-next-reference (&optional label backward limit) + "Return complete reference of the next footnote. + +If LABEL is provided, get the next reference of that footnote. If +BACKWARD is non-nil, find previous reference instead. LIMIT is +the buffer position bounding the search. + +Return value is a list like those provided by `org-footnote-at-reference-p'. +If no footnote is found, return nil." + (let ((label-regexp (if label (format "\\[fn:%s[]:]" label) org-footnote-re))) + (catch :exit + (save-excursion + (while (funcall (if backward #'re-search-backward #'re-search-forward) + label-regexp limit t) + (unless backward (backward-char)) + (pcase (org-footnote-at-reference-p) + (`nil nil) + (reference (throw :exit reference)))))))) + +(defun org-footnote-next-reference-or-definition (limit) + "Move point to next footnote reference or definition. + +LIMIT is the buffer position bounding the search. + +Return value is a list like those provided by +`org-footnote-at-reference-p' or `org-footnote-at-definition-p'. +If no footnote is found, return nil. + +This function is meant to be used for fontification only." + (let ((origin (point))) + (catch 'exit + (while t + (unless (re-search-forward org-footnote-re limit t) + (goto-char origin) + (throw 'exit nil)) + ;; Beware: with non-inline footnotes point will be just after + ;; the closing square bracket. + (backward-char) + (cond + ((and (/= (match-beginning 0) (line-beginning-position)) + (let* ((beg (match-beginning 0)) + (label (match-string-no-properties 1)) + ;; Inline footnotes don't end at (match-end 0) + ;; as `org-footnote-re' stops just after the + ;; second colon. Find the real ending with + ;; `scan-sexps', so Org doesn't get fooled by + ;; unrelated closing square brackets. + (end (ignore-errors (scan-sexps beg 1)))) + (and end + ;; Verify match isn't a part of a link. + (not (save-excursion + (goto-char beg) + (let ((linkp + (save-match-data + (org-in-regexp org-link-bracket-re)))) + (and linkp (< (point) (cdr linkp)))))) + ;; Verify point doesn't belong to a LaTeX macro. + (not (org-inside-latex-macro-p)) + (throw 'exit + (list label beg end + ;; Definition: ensure this is an + ;; inline footnote first. + (and (match-end 2) + (org-trim + (buffer-substring-no-properties + (match-end 0) (1- end)))))))))) + ;; Definition: also grab the last square bracket, matched in + ;; `org-footnote-re' for non-inline footnotes. + ((and (save-excursion + (beginning-of-line) + (save-match-data (org-footnote-in-valid-context-p))) + (save-excursion + (end-of-line) + ;; Footnotes definitions are separated by new + ;; headlines, another footnote definition or 2 blank + ;; lines. + (let ((end (match-end 0)) + (lim (save-excursion + (re-search-backward + (concat org-outline-regexp-bol + "\\|^\\([ \t]*\n\\)\\{2,\\}") + nil t)))) + (and (re-search-backward org-footnote-definition-re lim t) + (throw 'exit + (list nil + (match-beginning 0) + (if (eq (char-before end) ?\]) end + (1+ end))))))))) + (t nil)))))) + +(defun org-footnote-goto-definition (label &optional location) + "Move point to the definition of the footnote LABEL. + +LOCATION, when non-nil specifies the buffer position of the +definition. + +Throw an error if there is no definition or if it cannot be +reached from current narrowed part of buffer. Return a non-nil +value if point was successfully moved." + (interactive "sLabel: ") + (let* ((label (org-footnote-normalize-label label)) + (def-start (or location (nth 1 (org-footnote-get-definition label))))) + (cond + ((not def-start) + (user-error "Cannot find definition of footnote %s" label)) + ((or (> def-start (point-max)) (< def-start (point-min))) + (user-error "Definition is outside narrowed part of buffer"))) + (org-mark-ring-push) + (goto-char def-start) + (looking-at (format "\\[fn:%s[]:]" (regexp-quote label))) + (goto-char (match-end 0)) + (org-show-context 'link-search) + (when (derived-mode-p 'org-mode) + (message "%s" (substitute-command-keys + "Edit definition and go back with \ +`\\[org-mark-ring-goto]' or, if unique, with `\\[org-ctrl-c-ctrl-c]'."))) + t)) + +(defun org-footnote-goto-previous-reference (label) + "Find the first closest (to point) reference of footnote with label LABEL." + (interactive "sLabel: ") + (let* ((label (org-footnote-normalize-label label)) + (reference + (save-excursion + (or (org-footnote-get-next-reference label t) + (org-footnote-get-next-reference label) + (and (buffer-narrowed-p) + (org-with-wide-buffer + (or (org-footnote-get-next-reference label t) + (org-footnote-get-next-reference label))))))) + (start (nth 1 reference))) + (cond ((not reference) + (user-error "Cannot find reference of footnote %S" label)) + ((or (> start (point-max)) (< start (point-min))) + (user-error "Reference is outside narrowed part of buffer"))) + (org-mark-ring-push) + (goto-char start) + (org-show-context 'link-search))) + + +;;;; Getters + +(defun org-footnote-normalize-label (label) + "Return LABEL without \"fn:\" prefix. +If LABEL is the empty string or constituted of white spaces only, +return nil instead." + (pcase (org-trim label) + ("" nil) + ((pred (string-prefix-p "fn:")) (substring label 3)) + (_ label))) + +(defun org-footnote-get-definition (label) + "Return label, boundaries and definition of the footnote LABEL." + (let* ((label (regexp-quote (org-footnote-normalize-label label))) + (re (format "^\\[fn:%s\\]\\|.\\[fn:%s:" label label))) + (org-with-wide-buffer + (goto-char (point-min)) + (catch 'found + (while (re-search-forward re nil t) + (let* ((datum (progn (backward-char) (org-element-context))) + (type (org-element-type datum))) + (when (memq type '(footnote-definition footnote-reference)) + (throw 'found + (list + label + (org-element-property :begin datum) + (org-element-property :end datum) + (let ((cbeg (org-element-property :contents-begin datum))) + (if (not cbeg) "" + (replace-regexp-in-string + "[ \t\n]*\\'" + "" + (buffer-substring-no-properties + cbeg + (org-element-property :contents-end datum)))))))))) + nil)))) + +(defun org-footnote-all-labels () + "List all defined footnote labels used throughout the buffer. +This function ignores narrowing, if any." + (org-with-wide-buffer + (goto-char (point-min)) + (let (all) + (while (re-search-forward org-footnote-re nil t) + (backward-char) + (let ((context (org-element-context))) + (when (memq (org-element-type context) + '(footnote-definition footnote-reference)) + (let ((label (org-element-property :label context))) + (when label (cl-pushnew label all :test #'equal)))))) + all))) + +(defun org-footnote-unique-label (&optional current) + "Return a new unique footnote label. + +The function returns the first numeric label currently unused. + +Optional argument CURRENT is the list of labels active in the +buffer." + (let ((current (or current (org-footnote-all-labels)))) + (let ((count 1)) + (while (member (number-to-string count) current) + (cl-incf count)) + (number-to-string count)))) + + +;;;; Adding, Deleting Footnotes + +(defun org-footnote-new () + "Insert a new footnote. +This command prompts for a label. If this is a label referencing an +existing label, only insert the label. If the footnote label is empty +or new, let the user edit the definition of the footnote." + (interactive) + (unless (org-footnote--allow-reference-p) + (user-error "Cannot insert a footnote here")) + (let* ((all (org-footnote-all-labels)) + (label + (if (eq org-footnote-auto-label 'random) + (format "%x" (abs (random))) + (org-footnote-normalize-label + (let ((propose (org-footnote-unique-label all))) + (if (eq org-footnote-auto-label t) propose + (completing-read + "Label (leave empty for anonymous): " + (mapcar #'list all) nil nil + (and (eq org-footnote-auto-label 'confirm) propose)))))))) + (cond ((not label) + (insert "[fn::]") + (backward-char 1)) + ((member label all) + (insert "[fn:" label "]") + (message "New reference to existing note")) + (org-footnote-define-inline + (insert "[fn:" label ":]") + (backward-char 1) + (org-footnote-auto-adjust-maybe)) + (t + (insert "[fn:" label "]") + (let ((p (org-footnote-create-definition label))) + ;; `org-footnote-goto-definition' needs to be called + ;; after `org-footnote-auto-adjust-maybe'. Otherwise + ;; both label and location of the definition are lost. + ;; On the contrary, it needs to be called before + ;; `org-edit-footnote-reference' so that the remote + ;; editing buffer can display the correct label. + (if (ignore-errors (org-footnote-goto-definition label p)) + (org-footnote-auto-adjust-maybe) + ;; Definition was created outside current scope: edit + ;; it remotely. + (org-footnote-auto-adjust-maybe) + (org-edit-footnote-reference))))))) + +(defun org-footnote-create-definition (label) + "Start the definition of a footnote with label LABEL. +Return buffer position at the beginning of the definition. This +function doesn't move point." + (let ((label (org-footnote-normalize-label label)) + electric-indent-mode) ; Prevent wrong indentation. + (org-preserve-local-variables + (org-with-wide-buffer + (cond + ((not org-footnote-section) (org-footnote--goto-local-insertion-point)) + ((save-excursion + (goto-char (point-min)) + (re-search-forward + (concat "^\\*+[ \t]+" (regexp-quote org-footnote-section) "[ \t]*$") + nil t)) + (goto-char (match-end 0)) + (org-end-of-meta-data t) + (unless (bolp) (insert "\n"))) + (t (org-footnote--clear-footnote-section))) + (when (zerop (org-back-over-empty-lines)) (insert "\n")) + (insert "[fn:" label "] \n") + (line-beginning-position 0))))) + +(defun org-footnote-delete-references (label) + "Delete every reference to footnote LABEL. +Return the number of footnotes removed." + (save-excursion + (goto-char (point-min)) + (let (ref (nref 0)) + (while (setq ref (org-footnote-get-next-reference label)) + (goto-char (nth 1 ref)) + (delete-region (nth 1 ref) (nth 2 ref)) + (cl-incf nref)) + nref))) + +(defun org-footnote-delete-definitions (label) + "Delete every definition of the footnote LABEL. +Return the number of footnotes removed." + (save-excursion + (goto-char (point-min)) + (let ((def-re (format "^\\[fn:%s\\]" (regexp-quote label))) + (ndef 0)) + (while (re-search-forward def-re nil t) + (pcase (org-footnote-at-definition-p) + (`(,_ ,start ,end ,_) + ;; Remove the footnote, and all blank lines before it. + (delete-region (progn + (goto-char start) + (skip-chars-backward " \r\t\n") + (if (bobp) (point) (line-beginning-position 2))) + (progn + (goto-char end) + (skip-chars-backward " \r\t\n") + (if (bobp) (point) (line-beginning-position 2)))) + (cl-incf ndef)))) + ndef))) + +(defun org-footnote-delete (&optional label) + "Delete the footnote at point. +This will remove the definition (even multiple definitions if they exist) +and all references of a footnote label. + +If LABEL is non-nil, delete that footnote instead." + (catch 'done + (org-preserve-local-variables + (let* ((nref 0) (ndef 0) x + ;; 1. Determine LABEL of footnote at point. + (label (cond + ;; LABEL is provided as argument. + (label) + ;; Footnote reference at point. If the footnote is + ;; anonymous, delete it and exit instead. + ((setq x (org-footnote-at-reference-p)) + (or (car x) + (progn + (delete-region (nth 1 x) (nth 2 x)) + (message "Anonymous footnote removed") + (throw 'done t)))) + ;; Footnote definition at point. + ((setq x (org-footnote-at-definition-p)) + (car x)) + (t (error "Don't know which footnote to remove"))))) + ;; 2. Now that LABEL is non-nil, find every reference and every + ;; definition, and delete them. + (setq nref (org-footnote-delete-references label) + ndef (org-footnote-delete-definitions label)) + ;; 3. Verify consistency of footnotes and notify user. + (org-footnote-auto-adjust-maybe) + (message "%d definition(s) of and %d reference(s) of footnote %s removed" + ndef nref label))))) + + +;;;; Sorting, Renumbering, Normalizing + +(defun org-footnote-renumber-fn:N () + "Order numbered footnotes into a sequence in the document." + (interactive) + (let* ((c 0) + (references (cl-remove-if-not + (lambda (r) (string-match-p "\\`[0-9]+\\'" (car r))) + (org-footnote--collect-references))) + (alist (mapcar (lambda (l) (cons l (number-to-string (cl-incf c)))) + (delete-dups (mapcar #'car references))))) + (org-with-wide-buffer + ;; Re-number references. + (dolist (ref references) + (goto-char (nth 1 ref)) + (org-footnote--set-label (cdr (assoc (nth 0 ref) alist)))) + ;; Re-number definitions. + (goto-char (point-min)) + (while (re-search-forward "^\\[fn:\\([0-9]+\\)\\]" nil t) + (replace-match (or (cdr (assoc (match-string 1) alist)) + ;; Un-referenced definitions get higher + ;; numbers. + (number-to-string (cl-incf c))) + nil nil nil 1))))) + +(defun org-footnote-sort () + "Rearrange footnote definitions in the current buffer. +Sort footnote definitions so they match order of footnote +references. Also relocate definitions at the end of their +relative section or within a single footnote section, according +to `org-footnote-section'. Inline definitions are ignored." + (let ((references (org-footnote--collect-references))) + (org-preserve-local-variables + (let ((definitions (org-footnote--collect-definitions 'delete))) + (org-with-wide-buffer + (org-footnote--clear-footnote-section) + ;; Insert footnote definitions at the appropriate location, + ;; separated by a blank line. Each definition is inserted + ;; only once throughout the buffer. + (let (inserted) + (dolist (cell references) + (let ((label (car cell)) + (nested (not (nth 2 cell))) + (inline (nth 3 cell))) + (unless (or (member label inserted) inline) + (push label inserted) + (unless (or org-footnote-section nested) + ;; If `org-footnote-section' is non-nil, or + ;; reference is nested, point is already at the + ;; correct position. Otherwise, move at the + ;; appropriate location within the section + ;; containing the reference. + (goto-char (nth 1 cell)) + (org-footnote--goto-local-insertion-point)) + (insert "\n" + (or (cdr (assoc label definitions)) + (format "[fn:%s] DEFINITION NOT FOUND." label)) + "\n")))) + ;; Insert un-referenced footnote definitions at the end. + (pcase-dolist (`(,label . ,definition) definitions) + (unless (member label inserted) + (insert "\n" definition "\n"))))))))) + +(defun org-footnote-normalize () + "Turn every footnote in buffer into a numbered one." + (interactive) + (org-preserve-local-variables + (let ((n 0) + (translations nil) + (definitions nil) + (references (org-footnote--collect-references 'anonymous))) + (org-with-wide-buffer + ;; Update label for reference. We need to do this before + ;; clearing definitions in order to rename nested footnotes + ;; before they are deleted. + (dolist (cell references) + (let* ((label (car cell)) + (anonymous (not label)) + (new + (cond + ;; In order to differentiate anonymous references + ;; from regular ones, set their labels to integers, + ;; not strings. + (anonymous (setcar cell (cl-incf n))) + ((cdr (assoc label translations))) + (t (let ((l (number-to-string (cl-incf n)))) + (push (cons label l) translations) + l))))) + (goto-char (nth 1 cell)) ; Move to reference's start. + (org-footnote--set-label + (if anonymous (number-to-string new) new)) + (let ((size (nth 3 cell))) + ;; Transform inline footnotes into regular references and + ;; retain their definition for later insertion as + ;; a regular footnote definition. + (when size + (let ((def (concat + (format "[fn:%s] " new) + (org-trim + (substring + (delete-and-extract-region + (point) (+ (point) size 1)) + 1))))) + (push (cons (if anonymous new label) def) definitions) + (when org-footnote-fill-after-inline-note-extraction + (org-fill-paragraph))))))) + ;; Collect definitions. Update labels according to ALIST. + (let ((definitions + (nconc definitions + (org-footnote--collect-definitions 'delete))) + (inserted)) + (org-footnote--clear-footnote-section) + (dolist (cell references) + (let* ((label (car cell)) + (anonymous (integerp label)) + (pos (nth 1 cell))) + ;; Move to appropriate location, if required. When there + ;; is a footnote section or reference is nested, point is + ;; already at the expected location. + (unless (or org-footnote-section (not (nth 2 cell))) + (goto-char pos) + (org-footnote--goto-local-insertion-point)) + ;; Insert new definition once label is updated. + (unless (member label inserted) + (push label inserted) + (let ((stored (cdr (assoc label definitions))) + ;; Anonymous footnotes' label is already + ;; up-to-date. + (new (if anonymous label + (cdr (assoc label translations))))) + (insert "\n" + (cond + ((not stored) + (format "[fn:%s] DEFINITION NOT FOUND." new)) + (anonymous stored) + (t + (replace-regexp-in-string + "\\`\\[fn:\\(.*?\\)\\]" new stored nil nil 1))) + "\n"))))) + ;; Insert un-referenced footnote definitions at the end. + (pcase-dolist (`(,label . ,definition) definitions) + (unless (member label inserted) + (insert "\n" + (replace-regexp-in-string org-footnote-definition-re + (format "[fn:%d]" (cl-incf n)) + definition) + "\n")))))))) + +(defun org-footnote-auto-adjust-maybe () + "Renumber and/or sort footnotes according to user settings." + (when (memq org-footnote-auto-adjust '(t renumber)) + (org-footnote-renumber-fn:N)) + (when (memq org-footnote-auto-adjust '(t sort)) + (let ((label (car (org-footnote-at-definition-p)))) + (org-footnote-sort) + (when label + (goto-char (point-min)) + (and (re-search-forward (format "^\\[fn:%s\\]" (regexp-quote label)) + nil t) + (progn (insert " ") + (just-one-space))))))) + + +;;;; End-user interface + +;;;###autoload +(defun org-footnote-action (&optional special) + "Do the right thing for footnotes. + +When at a footnote reference, jump to the definition. + +When at a definition, jump to the references if they exist, offer +to create them otherwise. + +When neither at definition or reference, create a new footnote, +interactively if possible. + +With prefix arg SPECIAL, or when no footnote can be created, +offer additional commands in a menu." + (interactive "P") + (let* ((context (and (not special) (org-element-context))) + (type (org-element-type context))) + (cond + ;; On white space after element, insert a new footnote. + ((and context + (> (point) + (save-excursion + (goto-char (org-element-property :end context)) + (skip-chars-backward " \t") + (point)))) + (org-footnote-new)) + ((eq type 'footnote-reference) + (let ((label (org-element-property :label context))) + (cond + ;; Anonymous footnote: move point at the beginning of its + ;; definition. + ((not label) + (goto-char (org-element-property :contents-begin context))) + ;; Check if a definition exists: then move to it. + ((let ((p (nth 1 (org-footnote-get-definition label)))) + (when p (org-footnote-goto-definition label p)))) + ;; No definition exists: offer to create it. + ((yes-or-no-p (format "No definition for %s. Create one? " label)) + (let ((p (org-footnote-create-definition label))) + (or (ignore-errors (org-footnote-goto-definition label p)) + ;; Since definition was created outside current scope, + ;; edit it remotely. + (org-edit-footnote-reference))))))) + ((eq type 'footnote-definition) + (org-footnote-goto-previous-reference + (org-element-property :label context))) + ((or special (not (org-footnote--allow-reference-p))) + (message "Footnotes: [s]ort | [r]enumber fn:N | [S]=r+s | [n]ormalize | \ +\[d]elete") + (pcase (read-char-exclusive) + (?s (org-footnote-sort)) + (?r (org-footnote-renumber-fn:N)) + (?S (org-footnote-renumber-fn:N) + (org-footnote-sort)) + (?n (org-footnote-normalize)) + (?d (org-footnote-delete)) + (char (error "No such footnote command %c" char)))) + (t (org-footnote-new))))) + + +(provide 'org-footnote) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-footnote.el ends here diff --git a/elpa/org-9.5.2/org-footnote.elc b/elpa/org-9.5.2/org-footnote.elc new file mode 100644 index 0000000..8ab5965 Binary files /dev/null and b/elpa/org-9.5.2/org-footnote.elc differ diff --git a/elpa/org-9.5.2/org-goto.el b/elpa/org-9.5.2/org-goto.el new file mode 100644 index 0000000..352bf9f --- /dev/null +++ b/elpa/org-9.5.2/org-goto.el @@ -0,0 +1,291 @@ +;;; org-goto.el --- Fast navigation in an Org buffer -*- lexical-binding: t; -*- + +;; Copyright (C) 2012-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Code: + +(require 'org) +(require 'org-refile) + +(defvar org-goto-exit-command nil) +(defvar org-goto-map nil) +(defvar org-goto-marker nil) +(defvar org-goto-selected-point nil) +(defvar org-goto-start-pos nil) +(defvar org-goto-window-configuration nil) + +(defconst org-goto-local-auto-isearch-map (make-sparse-keymap)) +(set-keymap-parent org-goto-local-auto-isearch-map isearch-mode-map) + +(defconst org-goto-help + "Browse buffer copy, to find location or copy text.%s +RET=jump to location C-g=quit and return to previous location +\[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur") + + + +;;; Customization + +(defgroup org-goto nil + "Options concerning Org Goto navigation interface." + :tag "Org Goto" + :group 'org) + +(defcustom org-goto-interface 'outline + "The default interface to be used for `org-goto'. + +Allowed values are: + +`outline' + + The interface shows an outline of the relevant file and the + correct heading is found by moving through the outline or by + searching with incremental search. + +`outline-path-completion' + + Headlines in the current buffer are offered via completion. + This is the interface also used by the refile command." + :group 'org-goto + :type '(choice + (const :tag "Outline" outline) + (const :tag "Outline-path-completion" outline-path-completion))) + +(defcustom org-goto-max-level 5 + "Maximum target level when running `org-goto' with refile interface." + :group 'org-goto + :type 'integer) + +(defcustom org-goto-auto-isearch t + "Non-nil means typing characters in `org-goto' starts incremental search. +When nil, you can use these keybindings to navigate the buffer: + + q Quit the Org Goto interface + n Go to the next visible heading + p Go to the previous visible heading + f Go one heading forward on same level + b Go one heading backward on same level + u Go one heading up" + :group 'org-goto + :type 'boolean) + + + +;;; Internal functions + +(defun org-goto--set-map () + "Set the keymap `org-goto'." + (setq org-goto-map + (let ((map (make-sparse-keymap))) + (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command + mouse-drag-region universal-argument org-occur))) + (dolist (cmd cmds) + (substitute-key-definition cmd cmd map global-map))) + (suppress-keymap map) + (org-defkey map "\C-m" 'org-goto-ret) + (org-defkey map [(return)] 'org-goto-ret) + (org-defkey map [(left)] 'org-goto-left) + (org-defkey map [(right)] 'org-goto-right) + (org-defkey map [(control ?g)] 'org-goto-quit) + (org-defkey map "\C-i" 'org-cycle) + (org-defkey map [(tab)] 'org-cycle) + (org-defkey map [(down)] 'outline-next-visible-heading) + (org-defkey map [(up)] 'outline-previous-visible-heading) + (if org-goto-auto-isearch + (if (fboundp 'define-key-after) + (define-key-after map [t] 'org-goto-local-auto-isearch) + nil) + (org-defkey map "q" 'org-goto-quit) + (org-defkey map "n" 'outline-next-visible-heading) + (org-defkey map "p" 'outline-previous-visible-heading) + (org-defkey map "f" 'outline-forward-same-level) + (org-defkey map "b" 'outline-backward-same-level) + (org-defkey map "u" 'outline-up-heading)) + (org-defkey map "/" 'org-occur) + (org-defkey map "\C-c\C-n" 'outline-next-visible-heading) + (org-defkey map "\C-c\C-p" 'outline-previous-visible-heading) + (org-defkey map "\C-c\C-f" 'outline-forward-same-level) + (org-defkey map "\C-c\C-b" 'outline-backward-same-level) + (org-defkey map "\C-c\C-u" 'outline-up-heading) + map))) + +;; `isearch-other-control-char' was removed in Emacs 24.4. +(if (fboundp 'isearch-other-control-char) + (progn + (define-key org-goto-local-auto-isearch-map "\C-i" 'isearch-other-control-char) + (define-key org-goto-local-auto-isearch-map "\C-m" 'isearch-other-control-char)) + (define-key org-goto-local-auto-isearch-map "\C-i" nil) + (define-key org-goto-local-auto-isearch-map "\C-m" nil) + (define-key org-goto-local-auto-isearch-map [return] nil)) + +(defun org-goto--local-search-headings (string bound noerror) + "Search and make sure that any matches are in headlines." + (catch 'return + (while (if isearch-forward + (search-forward string bound noerror) + (search-backward string bound noerror)) + (when (save-match-data + (and (save-excursion + (beginning-of-line) + (looking-at org-complex-heading-regexp)) + (or (not (match-beginning 5)) + (< (point) (match-beginning 5))))) + (throw 'return (point)))))) + +(defun org-goto-local-auto-isearch () + "Start isearch." + (interactive) + (let ((keys (this-command-keys))) + (when (eq (lookup-key isearch-mode-map keys) 'isearch-printing-char) + (isearch-mode t) + (isearch-process-search-char (string-to-char keys)) + (org-font-lock-ensure)))) + +(defun org-goto-ret (&optional _arg) + "Finish `org-goto' by going to the new location." + (interactive "P") + (setq org-goto-selected-point (point)) + (setq org-goto-exit-command 'return) + (throw 'exit nil)) + +(defun org-goto-left () + "Finish `org-goto' by going to the new location." + (interactive) + (if (org-at-heading-p) + (progn + (beginning-of-line 1) + (setq org-goto-selected-point (point) + org-goto-exit-command 'left) + (throw 'exit nil)) + (user-error "Not on a heading"))) + +(defun org-goto-right () + "Finish `org-goto' by going to the new location." + (interactive) + (if (org-at-heading-p) + (progn + (setq org-goto-selected-point (point) + org-goto-exit-command 'right) + (throw 'exit nil)) + (user-error "Not on a heading"))) + +(defun org-goto-quit () + "Finish `org-goto' without cursor motion." + (interactive) + (setq org-goto-selected-point nil) + (setq org-goto-exit-command 'quit) + (throw 'exit nil)) + + + +;;; Public API + +;;;###autoload +(defun org-goto-location (&optional _buf help) + "Let the user select a location in current buffer. +This function uses a recursive edit. It returns the selected +position or nil." + (let ((isearch-mode-map org-goto-local-auto-isearch-map) + (isearch-hide-immediately nil) + (isearch-search-fun-function + (lambda () #'org-goto--local-search-headings)) + (help (or help org-goto-help))) + (save-excursion + (save-window-excursion + (delete-other-windows) + (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*")) + (pop-to-buffer-same-window + (condition-case nil + (make-indirect-buffer (current-buffer) "*org-goto*" t) + (error (make-indirect-buffer (current-buffer) "*org-goto*" t)))) + (let (temp-buffer-show-function temp-buffer-show-hook) + (with-output-to-temp-buffer "*Org Help*" + (princ (format help (if org-goto-auto-isearch + " Just type for auto-isearch." + " n/p/f/b/u to navigate, q to quit."))))) + (org-fit-window-to-buffer (get-buffer-window "*Org Help*")) + (org-overview) + (setq buffer-read-only t) + (if (and (boundp 'org-goto-start-pos) + (integer-or-marker-p org-goto-start-pos)) + (progn (goto-char org-goto-start-pos) + (when (org-invisible-p) + (org-show-set-visibility 'lineage))) + (goto-char (point-min))) + (let (org-special-ctrl-a/e) (org-beginning-of-line)) + (message "Select location and press RET") + (use-local-map org-goto-map) + (recursive-edit))) + (kill-buffer "*org-goto*") + (cons org-goto-selected-point org-goto-exit-command))) + +;;;###autoload +(defun org-goto (&optional alternative-interface) + "Look up a different location in the current file, keeping current visibility. + +When you want look-up or go to a different location in a +document, the fastest way is often to fold the entire buffer and +then dive into the tree. This method has the disadvantage, that +the previous location will be folded, which may not be what you +want. + +This command works around this by showing a copy of the current +buffer in an indirect buffer, in overview mode. You can dive +into the tree in that copy, use `org-occur' and incremental search +to find a location. When pressing RET or `Q', the command +returns to the original buffer in which the visibility is still +unchanged. After RET it will also jump to the location selected +in the indirect buffer and expose the headline hierarchy above. + +With a prefix argument, use the alternative interface: e.g., if +`org-goto-interface' is `outline' use `outline-path-completion'." + (interactive "P") + (org-goto--set-map) + (let* ((org-refile-targets `((nil . (:maxlevel . ,org-goto-max-level)))) + (org-refile-use-outline-path t) + (org-refile-target-verify-function nil) + (interface + (if (not alternative-interface) + org-goto-interface + (if (eq org-goto-interface 'outline) + 'outline-path-completion + 'outline))) + (org-goto-start-pos (point)) + (selected-point + (if (eq interface 'outline) (car (org-goto-location)) + (let ((pa (org-refile-get-location "Goto"))) + (org-refile-check-position pa) + (nth 3 pa))))) + (if selected-point + (progn + (org-mark-ring-push org-goto-start-pos) + (goto-char selected-point) + (when (or (org-invisible-p) (org-invisible-p2)) + (org-show-context 'org-goto))) + (message "Quit")))) + +(provide 'org-goto) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-goto.el ends here diff --git a/elpa/org-9.5.2/org-goto.elc b/elpa/org-9.5.2/org-goto.elc new file mode 100644 index 0000000..bd12424 Binary files /dev/null and b/elpa/org-9.5.2/org-goto.elc differ diff --git a/elpa/org-9.5.2/org-habit.el b/elpa/org-9.5.2/org-habit.el new file mode 100644 index 0000000..3ce8068 --- /dev/null +++ b/elpa/org-9.5.2/org-habit.el @@ -0,0 +1,476 @@ +;;; org-habit.el --- The habit tracking code for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. + +;; Author: John Wiegley <johnw at gnu dot org> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the habit tracking code for Org mode + +;;; Code: + +(require 'cl-lib) +(require 'org) +(require 'org-agenda) + +(defgroup org-habit nil + "Options concerning habit tracking in Org mode." + :tag "Org Habit" + :group 'org-progress) + +(defcustom org-habit-graph-column 40 + "The absolute column at which to insert habit consistency graphs. +Note that consistency graphs will overwrite anything else in the buffer." + :group 'org-habit + :type 'integer) + +(defcustom org-habit-preceding-days 21 + "Number of days before today to appear in consistency graphs." + :group 'org-habit + :type 'integer) + +(defcustom org-habit-following-days 7 + "Number of days after today to appear in consistency graphs." + :group 'org-habit + :type 'integer) + +(defcustom org-habit-show-habits t + "If non-nil, show habits in agenda buffers." + :group 'org-habit + :type 'boolean) + +(defcustom org-habit-show-habits-only-for-today t + "If non-nil, only show habits on today's agenda, and not for future days. +Note that even when shown for future days, the graph is always +relative to the current effective date." + :group 'org-habit + :type 'boolean) + +(defcustom org-habit-show-all-today nil + "If non-nil, will show the consistency graph of all habits on +today's agenda, even if they are not scheduled." + :group 'org-habit + :type 'boolean) + +(defcustom org-habit-today-glyph ?! + "Glyph character used to identify today." + :group 'org-habit + :version "24.1" + :type 'character) + +(defcustom org-habit-completed-glyph ?* + "Glyph character used to show completed days on which a task was done." + :group 'org-habit + :version "24.1" + :type 'character) + +(defcustom org-habit-show-done-always-green nil + "Non-nil means DONE days will always be green in the consistency graph. +It will be green even if it was done after the deadline." + :group 'org-habit + :type 'boolean) + +(defcustom org-habit-scheduled-past-days nil + "Value to use instead of `org-scheduled-past-days', for habits only. + +If nil, `org-scheduled-past-days' is used. + +Setting this to say 10000 is a way to make habits always show up +as a reminder, even if you set `org-scheduled-past-days' to a +small value because you regard scheduled items as a way of +\"turning on\" TODO items on a particular date, rather than as a +means of creating calendar-based reminders." + :group 'org-habit + :type '(choice integer (const nil)) + :package-version '(Org . "9.3") + :safe (lambda (v) (or (integerp v) (null v)))) + +(defface org-habit-clear-face + '((((background light)) (:background "#8270f9")) + (((background dark)) (:background "blue"))) + "Face for days on which a task shouldn't be done yet." + :group 'org-habit + :group 'org-faces) +(defface org-habit-clear-future-face + '((((background light)) (:background "#d6e4fc")) + (((background dark)) (:background "midnightblue"))) + "Face for future days on which a task shouldn't be done yet." + :group 'org-habit + :group 'org-faces) + +(defface org-habit-ready-face + '((((background light)) (:background "#4df946")) + (((background dark)) (:background "forestgreen"))) + "Face for days on which a task should start to be done." + :group 'org-habit + :group 'org-faces) +(defface org-habit-ready-future-face + '((((background light)) (:background "#acfca9")) + (((background dark)) (:background "darkgreen"))) + "Face for days on which a task should start to be done." + :group 'org-habit + :group 'org-faces) + +(defface org-habit-alert-face + '((((background light)) (:background "#f5f946")) + (((background dark)) (:background "gold"))) + "Face for days on which a task is due." + :group 'org-habit + :group 'org-faces) +(defface org-habit-alert-future-face + '((((background light)) (:background "#fafca9")) + (((background dark)) (:background "darkgoldenrod"))) + "Face for days on which a task is due." + :group 'org-habit + :group 'org-faces) + +(defface org-habit-overdue-face + '((((background light)) (:background "#f9372d")) + (((background dark)) (:background "firebrick"))) + "Face for days on which a task is overdue." + :group 'org-habit + :group 'org-faces) +(defface org-habit-overdue-future-face + '((((background light)) (:background "#fc9590")) + (((background dark)) (:background "darkred"))) + "Face for days on which a task is overdue." + :group 'org-habit + :group 'org-faces) + +(defun org-habit-duration-to-days (ts) + (if (string-match "\\([0-9]+\\)\\([dwmy]\\)" ts) + ;; lead time is specified. + (floor (* (string-to-number (match-string 1 ts)) + (cdr (assoc (match-string 2 ts) + '(("d" . 1) ("w" . 7) + ("m" . 30.4) ("y" . 365.25)))))) + (error "Invalid duration string: %s" ts))) + +(defun org-is-habit-p (&optional pom) + "Is the task at POM or point a habit?" + (string= "habit" (org-entry-get (or pom (point)) "STYLE"))) + +(defun org-habit-parse-todo (&optional pom) + "Parse the TODO surrounding point for its habit-related data. +Returns a list with the following elements: + + 0: Scheduled date for the habit (may be in the past) + 1: \".+\"-style repeater for the schedule, in days + 2: Optional deadline (nil if not present) + 3: If deadline, the repeater for the deadline, otherwise nil + 4: A list of all the past dates this todo was mark closed + 5: Repeater type as a string + +This list represents a \"habit\" for the rest of this module." + (save-excursion + (if pom (goto-char pom)) + (cl-assert (org-is-habit-p (point))) + (let* ((scheduled (org-get-scheduled-time (point))) + (scheduled-repeat (org-get-repeat (org-entry-get (point) "SCHEDULED"))) + (end (org-entry-end-position)) + (habit-entry (org-no-properties (nth 4 (org-heading-components)))) + closed-dates deadline dr-days sr-days sr-type) + (if scheduled + (setq scheduled (time-to-days scheduled)) + (error "Habit %s has no scheduled date" habit-entry)) + (unless scheduled-repeat + (error + "Habit `%s' has no scheduled repeat period or has an incorrect one" + habit-entry)) + (setq sr-days (org-habit-duration-to-days scheduled-repeat) + sr-type (progn (string-match "[\\.+]?\\+" scheduled-repeat) + (match-string-no-properties 0 scheduled-repeat))) + (unless (> sr-days 0) + (error "Habit %s scheduled repeat period is less than 1d" habit-entry)) + (when (string-match "/\\([0-9]+[dwmy]\\)" scheduled-repeat) + (setq dr-days (org-habit-duration-to-days + (match-string-no-properties 1 scheduled-repeat))) + (if (<= dr-days sr-days) + (error "Habit %s deadline repeat period is less than or equal to scheduled (%s)" + habit-entry scheduled-repeat)) + (setq deadline (+ scheduled (- dr-days sr-days)))) + (org-back-to-heading t) + (let* ((maxdays (+ org-habit-preceding-days org-habit-following-days)) + (reversed org-log-states-order-reversed) + (search (if reversed 're-search-forward 're-search-backward)) + (limit (if reversed end (point))) + (count 0) + (re (format + "^[ \t]*-[ \t]+\\(?:State \"%s\".*%s%s\\)" + (regexp-opt org-done-keywords) + org-ts-regexp-inactive + (let ((value (cdr (assq 'done org-log-note-headings)))) + (if (not value) "" + (concat "\\|" + (org-replace-escapes + (regexp-quote value) + `(("%d" . ,org-ts-regexp-inactive) + ("%D" . ,org-ts-regexp) + ("%s" . "\"\\S-+\"") + ("%S" . "\"\\S-+\"") + ("%t" . ,org-ts-regexp-inactive) + ("%T" . ,org-ts-regexp) + ("%u" . ".*?") + ("%U" . ".*?"))))))))) + (unless reversed (goto-char end)) + (while (and (< count maxdays) (funcall search re limit t)) + (push (time-to-days + (org-time-string-to-time + (or (match-string-no-properties 1) + (match-string-no-properties 2)))) + closed-dates) + (setq count (1+ count)))) + (list scheduled sr-days deadline dr-days closed-dates sr-type)))) + +(defsubst org-habit-scheduled (habit) + (nth 0 habit)) +(defsubst org-habit-scheduled-repeat (habit) + (nth 1 habit)) +(defsubst org-habit-deadline (habit) + (let ((deadline (nth 2 habit))) + (or deadline + (if (nth 3 habit) + (+ (org-habit-scheduled habit) + (1- (org-habit-scheduled-repeat habit))) + (org-habit-scheduled habit))))) +(defsubst org-habit-deadline-repeat (habit) + (or (nth 3 habit) + (org-habit-scheduled-repeat habit))) +(defsubst org-habit-done-dates (habit) + (nth 4 habit)) +(defsubst org-habit-repeat-type (habit) + (nth 5 habit)) + +(defsubst org-habit-get-priority (habit &optional moment) + "Determine the relative priority of a habit. +This must take into account not just urgency, but consistency as well." + (let ((pri 1000) + (now (if moment (time-to-days moment) (org-today))) + (scheduled (org-habit-scheduled habit)) + (deadline (org-habit-deadline habit))) + ;; add 10 for every day past the scheduled date, and subtract for every + ;; day before it + (setq pri (+ pri (* (- now scheduled) 10))) + ;; add 50 if the deadline is today + (if (and (/= scheduled deadline) + (= now deadline)) + (setq pri (+ pri 50))) + ;; add 100 for every day beyond the deadline date, and subtract 10 for + ;; every day before it + (let ((slip (- now (1- deadline)))) + (if (> slip 0) + (setq pri (+ pri (* slip 100))) + (setq pri (+ pri (* slip 10))))) + pri)) + +(defun org-habit-get-faces (habit &optional now-days scheduled-days donep) + "Return faces for HABIT relative to NOW-DAYS and SCHEDULED-DAYS. +NOW-DAYS defaults to the current time's days-past-the-epoch if nil. +SCHEDULED-DAYS defaults to the habit's actual scheduled days if nil. + +Habits are assigned colors on the following basis: + Blue Task is before the scheduled date. + Green Task is on or after scheduled date, but before the + end of the schedule's repeat period. + Yellow If the task has a deadline, then it is after schedule's + repeat period, but before the deadline. + Orange The task has reached the deadline day, or if there is + no deadline, the end of the schedule's repeat period. + Red The task has gone beyond the deadline day or the + schedule's repeat period." + (let* ((scheduled (or scheduled-days (org-habit-scheduled habit))) + (s-repeat (org-habit-scheduled-repeat habit)) + (d-repeat (org-habit-deadline-repeat habit)) + (deadline (if scheduled-days + (+ scheduled-days (- d-repeat s-repeat)) + (org-habit-deadline habit))) + (m-days (or now-days (time-to-days nil)))) + (cond + ((< m-days scheduled) + '(org-habit-clear-face . org-habit-clear-future-face)) + ((< m-days deadline) + '(org-habit-ready-face . org-habit-ready-future-face)) + ((= m-days deadline) + (if donep + '(org-habit-ready-face . org-habit-ready-future-face) + '(org-habit-alert-face . org-habit-alert-future-face))) + ((and org-habit-show-done-always-green donep) + '(org-habit-ready-face . org-habit-ready-future-face)) + (t '(org-habit-overdue-face . org-habit-overdue-future-face))))) + +(defun org-habit-build-graph (habit starting current ending) + "Build a graph for the given HABIT, from STARTING to ENDING. +CURRENT gives the current time between STARTING and ENDING, for +the purpose of drawing the graph. It need not be the actual +current time." + (let* ((all-done-dates (sort (org-habit-done-dates habit) #'<)) + (done-dates all-done-dates) + (scheduled (org-habit-scheduled habit)) + (s-repeat (org-habit-scheduled-repeat habit)) + (start (time-to-days starting)) + (now (time-to-days current)) + (end (time-to-days ending)) + (graph (make-string (1+ (- end start)) ?\s)) + (index 0) + last-done-date) + (while (and done-dates (< (car done-dates) start)) + (setq last-done-date (car done-dates) + done-dates (cdr done-dates))) + (while (< start end) + (let* ((in-the-past-p (< start now)) + (todayp (= start now)) + (donep (and done-dates (= start (car done-dates)))) + (faces + (if (and in-the-past-p + (not last-done-date) + (not (< scheduled now))) + (if (and all-done-dates (= (car all-done-dates) start)) + ;; This is the very first done of this habit. + '(org-habit-ready-face . org-habit-ready-future-face) + '(org-habit-clear-face . org-habit-clear-future-face)) + (org-habit-get-faces + habit start + (and in-the-past-p + last-done-date + ;; Compute scheduled time for habit at the time + ;; START was current. + (let ((type (org-habit-repeat-type habit))) + (cond + ;; At the last done date, use current + ;; scheduling in all cases. + ((null done-dates) scheduled) + ((equal type ".+") (+ last-done-date s-repeat)) + ((equal type "+") + ;; Since LAST-DONE-DATE, each done mark + ;; shifted scheduled date by S-REPEAT. + (- scheduled (* (length done-dates) s-repeat))) + (t + ;; Compute the scheduled time after the + ;; first repeat. This is the closest time + ;; past FIRST-DONE which can reach SCHEDULED + ;; by a number of S-REPEAT hops. + ;; + ;; Then, play TODO state change history from + ;; the beginning in order to find current + ;; scheduled time. + (let* ((first-done (car all-done-dates)) + (s (let ((shift (mod (- scheduled first-done) + s-repeat))) + (+ (if (= shift 0) s-repeat shift) + first-done)))) + (if (= first-done last-done-date) s + (catch :exit + (dolist (done (cdr all-done-dates) s) + ;; Each repeat shifts S by any + ;; number of S-REPEAT hops it takes + ;; to get past DONE, with a minimum + ;; of one hop. + (cl-incf s (* (1+ (/ (max (- done s) 0) + s-repeat)) + s-repeat)) + (when (= done last-done-date) + (throw :exit s)))))))))) + donep))) + markedp face) + (cond + (donep + (aset graph index org-habit-completed-glyph) + (setq markedp t) + (while (and done-dates (= start (car done-dates))) + (setq last-done-date (car done-dates)) + (setq done-dates (cdr done-dates)))) + (todayp + (aset graph index org-habit-today-glyph))) + (setq face (if (or in-the-past-p todayp) + (car faces) + (cdr faces))) + (when (and in-the-past-p + (not (eq face 'org-habit-overdue-face)) + (not markedp)) + (setq face (cdr faces))) + (put-text-property index (1+ index) 'face face graph) + (put-text-property index (1+ index) + 'help-echo + (concat (format-time-string + (org-time-stamp-format) + (time-add starting (days-to-time (- start (time-to-days starting))))) + (if donep " DONE" "")) + graph)) + (setq start (1+ start) + index (1+ index))) + graph)) + +(defun org-habit-insert-consistency-graphs (&optional line) + "Insert consistency graph for any habitual tasks." + (let ((inhibit-read-only t) + (buffer-invisibility-spec '(org-link)) + (moment (org-time-subtract nil + (* 3600 org-extend-today-until)))) + (save-excursion + (goto-char (if line (point-at-bol) (point-min))) + (while (not (eobp)) + (let ((habit (get-text-property (point) 'org-habit-p)) + (invisible-prop (get-text-property (point) 'invisible))) + (when habit + (move-to-column org-habit-graph-column t) + (delete-char (min (+ 1 org-habit-preceding-days + org-habit-following-days) + (- (line-end-position) (point)))) + (insert-before-markers + (org-habit-build-graph + habit + (time-subtract moment (days-to-time org-habit-preceding-days)) + moment + (time-add moment (days-to-time org-habit-following-days)))) + ;; Inherit invisible state of hidden entries. + (when invisible-prop + (put-text-property + (- (point) org-habit-graph-column) (point) + 'invisible invisible-prop)))) + (forward-line))))) + +(defun org-habit-toggle-habits () + "Toggle display of habits in an agenda buffer." + (interactive) + (org-agenda-check-type t 'agenda) + (setq org-habit-show-habits (not org-habit-show-habits)) + (org-agenda-redo) + (org-agenda-set-mode-name) + (message "Habits turned %s" + (if org-habit-show-habits "on" "off"))) + +(defun org-habit-toggle-display-in-agenda (arg) + "Toggle display of habits in agenda. +With ARG toggle display of all vs. undone scheduled habits. +See `org-habit-show-all-today'." + (interactive "P") + (if (not arg) + (org-habit-toggle-habits) + (org-agenda-check-type t 'agenda) + (setq org-habit-show-all-today (not org-habit-show-all-today)) + (when org-habit-show-habits (org-agenda-redo)))) + +(org-defkey org-agenda-mode-map "K" 'org-habit-toggle-display-in-agenda) + +(provide 'org-habit) + +;;; org-habit.el ends here diff --git a/elpa/org-9.5.2/org-habit.elc b/elpa/org-9.5.2/org-habit.elc new file mode 100644 index 0000000..c05224a Binary files /dev/null and b/elpa/org-9.5.2/org-habit.elc differ diff --git a/elpa/org-9.5.2/org-id.el b/elpa/org-9.5.2/org-id.el new file mode 100644 index 0000000..56783d1 --- /dev/null +++ b/elpa/org-9.5.2/org-id.el @@ -0,0 +1,755 @@ +;;; org-id.el --- Global identifiers for Org entries -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements globally unique identifiers for Org entries. +;; Identifiers are stored in the entry as an :ID: property. Functions +;; are provided that create and retrieve such identifiers, and that find +;; entries based on the identifier. + +;; Identifiers consist of a prefix (default "Org" given by the variable +;; `org-id-prefix') and a unique part that can be created by a number +;; of different methods, see the variable `org-id-method'. +;; Org has a builtin method that uses a compact encoding of the creation +;; time of the ID, with microsecond accuracy. This virtually +;; guarantees globally unique identifiers, even if several people are +;; creating IDs at the same time in files that will eventually be used +;; together. +;; +;; By default Org uses UUIDs as global unique identifiers. +;; +;; This file defines the following API: +;; +;; org-id-get-create +;; Create an ID for the entry at point if it does not yet have one. +;; Returns the ID (old or new). This function can be used +;; interactively, with prefix argument the creation of a new ID is +;; forced, even if there was an old one. +;; +;; org-id-get +;; Get the ID property of an entry. Using appropriate arguments +;; to the function, it can also create the ID for this entry. +;; +;; org-id-goto +;; Command to go to a specific ID, this command can be used +;; interactively. +;; +;; org-id-get-with-outline-path-completion +;; Retrieve the ID of an entry, using outline path completion. +;; This function can work for multiple files. +;; +;; org-id-get-with-outline-drilling +;; Retrieve the ID of an entry, using outline path completion. +;; This function only works for the current file. +;; +;; org-id-find +;; Find the location of an entry with specific id. +;; + +;;; Code: + +(require 'org) +(require 'org-refile) +(require 'ol) + +(declare-function message-make-fqdn "message" ()) +(declare-function org-goto-location "org-goto" (&optional _buf help)) + +;;; Customization + +(defgroup org-id nil + "Options concerning global entry identifiers in Org mode." + :tag "Org ID" + :group 'org) + +(defcustom org-id-link-to-org-use-id nil + "Non-nil means storing a link to an Org file will use entry IDs. +\\<org-mode-map> +The variable can have the following values: + +t Create an ID if needed to make a link to the current entry. + +create-if-interactive + If `org-store-link' is called directly (interactively, as a user + command), do create an ID to support the link. But when doing the + job for capture, only use the ID if it already exists. The + purpose of this setting is to avoid proliferation of unwanted + IDs, just because you happen to be in an Org file when you + call `org-capture' that automatically and preemptively creates a + link. If you do want to get an ID link in a capture template to + an entry not having an ID, create it first by explicitly creating + a link to it, using `\\[org-store-link]' first. + +create-if-interactive-and-no-custom-id + Like create-if-interactive, but do not create an ID if there is + a CUSTOM_ID property defined in the entry. + +use-existing + Use existing ID, do not create one. + +nil Never use an ID to make a link, instead link using a text search for + the headline text." + :group 'org-link-store + :group 'org-id + :version "24.3" + :type '(choice + (const :tag "Create ID to make link" t) + (const :tag "Create if storing link interactively" + create-if-interactive) + (const :tag "Create if storing link interactively and no CUSTOM_ID is present" + create-if-interactive-and-no-custom-id) + (const :tag "Only use existing" use-existing) + (const :tag "Do not use ID to create link" nil))) + +(defcustom org-id-uuid-program "uuidgen" + "The uuidgen program." + :group 'org-id + :type 'string) + +(defcustom org-id-ts-format "%Y%m%dT%H%M%S.%6N" + "Timestamp format for IDs generated using `ts' `org-id-method'. +The format should be suitable to pass as an argument to `format-time-string'. + +Defaults to ISO8601 timestamps without separators and without +timezone, local time and precision down to 1e-6 seconds." + :type 'string + :package-version '(Org . "9.5")) + +(defcustom org-id-method 'uuid + "The method that should be used to create new IDs. + +An ID will consist of the optional prefix specified in `org-id-prefix', +and a unique part created by the method this variable specifies. + +Allowed values are: + +org Org's own internal method, using an encoding of the current time to + microsecond accuracy, and optionally the current domain of the + computer. See the variable `org-id-include-domain'. + +uuid Create random (version 4) UUIDs. If the program defined in + `org-id-uuid-program' is available it is used to create the ID. + Otherwise an internal functions is used. + +ts Create ID's based on timestamps as specified in `org-id-ts-format'." + :group 'org-id + :type '(choice + (const :tag "Org's internal method" org) + (const :tag "external: uuidgen" uuid) + (const :tag "Timestamp with format `org-id-ts-format'" ts))) + +(defcustom org-id-prefix nil + "The prefix for IDs. + +This may be a string, or it can be nil to indicate that no prefix is required. +When a string, the string should have no space characters as IDs are expected +to have no space characters in them." + :group 'org-id + :type '(choice + (const :tag "No prefix") + (string :tag "Prefix"))) + +(defcustom org-id-include-domain nil + "Non-nil means add the domain name to new IDs. +This ensures global uniqueness of IDs, and is also suggested by +the relevant RFCs. This is relevant only if `org-id-method' is +`org' or `ts'. When uuidgen is used, the domain will never be added. + +The default is to not use this because we have no really good way to get +the true domain, and Org entries will normally not be shared with enough +people to make this necessary." + :group 'org-id + :type 'boolean) + +(defcustom org-id-track-globally t + "Non-nil means track IDs through files, so that links work globally. +This work by maintaining a hash table for IDs and writing this table +to disk when exiting Emacs. Because of this, it works best if you use +a single Emacs process, not many. + +When nil, IDs are not tracked. Links to IDs will still work within +a buffer, but not if the entry is located in another file. +IDs can still be used if the entry with the id is in the same file as +the link." + :group 'org-id + :type 'boolean) + +(defcustom org-id-locations-file (convert-standard-filename + (concat user-emacs-directory ".org-id-locations")) + "The file for remembering in which file an ID was defined. +This variable is only relevant when `org-id-track-globally' is set." + :group 'org-id + :type 'file) + +(defcustom org-id-locations-file-relative nil + "Determine if `org-id-locations' should be stored as relative links. +Non-nil means that links to locations are stored as links +relative to the location of where `org-id-locations-file' is +stored. + +Nil means to store absolute paths to files. + +This customization is useful when folders are shared across +systems but mounted at different roots. Relative path to +`org-id-locations-file' still has to be maintained across +systems." + :group 'org-id + :type 'boolean + :package-version '(Org . "9.3")) + +(defvar org-id-locations nil + "List of files with IDs in those files.") + +(defvar org-id-files nil + "List of files that contain IDs.") + +(defcustom org-id-extra-files 'org-agenda-text-search-extra-files + "Files to be searched for IDs, besides the agenda files. +When Org reparses files to remake the list of files and IDs it is tracking, +it will normally scan the agenda files, the archives related to agenda files, +any files that are listed as ID containing in the current register, and +any Org file currently visited by Emacs. +You can list additional files here. +This variable is only relevant when `org-id-track-globally' is set." + :group 'org-id + :type + '(choice + (symbol :tag "Variable") + (repeat :tag "List of files" + (file)))) + +(defcustom org-id-search-archives t + "Non-nil means search also the archive files of agenda files for entries. +This is a possibility to reduce overhead, but it means that entries moved +to the archives can no longer be found by ID. +This variable is only relevant when `org-id-track-globally' is set." + :group 'org-id + :type 'boolean) + +;;; The API functions + +;;;###autoload +(defun org-id-get-create (&optional force) + "Create an ID for the current entry and return it. +If the entry already has an ID, just return it. +With optional argument FORCE, force the creation of a new ID." + (interactive "P") + (when force + (org-entry-put (point) "ID" nil)) + (org-id-get (point) 'create)) + +;;;###autoload +(defun org-id-copy () + "Copy the ID of the entry at point to the kill ring. +Create an ID if necessary." + (interactive) + (org-kill-new (org-id-get nil 'create))) + +(defvar org-id-overriding-file-name nil + "Tell `org-id-get' to use this as the file name when creating an ID. +This is useful when working with contents in a temporary buffer +that will be copied back to the original.") + +;;;###autoload +(defun org-id-get (&optional pom create prefix) + "Get the ID property of the entry at point-or-marker POM. +If POM is nil, refer to the entry at point. +If the entry does not have an ID, the function returns nil. +However, when CREATE is non-nil, create an ID if none is present already. +PREFIX will be passed through to `org-id-new'. +In any case, the ID of the entry is returned." + (org-with-point-at pom + (let ((id (org-entry-get nil "ID"))) + (cond + ((and id (stringp id) (string-match "\\S-" id)) + id) + (create + (setq id (org-id-new prefix)) + (org-entry-put pom "ID" id) + (org-id-add-location id + (or org-id-overriding-file-name + (buffer-file-name (buffer-base-buffer)))) + id))))) + +;;;###autoload +(defun org-id-get-with-outline-path-completion (&optional targets) + "Use `outline-path-completion' to retrieve the ID of an entry. +TARGETS may be a setting for `org-refile-targets' to define +eligible headlines. When omitted, all headlines in the current +file are eligible. This function returns the ID of the entry. +If necessary, the ID is created." + (let* ((org-refile-targets (or targets '((nil . (:maxlevel . 10))))) + (org-refile-use-outline-path + (if (caar org-refile-targets) 'file t)) + (org-refile-target-verify-function nil) + (spos (org-refile-get-location "Entry")) + (pom (and spos (move-marker (make-marker) (or (nth 3 spos) 1) + (get-file-buffer (nth 1 spos)))))) + (prog1 (org-id-get pom 'create) + (move-marker pom nil)))) + +;;;###autoload +(defun org-id-get-with-outline-drilling () + "Use an outline-cycling interface to retrieve the ID of an entry. +This only finds entries in the current buffer, using `org-goto-location'. +It returns the ID of the entry. If necessary, the ID is created." + (let* ((spos (org-goto-location)) + (pom (and spos (move-marker (make-marker) (car spos))))) + (prog1 (org-id-get pom 'create) + (move-marker pom nil)))) + +;;;###autoload +(defun org-id-goto (id) + "Switch to the buffer containing the entry with id ID. +Move the cursor to that entry in that buffer." + (interactive "sID: ") + (let ((m (org-id-find id 'marker))) + (unless m + (error "Cannot find entry with ID \"%s\"" id)) + (pop-to-buffer-same-window (marker-buffer m)) + (goto-char m) + (move-marker m nil) + (org-show-context))) + +;;;###autoload +(defun org-id-find (id &optional markerp) + "Return the location of the entry with the id ID. +The return value is a cons cell (file-name . position), or nil +if there is no entry with that ID. +With optional argument MARKERP, return the position as a new marker." + (cond + ((symbolp id) (setq id (symbol-name id))) + ((numberp id) (setq id (number-to-string id)))) + (let ((file (org-id-find-id-file id)) + org-agenda-new-buffers where) + (when file + (setq where (org-id-find-id-in-file id file markerp))) + (unless where + (org-id-update-id-locations nil t) + (setq file (org-id-find-id-file id)) + (when file + (setq where (org-id-find-id-in-file id file markerp)))) + where)) + +;;; Internal functions + +;; Creating new IDs + +;;;###autoload +(defun org-id-new (&optional prefix) + "Create a new globally unique ID. + +An ID consists of two parts separated by a colon: +- a prefix +- a unique part that will be created according to `org-id-method'. + +PREFIX can specify the prefix, the default is given by the variable +`org-id-prefix'. However, if PREFIX is the symbol `none', don't use any +prefix even if `org-id-prefix' specifies one. + +So a typical ID could look like \"Org:4nd91V40HI\"." + (let* ((prefix (if (eq prefix 'none) + "" + (concat (or prefix org-id-prefix) ":"))) + unique) + (if (equal prefix ":") (setq prefix "")) + (cond + ((memq org-id-method '(uuidgen uuid)) + (setq unique (org-trim (shell-command-to-string org-id-uuid-program))) + (unless (org-uuidgen-p unique) + (setq unique (org-id-uuid)))) + ((eq org-id-method 'org) + (let* ((etime (org-reverse-string (org-id-time-to-b36))) + (postfix (when org-id-include-domain + (require 'message) + (concat "@" (message-make-fqdn))))) + (setq unique (concat etime postfix)))) + ((eq org-id-method 'ts) + (let ((ts (format-time-string org-id-ts-format)) + (postfix (when org-id-include-domain + (require 'message) + (concat "@" (message-make-fqdn))))) + (setq unique (concat ts postfix)))) + (t (error "Invalid `org-id-method'"))) + (concat prefix unique))) + +(defun org-id-uuid () + "Return string with random (version 4) UUID." + (let ((rnd (md5 (format "%s%s%s%s%s%s%s" + (random) + (org-time-convert-to-list nil) + (user-uid) + (emacs-pid) + (user-full-name) + user-mail-address + (recent-keys))))) + (format "%s-%s-4%s-%s%s-%s" + (substring rnd 0 8) + (substring rnd 8 12) + (substring rnd 13 16) + (format "%x" + (logior + #b10000000 + (logand + #b10111111 + (string-to-number + (substring rnd 16 18) 16)))) + (substring rnd 18 20) + (substring rnd 20 32)))) + +(defun org-id-int-to-b36-one-digit (integer) + "Convert INTEGER between 0 and 61 into a single character 0..9, A..Z, a..z." + (cond + ((< integer 10) (+ ?0 integer)) + ((< integer 36) (+ ?a integer -10)) + (t (error "Larger that 35")))) + +(defun org-id-b36-to-int-one-digit (i) + "Convert character 0..9, A..Z, a..z into a number 0..61. +The input I may be a character, or a single-letter string." + (and (stringp i) (setq i (string-to-char i))) + (cond + ((and (>= i ?0) (<= i ?9)) (- i ?0)) + ((and (>= i ?a) (<= i ?z)) (+ (- i ?a) 10)) + (t (error "Invalid b36 letter")))) + +(defun org-id-int-to-b36 (integer &optional length) + "Convert an INTEGER to a base-36 number represented as a string. +The returned string is padded with leading zeros to LENGTH if necessary." + (let ((s "") + (i integer)) + (while (> i 0) + (setq s (concat (char-to-string + (org-id-int-to-b36-one-digit (mod i 36))) s) + i (/ i 36))) + (setq length (max 1 (or length 1))) + (if (< (length s) length) + (setq s (concat (make-string (- length (length s)) ?0) s))) + s)) + +(defun org-id-b36-to-int (string) + "Convert a base-36 STRING into the corresponding integer." + (let ((r 0)) + (mapc (lambda (i) (setq r (+ (* r 36) (org-id-b36-to-int-one-digit i)))) + string) + r)) + +(defun org-id-time-to-b36 (&optional time) + "Encode TIME as a 12-digit string. +This string holds the time to micro-second accuracy, and can be decoded +using `org-id-decode'." + ;; FIXME: If TIME represents N seconds after the epoch, then + ;; this encoding assumes 0 <= N < 110075314176 = (* (expt 36 4) 65536), + ;; i.e., that TIME is from 1970-01-01 00:00:00 to 5458-02-23 20:09:36 UTC. + (setq time (org-time-convert-to-list nil)) + (concat (org-id-int-to-b36 (nth 0 time) 4) + (org-id-int-to-b36 (nth 1 time) 4) + (org-id-int-to-b36 (nth 2 time) 4))) + +(defun org-id-decode (id) + "Split ID into the prefix and the time value that was used to create it. +The return value is (prefix . time) where PREFIX is nil or a string, +and TIME is a Lisp time value (HI LO USEC)." + (let (prefix time parts) + (setq parts (org-split-string id ":")) + (if (= 2 (length parts)) + (setq prefix (car parts) time (nth 1 parts)) + (setq prefix nil time (nth 0 parts))) + (setq time (org-reverse-string time)) + (setq time (list (org-id-b36-to-int (substring time 0 4)) + (org-id-b36-to-int (substring time 4 8)) + (org-id-b36-to-int (substring time 8 12)))) + (cons prefix time))) + +;; Storing ID locations (files) + +;;;###autoload +(defun org-id-update-id-locations (&optional files silent) + "Scan relevant files for IDs. +Store the relation between files and corresponding IDs. +This will scan all agenda files, all associated archives, and all +files currently mentioned in `org-id-locations'. +When FILES is given, scan also these files. +If SILENT is non-nil, messages are suppressed." + (interactive) + (unless org-id-track-globally + (error "Please turn on `org-id-track-globally' if you want to track IDs")) + (setq org-id-locations nil) + (let* ((files + (delete-dups + (mapcar #'file-truename + (cl-remove-if-not + ;; Default `org-id-extra-files' value contains + ;; `agenda-archives' symbol. + #'stringp + (append + ;; Agenda files and all associated archives. + (org-agenda-files t org-id-search-archives) + ;; Explicit extra files. + (if (symbolp org-id-extra-files) + (symbol-value org-id-extra-files) + org-id-extra-files) + ;; All files known to have IDs. + org-id-files + ;; Additional files from function call. + files))))) + (nfiles (length files)) + (id-regexp + (rx (seq bol (0+ (any "\t ")) ":ID:" (1+ " ") (not (any " "))))) + (seen-ids nil) + (ndup 0) + (i 0)) + (with-temp-buffer + (delay-mode-hooks + (org-mode) + (dolist (file files) + (when (file-exists-p file) + (unless silent + (cl-incf i) + (message "Finding ID locations (%d/%d files): %s" i nfiles file)) + (insert-file-contents file nil nil nil 'replace) + (let ((ids nil) + (case-fold-search t)) + (org-with-point-at 1 + (while (re-search-forward id-regexp nil t) + (when (org-at-property-p) + (push (org-entry-get (point) "ID") ids))) + (when ids + (push (cons (abbreviate-file-name file) ids) + org-id-locations) + (dolist (id ids) + (cond + ((not (member id seen-ids)) (push id seen-ids)) + (silent nil) + (t + (message "Duplicate ID %S" id) + (cl-incf ndup))))))))))) + (setq org-id-files (mapcar #'car org-id-locations)) + (org-id-locations-save) + ;; Now convert to a hash table. + (setq org-id-locations (org-id-alist-to-hash org-id-locations)) + (when (and (not silent) (> ndup 0)) + (warn "WARNING: %d duplicate IDs found, check *Messages* buffer" ndup)) + (message "%d files scanned, %d files contains IDs, and %d IDs found." + nfiles (length org-id-files) (hash-table-count org-id-locations)) + org-id-locations)) + +(defun org-id-locations-save () + "Save `org-id-locations' in `org-id-locations-file'." + (when (and org-id-track-globally org-id-locations) + (let ((out (if (hash-table-p org-id-locations) + (org-id-hash-to-alist org-id-locations) + org-id-locations))) + (when (and org-id-locations-file-relative out) + (setq out (mapcar + (lambda (item) + (if (file-name-absolute-p (car item)) + (cons (file-relative-name + (car item) (file-name-directory + org-id-locations-file)) + (cdr item)) + item)) + out))) + (with-temp-file org-id-locations-file + (let ((print-level nil) + (print-length nil)) + (print out (current-buffer))))))) + +(defun org-id-locations-load () + "Read the data from `org-id-locations-file'." + (setq org-id-locations nil) + (when org-id-track-globally + (with-temp-buffer + (condition-case nil + (progn + (insert-file-contents org-id-locations-file) + (setq org-id-locations (read (current-buffer))) + (let ((loc (file-name-directory org-id-locations-file))) + (mapc (lambda (item) + (unless (file-name-absolute-p (car item)) + (setf (car item) (expand-file-name (car item) loc)))) + org-id-locations))) + (error + (message "Could not read `org-id-values' from %s, setting it to nil" + org-id-locations-file)))) + (setq org-id-files (mapcar 'car org-id-locations)) + (setq org-id-locations (org-id-alist-to-hash org-id-locations)))) + +(defun org-id-add-location (id file) + "Add the ID with location FILE to the database of ID locations." + ;; Only if global tracking is on, and when the buffer has a file + (unless file + (error "`org-id-get' expects a file-visiting buffer")) + (let ((afile (abbreviate-file-name file))) + (when (and org-id-track-globally id) + (unless org-id-locations (org-id-locations-load)) + (puthash id afile org-id-locations) + (unless (member afile org-id-files) + (add-to-list 'org-id-files afile))))) + +(unless noninteractive + (add-hook 'kill-emacs-hook 'org-id-locations-save)) + +(defun org-id-hash-to-alist (hash) + "Turn an org-id HASH into an alist. +This is to be able to write it to a file." + (let (res x) + (maphash + (lambda (k v) + (if (setq x (assoc v res)) + (setcdr x (cons k (cdr x))) + (push (list v k) res))) + hash) + res)) + +(defun org-id-alist-to-hash (list) + "Turn an org-id location LIST into a hash table." + (let ((res (make-hash-table + :test 'equal + :size (apply '+ (mapcar 'length list)))) + f) + (mapc + (lambda (x) + (setq f (car x)) + (mapc (lambda (i) (puthash i f res)) (cdr x))) + list) + res)) + +(defun org-id-paste-tracker (txt &optional buffer-or-file) + "Update any ids in TXT and assign BUFFER-OR-FILE to them." + (when org-id-track-globally + (save-match-data + (setq buffer-or-file (or buffer-or-file (current-buffer))) + (when (bufferp buffer-or-file) + (setq buffer-or-file (or (buffer-base-buffer buffer-or-file) + buffer-or-file)) + (setq buffer-or-file (buffer-file-name buffer-or-file))) + (when buffer-or-file + (let ((fname (abbreviate-file-name buffer-or-file)) + (s 0)) + (while (string-match "^[ \t]*:ID:[ \t]+\\([^ \t\n\r]+\\)" txt s) + (setq s (match-end 0)) + (org-id-add-location (match-string 1 txt) fname))))))) + +;; Finding entries with specified id + +;;;###autoload +(defun org-id-find-id-file (id) + "Query the id database for the file in which ID is located." + (unless org-id-locations (org-id-locations-load)) + (or (and org-id-locations + (hash-table-p org-id-locations) + (gethash id org-id-locations)) + ;; Fall back on current buffer + (buffer-file-name (or (buffer-base-buffer (current-buffer)) + (current-buffer))))) + +(defun org-id-find-id-in-file (id file &optional markerp) + "Return the position of the entry ID in FILE. + +If that files does not exist, or if it does not contain this ID, +return nil. + +The position is returned as a cons cell (file-name . position). With +optional argument MARKERP, return the position as a new marker." + (cond + ((not file) nil) + ((not (file-exists-p file)) nil) + (t + (let* ((visiting (find-buffer-visiting file)) + (buffer (or visiting (find-file-noselect file)))) + (unwind-protect + (with-current-buffer buffer + (let ((pos (org-find-entry-with-id id))) + (cond + ((null pos) nil) + (markerp (move-marker (make-marker) pos buffer)) + (t (cons file pos))))) + ;; Remove opened buffer in the process. + (unless (or visiting markerp) (kill-buffer buffer))))))) + +;; id link type + +;; Calling the following function is hard-coded into `org-store-link', +;; so we do have to add it to `org-store-link-functions'. + +;;;###autoload +(defun org-id-store-link () + "Store a link to the current entry, using its ID. + +If before first heading store first title-keyword as description +or filename if no title." + (interactive) + (when (and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 'org-mode)) + (let* ((link (concat "id:" (org-id-get-create))) + (case-fold-search nil) + (desc (save-excursion + (org-back-to-heading-or-point-min t) + (cond ((org-before-first-heading-p) + (let ((keywords (org-collect-keywords '("TITLE")))) + (if keywords + (cadr (assoc "TITLE" keywords)) + (file-name-nondirectory + (buffer-file-name (buffer-base-buffer)))))) + ((looking-at org-complex-heading-regexp) + (if (match-end 4) + (match-string 4) + (match-string 0))) + (t link))))) + (org-link-store-props :link link :description desc :type "id") + link))) + +(defun org-id-open (id _) + "Go to the entry with id ID." + (org-mark-ring-push) + (let ((m (org-id-find id 'marker)) + cmd) + (unless m + (error "Cannot find entry with ID \"%s\"" id)) + ;; Use a buffer-switching command in analogy to finding files + (setq cmd + (or + (cdr + (assq + (cdr (assq 'file org-link-frame-setup)) + '((find-file . switch-to-buffer) + (find-file-other-window . switch-to-buffer-other-window) + (find-file-other-frame . switch-to-buffer-other-frame)))) + 'switch-to-buffer-other-window)) + (if (not (equal (current-buffer) (marker-buffer m))) + (funcall cmd (marker-buffer m))) + (goto-char m) + (move-marker m nil) + (org-show-context))) + +(org-link-set-parameters "id" :follow #'org-id-open) + +(provide 'org-id) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-id.el ends here diff --git a/elpa/org-9.5.2/org-id.elc b/elpa/org-9.5.2/org-id.elc new file mode 100644 index 0000000..ffb9e10 Binary files /dev/null and b/elpa/org-9.5.2/org-id.elc differ diff --git a/elpa/org-9.5.2/org-indent.el b/elpa/org-9.5.2/org-indent.el new file mode 100644 index 0000000..e0cb697 --- /dev/null +++ b/elpa/org-9.5.2/org-indent.el @@ -0,0 +1,428 @@ +;;; org-indent.el --- Dynamic indentation for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. +;; +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This is an implementation of dynamic virtual indentation. It works +;; by adding text properties to a buffer to make sure lines are +;; indented according to outline structure. +;; +;; The process is synchronous, toggled at every buffer modification. +;; Though, the initialization (indentation of text already in the +;; buffer), which can take a few seconds in large buffers, happens on +;; idle time. +;; +;;; Code: + +(require 'org-macs) +(require 'org-compat) +(require 'org) + +(require 'cl-lib) + +(declare-function org-inlinetask-get-task-level "org-inlinetask" ()) +(declare-function org-inlinetask-in-task-p "org-inlinetask" ()) +(declare-function org-list-item-body-column "org-list" (item)) +(defvar org-inlinetask-show-first-star) + +(defgroup org-indent nil + "Options concerning dynamic virtual outline indentation." + :tag "Org Indent" + :group 'org) + +(defvar org-indent-inlinetask-first-star (org-add-props "*" '(face org-warning)) + "First star of inline tasks, with correct face.") +(defvar org-indent-agent-timer nil + "Timer running the initialize agent.") +(defvar org-indent-agentized-buffers nil + "List of buffers watched by the initialize agent.") +(defvar org-indent-agent-resume-timer nil + "Timer to reschedule agent after switching to other idle processes.") +(defvar org-indent-agent-active-delay '(0 2 0) + "Time to run agent before switching to other idle processes. +Delay used when the buffer to initialize is current.") +(defvar org-indent-agent-passive-delay '(0 0 400000) + "Time to run agent before switching to other idle processes. +Delay used when the buffer to initialize isn't current.") +(defvar org-indent-agent-resume-delay '(0 0 100000) + "Minimal time for other idle processes before switching back to agent.") +(defvar org-indent--initial-marker nil + "Position of initialization before interrupt. +This is used locally in each buffer being initialized.") +(defvar org-indent-modified-headline-flag nil + "Non-nil means the last deletion operated on a headline. +It is modified by `org-indent-notify-modified-headline'.") + + +(defcustom org-indent-boundary-char ?\s + "The end of the virtual indentation strings, a single-character string. +The default is just a space, but if you wish, you can use \"|\" or so. +This can be useful on a terminal window - under a windowing system, +it may be prettier to customize the `org-indent' face." + :group 'org-indent + :type 'character) + +(defcustom org-indent-mode-turns-off-org-adapt-indentation t + "Non-nil means setting `org-indent-mode' will turn off indentation adaptation. +For details see the variable `org-adapt-indentation'." + :group 'org-indent + :type 'boolean) + +(defcustom org-indent-mode-turns-on-hiding-stars t + "Non-nil means setting `org-indent-mode' will turn on `org-hide-leading-stars'." + :group 'org-indent + :type 'boolean) + +(defcustom org-indent-indentation-per-level 2 + "Indentation per level in number of characters." + :group 'org-indent + :type 'integer) + +(defface org-indent '((t (:inherit org-hide))) + "Face for outline indentation. +The default is to make it look like whitespace. But you may find it +useful to make it ever so slightly different." + :group 'org-faces) + +(defvar org-indent--text-line-prefixes nil + "Vector containing line prefixes strings for regular text.") + +(defvar org-indent--heading-line-prefixes nil + "Vector containing line prefix strings for headlines.") + +(defvar org-indent--inlinetask-line-prefixes nil + "Vector containing line prefix strings for inline tasks.") + +(defconst org-indent--deepest-level 50 + "Maximum theoretical headline depth.") + +(defun org-indent--compute-prefixes () + "Compute prefix strings for regular text and headlines." + (setq org-indent--heading-line-prefixes + (make-vector org-indent--deepest-level nil)) + (setq org-indent--inlinetask-line-prefixes + (make-vector org-indent--deepest-level nil)) + (setq org-indent--text-line-prefixes + (make-vector org-indent--deepest-level nil)) + (when (> org-indent-indentation-per-level 0) + (dotimes (n org-indent--deepest-level) + (let ((indentation (if (<= n 1) 0 + (* (1- org-indent-indentation-per-level) + (1- n))))) + ;; Headlines line prefixes. + (let ((heading-prefix (make-string indentation ?*))) + (aset org-indent--heading-line-prefixes + n + (org-add-props heading-prefix nil 'face 'org-indent)) + ;; Inline tasks line prefixes + (aset org-indent--inlinetask-line-prefixes + n + (cond ((<= n 1) "") + ((bound-and-true-p org-inlinetask-show-first-star) + (concat org-indent-inlinetask-first-star + (substring heading-prefix 1))) + (t (org-add-props heading-prefix nil 'face 'org-indent))))) + ;; Text line prefixes. + (aset org-indent--text-line-prefixes + n + (org-add-props + (concat (make-string (+ n indentation) ?\s) + (and (> n 0) + (char-to-string org-indent-boundary-char))) + nil 'face 'org-indent)))))) + +(defsubst org-indent-remove-properties (beg end) + "Remove indentations between BEG and END." + (with-silent-modifications + (remove-text-properties beg end '(line-prefix nil wrap-prefix nil)))) + +;;;###autoload +(define-minor-mode org-indent-mode + "When active, indent text according to outline structure. + +Internally this works by adding `line-prefix' and `wrap-prefix' +properties, after each buffer modification, on the modified zone. + +The process is synchronous. Though, initial indentation of +buffer, which can take a few seconds on large buffers, is done +during idle time." + :lighter " Ind" + (cond + (org-indent-mode + ;; mode was turned on. + (setq-local indent-tabs-mode nil) + (setq-local org-indent--initial-marker (copy-marker 1)) + (when org-indent-mode-turns-off-org-adapt-indentation + ;; Don't turn off `org-adapt-indentation' when its value is + ;; 'headline-data, just indent headline data specially. + (or (eq org-adapt-indentation 'headline-data) + (setq-local org-adapt-indentation nil))) + (when org-indent-mode-turns-on-hiding-stars + (setq-local org-hide-leading-stars t)) + (org-indent--compute-prefixes) + (if (boundp 'filter-buffer-substring-functions) + (add-hook 'filter-buffer-substring-functions + (lambda (fun start end delete) + (org-indent-remove-properties-from-string + (funcall fun start end delete))) + nil t) + ;; Emacs >= 24.4. + (add-function :filter-return (local 'filter-buffer-substring-function) + #'org-indent-remove-properties-from-string)) + (add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local) + (add-hook 'before-change-functions + 'org-indent-notify-modified-headline nil 'local) + (and font-lock-mode (org-restart-font-lock)) + (org-indent-remove-properties (point-min) (point-max)) + ;; Submit current buffer to initialize agent. If it's the first + ;; buffer submitted, also start the agent. Current buffer is + ;; pushed in both cases to avoid a race condition. + (if org-indent-agentized-buffers + (push (current-buffer) org-indent-agentized-buffers) + (push (current-buffer) org-indent-agentized-buffers) + (setq org-indent-agent-timer + (run-with-idle-timer 0.2 t #'org-indent-initialize-agent)))) + (t + ;; Mode was turned off (or we refused to turn it on) + (kill-local-variable 'org-adapt-indentation) + (setq org-indent-agentized-buffers + (delq (current-buffer) org-indent-agentized-buffers)) + (when (markerp org-indent--initial-marker) + (set-marker org-indent--initial-marker nil)) + (when (local-variable-p 'org-hide-leading-stars) + (kill-local-variable 'org-hide-leading-stars)) + (if (boundp 'filter-buffer-substring-functions) + (remove-hook 'filter-buffer-substring-functions + (lambda (fun start end delete) + (org-indent-remove-properties-from-string + (funcall fun start end delete)))) + (remove-function (local 'filter-buffer-substring-function) + #'org-indent-remove-properties-from-string)) + (remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local) + (remove-hook 'before-change-functions + 'org-indent-notify-modified-headline 'local) + (org-with-wide-buffer + (org-indent-remove-properties (point-min) (point-max))) + (and font-lock-mode (org-restart-font-lock)) + (redraw-display)))) + +(defun org-indent-indent-buffer () + "Add indentation properties to the accessible part of the buffer." + (interactive) + (if (not (derived-mode-p 'org-mode)) + (error "Not in Org mode") + (message "Setting buffer indentation. It may take a few seconds...") + (org-indent-remove-properties (point-min) (point-max)) + (org-indent-add-properties (point-min) (point-max)) + (message "Indentation of buffer set."))) + +(defun org-indent-remove-properties-from-string (string) + "Remove indentation properties from STRING." + (remove-text-properties 0 (length string) + '(line-prefix nil wrap-prefix nil) string) + string) + +(defun org-indent-initialize-agent () + "Start or resume current buffer initialization. +Only buffers in `org-indent-agentized-buffers' trigger an action. +When no more buffer is being watched, the agent suppress itself." + (when org-indent-agent-resume-timer + (cancel-timer org-indent-agent-resume-timer)) + (setq org-indent-agentized-buffers + (cl-remove-if-not #'buffer-live-p org-indent-agentized-buffers)) + (cond + ;; Job done: kill agent. + ((not org-indent-agentized-buffers) (cancel-timer org-indent-agent-timer)) + ;; Current buffer is agentized: start/resume initialization + ;; somewhat aggressively. + ((memq (current-buffer) org-indent-agentized-buffers) + (org-indent-initialize-buffer (current-buffer) + org-indent-agent-active-delay)) + ;; Else, start/resume initialization of the last agentized buffer, + ;; softly. + (t (org-indent-initialize-buffer (car org-indent-agentized-buffers) + org-indent-agent-passive-delay)))) + +(defun org-indent-initialize-buffer (buffer delay) + "Set virtual indentation for the buffer BUFFER, asynchronously. +Give hand to other idle processes if it takes longer than DELAY, +a time value." + (with-current-buffer buffer + (when org-indent-mode + (org-with-wide-buffer + (let ((interruptp + ;; Always nil unless interrupted. + (catch 'interrupt + (and org-indent--initial-marker + (marker-position org-indent--initial-marker) + (equal (marker-buffer org-indent--initial-marker) + buffer) + (org-indent-add-properties org-indent--initial-marker + (point-max) + delay) + nil)))) + (move-marker org-indent--initial-marker interruptp) + ;; Job is complete: un-agentize buffer. + (unless interruptp + (setq org-indent-agentized-buffers + (delq buffer org-indent-agentized-buffers)))))))) + +(defun org-indent-set-line-properties (level indentation &optional heading) + "Set prefix properties on current line an move to next one. + +LEVEL is the current level of heading. INDENTATION is the +expected indentation when wrapping line. + +When optional argument HEADING is non-nil, assume line is at +a heading. Moreover, if it is `inlinetask', the first star will +have `org-warning' face." + (let* ((line (aref (pcase heading + (`nil org-indent--text-line-prefixes) + (`inlinetask org-indent--inlinetask-line-prefixes) + (_ org-indent--heading-line-prefixes)) + level)) + (wrap + (org-add-props + (concat line + (if heading (concat (make-string level ?*) " ") + (make-string indentation ?\s))) + nil 'face 'org-indent))) + ;; Add properties down to the next line to indent empty lines. + (add-text-properties (line-beginning-position) (line-beginning-position 2) + `(line-prefix ,line wrap-prefix ,wrap))) + (forward-line)) + +(defun org-indent-add-properties (beg end &optional delay) + "Add indentation properties between BEG and END. + +When DELAY is non-nil, it must be a time value. In that case, +the process is asynchronous and can be interrupted, either by +user request, or after DELAY. This is done by throwing the +`interrupt' tag along with the buffer position where the process +stopped." + (save-match-data + (org-with-wide-buffer + (goto-char beg) + (beginning-of-line) + ;; Initialize prefix at BEG, according to current entry's level. + (let* ((case-fold-search t) + (limited-re (org-get-limited-outline-regexp)) + (level (or (org-current-level) 0)) + (time-limit (and delay (org-time-add nil delay)))) + ;; For each line, set `line-prefix' and `wrap-prefix' + ;; properties depending on the type of line (headline, inline + ;; task, item or other). + (with-silent-modifications + (while (and (<= (point) end) (not (eobp))) + (cond + ;; When in asynchronous mode, check if interrupt is + ;; required. + ((and delay (input-pending-p)) (throw 'interrupt (point))) + ;; In asynchronous mode, take a break of + ;; `org-indent-agent-resume-delay' every DELAY to avoid + ;; blocking any other idle timer or process output. + ((and delay (org-time-less-p time-limit nil)) + (setq org-indent-agent-resume-timer + (run-with-idle-timer + (time-add (current-idle-time) org-indent-agent-resume-delay) + nil #'org-indent-initialize-agent)) + (throw 'interrupt (point))) + ;; Headline or inline task. + ((looking-at org-outline-regexp) + (let* ((nstars (- (match-end 0) (match-beginning 0) 1)) + (type (or (looking-at-p limited-re) 'inlinetask))) + (org-indent-set-line-properties nstars 0 type) + ;; At an headline, define new value for LEVEL. + (unless (eq type 'inlinetask) (setq level nstars)))) + ;; List item: `wrap-prefix' is set where body starts. + ((org-at-item-p) + (org-indent-set-line-properties + level (org-list-item-body-column (point)))) + ;; Regular line. + (t + (org-indent-set-line-properties + level + (current-indentation) + ;; When adapt indentation is 'headline-data, use + ;; `org-indent--heading-line-prefixes' for setting + ;; headline data indentation. + (and (eq org-adapt-indentation 'headline-data) + (or (org-at-planning-p) + (org-at-clock-log-p) + (looking-at-p org-property-start-re) + (looking-at-p org-property-end-re) + (looking-at-p org-property-re)))))))))))) + +(defun org-indent-notify-modified-headline (beg end) + "Set `org-indent-modified-headline-flag' depending on context. + +BEG and END are the positions of the beginning and end of the +range of deleted text. + +This function is meant to be called by `before-change-functions'. +Flag will be non-nil if command is going to modify or delete an +headline." + (when org-indent-mode + (setq org-indent-modified-headline-flag + (org-with-wide-buffer + (goto-char beg) + (save-match-data + (or (and (org-at-heading-p) (< beg (match-end 0))) + (re-search-forward + (org-with-limited-levels org-outline-regexp-bol) end t))))))) + +(defun org-indent-refresh-maybe (beg end _) + "Refresh indentation properties in an adequate portion of buffer. +BEG and END are the positions of the beginning and end of the +range of inserted text. DUMMY is an unused argument. + +This function is meant to be called by `after-change-functions'." + (when org-indent-mode + (save-match-data + ;; If a headline was modified or inserted, set properties until + ;; next headline. + (org-with-wide-buffer + (if (or org-indent-modified-headline-flag + (save-excursion + (goto-char beg) + (beginning-of-line) + (re-search-forward + (org-with-limited-levels org-outline-regexp-bol) end t))) + (let ((end (save-excursion + (goto-char end) + (org-with-limited-levels (outline-next-heading)) + (point)))) + (setq org-indent-modified-headline-flag nil) + (org-indent-add-properties beg end)) + ;; Otherwise, only set properties on modified area. + (org-indent-add-properties beg end)))))) + +(provide 'org-indent) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-indent.el ends here diff --git a/elpa/org-9.5.2/org-indent.elc b/elpa/org-9.5.2/org-indent.elc new file mode 100644 index 0000000..08bf535 Binary files /dev/null and b/elpa/org-9.5.2/org-indent.elc differ diff --git a/elpa/org-9.5.2/org-inlinetask.el b/elpa/org-9.5.2/org-inlinetask.el new file mode 100644 index 0000000..3379a2e --- /dev/null +++ b/elpa/org-9.5.2/org-inlinetask.el @@ -0,0 +1,354 @@ +;;; org-inlinetask.el --- Tasks Independent of Outline Hierarchy -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; This module implements inline tasks in Org mode. Inline tasks are +;; tasks that have all the properties of normal outline nodes, +;; including the ability to store meta data like scheduling dates, +;; TODO state, tags and properties. However, these nodes are treated +;; specially by the visibility cycling. +;; +;; Visibility cycling exempts these nodes from cycling. So whenever +;; their parent is opened, so are these tasks. This will only work +;; with `org-cycle', so if you are also using other commands to +;; show/hide entries, you will occasionally find these tasks to behave +;; like all other outline nodes, seemingly splitting the text of the +;; parent into children. +;; +;; Special fontification of inline tasks, so that they can be +;; immediately recognized. From the stars of the headline, only last +;; two will be visible, the others will be hidden using the `org-hide' +;; face. +;; +;; An inline task is identified solely by a minimum outline level, +;; given by the variable `org-inlinetask-min-level', default 15. +;; +;; If you need to have a time planning line (DEADLINE etc), drawers, +;; for example LOGBOOK of PROPERTIES, or even normal text as part of +;; the inline task, you must add an "END" headline with the same +;; number of stars. +;; +;; As an example, here are two valid inline tasks: +;; +;; **************** TODO A small task +;; +;; and +;; +;; **************** TODO Another small task +;; DEADLINE: <2009-03-30 Mon> +;; :PROPERTIES: +;; :SOMETHING: another thing +;; :END: +;; And here is some extra text +;; **************** END +;; +;; Also, if you want to use refiling and archiving for inline tasks, +;; The END line must be present to make things work properly. +;; +;; Note that you should not try to use inline tasks within plain list, +;; visibility cycling is known to be problematic when doing so. +;; +;; This package installs one new command: +;; +;; C-c C-x t Insert a new inline task with END line + +;;; Code: + +(require 'org) + +(defgroup org-inlinetask nil + "Options concerning inline tasks in Org mode." + :tag "Org Inline Tasks" + :group 'org-structure) + +(defcustom org-inlinetask-min-level 15 + "Minimum level a headline must have before it is treated as an inline task. +Don't set it to something higher than `29' or clocking will break since this +is the hardcoded maximum number of stars `org-clock-sum' will work with. + +It is strongly recommended that you set `org-cycle-max-level' not at all, +or to a number smaller than this one. In fact, when `org-cycle-max-level' is +not set, it will be assumed to be one less than the value of smaller than +the value of this variable." + :group 'org-inlinetask + :type '(choice + (const :tag "Off" nil) + (integer))) + +(defcustom org-inlinetask-show-first-star nil + "Non-nil means display the first star of an inline task as additional marker. +When nil, the first star is not shown." + :tag "Org Inline Tasks" + :group 'org-structure + :type 'boolean) + +(defvar org-odd-levels-only) +(defvar org-keyword-time-regexp) +(defvar org-complex-heading-regexp) +(defvar org-property-end-re) + +(defcustom org-inlinetask-default-state nil + "Non-nil means make inline tasks have a TODO keyword initially. +This should be the state `org-inlinetask-insert-task' should use by +default, or nil if no state should be assigned." + :group 'org-inlinetask + :version "24.1" + :type '(choice + (const :tag "No state" nil) + (string :tag "Specific state"))) + +(defun org-inlinetask-insert-task (&optional no-state) + "Insert an inline task. +If prefix arg NO-STATE is set, ignore `org-inlinetask-default-state'. +If there is a region wrap it inside the inline task." + (interactive "P") + ;; Error when inside an inline task, except if point was at its very + ;; beginning, in which case the new inline task will be inserted + ;; before this one. + (when (and (org-inlinetask-in-task-p) + (not (and (org-inlinetask-at-task-p) (bolp)))) + (user-error "Cannot nest inline tasks")) + (or (bolp) (newline)) + (let* ((indent (if org-odd-levels-only + (1- (* 2 org-inlinetask-min-level)) + org-inlinetask-min-level)) + (indent-string (concat (make-string indent ?*) " ")) + (rbeg (if (org-region-active-p) (region-beginning) (point))) + (rend (if (org-region-active-p) (region-end) (point)))) + (goto-char rend) + (insert "\n" indent-string "END\n") + (goto-char rbeg) + (unless (bolp) (insert "\n")) + (insert indent-string + (if (or no-state (not org-inlinetask-default-state)) + "" + (concat org-inlinetask-default-state " ")) + (if (= rend rbeg) "" "\n")) + (unless (= rend rbeg) (end-of-line 0)))) +(define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task) + +(defun org-inlinetask-outline-regexp () + "Return string matching an inline task heading. +The number of levels is controlled by `org-inlinetask-min-level'." + (let ((nstars (if org-odd-levels-only + (1- (* org-inlinetask-min-level 2)) + org-inlinetask-min-level))) + (format "^\\(\\*\\{%d,\\}\\)[ \t]+" nstars))) + +(defun org-inlinetask-end-p () + "Return a non-nil value if point is on inline task's END part." + (let ((case-fold-search t)) + (org-match-line (concat (org-inlinetask-outline-regexp) "END[ \t]*$")))) + +(defun org-inlinetask-at-task-p () + "Return non-nil if point is at beginning of an inline task." + (and (org-match-line (concat (org-inlinetask-outline-regexp) "\\(.*\\)")) + (not (org-inlinetask-end-p)))) + +(defun org-inlinetask-in-task-p () + "Return true if point is inside an inline task." + (save-excursion + (beginning-of-line) + (let ((case-fold-search t)) + (or (looking-at-p (concat (org-inlinetask-outline-regexp) "\\(?:.*\\)")) + (and (re-search-forward "^\\*+[ \t]+" nil t) + (org-inlinetask-end-p)))))) + +(defun org-inlinetask-goto-beginning () + "Go to the beginning of the inline task at point." + (end-of-line) + (let ((case-fold-search t) + (inlinetask-re (org-inlinetask-outline-regexp))) + (re-search-backward inlinetask-re nil t) + (when (org-inlinetask-end-p) + (re-search-backward inlinetask-re nil t)))) + +(defun org-inlinetask-goto-end () + "Go to the end of the inline task at point. +Return point." + (save-match-data + (beginning-of-line) + (let ((case-fold-search t) + (inlinetask-re (org-inlinetask-outline-regexp))) + (cond + ((org-inlinetask-end-p) + (forward-line)) + ((looking-at-p inlinetask-re) + (forward-line) + (cond + ((org-inlinetask-end-p) (forward-line)) + ((looking-at-p inlinetask-re)) + ((org-inlinetask-in-task-p) + (re-search-forward inlinetask-re nil t) + (forward-line)) + (t nil))) + (t + (re-search-forward inlinetask-re nil t) + (forward-line))))) + (point)) + +(defun org-inlinetask-get-task-level () + "Get the level of the inline task around. +This assumes the point is inside an inline task." + (save-excursion + (end-of-line) + (re-search-backward (org-inlinetask-outline-regexp) nil t) + (- (match-end 1) (match-beginning 1)))) + +(defun org-inlinetask-promote () + "Promote the inline task at point. +If the task has an end part, promote it. Also, prevents level from +going below `org-inlinetask-min-level'." + (interactive) + (if (not (org-inlinetask-in-task-p)) + (user-error "Not in an inline task") + (save-excursion + (let* ((lvl (org-inlinetask-get-task-level)) + (next-lvl (org-get-valid-level lvl -1)) + (diff (- next-lvl lvl)) + (down-task (concat (make-string next-lvl ?*))) + beg) + (if (< next-lvl org-inlinetask-min-level) + (user-error "Cannot promote an inline task at minimum level") + (org-inlinetask-goto-beginning) + (setq beg (point)) + (replace-match down-task nil t nil 1) + (org-inlinetask-goto-end) + (if (and (eobp) (looking-back "END\\s-*" (point-at-bol))) + (beginning-of-line) + (forward-line -1)) + (unless (= (point) beg) + (looking-at (org-inlinetask-outline-regexp)) + (replace-match down-task nil t nil 1) + (when (eq org-adapt-indentation t) + (goto-char beg) + (org-fixup-indentation diff)))))))) + +(defun org-inlinetask-demote () + "Demote the inline task at point. +If the task has an end part, also demote it." + (interactive) + (if (not (org-inlinetask-in-task-p)) + (user-error "Not in an inline task") + (save-excursion + (let* ((lvl (org-inlinetask-get-task-level)) + (next-lvl (org-get-valid-level lvl 1)) + (diff (- next-lvl lvl)) + (down-task (concat (make-string next-lvl ?*))) + beg) + (org-inlinetask-goto-beginning) + (setq beg (point)) + (replace-match down-task nil t nil 1) + (org-inlinetask-goto-end) + (if (and (eobp) (looking-back "END\\s-*" (point-at-bol))) + (beginning-of-line) + (forward-line -1)) + (unless (= (point) beg) + (looking-at (org-inlinetask-outline-regexp)) + (replace-match down-task nil t nil 1) + (when (eq org-adapt-indentation t) + (goto-char beg) + (org-fixup-indentation diff))))))) + +(defvar org-indent-indentation-per-level) ; defined in org-indent.el + +(defface org-inlinetask '((t :inherit shadow)) + "Face for inlinetask headlines." + :group 'org-faces) + +(defun org-inlinetask-fontify (limit) + "Fontify the inline tasks down to LIMIT." + (let* ((nstars (if org-odd-levels-only + (1- (* 2 (or org-inlinetask-min-level 200))) + (or org-inlinetask-min-level 200))) + (re (concat "^\\(\\*\\)\\(\\*\\{" + (format "%d" (- nstars 3)) + ",\\}\\)\\(\\*\\* .*\\)")) + ;; Virtual indentation will add the warning face on the first + ;; star. Thus, in that case, only hide it. + (start-face (if (and (bound-and-true-p org-indent-mode) + (> org-indent-indentation-per-level 1)) + 'org-hide + 'org-warning))) + (while (re-search-forward re limit t) + (if org-inlinetask-show-first-star + (add-text-properties (match-beginning 1) (match-end 1) + `(face ,start-face font-lock-fontified t))) + (add-text-properties (match-beginning + (if org-inlinetask-show-first-star 2 1)) + (match-end 2) + '(face org-hide font-lock-fontified t)) + (add-text-properties (match-beginning 3) (match-end 3) + '(face org-inlinetask font-lock-fontified t))))) + +(defun org-inlinetask-toggle-visibility () + "Toggle visibility of inline task at point." + (let ((end (save-excursion + (org-inlinetask-goto-end) + (if (bolp) (1- (point)) (point)))) + (start (save-excursion + (org-inlinetask-goto-beginning) + (point-at-eol)))) + (cond + ;; Nothing to show/hide. + ((= end start)) + ;; Inlinetask was folded: expand it. + ((eq (get-char-property (1+ start) 'invisible) 'outline) + (org-flag-region start end nil 'outline)) + (t (org-flag-region start end t 'outline))))) + +(defun org-inlinetask-hide-tasks (state) + "Hide inline tasks in buffer when STATE is `contents' or `children'. +This function is meant to be used in `org-cycle-hook'." + (pcase state + (`contents + (let ((regexp (org-inlinetask-outline-regexp))) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + (org-inlinetask-toggle-visibility) + (org-inlinetask-goto-end))))) + (`children + (save-excursion + (while + (or (org-inlinetask-at-task-p) + (and (outline-next-heading) (org-inlinetask-at-task-p))) + (org-inlinetask-toggle-visibility) + (org-inlinetask-goto-end)))))) + +(defun org-inlinetask-remove-END-maybe () + "Remove an END line when present." + (when (looking-at (format "\\([ \t]*\n\\)*\\*\\{%d,\\}[ \t]+END[ \t]*$" + org-inlinetask-min-level)) + (replace-match ""))) + +(add-hook 'org-font-lock-hook 'org-inlinetask-fontify) +(add-hook 'org-cycle-hook 'org-inlinetask-hide-tasks) + +(provide 'org-inlinetask) + +;;; org-inlinetask.el ends here diff --git a/elpa/org-9.5.2/org-inlinetask.elc b/elpa/org-9.5.2/org-inlinetask.elc new file mode 100644 index 0000000..2fb6904 Binary files /dev/null and b/elpa/org-9.5.2/org-inlinetask.elc differ diff --git a/elpa/org-9.5.2/org-keys.el b/elpa/org-9.5.2/org-keys.el new file mode 100644 index 0000000..a3d9576 --- /dev/null +++ b/elpa/org-9.5.2/org-keys.el @@ -0,0 +1,931 @@ +;;; org-keys.el --- Key bindings for Org mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2018-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr> + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This library adds bindings for Org mode buffers. It also +;; implements both Speed keys and Babel speed keys. See manual for +;; details. + +;;; Code: + +(require 'cl-lib) + +(defvar org-outline-regexp) + +(require 'oc) + +(declare-function org-add-note "org" ()) +(declare-function org-agenda "org" (&optional arg org-keys restriction)) +(declare-function org-agenda-file-to-front "org" (&optional to-end)) +(declare-function org-agenda-remove-restriction-lock "org" (&optional noupdate)) +(declare-function org-agenda-set-restriction-lock "org" (&optional type)) +(declare-function org-archive-subtree "org" (&optional find-done)) +(declare-function org-archive-subtree-default "org" ()) +(declare-function org-archive-subtree-default-with-confirmation "org" ()) +(declare-function org-archive-to-archive-sibling "org" ()) +(declare-function org-at-heading-p "org" (&optional ignored)) +(declare-function org-attach "org" ()) +(declare-function org-backward-element "org" ()) +(declare-function org-backward-heading-same-level "org" (arg &optional invisible-ok)) +(declare-function org-backward-paragraph "org" ()) +(declare-function org-backward-sentence "org" (&optional arg)) +(declare-function org-beginning-of-line "org" (&optional n)) +(declare-function org-clock-cancel "org" ()) +(declare-function org-clock-display "org" (&optional arg)) +(declare-function org-clock-goto "org" (&optional select)) +(declare-function org-clock-in "org" (&optional select start-time)) +(declare-function org-clock-in-last "org" (&optional arg)) +(declare-function org-clock-out "org" (&optional switch-to-state fail-quietly at-time)) +(declare-function org-clone-subtree-with-time-shift "org" (n &optional shift)) +(declare-function org-columns "org" (&optional global columns-fmt-string)) +(declare-function org-comment-dwim "org" (arg)) +(declare-function org-copy-special "org" ()) +(declare-function org-copy-visible "org" (beg end)) +(declare-function org-ctrl-c-ctrl-c "org" (&optional arg)) +(declare-function org-ctrl-c-minus "org" ()) +(declare-function org-ctrl-c-ret "org" ()) +(declare-function org-ctrl-c-star "org" ()) +(declare-function org-ctrl-c-tab "org" (&optional arg)) +(declare-function org-cut-special "org" ()) +(declare-function org-cut-subtree "org" (&optional n)) +(declare-function org-cycle "org" (&optional arg)) +(declare-function org-cycle-agenda-files "org" ()) +(declare-function org-date-from-calendar "org" ()) +(declare-function org-dynamic-block-insert-dblock "org" (&optional arg)) +(declare-function org-dblock-update "org" (&optional arg)) +(declare-function org-deadline "org" (arg1 &optional time)) +(declare-function org-decrease-number-at-point "org" (&optional inc)) +(declare-function org-delete-backward-char "org" (n)) +(declare-function org-delete-char "org" (n)) +(declare-function org-delete-indentation "org" (&optional arg)) +(declare-function org-demote-subtree "org" ()) +(declare-function org-display-outline-path "org" (&optional file current separator just-return-string)) +(declare-function org-down-element "org" ()) +(declare-function org-edit-special "org" (&optional arg)) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-type "org-element" (element)) +(declare-function org-emphasize "org" (&optional char)) +(declare-function org-end-of-line "org" (&optional n)) +(declare-function org-entry-put "org" (pom property value)) +(declare-function org-eval-in-calendar "org" (form &optional keepdate)) +(declare-function org-evaluate-time-range "org" (&optional to-buffer)) +(declare-function org-export-dispatch "org" (&optional arg)) +(declare-function org-feed-goto-inbox "org" (feed)) +(declare-function org-feed-update-all "org" ()) +(declare-function org-fill-paragraph "org" (&optional justify region)) +(declare-function org-find-file-at-mouse "org" (ev)) +(declare-function org-footnote-action "org" (&optional special)) +(declare-function org-force-cycle-archived "org" ()) +(declare-function org-force-self-insert "org" (n)) +(declare-function org-forward-element "org" ()) +(declare-function org-forward-heading-same-level "org" (arg &optional invisible-ok)) +(declare-function org-forward-paragraph "org" ()) +(declare-function org-forward-sentence "org" (&optional arg)) +(declare-function org-goto "org" (&optional alternative-interface)) +(declare-function org-goto-calendar "org" (&optional arg)) +(declare-function org-inc-effort "org" ()) +(declare-function org-increase-number-at-point "org" (&optional inc)) +(declare-function org-info-find-node "org" (&optional nodename)) +(declare-function org-insert-all-links "org" (arg &optional pre post)) +(declare-function org-insert-drawer "org" (&optional arg drawer)) +(declare-function org-insert-heading-respect-content "org" (&optional invisible-ok)) +(declare-function org-insert-last-stored-link "org" (arg)) +(declare-function org-insert-link "org" (&optional complete-file link-location default-description)) +(declare-function org-insert-structure-template "org" (type)) +(declare-function org-insert-todo-heading "org" (arg &optional force-heading)) +(declare-function org-insert-todo-heading-respect-content "org" (&optional force-state)) +(declare-function org-kill-line "org" (&optional arg)) +(declare-function org-kill-note-or-show-branches "org" ()) +(declare-function org-list-make-subtree "org" ()) +(declare-function org-mark-element "org" ()) +(declare-function org-mark-ring-goto "org" (&optional n)) +(declare-function org-mark-ring-push "org" (&optional pos buffer)) +(declare-function org-mark-subtree "org" (&optional up)) +(declare-function org-match-sparse-tree "org" (&optional todo-only match)) +(declare-function org-meta-return "org" (&optional arg)) +(declare-function org-metadown "org" (&optional _arg)) +(declare-function org-metaleft "org" (&optional _)) +(declare-function org-metaright "org" (&optional _arg)) +(declare-function org-metaup "org" (&optional _arg)) +(declare-function org-narrow-to-block "org" ()) +(declare-function org-narrow-to-element "org" ()) +(declare-function org-narrow-to-subtree "org" ()) +(declare-function org-next-block "org" (arg &optional backward block-regexp)) +(declare-function org-next-link "org" (&optional search-backward)) +(declare-function org-next-visible-heading "org" (arg)) +(declare-function org-open-at-mouse "org" (ev)) +(declare-function org-open-at-point "org" (&optional arg reference-buffer)) +(declare-function org-open-line "org" (n)) +(declare-function org-paste-special "org" (arg)) +(declare-function org-plot/gnuplot "org-plot" (&optional params)) +(declare-function org-previous-block "org" (arg &optional block-regexp)) +(declare-function org-previous-link "org" ()) +(declare-function org-previous-visible-heading "org" (arg)) +(declare-function org-priority "org" (&optional action show)) +(declare-function org-promote-subtree "org" ()) +(declare-function org-redisplay-inline-images "org" ()) +(declare-function org-refile "org" (&optional arg1 default-buffer rfloc msg)) +(declare-function org-refile-copy "org" ()) +(declare-function org-refile-reverse "org-refile" (&optional arg default-buffer rfloc msg)) +(declare-function org-reftex-citation "org" ()) +(declare-function org-reload "org" (&optional arg1)) +(declare-function org-remove-file "org" (&optional file)) +(declare-function org-resolve-clocks "org" (&optional only-dangling-p prompt-fn last-valid)) +(declare-function org-return "org" (&optional indent)) +(declare-function org-return-and-maybe-indent "org" ()) +(declare-function org-reveal "org" (&optional siblings)) +(declare-function org-schedule "org" (arg &optional time)) +(declare-function org-self-insert-command "org" (N)) +(declare-function org-set-effort "org" (&optional increment value)) +(declare-function org-set-property "org" (property value)) +(declare-function org-set-property-and-value "org" (use-last)) +(declare-function org-set-tags-command "org" (&optional arg)) +(declare-function org-shiftcontroldown "org" (&optional n)) +(declare-function org-shiftcontrolleft "org" ()) +(declare-function org-shiftcontrolright "org" ()) +(declare-function org-shiftcontrolup "org" (&optional n)) +(declare-function org-shiftdown "org" (&optional arg)) +(declare-function org-shiftleft "org" (&optional arg)) +(declare-function org-shiftmetadown "org" (&optional _arg)) +(declare-function org-shiftmetaleft "org" ()) +(declare-function org-shiftmetaright "org" ()) +(declare-function org-shiftmetaup "org" (&optional arg)) +(declare-function org-shiftright "org" (&optional arg)) +(declare-function org-shifttab "org" (&optional arg)) +(declare-function org-shiftup "org" (&optional arg)) +(declare-function org-show-all "org" (&optional types)) +(declare-function org-show-children "org" (&optional level)) +(declare-function org-show-subtree "org" ()) +(declare-function org-sort "org" (&optional with-case)) +(declare-function org-sparse-tree "org" (&optional arg type)) +(declare-function org-table-copy-down "org" (n)) +(declare-function org-table-create-or-convert-from-region "org" (arg)) +(declare-function org-table-create-with-table\.el "org-table" ()) +(declare-function org-table-edit-field "org" (arg)) +(declare-function org-table-eval-formula "org" (&optional arg equation suppress-align suppress-const suppress-store suppress-analysis)) +(declare-function org-table-field-info "org" (arg)) +(declare-function org-table-rotate-recalc-marks "org" (&optional newchar)) +(declare-function org-table-sum "org" (&optional beg end nlast)) +(declare-function org-table-toggle-coordinate-overlays "org" ()) +(declare-function org-table-toggle-formula-debugger "org" ()) +(declare-function org-time-stamp "org" (arg &optional inactive)) +(declare-function org-time-stamp-inactive "org" (&optional arg)) +(declare-function org-timer "org" (&optional restart no-insert)) +(declare-function org-timer-item "org" (&optional arg)) +(declare-function org-timer-pause-or-continue "org" (&optional stop)) +(declare-function org-timer-set-timer "org" (&optional opt)) +(declare-function org-timer-start "org" (&optional offset)) +(declare-function org-timer-stop "org" ()) +(declare-function org-todo "org" (&optional arg1)) +(declare-function org-toggle-archive-tag "org" (&optional find-done)) +(declare-function org-toggle-checkbox "org" (&optional toggle-presence)) +(declare-function org-toggle-radio-button "org" (&optional arg)) +(declare-function org-toggle-comment "org" ()) +(declare-function org-toggle-fixed-width "org" ()) +(declare-function org-toggle-inline-images "org" (&optional include-linked)) +(declare-function org-latex-preview "org" (&optional arg)) +(declare-function org-toggle-narrow-to-subtree "org" ()) +(declare-function org-toggle-ordered-property "org" ()) +(declare-function org-toggle-pretty-entities "org" ()) +(declare-function org-toggle-tags-groups "org" ()) +(declare-function org-toggle-time-stamp-overlays "org" ()) +(declare-function org-transpose-element "org" ()) +(declare-function org-transpose-words "org" ()) +(declare-function org-tree-to-indirect-buffer "org" (&optional arg)) +(declare-function org-up-element "org" ()) +(declare-function org-update-statistics-cookies "org" (all)) +(declare-function org-yank "org" (&optional arg)) +(declare-function orgtbl-ascii-plot "org-table" (&optional ask)) + + + +;;; Variables + +(defvar org-mode-map (make-sparse-keymap) + "Keymap for Org mode.") + +(defvaralias 'org-CUA-compatible 'org-replace-disputed-keys) + +(defcustom org-replace-disputed-keys nil + "Non-nil means use alternative key bindings for some keys. + +Org mode uses S-<cursor> keys for changing timestamps and priorities. +These keys are also used by other packages like Shift Select mode, +CUA mode or Windmove. If you want to use Org mode together with +one of these other modes, or more generally if you would like to +move some Org mode commands to other keys, set this variable and +configure the keys with the variable `org-disputed-keys'. + +This option is only relevant at load-time of Org mode, and must be set +*before* org.el is loaded. Changing it requires a restart of Emacs to +become effective." + :group 'org-startup + :type 'boolean + :safe #'booleanp) + +(defcustom org-use-extra-keys nil + "Non-nil means use extra key sequence definitions for certain commands. +This happens automatically if `window-system' is nil. This +variable lets you do the same manually. You must set it before +loading Org." + :group 'org-startup + :type 'boolean + :safe #'booleanp) + +(defcustom org-disputed-keys + '(([(shift up)] . [(meta p)]) + ([(shift down)] . [(meta n)]) + ([(shift left)] . [(meta -)]) + ([(shift right)] . [(meta +)]) + ([(control shift right)] . [(meta shift +)]) + ([(control shift left)] . [(meta shift -)])) + "Keys for which Org mode and other modes compete. +This is an alist, cars are the default keys, second element specifies +the alternative to use when `org-replace-disputed-keys' is t. + +Keys can be specified in any syntax supported by `define-key'. +The value of this option takes effect only at Org mode startup, +therefore you'll have to restart Emacs to apply it after changing." + :group 'org-startup + :type 'alist) + +(defcustom org-mouse-1-follows-link + (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t) + "Non-nil means mouse-1 on a link will follow the link. +A longer mouse click will still set point. Needs to be set +before org.el is loaded." + :group 'org-link-follow + :version "26.1" + :package-version '(Org . "8.3") + :type '(choice + (const :tag "A double click follows the link" double) + (const :tag "Unconditionally follow the link with mouse-1" t) + (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450))) + +(defcustom org-tab-follows-link nil + "Non-nil means on links TAB will follow the link. +Needs to be set before Org is loaded. +This really should not be used, it does not make sense, and the +implementation is bad." + :group 'org-link-follow + :type 'boolean) + +(defcustom org-follow-link-hook nil + "Hook that is run after a link has been followed." + :group 'org-link-follow + :type 'hook) + +(defcustom org-return-follows-link nil + "Non-nil means on links RET will follow the link. +In tables, the special behavior of RET has precedence." + :group 'org-link-follow + :type 'boolean + :safe #'booleanp) + + +;;; Functions + +;;;; Base functions +(defun org-key (key) + "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'. +Or return the original if not disputed." + (when org-replace-disputed-keys + (let* ((nkey (key-description key)) + (x (cl-find-if (lambda (x) (equal (key-description (car x)) nkey)) + org-disputed-keys))) + (setq key (if x (cdr x) key)))) + key) + +(defun org-defkey (keymap key def) + "Define a key, possibly translated, as returned by `org-key'." + (define-key keymap (org-key key) def)) + +(defun org-remap (map &rest commands) + "In MAP, remap the functions given in COMMANDS. +COMMANDS is a list of alternating OLDDEF NEWDEF command names." + (let (new old) + (while commands + (setq old (pop commands) new (pop commands)) + (org-defkey map (vector 'remap old) new)))) + + +;;; Mouse map + +(defvar org-mouse-map (make-sparse-keymap)) +(org-defkey org-mouse-map [mouse-2] 'org-open-at-mouse) +(org-defkey org-mouse-map [mouse-3] 'org-find-file-at-mouse) + +(when org-mouse-1-follows-link + (org-defkey org-mouse-map [follow-link] 'mouse-face)) + +(when org-tab-follows-link + (org-defkey org-mouse-map (kbd "TAB") #'org-open-at-point)) + + +;;; Read date map + +(defvar org-read-date-minibuffer-local-map + (let* ((map (make-sparse-keymap))) + (set-keymap-parent map minibuffer-local-map) + (org-defkey map (kbd ".") + (lambda () (interactive) + ;; Are we at the beginning of the prompt? + (if (looking-back "^[^:]+: " + (let ((inhibit-field-text-motion t)) + (line-beginning-position))) + (org-eval-in-calendar '(calendar-goto-today)) + (insert ".")))) + (org-defkey map (kbd "C-.") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-goto-today)))) + (org-defkey map (kbd "M-S-<left>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-month 1)))) + (org-defkey map (kbd "ESC S-<left>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-month 1)))) + (org-defkey map (kbd "M-S-<right>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-month 1)))) + (org-defkey map (kbd "ESC S-<right>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-month 1)))) + (org-defkey map (kbd "M-S-<up>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-year 1)))) + (org-defkey map (kbd "ESC S-<up>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-year 1)))) + (org-defkey map (kbd "M-S-<down>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-year 1)))) + (org-defkey map (kbd "ESC S-<down>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-year 1)))) + (org-defkey map (kbd "S-<up>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-week 1)))) + (org-defkey map (kbd "S-<down>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-week 1)))) + (org-defkey map (kbd "S-<left>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-day 1)))) + (org-defkey map (kbd "S-<right>") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-day 1)))) + (org-defkey map (kbd "!") + (lambda () (interactive) + (org-eval-in-calendar '(diary-view-entries)) + (message ""))) + (org-defkey map (kbd ">") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-scroll-left 1)))) + (org-defkey map (kbd "<") + (lambda () (interactive) + (org-eval-in-calendar '(calendar-scroll-right 1)))) + (org-defkey map (kbd "C-v") + (lambda () (interactive) + (org-eval-in-calendar + '(calendar-scroll-left-three-months 1)))) + (org-defkey map (kbd "M-v") + (lambda () (interactive) + (org-eval-in-calendar + '(calendar-scroll-right-three-months 1)))) + map) + "Keymap for minibuffer commands when using `org-read-date'.") + + +;;; Global bindings + +;;;; Outline functions +(define-key org-mode-map [menu-bar headings] 'undefined) +(define-key org-mode-map [menu-bar hide] 'undefined) +(define-key org-mode-map [menu-bar show] 'undefined) + +(define-key org-mode-map [remap outline-mark-subtree] #'org-mark-subtree) +(define-key org-mode-map [remap outline-show-subtree] #'org-show-subtree) +(define-key org-mode-map [remap outline-forward-same-level] + #'org-forward-heading-same-level) +(define-key org-mode-map [remap outline-backward-same-level] + #'org-backward-heading-same-level) +(define-key org-mode-map [remap outline-show-branches] + #'org-kill-note-or-show-branches) +(define-key org-mode-map [remap outline-promote] #'org-promote-subtree) +(define-key org-mode-map [remap outline-demote] #'org-demote-subtree) +(define-key org-mode-map [remap outline-insert-heading] #'org-ctrl-c-ret) +(define-key org-mode-map [remap outline-next-visible-heading] + #'org-next-visible-heading) +(define-key org-mode-map [remap outline-previous-visible-heading] + #'org-previous-visible-heading) +(define-key org-mode-map [remap show-children] #'org-show-children) + +;;;; Make `C-c C-x' a prefix key +(org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap)) + +;;;; TAB key with modifiers +(org-defkey org-mode-map (kbd "TAB") #'org-cycle) +(org-defkey org-mode-map (kbd "C-c C-<tab>") #'org-force-cycle-archived) +;; Override text-mode binding to expose `complete-symbol' for +;; pcomplete functionality. +(org-defkey org-mode-map (kbd "M-TAB") nil) +(org-defkey org-mode-map (kbd "ESC TAB") nil) + +(org-defkey org-mode-map (kbd "S-TAB") #'org-shifttab) +(define-key org-mode-map (kbd "<backtab>") #'org-shifttab) + +;;;; RET/<return> key with modifiers +(org-defkey org-mode-map (kbd "S-<return>") #'org-table-copy-down) +(org-defkey org-mode-map (kbd "S-RET") #'org-table-copy-down) +(org-defkey org-mode-map (kbd "M-S-<return>") #'org-insert-todo-heading) +(org-defkey org-mode-map (kbd "M-S-RET") #'org-insert-todo-heading) +(org-defkey org-mode-map (kbd "M-RET") #'org-meta-return) + +;;;; Cursor keys with modifiers +(org-defkey org-mode-map (kbd "M-<left>") #'org-metaleft) +(org-defkey org-mode-map (kbd "M-<right>") #'org-metaright) +(org-defkey org-mode-map (kbd "ESC <right>") #'org-metaright) +(org-defkey org-mode-map (kbd "M-<up>") #'org-metaup) +(org-defkey org-mode-map (kbd "ESC <up>") #'org-metaup) +(org-defkey org-mode-map (kbd "M-<down>") #'org-metadown) +(org-defkey org-mode-map (kbd "ESC <down>") #'org-metadown) + +(org-defkey org-mode-map (kbd "C-M-S-<right>") #'org-increase-number-at-point) +(org-defkey org-mode-map (kbd "C-M-S-<left>") #'org-decrease-number-at-point) +(org-defkey org-mode-map (kbd "M-S-<left>") #'org-shiftmetaleft) +(org-defkey org-mode-map (kbd "ESC S-<left>") #'org-shiftmetaleft) +(org-defkey org-mode-map (kbd "M-S-<right>") #'org-shiftmetaright) +(org-defkey org-mode-map (kbd "ESC S-<right>") #'org-shiftmetaright) +(org-defkey org-mode-map (kbd "M-S-<up>") #'org-shiftmetaup) +(org-defkey org-mode-map (kbd "ESC S-<up>") #'org-shiftmetaup) +(org-defkey org-mode-map (kbd "M-S-<down>") #'org-shiftmetadown) +(org-defkey org-mode-map (kbd "ESC S-<down>") #'org-shiftmetadown) + +(org-defkey org-mode-map (kbd "S-<up>") #'org-shiftup) +(org-defkey org-mode-map (kbd "S-<down>") #'org-shiftdown) +(org-defkey org-mode-map (kbd "S-<left>") #'org-shiftleft) +(org-defkey org-mode-map (kbd "S-<right>") #'org-shiftright) + +(org-defkey org-mode-map (kbd "C-S-<right>") #'org-shiftcontrolright) +(org-defkey org-mode-map (kbd "C-S-<left>") #'org-shiftcontrolleft) +(org-defkey org-mode-map (kbd "C-S-<up>") #'org-shiftcontrolup) +(org-defkey org-mode-map (kbd "C-S-<down>") #'org-shiftcontroldown) + +;;;; Extra keys for TTY access. + +;; We only set them when really needed because otherwise the +;; menus don't show the simple keys + +(when (or org-use-extra-keys (not window-system)) + (org-defkey org-mode-map (kbd "C-c C-x c") #'org-table-copy-down) + (org-defkey org-mode-map (kbd "C-c C-x m") #'org-meta-return) + (org-defkey org-mode-map (kbd "C-c C-x M") #'org-insert-todo-heading) + (org-defkey org-mode-map (kbd "C-c C-x RET") #'org-meta-return) + (org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return) + (org-defkey org-mode-map (kbd "ESC <left>") #'org-metaleft) + (org-defkey org-mode-map (kbd "C-c C-x l") #'org-metaleft) + (org-defkey org-mode-map (kbd "ESC <right>") #'org-metaright) + (org-defkey org-mode-map (kbd "C-c C-x r") #'org-metaright) + (org-defkey org-mode-map (kbd "C-c C-x u") #'org-metaup) + (org-defkey org-mode-map (kbd "C-c C-x d") #'org-metadown) + (org-defkey org-mode-map (kbd "C-c C-x L") #'org-shiftmetaleft) + (org-defkey org-mode-map (kbd "C-c C-x R") #'org-shiftmetaright) + (org-defkey org-mode-map (kbd "C-c C-x U") #'org-shiftmetaup) + (org-defkey org-mode-map (kbd "C-c C-x D") #'org-shiftmetadown) + (org-defkey org-mode-map (kbd "C-c <up>") #'org-shiftup) + (org-defkey org-mode-map (kbd "C-c <down>") #'org-shiftdown) + (org-defkey org-mode-map (kbd "C-c <left>") #'org-shiftleft) + (org-defkey org-mode-map (kbd "C-c <right>") #'org-shiftright) + (org-defkey org-mode-map (kbd "C-c C-x <right>") #'org-shiftcontrolright) + (org-defkey org-mode-map (kbd "C-c C-x <left>") #'org-shiftcontrolleft)) + +;;;; Narrowing bindings +(org-defkey org-mode-map (kbd "C-x n s") #'org-narrow-to-subtree) +(org-defkey org-mode-map (kbd "C-x n b") #'org-narrow-to-block) +(org-defkey org-mode-map (kbd "C-x n e") #'org-narrow-to-element) + +;;;; Remap usual Emacs bindings +(org-remap org-mode-map + 'self-insert-command 'org-self-insert-command + 'delete-char 'org-delete-char + 'delete-backward-char 'org-delete-backward-char + 'kill-line 'org-kill-line + 'open-line 'org-open-line + 'yank 'org-yank + 'comment-dwim 'org-comment-dwim + 'move-beginning-of-line 'org-beginning-of-line + 'move-end-of-line 'org-end-of-line + 'forward-paragraph 'org-forward-paragraph + 'backward-paragraph 'org-backward-paragraph + 'backward-sentence 'org-backward-sentence + 'forward-sentence 'org-forward-sentence + 'fill-paragraph 'org-fill-paragraph + 'delete-indentation 'org-delete-indentation + 'transpose-words 'org-transpose-words) + +;;;; All the other keys +(org-defkey org-mode-map (kbd "|") #'org-force-self-insert) +(org-defkey org-mode-map (kbd "C-c C-r") #'org-reveal) +(org-defkey org-mode-map (kbd "C-M-t") #'org-transpose-element) +(org-defkey org-mode-map (kbd "M-}") #'org-forward-element) +(org-defkey org-mode-map (kbd "ESC }") #'org-forward-element) +(org-defkey org-mode-map (kbd "M-{") #'org-backward-element) +(org-defkey org-mode-map (kbd "ESC {") #'org-backward-element) +(org-defkey org-mode-map (kbd "C-c C-^") #'org-up-element) +(org-defkey org-mode-map (kbd "C-c C-_") #'org-down-element) +(org-defkey org-mode-map (kbd "C-c C-f") #'org-forward-heading-same-level) +(org-defkey org-mode-map (kbd "C-c C-b") #'org-backward-heading-same-level) +(org-defkey org-mode-map (kbd "C-c M-f") #'org-next-block) +(org-defkey org-mode-map (kbd "C-c M-b") #'org-previous-block) +(org-defkey org-mode-map (kbd "C-c $") #'org-archive-subtree) +(org-defkey org-mode-map (kbd "C-c C-x C-s") #'org-archive-subtree) +(org-defkey org-mode-map (kbd "C-c C-x C-a") #'org-archive-subtree-default) +(org-defkey org-mode-map (kbd "C-c C-x d") #'org-insert-drawer) +(org-defkey org-mode-map (kbd "C-c C-x a") #'org-toggle-archive-tag) +(org-defkey org-mode-map (kbd "C-c C-x A") #'org-archive-to-archive-sibling) +(org-defkey org-mode-map (kbd "C-c C-x b") #'org-tree-to-indirect-buffer) +(org-defkey org-mode-map (kbd "C-c C-x q") #'org-toggle-tags-groups) +(org-defkey org-mode-map (kbd "C-c C-j") #'org-goto) +(org-defkey org-mode-map (kbd "C-c C-t") #'org-todo) +(org-defkey org-mode-map (kbd "C-c C-q") #'org-set-tags-command) +(org-defkey org-mode-map (kbd "C-c C-s") #'org-schedule) +(org-defkey org-mode-map (kbd "C-c C-d") #'org-deadline) +(org-defkey org-mode-map (kbd "C-c ;") #'org-toggle-comment) +(org-defkey org-mode-map (kbd "C-c C-w") #'org-refile) +(org-defkey org-mode-map (kbd "C-c M-w") #'org-refile-copy) +(org-defkey org-mode-map (kbd "C-c C-M-w") #'org-refile-reverse) +(org-defkey org-mode-map (kbd "C-c /") #'org-sparse-tree) ;minor-mode reserved +(org-defkey org-mode-map (kbd "C-c \\") #'org-match-sparse-tree) ;minor-mode r. +(org-defkey org-mode-map (kbd "C-c RET") #'org-ctrl-c-ret) +(org-defkey org-mode-map (kbd "C-c C-x c") #'org-clone-subtree-with-time-shift) +(org-defkey org-mode-map (kbd "C-c C-x v") #'org-copy-visible) +(org-defkey org-mode-map (kbd "C-<return>") #'org-insert-heading-respect-content) +(org-defkey org-mode-map (kbd "C-S-<return>") #'org-insert-todo-heading-respect-content) +(org-defkey org-mode-map (kbd "C-c C-x C-n") #'org-next-link) +(org-defkey org-mode-map (kbd "C-c C-x C-p") #'org-previous-link) +(org-defkey org-mode-map (kbd "C-c C-l") #'org-insert-link) +(org-defkey org-mode-map (kbd "C-c M-l") #'org-insert-last-stored-link) +(org-defkey org-mode-map (kbd "C-c C-M-l") #'org-insert-all-links) +(org-defkey org-mode-map (kbd "C-c C-o") #'org-open-at-point) +(org-defkey org-mode-map (kbd "C-c %") #'org-mark-ring-push) +(org-defkey org-mode-map (kbd "C-c &") #'org-mark-ring-goto) +(org-defkey org-mode-map (kbd "C-c C-z") #'org-add-note) ;alternative binding +(org-defkey org-mode-map (kbd "C-c .") #'org-time-stamp) ;minor-mode reserved +(org-defkey org-mode-map (kbd "C-c !") #'org-time-stamp-inactive) ;minor-mode r. +(org-defkey org-mode-map (kbd "C-c ,") #'org-priority) ;minor-mode reserved +(org-defkey org-mode-map (kbd "C-c C-y") #'org-evaluate-time-range) +(org-defkey org-mode-map (kbd "C-c >") #'org-goto-calendar) +(org-defkey org-mode-map (kbd "C-c <") #'org-date-from-calendar) +(org-defkey org-mode-map (kbd "C-,") #'org-cycle-agenda-files) +(org-defkey org-mode-map (kbd "C-'") #'org-cycle-agenda-files) +(org-defkey org-mode-map (kbd "C-c [") #'org-agenda-file-to-front) +(org-defkey org-mode-map (kbd "C-c ]") #'org-remove-file) +(org-defkey org-mode-map (kbd "C-c C-x <") #'org-agenda-set-restriction-lock) +(org-defkey org-mode-map (kbd "C-c C-x >") #'org-agenda-remove-restriction-lock) +(org-defkey org-mode-map (kbd "C-c -") #'org-ctrl-c-minus) +(org-defkey org-mode-map (kbd "C-c *") #'org-ctrl-c-star) +(org-defkey org-mode-map (kbd "C-c TAB") #'org-ctrl-c-tab) +(org-defkey org-mode-map (kbd "C-c ^") #'org-sort) +(org-defkey org-mode-map (kbd "C-c C-c") #'org-ctrl-c-ctrl-c) +(org-defkey org-mode-map (kbd "C-c C-k") #'org-kill-note-or-show-branches) +(org-defkey org-mode-map (kbd "C-c #") #'org-update-statistics-cookies) +(org-defkey org-mode-map (kbd "RET") #'org-return) +(org-defkey org-mode-map (kbd "C-j") #'org-return-and-maybe-indent) +(org-defkey org-mode-map (kbd "C-c ?") #'org-table-field-info) +(org-defkey org-mode-map (kbd "C-c +") #'org-table-sum) +(org-defkey org-mode-map (kbd "C-c =") #'org-table-eval-formula) +(org-defkey org-mode-map (kbd "C-c '") #'org-edit-special) +(org-defkey org-mode-map (kbd "C-c `") #'org-table-edit-field) +(org-defkey org-mode-map (kbd "C-c \" a") #'orgtbl-ascii-plot) +(org-defkey org-mode-map (kbd "C-c \" g") #'org-plot/gnuplot) +(org-defkey org-mode-map (kbd "C-c |") #'org-table-create-or-convert-from-region) +(org-defkey org-mode-map (kbd "C-#") #'org-table-rotate-recalc-marks) +(org-defkey org-mode-map (kbd "C-c ~") #'org-table-create-with-table.el) +(org-defkey org-mode-map (kbd "C-c C-a") #'org-attach) +(org-defkey org-mode-map (kbd "C-c }") #'org-table-toggle-coordinate-overlays) +(org-defkey org-mode-map (kbd "C-c {") #'org-table-toggle-formula-debugger) +(org-defkey org-mode-map (kbd "C-c C-e") #'org-export-dispatch) +(org-defkey org-mode-map (kbd "C-c :") #'org-toggle-fixed-width) +(org-defkey org-mode-map (kbd "C-c C-x C-f") #'org-emphasize) +(org-defkey org-mode-map (kbd "C-c C-x f") #'org-footnote-action) +(org-defkey org-mode-map (kbd "C-c @") #'org-mark-subtree) +(org-defkey org-mode-map (kbd "M-h") #'org-mark-element) +(org-defkey org-mode-map (kbd "ESC h") #'org-mark-element) +(org-defkey org-mode-map (kbd "C-c C-*") #'org-list-make-subtree) +(org-defkey org-mode-map (kbd "C-c C-x C-w") #'org-cut-special) +(org-defkey org-mode-map (kbd "C-c C-x M-w") #'org-copy-special) +(org-defkey org-mode-map (kbd "C-c C-x C-y") #'org-paste-special) +(org-defkey org-mode-map (kbd "C-c C-x C-t") #'org-toggle-time-stamp-overlays) +(org-defkey org-mode-map (kbd "C-c C-x C-i") #'org-clock-in) +(org-defkey org-mode-map (kbd "C-c C-x C-x") #'org-clock-in-last) +(org-defkey org-mode-map (kbd "C-c C-x C-z") #'org-resolve-clocks) +(org-defkey org-mode-map (kbd "C-c C-x C-o") #'org-clock-out) +(org-defkey org-mode-map (kbd "C-c C-x C-j") #'org-clock-goto) +(org-defkey org-mode-map (kbd "C-c C-x C-q") #'org-clock-cancel) +(org-defkey org-mode-map (kbd "C-c C-x C-d") #'org-clock-display) +(org-defkey org-mode-map (kbd "C-c C-x x") #'org-dynamic-block-insert-dblock) +(org-defkey org-mode-map (kbd "C-c C-x C-u") #'org-dblock-update) +(org-defkey org-mode-map (kbd "C-c C-x C-l") #'org-latex-preview) +(org-defkey org-mode-map (kbd "C-c C-x C-v") #'org-toggle-inline-images) +(org-defkey org-mode-map (kbd "C-c C-x C-M-v") #'org-redisplay-inline-images) +(org-defkey org-mode-map (kbd "C-c C-x \\") #'org-toggle-pretty-entities) +(org-defkey org-mode-map (kbd "C-c C-x C-b") #'org-toggle-checkbox) +(org-defkey org-mode-map (kbd "C-c C-x C-r") #'org-toggle-radio-button) +(org-defkey org-mode-map (kbd "C-c C-x p") #'org-set-property) +(org-defkey org-mode-map (kbd "C-c C-x P") #'org-set-property-and-value) +(org-defkey org-mode-map (kbd "C-c C-x e") #'org-set-effort) +(org-defkey org-mode-map (kbd "C-c C-x E") #'org-inc-effort) +(org-defkey org-mode-map (kbd "C-c C-x o") #'org-toggle-ordered-property) +(org-defkey org-mode-map (kbd "C-c C-,") #'org-insert-structure-template) +(org-defkey org-mode-map (kbd "C-c C-x .") #'org-timer) +(org-defkey org-mode-map (kbd "C-c C-x -") #'org-timer-item) +(org-defkey org-mode-map (kbd "C-c C-x 0") #'org-timer-start) +(org-defkey org-mode-map (kbd "C-c C-x _") #'org-timer-stop) +(org-defkey org-mode-map (kbd "C-c C-x ;") #'org-timer-set-timer) +(org-defkey org-mode-map (kbd "C-c C-x ,") #'org-timer-pause-or-continue) +(org-defkey org-mode-map (kbd "C-c C-x C-c") #'org-columns) +(org-defkey org-mode-map (kbd "C-c C-x !") #'org-reload) +(org-defkey org-mode-map (kbd "C-c C-x g") #'org-feed-update-all) +(org-defkey org-mode-map (kbd "C-c C-x G") #'org-feed-goto-inbox) +(org-defkey org-mode-map (kbd "C-c C-x @") #'org-cite-insert) +(org-defkey org-mode-map (kbd "C-c C-x [") #'org-reftex-citation) +(org-defkey org-mode-map (kbd "C-c C-x I") #'org-info-find-node) + + +;;; Speed keys + +(defcustom org-use-speed-commands nil + "Non-nil means activate single letter commands at beginning of a headline. +This may also be a function to test for appropriate locations where speed +commands should be active. + +For example, to activate speed commands when the point is on any +star at the beginning of the headline, you can do this: + + (setq org-use-speed-commands + (lambda () (and (looking-at org-outline-regexp) (looking-back \"^\\**\"))))" + :group 'org-structure + :type '(choice + (const :tag "Never" nil) + (const :tag "At beginning of headline stars" t) + (function))) + +(defcustom org-speed-command-hook + '(org-speed-command-activate org-babel-speed-command-activate) + "Hook for activating speed commands at strategic locations. +Hook functions are called in sequence until a valid handler is +found. + +Each hook takes a single argument, a user-pressed command key +which is also a `self-insert-command' from the global map. + +Within the hook, examine the cursor position and the command key +and return nil or a valid handler as appropriate. Handler could +be one of an interactive command, a function, or a form. + +Set `org-use-speed-commands' to non-nil value to enable this +hook. The default setting is `org-speed-command-activate'." + :group 'org-structure + :version "24.1" + :type 'hook) + +(defcustom org-speed-commands + '(("Outline Navigation") + ("n" . (org-speed-move-safe 'org-next-visible-heading)) + ("p" . (org-speed-move-safe 'org-previous-visible-heading)) + ("f" . (org-speed-move-safe 'org-forward-heading-same-level)) + ("b" . (org-speed-move-safe 'org-backward-heading-same-level)) + ("F" . org-next-block) + ("B" . org-previous-block) + ("u" . (org-speed-move-safe 'outline-up-heading)) + ("j" . org-goto) + ("g" . (org-refile '(4))) + ("Outline Visibility") + ("c" . org-cycle) + ("C" . org-shifttab) + (" " . org-display-outline-path) + ("s" . org-toggle-narrow-to-subtree) + ("k" . org-cut-subtree) + ("=" . org-columns) + ("Outline Structure Editing") + ("U" . org-metaup) + ("D" . org-metadown) + ("r" . org-metaright) + ("l" . org-metaleft) + ("R" . org-shiftmetaright) + ("L" . org-shiftmetaleft) + ("i" . (progn (forward-char 1) (call-interactively 'org-insert-heading-respect-content))) + ("^" . org-sort) + ("w" . org-refile) + ("a" . org-archive-subtree-default-with-confirmation) + ("@" . org-mark-subtree) + ("#" . org-toggle-comment) + ("Clock Commands") + ("I" . org-clock-in) + ("O" . org-clock-out) + ("Meta Data Editing") + ("t" . org-todo) + ("," . (org-priority)) + ("0" . (org-priority ?\ )) + ("1" . (org-priority ?A)) + ("2" . (org-priority ?B)) + ("3" . (org-priority ?C)) + (":" . org-set-tags-command) + ("e" . org-set-effort) + ("E" . org-inc-effort) + ("W" . (lambda (m) (interactive "sMinutes before warning: ") (org-entry-put (point) "APPT_WARNTIME" m))) + ("Agenda Views etc") + ("v" . org-agenda) + ("/" . org-sparse-tree) + ("Misc") + ("o" . org-open-at-point) + ("?" . org-speed-command-help) + ("<" . (org-agenda-set-restriction-lock 'subtree)) + (">" . (org-agenda-remove-restriction-lock))) + "Alist of speed commands. + +The car of each entry is a string with a single letter, which +must be assigned to `self-insert-command' in the global map. + +The cdr is either a command to be called interactively, a +function to be called, or a form to be evaluated. + +An entry that is just a list with a single string will be +interpreted as a descriptive headline that will be added when +listing the speed commands in the Help buffer using the `?' speed +command." + :group 'org-structure + :package-version '(Org . "9.5") + :type '(repeat :value ("k" . ignore) + (choice :value ("k" . ignore) + (list :tag "Descriptive Headline" (string :tag "Headline")) + (cons :tag "Letter and Command" + (string :tag "Command letter") + (choice + (function) + (sexp)))))) + +(defun org-print-speed-command (e) + (if (> (length (car e)) 1) + (progn + (princ "\n") + (princ (car e)) + (princ "\n") + (princ (make-string (length (car e)) ?-)) + (princ "\n")) + (princ (car e)) + (princ " ") + (if (symbolp (cdr e)) + (princ (symbol-name (cdr e))) + (prin1 (cdr e))) + (princ "\n"))) + +(defun org-speed-command-help () + "Show the available speed commands." + (interactive) + (unless org-use-speed-commands + (user-error "Speed commands are not activated, customize `org-use-speed-commands'")) + ;; FIXME: remove this warning for 9.6 + (when (boundp 'org-speed-commands-user) + (message "`org-speed-command-user' is obsolete, please use `org-speed-commands'") + (sit-for 3)) + (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))) + (with-current-buffer "*Help*" + (setq truncate-lines t))) + +(defun org-speed-move-safe (cmd) + "Execute CMD, but make sure that the cursor always ends up in a headline. +If not, return to the original position and throw an error." + (interactive) + (let ((pos (point))) + (call-interactively cmd) + (unless (and (bolp) (org-at-heading-p)) + (goto-char pos) + (error "Boundary reached while executing %s" cmd)))) + +(defun org-speed-command-activate (keys) + "Hook for activating single-letter speed commands. +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))))) + + +;;; Babel speed keys + +(defvar org-babel-key-prefix "\C-c\C-v" + "The key prefix for Babel interactive key-bindings. +See `org-babel-key-bindings' for the list of interactive Babel +functions which are assigned key bindings, and see +`org-babel-map' for the actual babel keymap.") + +(defvar org-babel-map (make-sparse-keymap) + "The keymap for interactive Babel functions.") + +(defvar org-babel-key-bindings + '(("p" . org-babel-previous-src-block) + ("\C-p" . org-babel-previous-src-block) + ("n" . org-babel-next-src-block) + ("\C-n" . org-babel-next-src-block) + ("e" . org-babel-execute-maybe) + ("\C-e" . org-babel-execute-maybe) + ("o" . org-babel-open-src-block-result) + ("\C-o" . org-babel-open-src-block-result) + ("\C-v" . org-babel-expand-src-block) + ("v" . org-babel-expand-src-block) + ("u" . org-babel-goto-src-block-head) + ("\C-u" . org-babel-goto-src-block-head) + ("g" . org-babel-goto-named-src-block) + ("r" . org-babel-goto-named-result) + ("\C-r" . org-babel-goto-named-result) + ("\C-b" . org-babel-execute-buffer) + ("b" . org-babel-execute-buffer) + ("\C-s" . org-babel-execute-subtree) + ("s" . org-babel-execute-subtree) + ("\C-d" . org-babel-demarcate-block) + ("d" . org-babel-demarcate-block) + ("\C-t" . org-babel-tangle) + ("t" . org-babel-tangle) + ("\C-f" . org-babel-tangle-file) + ("f" . org-babel-tangle-file) + ("\C-c" . org-babel-check-src-block) + ("c" . org-babel-check-src-block) + ("\C-j" . org-babel-insert-header-arg) + ("j" . org-babel-insert-header-arg) + ("\C-l" . org-babel-load-in-session) + ("l" . org-babel-load-in-session) + ("\C-i" . org-babel-lob-ingest) + ("i" . org-babel-lob-ingest) + ("\C-I" . org-babel-view-src-block-info) + ("I" . org-babel-view-src-block-info) + ("\C-z" . org-babel-switch-to-session) + ("z" . org-babel-switch-to-session-with-code) + ("\C-a" . org-babel-sha1-hash) + ("a" . org-babel-sha1-hash) + ("h" . org-babel-describe-bindings) + ("\C-x" . org-babel-do-key-sequence-in-edit-buffer) + ("x" . org-babel-do-key-sequence-in-edit-buffer) + ("k" . org-babel-remove-result-one-or-many) + ("\C-\M-h" . org-babel-mark-block)) + "Alist of key bindings and interactive Babel functions. +This list associates interactive Babel functions +with keys. Each element of this list will add an entry to the +`org-babel-map' using the letter key which is the `car' of the +a-list placed behind the generic `org-babel-key-prefix'.") + +(define-key org-mode-map org-babel-key-prefix org-babel-map) +(pcase-dolist (`(,key . ,def) org-babel-key-bindings) + (define-key org-babel-map key def)) + +(defun org-babel-speed-command-activate (keys) + "Hook for activating single-letter code block commands." + (when (and (bolp) + (let ((case-fold-search t)) (looking-at "[ \t]*#\\+begin_src")) + (eq 'src-block (org-element-type (org-element-at-point)))) + (cdr (assoc keys org-babel-key-bindings)))) + +;;;###autoload +(defun org-babel-describe-bindings () + "Describe all keybindings behind `org-babel-key-prefix'." + (interactive) + (describe-bindings org-babel-key-prefix)) + +(provide 'org-keys) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-keys.el ends here diff --git a/elpa/org-9.5.2/org-keys.elc b/elpa/org-9.5.2/org-keys.elc new file mode 100644 index 0000000..7249255 Binary files /dev/null and b/elpa/org-9.5.2/org-keys.elc differ diff --git a/elpa/org-9.5.2/org-lint.el b/elpa/org-9.5.2/org-lint.el new file mode 100644 index 0000000..da5e6ae --- /dev/null +++ b/elpa/org-9.5.2/org-lint.el @@ -0,0 +1,1321 @@ +;;; org-lint.el --- Linting for Org documents -*- lexical-binding: t; -*- + +;; Copyright (C) 2015-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr> +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This library implements linting for Org syntax. The sole public +;; function is `org-lint', which see. + +;; Internally, the library defines a new structure: +;; `org-lint-checker', with the following slots: + +;; - NAME: Unique check identifier, as a non-nil symbol that doesn't +;; start with an hyphen. +;; +;; The check is done calling the function `org-lint-NAME' with one +;; mandatory argument, the parse tree describing the current Org +;; buffer. Such function calls are wrapped within +;; a `save-excursion' and point is always at `point-min'. Its +;; return value has to be an alist (POSITION MESSAGE) when +;; POSITION refer to the buffer position of the error, as an +;; integer, and MESSAGE is a string describing the error. + +;; - DESCRIPTION: Summary about the check, as a string. + +;; - CATEGORIES: Categories relative to the check, as a list of +;; symbol. They are used for filtering when calling `org-lint'. +;; Checkers not explicitly associated to a category are collected +;; in the `default' one. + +;; - TRUST: The trust level one can have in the check. It is either +;; `low' or `high', depending on the heuristics implemented and +;; the nature of the check. This has an indicative value only and +;; is displayed along reports. + +;; All checks have to be listed in `org-lint--checkers'. + +;; Results are displayed in a special "*Org Lint*" buffer with +;; a dedicated major mode, derived from `tabulated-list-mode'. +;; +;; In addition to the usual key-bindings inherited from it, "C-j" and +;; "TAB" display problematic line reported under point whereas "RET" +;; jumps to it. Also, "h" hides all reports similar to the current +;; one. Additionally, "i" removes them from subsequent reports. + +;; Checks currently implemented are: + +;; - duplicate CUSTOM_ID properties +;; - duplicate NAME values +;; - duplicate targets +;; - duplicate footnote definitions +;; - orphaned affiliated keywords +;; - obsolete affiliated keywords +;; - missing language in source blocks +;; - missing back-end in export blocks +;; - invalid Babel call blocks +;; - NAME values with a colon +;; - deprecated export block syntax +;; - deprecated Babel header properties +;; - wrong header arguments in source blocks +;; - misuse of CATEGORY keyword +;; - "coderef" links with unknown destination +;; - "custom-id" links with unknown destination +;; - "fuzzy" links with unknown destination +;; - "id" links with unknown destination +;; - links to non-existent local files +;; - SETUPFILE keywords with non-existent file parameter +;; - INCLUDE keywords with wrong link parameter +;; - obsolete markup in INCLUDE keyword +;; - unknown items in OPTIONS keyword +;; - spurious macro arguments or invalid macro templates +;; - special properties in properties drawer +;; - obsolete syntax for PROPERTIES drawers +;; - Invalid EFFORT property value +;; - missing definition for footnote references +;; - missing reference for footnote definitions +;; - non-footnote definitions in footnote section +;; - probable invalid keywords +;; - invalid blocks +;; - misplaced planning info line +;; - incomplete drawers +;; - indented diary-sexps +;; - obsolete QUOTE section +;; - obsolete "file+application" link +;; - spurious colons in tags + + +;;; Code: + +(require 'cl-lib) +(require 'ob) +(require 'ol) +(require 'org-attach) +(require 'org-macro) +(require 'ox) + + +;;; Checkers + +(cl-defstruct (org-lint-checker (:copier nil)) + (name 'missing-checker-name) + (description "") + (categories '(default)) + (trust 'high)) ; `low' or `high' + +(defun org-lint-missing-checker-name (_) + (error + "`A checker has no `:name' property. Please verify `org-lint--checkers'")) + +(defconst org-lint--checkers + (list + (make-org-lint-checker + :name 'duplicate-custom-id + :description "Report duplicates CUSTOM_ID properties" + :categories '(link)) + (make-org-lint-checker + :name 'duplicate-name + :description "Report duplicate NAME values" + :categories '(babel link)) + (make-org-lint-checker + :name 'duplicate-target + :description "Report duplicate targets" + :categories '(link)) + (make-org-lint-checker + :name 'duplicate-footnote-definition + :description "Report duplicate footnote definitions" + :categories '(footnote)) + (make-org-lint-checker + :name 'orphaned-affiliated-keywords + :description "Report orphaned affiliated keywords" + :trust 'low) + (make-org-lint-checker + :name 'obsolete-affiliated-keywords + :description "Report obsolete affiliated keywords" + :categories '(obsolete)) + (make-org-lint-checker + :name 'deprecated-export-blocks + :description "Report deprecated export block syntax" + :categories '(obsolete export) + :trust 'low) + (make-org-lint-checker + :name 'deprecated-header-syntax + :description "Report deprecated Babel header syntax" + :categories '(obsolete babel) + :trust 'low) + (make-org-lint-checker + :name 'missing-language-in-src-block + :description "Report missing language in source blocks" + :categories '(babel)) + (make-org-lint-checker + :name 'missing-backend-in-export-block + :description "Report missing back-end in export blocks" + :categories '(export)) + (make-org-lint-checker + :name 'invalid-babel-call-block + :description "Report invalid Babel call blocks" + :categories '(babel)) + (make-org-lint-checker + :name 'colon-in-name + :description "Report NAME values with a colon" + :categories '(babel)) + (make-org-lint-checker + :name 'wrong-header-argument + :description "Report wrong babel headers" + :categories '(babel)) + (make-org-lint-checker + :name 'wrong-header-value + :description "Report invalid value in babel headers" + :categories '(babel) + :trust 'low) + (make-org-lint-checker + :name 'deprecated-category-setup + :description "Report misuse of CATEGORY keyword" + :categories '(obsolete)) + (make-org-lint-checker + :name 'invalid-coderef-link + :description "Report \"coderef\" links with unknown destination" + :categories '(link)) + (make-org-lint-checker + :name 'invalid-custom-id-link + :description "Report \"custom-id\" links with unknown destination" + :categories '(link)) + (make-org-lint-checker + :name 'invalid-fuzzy-link + :description "Report \"fuzzy\" links with unknown destination" + :categories '(link)) + (make-org-lint-checker + :name 'invalid-id-link + :description "Report \"id\" links with unknown destination" + :categories '(link)) + (make-org-lint-checker + :name 'link-to-local-file + :description "Report links to non-existent local files" + :categories '(link) + :trust 'low) + (make-org-lint-checker + :name 'non-existent-setupfile-parameter + :description "Report SETUPFILE keywords with non-existent file parameter" + :trust 'low) + (make-org-lint-checker + :name 'wrong-include-link-parameter + :description "Report INCLUDE keywords with misleading link parameter" + :categories '(export) + :trust 'low) + (make-org-lint-checker + :name 'obsolete-include-markup + :description "Report obsolete markup in INCLUDE keyword" + :categories '(obsolete export) + :trust 'low) + (make-org-lint-checker + :name 'unknown-options-item + :description "Report unknown items in OPTIONS keyword" + :categories '(export) + :trust 'low) + (make-org-lint-checker + :name 'invalid-macro-argument-and-template + :description "Report spurious macro arguments or invalid macro templates" + :categories '(export) + :trust 'low) + (make-org-lint-checker + :name 'special-property-in-properties-drawer + :description "Report special properties in properties drawers" + :categories '(properties)) + (make-org-lint-checker + :name 'obsolete-properties-drawer + :description "Report obsolete syntax for properties drawers" + :categories '(obsolete properties)) + (make-org-lint-checker + :name 'invalid-effort-property + :description "Report invalid duration in EFFORT property" + :categories '(properties)) + (make-org-lint-checker + :name 'undefined-footnote-reference + :description "Report missing definition for footnote references" + :categories '(footnote)) + (make-org-lint-checker + :name 'unreferenced-footnote-definition + :description "Report missing reference for footnote definitions" + :categories '(footnote)) + (make-org-lint-checker + :name 'extraneous-element-in-footnote-section + :description "Report non-footnote definitions in footnote section" + :categories '(footnote)) + (make-org-lint-checker + :name 'invalid-keyword-syntax + :description "Report probable invalid keywords" + :trust 'low) + (make-org-lint-checker + :name 'invalid-block + :description "Report invalid blocks" + :trust 'low) + (make-org-lint-checker + :name 'misplaced-planning-info + :description "Report misplaced planning info line" + :trust 'low) + (make-org-lint-checker + :name 'incomplete-drawer + :description "Report probable incomplete drawers" + :trust 'low) + (make-org-lint-checker + :name 'indented-diary-sexp + :description "Report probable indented diary-sexps" + :trust 'low) + (make-org-lint-checker + :name 'quote-section + :description "Report obsolete QUOTE section" + :categories '(obsolete) + :trust 'low) + (make-org-lint-checker + :name 'file-application + :description "Report obsolete \"file+application\" link" + :categories '(link obsolete)) + (make-org-lint-checker + :name 'percent-encoding-link-escape + :description "Report obsolete escape syntax in links" + :categories '(link obsolete) + :trust 'low) + (make-org-lint-checker + :name 'spurious-colons + :description "Report spurious colons in tags" + :categories '(tags))) + "List of all available checkers.") + +(defun org-lint--collect-duplicates + (ast type extract-key extract-position build-message) + "Helper function to collect duplicates in parse tree AST. + +EXTRACT-KEY is a function extracting key. It is called with +a single argument: the element or object. Comparison is done +with `equal'. + +EXTRACT-POSITION is a function returning position for the report. +It is called with two arguments, the object or element, and the +key. + +BUILD-MESSAGE is a function creating the report message. It is +called with one argument, the key used for comparison." + (let* (keys + originals + reports + (make-report + (lambda (position value) + (push (list position (funcall build-message value)) reports)))) + (org-element-map ast type + (lambda (datum) + (let ((key (funcall extract-key datum))) + (cond + ((not key)) + ((assoc key keys) (cl-pushnew (assoc key keys) originals) + (funcall make-report (funcall extract-position datum key) key)) + (t (push (cons key (funcall extract-position datum key)) keys)))))) + (dolist (e originals reports) (funcall make-report (cdr e) (car e))))) + +(defun org-lint-duplicate-custom-id (ast) + (org-lint--collect-duplicates + ast + 'node-property + (lambda (property) + (and (eq (compare-strings "CUSTOM_ID" nil nil + (org-element-property :key property) nil nil + t) + t) + (org-element-property :value property))) + (lambda (property _) (org-element-property :begin property)) + (lambda (key) (format "Duplicate CUSTOM_ID property \"%s\"" key)))) + +(defun org-lint-duplicate-name (ast) + (org-lint--collect-duplicates + ast + org-element-all-elements + (lambda (datum) (org-element-property :name datum)) + (lambda (datum name) + (goto-char (org-element-property :begin datum)) + (re-search-forward + (format "^[ \t]*#\\+[A-Za-z]+:[ \t]*%s[ \t]*$" (regexp-quote name))) + (match-beginning 0)) + (lambda (key) (format "Duplicate NAME \"%s\"" key)))) + +(defun org-lint-duplicate-target (ast) + (org-lint--collect-duplicates + ast + 'target + (lambda (target) (split-string (org-element-property :value target))) + (lambda (target _) (org-element-property :begin target)) + (lambda (key) + (format "Duplicate target <<%s>>" (mapconcat #'identity key " "))))) + +(defun org-lint-duplicate-footnote-definition (ast) + (org-lint--collect-duplicates + ast + 'footnote-definition + (lambda (definition) (org-element-property :label definition)) + (lambda (definition _) (org-element-property :post-affiliated definition)) + (lambda (key) (format "Duplicate footnote definition \"%s\"" key)))) + +(defun org-lint-orphaned-affiliated-keywords (ast) + ;; Ignore orphan RESULTS keywords, which could be generated from + ;; a source block returning no value. + (let ((keywords (cl-set-difference org-element-affiliated-keywords + '("RESULT" "RESULTS") + :test #'equal))) + (org-element-map ast 'keyword + (lambda (k) + (let ((key (org-element-property :key k))) + (and (or (let ((case-fold-search t)) + (string-match-p "\\`ATTR_[-_A-Za-z0-9]+\\'" key)) + (member key keywords)) + (list (org-element-property :post-affiliated k) + (format "Orphaned affiliated keyword: \"%s\"" key)))))))) + +(defun org-lint-obsolete-affiliated-keywords (_) + (let ((regexp (format "^[ \t]*#\\+%s:" + (regexp-opt '("DATA" "LABEL" "RESNAME" "SOURCE" + "SRCNAME" "TBLNAME" "RESULT" "HEADERS") + t))) + reports) + (while (re-search-forward regexp nil t) + (let ((key (upcase (match-string-no-properties 1)))) + (when (< (point) + (org-element-property :post-affiliated (org-element-at-point))) + (push + (list (line-beginning-position) + (format + "Obsolete affiliated keyword: \"%s\". Use \"%s\" instead" + key + (pcase key + ("HEADERS" "HEADER") + ("RESULT" "RESULTS") + (_ "NAME")))) + reports)))) + reports)) + +(defun org-lint-deprecated-export-blocks (ast) + (let ((deprecated '("ASCII" "BEAMER" "HTML" "LATEX" "MAN" "MARKDOWN" "MD" + "ODT" "ORG" "TEXINFO"))) + (org-element-map ast 'special-block + (lambda (b) + (let ((type (org-element-property :type b))) + (when (member-ignore-case type deprecated) + (list + (org-element-property :post-affiliated b) + (format + "Deprecated syntax for export block. Use \"BEGIN_EXPORT %s\" \ +instead" + type)))))))) + +(defun org-lint-deprecated-header-syntax (ast) + (let* ((deprecated-babel-properties + ;; DIR is also used for attachments. + (delete "dir" + (mapcar (lambda (arg) (downcase (symbol-name (car arg)))) + org-babel-common-header-args-w-values))) + (deprecated-re + (format "\\`%s[ \t]" (regexp-opt deprecated-babel-properties t)))) + (org-element-map ast '(keyword node-property) + (lambda (datum) + (let ((key (org-element-property :key datum))) + (pcase (org-element-type datum) + (`keyword + (let ((value (org-element-property :value datum))) + (and (string= key "PROPERTY") + (string-match deprecated-re value) + (list (org-element-property :begin datum) + (format "Deprecated syntax for \"%s\". \ +Use header-args instead" + (match-string-no-properties 1 value)))))) + (`node-property + (and (member-ignore-case key deprecated-babel-properties) + (list + (org-element-property :begin datum) + (format "Deprecated syntax for \"%s\". \ +Use :header-args: instead" + key)))))))))) + +(defun org-lint-missing-language-in-src-block (ast) + (org-element-map ast 'src-block + (lambda (b) + (unless (org-element-property :language b) + (list (org-element-property :post-affiliated b) + "Missing language in source block"))))) + +(defun org-lint-missing-backend-in-export-block (ast) + (org-element-map ast 'export-block + (lambda (b) + (unless (org-element-property :type b) + (list (org-element-property :post-affiliated b) + "Missing back-end in export block"))))) + +(defun org-lint-invalid-babel-call-block (ast) + (org-element-map ast 'babel-call + (lambda (b) + (cond + ((not (org-element-property :call b)) + (list (org-element-property :post-affiliated b) + "Invalid syntax in babel call block")) + ((let ((h (org-element-property :end-header b))) + (and h (string-match-p "\\`\\[.*\\]\\'" h))) + (list + (org-element-property :post-affiliated b) + "Babel call's end header must not be wrapped within brackets")))))) + +(defun org-lint-deprecated-category-setup (ast) + (org-element-map ast 'keyword + (let (category-flag) + (lambda (k) + (cond + ((not (string= (org-element-property :key k) "CATEGORY")) nil) + (category-flag + (list (org-element-property :post-affiliated k) + "Spurious CATEGORY keyword. Set :CATEGORY: property instead")) + (t (setf category-flag t) nil)))))) + +(defun org-lint-invalid-coderef-link (ast) + (let ((info (list :parse-tree ast))) + (org-element-map ast 'link + (lambda (link) + (let ((ref (org-element-property :path link))) + (and (equal (org-element-property :type link) "coderef") + (not (ignore-errors (org-export-resolve-coderef ref info))) + (list (org-element-property :begin link) + (format "Unknown coderef \"%s\"" ref)))))))) + +(defun org-lint-invalid-custom-id-link (ast) + (let ((info (list :parse-tree ast))) + (org-element-map ast 'link + (lambda (link) + (and (equal (org-element-property :type link) "custom-id") + (not (ignore-errors (org-export-resolve-id-link link info))) + (list (org-element-property :begin link) + (format "Unknown custom ID \"%s\"" + (org-element-property :path link)))))))) + +(defun org-lint-invalid-fuzzy-link (ast) + (let ((info (list :parse-tree ast))) + (org-element-map ast 'link + (lambda (link) + (and (equal (org-element-property :type link) "fuzzy") + (not (ignore-errors (org-export-resolve-fuzzy-link link info))) + (list (org-element-property :begin link) + (format "Unknown fuzzy location \"%s\"" + (let ((path (org-element-property :path link))) + (if (string-prefix-p "*" path) + (substring path 1) + path))))))))) + +(defun org-lint-invalid-id-link (ast) + (org-element-map ast 'link + (lambda (link) + (let ((id (org-element-property :path link))) + (and (equal (org-element-property :type link) "id") + (not (org-id-find id)) + (list (org-element-property :begin link) + (format "Unknown ID \"%s\"" id))))))) + +(defun org-lint-special-property-in-properties-drawer (ast) + (org-element-map ast 'node-property + (lambda (p) + (let ((key (org-element-property :key p))) + (and (member-ignore-case key org-special-properties) + (list (org-element-property :begin p) + (format + "Special property \"%s\" found in a properties drawer" + key))))))) + +(defun org-lint-obsolete-properties-drawer (ast) + (org-element-map ast 'drawer + (lambda (d) + (when (equal (org-element-property :drawer-name d) "PROPERTIES") + (let ((headline? (org-element-lineage d '(headline))) + (before + (mapcar #'org-element-type + (assq d (reverse (org-element-contents + (org-element-property :parent d))))))) + (list (org-element-property :post-affiliated d) + (if (or (and headline? (member before '(nil (planning)))) + (and (null headline?) (member before '(nil (comment))))) + "Incorrect contents for PROPERTIES drawer" + "Incorrect location for PROPERTIES drawer"))))))) + +(defun org-lint-invalid-effort-property (ast) + (org-element-map ast 'node-property + (lambda (p) + (when (equal "EFFORT" (org-element-property :key p)) + (let ((value (org-element-property :value p))) + (and (org-string-nw-p value) + (not (org-duration-p value)) + (list (org-element-property :begin p) + (format "Invalid effort duration format: %S" value)))))))) + +(defun org-lint-link-to-local-file (ast) + (org-element-map ast 'link + (lambda (l) + (let ((type (org-element-property :type l))) + (pcase type + ((or "attachment" "file") + (let* ((path (org-element-property :path l)) + (file (if (string= type "file") + path + (org-with-point-at (org-element-property :begin l) + (org-attach-expand path))))) + (and (not (file-remote-p file)) + (not (file-exists-p file)) + (list (org-element-property :begin l) + (format (if (org-element-lineage l '(link)) + "Link to non-existent image file %S \ +in description" + "Link to non-existent local file %S") + file))))) + (_ nil)))))) + +(defun org-lint-non-existent-setupfile-parameter (ast) + (org-element-map ast 'keyword + (lambda (k) + (when (equal (org-element-property :key k) "SETUPFILE") + (let ((file (org-unbracket-string + "\"" "\"" + (org-element-property :value k)))) + (and (not (org-url-p file)) + (not (file-remote-p file)) + (not (file-exists-p file)) + (list (org-element-property :begin k) + (format "Non-existent setup file %S" file)))))))) + +(defun org-lint-wrong-include-link-parameter (ast) + (org-element-map ast 'keyword + (lambda (k) + (when (equal (org-element-property :key k) "INCLUDE") + (let* ((value (org-element-property :value k)) + (path + (and (string-match "^\\(\".+\"\\|\\S-+\\)[ \t]*" value) + (save-match-data + (org-strip-quotes (match-string 1 value)))))) + (if (not path) + (list (org-element-property :post-affiliated k) + "Missing location argument in INCLUDE keyword") + (let* ((file (org-string-nw-p + (if (string-match "::\\(.*\\)\\'" path) + (substring path 0 (match-beginning 0)) + path))) + (search (and (not (equal file path)) + (org-string-nw-p (match-string 1 path))))) + (if (and file + (not (file-remote-p file)) + (not (file-exists-p file))) + (list (org-element-property :post-affiliated k) + "Non-existent file argument in INCLUDE keyword") + (let* ((visiting (if file (find-buffer-visiting file) + (current-buffer))) + (buffer (or visiting (find-file-noselect file))) + (org-link-search-must-match-exact-headline t)) + (unwind-protect + (with-current-buffer buffer + (when (and search + (not (ignore-errors + (org-link-search search nil t)))) + (list (org-element-property :post-affiliated k) + (format + "Invalid search part \"%s\" in INCLUDE keyword" + search)))) + (unless visiting (kill-buffer buffer)))))))))))) + +(defun org-lint-obsolete-include-markup (ast) + (let ((regexp (format "\\`\\(?:\".+\"\\|\\S-+\\)[ \t]+%s" + (regexp-opt + '("ASCII" "BEAMER" "HTML" "LATEX" "MAN" "MARKDOWN" "MD" + "ODT" "ORG" "TEXINFO") + t)))) + (org-element-map ast 'keyword + (lambda (k) + (when (equal (org-element-property :key k) "INCLUDE") + (let ((case-fold-search t) + (value (org-element-property :value k))) + (when (string-match regexp value) + (let ((markup (match-string-no-properties 1 value))) + (list (org-element-property :post-affiliated k) + (format "Obsolete markup \"%s\" in INCLUDE keyword. \ +Use \"export %s\" instead" + markup + markup)))))))))) + +(defun org-lint-unknown-options-item (ast) + (let ((allowed (delq nil + (append + (mapcar (lambda (o) (nth 2 o)) org-export-options-alist) + (cl-mapcan + (lambda (b) + (mapcar (lambda (o) (nth 2 o)) + (org-export-backend-options b))) + org-export-registered-backends)))) + reports) + (org-element-map ast 'keyword + (lambda (k) + (when (string= (org-element-property :key k) "OPTIONS") + (let ((value (org-element-property :value k)) + (start 0)) + (while (string-match "\\(.+?\\):\\((.*?)\\|\\S-+\\)?[ \t]*" + value + start) + (setf start (match-end 0)) + (let ((item (match-string 1 value))) + (unless (member item allowed) + (push (list (org-element-property :post-affiliated k) + (format "Unknown OPTIONS item \"%s\"" item)) + reports)) + (unless (match-string 2 value) + (push (list (org-element-property :post-affiliated k) + (format "Missing value for option item %S" item)) + reports)))))))) + reports)) + +(defun org-lint-invalid-macro-argument-and-template (ast) + (let* ((reports nil) + (extract-placeholders + (lambda (template) + (let ((start 0) + args) + (while (string-match "\\$\\([1-9][0-9]*\\)" template start) + (setf start (match-end 0)) + (push (string-to-number (match-string 1 template)) args)) + (sort (org-uniquify args) #'<)))) + (check-arity + (lambda (arity macro) + (let* ((name (org-element-property :key macro)) + (pos (org-element-property :begin macro)) + (args (org-element-property :args macro)) + (l (length args))) + (cond + ((< l (1- (car arity))) + (push (list pos (format "Missing arguments in macro %S" name)) + reports)) + ((< l (car arity)) + (push (list pos (format "Missing argument in macro %S" name)) + reports)) + ((> l (1+ (cdr arity))) + (push (let ((spurious-args (nthcdr (cdr arity) args))) + (list pos + (format "Spurious arguments in macro %S: %s" + name + (mapconcat #'org-trim spurious-args ", ")))) + reports)) + ((> l (cdr arity)) + (push (list pos + (format "Spurious argument in macro %S: %s" + name + (org-last args))) + reports)) + (t nil)))))) + ;; Check arguments for macro templates. + (org-element-map ast 'keyword + (lambda (k) + (when (string= (org-element-property :key k) "MACRO") + (let* ((value (org-element-property :value k)) + (name (and (string-match "^\\S-+" value) + (match-string 0 value))) + (template (and name + (org-trim (substring value (match-end 0)))))) + (cond + ((not name) + (push (list (org-element-property :post-affiliated k) + "Missing name in MACRO keyword") + reports)) + ((not (org-string-nw-p template)) + (push (list (org-element-property :post-affiliated k) + "Missing template in macro \"%s\"" name) + reports)) + (t + (unless (let ((args (funcall extract-placeholders template))) + (equal (number-sequence 1 (or (org-last args) 0)) args)) + (push (list (org-element-property :post-affiliated k) + (format "Unused placeholders in macro \"%s\"" + name)) + reports)))))))) + ;; Check arguments for macros. + (org-macro-initialize-templates) + (let ((templates (append + (mapcar (lambda (m) (cons m "$1")) + '("author" "date" "email" "title" "results")) + org-macro-templates))) + (org-element-map ast 'macro + (lambda (macro) + (let* ((name (org-element-property :key macro)) + (template (cdr (assoc-string name templates t)))) + (pcase template + (`nil + (push (list (org-element-property :begin macro) + (format "Undefined macro %S" name)) + reports)) + ((guard (string= name "keyword")) + (funcall check-arity '(1 . 1) macro)) + ((guard (string= name "modification-time")) + (funcall check-arity '(1 . 2) macro)) + ((guard (string= name "n")) + (funcall check-arity '(0 . 2) macro)) + ((guard (string= name "property")) + (funcall check-arity '(1 . 2) macro)) + ((guard (string= name "time")) + (funcall check-arity '(1 . 1) macro)) + ((pred functionp)) ;ignore (eval ...) templates + (_ + (let* ((arg-numbers (funcall extract-placeholders template)) + (arity (if (null arg-numbers) + '(0 . 0) + (let ((m (apply #'max arg-numbers))) + (cons m m))))) + (funcall check-arity arity macro)))))))) + reports)) + +(defun org-lint-undefined-footnote-reference (ast) + (let ((definitions (org-element-map ast 'footnote-definition + (lambda (f) (org-element-property :label f))))) + (org-element-map ast 'footnote-reference + (lambda (f) + (let ((label (org-element-property :label f))) + (and (eq 'standard (org-element-property :type f)) + (not (member label definitions)) + (list (org-element-property :begin f) + (format "Missing definition for footnote [%s]" + label)))))))) + +(defun org-lint-unreferenced-footnote-definition (ast) + (let ((references (org-element-map ast 'footnote-reference + (lambda (f) (org-element-property :label f))))) + (org-element-map ast 'footnote-definition + (lambda (f) + (let ((label (org-element-property :label f))) + (and label + (not (member label references)) + (list (org-element-property :post-affiliated f) + (format "No reference for footnote definition [%s]" + label)))))))) + +(defun org-lint-colon-in-name (ast) + (org-element-map ast org-element-all-elements + (lambda (e) + (let ((name (org-element-property :name e))) + (and name + (string-match-p ":" name) + (list (progn + (goto-char (org-element-property :begin e)) + (re-search-forward + (format "^[ \t]*#\\+\\w+: +%s *$" (regexp-quote name))) + (match-beginning 0)) + (format + "Name \"%s\" contains a colon; Babel cannot use it as input" + name))))))) + +(defun org-lint-misplaced-planning-info (_) + (let ((case-fold-search t) + reports) + (while (re-search-forward org-planning-line-re nil t) + (unless (memq (org-element-type (org-element-at-point)) + '(comment-block example-block export-block planning + src-block verse-block)) + (push (list (line-beginning-position) "Misplaced planning info line") + reports))) + reports)) + +(defun org-lint-incomplete-drawer (_) + (let (reports) + (while (re-search-forward org-drawer-regexp nil t) + (let ((name (org-trim (match-string-no-properties 0))) + (element (org-element-at-point))) + (pcase (org-element-type element) + (`drawer + ;; Find drawer opening lines within non-empty drawers. + (let ((end (org-element-property :contents-end element))) + (when end + (while (re-search-forward org-drawer-regexp end t) + (let ((n (org-trim (match-string-no-properties 0)))) + (push (list (line-beginning-position) + (format "Possible misleading drawer entry %S" n)) + reports)))) + (goto-char (org-element-property :end element)))) + (`property-drawer + (goto-char (org-element-property :end element))) + ((or `comment-block `example-block `export-block `src-block + `verse-block) + nil) + (_ + ;; Find drawer opening lines outside of any drawer. + (push (list (line-beginning-position) + (format "Possible incomplete drawer %S" name)) + reports))))) + reports)) + +(defun org-lint-indented-diary-sexp (_) + (let (reports) + (while (re-search-forward "^[ \t]+%%(" nil t) + (unless (memq (org-element-type (org-element-at-point)) + '(comment-block diary-sexp example-block export-block + src-block verse-block)) + (push (list (line-beginning-position) "Possible indented diary-sexp") + reports))) + reports)) + +(defun org-lint-invalid-block (_) + (let ((case-fold-search t) + (regexp "^[ \t]*#\\+\\(BEGIN\\|END\\)\\(?::\\|_[^[:space:]]*\\)?[ \t]*") + reports) + (while (re-search-forward regexp nil t) + (let ((name (org-trim (buffer-substring-no-properties + (line-beginning-position) (line-end-position))))) + (cond + ((and (string-prefix-p "END" (match-string 1) t) + (not (eolp))) + (push (list (line-beginning-position) + (format "Invalid block closing line \"%s\"" name)) + reports)) + ((not (memq (org-element-type (org-element-at-point)) + '(center-block comment-block dynamic-block example-block + export-block quote-block special-block + src-block verse-block))) + (push (list (line-beginning-position) + (format "Possible incomplete block \"%s\"" + name)) + reports))))) + reports)) + +(defun org-lint-invalid-keyword-syntax (_) + (let ((regexp "^[ \t]*#\\+\\([^[:space:]:]*\\)\\(?: \\|$\\)") + (exception-re + (format "[ \t]*#\\+%s\\(\\[.*\\]\\)?:\\(?: \\|$\\)" + (regexp-opt org-element-dual-keywords))) + reports) + (while (re-search-forward regexp nil t) + (let ((name (match-string-no-properties 1))) + (unless (or (string-prefix-p "BEGIN" name t) + (string-prefix-p "END" name t) + (save-excursion + (beginning-of-line) + (let ((case-fold-search t)) (looking-at exception-re)))) + (push (list (match-beginning 0) + (format "Possible missing colon in keyword \"%s\"" name)) + reports)))) + reports)) + +(defun org-lint-extraneous-element-in-footnote-section (ast) + (org-element-map ast 'headline + (lambda (h) + (and (org-element-property :footnote-section-p h) + (org-element-map (org-element-contents h) + (cl-remove-if + (lambda (e) + (memq e '(comment comment-block footnote-definition + property-drawer section))) + org-element-all-elements) + (lambda (e) + (not (and (eq (org-element-type e) 'headline) + (org-element-property :commentedp e)))) + nil t '(footnote-definition property-drawer)) + (list (org-element-property :begin h) + "Extraneous elements in footnote section are not exported"))))) + +(defun org-lint-quote-section (ast) + (org-element-map ast '(headline inlinetask) + (lambda (h) + (let ((title (org-element-property :raw-value h))) + (and (or (string-prefix-p "QUOTE " title) + (string-prefix-p (concat org-comment-string " QUOTE ") title)) + (list (org-element-property :begin h) + "Deprecated QUOTE section")))))) + +(defun org-lint-file-application (ast) + (org-element-map ast 'link + (lambda (l) + (let ((app (org-element-property :application l))) + (and app + (list (org-element-property :begin l) + (format "Deprecated \"file+%s\" link type" app))))))) + +(defun org-lint-percent-encoding-link-escape (ast) + (org-element-map ast 'link + (lambda (l) + (when (eq 'bracket (org-element-property :format l)) + (let* ((uri (org-element-property :path l)) + (start 0) + (obsolete-flag + (catch :obsolete + (while (string-match "%\\(..\\)?" uri start) + (setq start (match-end 0)) + (unless (member (match-string 1 uri) '("25" "5B" "5D" "20")) + (throw :obsolete nil))) + (string-match-p "%" uri)))) + (when obsolete-flag + (list (org-element-property :begin l) + "Link escaped with obsolete percent-encoding syntax"))))))) + +(defun org-lint-wrong-header-argument (ast) + (let* ((reports) + (verify + (lambda (datum language headers) + (let ((allowed + ;; If LANGUAGE is specified, restrict allowed + ;; headers to both LANGUAGE-specific and default + ;; ones. Otherwise, accept headers from any loaded + ;; language. + (append + org-babel-header-arg-names + (cl-mapcan + (lambda (l) + (let ((v (intern (format "org-babel-header-args:%s" l)))) + (and (boundp v) (mapcar #'car (symbol-value v))))) + (if language (list language) + (mapcar #'car org-babel-load-languages)))))) + (dolist (header headers) + (let ((h (symbol-name (car header))) + (p (or (org-element-property :post-affiliated datum) + (org-element-property :begin datum)))) + (cond + ((not (string-prefix-p ":" h)) + (push + (list p + (format "Missing colon in header argument \"%s\"" h)) + reports)) + ((assoc-string (substring h 1) allowed)) + (t (push (list p (format "Unknown header argument \"%s\"" h)) + reports))))))))) + (org-element-map ast '(babel-call inline-babel-call inline-src-block keyword + node-property src-block) + (lambda (datum) + (pcase (org-element-type datum) + ((or `babel-call `inline-babel-call) + (funcall verify + datum + nil + (cl-mapcan #'org-babel-parse-header-arguments + (list + (org-element-property :inside-header datum) + (org-element-property :end-header datum))))) + (`inline-src-block + (funcall verify + datum + (org-element-property :language datum) + (org-babel-parse-header-arguments + (org-element-property :parameters datum)))) + (`keyword + (when (string= (org-element-property :key datum) "PROPERTY") + (let ((value (org-element-property :value datum))) + (when (string-match "\\`header-args\\(?::\\(\\S-+\\)\\)?\\+? *" + value) + (funcall verify + datum + (match-string 1 value) + (org-babel-parse-header-arguments + (substring value (match-end 0)))))))) + (`node-property + (let ((key (org-element-property :key datum))) + (when (let ((case-fold-search t)) + (string-match "\\`HEADER-ARGS\\(?::\\(\\S-+\\)\\)?\\+?" + key)) + (funcall verify + datum + (match-string 1 key) + (org-babel-parse-header-arguments + (org-element-property :value datum)))))) + (`src-block + (funcall verify + datum + (org-element-property :language datum) + (cl-mapcan #'org-babel-parse-header-arguments + (cons (org-element-property :parameters datum) + (org-element-property :header datum)))))))) + reports)) + +(defun org-lint-wrong-header-value (ast) + (let (reports) + (org-element-map ast + '(babel-call inline-babel-call inline-src-block src-block) + (lambda (datum) + (let* ((type (org-element-type datum)) + (language (org-element-property :language datum)) + (allowed-header-values + (append (and language + (let ((v (intern (concat "org-babel-header-args:" + language)))) + (and (boundp v) (symbol-value v)))) + org-babel-common-header-args-w-values)) + (datum-header-values + (org-babel-parse-header-arguments + (org-trim + (pcase type + (`src-block + (mapconcat + #'identity + (cons (org-element-property :parameters datum) + (org-element-property :header datum)) + " ")) + (`inline-src-block + (or (org-element-property :parameters datum) "")) + (_ + (concat + (org-element-property :inside-header datum) + " " + (org-element-property :end-header datum)))))))) + (dolist (header datum-header-values) + (let ((allowed-values + (cdr (assoc-string (substring (symbol-name (car header)) 1) + allowed-header-values)))) + (unless (memq allowed-values '(:any nil)) + (let ((values (cdr header)) + groups-alist) + (dolist (v (if (stringp values) (split-string values) + (list values))) + (let ((valid-value nil)) + (catch 'exit + (dolist (group allowed-values) + (cond + ((not (funcall + (if (stringp v) #'assoc-string #'assoc) + v group)) + (when (memq :any group) + (setf valid-value t) + (push (cons group v) groups-alist))) + ((assq group groups-alist) + (push + (list + (or (org-element-property :post-affiliated datum) + (org-element-property :begin datum)) + (format + "Forbidden combination in header \"%s\": %s, %s" + (car header) + (cdr (assq group groups-alist)) + v)) + reports) + (throw 'exit nil)) + (t (push (cons group v) groups-alist) + (setf valid-value t)))) + (unless valid-value + (push + (list + (or (org-element-property :post-affiliated datum) + (org-element-property :begin datum)) + (format "Unknown value \"%s\" for header \"%s\"" + v + (car header))) + reports)))))))))))) + reports)) + +(defun org-lint-spurious-colons (ast) + (org-element-map ast '(headline inlinetask) + (lambda (h) + (when (member "" (org-element-property :tags h)) + (list (org-element-property :begin h) + "Tags contain a spurious colon"))))) + + + +;;; Reports UI + +(defvar org-lint--report-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map tabulated-list-mode-map) + (define-key map (kbd "RET") 'org-lint--jump-to-source) + (define-key map (kbd "TAB") 'org-lint--show-source) + (define-key map (kbd "C-j") 'org-lint--show-source) + (define-key map (kbd "h") 'org-lint--hide-checker) + (define-key map (kbd "i") 'org-lint--ignore-checker) + map) + "Local keymap for `org-lint--report-mode' buffers.") + +(define-derived-mode org-lint--report-mode tabulated-list-mode "OrgLint" + "Major mode used to display reports emitted during linting. +\\{org-lint--report-mode-map}" + (setf tabulated-list-format + `[("Line" 6 + (lambda (a b) + (< (string-to-number (aref (cadr a) 0)) + (string-to-number (aref (cadr b) 0)))) + :right-align t) + ("Trust" 5 t) + ("Warning" 0 t)]) + (tabulated-list-init-header)) + +(defun org-lint--generate-reports (buffer checkers) + "Generate linting report for BUFFER. + +CHECKERS is the list of checkers used. + +Return an alist (ID [LINE TRUST DESCRIPTION CHECKER]), suitable +for `tabulated-list-printer'." + (with-current-buffer buffer + (save-excursion + (goto-char (point-min)) + (let ((ast (org-element-parse-buffer)) + (id 0) + (last-line 1) + (last-pos 1)) + ;; Insert unique ID for each report. Replace buffer positions + ;; with line numbers. + (mapcar + (lambda (report) + (list + (cl-incf id) + (apply #'vector + (cons + (progn + (goto-char (car report)) + (beginning-of-line) + (prog1 (number-to-string + (cl-incf last-line + (count-lines last-pos (point)))) + (setf last-pos (point)))) + (cdr report))))) + ;; Insert trust level in generated reports. Also sort them + ;; by buffer position in order to optimize lines computation. + (sort (cl-mapcan + (lambda (c) + (let ((trust (symbol-name (org-lint-checker-trust c)))) + (mapcar + (lambda (report) + (list (car report) trust (nth 1 report) c)) + (save-excursion + (funcall + (intern (format "org-lint-%s" + (org-lint-checker-name c))) + ast))))) + checkers) + #'car-less-than-car)))))) + +(defvar-local org-lint--source-buffer nil + "Source buffer associated to current report buffer.") + +(defvar-local org-lint--local-checkers nil + "List of checkers used to build current report.") + +(defun org-lint--refresh-reports () + (setq tabulated-list-entries + (org-lint--generate-reports org-lint--source-buffer + org-lint--local-checkers)) + (tabulated-list-print)) + +(defun org-lint--current-line () + "Return current report line, as a number." + (string-to-number (aref (tabulated-list-get-entry) 0))) + +(defun org-lint--current-checker (&optional entry) + "Return current report checker. +When optional argument ENTRY is non-nil, use this entry instead +of current one." + (aref (if entry (nth 1 entry) (tabulated-list-get-entry)) 3)) + +(defun org-lint--display-reports (source checkers) + "Display linting reports for buffer SOURCE. +CHECKERS is the list of checkers used." + (let ((buffer (get-buffer-create "*Org Lint*"))) + (with-current-buffer buffer + (org-lint--report-mode) + (setf org-lint--source-buffer source) + (setf org-lint--local-checkers checkers) + (org-lint--refresh-reports) + (add-hook 'tabulated-list-revert-hook #'org-lint--refresh-reports nil t)) + (pop-to-buffer buffer))) + +(defun org-lint--jump-to-source () + "Move to source line that generated the report at point." + (interactive) + (let ((l (org-lint--current-line))) + (switch-to-buffer-other-window org-lint--source-buffer) + (org-goto-line l) + (org-show-set-visibility 'local) + (recenter))) + +(defun org-lint--show-source () + "Show source line that generated the report at point." + (interactive) + (let ((buffer (current-buffer))) + (org-lint--jump-to-source) + (switch-to-buffer-other-window buffer))) + +(defun org-lint--hide-checker () + "Hide all reports from checker that generated the report at point." + (interactive) + (let ((c (org-lint--current-checker))) + (setf tabulated-list-entries + (cl-remove-if (lambda (e) (equal c (org-lint--current-checker e))) + tabulated-list-entries)) + (tabulated-list-print))) + +(defun org-lint--ignore-checker () + "Ignore all reports from checker that generated the report at point. +Checker will also be ignored in all subsequent reports." + (interactive) + (setf org-lint--local-checkers + (remove (org-lint--current-checker) org-lint--local-checkers)) + (org-lint--hide-checker)) + + +;;; Public function + +;;;###autoload +(defun org-lint (&optional arg) + "Check current Org buffer for syntax mistakes. + +By default, run all checkers. With a `\\[universal-argument]' prefix ARG, \ +select one +category of checkers only. With a `\\[universal-argument] \ +\\[universal-argument]' prefix, run one precise +checker by its name. + +ARG can also be a list of checker names, as symbols, to run." + (interactive "P") + (unless (derived-mode-p 'org-mode) (user-error "Not in an Org buffer")) + (when (called-interactively-p 'any) + (message "Org linting process starting...")) + (let ((checkers + (pcase arg + (`nil org-lint--checkers) + (`(4) + (let ((category + (completing-read + "Checker category: " + (mapcar #'org-lint-checker-categories org-lint--checkers) + nil t))) + (cl-remove-if-not + (lambda (c) + (assoc-string (org-lint-checker-categories c) category)) + org-lint--checkers))) + (`(16) + (list + (let ((name (completing-read + "Checker name: " + (mapcar #'org-lint-checker-name org-lint--checkers) + nil t))) + (catch 'exit + (dolist (c org-lint--checkers) + (when (string= (org-lint-checker-name c) name) + (throw 'exit c))))))) + ((pred consp) + (cl-remove-if-not (lambda (c) (memq (org-lint-checker-name c) arg)) + org-lint--checkers)) + (_ (user-error "Invalid argument `%S' for `org-lint'" arg))))) + (if (not (called-interactively-p 'any)) + (org-lint--generate-reports (current-buffer) checkers) + (org-lint--display-reports (current-buffer) checkers) + (message "Org linting process completed")))) + +(provide 'org-lint) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-lint.el ends here diff --git a/elpa/org-9.5.2/org-lint.elc b/elpa/org-9.5.2/org-lint.elc new file mode 100644 index 0000000..ffed70a Binary files /dev/null and b/elpa/org-9.5.2/org-lint.elc differ diff --git a/elpa/org-9.5.2/org-list.el b/elpa/org-9.5.2/org-list.el new file mode 100644 index 0000000..2bd9dc4 --- /dev/null +++ b/elpa/org-9.5.2/org-list.el @@ -0,0 +1,3582 @@ +;;; org-list.el --- Plain lists for Org -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Bastien Guerry <bzg@gnu.org> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the code dealing with plain lists in Org mode. + +;; The core concept behind lists is their structure. A structure is +;; a snapshot of the list, in the shape of a data tree (see +;; `org-list-struct'). + +;; Once the list structure is stored, it is possible to make changes +;; on it that will be mirrored to the real list or to get information +;; about the list, using accessors and methods provided in the +;; library. Most of them require the use of one or two helper +;; functions, namely `org-list-parents-alist' and +;; `org-list-prevs-alist'. + +;; Structure is eventually applied to the buffer with +;; `org-list-write-struct'. This function repairs (bullets, +;; indentation, checkboxes) the list in the process. It should be +;; called near the end of any function working on structures. + +;; Thus, a function applying to lists should usually follow this +;; template: + +;; 1. Verify point is in a list and grab item beginning (with the same +;; function `org-in-item-p'). If the function requires the cursor +;; to be at item's bullet, `org-at-item-p' is more selective. It +;; is also possible to move point to the closest item with +;; `org-list-search-backward', or `org-list-search-forward', +;; applied to the function `org-item-beginning-re'. + +;; 2. Get list structure with `org-list-struct'. + +;; 3. Compute one, or both, helper functions, +;; (`org-list-parents-alist', `org-list-prevs-alist') depending on +;; needed accessors. + +;; 4. Proceed with the modifications, using methods and accessors. + +;; 5. Verify and apply structure to buffer, using +;; `org-list-write-struct'. + +;; 6. If changes made to the list might have modified check-boxes, +;; call `org-update-checkbox-count-maybe'. + +;; Computing a structure can be a costly operation on huge lists (a +;; few thousand lines long). Thus, code should follow the rule: +;; "collect once, use many". As a corollary, it is usually a bad idea +;; to use directly an interactive function inside the code, as those, +;; being independent entities, read the whole list structure another +;; time. + +;;; Code: + +(require 'cl-lib) +(require 'org-macs) +(require 'org-compat) + +(defvar org-M-RET-may-split-line) +(defvar org-adapt-indentation) +(defvar org-auto-align-tags) +(defvar org-blank-before-new-entry) +(defvar org-clock-string) +(defvar org-closed-string) +(defvar org-deadline-string) +(defvar org-done-keywords) +(defvar org-drawer-regexp) +(defvar org-element-all-objects) +(defvar org-inhibit-startup) +(defvar org-loop-over-headlines-in-active-region) +(defvar org-odd-levels-only) +(defvar org-outline-regexp-bol) +(defvar org-scheduled-string) +(defvar org-todo-line-regexp) +(defvar org-ts-regexp) +(defvar org-ts-regexp-both) + +(declare-function org-at-heading-p "org" (&optional invisible-ok)) +(declare-function org-back-to-heading "org" (&optional invisible-ok)) +(declare-function org-before-first-heading-p "org" ()) +(declare-function org-current-level "org" ()) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-context "org-element" (&optional element)) +(declare-function org-element-interpret-data "org-element" (data)) +(declare-function org-element-lineage "org-element" (blob &optional types with-self)) +(declare-function org-element-macro-interpreter "org-element" (macro ##)) +(declare-function org-element-map "org-element" (data types fun &optional info first-match no-recursion with-affiliated)) +(declare-function org-element-normalize-string "org-element" (s)) +(declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-put-property "org-element" (element property value)) +(declare-function org-element-set-element "org-element" (old new)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-element-update-syntax "org-element" ()) +(declare-function org-end-of-meta-data "org" (&optional full)) +(declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) +(declare-function org-export-create-backend "ox" (&rest rest) t) +(declare-function org-export-data-with-backend "ox" (data backend info)) +(declare-function org-export-get-backend "ox" (name)) +(declare-function org-export-get-environment "ox" (&optional backend subtreep ext-plist)) +(declare-function org-export-get-next-element "ox" (blob info &optional n)) +(declare-function org-export-with-backend "ox" (backend data &optional contents info)) +(declare-function org-fix-tags-on-the-fly "org" ()) +(declare-function org-get-todo-state "org" ()) +(declare-function org-in-block-p "org" (names)) +(declare-function org-inlinetask-goto-beginning "org-inlinetask" ()) +(declare-function org-inlinetask-goto-end "org-inlinetask" ()) +(declare-function org-inlinetask-in-task-p "org-inlinetask" ()) +(declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) +(declare-function org-level-increment "org" ()) +(declare-function org-mode "org" ()) +(declare-function org-narrow-to-subtree "org" ()) +(declare-function org-outline-level "org" ()) +(declare-function org-previous-line-empty-p "org" ()) +(declare-function org-reduced-level "org" (L)) +(declare-function org-set-tags "org" (tags)) +(declare-function org-show-subtree "org" ()) +(declare-function org-sort-remove-invisible "org" (S)) +(declare-function org-time-string-to-seconds "org" (s)) +(declare-function org-timer-hms-to-secs "org-timer" (hms)) +(declare-function org-timer-item "org-timer" (&optional arg)) +(declare-function outline-next-heading "outline" ()) +(declare-function outline-previous-heading "outline" ()) + + + +;;; Configuration variables + +(defgroup org-plain-lists nil + "Options concerning plain lists in Org mode." + :tag "Org Plain lists" + :group 'org-structure) + +(defcustom org-cycle-include-plain-lists t + "When t, make TAB cycle visibility on plain list items. +Cycling plain lists works only when the cursor is on a plain list +item. When the cursor is on an outline heading, plain lists are +treated as text. This is the most stable way of handling this, +which is why it is the default. + +When this is the symbol `integrate', then integrate plain list +items when cycling, as if they were children of outline headings. + +This setting can lead to strange effects when switching visibility +to `children', because the first \"child\" in a subtree decides +what children should be listed. If that first \"child\" is a +plain list item with an implied large level number, all true +children and grand children of the outline heading will be +exposed in a children' view." + :group 'org-plain-lists + :group 'org-cycle + :type '(choice + (const :tag "Never" nil) + (const :tag "With cursor in plain list (recommended)" t) + (const :tag "As children of outline headings" integrate))) + +(defcustom org-list-demote-modify-bullet nil + "Default bullet type installed when demoting an item. +This is an association list, for each bullet type, this alist will point +to the bullet that should be used when this item is demoted. +For example, + + (setq org-list-demote-modify-bullet + \\='((\"+\" . \"-\") (\"-\" . \"+\") (\"*\" . \"+\"))) + +will make + + + Movies + + Silence of the Lambs + + My Cousin Vinny + + Books + + The Hunt for Red October + + The Road to Omaha + +into + + + Movies + - Silence of the Lambs + - My Cousin Vinny + + Books + - The Hunt for Red October + - The Road to Omaha" + :group 'org-plain-lists + :type '(repeat + (cons + (choice :tag "If the current bullet is " + (const "-") + (const "+") + (const "*") + (const "1.") + (const "1)")) + (choice :tag "demotion will change it to" + (const "-") + (const "+") + (const "*") + (const "1.") + (const "1)"))))) + +(defcustom org-plain-list-ordered-item-terminator t + "The character that makes a line with leading number an ordered list item. +Valid values are ?. and ?\\). To get both terminators, use t. + +This variable needs to be set before org.el is loaded. If you +need to make a change while Emacs is running, use the customize +interface or run the following code after updating it: + + `\\[org-element-update-syntax]'" + :group 'org-plain-lists + :type '(choice (const :tag "dot like in \"2.\"" ?.) + (const :tag "paren like in \"2)\"" ?\)) + (const :tag "both" t)) + :set (lambda (var val) (set var val) + (when (featurep 'org-element) (org-element-update-syntax)))) + +(defcustom org-list-allow-alphabetical nil + "Non-nil means single character alphabetical bullets are allowed. + +Both uppercase and lowercase are handled. Lists with more than +26 items will fallback to standard numbering. Alphabetical +counters like \"[@c]\" will be recognized. + +This variable needs to be set before org.el is loaded. If you +need to make a change while Emacs is running, use the customize +interface or run the following code after updating it: + + `\\[org-element-update-syntax]'" + :group 'org-plain-lists + :version "24.1" + :type 'boolean + :set (lambda (var val) (set var val) + (when (featurep 'org-element) (org-element-update-syntax)))) + +(defcustom org-list-two-spaces-after-bullet-regexp nil + "A regular expression matching bullets that should have 2 spaces after them. +When nil, no bullet will have two spaces after them. When +a string, it will be used as a regular expression. When the +bullet type of a list is changed, the new bullet type will be +matched against this regexp. If it matches, there will be two +spaces instead of one after the bullet in each item of the list." + :group 'org-plain-lists + :type '(choice + (const :tag "never" nil) + (regexp))) + +(defcustom org-list-automatic-rules '((checkbox . t) + (indent . t)) + "Non-nil means apply set of rules when acting on lists. +\\<org-mode-map> +By default, automatic actions are taken when using + `\\[org-meta-return]', + `\\[org-metaright]', + `\\[org-metaleft]', + `\\[org-shiftmetaright]', + `\\[org-shiftmetaleft]', + `\\[org-ctrl-c-minus]', + `\\[org-toggle-checkbox]', + `\\[org-insert-todo-heading]'. + +You can disable individually these rules by setting them to nil. +Valid rules are: + +checkbox when non-nil, checkbox statistics is updated each time + you either insert a new checkbox or toggle a checkbox. +indent when non-nil, indenting or outdenting list top-item + with its subtree will move the whole list and + outdenting a list whose bullet is * to column 0 will + change that bullet to \"-\"." + :group 'org-plain-lists + :version "24.1" + :type '(alist :tag "Sets of rules" + :key-type + (choice + (const :tag "Checkbox" checkbox) + (const :tag "Indent" indent)) + :value-type + (boolean :tag "Activate" :value t))) + +(defcustom org-list-use-circular-motion nil + "Non-nil means commands implying motion in lists should be cyclic. +\\<org-mode-map> +In that case, the item following the last item is the first one, +and the item preceding the first item is the last one. + +This affects the behavior of + `\\[org-move-item-up]', + `\\[org-move-item-down]', + `\\[org-next-item]', + `\\[org-previous-item]'." + :group 'org-plain-lists + :version "24.1" + :type 'boolean) + +(defvar org-checkbox-statistics-hook nil + "Hook that is run whenever Org thinks checkbox statistics should be updated. +This hook runs even if checkbox rule in +`org-list-automatic-rules' does not apply, so it can be used to +implement alternative ways of collecting statistics +information.") + +(defcustom org-checkbox-hierarchical-statistics t + "Non-nil means checkbox statistics counts only the state of direct children. +When nil, all boxes below the cookie are counted. +This can be set to nil on a per-node basis using a COOKIE_DATA property +with the word \"recursive\" in the value." + :group 'org-plain-lists + :type 'boolean) + +(defcustom org-list-indent-offset 0 + "Additional indentation for sub-items in a list. +By setting this to a small number, usually 1 or 2, one can more +clearly distinguish sub-items in a list." + :group 'org-plain-lists + :version "24.1" + :type 'integer) + +(defvar org-list-forbidden-blocks '("example" "verse" "src" "export") + "Names of blocks where lists are not allowed. +Names must be in lower case.") + + +;;; Predicates and regexps + +(defconst org-list-end-re "^[ \t]*\n[ \t]*\n" + "Regex matching the end of a plain list.") + +(defconst org-list-full-item-re + (concat "^[ \t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)\\(?:[ \t]+\\|$\\)\\)" + "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?" + "\\(?:\\(\\[[ X-]\\]\\)\\(?:[ \t]+\\|$\\)\\)?" + "\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?") + "Matches a list item and puts everything into groups: +group 1: bullet +group 2: counter +group 3: checkbox +group 4: description tag") + +(defun org-item-re () + "Return the correct regular expression for plain lists." + (let ((term (cond + ((eq org-plain-list-ordered-item-terminator t) "[.)]") + ((= org-plain-list-ordered-item-terminator ?\)) ")") + ((= org-plain-list-ordered-item-terminator ?.) "\\.") + (t "[.)]"))) + (alpha (if org-list-allow-alphabetical "\\|[A-Za-z]" ""))) + (concat "\\([ \t]*\\([-+]\\|\\(\\([0-9]+" alpha "\\)" term + "\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)"))) + +(defsubst org-item-beginning-re () + "Regexp matching the beginning of a plain list item." + (concat "^" (org-item-re))) + +(defun org-list-at-regexp-after-bullet-p (regexp) + "Is point at a list item with REGEXP after bullet?" + (and (org-at-item-p) + (save-excursion + (goto-char (match-end 0)) + (let ((counter-re (concat "\\(?:\\[@\\(?:start:\\)?" + (if org-list-allow-alphabetical + "\\([0-9]+\\|[A-Za-z]\\)" + "[0-9]+") + "\\][ \t]*\\)"))) + ;; Ignore counter if any + (when (looking-at counter-re) (goto-char (match-end 0)))) + (looking-at regexp)))) + +(defun org-list-in-valid-context-p () + "Is point in a context where lists are allowed?" + (not (org-in-block-p org-list-forbidden-blocks))) + +(defun org-in-item-p () + "Return item beginning position when in a plain list, nil otherwise." + (save-excursion + (beginning-of-line) + (let* ((case-fold-search t) + (context (org-list-context)) + (lim-up (car context)) + (inlinetask-re (and (featurep 'org-inlinetask) + (org-inlinetask-outline-regexp))) + (item-re (org-item-re)) + ;; Indentation isn't meaningful when point starts at an empty + ;; line or an inline task. + (ind-ref (if (or (looking-at "^[ \t]*$") + (and inlinetask-re (looking-at inlinetask-re))) + 10000 + (current-indentation)))) + (cond + ((eq (nth 2 context) 'invalid) nil) + ((looking-at item-re) (point)) + (t + ;; Detect if cursor in amidst `org-list-end-re'. First, count + ;; number HL of hard lines it takes, then call `org-in-regexp' + ;; to compute its boundaries END-BOUNDS. When point is + ;; in-between, move cursor before regexp beginning. + (let ((hl 0) (i -1) end-bounds) + (when (and (progn + (while (setq i (string-match + "[\r\n]" org-list-end-re (1+ i))) + (setq hl (1+ hl))) + (setq end-bounds (org-in-regexp org-list-end-re hl))) + (>= (point) (car end-bounds)) + (< (point) (cdr end-bounds))) + (goto-char (car end-bounds)) + (forward-line -1))) + ;; Look for an item, less indented that reference line. + (catch 'exit + (while t + (let ((ind (current-indentation))) + (cond + ;; This is exactly what we want. + ((and (looking-at item-re) (< ind ind-ref)) + (throw 'exit (point))) + ;; At upper bound of search or looking at the end of a + ;; previous list: search is over. + ((<= (point) lim-up) (throw 'exit nil)) + ((looking-at org-list-end-re) (throw 'exit nil)) + ;; Skip blocks, drawers, inline-tasks, blank lines + ((and (looking-at "^[ \t]*#\\+end_") + (re-search-backward "^[ \t]*#\\+begin_" lim-up t))) + ((and (looking-at "^[ \t]*:END:") + (re-search-backward org-drawer-regexp lim-up t)) + (beginning-of-line)) + ((and inlinetask-re (looking-at inlinetask-re)) + (org-inlinetask-goto-beginning) + (forward-line -1)) + ((looking-at "^[ \t]*$") (forward-line -1)) + ;; Text at column 0 cannot belong to a list: stop. + ((zerop ind) (throw 'exit nil)) + ;; Normal text less indented than reference line, take + ;; it as new reference. + ((< ind ind-ref) + (setq ind-ref ind) + (forward-line -1)) + (t (forward-line -1))))))))))) + +(defun org-at-item-p () + "Is point in a line starting a hand-formatted item?" + (save-excursion + (beginning-of-line) + (and (looking-at (org-item-re)) (org-list-in-valid-context-p)))) + +(defun org-at-item-bullet-p () + "Is point at the bullet of a plain list item?" + (and (org-at-item-p) + (not (member (char-after) '(?\ ?\t))) + (< (point) (match-end 0)))) + +(defun org-at-item-timer-p () + "Is point at a line starting a plain list item with a timer?" + (org-list-at-regexp-after-bullet-p + "\\([0-9]+:[0-9]+:[0-9]+\\)[ \t]+::[ \t]+")) + +(defun org-at-item-description-p () + "Is point at a description list item?" + (org-list-at-regexp-after-bullet-p "\\(\\S-.+\\)[ \t]+::\\([ \t]+\\|$\\)")) + +(defun org-at-item-checkbox-p () + "Is point at a line starting a plain-list item with a checklet?" + (org-list-at-regexp-after-bullet-p "\\(\\[[- X]\\]\\)[ \t]+")) + +(defun org-at-item-counter-p () + "Is point at a line starting a plain-list item with a counter?" + (and (org-at-item-p) + (looking-at org-list-full-item-re) + (match-string 2))) + + + +;;; Structures and helper functions + +(defun org-list-context () + "Determine context, and its boundaries, around point. + +Context will be a cell like (MIN MAX CONTEXT) where MIN and MAX +are boundaries and CONTEXT is a symbol among `drawer', `block', +`invalid', `inlinetask' and nil. + +Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'." + (save-match-data + (save-excursion + (org-with-limited-levels + (beginning-of-line) + (let ((case-fold-search t) (pos (point)) beg end context-type + ;; Get positions of surrounding headings. This is the + ;; default context. + (lim-up (or (save-excursion (and (ignore-errors (org-back-to-heading t)) + (point))) + (point-min))) + (lim-down (or (save-excursion (outline-next-heading)) (point-max)))) + ;; Is point inside a drawer? + (let ((end-re "^[ \t]*:END:") + (beg-re org-drawer-regexp)) + (when (save-excursion + (and (not (looking-at beg-re)) + (not (looking-at end-re)) + (setq beg (and (re-search-backward beg-re lim-up t) + (1+ (point-at-eol)))) + (setq end (or (and (re-search-forward end-re lim-down t) + (1- (match-beginning 0))) + lim-down)) + (>= end pos))) + (setq lim-up beg lim-down end context-type 'drawer))) + ;; Is point strictly in a block, and of which type? + (let ((block-re "^[ \t]*#\\+\\(begin\\|end\\)_") type) + (when (save-excursion + (and (not (looking-at block-re)) + (setq beg (and (re-search-backward block-re lim-up t) + (1+ (point-at-eol)))) + (looking-at "^[ \t]*#\\+begin_\\(\\S-+\\)") + (setq type (downcase (match-string 1))) + (goto-char beg) + (setq end (or (and (re-search-forward block-re lim-down t) + (1- (point-at-bol))) + lim-down)) + (>= end pos) + (equal (downcase (match-string 1)) "end"))) + (setq lim-up beg lim-down end + context-type (if (member type org-list-forbidden-blocks) + 'invalid 'block)))) + ;; Is point in an inlinetask? + (when (and (featurep 'org-inlinetask) + (save-excursion + (let* ((beg-re (org-inlinetask-outline-regexp)) + (end-re (concat beg-re "END[ \t]*$"))) + (and (not (looking-at "^\\*+")) + (setq beg (and (re-search-backward beg-re lim-up t) + (1+ (point-at-eol)))) + (not (looking-at end-re)) + (setq end (and (re-search-forward end-re lim-down t) + (1- (match-beginning 0)))) + (> (point) pos))))) + (setq lim-up beg lim-down end context-type 'inlinetask)) + ;; Return context boundaries and type. + (list lim-up lim-down context-type)))))) + +(defun org-list-struct () + "Return structure of list at point. + +A list structure is an alist where key is point at item, and +values are: +1. indentation, +2. bullet with trailing whitespace, +3. bullet counter, if any, +4. checkbox, if any, +5. description tag, if any, +6. position at item end. + +Thus the following list, where numbers in parens are +point-at-bol: + +- [X] first item (1) + 1. sub-item 1 (18) + 5. [@5] sub-item 2 (34) + some other text belonging to first item (55) +- last item (97) + + tag :: description (109) + (131) + +will get the following structure: + + ((1 0 \"- \" nil \"[X]\" nil 97) + (18 2 \"1. \" nil nil nil 34) + (34 2 \"5. \" \"5\" nil nil 55) + (97 0 \"- \" nil nil nil 131) + (109 2 \"+ \" nil nil \"tag\" 131)) + +Assume point is at an item." + (save-excursion + (beginning-of-line) + (let* ((case-fold-search t) + (context (org-list-context)) + (lim-up (car context)) + (lim-down (nth 1 context)) + (text-min-ind 10000) + (item-re (org-item-re)) + (inlinetask-re (and (featurep 'org-inlinetask) + (org-inlinetask-outline-regexp))) + (beg-cell (cons (point) (current-indentation))) + itm-lst itm-lst-2 end-lst end-lst-2 struct + (assoc-at-point + ;; Return association at point. + (lambda (ind) + (looking-at org-list-full-item-re) + (let ((bullet (match-string-no-properties 1))) + (list (point) + ind + bullet + (match-string-no-properties 2) ; counter + (match-string-no-properties 3) ; checkbox + ;; Description tag. + (and (string-match-p "[-+*]" bullet) + (match-string-no-properties 4)))))) + (end-before-blank + ;; Ensure list ends at the first blank line. + (lambda () + (skip-chars-backward " \r\t\n") + (min (1+ (point-at-eol)) lim-down)))) + ;; 1. Read list from starting item to its beginning, and save + ;; top item position and indentation in BEG-CELL. Also store + ;; ending position of items in END-LST. + (save-excursion + (catch 'exit + (while t + (let ((ind (current-indentation))) + (cond + ((<= (point) lim-up) + ;; At upward limit: if we ended at an item, store it, + ;; else dismiss useless data recorded above BEG-CELL. + ;; Jump to part 2. + (throw 'exit + (setq itm-lst + (if (not (looking-at item-re)) + (memq (assq (car beg-cell) itm-lst) itm-lst) + (setq beg-cell (cons (point) ind)) + (cons (funcall assoc-at-point ind) itm-lst))))) + ;; Looking at a list ending regexp. Dismiss useless + ;; data recorded above BEG-CELL. Jump to part 2. + ((looking-at org-list-end-re) + (throw 'exit + (setq itm-lst + (memq (assq (car beg-cell) itm-lst) itm-lst)))) + ;; Point is at an item. Add data to ITM-LST. It may + ;; also end a previous item: save it in END-LST. If + ;; ind is less or equal than BEG-CELL and there is no + ;; end at this ind or lesser, this item becomes the new + ;; BEG-CELL. + ((looking-at item-re) + (push (funcall assoc-at-point ind) itm-lst) + (push (cons ind (point)) end-lst) + (when (< ind text-min-ind) (setq beg-cell (cons (point) ind))) + (forward-line -1)) + ;; Skip blocks, drawers, inline tasks, blank lines. + ((and (looking-at "^[ \t]*#\\+end_") + (re-search-backward "^[ \t]*#\\+begin_" lim-up t))) + ((and (looking-at "^[ \t]*:END:") + (re-search-backward org-drawer-regexp lim-up t)) + (beginning-of-line)) + ((and inlinetask-re (looking-at inlinetask-re)) + (org-inlinetask-goto-beginning) + (forward-line -1)) + ((looking-at "^[ \t]*$") + (forward-line -1)) + ;; From there, point is not at an item. Interpret + ;; line's indentation: + ;; - text at column 0 is necessarily out of any list. + ;; Dismiss data recorded above BEG-CELL. Jump to + ;; part 2. + ;; - any other case may be an ending position for an + ;; hypothetical item above. Store it and proceed. + ((zerop ind) + (throw 'exit + (setq itm-lst + (memq (assq (car beg-cell) itm-lst) itm-lst)))) + (t + (when (< ind text-min-ind) (setq text-min-ind ind)) + (push (cons ind (point)) end-lst) + (forward-line -1))))))) + ;; 2. Read list from starting point to its end, that is until we + ;; get out of context, or that a non-item line is less or + ;; equally indented than BEG-CELL's cdr. Also, store ending + ;; position of items in END-LST-2. + (catch 'exit + (while t + (let ((ind (current-indentation))) + (cond + ((>= (point) lim-down) + ;; At downward limit: this is de facto the end of the + ;; list. Save point as an ending position, and jump to + ;; part 3. + (throw 'exit + (push (cons 0 (funcall end-before-blank)) end-lst-2))) + ;; Looking at a list ending regexp. Save point as an + ;; ending position and jump to part 3. + ((looking-at org-list-end-re) + (throw 'exit (push (cons 0 (point)) end-lst-2))) + ((looking-at item-re) + ;; Point is at an item. Add data to ITM-LST-2. It may + ;; also end a previous item, so save it in END-LST-2. + (push (funcall assoc-at-point ind) itm-lst-2) + (push (cons ind (point)) end-lst-2) + (forward-line 1)) + ;; Skip inline tasks and blank lines along the way + ((and inlinetask-re (looking-at inlinetask-re)) + (org-inlinetask-goto-end)) + ((looking-at "^[ \t]*$") + (forward-line 1)) + ;; Ind is lesser or equal than BEG-CELL's. The list is + ;; over: store point as an ending position and jump to + ;; part 3. + ((<= ind (cdr beg-cell)) + (throw 'exit + (push (cons 0 (funcall end-before-blank)) end-lst-2))) + ;; Else, if ind is lesser or equal than previous item's, + ;; this is an ending position: store it. In any case, + ;; skip block or drawer at point, and move to next line. + (t + (when (<= ind (nth 1 (car itm-lst-2))) + (push (cons ind (point)) end-lst-2)) + (cond + ((and (looking-at "^[ \t]*#\\+begin_") + (re-search-forward "^[ \t]*#\\+end_" lim-down t))) + ((and (looking-at org-drawer-regexp) + (re-search-forward "^[ \t]*:END:" lim-down t)))) + (forward-line 1)))))) + (setq struct (append itm-lst (cdr (nreverse itm-lst-2))) + end-lst (append end-lst (cdr (nreverse end-lst-2)))) + ;; 3. Associate each item to its end position. + (org-list-struct-assoc-end struct end-lst) + ;; 4. Return STRUCT + struct))) + +(defun org-list-struct-assoc-end (struct end-list) + "Associate proper ending point to items in STRUCT. + +END-LIST is a pseudo-alist where car is indentation and cdr is +ending position. + +This function modifies STRUCT." + (let ((endings end-list)) + (mapc + (lambda (elt) + (let ((pos (car elt)) + (ind (nth 1 elt))) + ;; Remove end candidates behind current item. + (while (or (<= (cdar endings) pos)) + (pop endings)) + ;; Add end position to item assoc. + (let ((old-end (nthcdr 6 elt)) + (new-end (assoc-default ind endings '<=))) + (if old-end + (setcar old-end new-end) + (setcdr elt (append (cdr elt) (list new-end))))))) + struct))) + +(defun org-list-prevs-alist (struct) + "Return alist between item and previous item in STRUCT." + (let ((item-end-alist (mapcar (lambda (e) (cons (car e) (nth 6 e))) + struct))) + (mapcar (lambda (e) + (let ((prev (car (rassq (car e) item-end-alist)))) + (cons (car e) prev))) + struct))) + +(defun org-list-parents-alist (struct) + "Return alist between item and parent in STRUCT." + (let* ((ind-to-ori (list (list (nth 1 (car struct))))) + (top-item (org-list-get-top-point struct)) + (prev-pos (list top-item))) + (cons prev-pos + (mapcar (lambda (item) + (let ((pos (car item)) + (ind (nth 1 item)) + (prev-ind (caar ind-to-ori))) + (push pos prev-pos) + (cond + ((> prev-ind ind) + ;; A sub-list is over. Find the associated + ;; origin in IND-TO-ORI. If it cannot be + ;; found (ill-formed list), set its parent as + ;; the first item less indented. If there is + ;; none, make it a top-level item. + (setq ind-to-ori + (or (member (assq ind ind-to-ori) ind-to-ori) + (catch 'exit + (mapc + (lambda (e) + (when (< (car e) ind) + (throw 'exit (member e ind-to-ori)))) + ind-to-ori) + (list (list ind))))) + (cons pos (cdar ind-to-ori))) + ;; A sub-list starts. Every item at IND will + ;; have previous item as its parent. + ((< prev-ind ind) + (let ((origin (nth 1 prev-pos))) + (push (cons ind origin) ind-to-ori) + (cons pos origin))) + ;; Another item in the same sub-list: it shares + ;; the same parent as the previous item. + (t (cons pos (cdar ind-to-ori)))))) + (cdr struct))))) + +(defun org-list--delete-metadata () + "Delete metadata from the heading at point. +Metadata are tags, planning information and properties drawers." + (save-match-data + (org-with-wide-buffer + (org-set-tags nil) + (delete-region (line-beginning-position 2) + (save-excursion + (org-end-of-meta-data) + (org-skip-whitespace) + (if (eobp) (point) (line-beginning-position))))))) + + +;;; Accessors + +(defsubst org-list-get-nth (n key struct) + "Return the Nth value of KEY in STRUCT." + (nth n (assq key struct))) + +(defun org-list-set-nth (n key struct new) + "Set the Nth value of KEY in STRUCT to NEW. +\nThis function modifies STRUCT." + (setcar (nthcdr n (assq key struct)) new)) + +(defsubst org-list-get-ind (item struct) + "Return indentation of ITEM in STRUCT." + (org-list-get-nth 1 item struct)) + +(defun org-list-set-ind (item struct ind) + "Set indentation of ITEM in STRUCT to IND. +\nThis function modifies STRUCT." + (org-list-set-nth 1 item struct ind)) + +(defsubst org-list-get-bullet (item struct) + "Return bullet of ITEM in STRUCT." + (org-list-get-nth 2 item struct)) + +(defun org-list-set-bullet (item struct bullet) + "Set bullet of ITEM in STRUCT to BULLET. +\nThis function modifies STRUCT." + (org-list-set-nth 2 item struct bullet)) + +(defsubst org-list-get-counter (item struct) + "Return counter of ITEM in STRUCT." + (org-list-get-nth 3 item struct)) + +(defsubst org-list-get-checkbox (item struct) + "Return checkbox of ITEM in STRUCT or nil." + (org-list-get-nth 4 item struct)) + +(defun org-list-set-checkbox (item struct checkbox) + "Set checkbox of ITEM in STRUCT to CHECKBOX. +\nThis function modifies STRUCT." + (org-list-set-nth 4 item struct checkbox)) + +(defsubst org-list-get-tag (item struct) + "Return end position of ITEM in STRUCT." + (org-list-get-nth 5 item struct)) + +(defun org-list-get-item-end (item struct) + "Return end position of ITEM in STRUCT." + (org-list-get-nth 6 item struct)) + +(defun org-list-get-item-end-before-blank (item struct) + "Return point at end of ITEM in STRUCT, before any blank line. +Point returned is at end of line." + (save-excursion + (goto-char (org-list-get-item-end item struct)) + (skip-chars-backward " \r\t\n") + (point-at-eol))) + +(defun org-list-get-parent (item struct parents) + "Return parent of ITEM or nil. +STRUCT is the list structure. PARENTS is the alist of parents, +as returned by `org-list-parents-alist'." + (let ((parents (or parents (org-list-parents-alist struct)))) + (cdr (assq item parents)))) + +(defun org-list-has-child-p (item struct) + "Non-nil if ITEM has a child. + +STRUCT is the list structure. + +Value returned is the position of the first child of ITEM." + (let ((ind (org-list-get-ind item struct)) + (child-maybe (car (nth 1 (member (assq item struct) struct))))) + (when (and child-maybe + (< ind (org-list-get-ind child-maybe struct))) + child-maybe))) + +(defun org-list-get-next-item (item _struct prevs) + "Return next item in same sub-list as ITEM, or nil. +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'." + (car (rassq item prevs))) + +(defun org-list-get-prev-item (item _struct prevs) + "Return previous item in same sub-list as ITEM, or nil. +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'." + (cdr (assq item prevs))) + +(defun org-list-get-subtree (item struct) + "List all items having ITEM as a common ancestor, or nil. +STRUCT is the list structure." + (let* ((item-end (org-list-get-item-end item struct)) + (sub-struct (cdr (member (assq item struct) struct))) + items) + (catch :exit + (pcase-dolist (`(,pos . ,_) sub-struct) + (if (< pos item-end) + (push pos items) + (throw :exit nil)))) + (nreverse items))) + +(defun org-list-get-all-items (item struct prevs) + "List all items in the same sub-list as ITEM. +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'." + (let ((prev-item item) + (next-item item) + before-item after-item) + (while (setq prev-item (org-list-get-prev-item prev-item struct prevs)) + (push prev-item before-item)) + (while (setq next-item (org-list-get-next-item next-item struct prevs)) + (push next-item after-item)) + (append before-item (list item) (nreverse after-item)))) + +(defun org-list-get-children (item _struct parents) + "List all children of ITEM, or nil. +STRUCT is the list structure. PARENTS is the alist of parents, +as returned by `org-list-parents-alist'." + (let (all child) + (while (setq child (car (rassq item parents))) + (setq parents (cdr (member (assq child parents) parents))) + (push child all)) + (nreverse all))) + +(defun org-list-get-top-point (struct) + "Return point at beginning of list. +STRUCT is the list structure." + (caar struct)) + +(defun org-list-get-bottom-point (struct) + "Return point at bottom of list. +STRUCT is the list structure." + (apply #'max + (mapcar (lambda (e) (org-list-get-item-end (car e) struct)) struct))) + +(defun org-list-get-list-begin (item struct prevs) + "Return point at beginning of sub-list ITEM belongs. +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'." + (let ((first-item item) prev-item) + (while (setq prev-item (org-list-get-prev-item first-item struct prevs)) + (setq first-item prev-item)) + first-item)) + +(defalias 'org-list-get-first-item 'org-list-get-list-begin) + +(defun org-list-get-last-item (item struct prevs) + "Return point at last item of sub-list ITEM belongs. +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'." + (let ((last-item item) next-item) + (while (setq next-item (org-list-get-next-item last-item struct prevs)) + (setq last-item next-item)) + last-item)) + +(defun org-list-get-list-end (item struct prevs) + "Return point at end of sub-list ITEM belongs. +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'." + (org-list-get-item-end (org-list-get-last-item item struct prevs) struct)) + +(defun org-list-get-list-type (item struct prevs) + "Return the type of the list containing ITEM, as a symbol. + +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'. + +Possible types are `descriptive', `ordered' and `unordered'. The +type is determined by the first item of the list." + (let ((first (org-list-get-list-begin item struct prevs))) + (cond + ((string-match-p "[[:alnum:]]" (org-list-get-bullet first struct)) 'ordered) + ((org-list-get-tag first struct) 'descriptive) + (t 'unordered)))) + +(defun org-list-get-item-number (item struct prevs parents) + "Return ITEM's sequence number. + +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'. PARENTS is the +alist of ancestors, as returned by `org-list-parents-alist'. + +Return value is a list of integers. Counters have an impact on +that value." + (let ((get-relative-number + (lambda (item struct prevs) + ;; Return relative sequence number of ITEM in the sub-list + ;; it belongs. STRUCT is the list structure. PREVS is + ;; the alist of previous items. + (let ((seq 0) (pos item) counter) + (while (and (not (setq counter (org-list-get-counter pos struct))) + (setq pos (org-list-get-prev-item pos struct prevs))) + (cl-incf seq)) + (if (not counter) (1+ seq) + (cond + ((string-match "[A-Za-z]" counter) + (+ (- (string-to-char (upcase (match-string 0 counter))) 64) + seq)) + ((string-match "[0-9]+" counter) + (+ (string-to-number (match-string 0 counter)) seq)) + (t (1+ seq)))))))) + ;; Cons each parent relative number into return value (OUT). + (let ((out (list (funcall get-relative-number item struct prevs))) + (parent item)) + (while (setq parent (org-list-get-parent parent struct parents)) + (push (funcall get-relative-number parent struct prevs) out)) + ;; Return value. + out))) + + + +;;; Searching + +(defun org-list-search-generic (search re bound noerr) + "Search a string in valid contexts for lists. +Arguments SEARCH, RE, BOUND and NOERR are similar to those used +in `re-search-forward'." + (catch 'exit + (let ((origin (point))) + (while t + ;; 1. No match: return to origin or bound, depending on NOERR. + (unless (funcall search re bound noerr) + (throw 'exit (and (goto-char (if (memq noerr '(t nil)) origin bound)) + nil))) + ;; 2. Match in valid context: return point. Else, continue + ;; searching. + (when (org-list-in-valid-context-p) (throw 'exit (point))))))) + +(defun org-list-search-backward (regexp &optional bound noerror) + "Like `re-search-backward' but stop only where lists are recognized. +Arguments REGEXP, BOUND and NOERROR are similar to those used in +`re-search-backward'." + (org-list-search-generic #'re-search-backward + regexp (or bound (point-min)) noerror)) + +(defun org-list-search-forward (regexp &optional bound noerror) + "Like `re-search-forward' but stop only where lists are recognized. +Arguments REGEXP, BOUND and NOERROR are similar to those used in +`re-search-forward'." + (org-list-search-generic #'re-search-forward + regexp (or bound (point-max)) noerror)) + + + +;;; Methods on structures + +(defsubst org-list-bullet-string (bullet) + "Return BULLET with the correct number of whitespaces. +It determines the number of whitespaces to append by looking at +`org-list-two-spaces-after-bullet-regexp'." + (save-match-data + (let ((spaces (if (and org-list-two-spaces-after-bullet-regexp + (string-match + org-list-two-spaces-after-bullet-regexp bullet)) + " " + " "))) + (if (string-match "\\S-+\\([ \t]*\\)" bullet) + (replace-match spaces nil nil bullet 1) + bullet)))) + +(defun org-list-swap-items (beg-A beg-B struct) + "Swap item starting at BEG-A with item starting at BEG-B in STRUCT. + +Blank lines at the end of items are left in place. Item +visibility is preserved. Return the new structure after the +changes. + +Assume BEG-A is lesser than BEG-B and that BEG-A and BEG-B belong +to the same sub-list. + +This function modifies STRUCT." + (save-excursion + (let* ((end-A-no-blank (org-list-get-item-end-before-blank beg-A struct)) + (end-B-no-blank (org-list-get-item-end-before-blank beg-B struct)) + (end-A (org-list-get-item-end beg-A struct)) + (end-B (org-list-get-item-end beg-B struct)) + (size-A (- end-A-no-blank beg-A)) + (size-B (- end-B-no-blank beg-B)) + (body-A (buffer-substring beg-A end-A-no-blank)) + (body-B (buffer-substring beg-B end-B-no-blank)) + (between-A-no-blank-and-B (buffer-substring end-A-no-blank beg-B)) + (sub-A (cons beg-A (org-list-get-subtree beg-A struct))) + (sub-B (cons beg-B (org-list-get-subtree beg-B struct))) + ;; Store overlays responsible for visibility status. We + ;; also need to store their boundaries as they will be + ;; removed from buffer. + (overlays + (cons + (delq nil + (mapcar (lambda (o) + (and (>= (overlay-start o) beg-A) + (<= (overlay-end o) end-A) + (list o (overlay-start o) (overlay-end o)))) + (overlays-in beg-A end-A))) + (delq nil + (mapcar (lambda (o) + (and (>= (overlay-start o) beg-B) + (<= (overlay-end o) end-B) + (list o (overlay-start o) (overlay-end o)))) + (overlays-in beg-B end-B)))))) + ;; 1. Move effectively items in buffer. + (goto-char beg-A) + (delete-region beg-A end-B-no-blank) + (insert (concat body-B between-A-no-blank-and-B body-A)) + ;; 2. Now modify struct. No need to re-read the list, the + ;; transformation is just a shift of positions. Some special + ;; attention is required for items ending at END-A and END-B + ;; as empty spaces are not moved there. In others words, + ;; item BEG-A will end with whitespaces that were at the end + ;; of BEG-B and the same applies to BEG-B. + (dolist (e struct) + (let ((pos (car e))) + (cond + ((< pos beg-A)) + ((memq pos sub-A) + (let ((end-e (nth 6 e))) + (setcar e (+ pos (- end-B-no-blank end-A-no-blank))) + (setcar (nthcdr 6 e) + (+ end-e (- end-B-no-blank end-A-no-blank))) + (when (= end-e end-A) (setcar (nthcdr 6 e) end-B)))) + ((memq pos sub-B) + (let ((end-e (nth 6 e))) + (setcar e (- (+ pos beg-A) beg-B)) + (setcar (nthcdr 6 e) (+ end-e (- beg-A beg-B))) + (when (= end-e end-B) + (setcar (nthcdr 6 e) + (+ beg-A size-B (- end-A end-A-no-blank)))))) + ((< pos beg-B) + (let ((end-e (nth 6 e))) + (setcar e (+ pos (- size-B size-A))) + (setcar (nthcdr 6 e) (+ end-e (- size-B size-A)))))))) + (setq struct (sort struct #'car-less-than-car)) + ;; Restore visibility status, by moving overlays to their new + ;; position. + (dolist (ov (car overlays)) + (move-overlay + (car ov) + (+ (nth 1 ov) (- (+ beg-B (- size-B size-A)) beg-A)) + (+ (nth 2 ov) (- (+ beg-B (- size-B size-A)) beg-A)))) + (dolist (ov (cdr overlays)) + (move-overlay (car ov) + (+ (nth 1 ov) (- beg-A beg-B)) + (+ (nth 2 ov) (- beg-A beg-B)))) + ;; Return structure. + struct))) + +(defun org-list-separating-blank-lines-number (pos struct prevs) + "Return number of blank lines that should separate items in list. + +POS is the position of point where `org-list-insert-item' was called. + +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'. + +Assume point is at item's beginning. If the item is alone, apply +some heuristics to guess the result." + (save-excursion + (let ((item (point)) + (insert-blank-p + (cdr (assq 'plain-list-item org-blank-before-new-entry))) + usr-blank + (count-blanks + (lambda () + ;; Count blank lines above beginning of line. + (save-excursion + (count-lines (goto-char (point-at-bol)) + (progn (skip-chars-backward " \r\t\n") + (forward-line) + (point))))))) + (cond + ;; Trivial cases where there should be none. + ((not insert-blank-p) 0) + ;; When `org-blank-before-new-entry' says so, it is 1. + ((eq insert-blank-p t) 1) + ;; `plain-list-item' is 'auto. Count blank lines separating + ;; neighbors' items in list. + (t (let ((next-p (org-list-get-next-item item struct prevs))) + (cond + ;; Is there a next item? + (next-p (goto-char next-p) + (funcall count-blanks)) + ;; Is there a previous item? + ((org-list-get-prev-item item struct prevs) + (funcall count-blanks)) + ;; User inserted blank lines, trust him. + ((and (> pos (org-list-get-item-end-before-blank item struct)) + (> (save-excursion (goto-char pos) + (setq usr-blank (funcall count-blanks))) + 0)) + usr-blank) + ;; Are there blank lines inside the list so far? + ((save-excursion + (goto-char (org-list-get-top-point struct)) + ;; Do not use `org-list-search-forward' so blank lines + ;; in blocks can be counted in. + (re-search-forward + "^[ \t]*$" (org-list-get-item-end-before-blank item struct) t)) + 1) + ;; Default choice: no blank line. + (t 0)))))))) + +(defun org-list-insert-item (pos struct prevs &optional checkbox after-bullet) + "Insert a new list item at POS and return the new structure. +If POS is before first character after bullet of the item, the +new item will be created before the current one. + +STRUCT is the list structure. PREVS is the alist of previous +items, as returned by `org-list-prevs-alist'. + +Insert a checkbox if CHECKBOX is non-nil, and string AFTER-BULLET +after the bullet. Cursor will be after this text once the +function ends. + +This function modifies STRUCT." + (let* ((case-fold-search t) + ;; Get information about list: ITEM containing POS, position + ;; of point with regards to item start (BEFOREP), blank lines + ;; number separating items (BLANK-NB), if we're allowed to + ;; (SPLIT-LINE-P). + (item + (catch :exit + (let ((i nil)) + (pcase-dolist (`(,start ,_ ,_ ,_ ,_ ,_ ,end) struct) + (cond + ((> start pos) (throw :exit i)) + ((< end pos) nil) ;skip sub-lists before point + (t (setq i start)))) + ;; If no suitable item is found, insert a sibling of the + ;; last item in buffer. + (or i (caar (reverse struct)))))) + (item-end (org-list-get-item-end item struct)) + (item-end-no-blank (org-list-get-item-end-before-blank item struct)) + (beforep + (progn + (goto-char item) + (looking-at org-list-full-item-re) + (<= pos + (cond + ((not (match-beginning 4)) (match-end 0)) + ;; Ignore tag in a non-descriptive list. + ((save-match-data (string-match "[.)]" (match-string 1))) + (match-beginning 4)) + (t (save-excursion + (goto-char (match-end 4)) + (skip-chars-forward " \t") + (point))))))) + (split-line-p (org-get-alist-option org-M-RET-may-split-line 'item)) + (blank-nb (org-list-separating-blank-lines-number pos struct prevs)) + ;; Build the new item to be created. Concatenate same bullet + ;; as item, checkbox, text AFTER-BULLET if provided, and text + ;; cut from point to end of item (TEXT-CUT) to form item's + ;; BODY. TEXT-CUT depends on BEFOREP and SPLIT-LINE-P. The + ;; difference of size between what was cut and what was + ;; inserted in buffer is stored in SIZE-OFFSET. + (ind (org-list-get-ind item struct)) + (ind-size (if indent-tabs-mode + (+ (/ ind tab-width) (mod ind tab-width)) + ind)) + (bullet (org-list-bullet-string (org-list-get-bullet item struct))) + (box (and checkbox "[ ]")) + (text-cut + (and (not beforep) + split-line-p + (progn + (goto-char pos) + ;; If POS is greater than ITEM-END, then point is in + ;; some white lines after the end of the list. Those + ;; must be removed, or they will be left, stacking up + ;; after the list. + (when (< item-end pos) + (delete-region (1- item-end) (point-at-eol))) + (skip-chars-backward " \r\t\n") + ;; Cut position is after any blank on the line. + (save-excursion + (skip-chars-forward " \t") + (setq pos (point))) + (delete-and-extract-region (point) item-end-no-blank)))) + (body + (concat bullet + (and box (concat box " ")) + after-bullet + (and text-cut + (if (string-match "\\`[ \t]+" text-cut) + (replace-match "" t t text-cut) + text-cut)))) + (item-sep (make-string (1+ blank-nb) ?\n)) + (item-size (+ ind-size (length body) (length item-sep))) + (size-offset (- item-size (length text-cut)))) + ;; Insert effectively item into buffer. + (goto-char item) + (indent-to-column ind) + (insert body item-sep) + ;; Add new item to STRUCT. + (dolist (e struct) + (let ((p (car e)) (end (nth 6 e))) + (cond + ;; Before inserted item, positions don't change but an item + ;; ending after insertion has its end shifted by SIZE-OFFSET. + ((< p item) + (when (> end item) + (setcar (nthcdr 6 e) (+ end size-offset)))) + ;; Item where insertion happens may be split in two parts. + ;; In this case, move start by ITEM-SIZE and end by + ;; SIZE-OFFSET. + ((and (= p item) (not beforep) split-line-p) + (setcar e (+ p item-size)) + (setcar (nthcdr 6 e) (+ end size-offset))) + ;; Items starting after modified item fall into two + ;; categories. + ;; + ;; If modified item was split, and current sub-item was + ;; located after split point, it was moved to the new item: + ;; the part between body start and split point (POS) was + ;; removed. So we compute the length of that part and shift + ;; item's positions accordingly. + ;; + ;; Otherwise, the item was simply shifted by SIZE-OFFSET. + ((and split-line-p (not beforep) (>= p pos) (<= p item-end-no-blank)) + (let ((offset (- pos item ind (length bullet) (length after-bullet)))) + (setcar e (- p offset)) + (setcar (nthcdr 6 e) (- end offset)))) + (t + (setcar e (+ p size-offset)) + (setcar (nthcdr 6 e) (+ end size-offset)))))) + (push (list item ind bullet nil box nil (+ item item-size)) struct) + (setq struct (sort struct #'car-less-than-car)) + ;; If not BEFOREP, new item must appear after ITEM, so exchange + ;; ITEM with the next item in list. Position cursor after bullet, + ;; counter, checkbox, and label. + (if beforep + (goto-char item) + (setq struct (org-list-swap-items item (+ item item-size) struct)) + (goto-char (org-list-get-next-item + item struct (org-list-prevs-alist struct)))) + struct)) + +(defun org-list-delete-item (item struct) + "Remove ITEM from the list and return the new structure. + +STRUCT is the list structure." + (let* ((end (org-list-get-item-end item struct)) + (beg (if (= (org-list-get-bottom-point struct) end) + ;; If ITEM ends with the list, delete blank lines + ;; before it. + (save-excursion + (goto-char item) + (skip-chars-backward " \r\t\n") + (min (1+ (point-at-eol)) (point-max))) + item))) + ;; Remove item from buffer. + (delete-region beg end) + ;; Remove item from structure and shift others items accordingly. + ;; Don't forget to shift also ending position when appropriate. + (let ((size (- end beg))) + (delq nil (mapcar (lambda (e) + (let ((pos (car e))) + (cond + ((< pos item) + (let ((end-e (nth 6 e))) + (cond + ((< end-e item) e) + ((= end-e item) + (append (butlast e) (list beg))) + (t + (append (butlast e) (list (- end-e size))))))) + ((< pos end) nil) + (t + (cons (- pos size) + (append (butlast (cdr e)) + (list (- (nth 6 e) size)))))))) + struct))))) + +(defun org-list-send-item (item dest struct) + "Send ITEM to destination DEST. + +STRUCT is the list structure. + +DEST can have various values. + +If DEST is a buffer position, the function will assume it points +to another item in the same list as ITEM, and will move the +latter just before the former. + +If DEST is `begin' (respectively `end'), ITEM will be moved at +the beginning (respectively end) of the list it belongs to. + +If DEST is a string like \"N\", where N is an integer, ITEM will +be moved at the Nth position in the list. + +If DEST is `kill', ITEM will be deleted and its body will be +added to the kill-ring. + +If DEST is `delete', ITEM will be deleted. + +Visibility of item is preserved. + +This function returns, destructively, the new list structure." + (let* ((prevs (org-list-prevs-alist struct)) + (item-end (org-list-get-item-end item struct)) + ;; Grab full item body minus its bullet. + (body (org-trim + (buffer-substring + (save-excursion + (goto-char item) + (looking-at + (concat "[ \t]*" + (regexp-quote (org-list-get-bullet item struct)))) + (match-end 0)) + item-end))) + ;; Change DEST into a buffer position. A trick is needed + ;; when ITEM is meant to be sent at the end of the list. + ;; Indeed, by setting locally `org-M-RET-may-split-line' to + ;; nil and insertion point (INS-POINT) to the first line's + ;; end of the last item, we ensure the new item will be + ;; inserted after the last item, and not after any of its + ;; hypothetical sub-items. + (ins-point (cond + ((or (eq dest 'kill) (eq dest 'delete))) + ((eq dest 'begin) + (setq dest (org-list-get-list-begin item struct prevs))) + ((eq dest 'end) + (setq dest (org-list-get-list-end item struct prevs)) + (save-excursion + (goto-char (org-list-get-last-item item struct prevs)) + (point-at-eol))) + ((string-match-p "\\`[0-9]+\\'" dest) + (let* ((all (org-list-get-all-items item struct prevs)) + (len (length all)) + (index (mod (string-to-number dest) len))) + (if (not (zerop index)) + (setq dest (nth (1- index) all)) + ;; Send ITEM at the end of the list. + (setq dest (org-list-get-list-end item struct prevs)) + (save-excursion + (goto-char + (org-list-get-last-item item struct prevs)) + (point-at-eol))))) + (t dest))) + (org-M-RET-may-split-line nil) + ;; Store inner overlays (to preserve visibility). + (overlays (cl-remove-if (lambda (o) (or (< (overlay-start o) item) + (> (overlay-end o) item))) + (overlays-in item item-end)))) + (cond + ((eq dest 'delete) (org-list-delete-item item struct)) + ((eq dest 'kill) + (kill-new body) + (org-list-delete-item item struct)) + ((and (integerp dest) (/= item ins-point)) + (setq item (copy-marker item)) + (setq struct (org-list-insert-item ins-point struct prevs nil body)) + ;; 1. Structure returned by `org-list-insert-item' may not be + ;; accurate, as it cannot see sub-items included in BODY. + ;; Thus, first compute the real structure so far. + (let ((moved-items + (cons (marker-position item) + (org-list-get-subtree (marker-position item) struct))) + (new-end (org-list-get-item-end (point) struct)) + (old-end (org-list-get-item-end (marker-position item) struct)) + (new-item (point)) + (shift (- (point) item))) + ;; 1.1. Remove the item just created in structure. + (setq struct (delete (assq new-item struct) struct)) + ;; 1.2. Copy ITEM and any of its sub-items at NEW-ITEM. + (setq struct (sort + (append + struct + (mapcar (lambda (e) + (let* ((cell (assq e struct)) + (pos (car cell)) + (end (nth 6 cell))) + (cons (+ pos shift) + (append (butlast (cdr cell)) + (list (if (= end old-end) + new-end + (+ end shift))))))) + moved-items)) + #'car-less-than-car))) + ;; 2. Restore inner overlays. + (dolist (o overlays) + (move-overlay o + (+ (overlay-start o) (- (point) item)) + (+ (overlay-end o) (- (point) item)))) + ;; 3. Eventually delete extra copy of the item and clean marker. + (prog1 (org-list-delete-item (marker-position item) struct) + (move-marker item nil))) + (t struct)))) + +(defun org-list-struct-outdent (start end struct parents) + "Outdent items between positions START and END. + +STRUCT is the list structure. PARENTS is the alist of items' +parents, as returned by `org-list-parents-alist'. + +START is included, END excluded." + (let* (acc + (out (lambda (cell) + (let* ((item (car cell)) + (parent (cdr cell))) + (cond + ;; Item not yet in zone: keep association. + ((< item start) cell) + ;; Item out of zone: follow associations in ACC. + ((>= item end) + (let ((convert (and parent (assq parent acc)))) + (if convert (cons item (cdr convert)) cell))) + ;; Item has no parent: error + ((not parent) + (error "Cannot outdent top-level items")) + ;; Parent is outdented: keep association. + ((>= parent start) + (push (cons parent item) acc) cell) + (t + ;; Parent isn't outdented: reparent to grand-parent. + (let ((grand-parent (org-list-get-parent + parent struct parents))) + (push (cons parent item) acc) + (cons item grand-parent)))))))) + (mapcar out parents))) + +(defun org-list-struct-indent (start end struct parents prevs) + "Indent items between positions START and END. + +STRUCT is the list structure. PARENTS is the alist of parents +and PREVS is the alist of previous items, returned by, +respectively, `org-list-parents-alist' and +`org-list-prevs-alist'. + +START is included and END excluded. + +STRUCT may be modified if `org-list-demote-modify-bullet' matches +bullets between START and END." + (let* (acc + (set-assoc (lambda (cell) (push cell acc) cell)) + (ind + (lambda (cell) + (let* ((item (car cell)) + (parent (cdr cell))) + (cond + ;; Item not yet in zone: keep association. + ((< item start) cell) + ((>= item end) + ;; Item out of zone: follow associations in ACC. + (let ((convert (assq parent acc))) + (if convert (cons item (cdr convert)) cell))) + (t + ;; Item is in zone... + (let ((prev (org-list-get-prev-item item struct prevs))) + ;; Check if bullet needs to be changed. + (pcase (assoc (let ((b (org-list-get-bullet item struct)) + (case-fold-search nil)) + (cond ((string-match "[A-Z]\\." b) "A.") + ((string-match "[A-Z])" b) "A)") + ((string-match "[a-z]\\." b) "a.") + ((string-match "[a-z])" b) "a)") + ((string-match "[0-9]\\." b) "1.") + ((string-match "[0-9])" b) "1)") + (t (org-trim b)))) + org-list-demote-modify-bullet) + (`(,_ . ,bullet) + (org-list-set-bullet + item struct (org-list-bullet-string bullet))) + (_ nil)) + (cond + ;; First item indented but not parent: error + ((and (not prev) (or (not parent) (< parent start))) + (user-error "Cannot indent the first item of a list")) + ;; First item and parent indented: keep same + ;; parent. + ((not prev) (funcall set-assoc cell)) + ;; Previous item not indented: reparent to it. + ((< prev start) (funcall set-assoc (cons item prev))) + ;; Previous item indented: reparent like it. + (t + (funcall set-assoc + (cons item (cdr (assq prev acc))))))))))))) + (mapcar ind parents))) + + + +;;; Repairing structures + +(defun org-list-use-alpha-bul-p (first struct prevs) + "Non-nil if list starting at FIRST can have alphabetical bullets. + +STRUCT is list structure. PREVS is the alist of previous items, +as returned by `org-list-prevs-alist'." + (and org-list-allow-alphabetical + (catch 'exit + (let ((item first) (ascii 64) (case-fold-search nil)) + ;; Pretend that bullets are uppercase and check if alphabet + ;; is sufficient, taking counters into account. + (while item + (let ((count (org-list-get-counter item struct))) + ;; Virtually determine current bullet + (if (and count (string-match-p "[a-zA-Z]" count)) + ;; Counters are not case-sensitive. + (setq ascii (string-to-char (upcase count))) + (setq ascii (1+ ascii))) + ;; Test if bullet would be over z or Z. + (if (> ascii 90) + (throw 'exit nil) + (setq item (org-list-get-next-item item struct prevs))))) + ;; All items checked. All good. + t)))) + +(defun org-list-inc-bullet-maybe (bullet) + "Increment BULLET if applicable." + (let ((case-fold-search nil)) + (cond + ;; Num bullet: increment it. + ((string-match "[0-9]+" bullet) + (replace-match + (number-to-string (1+ (string-to-number (match-string 0 bullet)))) + nil nil bullet)) + ;; Alpha bullet: increment it. + ((string-match "[A-Za-z]" bullet) + (replace-match + (char-to-string (1+ (string-to-char (match-string 0 bullet)))) + nil nil bullet)) + ;; Unordered bullet: leave it. + (t bullet)))) + +(defun org-list-struct-fix-bul (struct prevs) + "Verify and correct bullets in STRUCT. +PREVS is the alist of previous items, as returned by +`org-list-prevs-alist'. + +This function modifies STRUCT." + (let ((case-fold-search nil) + (fix-bul + ;; Set bullet of ITEM in STRUCT, depending on the type of + ;; first item of the list, the previous bullet and counter + ;; if any. + (lambda (item) + (let* ((prev (org-list-get-prev-item item struct prevs)) + (prev-bul (and prev (org-list-get-bullet prev struct))) + (counter (org-list-get-counter item struct)) + (bullet (org-list-get-bullet item struct)) + (alphap (and (not prev) + (org-list-use-alpha-bul-p item struct prevs)))) + (org-list-set-bullet + item struct + (org-list-bullet-string + (cond + ;; Alpha counter in alpha list: use counter. + ((and prev counter + (string-match "[a-zA-Z]" counter) + (string-match "[a-zA-Z]" prev-bul)) + ;; Use cond to be sure `string-match' is used in + ;; both cases. + (let ((real-count + (cond + ((string-match "[a-z]" prev-bul) (downcase counter)) + ((string-match "[A-Z]" prev-bul) (upcase counter))))) + (replace-match real-count nil nil prev-bul))) + ;; Num counter in a num list: use counter. + ((and prev counter + (string-match "[0-9]+" counter) + (string-match "[0-9]+" prev-bul)) + (replace-match counter nil nil prev-bul)) + ;; No counter: increase, if needed, previous bullet. + (prev + (org-list-inc-bullet-maybe (org-list-get-bullet prev struct))) + ;; Alpha counter at first item: use counter. + ((and counter (org-list-use-alpha-bul-p item struct prevs) + (string-match "[A-Za-z]" counter) + (string-match "[A-Za-z]" bullet)) + (let ((real-count + (cond + ((string-match "[a-z]" bullet) (downcase counter)) + ((string-match "[A-Z]" bullet) (upcase counter))))) + (replace-match real-count nil nil bullet))) + ;; Num counter at first item: use counter. + ((and counter + (string-match "[0-9]+" counter) + (string-match "[0-9]+" bullet)) + (replace-match counter nil nil bullet)) + ;; First bullet is alpha uppercase: use "A". + ((and alphap (string-match "[A-Z]" bullet)) + (replace-match "A" nil nil bullet)) + ;; First bullet is alpha lowercase: use "a". + ((and alphap (string-match "[a-z]" bullet)) + (replace-match "a" nil nil bullet)) + ;; First bullet is num: use "1". + ((string-match "\\([0-9]+\\|[A-Za-z]\\)" bullet) + (replace-match "1" nil nil bullet)) + ;; Not an ordered list: keep bullet. + (t bullet)))))))) + (mapc fix-bul (mapcar #'car struct)))) + +(defun org-list-struct-fix-ind (struct parents &optional bullet-size) + "Verify and correct indentation in STRUCT. + +PARENTS is the alist of parents, as returned by +`org-list-parents-alist'. + +If numeric optional argument BULLET-SIZE is set, assume all +bullets in list have this length to determine new indentation. + +This function modifies STRUCT." + (let* ((ancestor (org-list-get-top-point struct)) + (top-ind (org-list-get-ind ancestor struct)) + (new-ind + (lambda (item) + (let ((parent (org-list-get-parent item struct parents))) + (if parent + ;; Indent like parent + length of parent's bullet + + ;; sub-list offset. + (org-list-set-ind + item struct (+ (or bullet-size + (length + (org-list-get-bullet parent struct))) + (org-list-get-ind parent struct) + org-list-indent-offset)) + ;; If no parent, indent like top-point. + (org-list-set-ind item struct top-ind)))))) + (mapc new-ind (mapcar #'car (cdr struct))))) + +(defun org-list-struct-fix-box (struct parents prevs &optional ordered) + "Verify and correct checkboxes in STRUCT. + +PARENTS is the alist of parents and PREVS is the alist of +previous items, as returned by, respectively, +`org-list-parents-alist' and `org-list-prevs-alist'. + +If ORDERED is non-nil, a checkbox can only be checked when every +checkbox before it is checked too. If there was an attempt to +break this rule, the function will return the blocking item. In +all others cases, the return value will be nil. + +This function modifies STRUCT." + (let ((all-items (mapcar #'car struct)) + (set-parent-box + (lambda (item) + (let* ((box-list + (mapcar (lambda (child) + (org-list-get-checkbox child struct)) + (org-list-get-children item struct parents)))) + (org-list-set-checkbox + item struct + (cond + ((and (member "[ ]" box-list) (member "[X]" box-list)) "[-]") + ((member "[-]" box-list) "[-]") + ((member "[X]" box-list) "[X]") + ((member "[ ]" box-list) "[ ]") + ;; Parent has no boxed child: leave box as-is. + (t (org-list-get-checkbox item struct))))))) + parent-list) + ;; 1. List all parents with a checkbox. + (mapc + (lambda (e) + (let* ((parent (org-list-get-parent e struct parents)) + (parent-box-p (org-list-get-checkbox parent struct))) + (when (and parent-box-p (not (memq parent parent-list))) + (push parent parent-list)))) + all-items) + ;; 2. Sort those parents by decreasing indentation. + (setq parent-list (sort parent-list + (lambda (e1 e2) + (> (org-list-get-ind e1 struct) + (org-list-get-ind e2 struct))))) + ;; 3. For each parent, get all children's checkboxes to determine + ;; and set its checkbox accordingly. + (mapc set-parent-box parent-list) + ;; 4. If ORDERED is set, see if we need to uncheck some boxes. + (when ordered + (let* ((box-list + (mapcar (lambda (e) (org-list-get-checkbox e struct)) all-items)) + (after-unchecked (member "[ ]" box-list))) + ;; There are boxes checked after an unchecked one: fix that. + (when (member "[X]" after-unchecked) + (let ((index (- (length struct) (length after-unchecked)))) + (dolist (e (nthcdr index all-items)) + (when (org-list-get-checkbox e struct) + (org-list-set-checkbox e struct "[ ]"))) + ;; Verify once again the structure, without ORDERED. + (org-list-struct-fix-box struct parents prevs nil) + ;; Return blocking item. + (nth index all-items))))))) + +(defun org-list-struct-fix-item-end (struct) + "Verify and correct each item end position in STRUCT. + +This function modifies STRUCT." + (let (end-list acc-end) + (pcase-dolist (`(,pos . ,_) struct) + (let ((ind-pos (org-list-get-ind pos struct)) + (end-pos (org-list-get-item-end pos struct))) + (unless (assq end-pos struct) + ;; To determine real ind of an ending position that is not + ;; at an item, we have to find the item it belongs to: it is + ;; the last item (ITEM-UP), whose ending is further than the + ;; position we're interested in. + (let ((item-up (assoc-default end-pos acc-end #'>))) + (push (cons + ;; Else part is for the bottom point. + (if item-up (+ (org-list-get-ind item-up struct) 2) 0) + end-pos) + end-list))) + (push (cons ind-pos pos) end-list) + (push (cons end-pos pos) acc-end))) + (setq end-list (sort end-list (lambda (e1 e2) (< (cdr e1) (cdr e2))))) + (org-list-struct-assoc-end struct end-list))) + +(defun org-list-struct-apply-struct (struct old-struct) + "Apply set difference between STRUCT and OLD-STRUCT to the buffer. + +OLD-STRUCT is the structure before any modifications, and STRUCT +the structure to be applied. The function will only modify parts +of the list which have changed. + +Initial position of cursor is restored after the changes." + (let* ((origin (point-marker)) + (inlinetask-re (and (featurep 'org-inlinetask) + (org-inlinetask-outline-regexp))) + (item-re (org-item-re)) + (shift-body-ind + ;; Shift the indentation between END and BEG by DELTA. + ;; Start from the line before END. + (lambda (end beg delta) + (goto-char end) + (skip-chars-backward " \r\t\n") + (beginning-of-line) + (while (or (> (point) beg) + (and (= (point) beg) + (not (looking-at item-re)))) + (cond + ;; Skip inline tasks. + ((and inlinetask-re (looking-at inlinetask-re)) + (org-inlinetask-goto-beginning)) + ;; Shift only non-empty lines. + ((looking-at-p "^[ \t]*\\S-") + (indent-line-to (+ (current-indentation) delta)))) + (forward-line -1)))) + (modify-item + ;; Replace ITEM first line elements with new elements from + ;; STRUCT, if appropriate. + (lambda (item) + (goto-char item) + (let* ((new-ind (org-list-get-ind item struct)) + (old-ind (current-indentation)) + (new-bul (org-list-bullet-string + (org-list-get-bullet item struct))) + (old-bul (org-list-get-bullet item old-struct)) + (new-box (org-list-get-checkbox item struct))) + (looking-at org-list-full-item-re) + ;; a. Replace bullet + (unless (equal old-bul new-bul) + (replace-match new-bul nil nil nil 1)) + ;; b. Replace checkbox. + (cond + ((equal (match-string 3) new-box)) + ((and (match-string 3) new-box) + (replace-match new-box nil nil nil 3)) + ((match-string 3) + (looking-at ".*?\\([ \t]*\\[[ X-]\\]\\)") + (replace-match "" nil nil nil 1)) + (t (let ((counterp (match-end 2))) + (goto-char (if counterp (1+ counterp) (match-end 1))) + (insert (concat new-box (unless counterp " ")))))) + ;; c. Indent item to appropriate column. + (unless (= new-ind old-ind) + (delete-region (goto-char (point-at-bol)) + (progn (skip-chars-forward " \t") (point))) + (indent-to new-ind)))))) + ;; 1. First get list of items and position endings. We maintain + ;; two alists: ITM-SHIFT, determining indentation shift needed + ;; at item, and END-LIST, a pseudo-alist where key is ending + ;; position and value point. + (let (end-list acc-end itm-shift all-ends sliced-struct) + (dolist (e old-struct) + (let* ((pos (car e)) + (ind-pos (org-list-get-ind pos struct)) + (ind-old (org-list-get-ind pos old-struct)) + (bul-pos (org-list-get-bullet pos struct)) + (bul-old (org-list-get-bullet pos old-struct)) + (ind-shift (- (+ ind-pos (length bul-pos)) + (+ ind-old (length bul-old)))) + (end-pos (org-list-get-item-end pos old-struct))) + (push (cons pos ind-shift) itm-shift) + (unless (assq end-pos old-struct) + ;; To determine real ind of an ending position that + ;; is not at an item, we have to find the item it + ;; belongs to: it is the last item (ITEM-UP), whose + ;; ending is further than the position we're + ;; interested in. + (let ((item-up (assoc-default end-pos acc-end #'>))) + (push (cons end-pos item-up) end-list))) + (push (cons end-pos pos) acc-end))) + ;; 2. Slice the items into parts that should be shifted by the + ;; same amount of indentation. Each slice follow the pattern + ;; (END BEG DELTA). Slices are returned in reverse order. + (setq all-ends (sort (append (mapcar #'car itm-shift) + (org-uniquify (mapcar #'car end-list))) + #'<) + acc-end (nreverse acc-end)) + (while (cdr all-ends) + (let* ((up (pop all-ends)) + (down (car all-ends)) + (itemp (assq up struct)) + (delta + (if itemp (cdr (assq up itm-shift)) + ;; If we're not at an item, there's a child of the + ;; item point belongs to above. Make sure the less + ;; indented line in this slice has the same column + ;; as that child. + (let* ((child (cdr (assq up acc-end))) + (ind (org-list-get-ind child struct)) + (min-ind most-positive-fixnum)) + (save-excursion + (goto-char up) + (while (< (point) down) + ;; Ignore empty lines. Also ignore blocks and + ;; drawers contents. + (unless (looking-at-p "[ \t]*$") + (setq min-ind (min (current-indentation) min-ind)) + (cond + ((and (looking-at "#\\+BEGIN\\(:\\|_\\S-+\\)") + (re-search-forward + (format "^[ \t]*#\\+END%s[ \t]*$" + (match-string 1)) + down t))) + ((and (looking-at org-drawer-regexp) + (re-search-forward "^[ \t]*:END:[ \t]*$" + down t))))) + (forward-line))) + (- ind min-ind))))) + (push (list down up delta) sliced-struct))) + ;; 3. Shift each slice in buffer, provided delta isn't 0, from + ;; end to beginning. Take a special action when beginning is + ;; at item bullet. + (dolist (e sliced-struct) + (unless (zerop (nth 2 e)) (apply shift-body-ind e)) + (let* ((beg (nth 1 e)) + (cell (assq beg struct))) + (unless (or (not cell) (equal cell (assq beg old-struct))) + (funcall modify-item beg))))) + ;; 4. Go back to initial position and clean marker. + (goto-char origin) + (move-marker origin nil))) + +(defun org-list-write-struct (struct parents &optional old-struct) + "Correct bullets, checkboxes and indentation in list at point. + +STRUCT is the list structure. PARENTS is the alist of parents, +as returned by `org-list-parents-alist'. + +When non-nil, optional argument OLD-STRUCT is the reference +structure of the list. It should be provided whenever STRUCT +doesn't correspond anymore to the real list in buffer." + ;; Order of functions matters here: checkboxes and endings need + ;; correct indentation to be set, and indentation needs correct + ;; bullets. + ;; + ;; 0. Save a copy of structure before modifications + (let ((old-struct (or old-struct (copy-tree struct)))) + ;; 1. Set a temporary, but coherent with PARENTS, indentation in + ;; order to get items endings and bullets properly + (org-list-struct-fix-ind struct parents 2) + ;; 2. Fix each item end to get correct prevs alist. + (org-list-struct-fix-item-end struct) + ;; 3. Get bullets right. + (let ((prevs (org-list-prevs-alist struct))) + (org-list-struct-fix-bul struct prevs) + ;; 4. Now get real indentation. + (org-list-struct-fix-ind struct parents) + ;; 5. Eventually fix checkboxes. + (org-list-struct-fix-box struct parents prevs)) + ;; 6. Apply structure modifications to buffer. + (org-list-struct-apply-struct struct old-struct)) + ;; 7. Return the updated structure + struct) + + + +;;; Misc Tools + +(defun org-apply-on-list (function init-value &rest args) + "Call FUNCTION on each item of the list at point. +FUNCTION must be called with at least one argument: INIT-VALUE, +that will contain the value returned by the function at the +previous item, plus ARGS extra arguments. + +FUNCTION is applied on items in reverse order. + +As an example, \(org-apply-on-list \(lambda \(result) \(1+ result)) 0) +will return the number of items in the current list. + +Sublists of the list are skipped. Cursor is always at the +beginning of the item." + (let* ((struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (item (copy-marker (point-at-bol))) + (all (org-list-get-all-items (marker-position item) struct prevs)) + (value init-value)) + (dolist (e (nreverse all)) + (goto-char e) + (setq value (apply function value args))) + (goto-char item) + (move-marker item nil) + value)) + +(defun org-list-set-item-visibility (item struct view) + "Set visibility of ITEM in STRUCT to VIEW. + +Possible values are: `folded', `children' or `subtree'. See +`org-cycle' for more information." + (cond + ((eq view 'folded) + (let ((item-end (org-list-get-item-end-before-blank item struct))) + ;; Hide from eol + (org-flag-region (save-excursion (goto-char item) (line-end-position)) + item-end t 'outline))) + ((eq view 'children) + ;; First show everything. + (org-list-set-item-visibility item struct 'subtree) + ;; Then fold every child. + (let* ((parents (org-list-parents-alist struct)) + (children (org-list-get-children item struct parents))) + (dolist (child children) + (org-list-set-item-visibility child struct 'folded)))) + ((eq view 'subtree) + ;; Show everything + (let ((item-end (org-list-get-item-end item struct))) + (org-flag-region item item-end nil 'outline))))) + +(defun org-list-item-body-column (item) + "Return column at which body of ITEM should start." + (save-excursion + (goto-char item) + (looking-at "[ \t]*\\(\\S-+\\)") + (+ (progn (goto-char (match-end 1)) (current-column)) + (if (and org-list-two-spaces-after-bullet-regexp + (string-match-p org-list-two-spaces-after-bullet-regexp + (match-string 1))) + 2 + 1)))) + + + +;;; Interactive functions + +(defalias 'org-list-get-item-begin 'org-in-item-p) + +(defun org-beginning-of-item () + "Go to the beginning of the current item. +Throw an error when not in a list." + (interactive) + (let ((begin (org-in-item-p))) + (if begin (goto-char begin) (error "Not in an item")))) + +(defun org-beginning-of-item-list () + "Go to the beginning item of the current list or sublist. +Throw an error when not in a list." + (interactive) + (let ((begin (org-in-item-p))) + (if (not begin) + (error "Not in an item") + (goto-char begin) + (let* ((struct (org-list-struct)) + (prevs (org-list-prevs-alist struct))) + (goto-char (org-list-get-list-begin begin struct prevs)))))) + +(defun org-end-of-item-list () + "Go to the end of the current list or sublist. +Throw an error when not in a list." + (interactive) + (let ((begin (org-in-item-p))) + (if (not begin) + (error "Not in an item") + (goto-char begin) + (let* ((struct (org-list-struct)) + (prevs (org-list-prevs-alist struct))) + (goto-char (org-list-get-list-end begin struct prevs)))))) + +(defun org-end-of-item () + "Go to the end of the current item. +Throw an error when not in a list." + (interactive) + (let ((begin (org-in-item-p))) + (if (not begin) + (error "Not in an item") + (goto-char begin) + (let ((struct (org-list-struct))) + (goto-char (org-list-get-item-end begin struct)))))) + +(defun org-previous-item () + "Move to the beginning of the previous item. +Throw an error when not in a list. Also throw an error when at +first item, unless `org-list-use-circular-motion' is non-nil." + (interactive) + (let ((item (org-in-item-p))) + (if (not item) + (error "Not in an item") + (goto-char item) + (let* ((struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (prevp (org-list-get-prev-item item struct prevs))) + (cond + (prevp (goto-char prevp)) + (org-list-use-circular-motion + (goto-char (org-list-get-last-item item struct prevs))) + (t (error "On first item"))))))) + +(defun org-next-item () + "Move to the beginning of the next item. +Throw an error when not in a list. Also throw an error when at +last item, unless `org-list-use-circular-motion' is non-nil." + (interactive) + (let ((item (org-in-item-p))) + (if (not item) + (error "Not in an item") + (goto-char item) + (let* ((struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (prevp (org-list-get-next-item item struct prevs))) + (cond + (prevp (goto-char prevp)) + (org-list-use-circular-motion + (goto-char (org-list-get-first-item item struct prevs))) + (t (error "On last item"))))))) + +(defun org-move-item-down () + "Move the item at point down, i.e. swap with following item. +Sub-items (items with larger indentation) are considered part of +the item, so this really moves item trees." + (interactive) + (unless (org-at-item-p) (error "Not at an item")) + (let* ((col (current-column)) + (item (point-at-bol)) + (struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (next-item (org-list-get-next-item (point-at-bol) struct prevs))) + (unless (or next-item org-list-use-circular-motion) + (user-error "Cannot move this item further down")) + (if (not next-item) + (setq struct (org-list-send-item item 'begin struct)) + (setq struct (org-list-swap-items item next-item struct)) + (goto-char + (org-list-get-next-item item struct (org-list-prevs-alist struct)))) + (org-list-write-struct struct (org-list-parents-alist struct)) + (org-move-to-column col))) + +(defun org-move-item-up () + "Move the item at point up, i.e. swap with previous item. +Sub-items (items with larger indentation) are considered part of +the item, so this really moves item trees." + (interactive) + (unless (org-at-item-p) (error "Not at an item")) + (let* ((col (current-column)) + (item (point-at-bol)) + (struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (prev-item (org-list-get-prev-item (point-at-bol) struct prevs))) + (unless (or prev-item org-list-use-circular-motion) + (user-error "Cannot move this item further up")) + (if (not prev-item) + (setq struct (org-list-send-item item 'end struct)) + (setq struct (org-list-swap-items prev-item item struct))) + (org-list-write-struct struct (org-list-parents-alist struct)) + (org-move-to-column col))) + +(defun org-insert-item (&optional checkbox) + "Insert a new item at the current level. +If cursor is before first character after bullet of the item, the +new item will be created before the current one. + +If CHECKBOX is non-nil, add a checkbox next to the bullet. + +Return t when things worked, nil when we are not in an item, or +item is invisible." + (interactive "P") + (let ((itemp (org-in-item-p)) + (pos (point))) + ;; If cursor isn't is a list or if list is invisible, return nil. + (unless (or (not itemp) + (save-excursion + (goto-char itemp) + (org-invisible-p))) + (if (save-excursion + (goto-char itemp) + (org-at-item-timer-p)) + ;; Timer list: delegate to `org-timer-item'. + (progn (org-timer-item) t) + (let* ((struct (save-excursion (goto-char itemp) + (org-list-struct))) + (prevs (org-list-prevs-alist struct)) + ;; If we're in a description list, ask for the new term. + (desc (when (eq (org-list-get-list-type itemp struct prevs) + 'descriptive) + " :: "))) + (setq struct (org-list-insert-item pos struct prevs checkbox desc)) + (org-list-write-struct struct (org-list-parents-alist struct)) + (when checkbox (org-update-checkbox-count-maybe)) + (looking-at org-list-full-item-re) + (goto-char (if (and (match-beginning 4) + (save-match-data + (string-match "[.)]" (match-string 1)))) + (match-beginning 4) + (match-end 0))) + (when desc (backward-char 1)) + t))))) + +(defun org-list-repair () + "Fix indentation, bullets and checkboxes in the list at point." + (interactive) + (unless (org-at-item-p) (error "This is not a list")) + (let* ((struct (org-list-struct)) + (parents (org-list-parents-alist struct))) + (org-list-write-struct struct parents))) + +(defun org-cycle-list-bullet (&optional which) + "Cycle through the different itemize/enumerate bullets. +This cycle the entire list level through the sequence: + + `-' -> `+' -> `*' -> `1.' -> `1)' + +If WHICH is a valid string, use that as the new bullet. If WHICH +is an integer, 0 means `-', 1 means `+' etc. If WHICH is +`previous', cycle backwards." + (interactive "P") + (unless (org-at-item-p) (error "Not at an item")) + (save-excursion + (beginning-of-line) + (let* ((struct (org-list-struct)) + (parents (org-list-parents-alist struct)) + (prevs (org-list-prevs-alist struct)) + (list-beg (org-list-get-first-item (point) struct prevs)) + (bullet (org-list-get-bullet list-beg struct)) + (alpha-p (org-list-use-alpha-bul-p list-beg struct prevs)) + (case-fold-search nil) + (current (cond + ((string-match "[a-z]\\." bullet) "a.") + ((string-match "[a-z])" bullet) "a)") + ((string-match "[A-Z]\\." bullet) "A.") + ((string-match "[A-Z])" bullet) "A)") + ((string-match "\\." bullet) "1.") + ((string-match ")" bullet) "1)") + (t (org-trim bullet)))) + ;; Compute list of possible bullets, depending on context. + (bullet-list + (append '("-" "+" ) + ;; *-bullets are not allowed at column 0. + (unless (looking-at "\\S-") '("*")) + ;; Description items cannot be numbered. + (unless (or (eq org-plain-list-ordered-item-terminator ?\)) + (org-at-item-description-p)) + '("1.")) + (unless (or (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p)) + '("1)")) + (unless (or (not alpha-p) + (eq org-plain-list-ordered-item-terminator ?\)) + (org-at-item-description-p)) + '("a." "A.")) + (unless (or (not alpha-p) + (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p)) + '("a)" "A)")))) + (len (length bullet-list)) + (item-index (- len (length (member current bullet-list)))) + (get-value (lambda (index) (nth (mod index len) bullet-list))) + (new (cond + ((member which bullet-list) which) + ((numberp which) (funcall get-value which)) + ((eq 'previous which) (funcall get-value (1- item-index))) + (t (funcall get-value (1+ item-index)))))) + ;; Use a short variation of `org-list-write-struct' as there's + ;; no need to go through all the steps. + (let ((old-struct (copy-tree struct))) + (org-list-set-bullet list-beg struct (org-list-bullet-string new)) + (org-list-struct-fix-bul struct prevs) + (org-list-struct-fix-ind struct parents) + (org-list-struct-apply-struct struct old-struct))))) + +;;;###autoload +(define-minor-mode org-list-checkbox-radio-mode + "When turned on, use list checkboxes as radio buttons." + :lighter " CheckBoxRadio" + (unless (eq major-mode 'org-mode) + (user-error "Cannot turn this mode outside org-mode buffers"))) + +(defun org-toggle-radio-button (&optional arg) + "Toggle off all checkboxes and toggle on the one at point." + (interactive "P") + (if (not (org-at-item-p)) + (user-error "Cannot toggle checkbox outside of a list") + (let* ((cpos (org-in-item-p)) + (struct (org-list-struct)) + (orderedp (org-entry-get nil "ORDERED")) + (parents (org-list-parents-alist struct)) + (old-struct (copy-tree struct)) + (cbox (org-list-get-checkbox cpos struct)) + (prevs (org-list-prevs-alist struct)) + (start (org-list-get-list-begin (point-at-bol) struct prevs)) + (new (unless (and cbox (equal arg '(4)) (equal start cpos)) + "[ ]"))) + (dolist (pos (org-list-get-all-items + start struct (org-list-prevs-alist struct))) + (org-list-set-checkbox pos struct new)) + (when new + (org-list-set-checkbox + cpos struct + (cond ((equal arg '(4)) (unless cbox "[ ]")) + ((equal arg '(16)) (unless cbox "[-]")) + (t (if (equal cbox "[X]") "[ ]" "[X]"))))) + (org-list-struct-fix-box struct parents prevs orderedp) + (org-list-struct-apply-struct struct old-struct) + (org-update-checkbox-count-maybe)))) + +(defun org-at-radio-list-p () + "Is point at a list item with radio buttons?" + (when (org-match-line (org-item-re)) ;short-circuit + (let* ((e (save-excursion (beginning-of-line) (org-element-at-point)))) + ;; Check we're really on a line with a bullet. + (when (memq (org-element-type e) '(item plain-list)) + ;; Look for ATTR_ORG attribute in the current plain list. + (let ((plain-list (org-element-lineage e '(plain-list) t))) + (org-with-point-at (org-element-property :post-affiliated plain-list) + (let ((case-fold-search t) + (regexp "^[ \t]*#\\+attr_org:.* :radio \\(\\S-+\\)") + (begin (org-element-property :begin plain-list))) + (and (re-search-backward regexp begin t) + (not (string-equal "nil" (match-string 1))))))))))) + +(defun org-toggle-checkbox (&optional toggle-presence) + "Toggle the checkbox in the current line. + +With prefix argument TOGGLE-PRESENCE, add or remove checkboxes. +With a double prefix argument, set the checkbox to \"[-]\". + +When there is an active region, toggle status or presence of the +first checkbox there, and make every item inside have the same +status or presence, respectively. + +If point is on a headline, apply this to all checkbox items in +the text below the heading, taking as reference the first item in +subtree, ignoring planning line and any drawer following it." + (interactive "P") + (if (org-at-radio-list-p) + (org-toggle-radio-button toggle-presence) + (save-excursion + (let* (singlep + block-item + lim-up + lim-down + (orderedp (org-entry-get nil "ORDERED")) + (_bounds + ;; In a region, start at first item in region. + (cond + ((org-region-active-p) + (let ((limit (region-end))) + (goto-char (region-beginning)) + (if (org-list-search-forward (org-item-beginning-re) limit t) + (setq lim-up (point-at-bol)) + (error "No item in region")) + (setq lim-down (copy-marker limit)))) + ((org-at-heading-p) + ;; On a heading, start at first item after drawers and + ;; time-stamps (scheduled, etc.). + (let ((limit (save-excursion (outline-next-heading) (point)))) + (org-end-of-meta-data t) + (if (org-list-search-forward (org-item-beginning-re) limit t) + (setq lim-up (point-at-bol)) + (error "No item in subtree")) + (setq lim-down (copy-marker limit)))) + ;; Just one item: set SINGLEP flag. + ((org-at-item-p) + (setq singlep t) + (setq lim-up (point-at-bol) + lim-down (copy-marker (point-at-eol)))) + (t (error "Not at an item or heading, and no active region")))) + ;; Determine the checkbox going to be applied to all items + ;; within bounds. + (ref-checkbox + (progn + (goto-char lim-up) + (let ((cbox (and (org-at-item-checkbox-p) (match-string 1)))) + (cond + ((equal toggle-presence '(16)) "[-]") + ((equal toggle-presence '(4)) + (unless cbox "[ ]")) + ((equal "[X]" cbox) "[ ]") + (t "[X]")))))) + ;; When an item is found within bounds, grab the full list at + ;; point structure, then: (1) set check-box of all its items + ;; within bounds to REF-CHECKBOX, (2) fix check-boxes of the + ;; whole list, (3) move point after the list. + (goto-char lim-up) + (while (and (< (point) lim-down) + (org-list-search-forward (org-item-beginning-re) + lim-down 'move)) + (let* ((struct (org-list-struct)) + (struct-copy (copy-tree struct)) + (parents (org-list-parents-alist struct)) + (prevs (org-list-prevs-alist struct)) + (bottom (copy-marker (org-list-get-bottom-point struct))) + (items-to-toggle (cl-remove-if + (lambda (e) (or (< e lim-up) (> e lim-down))) + (mapcar #'car struct)))) + (dolist (e items-to-toggle) + (org-list-set-checkbox + e struct + ;; If there is no box at item, leave as-is unless + ;; function was called with C-u prefix. + (let ((cur-box (org-list-get-checkbox e struct))) + (if (or cur-box (equal toggle-presence '(4))) + ref-checkbox + cur-box)))) + (setq block-item (org-list-struct-fix-box + struct parents prevs orderedp)) + ;; Report some problems due to ORDERED status of subtree. + ;; If only one box was being checked, throw an error, else, + ;; only signal problems. + (cond + ((and singlep block-item (> lim-up block-item)) + (error + "Checkbox blocked because of unchecked box at line %d" + (org-current-line block-item))) + (block-item + (message + "Checkboxes were removed due to unchecked box at line %d" + (org-current-line block-item)))) + (goto-char bottom) + (move-marker bottom nil) + (org-list-struct-apply-struct struct struct-copy))) + (move-marker lim-down nil)))) + (org-update-checkbox-count-maybe)) + +(defun org-reset-checkbox-state-subtree () + "Reset all checkboxes in an entry subtree." + (interactive "*") + (if (org-before-first-heading-p) + (error "Not inside a tree") + (save-restriction + (save-excursion + (org-narrow-to-subtree) + (org-show-subtree) + (goto-char (point-min)) + (let ((end (point-max))) + (while (< (point) end) + (when (org-at-item-checkbox-p) + (replace-match "[ ]" t t nil 1)) + (beginning-of-line 2))) + (org-update-checkbox-count-maybe 'all))))) + +(defun org-update-checkbox-count (&optional all) + "Update the checkbox statistics in the current section. + +This will find all statistic cookies like [57%] and [6/12] and +update them with the current numbers. + +With optional prefix argument ALL, do this for the whole buffer." + (interactive "P") + (org-with-wide-buffer + (let* ((cookie-re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") + (box-re "^[ \t]*\\([-+*]\\|\\([0-9]+\\|[A-Za-z]\\)[.)]\\)[ \t]+\ +\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?\\(\\[[- X]\\]\\)") + (cookie-data (or (org-entry-get nil "COOKIE_DATA") "")) + (recursivep + (or (not org-checkbox-hierarchical-statistics) + (string-match-p "\\<recursive\\>" cookie-data))) + (within-inlinetask (and (not all) + (featurep 'org-inlinetask) + (org-inlinetask-in-task-p))) + (end (cond (all (point-max)) + (within-inlinetask + (save-excursion (outline-next-heading) (point))) + (t (save-excursion + (org-with-limited-levels (outline-next-heading)) + (point))))) + (count-boxes + (lambda (item structs recursivep) + ;; Return number of checked boxes and boxes of all types + ;; in all structures in STRUCTS. If RECURSIVEP is + ;; non-nil, also count boxes in sub-lists. If ITEM is + ;; nil, count across the whole structure, else count only + ;; across subtree whose ancestor is ITEM. + (let ((c-on 0) (c-all 0)) + (dolist (s structs (list c-on c-all)) + (let* ((pre (org-list-prevs-alist s)) + (par (org-list-parents-alist s)) + (items + (cond + ((and recursivep item) (org-list-get-subtree item s)) + (recursivep (mapcar #'car s)) + (item (org-list-get-children item s par)) + (t (org-list-get-all-items + (org-list-get-top-point s) s pre)))) + (cookies (delq nil (mapcar + (lambda (e) + (org-list-get-checkbox e s)) + items)))) + (cl-incf c-all (length cookies)) + (cl-incf c-on (cl-count "[X]" cookies :test #'equal))))))) + cookies-list cache) + ;; Move to start. + (cond (all (goto-char (point-min))) + (within-inlinetask (org-back-to-heading t)) + (t (org-with-limited-levels (outline-previous-heading)))) + ;; Build an alist for each cookie found. The key is the position + ;; at beginning of cookie and values ending position, format of + ;; cookie, number of checked boxes to report and total number of + ;; boxes. + (while (re-search-forward cookie-re end t) + (let ((context (save-excursion (backward-char) + (save-match-data (org-element-context))))) + (when (and (eq (org-element-type context) 'statistics-cookie) + (not (string-match-p "\\<todo\\>" cookie-data))) + (push + (append + (list (match-beginning 1) (match-end 1) (match-end 2)) + (let* ((container + (org-element-lineage + context + '(drawer center-block dynamic-block inlinetask item + quote-block special-block verse-block))) + (beg (if container + (org-element-property :contents-begin container) + (save-excursion + (org-with-limited-levels + (outline-previous-heading)) + (point))))) + (or (cdr (assq beg cache)) + (save-excursion + (goto-char beg) + (let ((end + (if container + (org-element-property :contents-end container) + (save-excursion + (org-with-limited-levels (outline-next-heading)) + (point)))) + structs) + (while (re-search-forward box-re end t) + (let ((element (org-element-at-point))) + (when (eq (org-element-type element) 'item) + (push (org-element-property :structure element) + structs) + ;; Skip whole list since we have its + ;; structure anyway. + (while (setq element (org-element-lineage + element '(plain-list))) + (goto-char + (min (org-element-property :end element) + end)))))) + ;; Cache count for cookies applying to the same + ;; area. Then return it. + (let ((count + (funcall count-boxes + (and (eq (org-element-type container) + 'item) + (org-element-property + :begin container)) + structs + recursivep))) + (push (cons beg count) cache) + count)))))) + cookies-list)))) + ;; Apply alist to buffer. + (dolist (cookie cookies-list) + (let* ((beg (car cookie)) + (end (nth 1 cookie)) + (percent (nth 2 cookie)) + (checked (nth 3 cookie)) + (total (nth 4 cookie))) + (goto-char beg) + (insert + (if percent (format "[%d%%]" (floor (* 100.0 checked) + (max 1 total))) + (format "[%d/%d]" checked total))) + (delete-region (point) (+ (point) (- end beg))) + (when org-auto-align-tags (org-fix-tags-on-the-fly))))))) + +(defun org-get-checkbox-statistics-face () + "Select the face for checkbox statistics. +The face will be `org-done' when all relevant boxes are checked. +Otherwise it will be `org-todo'." + (if (match-end 1) + (if (equal (match-string 1) "100%") + 'org-checkbox-statistics-done + 'org-checkbox-statistics-todo) + (if (and (> (match-end 2) (match-beginning 2)) + (equal (match-string 2) (match-string 3))) + 'org-checkbox-statistics-done + 'org-checkbox-statistics-todo))) + +(defun org-update-checkbox-count-maybe (&optional all) + "Update checkbox statistics unless turned off by user. +With an optional argument ALL, update them in the whole buffer." + (when (cdr (assq 'checkbox org-list-automatic-rules)) + (org-update-checkbox-count all)) + (run-hooks 'org-checkbox-statistics-hook)) + +(defvar org-last-indent-begin-marker (make-marker)) +(defvar org-last-indent-end-marker (make-marker)) +(defun org-list-indent-item-generic (arg no-subtree struct) + "Indent a local list item including its children. +When number ARG is a negative, item will be outdented, otherwise +it will be indented. + +If a region is active, all items inside will be moved. + +If NO-SUBTREE is non-nil, only indent the item itself, not its +children. + +STRUCT is the list structure. + +Return t if successful." + (save-excursion + (let* ((regionp (org-region-active-p)) + (rbeg (and regionp (region-beginning))) + (rend (and regionp (region-end))) + (top (org-list-get-top-point struct)) + (parents (org-list-parents-alist struct)) + (prevs (org-list-prevs-alist struct)) + ;; Are we going to move the whole list? + (specialp + (and (not regionp) + (= top (point-at-bol)) + (cdr (assq 'indent org-list-automatic-rules)) + (if no-subtree + (user-error + "At first item: use S-M-<left/right> to move the whole list") + t)))) + ;; Determine begin and end points of zone to indent. If moving + ;; more than one item, save them for subsequent moves. + (unless (and (memq last-command '(org-shiftmetaright org-shiftmetaleft)) + (memq this-command '(org-shiftmetaright org-shiftmetaleft))) + (if regionp + (progn + (set-marker org-last-indent-begin-marker rbeg) + (set-marker org-last-indent-end-marker rend)) + (set-marker org-last-indent-begin-marker (point-at-bol)) + (set-marker org-last-indent-end-marker + (cond + (specialp (org-list-get-bottom-point struct)) + (no-subtree (1+ (point-at-bol))) + (t (org-list-get-item-end (point-at-bol) struct)))))) + (let* ((beg (marker-position org-last-indent-begin-marker)) + (end (marker-position org-last-indent-end-marker))) + (cond + ;; Special case: moving top-item with indent rule. + (specialp + (let* ((level-skip (org-level-increment)) + (offset (if (< arg 0) (- level-skip) level-skip)) + (top-ind (org-list-get-ind beg struct)) + (old-struct (copy-tree struct))) + (if (< (+ top-ind offset) 0) + (error "Cannot outdent beyond margin") + ;; Change bullet if necessary. + (when (and (= (+ top-ind offset) 0) + (string-match "\\*" + (org-list-get-bullet beg struct))) + (org-list-set-bullet beg struct + (org-list-bullet-string "-"))) + ;; Shift every item by OFFSET and fix bullets. Then + ;; apply changes to buffer. + (pcase-dolist (`(,pos . ,_) struct) + (let ((ind (org-list-get-ind pos struct))) + (org-list-set-ind pos struct (+ ind offset)))) + (org-list-struct-fix-bul struct prevs) + (org-list-struct-apply-struct struct old-struct)))) + ;; Forbidden move: + ((and (< arg 0) + ;; If only one item is moved, it mustn't have a child. + (or (and no-subtree + (not regionp) + (org-list-has-child-p beg struct)) + ;; If a subtree or region is moved, the last item + ;; of the subtree mustn't have a child. + (let ((last-item (caar + (reverse + (cl-remove-if + (lambda (e) (>= (car e) end)) + struct))))) + (org-list-has-child-p last-item struct)))) + (error "Cannot outdent an item without its children")) + ;; Normal shifting + (t + (let* ((old-struct (copy-tree struct)) + (new-parents + (if (< arg 0) + (org-list-struct-outdent beg end struct parents) + (org-list-struct-indent beg end struct parents prevs)))) + (org-list-write-struct struct new-parents old-struct)) + (org-update-checkbox-count-maybe)))))) + t) + +(defun org-outdent-item () + "Outdent a local list item, but not its children. +If a region is active, all items inside will be moved." + (interactive) + (let ((regionp (org-region-active-p))) + (cond + ((or (org-at-item-p) + (and regionp + (save-excursion (goto-char (region-beginning)) + (org-at-item-p)))) + (let ((struct (if (not regionp) (org-list-struct) + (save-excursion (goto-char (region-beginning)) + (org-list-struct))))) + (org-list-indent-item-generic -1 t struct))) + (regionp (error "Region not starting at an item")) + (t (error "Not at an item"))))) + +(defun org-indent-item () + "Indent a local list item, but not its children. +If a region is active, all items inside will be moved." + (interactive) + (let ((regionp (org-region-active-p))) + (cond + ((or (org-at-item-p) + (and regionp + (save-excursion (goto-char (region-beginning)) + (org-at-item-p)))) + (let ((struct (if (not regionp) (org-list-struct) + (save-excursion (goto-char (region-beginning)) + (org-list-struct))))) + (org-list-indent-item-generic 1 t struct))) + (regionp (error "Region not starting at an item")) + (t (error "Not at an item"))))) + +(defun org-outdent-item-tree () + "Outdent a local list item including its children. +If a region is active, all items inside will be moved." + (interactive) + (let ((regionp (org-region-active-p))) + (cond + ((or (org-at-item-p) + (and regionp + (save-excursion (goto-char (region-beginning)) + (org-at-item-p)))) + (let ((struct (if (not regionp) (org-list-struct) + (save-excursion (goto-char (region-beginning)) + (org-list-struct))))) + (org-list-indent-item-generic -1 nil struct))) + (regionp (error "Region not starting at an item")) + (t (error "Not at an item"))))) + +(defun org-indent-item-tree () + "Indent a local list item including its children. +If a region is active, all items inside will be moved." + (interactive) + (let ((regionp (org-region-active-p))) + (cond + ((or (org-at-item-p) + (and regionp + (save-excursion (goto-char (region-beginning)) + (org-at-item-p)))) + (let ((struct (if (not regionp) (org-list-struct) + (save-excursion (goto-char (region-beginning)) + (org-list-struct))))) + (org-list-indent-item-generic 1 nil struct))) + (regionp (error "Region not starting at an item")) + (t (error "Not at an item"))))) + +(defvar org-tab-ind-state) +(defun org-cycle-item-indentation () + "Cycle levels of indentation of an empty item. + +The first run indents the item, if applicable. Subsequent runs +outdent it at meaningful levels in the list. When done, item is +put back at its original position with its original bullet. + +Return t at each successful move." + (when (org-at-item-p) + (let* ((struct (org-list-struct)) + (item (line-beginning-position)) + (ind (org-list-get-ind item struct))) + ;; Accept empty items or if cycle has already started. + (when (or (eq last-command 'org-cycle-item-indentation) + (and (org-match-line org-list-full-item-re) + (>= (match-end 0) + (save-excursion + (goto-char (org-list-get-item-end item struct)) + (skip-chars-backward " \t\n") + (point))))) + (setq this-command 'org-cycle-item-indentation) + (let ((prevs (org-list-prevs-alist struct)) + (parents (org-list-parents-alist struct))) + (if (eq last-command 'org-cycle-item-indentation) + ;; When in the middle of the cycle, try to outdent. If + ;; it fails, move point back to its initial position and + ;; reset cycle. + (pcase-let ((`(,old-ind . ,old-bul) org-tab-ind-state) + (allow-outdent + (lambda (struct prevs parents) + ;; Non-nil if current item can be + ;; outdented. + (and (not (org-list-get-next-item item nil prevs)) + (not (org-list-has-child-p item struct)) + (org-list-get-parent item struct parents))))) + (cond + ((and (> ind old-ind) + (org-list-get-prev-item item nil prevs)) + (org-list-indent-item-generic 1 t struct)) + ((and (< ind old-ind) + (funcall allow-outdent struct prevs parents)) + (org-list-indent-item-generic -1 t struct)) + (t + (delete-region (line-beginning-position) (line-end-position)) + (indent-to-column old-ind) + (insert old-bul " ") + (let* ((struct (org-list-struct)) + (parents (org-list-parents-alist struct))) + (if (and (> ind old-ind) + ;; We were previously indenting item. It + ;; is no longer possible. Try to outdent + ;; from initial position. + (funcall allow-outdent + struct + (org-list-prevs-alist struct) + parents)) + (org-list-indent-item-generic -1 t struct) + (org-list-write-struct struct parents) + ;; Start cycle over. + (setq this-command 'identity) + t))))) + ;; If a cycle is starting, remember initial indentation + ;; and bullet, then try to indent. If it fails, try to + ;; outdent. + (setq org-tab-ind-state + (cons ind (org-trim (org-current-line-string)))) + (cond + ((org-list-get-prev-item item nil prevs) + (org-list-indent-item-generic 1 t struct)) + ((and (not (org-list-get-next-item item nil prevs)) + (org-list-get-parent item struct parents)) + (org-list-indent-item-generic -1 t struct)) + (t + ;; This command failed. So will the following one. + ;; There's no point in starting the cycle. + (setq this-command 'identity) + (user-error "Cannot move item"))))))))) + +(defun org-sort-list + (&optional with-case sorting-type getkey-func compare-func interactive?) + "Sort list items. +The cursor may be at any item of the list that should be sorted. +Sublists are not sorted. Checkboxes, if any, are ignored. + +Sorting can be alphabetically, numerically, by date/time as given +by a time stamp, by a property or by priority. + +Comparing entries ignores case by default. However, with an +optional argument WITH-CASE, the sorting considers case as well, +if the current locale allows for it. + +The command prompts for the sorting type unless it has been given +to the function through the SORTING-TYPE argument, which needs to +be a character, among ?n ?N ?a ?A ?t ?T ?f ?F ?x or ?X. Here is +the detailed meaning of each character: + +n Numerically, by converting the beginning of the item to a number. +a Alphabetically. Only the first line of item is checked. +t By date/time, either the first active time stamp in the entry, if + any, or by the first inactive one. In a timer list, sort the timers. +x By \"checked\" status of a check list. + +Capital letters will reverse the sort order. + +If the SORTING-TYPE is ?f or ?F, then GETKEY-FUNC specifies +a function to be called with point at the beginning of the +record. It must return a value that is compatible with COMPARE-FUNC, +the function used to compare entries. + +Sorting is done against the visible part of the headlines, it +ignores hidden links. + +A non-nil value for INTERACTIVE? is used to signal that this +function is being called interactively." + (interactive (list current-prefix-arg nil nil nil t)) + (let* ((case-func (if with-case 'identity 'downcase)) + (struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (start (org-list-get-list-begin (point-at-bol) struct prevs)) + (end (org-list-get-list-end (point-at-bol) struct prevs)) + (sorting-type + (or sorting-type + (progn + (message + "Sort plain list: [a]lpha [n]umeric [t]ime [f]unc [x]checked A/N/T/F/X means reversed:") + (read-char-exclusive)))) + (dcst (downcase sorting-type)) + (getkey-func + (and (= dcst ?f) + (or getkey-func + (and interactive? + (org-read-function "Function for extracting keys: ")) + (error "Missing key extractor")))) + (sort-func + (cond + ((= dcst ?a) #'org-string-collate-lessp) + ((= dcst ?f) + (or compare-func + (and interactive? + (org-read-function + (concat "Function for comparing keys " + "(empty for default `sort-subr' predicate): ") + 'allow-empty)))) + ((= dcst ?t) #'<) + ((= dcst ?x) #'string<)))) + (message "Sorting items...") + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (let* ((case-fold-search nil) + (now (current-time)) + (next-record (lambda () + (skip-chars-forward " \r\t\n") + (or (eobp) (beginning-of-line)))) + (end-record (lambda () + (goto-char (org-list-get-item-end-before-blank + (point) struct)))) + (value-to-sort + (lambda () + (when (looking-at "[ \t]*[-+*0-9.)]+\\([ \t]+\\[[- X]\\]\\)?[ \t]+") + (cond + ((= dcst ?n) + (string-to-number + (org-sort-remove-invisible + (buffer-substring (match-end 0) (point-at-eol))))) + ((= dcst ?a) + (funcall case-func + (org-sort-remove-invisible + (buffer-substring + (match-end 0) (point-at-eol))))) + ((= dcst ?t) + (cond + ;; If it is a timer list, convert timer to seconds + ((org-at-item-timer-p) + (org-timer-hms-to-secs (match-string 1))) + ((or (save-excursion + (re-search-forward org-ts-regexp (point-at-eol) t)) + (save-excursion (re-search-forward org-ts-regexp-both + (point-at-eol) t))) + (org-time-string-to-seconds (match-string 0))) + (t (float-time now)))) + ((= dcst ?x) (or (and (stringp (match-string 1)) + (match-string 1)) + "")) + ((= dcst ?f) + (if getkey-func + (let ((value (funcall getkey-func))) + (if (stringp value) + (funcall case-func value) + value)) + (error "Invalid key function `%s'" getkey-func))) + (t (error "Invalid sorting type `%c'" sorting-type))))))) + (sort-subr (/= dcst sorting-type) + next-record + end-record + value-to-sort + nil + sort-func) + ;; Read and fix list again, as `sort-subr' probably destroyed + ;; its structure. + (org-list-repair) + (run-hooks 'org-after-sorting-entries-or-items-hook) + (message "Sorting items...done"))))) + +(defun org-toggle-item (arg) + "Convert headings or normal lines to items, items to normal lines. +If there is no active region, only the current line is considered. + +If the first non blank line in the region is a headline, convert +all headlines to items, shifting text accordingly. + +If it is an item, convert all items to normal lines. + +If it is normal text, change region into a list of items. +With a prefix argument ARG, change the region in a single item." + (interactive "P") + (let ((shift-text + (lambda (ind end) + ;; Shift text in current section to IND, from point to END. + ;; The function leaves point to END line. + (let ((min-i 1000) (end (copy-marker end))) + ;; First determine the minimum indentation (MIN-I) of + ;; the text. + (save-excursion + (catch 'exit + (while (< (point) end) + (let ((i (current-indentation))) + (cond + ;; Skip blank lines and inline tasks. + ((looking-at "^[ \t]*$")) + ((looking-at org-outline-regexp-bol)) + ;; We can't find less than 0 indentation. + ((zerop i) (throw 'exit (setq min-i 0))) + ((< i min-i) (setq min-i i)))) + (forward-line)))) + ;; Then indent each line so that a line indented to + ;; MIN-I becomes indented to IND. Ignore blank lines + ;; and inline tasks in the process. + (let ((delta (- ind min-i))) + (while (< (point) end) + (unless (or (looking-at "^[ \t]*$") + (looking-at org-outline-regexp-bol)) + (indent-line-to (+ (current-indentation) delta))) + (forward-line)))))) + (skip-blanks + (lambda (pos) + ;; Return beginning of first non-blank line, starting from + ;; line at POS. + (save-excursion + (goto-char pos) + (skip-chars-forward " \r\t\n") + (point-at-bol)))) + beg end) + ;; Determine boundaries of changes. + (if (org-region-active-p) + (setq beg (funcall skip-blanks (region-beginning)) + end (copy-marker (region-end))) + (setq beg (point-at-bol) + end (copy-marker (point-at-eol)))) + ;; Depending on the starting line, choose an action on the text + ;; between BEG and END. + (org-with-limited-levels + (save-excursion + (goto-char beg) + (cond + ;; Case 1. Start at an item: de-itemize. Note that it only + ;; happens when a region is active: `org-ctrl-c-minus' + ;; would call `org-cycle-list-bullet' otherwise. + ((org-at-item-p) + (while (< (point) end) + (when (org-at-item-p) + (skip-chars-forward " \t") + (delete-region (point) (match-end 0))) + (forward-line))) + ;; Case 2. Start at an heading: convert to items. + ((org-at-heading-p) + ;; Remove metadata + (let (org-loop-over-headlines-in-active-region) + (org-list--delete-metadata)) + (let* ((bul (org-list-bullet-string "-")) + (bul-len (length bul)) + ;; Indentation of the first heading. It should be + ;; relative to the indentation of its parent, if any. + (start-ind (save-excursion + (cond + ((not org-adapt-indentation) 0) + ((not (outline-previous-heading)) 0) + (t (length (match-string 0)))))) + ;; Level of first heading. Further headings will be + ;; compared to it to determine hierarchy in the list. + (ref-level (org-reduced-level (org-outline-level)))) + (while (< (point) end) + (let* ((level (org-reduced-level (org-outline-level))) + (delta (max 0 (- level ref-level))) + (todo-state (org-get-todo-state))) + ;; If current headline is less indented than the first + ;; one, set it as reference, in order to preserve + ;; subtrees. + (when (< level ref-level) (setq ref-level level)) + ;; Remove metadata + (let (org-loop-over-headlines-in-active-region) + (org-list--delete-metadata)) + ;; Remove stars and TODO keyword. + (let ((case-fold-search nil)) (looking-at org-todo-line-regexp)) + (delete-region (point) (or (match-beginning 3) + (line-end-position))) + (insert bul) + (indent-line-to (+ start-ind (* delta bul-len))) + ;; Turn TODO keyword into a check box. + (when todo-state + (let* ((struct (org-list-struct)) + (old (copy-tree struct))) + (org-list-set-checkbox + (line-beginning-position) + struct + (if (member todo-state org-done-keywords) + "[X]" + "[ ]")) + (org-list-write-struct struct + (org-list-parents-alist struct) + old))) + ;; Ensure all text down to END (or SECTION-END) belongs + ;; to the newly created item. + (let ((section-end (save-excursion + (or (outline-next-heading) (point))))) + (forward-line) + (funcall shift-text + (+ start-ind (* (1+ delta) bul-len)) + (min end section-end))))))) + ;; Case 3. Normal line with ARG: make the first line of region + ;; an item, and shift indentation of others lines to + ;; set them as item's body. + (arg (let* ((bul (org-list-bullet-string "-")) + (bul-len (length bul)) + (ref-ind (current-indentation))) + (skip-chars-forward " \t") + (insert bul) + (forward-line) + (while (< (point) end) + ;; Ensure that lines less indented than first one + ;; still get included in item body. + (funcall shift-text + (+ ref-ind bul-len) + (min end (save-excursion (or (outline-next-heading) + (point))))) + (forward-line)))) + ;; Case 4. Normal line without ARG: turn each non-item line + ;; into an item. + (t + (while (< (point) end) + (unless (or (org-at-heading-p) (org-at-item-p)) + (when (looking-at "\\([ \t]*\\)\\(\\S-\\)") + (replace-match + (concat "\\1" (org-list-bullet-string "-") "\\2")))) + (forward-line)))))))) + + +;;; Send and receive lists + +(defun org-list-to-lisp (&optional delete) + "Parse the list at point and maybe DELETE it. + +Return a list whose car is a symbol of list type, among +`ordered', `unordered' and `descriptive'. Then, each item is +a list of strings and other sub-lists. + +For example, the following list: + + 1. first item + + sub-item one + + [X] sub-item two + more text in first item + 2. [@3] last item + +is parsed as + + (ordered + (\"first item\" + (unordered + (\"sub-item one\") + (\"[X] sub-item two\")) + \"more text in first item\") + (\"[@3] last item\")) + +Point is left at list's end." + (letrec ((struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (parents (org-list-parents-alist struct)) + (top (org-list-get-top-point struct)) + (bottom (org-list-get-bottom-point struct)) + (trim + (lambda (text) + ;; Remove indentation and final newline from TEXT. + (org-remove-indentation + (if (string-match-p "\n\\'" text) + (substring text 0 -1) + text)))) + (parse-sublist + (lambda (e) + ;; Return a list whose car is list type and cdr a list + ;; of items' body. + (cons (org-list-get-list-type (car e) struct prevs) + (mapcar parse-item e)))) + (parse-item + (lambda (e) + ;; Return a list containing counter of item, if any, + ;; text and any sublist inside it. + (let* ((end (org-list-get-item-end e struct)) + (children (org-list-get-children e struct parents)) + (body + (save-excursion + (goto-char e) + (looking-at "[ \t]*\\S-+[ \t]*") + (list + (funcall + trim + (concat + (make-string (string-width (match-string 0)) ?\s) + (buffer-substring-no-properties + (match-end 0) (or (car children) end)))))))) + (while children + (let* ((child (car children)) + (sub (org-list-get-all-items child struct prevs)) + (last-in-sub (car (last sub)))) + (push (funcall parse-sublist sub) body) + ;; Remove whole sub-list from children. + (setq children (cdr (memq last-in-sub children))) + ;; There is a chunk of text belonging to the item + ;; if last child doesn't end where next child + ;; starts or where item ends. + (let ((sub-end (org-list-get-item-end last-in-sub struct)) + (next (or (car children) end))) + (when (/= sub-end next) + (push (funcall + trim + (buffer-substring-no-properties sub-end next)) + body))))) + (nreverse body))))) + ;; Store output, take care of cursor position and deletion of + ;; list, then return output. + (prog1 (funcall parse-sublist (org-list-get-all-items top struct prevs)) + (goto-char top) + (when delete + (delete-region top bottom) + (when (and (not (looking-at "[ \t]*$")) (looking-at org-list-end-re)) + (replace-match "")))))) + +(defun org-list-make-subtree () + "Convert the plain list at point into a subtree." + (interactive) + (let ((item (org-in-item-p))) + (unless item (error "Not in a list")) + (goto-char item) + (let ((level (pcase (org-current-level) + (`nil 1) + (l (1+ (org-reduced-level l))))) + (list (save-excursion (org-list-to-lisp t)))) + (insert (org-list-to-subtree list level) "\n")))) + +(defun org-list-to-generic (list params) + "Convert a LIST parsed through `org-list-to-lisp' to a custom format. + +LIST is a list as returned by `org-list-to-lisp', which see. +PARAMS is a property list of parameters used to tweak the output +format. + +Valid parameters are: + +:backend, :raw + + Export back-end used as a basis to transcode elements of the + list, when no specific parameter applies to it. It is also + used to translate its contents. You can prevent this by + setting :raw property to a non-nil value. + +:splice + + When non-nil, only export the contents of the top most plain + list, effectively ignoring its opening and closing lines. + +:ustart, :uend + + Strings to start and end an unordered list. They can also be + set to a function returning a string or nil, which will be + called with the depth of the list, counting from 1. + +:ostart, :oend + + Strings to start and end an ordered list. They can also be set + to a function returning a string or nil, which will be called + with the depth of the list, counting from 1. + +:dstart, :dend + + Strings to start and end a descriptive list. They can also be + set to a function returning a string or nil, which will be + called with the depth of the list, counting from 1. + +:dtstart, :dtend, :ddstart, :ddend + + Strings to start and end a descriptive term. + +:istart, :iend + + Strings to start or end a list item, and to start a list item + with a counter. They can also be set to a function returning + a string or nil, which will be called with two arguments: the + type of list and the depth of the item, counting from 1. + +:icount + + Strings to start a list item with a counter. It can also be + set to a function returning a string or nil, which will be + called with three arguments: the type of list, the depth of the + item, counting from 1, and the counter. Its value, when + non-nil, has precedence over `:istart'. + +:isep + + String used to separate items. It can also be set to + a function returning a string or nil, which will be called with + two arguments: the type of list and the depth of the item, + counting from 1. It always start on a new line. + +:ifmt + + Function to be applied to the contents of every item. It is + called with two arguments: the type of list and the contents. + +:cbon, :cboff, :cbtrans + + String to insert, respectively, an un-checked check-box, + a checked check-box and a check-box in transitional state." + (require 'ox) + (let* ((backend (plist-get params :backend)) + (custom-backend + (org-export-create-backend + :parent (or backend 'org) + :transcoders + `((plain-list . ,(org-list--to-generic-plain-list params)) + (item . ,(org-list--to-generic-item params)) + (macro . (lambda (m c i) (org-element-macro-interpreter m nil)))))) + data info) + ;; Write LIST back into Org syntax and parse it. + (with-temp-buffer + (let ((org-inhibit-startup t)) (org-mode)) + (letrec ((insert-list + (lambda (l) + (dolist (i (cdr l)) + (funcall insert-item i (car l))))) + (insert-item + (lambda (i type) + (let ((start (point))) + (insert (if (eq type 'ordered) "1. " "- ")) + (dolist (e i) + (if (consp e) (funcall insert-list e) + (insert e) + (insert "\n"))) + (beginning-of-line) + (save-excursion + (let ((ind (if (eq type 'ordered) 3 2))) + (while (> (point) start) + (unless (looking-at-p "[ \t]*$") + (indent-to ind)) + (forward-line -1)))))))) + (funcall insert-list list)) + (setf data + (org-element-map (org-element-parse-buffer) 'plain-list + #'identity nil t)) + (setf info (org-export-get-environment backend nil params))) + (when (and backend (symbolp backend) (not (org-export-get-backend backend))) + (user-error "Unknown :backend value")) + (unless backend (require 'ox-org)) + ;; When ':raw' property has a non-nil value, turn all objects back + ;; into Org syntax. + (when (and backend (plist-get params :raw)) + (org-element-map data org-element-all-objects + (lambda (object) + (org-element-set-element + object (org-element-interpret-data object))))) + ;; We use a low-level mechanism to export DATA so as to skip all + ;; usual pre-processing and post-processing, i.e., hooks, filters, + ;; Babel code evaluation, include keywords and macro expansion, + ;; and filters. + (let ((output (org-export-data-with-backend data custom-backend info))) + ;; Remove final newline. + (if (org-string-nw-p output) (substring-no-properties output 0 -1) "")))) + +(defun org-list--depth (element) + "Return the level of ELEMENT within current plain list. +ELEMENT is either an item or a plain list." + (cl-count-if (lambda (ancestor) (eq (org-element-type ancestor) 'plain-list)) + (org-element-lineage element nil t))) + +(defun org-list--trailing-newlines (string) + "Return the number of trailing newlines in STRING." + (with-temp-buffer + (insert string) + (skip-chars-backward " \t\n") + (count-lines (line-beginning-position 2) (point-max)))) + +(defun org-list--generic-eval (value &rest args) + "Evaluate VALUE according to its type. +VALUE is either nil, a string or a function. In the latter case, +it is called with arguments ARGS." + (cond ((null value) nil) + ((stringp value) value) + ((functionp value) (apply value args)) + (t (error "Wrong value: %s" value)))) + +(defun org-list--to-generic-plain-list (params) + "Return a transcoder for `plain-list' elements. +PARAMS is a plist used to tweak the behavior of the transcoder." + (let ((ustart (plist-get params :ustart)) + (uend (plist-get params :uend)) + (ostart (plist-get params :ostart)) + (oend (plist-get params :oend)) + (dstart (plist-get params :dstart)) + (dend (plist-get params :dend)) + (splice (plist-get params :splice)) + (backend (plist-get params :backend))) + (lambda (plain-list contents info) + (let* ((type (org-element-property :type plain-list)) + (depth (org-list--depth plain-list)) + (start (and (not splice) + (org-list--generic-eval + (pcase type + (`ordered ostart) + (`unordered ustart) + (_ dstart)) + depth))) + (end (and (not splice) + (org-list--generic-eval + (pcase type + (`ordered oend) + (`unordered uend) + (_ dend)) + depth)))) + ;; Make sure trailing newlines in END appear in the output by + ;; setting `:post-blank' property to their number. + (when end + (org-element-put-property + plain-list :post-blank (org-list--trailing-newlines end))) + ;; Build output. + (concat (and start (concat start "\n")) + (if (or start end splice (not backend)) + contents + (org-export-with-backend backend plain-list contents info)) + end))))) + +(defun org-list--to-generic-item (params) + "Return a transcoder for `item' elements. +PARAMS is a plist used to tweak the behavior of the transcoder." + (let ((backend (plist-get params :backend)) + (istart (plist-get params :istart)) + (iend (plist-get params :iend)) + (isep (plist-get params :isep)) + (icount (plist-get params :icount)) + (ifmt (plist-get params :ifmt)) + (cboff (plist-get params :cboff)) + (cbon (plist-get params :cbon)) + (cbtrans (plist-get params :cbtrans)) + (dtstart (plist-get params :dtstart)) + (dtend (plist-get params :dtend)) + (ddstart (plist-get params :ddstart)) + (ddend (plist-get params :ddend))) + (lambda (item contents info) + (let* ((type + (org-element-property :type (org-element-property :parent item))) + (tag (org-element-property :tag item)) + (depth (org-list--depth item)) + (separator (and (org-export-get-next-element item info) + (org-list--generic-eval isep type depth))) + (closing (pcase (org-list--generic-eval iend type depth) + ((or `nil "") "\n") + ((and (guard separator) s) + (if (equal (substring s -1) "\n") s (concat s "\n"))) + (s s)))) + ;; When a closing line or a separator is provided, make sure + ;; its trailing newlines are taken into account when building + ;; output. This is done by setting `:post-blank' property to + ;; the number of such lines in the last line to be added. + (let ((last-string (or separator closing))) + (when last-string + (org-element-put-property + item + :post-blank + (max (1- (org-list--trailing-newlines last-string)) 0)))) + ;; Build output. + (concat + (let ((c (org-element-property :counter item))) + (if (and c icount) (org-list--generic-eval icount type depth c) + (org-list--generic-eval istart type depth))) + (let ((body + (if (or istart iend icount ifmt cbon cboff cbtrans (not backend) + (and (eq type 'descriptive) + (or dtstart dtend ddstart ddend))) + (concat + (pcase (org-element-property :checkbox item) + (`on cbon) + (`off cboff) + (`trans cbtrans)) + (and tag + (concat dtstart + (if backend + (org-export-data-with-backend + tag backend info) + (org-element-interpret-data tag)) + dtend)) + (and tag ddstart) + (let ((contents + (if (= (length contents) 0) "" + (substring contents 0 -1)))) + (if ifmt (org-list--generic-eval ifmt type contents) + contents)) + (and tag ddend)) + (org-export-with-backend backend item contents info)))) + ;; Remove final newline. + (if (equal body "") "" + (substring (org-element-normalize-string body) 0 -1))) + closing + separator))))) + +(defun org-list-to-latex (list &optional params) + "Convert LIST into a LaTeX list. +LIST is a parsed plain list, as returned by `org-list-to-lisp'. +PARAMS is a property list with overruling parameters for +`org-list-to-generic'. Return converted list as a string." + (require 'ox-latex) + (org-list-to-generic list (org-combine-plists '(:backend latex) params))) + +(defun org-list-to-html (list &optional params) + "Convert LIST into a HTML list. +LIST is a parsed plain list, as returned by `org-list-to-lisp'. +PARAMS is a property list with overruling parameters for +`org-list-to-generic'. Return converted list as a string." + (require 'ox-html) + (org-list-to-generic list (org-combine-plists '(:backend html) params))) + +(defun org-list-to-texinfo (list &optional params) + "Convert LIST into a Texinfo list. +LIST is a parsed plain list, as returned by `org-list-to-lisp'. +PARAMS is a property list with overruling parameters for +`org-list-to-generic'. Return converted list as a string." + (require 'ox-texinfo) + (org-list-to-generic list (org-combine-plists '(:backend texinfo) params))) + +(defun org-list-to-org (list &optional params) + "Convert LIST into an Org plain list. +LIST is as returned by `org-list-parse-list'. PARAMS is a property list +with overruling parameters for `org-list-to-generic'." + (let* ((make-item + (lambda (type _depth &optional c) + (concat (if (eq type 'ordered) "1. " "- ") + (and c (format "[@%d] " c))))) + (defaults + (list :istart make-item + :icount make-item + :ifmt (lambda (_type contents) + (replace-regexp-in-string "\n" "\n " contents)) + :dtend " :: " + :cbon "[X] " + :cboff "[ ] " + :cbtrans "[-] "))) + (org-list-to-generic list (org-combine-plists defaults params)))) + +(defun org-list-to-subtree (list &optional start-level params) + "Convert LIST into an Org subtree. +LIST is as returned by `org-list-to-lisp'. Subtree starts at +START-LEVEL or level 1 if nil. PARAMS is a property list with +overruling parameters for `org-list-to-generic'." + (let* ((blank (pcase (cdr (assq 'heading org-blank-before-new-entry)) + (`t t) + (`auto (save-excursion + (org-with-limited-levels (outline-previous-heading)) + (org-previous-line-empty-p))))) + (level (or start-level 1)) + (make-stars + (lambda (_type depth &optional _count) + ;; Return the string for the heading, depending on DEPTH + ;; of current sub-list. + (let ((oddeven-level (+ level (1- depth)))) + (concat (make-string (if org-odd-levels-only + (1- (* 2 oddeven-level)) + oddeven-level) + ?*) + " "))))) + (org-list-to-generic + list + (org-combine-plists + (list :splice t + :istart make-stars + :icount make-stars + :dtstart " " :dtend " " + :isep (if blank "\n\n" "\n") + :cbon "DONE " :cboff "TODO " :cbtrans "TODO ") + params)))) + +(provide 'org-list) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-list.el ends here diff --git a/elpa/org-9.5.2/org-list.elc b/elpa/org-9.5.2/org-list.elc new file mode 100644 index 0000000..72da99f Binary files /dev/null and b/elpa/org-9.5.2/org-list.elc differ diff --git a/elpa/org-9.5.2/org-loaddefs.el b/elpa/org-9.5.2/org-loaddefs.el new file mode 100644 index 0000000..169f897 --- /dev/null +++ b/elpa/org-9.5.2/org-loaddefs.el @@ -0,0 +1,4612 @@ +;;; org-loaddefs.el --- autogenerated file, do not edit +;; +;;; Code: + +;;;### (autoloads nil "ob-C" "ob-C.el" (0 0 0 0)) +;;; Generated autoloads from ob-C.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-C" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-R" "ob-R.el" (0 0 0 0)) +;;; Generated autoloads from ob-R.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-R" '("ob-" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-awk" "ob-awk.el" (0 0 0 0)) +;;; Generated autoloads from ob-awk.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-awk" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-calc" "ob-calc.el" (0 0 0 0)) +;;; Generated autoloads from ob-calc.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-calc" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-clojure" "ob-clojure.el" (0 0 0 0)) +;;; Generated autoloads from ob-clojure.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-clojure" '("ob-clojure-" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-comint" "ob-comint.el" (0 0 0 0)) +;;; Generated autoloads from ob-comint.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-comint" '("org-babel-comint-"))) + +;;;*** + +;;;### (autoloads nil "ob-core" "ob-core.el" "6ed35c309cede94731f23c7d075ec53d") +;;; Generated autoloads from ob-core.el + +(autoload 'org-babel-execute-safely-maybe "ob-core" nil nil nil) + +(autoload 'org-babel-execute-maybe "ob-core" nil t nil) + +(autoload 'org-babel-view-src-block-info "ob-core" "\ +Display information on the current source block. +This includes header arguments, language and name, and is largely +a window into the `org-babel-get-src-block-info' function." t nil) + +(autoload 'org-babel-expand-src-block-maybe "ob-core" "\ +Conditionally expand a source block. +Detect if this is context for an org-babel src-block and if so +then run `org-babel-expand-src-block'." t nil) + +(autoload 'org-babel-load-in-session-maybe "ob-core" "\ +Conditionally load a source block in a session. +Detect if this is context for an org-babel src-block and if so +then run `org-babel-load-in-session'." t nil) + +(autoload 'org-babel-pop-to-session-maybe "ob-core" "\ +Conditionally pop to a session. +Detect if this is context for an org-babel src-block and if so +then run `org-babel-switch-to-session'." t nil) + +(autoload 'org-babel-execute-src-block "ob-core" "\ +Execute the current source code block. +Insert the results of execution into the buffer. Source code +execution and the collection and formatting of results can be +controlled through a variety of header arguments. + +With prefix argument ARG, force re-execution even if an existing +result cached in the buffer would otherwise have been returned. + +Optionally supply a value for INFO in the form returned by +`org-babel-get-src-block-info'. + +Optionally supply a value for PARAMS which will be merged with +the header arguments specified at the front of the source code +block. + +\(fn &optional ARG INFO PARAMS)" t nil) + +(autoload 'org-babel-expand-src-block "ob-core" "\ +Expand the current source code block. +Expand according to the source code block's header +arguments and pop open the results in a preview buffer. + +\(fn &optional ARG INFO PARAMS)" t nil) + +(autoload 'org-babel-check-src-block "ob-core" "\ +Check for misspelled header arguments in the current code block." t nil) + +(autoload 'org-babel-insert-header-arg "ob-core" "\ +Insert a header argument selecting from lists of common args and values. + +\(fn &optional HEADER-ARG VALUE)" t nil) + +(autoload 'org-babel-load-in-session "ob-core" "\ +Load the body of the current source-code block. +Evaluate the header arguments for the source block before +entering the session. After loading the body this pops open the +session. + +\(fn &optional ARG INFO)" t nil) + +(autoload 'org-babel-initiate-session "ob-core" "\ +Initiate session for current code block. +If called with a prefix argument then resolve any variable +references in the header arguments and assign these variables in +the session. Copy the body of the code block to the kill ring. + +\(fn &optional ARG INFO)" t nil) + +(autoload 'org-babel-switch-to-session "ob-core" "\ +Switch to the session of the current code block. +Uses `org-babel-initiate-session' to start the session. If called +with a prefix argument then this is passed on to +`org-babel-initiate-session'. + +\(fn &optional ARG INFO)" t nil) + +(autoload 'org-babel-switch-to-session-with-code "ob-core" "\ +Switch to code buffer and display session. + +\(fn &optional ARG INFO)" t nil) + +(autoload 'org-babel-do-in-edit-buffer "ob-core" "\ +Evaluate BODY in edit buffer if there is a code block at point. +Return t if a code block was found at point, nil otherwise. + +\(fn &rest BODY)" nil t) + +(autoload 'org-babel-open-src-block-result "ob-core" "\ +Open results of source block at point. + +If `point' is on a source block then open the results of the source +code block, otherwise return nil. With optional prefix argument +RE-RUN the source-code block is evaluated even if results already +exist. + +\(fn &optional RE-RUN)" t nil) + +(autoload 'org-babel-map-src-blocks "ob-core" "\ +Evaluate BODY forms on each source-block in FILE. +If FILE is nil evaluate BODY forms on source blocks in current +buffer. During evaluation of BODY the following local variables +are set relative to the currently matched code block. + +full-block ------- string holding the entirety of the code block +beg-block -------- point at the beginning of the code block +end-block -------- point at the end of the matched code block +lang ------------- string holding the language of the code block +beg-lang --------- point at the beginning of the lang +end-lang --------- point at the end of the lang +switches --------- string holding the switches +beg-switches ----- point at the beginning of the switches +end-switches ----- point at the end of the switches +header-args ------ string holding the header-args +beg-header-args -- point at the beginning of the header-args +end-header-args -- point at the end of the header-args +body ------------- string holding the body of the code block +beg-body --------- point at the beginning of the body +end-body --------- point at the end of the body + +\(fn FILE &rest BODY)" nil t) + +(function-put 'org-babel-map-src-blocks 'lisp-indent-function '1) + +(autoload 'org-babel-map-inline-src-blocks "ob-core" "\ +Evaluate BODY forms on each inline source block in FILE. +If FILE is nil evaluate BODY forms on source blocks in current +buffer. + +\(fn FILE &rest BODY)" nil t) + +(function-put 'org-babel-map-inline-src-blocks 'lisp-indent-function '1) + +(autoload 'org-babel-map-call-lines "ob-core" "\ +Evaluate BODY forms on each call line in FILE. +If FILE is nil evaluate BODY forms on source blocks in current +buffer. + +\(fn FILE &rest BODY)" nil t) + +(function-put 'org-babel-map-call-lines 'lisp-indent-function '1) + +(autoload 'org-babel-map-executables "ob-core" "\ +Evaluate BODY forms on each active Babel code in FILE. +If FILE is nil evaluate BODY forms on source blocks in current +buffer. + +\(fn FILE &rest BODY)" nil t) + +(function-put 'org-babel-map-executables 'lisp-indent-function '1) + +(autoload 'org-babel-execute-buffer "ob-core" "\ +Execute source code blocks in a buffer. +Call `org-babel-execute-src-block' on every source block in +the current buffer. + +\(fn &optional ARG)" t nil) + +(autoload 'org-babel-execute-subtree "ob-core" "\ +Execute source code blocks in a subtree. +Call `org-babel-execute-src-block' on every source block in +the current subtree. + +\(fn &optional ARG)" t nil) + +(autoload 'org-babel-sha1-hash "ob-core" "\ +Generate a sha1 hash based on the value of INFO. +CONTEXT specifies the context of evaluation. It can be `:eval', +`:export', `:tangle'. A nil value means `:eval'. + +\(fn &optional INFO CONTEXT)" t nil) + +(autoload 'org-babel-hide-result-toggle-maybe "ob-core" "\ +Toggle visibility of result at point." t nil) + +(autoload 'org-babel-goto-src-block-head "ob-core" "\ +Go to the beginning of the current code block." t nil) + +(autoload 'org-babel-goto-named-src-block "ob-core" "\ +Go to a named source-code block. + +\(fn NAME)" t nil) + +(autoload 'org-babel-goto-named-result "ob-core" "\ +Go to a named result. + +\(fn NAME)" t nil) + +(autoload 'org-babel-next-src-block "ob-core" "\ +Jump to the next source block. +With optional prefix argument ARG, jump forward ARG many source blocks. + +\(fn &optional ARG)" t nil) + +(autoload 'org-babel-previous-src-block "ob-core" "\ +Jump to the previous source block. +With optional prefix argument ARG, jump backward ARG many source blocks. + +\(fn &optional ARG)" t nil) + +(autoload 'org-babel-mark-block "ob-core" "\ +Mark current source block." t nil) + +;;;*** + +;;;### (autoloads nil "ob-css" "ob-css.el" (0 0 0 0)) +;;; Generated autoloads from ob-css.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-css" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-ditaa" "ob-ditaa.el" (0 0 0 0)) +;;; Generated autoloads from ob-ditaa.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-ditaa" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ob-dot" "ob-dot.el" (0 0 0 0)) +;;; Generated autoloads from ob-dot.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-dot" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-emacs-lisp" "ob-emacs-lisp.el" (0 0 0 0)) +;;; Generated autoloads from ob-emacs-lisp.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-emacs-lisp" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-eshell" "ob-eshell.el" (0 0 0 0)) +;;; Generated autoloads from ob-eshell.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-eshell" '("ob-eshell-session-live-p" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-eval" "ob-eval.el" (0 0 0 0)) +;;; Generated autoloads from ob-eval.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-eval" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-exp" "ob-exp.el" (0 0 0 0)) +;;; Generated autoloads from ob-exp.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-exp" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ob-forth" "ob-forth.el" (0 0 0 0)) +;;; Generated autoloads from ob-forth.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-forth" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-fortran" "ob-fortran.el" (0 0 0 0)) +;;; Generated autoloads from ob-fortran.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-fortran" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-gnuplot" "ob-gnuplot.el" (0 0 0 0)) +;;; Generated autoloads from ob-gnuplot.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-gnuplot" '("*org-babel-gnuplot-" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-groovy" "ob-groovy.el" (0 0 0 0)) +;;; Generated autoloads from ob-groovy.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-groovy" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-haskell" "ob-haskell.el" (0 0 0 0)) +;;; Generated autoloads from ob-haskell.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-haskell" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-java" "ob-java.el" (0 0 0 0)) +;;; Generated autoloads from ob-java.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-java" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-js" "ob-js.el" (0 0 0 0)) +;;; Generated autoloads from ob-js.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-js" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-julia" "ob-julia.el" (0 0 0 0)) +;;; Generated autoloads from ob-julia.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-julia" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-latex" "ob-latex.el" (0 0 0 0)) +;;; Generated autoloads from ob-latex.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-latex" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-lilypond" "ob-lilypond.el" (0 0 0 0)) +;;; Generated autoloads from ob-lilypond.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-lilypond" '("lilypond-mode" "ob-lilypond-header-args" "org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-lisp" "ob-lisp.el" (0 0 0 0)) +;;; Generated autoloads from ob-lisp.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-lisp" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-lob" "ob-lob.el" "f88c2277aca81467214c57a5217e41ef") +;;; Generated autoloads from ob-lob.el + +(autoload 'org-babel-lob-execute-maybe "ob-lob" "\ +Execute a Library of Babel source block, if appropriate. +Detect if this is context for a Library Of Babel source block and +if so then run the appropriate source block from the Library." t nil) + +(autoload 'org-babel-lob-get-info "ob-lob" "\ +Return internal representation for Library of Babel function call. + +Consider DATUM, when provided, or element at point otherwise. + +Return nil when not on an appropriate location. Otherwise return +a list compatible with `org-babel-get-src-block-info', which +see. + +\(fn &optional DATUM)" nil nil) + +;;;*** + +;;;### (autoloads nil "ob-lua" "ob-lua.el" (0 0 0 0)) +;;; Generated autoloads from ob-lua.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-lua" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-makefile" "ob-makefile.el" (0 0 0 0)) +;;; Generated autoloads from ob-makefile.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-makefile" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-maxima" "ob-maxima.el" (0 0 0 0)) +;;; Generated autoloads from ob-maxima.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-maxima" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-ocaml" "ob-ocaml.el" (0 0 0 0)) +;;; Generated autoloads from ob-ocaml.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-ocaml" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-octave" "ob-octave.el" (0 0 0 0)) +;;; Generated autoloads from ob-octave.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-octave" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-org" "ob-org.el" (0 0 0 0)) +;;; Generated autoloads from ob-org.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-org" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-perl" "ob-perl.el" (0 0 0 0)) +;;; Generated autoloads from ob-perl.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-perl" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-plantuml" "ob-plantuml.el" (0 0 0 0)) +;;; Generated autoloads from ob-plantuml.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-plantuml" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ob-processing" "ob-processing.el" (0 0 0 0)) +;;; Generated autoloads from ob-processing.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-processing" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-python" "ob-python.el" (0 0 0 0)) +;;; Generated autoloads from ob-python.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-python" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-ref" "ob-ref.el" (0 0 0 0)) +;;; Generated autoloads from ob-ref.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-ref" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-ruby" "ob-ruby.el" (0 0 0 0)) +;;; Generated autoloads from ob-ruby.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-ruby" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-sass" "ob-sass.el" (0 0 0 0)) +;;; Generated autoloads from ob-sass.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sass" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-scheme" "ob-scheme.el" (0 0 0 0)) +;;; Generated autoloads from ob-scheme.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-scheme" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-screen" "ob-screen.el" (0 0 0 0)) +;;; Generated autoloads from ob-screen.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-screen" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-sed" "ob-sed.el" (0 0 0 0)) +;;; Generated autoloads from ob-sed.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sed" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-shell" "ob-shell.el" (0 0 0 0)) +;;; Generated autoloads from ob-shell.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-shell" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-sql" "ob-sql.el" (0 0 0 0)) +;;; Generated autoloads from ob-sql.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sql" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-sqlite" "ob-sqlite.el" (0 0 0 0)) +;;; Generated autoloads from ob-sqlite.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sqlite" '("org-babel-"))) + +;;;*** + +;;;### (autoloads nil "ob-table" "ob-table.el" (0 0 0 0)) +;;; Generated autoloads from ob-table.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-table" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ob-tangle" "ob-tangle.el" "9590fffd5730d1959a335157d8fd8522") +;;; Generated autoloads from ob-tangle.el + +(autoload 'org-babel-tangle-file "ob-tangle" "\ +Extract the bodies of source code blocks in FILE. +Source code blocks are extracted with `org-babel-tangle'. + +Optional argument TARGET-FILE can be used to specify a default +export file for all source blocks. + +Optional argument LANG-RE can be used to limit the exported +source code blocks by languages matching a regular expression. + +Return a list whose CAR is the tangled file name. + +\(fn FILE &optional TARGET-FILE LANG-RE)" t nil) + +(autoload 'org-babel-tangle "ob-tangle" "\ +Write code blocks to source-specific files. +Extract the bodies of all source code blocks from the current +file into their own source-specific files. +With one universal prefix argument, only tangle the block at point. +When two universal prefix arguments, only tangle blocks for the +tangle file of the block at point. +Optional argument TARGET-FILE can be used to specify a default +export file for all source blocks. Optional argument LANG-RE can +be used to limit the exported source code blocks by languages +matching a regular expression. + +\(fn &optional ARG TARGET-FILE LANG-RE)" t nil) + +;;;*** + +;;;### (autoloads nil "ol" "ol.el" "975aba699c0e378e9081eb750bf034aa") +;;; Generated autoloads from ol.el + +(autoload 'org-next-link "ol" "\ +Move forward to the next link. +If the link is in hidden text, expose it. When SEARCH-BACKWARD +is non-nil, move backward. + +\(fn &optional SEARCH-BACKWARD)" t nil) + +(autoload 'org-previous-link "ol" "\ +Move backward to the previous link. +If the link is in hidden text, expose it." t nil) + +(autoload 'org-toggle-link-display "ol" "\ +Toggle the literal or descriptive display of links." t nil) + +(autoload 'org-store-link "ol" "\ +Store a link to the current location. +\\<org-mode-map> +This link is added to `org-stored-links' and can later be inserted +into an Org buffer with `org-insert-link' (`\\[org-insert-link]'). + +For some link types, a `\\[universal-argument]' prefix ARG is interpreted. A single +`\\[universal-argument]' negates `org-context-in-file-links' for file links or +`org-gnus-prefer-web-links' for links to Usenet articles. + +A `\\[universal-argument] \\[universal-argument]' prefix ARG forces skipping storing functions that are not +part of Org core. + +A `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix ARG forces storing a link for each line in the +active region. + +Assume the function is called interactively if INTERACTIVE? is +non-nil. + +\(fn ARG &optional INTERACTIVE\\=\\?)" t nil) + +(autoload 'org-insert-link "ol" "\ +Insert a link. At the prompt, enter the link. + +Completion can be used to insert any of the link protocol prefixes in use. + +The history can be used to select a link previously stored with +`org-store-link'. When the empty string is entered (i.e. if you just +press `RET' at the prompt), the link defaults to the most recently +stored link. As `SPC' triggers completion in the minibuffer, you need to +use `M-SPC' or `C-q SPC' to force the insertion of a space character. + +You will also be prompted for a description, and if one is given, it will +be displayed in the buffer instead of the link. + +If there is already a link at point, this command will allow you to edit +link and description parts. + +With a `\\[universal-argument]' prefix, prompts for a file to link to. The file name can be +selected using completion. The path to the file will be relative to the +current directory if the file is in the current directory or a subdirectory. +Otherwise, the link will be the absolute path as completed in the minibuffer +\(i.e. normally ~/path/to/file). You can configure this behavior using the +option `org-link-file-path-type'. + +With a `\\[universal-argument] \\[universal-argument]' prefix, enforce an absolute path even if the file is in +the current directory or below. + +A `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix negates `org-link-keep-stored-after-insertion'. + +If the LINK-LOCATION parameter is non-nil, this value will be used as +the link location instead of reading one interactively. + +If the DESCRIPTION parameter is non-nil, this value will be used as the +default description. 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. + +\(fn &optional COMPLETE-FILE LINK-LOCATION DESCRIPTION)" t nil) + +(autoload 'org-insert-all-links "ol" "\ +Insert all links in `org-stored-links'. +When a universal prefix, do not delete the links from `org-stored-links'. +When `ARG' is a number, insert the last N link(s). +`PRE' and `POST' are optional arguments to define a string to +prepend or to append. + +\(fn ARG &optional PRE POST)" t nil) + +(autoload 'org-insert-last-stored-link "ol" "\ +Insert the last link stored in `org-stored-links'. + +\(fn ARG)" t nil) + +(autoload 'org-insert-link-global "ol" "\ +Insert a link like Org mode does. +This command can be called in any mode to insert a link in Org syntax." t nil) + +(autoload 'org-update-radio-target-regexp "ol" "\ +Find all radio targets in this file and update the regular expression. +Also refresh fontification if needed." t nil) + +;;;*** + +;;;### (autoloads nil "ol-bbdb" "ol-bbdb.el" "b523fedbd6ad3117faaf0dfdaa09ea8c") +;;; Generated autoloads from ol-bbdb.el + +(autoload 'org-bbdb-anniversaries "ol-bbdb" "\ +Extract anniversaries from BBDB for display in the agenda. +When called programmatically, this function expects the `date' +variable to be globally bound." nil nil) + +;;;*** + +;;;### (autoloads nil "ol-bibtex" "ol-bibtex.el" (0 0 0 0)) +;;; Generated autoloads from ol-bibtex.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-bibtex" '("org-"))) + +;;;*** + +;;;### (autoloads nil "ol-docview" "ol-docview.el" (0 0 0 0)) +;;; Generated autoloads from ol-docview.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-docview" '("org-docview-"))) + +;;;*** + +;;;### (autoloads nil "ol-doi" "ol-doi.el" (0 0 0 0)) +;;; Generated autoloads from ol-doi.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-doi" '("org-link-doi-"))) + +;;;*** + +;;;### (autoloads nil "ol-eshell" "ol-eshell.el" (0 0 0 0)) +;;; Generated autoloads from ol-eshell.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-eshell" '("org-eshell-"))) + +;;;*** + +;;;### (autoloads nil "ol-eww" "ol-eww.el" (0 0 0 0)) +;;; Generated autoloads from ol-eww.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-eww" '("org-eww-"))) + +;;;*** + +;;;### (autoloads nil "ol-gnus" "ol-gnus.el" (0 0 0 0)) +;;; Generated autoloads from ol-gnus.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-gnus" '("org-gnus-"))) + +;;;*** + +;;;### (autoloads nil "ol-info" "ol-info.el" (0 0 0 0)) +;;; Generated autoloads from ol-info.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-info" '("org-info-"))) + +;;;*** + +;;;### (autoloads nil "ol-irc" "ol-irc.el" "e1dcb3decf43f174ed65f8b171acac80") +;;; Generated autoloads from ol-irc.el + +(autoload 'org-irc-store-link "ol-irc" "\ +Dispatch to the appropriate function to store a link to an IRC session." nil nil) + +;;;*** + +;;;### (autoloads nil "ol-man" "ol-man.el" (0 0 0 0)) +;;; Generated autoloads from ol-man.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-man" '("org-man-"))) + +;;;*** + +;;;### (autoloads nil "ol-mhe" "ol-mhe.el" (0 0 0 0)) +;;; Generated autoloads from ol-mhe.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-mhe" '("org-mhe-"))) + +;;;*** + +;;;### (autoloads nil "ol-rmail" "ol-rmail.el" (0 0 0 0)) +;;; Generated autoloads from ol-rmail.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-rmail" '("org-rmail-"))) + +;;;*** + +;;;### (autoloads nil "ol-w3m" "ol-w3m.el" (0 0 0 0)) +;;; Generated autoloads from ol-w3m.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol-w3m" '("org-w3m-"))) + +;;;*** + +;;;### (autoloads nil "ol" "ol.el" (0 0 0 0)) +;;; Generated autoloads from ol.el + +(autoload 'org-next-link "ol" "\ +Move forward to the next link. +If the link is in hidden text, expose it. When SEARCH-BACKWARD +is non-nil, move backward. + +\(fn &optional SEARCH-BACKWARD)" t nil) + +(autoload 'org-previous-link "ol" "\ +Move backward to the previous link. +If the link is in hidden text, expose it." t nil) + +(autoload 'org-toggle-link-display "ol" "\ +Toggle the literal or descriptive display of links." t nil) + +(autoload 'org-store-link "ol" "\ +Store a link to the current location. +\\<org-mode-map> +This link is added to `org-stored-links' and can later be inserted +into an Org buffer with `org-insert-link' (`\\[org-insert-link]'). + +For some link types, a `\\[universal-argument]' prefix ARG is interpreted. A single +`\\[universal-argument]' negates `org-context-in-file-links' for file links or +`org-gnus-prefer-web-links' for links to Usenet articles. + +A `\\[universal-argument] \\[universal-argument]' prefix ARG forces skipping storing functions that are not +part of Org core. + +A `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix ARG forces storing a link for each line in the +active region. + +Assume the function is called interactively if INTERACTIVE? is +non-nil. + +\(fn ARG &optional INTERACTIVE\\=\\?)" t nil) + +(autoload 'org-insert-link "ol" "\ +Insert a link. At the prompt, enter the link. + +Completion can be used to insert any of the link protocol prefixes in use. + +The history can be used to select a link previously stored with +`org-store-link'. When the empty string is entered (i.e. if you just +press `RET' at the prompt), the link defaults to the most recently +stored link. As `SPC' triggers completion in the minibuffer, you need to +use `M-SPC' or `C-q SPC' to force the insertion of a space character. + +You will also be prompted for a description, and if one is given, it will +be displayed in the buffer instead of the link. + +If there is already a link at point, this command will allow you to edit +link and description parts. + +With a `\\[universal-argument]' prefix, prompts for a file to link to. The file name can be +selected using completion. The path to the file will be relative to the +current directory if the file is in the current directory or a subdirectory. +Otherwise, the link will be the absolute path as completed in the minibuffer +\(i.e. normally ~/path/to/file). You can configure this behavior using the +option `org-link-file-path-type'. + +With a `\\[universal-argument] \\[universal-argument]' prefix, enforce an absolute path even if the file is in +the current directory or below. + +A `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix negates `org-link-keep-stored-after-insertion'. + +If the LINK-LOCATION parameter is non-nil, this value will be used as +the link location instead of reading one interactively. + +If the DESCRIPTION parameter is non-nil, this value will be used as the +default description. 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. + +\(fn &optional COMPLETE-FILE LINK-LOCATION DESCRIPTION)" t nil) + +(autoload 'org-insert-all-links "ol" "\ +Insert all links in `org-stored-links'. +When a universal prefix, do not delete the links from `org-stored-links'. +When `ARG' is a number, insert the last N link(s). +`PRE' and `POST' are optional arguments to define a string to +prepend or to append. + +\(fn ARG &optional PRE POST)" t nil) + +(autoload 'org-insert-last-stored-link "ol" "\ +Insert the last link stored in `org-stored-links'. + +\(fn ARG)" t nil) + +(autoload 'org-insert-link-global "ol" "\ +Insert a link like Org mode does. +This command can be called in any mode to insert a link in Org syntax." t nil) + +(autoload 'org-update-radio-target-regexp "ol" "\ +Find all radio targets in this file and update the regular expression. +Also refresh fontification if needed." t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ol" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-agenda" "org-agenda.el" (0 0 0 0)) +;;; Generated autoloads from org-agenda.el + +(autoload 'org-toggle-sticky-agenda "org-agenda" "\ +Toggle `org-agenda-sticky'. + +\(fn &optional ARG)" t nil) + +(autoload 'org-agenda "org-agenda" "\ +Dispatch agenda commands to collect entries to the agenda buffer. +Prompts for a command to execute. Any prefix arg will be passed +on to the selected command. The default selections are: + +a Call `org-agenda-list' to display the agenda for current day or week. +t Call `org-todo-list' to display the global todo list. +T Call `org-todo-list' to display the global todo list, select only + entries with a specific TODO keyword (the user gets a prompt). +m Call `org-tags-view' to display headlines with tags matching + a condition (the user is prompted for the condition). +M Like `m', but select only TODO entries, no ordinary headlines. +e Export views to associated files. +s Search entries for keywords. +S Search entries for keywords, only with TODO keywords. +/ Multi occur across all agenda files and also files listed + in `org-agenda-text-search-extra-files'. +< Restrict agenda commands to buffer, subtree, or region. + Press several times to get the desired effect. +> Remove a previous restriction. +# List \"stuck\" projects. +! Configure what \"stuck\" means. +C Configure custom agenda commands. + +More commands can be added by configuring the variable +`org-agenda-custom-commands'. In particular, specific tags and TODO keyword +searches can be pre-defined in this way. + +If the current buffer is in Org mode and visiting a file, you can also +first press `<' once to indicate that the agenda should be temporarily +\(until the next use of `\\[org-agenda]') restricted to the current file. +Pressing `<' twice means to restrict to the current subtree or region +\(if active). + +\(fn &optional ARG KEYS RESTRICTION)" t nil) + +(autoload 'org-batch-agenda "org-agenda" "\ +Run an agenda command in batch mode and send the result to STDOUT. +If CMD-KEY is a string of length 1, it is used as a key in +`org-agenda-custom-commands' and triggers this command. If it is a +longer string it is used as a tags/todo match string. +Parameters are alternating variable names and values that will be bound +before running the agenda command. + +\(fn CMD-KEY &rest PARAMETERS)" nil t) + +(autoload 'org-batch-agenda-csv "org-agenda" "\ +Run an agenda command in batch mode and send the result to STDOUT. +If CMD-KEY is a string of length 1, it is used as a key in +`org-agenda-custom-commands' and triggers this command. If it is a +longer string it is used as a tags/todo match string. +Parameters are alternating variable names and values that will be bound +before running the agenda command. + +The output gives a line for each selected agenda item. Each +item is a list of comma-separated values, like this: + +category,head,type,todo,tags,date,time,extra,priority-l,priority-n + +category The category of the item +head The headline, without TODO kwd, TAGS and PRIORITY +type The type of the agenda entry, can be + todo selected in TODO match + tagsmatch selected in tags match + diary imported from diary + deadline a deadline on given date + scheduled scheduled on given date + timestamp entry has timestamp on given date + closed entry was closed on given date + upcoming-deadline warning about deadline + past-scheduled forwarded scheduled item + block entry has date block including g. date +todo The todo keyword, if any +tags All tags including inherited ones, separated by colons +date The relevant date, like 2007-2-14 +time The time, like 15:00-16:50 +extra String with extra planning info +priority-l The priority letter if any was given +priority-n The computed numerical priority +agenda-day The day in the agenda where this is listed + +\(fn CMD-KEY &rest PARAMETERS)" nil t) + +(autoload 'org-store-agenda-views "org-agenda" "\ +Store agenda views. + +\(fn &rest PARAMETERS)" t nil) + +(autoload 'org-batch-store-agenda-views "org-agenda" "\ +Run all custom agenda commands that have a file argument. + +\(fn &rest PARAMETERS)" nil t) + +(autoload 'org-agenda-list "org-agenda" "\ +Produce a daily/weekly view from all files in variable `org-agenda-files'. +The view will be for the current day or week, but from the overview buffer +you will be able to go to other days/weeks. + +With a numeric prefix argument in an interactive call, the agenda will +span ARG days. Lisp programs should instead specify SPAN to change +the number of days. SPAN defaults to `org-agenda-span'. + +START-DAY defaults to TODAY, or to the most recent match for the weekday +given in `org-agenda-start-on-weekday'. + +When WITH-HOUR is non-nil, only include scheduled and deadline +items if they have an hour specification like [h]h:mm. + +\(fn &optional ARG START-DAY SPAN WITH-HOUR)" t nil) + +(autoload 'org-search-view "org-agenda" "\ +Show all entries that contain a phrase or words or regular expressions. + +With optional prefix argument TODO-ONLY, only consider entries that are +TODO entries. The argument STRING can be used to pass a default search +string into this function. If EDIT-AT is non-nil, it means that the +user should get a chance to edit this string, with cursor at position +EDIT-AT. + +The search string can be viewed either as a phrase that should be found as +is, or it can be broken into a number of snippets, each of which must match +in a Boolean way to select an entry. The default depends on the variable +`org-agenda-search-view-always-boolean'. +Even if this is turned off (the default) you can always switch to +Boolean search dynamically by preceding the first word with \"+\" or \"-\". + +The default is a direct search of the whole phrase, where each space in +the search string can expand to an arbitrary amount of whitespace, +including newlines. + +If using a Boolean search, the search string is split on whitespace and +each snippet is searched separately, with logical AND to select an entry. +Words prefixed with a minus must *not* occur in the entry. Words without +a prefix or prefixed with a plus must occur in the entry. Matching is +case-insensitive. Words are enclosed by word delimiters (i.e. they must +match whole words, not parts of a word) if +`org-agenda-search-view-force-full-words' is set (default is nil). + +Boolean search snippets enclosed by curly braces are interpreted as +regular expressions that must or (when preceded with \"-\") must not +match in the entry. Snippets enclosed into double quotes will be taken +as a whole, to include whitespace. + +- If the search string starts with an asterisk, search only in headlines. +- If (possibly after the leading star) the search string starts with an + exclamation mark, this also means to look at TODO entries only, an effect + that can also be achieved with a prefix argument. +- If (possibly after star and exclamation mark) the search string starts + with a colon, this will mean that the (non-regexp) snippets of the + Boolean search must match as full words. + +This command searches the agenda files, and in addition the files +listed in `org-agenda-text-search-extra-files' unless a restriction lock +is active. + +\(fn &optional TODO-ONLY STRING EDIT-AT)" t nil) + +(autoload 'org-todo-list "org-agenda" "\ +Show all (not done) TODO entries from all agenda file in a single list. +The prefix arg can be used to select a specific TODO keyword and limit +the list to these. When using `\\[universal-argument]', you will be prompted +for a keyword. A numeric prefix directly selects the Nth keyword in +`org-todo-keywords-1'. + +\(fn &optional ARG)" t nil) + +(autoload 'org-tags-view "org-agenda" "\ +Show all headlines for all `org-agenda-files' matching a TAGS criterion. +The prefix arg TODO-ONLY limits the search to TODO entries. + +\(fn &optional TODO-ONLY MATCH)" t nil) + +(autoload 'org-agenda-list-stuck-projects "org-agenda" "\ +Create agenda view for projects that are stuck. +Stuck projects are project that have no next actions. For the definitions +of what a project is and how to check if it stuck, customize the variable +`org-stuck-projects'. + +\(fn &rest IGNORE)" t nil) + +(autoload 'org-diary "org-agenda" "\ +Return diary information from org files. +This function can be used in a \"sexp\" diary entry in the Emacs calendar. +It accesses org files and extracts information from those files to be +listed in the diary. The function accepts arguments specifying what +items should be listed. For a list of arguments allowed here, see the +variable `org-agenda-entry-types'. + +The call in the diary file should look like this: + + &%%(org-diary) ~/path/to/some/orgfile.org + +Use a separate line for each org file to check. Or, if you omit the file name, +all files listed in `org-agenda-files' will be checked automatically: + + &%%(org-diary) + +If you don't give any arguments (as in the example above), the default value +of `org-agenda-entry-types' is used: (:deadline :scheduled :timestamp :sexp). +So the example above may also be written as + + &%%(org-diary :deadline :timestamp :sexp :scheduled) + +The function expects the lisp variables `entry' and `date' to be provided +by the caller, because this is how the calendar works. Don't use this +function from a program - use `org-agenda-get-day-entries' instead. + +\(fn &rest ARGS)" nil nil) + +(autoload 'org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item "org-agenda" "\ +Do we have a reason to ignore this TODO entry because it has a time stamp? + +\(fn &optional END)" nil nil) + +(autoload 'org-agenda-set-restriction-lock "org-agenda" "\ +Set restriction lock for agenda to current subtree or file. +When in a restricted subtree, remove it. + +The restriction will span over the entire file if TYPE is `file', +or if type is '(4), or if the cursor is before the first headline +in the file. Otherwise, only apply the restriction to the current +subtree. + +\(fn &optional TYPE)" t nil) + +(autoload 'org-calendar-goto-agenda "org-agenda" "\ +Compute the Org agenda for the calendar date displayed at the cursor. +This is a command that has to be installed in `calendar-mode-map'." t nil) + +(autoload 'org-agenda-to-appt "org-agenda" "\ +Activate appointments found in `org-agenda-files'. + +With a `\\[universal-argument]' prefix, refresh the list of appointments. + +If FILTER is t, interactively prompt the user for a regular +expression, and filter out entries that don't match it. + +If FILTER is a string, use this string as a regular expression +for filtering entries out. + +If FILTER is a function, filter out entries against which +calling the function returns nil. This function takes one +argument: an entry from `org-agenda-get-day-entries'. + +FILTER can also be an alist with the car of each cell being +either `headline' or `category'. For example: + + \\='((headline \"IMPORTANT\") + (category \"Work\")) + +will only add headlines containing IMPORTANT or headlines +belonging to the \"Work\" category. + +ARGS are symbols indicating what kind of entries to consider. +By default `org-agenda-to-appt' will use :deadline*, :scheduled* +\(i.e., deadlines and scheduled items with a hh:mm specification) +and :timestamp entries. See the docstring of `org-diary' for +details and examples. + +If an entry has a APPT_WARNTIME property, its value will be used +to override `appt-message-warning-time'. + +\(fn &optional REFRESH FILTER &rest ARGS)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-agenda" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-archive" "org-archive.el" "65479c6644844adb44ca51a27466dc21") +;;; Generated autoloads from org-archive.el + +(autoload 'org-add-archive-files "org-archive" "\ +Splice the archive files into the list of files. +This implies visiting all these files and finding out what the +archive file is. + +\(fn FILES)" nil nil) + +(autoload 'org-archive-subtree "org-archive" "\ +Move the current subtree to the archive. +The archive can be a certain top-level heading in the current +file, or in a different file. The tree will be moved to that +location, the subtree heading be marked DONE, and the current +time will be added. + +When called with a single prefix argument FIND-DONE, find whole +trees without any open TODO items and archive them (after getting +confirmation from the user). When called with a double prefix +argument, find whole trees with timestamps before today and +archive them (after getting confirmation from the user). If the +cursor is not at a headline when these commands are called, try +all level 1 trees. If the cursor is on a headline, only try the +direct children of this heading. + +\(fn &optional FIND-DONE)" t nil) + +(autoload 'org-archive-to-archive-sibling "org-archive" "\ +Archive the current heading by moving it under the archive sibling. + +The archive sibling is a sibling of the heading with the heading name +`org-archive-sibling-heading' and an `org-archive-tag' tag. If this +sibling does not exist, it will be created at the end of the subtree. + +Archiving time is retained in the ARCHIVE_TIME node property." t nil) + +(autoload 'org-toggle-archive-tag "org-archive" "\ +Toggle the archive tag for the current headline. +With prefix ARG, check all children of current headline and offer tagging +the children that do not contain any open TODO items. + +\(fn &optional FIND-DONE)" t nil) + +(autoload 'org-archive-subtree-default "org-archive" "\ +Archive the current subtree with the default command. +This command is set with the variable `org-archive-default-command'." t nil) + +(autoload 'org-archive-subtree-default-with-confirmation "org-archive" "\ +Archive the current subtree with the default command. +This command is set with the variable `org-archive-default-command'." t nil) + +;;;*** + +;;;### (autoloads nil "org-attach" "org-attach.el" "5c9d4d7993c6b2e103a1189f04539280") +;;; Generated autoloads from org-attach.el + +(autoload 'org-attach "org-attach" "\ +The dispatcher for attachment commands. +Shows a list of commands and prompts for another key to execute a command." t nil) + +(autoload 'org-attach-dired-to-subtree "org-attach" "\ +Attach FILES marked or current file in dired to subtree in other window. +Takes the method given in `org-attach-method' for the attach action. +Precondition: Point must be in a dired buffer. +Idea taken from `gnus-dired-attach'. + +\(fn FILES)" t nil) + +;;;*** + +;;;### (autoloads nil "org-attach-git" "org-attach-git.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from org-attach-git.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-attach-git" '("org-attach-git-"))) + +;;;*** + +;;;### (autoloads nil "org-attach" "org-attach.el" (0 0 0 0)) +;;; Generated autoloads from org-attach.el + +(autoload 'org-attach "org-attach" "\ +The dispatcher for attachment commands. +Shows a list of commands and prompts for another key to execute a command." t nil) + +(autoload 'org-attach-dired-to-subtree "org-attach" "\ +Attach FILES marked or current file in dired to subtree in other window. +Takes the method given in `org-attach-method' for the attach action. +Precondition: Point must be in a dired buffer. +Idea taken from `gnus-dired-attach'. + +\(fn FILES)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-attach" '("org-attach-"))) + +;;;*** + +;;;### (autoloads nil "org-capture" "org-capture.el" (0 0 0 0)) +;;; Generated autoloads from org-capture.el + +(autoload 'org-capture-string "org-capture" "\ +Capture STRING with the template selected by KEYS. + +\(fn STRING &optional KEYS)" t nil) + +(autoload 'org-capture "org-capture" "\ +Capture something. +\\<org-capture-mode-map> +This will let you select a template from `org-capture-templates', and +then file the newly captured information. The text is immediately +inserted at the target location, and an indirect buffer is shown where +you can edit it. Pressing `\\[org-capture-finalize]' brings you back to the previous +state of Emacs, so that you can continue your work. + +When called interactively with a `\\[universal-argument]' prefix argument GOTO, don't +capture anything, just go to the file/headline where the selected +template stores its notes. + +With a `\\[universal-argument] \\[universal-argument]' prefix argument, go to the last note stored. + +When called with a `C-0' (zero) prefix, insert a template at point. + +When called with a `C-1' (one) prefix, force prompting for a date when +a datetree entry is made. + +ELisp programs can set KEYS to a string associated with a template +in `org-capture-templates'. In this case, interactive selection +will be bypassed. + +If `org-capture-use-agenda-date' is non-nil, capturing from the +agenda will use the date at point as the default date. Then, a +`C-1' prefix will tell the capture process to use the HH:MM time +of the day at point (if any) or the current HH:MM time. + +\(fn &optional GOTO KEYS)" t nil) + +(autoload 'org-capture-import-remember-templates "org-capture" "\ +Set `org-capture-templates' to be similar to `org-remember-templates'." t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-capture" '("org-capture-"))) + +;;;*** + +;;;### (autoloads nil "org-clock" "org-clock.el" "3045e2086764060ba0e9bba14a9d82c0") +;;; Generated autoloads from org-clock.el + +(autoload 'org-resolve-clocks "org-clock" "\ +Resolve all currently open Org clocks. +If `only-dangling-p' is non-nil, only ask to resolve dangling +\(i.e., not currently open and valid) clocks. + +\(fn &optional ONLY-DANGLING-P PROMPT-FN LAST-VALID)" t nil) + +(autoload 'org-clock-in "org-clock" "\ +Start the clock on the current item. + +If necessary, clock-out of the currently active clock. + +With a `\\[universal-argument]' prefix argument SELECT, offer a list of recently clocked +tasks to clock into. + +When SELECT is `\\[universal-argument] \\[universal-argument]', clock into the current task and mark it as +the default task, a special task that will always be offered in the +clocking selection, associated with the letter `d'. + +When SELECT is `\\[universal-argument] \\[universal-argument] \\[universal-argument]', clock in by using the last clock-out +time as the start time. See `org-clock-continuously' to make this +the default behavior. + +\(fn &optional SELECT START-TIME)" t nil) + +(autoload 'org-clock-toggle-auto-clockout "org-clock" nil t nil) + +(autoload 'org-clock-in-last "org-clock" "\ +Clock in the last closed clocked item. +When already clocking in, send a warning. +With a universal prefix argument, select the task you want to +clock in from the last clocked in tasks. +With two universal prefix arguments, start clocking using the +last clock-out time, if any. +With three universal prefix arguments, interactively prompt +for a todo state to switch to, overriding the existing value +`org-clock-in-switch-to-state'. + +\(fn &optional ARG)" t nil) + +(autoload 'org-clock-out "org-clock" "\ +Stop the currently running clock. +Throw an error if there is no running clock and FAIL-QUIETLY is nil. +With a universal prefix, prompt for a state to switch the clocked out task +to, overriding the existing value of `org-clock-out-switch-to-state'. + +\(fn &optional SWITCH-TO-STATE FAIL-QUIETLY AT-TIME)" t nil) + +(autoload 'org-clock-cancel "org-clock" "\ +Cancel the running clock by removing the start timestamp." t nil) + +(autoload 'org-clock-goto "org-clock" "\ +Go to the currently clocked-in entry, or to the most recently clocked one. +With prefix arg SELECT, offer recently clocked tasks for selection. + +\(fn &optional SELECT)" t nil) + +(autoload 'org-clock-sum-today "org-clock" "\ +Sum the times for each subtree for today. + +\(fn &optional HEADLINE-FILTER)" nil nil) + +(autoload 'org-clock-sum "org-clock" "\ +Sum the times for each subtree. +Puts the resulting times in minutes as a text property on each headline. +TSTART and TEND can mark a time range to be considered. +HEADLINE-FILTER is a zero-arg function that, if specified, is called for +each headline in the time range with point at the headline. Headlines for +which HEADLINE-FILTER returns nil are excluded from the clock summation. +PROPNAME lets you set a custom text property instead of :org-clock-minutes. + +\(fn &optional TSTART TEND HEADLINE-FILTER PROPNAME)" nil nil) + +(autoload 'org-clock-display "org-clock" "\ +Show subtree times in the entire buffer. + +By default, show the total time for the range defined in +`org-clock-display-default-range'. With `\\[universal-argument]' prefix, show +the total time for today instead. + +With `\\[universal-argument] \\[universal-argument]' prefix, use a custom range, entered at prompt. + +With `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix, display the total time in the +echo area. + +Use `\\[org-clock-remove-overlays]' to remove the subtree times. + +\(fn &optional ARG)" t nil) + +(autoload 'org-clock-remove-overlays "org-clock" "\ +Remove the occur highlights from the buffer. +If NOREMOVE is nil, remove this function from the +`before-change-functions' in the current buffer. + +\(fn &optional BEG END NOREMOVE)" t nil) + +(autoload 'org-clock-out-if-current "org-clock" "\ +Clock out if the current entry contains the running clock. +This is used to stop the clock after a TODO entry is marked DONE, +and is only done if the variable `org-clock-out-when-done' is not nil." nil nil) + +(autoload 'org-clock-get-clocktable "org-clock" "\ +Get a formatted clocktable with parameters according to PROPS. +The table is created in a temporary buffer, fully formatted and +fontified, and then returned. + +\(fn &rest PROPS)" nil nil) + +(autoload 'org-clock-report "org-clock" "\ +Update or create a table containing a report about clocked time. + +If point is inside an existing clocktable block, update it. +Otherwise, insert a new one. + +The new table inherits its properties from the variable +`org-clock-clocktable-default-properties'. The scope of the +clocktable, when not specified in the previous variable, is +`subtree' when the function is called from within a subtree, and +`file' elsewhere. + +When called with a prefix argument, move to the first clock table +in the buffer and update it. + +\(fn &optional ARG)" t nil) + +(eval-after-load 'org '(progn (org-dynamic-block-define "clocktable" #'org-clock-report))) + +(autoload 'org-clocktable-shift "org-clock" "\ +Try to shift the :block date of the clocktable at point. +Point must be in the #+BEGIN: line of a clocktable, or this function +will throw an error. +DIR is a direction, a symbol `left', `right', `up', or `down'. +Both `left' and `down' shift the block toward the past, `up' and `right' +push it toward the future. +N is the number of shift steps to take. The size of the step depends on +the currently selected interval size. + +\(fn DIR N)" nil nil) + +(autoload 'org-dblock-write:clocktable "org-clock" "\ +Write the standard clocktable. + +\(fn PARAMS)" nil nil) + +(autoload 'org-clock-update-time-maybe "org-clock" "\ +If this is a CLOCK line, update it and return t. +Otherwise, return nil." t nil) + +;;;*** + +;;;### (autoloads nil "org-colview" "org-colview.el" "8b8cff156cbeb45bc1b67244c28741c6") +;;; Generated autoloads from org-colview.el + +(autoload 'org-columns-remove-overlays "org-colview" "\ +Remove all currently active column overlays." t nil) + +(autoload 'org-columns-get-format-and-top-level "org-colview" nil nil nil) + +(autoload 'org-columns "org-colview" "\ +Turn on column view on an Org mode file. + +Column view applies to the whole buffer if point is before the first +headline. Otherwise, it applies to the first ancestor setting +\"COLUMNS\" property. If there is none, it defaults to the current +headline. With a `\\[universal-argument]' prefix argument, GLOBAL, +turn on column view for the whole buffer unconditionally. + +When COLUMNS-FMT-STRING is non-nil, use it as the column format. + +\(fn &optional GLOBAL COLUMNS-FMT-STRING)" t nil) + +(autoload 'org-columns-compute "org-colview" "\ +Summarize the values of PROPERTY hierarchically. +Also update existing values for PROPERTY according to the first +column specification. + +\(fn PROPERTY)" t nil) + +(autoload 'org-dblock-write:columnview "org-colview" "\ +Write the column view table. + +PARAMS is a property list of parameters: + +`:id' (mandatory) + + The ID property of the entry where the columns view should be + built. When the symbol `local', call locally. When `global' + call column view with the cursor at the beginning of the + buffer (usually this means that the whole buffer switches to + column view). When \"file:path/to/file.org\", invoke column + view at the start of that file. Otherwise, the ID is located + using `org-id-find'. + +`:exclude-tags' + + List of tags to exclude from column view table. + +`:format' + + When non-nil, specify the column view format to use. + +`:hlines' + + When non-nil, insert a hline before each item. When + a number, insert a hline before each level inferior or equal + to that number. + +`:indent' + + When non-nil, indent each ITEM field according to its level. + +`:match' + + When set to a string, use this as a tags/property match filter. + +`:maxlevel' + + When set to a number, don't capture headlines below this level. + +`:skip-empty-rows' + + When non-nil, skip rows where all specifiers other than ITEM + are empty. + +`:vlines' + + When non-nil, make each column a column group to enforce + vertical lines. + +\(fn PARAMS)" nil nil) + +(autoload 'org-columns-insert-dblock "org-colview" "\ +Create a dynamic block capturing a column view table." t nil) + +(eval-after-load 'org '(progn (org-dynamic-block-define "columnview" #'org-columns-insert-dblock))) + +(autoload 'org-agenda-columns "org-colview" "\ +Turn on or update column view in the agenda." t nil) + +;;;*** + +;;;### (autoloads nil "org-compat" "org-compat.el" "2343a564c1268fa269dc2dc05ca32722") +;;; Generated autoloads from org-compat.el + +(autoload 'org-check-version "org-compat" "\ +Try very hard to provide sensible version strings." nil t) + +;;;*** + +;;;### (autoloads nil "org-crypt" "org-crypt.el" (0 0 0 0)) +;;; Generated autoloads from org-crypt.el + +(autoload 'org-encrypt-entry "org-crypt" "\ +Encrypt the content of the current headline." t nil) + +(autoload 'org-decrypt-entry "org-crypt" "\ +Decrypt the content of the current headline." t nil) + +(autoload 'org-encrypt-entries "org-crypt" "\ +Encrypt all top-level entries in the current buffer." t nil) + +(autoload 'org-decrypt-entries "org-crypt" "\ +Decrypt all entries in the current buffer." t nil) + +(autoload 'org-crypt-use-before-save-magic "org-crypt" "\ +Add a hook to automatically encrypt entries before a file is saved to disk." nil nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-crypt" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-ctags" "org-ctags.el" (0 0 0 0)) +;;; Generated autoloads from org-ctags.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-ctags" '("org-ctags-"))) + +;;;*** + +;;;### (autoloads nil "org-datetree" "org-datetree.el" "6c41420f6ee1e056210adbe3f33e15b1") +;;; Generated autoloads from org-datetree.el + +(autoload 'org-datetree-find-date-create "org-datetree" "\ +Find or create a day entry for date D. +If KEEP-RESTRICTION is non-nil, do not widen the buffer. +When it is nil, the buffer will be widened to make sure an existing date +tree can be found. If it is the symbol `subtree-at-point', then the tree +will be built under the headline at point. + +\(fn D &optional KEEP-RESTRICTION)" nil nil) + +(autoload 'org-datetree-find-month-create "org-datetree" "\ +Find or create a month entry for date D. +Compared to `org-datetree-find-date-create' this function creates +entries grouped by month instead of days. +If KEEP-RESTRICTION is non-nil, do not widen the buffer. +When it is nil, the buffer will be widened to make sure an existing date +tree can be found. If it is the symbol `subtree-at-point', then the tree +will be built under the headline at point. + +\(fn D &optional KEEP-RESTRICTION)" nil nil) + +(autoload 'org-datetree-find-iso-week-create "org-datetree" "\ +Find or create an ISO week entry for date D. +Compared to `org-datetree-find-date-create' this function creates +entries ordered by week instead of months. +When it is nil, the buffer will be widened to make sure an existing date +tree can be found. If it is the symbol `subtree-at-point', then the tree +will be built under the headline at point. + +\(fn D &optional KEEP-RESTRICTION)" nil nil) + +;;;*** + +;;;### (autoloads nil "org-duration" "org-duration.el" "92f81152132375166a8cb1135d1607a2") +;;; Generated autoloads from org-duration.el + +(autoload 'org-duration-set-regexps "org-duration" "\ +Set duration related regexps." t nil) + +(autoload 'org-duration-p "org-duration" "\ +Non-nil when string S is a time duration. + +\(fn S)" nil nil) + +(autoload 'org-duration-to-minutes "org-duration" "\ +Return number of minutes of DURATION string. + +When optional argument CANONICAL is non-nil, ignore +`org-duration-units' and use standard time units value. + +A bare number is translated into minutes. The empty string is +translated into 0.0. + +Return value as a float. Raise an error if duration format is +not recognized. + +\(fn DURATION &optional CANONICAL)" nil nil) + +(autoload 'org-duration-from-minutes "org-duration" "\ +Return duration string for a given number of MINUTES. + +Format duration according to `org-duration-format' or FMT, when +non-nil. + +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. + +\(fn MINUTES &optional FMT CANONICAL)" nil nil) + +(autoload 'org-duration-h:mm-only-p "org-duration" "\ +Non-nil when every duration in TIMES has \"H:MM\" or \"H:MM:SS\" format. + +TIMES is a list of duration strings. + +Return nil if any duration is expressed with units, as defined in +`org-duration-units'. Otherwise, if any duration is expressed +with \"H:MM:SS\" format, return `h:mm:ss'. Otherwise, return +`h:mm'. + +\(fn TIMES)" nil nil) + +;;;*** + +;;;### (autoloads nil "org-element" "org-element.el" "3e68d96e30ad3c40c4c8ab5edfd50d74") +;;; Generated autoloads from org-element.el + +(autoload 'org-element-update-syntax "org-element" "\ +Update parser internals." t nil) + +(autoload 'org-element-interpret-data "org-element" "\ +Interpret DATA as Org syntax. +DATA is a parse tree, an element, an object or a secondary string +to interpret. Return Org syntax as a string. + +\(fn DATA)" nil nil) + +(autoload 'org-element-cache-reset "org-element" "\ +Reset cache in current buffer. +When optional argument ALL is non-nil, reset cache in all Org +buffers. + +\(fn &optional ALL)" t nil) + +(autoload 'org-element-cache-refresh "org-element" "\ +Refresh cache at position POS. + +\(fn POS)" nil nil) + +(autoload 'org-element-at-point "org-element" "\ +Determine closest element around point. + +Return value is a list like (TYPE PROPS) where TYPE is the type +of the element and PROPS a plist of properties associated to the +element. + +Possible types are defined in `org-element-all-elements'. +Properties depend on element or object type, but always include +`:begin', `:end', and `:post-blank' properties. + +As a special case, if point is at the very beginning of the first +item in a list or sub-list, returned element will be that list +instead of the item. Likewise, if point is at the beginning of +the first row of a table, returned element will be the table +instead of the first row. + +When point is at the end of the buffer, return the innermost +element ending there." nil nil) + +(autoload 'org-element-context "org-element" "\ +Return smallest element or object around point. + +Return value is a list like (TYPE PROPS) where TYPE is the type +of the element or object and PROPS a plist of properties +associated to it. + +Possible types are defined in `org-element-all-elements' and +`org-element-all-objects'. Properties depend on element or +object type, but always include `:begin', `:end', `:parent' and +`:post-blank'. + +As a special case, if point is right after an object and not at +the beginning of any other object, return that object. + +Optional argument ELEMENT, when non-nil, is the closest element +containing point, as returned by `org-element-at-point'. +Providing it allows for quicker computation. + +\(fn &optional ELEMENT)" nil nil) + +;;;*** + +;;;### (autoloads nil "org-entities" "org-entities.el" (0 0 0 0)) +;;; Generated autoloads from org-entities.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-entities" '("org-entit"))) + +;;;*** + +;;;### (autoloads nil "org-faces" "org-faces.el" (0 0 0 0)) +;;; Generated autoloads from org-faces.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-faces" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-feed" "org-feed.el" "2fe8531b7a85d6d58c04c106eb5a4957") +;;; Generated autoloads from org-feed.el + +(autoload 'org-feed-update-all "org-feed" "\ +Get inbox items from all feeds in `org-feed-alist'." t nil) + +(autoload 'org-feed-update "org-feed" "\ +Get inbox items from FEED. +FEED can be a string with an association in `org-feed-alist', or +it can be a list structured like an entry in `org-feed-alist'. + +\(fn FEED &optional RETRIEVE-ONLY)" t nil) + +(autoload 'org-feed-goto-inbox "org-feed" "\ +Go to the inbox that captures the feed named FEED. + +\(fn FEED)" t nil) + +(autoload 'org-feed-show-raw-feed "org-feed" "\ +Show the raw feed buffer of a feed. + +\(fn FEED)" t nil) + +;;;*** + +;;;### (autoloads nil "org-footnote" "org-footnote.el" "0213602f0b8b463d562a4caf2721491b") +;;; Generated autoloads from org-footnote.el + +(autoload 'org-footnote-action "org-footnote" "\ +Do the right thing for footnotes. + +When at a footnote reference, jump to the definition. + +When at a definition, jump to the references if they exist, offer +to create them otherwise. + +When neither at definition or reference, create a new footnote, +interactively if possible. + +With prefix arg SPECIAL, or when no footnote can be created, +offer additional commands in a menu. + +\(fn &optional SPECIAL)" t nil) + +;;;*** + +;;;### (autoloads nil "org-goto" "org-goto.el" "adbb2396243174923803514cf5c190b4") +;;; Generated autoloads from org-goto.el + +(autoload 'org-goto-location "org-goto" "\ +Let the user select a location in current buffer. +This function uses a recursive edit. It returns the selected +position or nil. + +\(fn &optional BUF HELP)" nil nil) + +(autoload 'org-goto "org-goto" "\ +Look up a different location in the current file, keeping current visibility. + +When you want look-up or go to a different location in a +document, the fastest way is often to fold the entire buffer and +then dive into the tree. This method has the disadvantage, that +the previous location will be folded, which may not be what you +want. + +This command works around this by showing a copy of the current +buffer in an indirect buffer, in overview mode. You can dive +into the tree in that copy, use `org-occur' and incremental search +to find a location. When pressing RET or `Q', the command +returns to the original buffer in which the visibility is still +unchanged. After RET it will also jump to the location selected +in the indirect buffer and expose the headline hierarchy above. + +With a prefix argument, use the alternative interface: e.g., if +`org-goto-interface' is `outline' use `outline-path-completion'. + +\(fn &optional ALTERNATIVE-INTERFACE)" t nil) + +;;;*** + +;;;### (autoloads nil "org-habit" "org-habit.el" (0 0 0 0)) +;;; Generated autoloads from org-habit.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-habit" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-id" "org-id.el" "113f5d6f60577662c87fbd6df64ee9e9") +;;; Generated autoloads from org-id.el + +(autoload 'org-id-get-create "org-id" "\ +Create an ID for the current entry and return it. +If the entry already has an ID, just return it. +With optional argument FORCE, force the creation of a new ID. + +\(fn &optional FORCE)" t nil) + +(autoload 'org-id-copy "org-id" "\ +Copy the ID of the entry at point to the kill ring. +Create an ID if necessary." t nil) + +(autoload 'org-id-get "org-id" "\ +Get the ID property of the entry at point-or-marker POM. +If POM is nil, refer to the entry at point. +If the entry does not have an ID, the function returns nil. +However, when CREATE is non-nil, create an ID if none is present already. +PREFIX will be passed through to `org-id-new'. +In any case, the ID of the entry is returned. + +\(fn &optional POM CREATE PREFIX)" nil nil) + +(autoload 'org-id-get-with-outline-path-completion "org-id" "\ +Use `outline-path-completion' to retrieve the ID of an entry. +TARGETS may be a setting for `org-refile-targets' to define +eligible headlines. When omitted, all headlines in the current +file are eligible. This function returns the ID of the entry. +If necessary, the ID is created. + +\(fn &optional TARGETS)" nil nil) + +(autoload 'org-id-get-with-outline-drilling "org-id" "\ +Use an outline-cycling interface to retrieve the ID of an entry. +This only finds entries in the current buffer, using `org-goto-location'. +It returns the ID of the entry. If necessary, the ID is created." nil nil) + +(autoload 'org-id-goto "org-id" "\ +Switch to the buffer containing the entry with id ID. +Move the cursor to that entry in that buffer. + +\(fn ID)" t nil) + +(autoload 'org-id-find "org-id" "\ +Return the location of the entry with the id ID. +The return value is a cons cell (file-name . position), or nil +if there is no entry with that ID. +With optional argument MARKERP, return the position as a new marker. + +\(fn ID &optional MARKERP)" nil nil) + +(autoload 'org-id-new "org-id" "\ +Create a new globally unique ID. + +An ID consists of two parts separated by a colon: +- a prefix +- a unique part that will be created according to `org-id-method'. + +PREFIX can specify the prefix, the default is given by the variable +`org-id-prefix'. However, if PREFIX is the symbol `none', don't use any +prefix even if `org-id-prefix' specifies one. + +So a typical ID could look like \"Org:4nd91V40HI\". + +\(fn &optional PREFIX)" nil nil) + +(autoload 'org-id-update-id-locations "org-id" "\ +Scan relevant files for IDs. +Store the relation between files and corresponding IDs. +This will scan all agenda files, all associated archives, and all +files currently mentioned in `org-id-locations'. +When FILES is given, scan also these files. +If SILENT is non-nil, messages are suppressed. + +\(fn &optional FILES SILENT)" t nil) + +(autoload 'org-id-find-id-file "org-id" "\ +Query the id database for the file in which ID is located. + +\(fn ID)" nil nil) + +(autoload 'org-id-store-link "org-id" "\ +Store a link to the current entry, using its ID. + +If before first heading store first title-keyword as description +or filename if no title." t nil) + +;;;*** + +;;;### (autoloads nil "org-indent" "org-indent.el" "357fb56462ce4eaec7a2ea8aad6c64a3") +;;; Generated autoloads from org-indent.el + +(autoload 'org-indent-mode "org-indent" "\ +When active, indent text according to outline structure. + +If called interactively, enable Org-Indent mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. + +Internally this works by adding `line-prefix' and `wrap-prefix' +properties, after each buffer modification, on the modified zone. + +The process is synchronous. Though, initial indentation of +buffer, which can take a few seconds on large buffers, is done +during idle time. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "org-inlinetask" "org-inlinetask.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from org-inlinetask.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-inlinetask" '("org-inlinetask-"))) + +;;;*** + +;;;### (autoloads nil "org-keys" "org-keys.el" "74211ba8b1b00995f3de35dbd5104e88") +;;; Generated autoloads from org-keys.el + +(autoload 'org-babel-describe-bindings "org-keys" "\ +Describe all keybindings behind `org-babel-key-prefix'." t nil) + +;;;*** + +;;;### (autoloads nil "org-lint" "org-lint.el" "ef9470da9d3e9882e1c1b96873e92418") +;;; Generated autoloads from org-lint.el + +(autoload 'org-lint "org-lint" "\ +Check current Org buffer for syntax mistakes. + +By default, run all checkers. With a `\\[universal-argument]' prefix ARG, select one +category of checkers only. With a `\\[universal-argument] \\[universal-argument]' prefix, run one precise +checker by its name. + +ARG can also be a list of checker names, as symbols, to run. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "org-list" "org-list.el" "47875c38e3722e913a52e17a36e35b23") +;;; Generated autoloads from org-list.el + +(autoload 'org-list-checkbox-radio-mode "org-list" "\ +When turned on, use list checkboxes as radio buttons. + +If called interactively, enable Org-List-Checkbox-Radio mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "org-macro" "org-macro.el" (0 0 0 0)) +;;; Generated autoloads from org-macro.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-macro" '("org-macro-"))) + +;;;*** + +;;;### (autoloads nil "org-macs" "org-macs.el" "c0b87b38400d6e7f5b3e7a61de8a7b7e") +;;; Generated autoloads from org-macs.el + +(autoload 'org-load-noerror-mustsuffix "org-macs" "\ +Load FILE with optional arguments NOERROR and MUSTSUFFIX. + +\(fn FILE)" nil t) + +;;;*** + +;;;### (autoloads nil "org-mobile" "org-mobile.el" "9a68b969d5c5d3f89dfd4dce19753452") +;;; Generated autoloads from org-mobile.el + +(autoload 'org-mobile-push "org-mobile" "\ +Push the current state of Org affairs to the target directory. +This will create the index file, copy all agenda files there, and also +create all custom agenda views, for upload to the mobile phone." t nil) + +(autoload 'org-mobile-pull "org-mobile" "\ +Pull the contents of `org-mobile-capture-file' and integrate them. +Apply all flagged actions, flag entries to be flagged and then call an +agenda view showing the flagged items." t nil) + +;;;*** + +;;;### (autoloads nil "org-mouse" "org-mouse.el" (0 0 0 0)) +;;; Generated autoloads from org-mouse.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-mouse" '("org-mouse-"))) + +;;;*** + +;;;### (autoloads nil "org-num" "org-num.el" "e60a3e53d2eab60841976baaa9ca6585") +;;; Generated autoloads from org-num.el + +(autoload 'org-num-default-format "org-num" "\ +Default numbering display function. +NUMBERING is a list of numbers. + +\(fn NUMBERING)" nil nil) + +(autoload 'org-num-mode "org-num" "\ +Dynamic numbering of headlines in an Org buffer. + +If called interactively, enable Org-Num mode if ARG is positive, and +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "org-pcomplete" "org-pcomplete.el" (0 0 0 0)) +;;; Generated autoloads from org-pcomplete.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-pcomplete" '("org-" "pcomplete/org-mode/"))) + +;;;*** + +;;;### (autoloads nil "org-plot" "org-plot.el" "57b93f7fc561fa842d313207fae716d8") +;;; Generated autoloads from org-plot.el + +(autoload 'org-plot/gnuplot "org-plot" "\ +Plot table using gnuplot. Gnuplot options can be specified with PARAMS. +If not given options will be taken from the +PLOT +line directly before or after the table. + +\(fn &optional PARAMS)" t nil) + +;;;*** + +;;;### (autoloads nil "org-protocol" "org-protocol.el" (0 0 0 0)) +;;; Generated autoloads from org-protocol.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-protocol" '("org-protocol-"))) + +;;;*** + +;;;### (autoloads nil "org-refile" "org-refile.el" "5df09bd1d8e278b9b8b29a266833de56") +;;; Generated autoloads from org-refile.el + +(autoload 'org-refile-copy "org-refile" "\ +Like `org-refile', but preserve the refiled subtree." t nil) + +(autoload 'org-refile-reverse "org-refile" "\ +Refile while temporarily toggling `org-reverse-note-order'. +So if `org-refile' would append the entry as the last entry under +the target heading, `org-refile-reverse' will prepend it as the +first entry, and vice-versa. + +\(fn &optional ARG DEFAULT-BUFFER RFLOC MSG)" t nil) + +(autoload 'org-refile "org-refile" "\ +Move the entry or entries at point to another heading. + +The list of target headings is compiled using the information in +`org-refile-targets', which see. + +At the target location, the entry is filed as a subitem of the +target heading. Depending on `org-reverse-note-order', the new +subitem will either be the first or the last subitem. + +If there is an active region, all entries in that region will be +refiled. However, the region must fulfill the requirement that +the first heading sets the top-level of the moved text. + +With a `\\[universal-argument]' ARG, the command will only visit the target location +and not actually move anything. + +With a prefix `\\[universal-argument] \\[universal-argument]', go to the location where the last +refiling operation has put the subtree. + +With a numeric prefix argument of `2', refile to the running clock. + +With a numeric prefix argument of `3', emulate `org-refile-keep' +being set to t and copy to the target location, don't move it. +Beware that keeping refiled entries may result in duplicated ID +properties. + +RFLOC can be a refile location obtained in a different way. It +should be a list with the following 4 elements: + +1. Name - an identifier for the refile location, typically the +headline text +2. File - the file the refile location is in +3. nil - used for generating refile location candidates, not +needed when passing RFLOC +4. Position - the position in the specified file of the +headline to refile under + +MSG is a string to replace \"Refile\" in the default prompt with +another verb. E.g. `org-refile-copy' sets this parameter to \"Copy\". + +See also `org-refile-use-outline-path'. + +If you are using target caching (see `org-refile-use-cache'), you +have to clear the target cache in order to find new targets. +This can be done with a `0' prefix (`C-0 C-c C-w') or a triple +prefix argument (`C-u C-u C-u C-c C-w'). + +\(fn &optional ARG DEFAULT-BUFFER RFLOC MSG)" t nil) + +;;;*** + +;;;### (autoloads nil "org-src" "org-src.el" (0 0 0 0)) +;;; Generated autoloads from org-src.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-src" '("org-"))) + +;;;*** + +;;;### (autoloads nil "org-table" "org-table.el" "7abbbe0fc8b35c584e97ccfd854ece6f") +;;; Generated autoloads from org-table.el + +(autoload 'org-table-header-line-mode "org-table" "\ +Display the first row of the table at point in the header line. + +If called interactively, enable Org-Table-Header-Line mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. + +\(fn &optional ARG)" t nil) + +(autoload 'org-table-create-with-table\.el "org-table" "\ +Use the table.el package to insert a new table. +If there is already a table at point, convert between Org tables +and table.el tables." t nil) + +(autoload 'org-table-create-or-convert-from-region "org-table" "\ +Convert region to table, or create an empty table. +If there is an active region, convert it to a table, using the function +`org-table-convert-region'. See the documentation of that function +to learn how the prefix argument is interpreted to determine the field +separator. +If there is no such region, create an empty table with `org-table-create'. + +\(fn ARG)" t nil) + +(autoload 'org-table-create "org-table" "\ +Query for a size and insert a table skeleton. +SIZE is a string Columns x Rows like for example \"3x2\". + +\(fn &optional SIZE)" t nil) + +(autoload 'org-table-convert-region "org-table" "\ +Convert region to a table. + +The region goes from BEG0 to END0, but these borders will be moved +slightly, to make sure a beginning of line in the first line is included. + +SEPARATOR specifies the field separator in the lines. It can have the +following values: + +\(4) Use the comma as a field separator +\(16) Use a TAB as field separator +\(64) Prompt for a regular expression as field separator +integer When a number, use that many spaces, or a TAB, as field separator +regexp When a regular expression, use it to match the separator +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. + +\(fn BEG0 END0 &optional SEPARATOR)" t nil) + +(autoload 'org-table-import "org-table" "\ +Import FILE as a table. + +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. + +When non-nil, SEPARATOR specifies the field separator in the +lines. It can have the following values: + +- (4) Use the comma as a field separator. +- (16) Use a TAB as field separator. +- (64) Prompt for a regular expression as field separator. +- integer When a number, use that many spaces, or a TAB, as field separator. +- regexp When a regular expression, use it to match the separator. + +\(fn FILE SEPARATOR)" t nil) + +(autoload 'org-table-begin "org-table" "\ +Find the beginning of the table and return its position. +With a non-nil optional argument TABLE-TYPE, return the beginning +of a table.el-type table. This function assumes point is on +a table. + +\(fn &optional TABLE-TYPE)" nil nil) + +(autoload 'org-table-end "org-table" "\ +Find the end of the table and return its position. +With a non-nil optional argument TABLE-TYPE, return the end of +a table.el-type table. This function assumes point is on +a table. + +\(fn &optional TABLE-TYPE)" nil nil) + +(autoload 'org-table-next-field "org-table" "\ +Go to the next field in the current table, creating new lines as needed. +Before doing so, re-align the table if necessary." t nil) + +(autoload 'org-table-previous-field "org-table" "\ +Go to the previous field in the table. +Before doing so, re-align the table if necessary." t nil) + +(autoload 'org-table-next-row "org-table" "\ +Go to the next row (same column) in the current table. +Before doing so, re-align the table if necessary." t nil) + +(autoload 'org-table-blank-field "org-table" "\ +Blank the current table field or active region." t nil) + +(autoload 'org-table-field-info "org-table" "\ +Show info about the current field, and highlight any reference at point. + +\(fn ARG)" t nil) + +(autoload 'org-table-goto-column "org-table" "\ +Move the cursor to the Nth column in the current table line. +With optional argument ON-DELIM, stop with point before the left delimiter +of the field. +If there are less than N fields, just go to after the last delimiter. +However, when FORCE is non-nil, create new columns if necessary. + +\(fn N &optional ON-DELIM FORCE)" t nil) + +(autoload 'org-table-insert-column "org-table" "\ +Insert a new column into the table." t nil) + +(autoload 'org-table-move-cell-up "org-table" "\ +Move a single cell up in a table. +Swap with anything in target cell." t nil) + +(autoload 'org-table-move-cell-down "org-table" "\ +Move a single cell down in a table. +Swap with anything in target cell." t nil) + +(autoload 'org-table-move-cell-left "org-table" "\ +Move a single cell left in a table. +Swap with anything in target cell." t nil) + +(autoload 'org-table-move-cell-right "org-table" "\ +Move a single cell right in a table. +Swap with anything in target cell." t nil) + +(autoload 'org-table-delete-column "org-table" "\ +Delete a column from the table." t nil) + +(autoload 'org-table-move-column-right "org-table" "\ +Move column to the right." t nil) + +(autoload 'org-table-move-column-left "org-table" "\ +Move column to the left." t nil) + +(autoload 'org-table-move-column "org-table" "\ +Move the current column to the right. With arg LEFT, move to the left. + +\(fn &optional LEFT)" t nil) + +(autoload 'org-table-move-row-down "org-table" "\ +Move table row down." t nil) + +(autoload 'org-table-move-row-up "org-table" "\ +Move table row up." t nil) + +(autoload 'org-table-move-row "org-table" "\ +Move the current table line down. With arg UP, move it up. + +\(fn &optional UP)" t nil) + +(autoload 'org-table-insert-row "org-table" "\ +Insert a new row above the current line into the table. +With prefix ARG, insert below the current line. + +\(fn &optional ARG)" t nil) + +(autoload 'org-table-insert-hline "org-table" "\ +Insert a horizontal-line below the current line into the table. +With prefix ABOVE, insert above the current line. + +\(fn &optional ABOVE)" t nil) + +(autoload 'org-table-hline-and-move "org-table" "\ +Insert a hline and move to the row below that line. + +\(fn &optional SAME-COLUMN)" t nil) + +(autoload 'org-table-kill-row "org-table" "\ +Delete the current row or horizontal line from the table." t nil) + +(autoload 'org-table-cut-region "org-table" "\ +Copy region in table to the clipboard and blank all relevant fields. +If there is no active region, use just the field at point. + +\(fn BEG END)" t nil) + +(autoload 'org-table-copy-down "org-table" "\ +Copy the value of the current field one row below. + +If the field at the cursor is empty, copy the content of the +nearest non-empty field above. With argument N, use the Nth +non-empty field. + +If the current field is not empty, it is copied down to the next +row, and the cursor is moved with it. Therefore, repeating this +command causes the column to be filled row-by-row. + +If the variable `org-table-copy-increment' is non-nil and the +field is a number, a timestamp, or is either prefixed or suffixed +with a number, it will be incremented while copying. By default, +increment by the difference between the value in the current +field and the one in the field above, if any. To increment using +a fixed integer, set `org-table-copy-increment' to a number. In +the case of a timestamp, increment by days. + +However, when N is 0, do not increment the field at all. + +\(fn N)" t nil) + +(autoload 'org-table-copy-region "org-table" "\ +Copy rectangular region in table to clipboard. +A special clipboard is used which can only be accessed with +`org-table-paste-rectangle'. Return the region copied, as a list +of lists of fields. + +\(fn BEG END &optional CUT)" t nil) + +(autoload 'org-table-paste-rectangle "org-table" "\ +Paste a rectangular region into a table. +The upper right corner ends up in the current field. All involved fields +will be overwritten. If the rectangle does not fit into the present table, +the table is enlarged as needed. The process ignores horizontal separator +lines." t nil) + +(autoload 'org-table-edit-field "org-table" "\ +Edit table field in a different window. +This is mainly useful for fields that contain hidden parts. + +When called with a `\\[universal-argument]' prefix, just make the full field +visible so that it can be edited in place. + +When called with a `\\[universal-argument] \\[universal-argument]' prefix, toggle `org-table-follow-field-mode'. + +\(fn ARG)" t nil) + +(autoload 'org-table-get-stored-formulas "org-table" "\ +Return an alist with the stored formulas directly after current table. +By default, only return active formulas, i.e., formulas located +on the first line after the table. However, if optional argument +LOCATION is a buffer position, consider the formulas there. + +\(fn &optional NOERROR LOCATION)" nil nil) + +(autoload 'org-table-maybe-eval-formula "org-table" "\ +Check if the current field starts with \"=\" or \":=\". +If yes, store the formula and apply it." nil nil) + +(autoload 'org-table-rotate-recalc-marks "org-table" "\ +Rotate the recalculation mark in the first column. +If in any row, the first field is not consistent with a mark, +insert a new column for the markers. +When there is an active region, change all the lines in the region, +after prompting for the marking character. +After each change, a message will be displayed indicating the meaning +of the new mark. + +\(fn &optional NEWCHAR)" t nil) + +(autoload 'org-table-maybe-recalculate-line "org-table" "\ +Recompute the current line if marked for it, and if we haven't just done it." t nil) + +(autoload 'org-table-eval-formula "org-table" "\ +Replace the table field value at the cursor by the result of a calculation. + +In a table, this command replaces the value in the current field with the +result of a formula. It also installs the formula as the \"current\" column +formula, by storing it in a special line below the table. When called +with a `\\[universal-argument]' prefix the formula is installed as a field formula. + +When called with a `\\[universal-argument] \\[universal-argument]' prefix, insert the active equation for the field +back into the current field, so that it can be edited there. This is useful +in order to use \\<org-table-fedit-map>`\\[org-table-show-reference]' to check the referenced fields. + +When called, the command first prompts for a formula, which is read in +the minibuffer. Previously entered formulas are available through the +history list, and the last used formula is offered as a default. +These stored formulas are adapted correctly when moving, inserting, or +deleting columns with the corresponding commands. + +The formula can be any algebraic expression understood by the Calc package. +For details, see the Org mode manual. + +This function can also be called from Lisp programs and offers +additional arguments: EQUATION can be the formula to apply. If this +argument is given, the user will not be prompted. + +SUPPRESS-ALIGN is used to speed-up recursive calls by by-passing +unnecessary aligns. + +SUPPRESS-CONST suppresses the interpretation of constants in the +formula, assuming that this has been done already outside the +function. + +SUPPRESS-STORE means the formula should not be stored, either +because it is already stored, or because it is a modified +equation that should not overwrite the stored one. + +SUPPRESS-ANALYSIS prevents analyzing the table and checking +location of point. + +\(fn &optional ARG EQUATION SUPPRESS-ALIGN SUPPRESS-CONST SUPPRESS-STORE SUPPRESS-ANALYSIS)" t nil) + +(autoload 'org-table-recalculate "org-table" "\ +Recalculate the current table line by applying all stored formulas. + +With prefix arg ALL, do this for all lines in the table. + +When called with a `\\[universal-argument] \\[universal-argument]' prefix, or if ALL is the symbol `iterate', +recompute the table until it no longer changes. + +If NOALIGN is not nil, do not re-align the table after the computations +are done. This is typically used internally to save time, if it is +known that the table will be realigned a little later anyway. + +\(fn &optional ALL NOALIGN)" t nil) + +(autoload 'org-table-iterate "org-table" "\ +Recalculate the table until it does not change anymore. +The maximum number of iterations is 10, but you can choose a different value +with the prefix ARG. + +\(fn &optional ARG)" t nil) + +(autoload 'org-table-recalculate-buffer-tables "org-table" "\ +Recalculate all tables in the current buffer." t nil) + +(autoload 'org-table-iterate-buffer-tables "org-table" "\ +Iterate all tables in the buffer, to converge inter-table dependencies." t nil) + +(autoload 'org-table-edit-formulas "org-table" "\ +Edit the formulas of the current table in a separate buffer." t nil) + +(autoload 'org-table-toggle-coordinate-overlays "org-table" "\ +Toggle the display of Row/Column numbers in tables." t nil) + +(autoload 'org-table-toggle-formula-debugger "org-table" "\ +Toggle the formula debugger in tables." t nil) + +(autoload 'org-table-toggle-column-width "org-table" "\ +Shrink or expand current column in an Org table. + +If a width cookie specifies a width W for the column, the first +W visible characters are displayed. Otherwise, the column is +shrunk to a single character. + +When point is before the first column or after the last one, ask +for the columns to shrink or expand, as a list of ranges. +A column range can be one of the following patterns: + + N column N only + N-M every column between N and M (both inclusive) + N- every column between N (inclusive) and the last column + -M every column between the first one and M (inclusive) + - every column + +When optional argument ARG is a string, use it as white space +separated list of column ranges. + +When called with `\\[universal-argument]' prefix, call `org-table-shrink', i.e., +shrink columns with a width cookie and expand the others. + +When called with `\\[universal-argument] \\[universal-argument]' prefix, expand all columns. + +\(fn &optional ARG)" t nil) + +(autoload 'org-table-shrink "org-table" "\ +Shrink all columns with a width cookie in the table at point. + +Columns without a width cookie are expanded. + +Optional arguments BEGIN and END, when non-nil, specify the +beginning and end position of the current table. + +\(fn &optional BEGIN END)" t nil) + +(autoload 'org-table-expand "org-table" "\ +Expand all columns in the table at point. +Optional arguments BEGIN and END, when non-nil, specify the +beginning and end position of the current table. + +\(fn &optional BEGIN END)" t nil) + +(autoload 'org-table-map-tables "org-table" "\ +Apply function F to the start of all tables in the buffer. + +\(fn F &optional QUIETLY)" nil nil) + +(autoload 'org-table-export "org-table" "\ +Export table to a file, with configurable format. +Such a file can be imported into usual spreadsheet programs. + +FILE can be the output file name. If not given, it will be taken +from a TABLE_EXPORT_FILE property in the current entry or higher +up in the hierarchy, or the user will be prompted for a file +name. FORMAT can be an export format, of the same kind as it +used when `-mode' sends a table in a different format. + +The command suggests a format depending on TABLE_EXPORT_FORMAT, +whether it is set locally or up in the hierarchy, then on the +extension of the given file name, and finally on the variable +`org-table-export-default-format'. + +\(fn &optional FILE FORMAT)" t nil) + +(autoload 'org-table--align-field "org-table" "\ +Format FIELD according to column WIDTH and alignment ALIGN. +FIELD is a string. WIDTH is a number. ALIGN is either \"c\", +\"l\" or\"r\". + +\(fn FIELD WIDTH ALIGN)" nil nil) + +(autoload 'org-table-justify-field-maybe "org-table" "\ +Justify the current field, text to left, number to right. +Optional argument NEW may specify text to replace the current field content. + +\(fn &optional NEW)" nil nil) + +(autoload 'org-table-sort-lines "org-table" "\ +Sort table lines according to the column at point. + +The position of point indicates the column to be used for +sorting, and the range of lines is the range between the nearest +horizontal separator lines, or the entire table of no such lines +exist. If point is before the first column, you will be prompted +for the sorting column. If there is an active region, the mark +specifies the first line and the sorting column, while point +should be in the last line to be included into the sorting. + +The command then prompts for the sorting type which can be +alphabetically, numerically, or by time (as given in a time stamp +in the field, or as a HH:MM value). Sorting in reverse order is +also possible. + +With prefix argument WITH-CASE, alphabetic sorting will be case-sensitive +if the locale allows for it. + +If SORTING-TYPE is specified when this function is called from a Lisp +program, no prompting will take place. SORTING-TYPE must be a character, +any of (?a ?A ?n ?N ?t ?T ?f ?F) where the capital letters indicate that +sorting should be done in reverse order. + +If the SORTING-TYPE is ?f or ?F, then GETKEY-FUNC specifies +a function to be called to extract the key. It must return a value +that is compatible with COMPARE-FUNC, the function used to compare +entries. + +A non-nil value for INTERACTIVE? is used to signal that this +function is being called interactively. + +\(fn &optional WITH-CASE SORTING-TYPE GETKEY-FUNC COMPARE-FUNC INTERACTIVE\\=\\?)" t nil) + +(autoload 'org-table-wrap-region "org-table" "\ +Wrap several fields in a column like a paragraph. +This is useful if you'd like to spread the contents of a field over several +lines, in order to keep the table compact. + +If there is an active region, and both point and mark are in the same column, +the text in the column is wrapped to minimum width for the given number of +lines. Generally, this makes the table more compact. A prefix ARG may be +used to change the number of desired lines. For example, `C-2 \\[org-table-wrap-region]' +formats the selected text to two lines. If the region was longer than two +lines, the remaining lines remain empty. A negative prefix argument reduces +the current number of lines by that amount. The wrapped text is pasted back +into the table. If you formatted it to more lines than it was before, fields +further down in the table get overwritten - so you might need to make space in +the table first. + +If there is no region, the current field is split at the cursor position and +the text fragment to the right of the cursor is prepended to the field one +line down. + +If there is no region, but you specify a prefix ARG, the current field gets +blank, and the content is appended to the field above. + +\(fn ARG)" t nil) + +(autoload 'org-table-sum "org-table" "\ +Sum numbers in region of current table column. +The result will be displayed in the echo area, and will be available +as kill to be inserted with \\[yank]. + +If there is an active region, it is interpreted as a rectangle and all +numbers in that rectangle will be summed. If there is no active +region and point is located in a table column, sum all numbers in that +column. + +If at least one number looks like a time HH:MM or HH:MM:SS, all other +numbers are assumed to be times as well (in decimal hours) and the +numbers are added as such. + +If NLAST is a number, only the NLAST fields will actually be summed. + +\(fn &optional BEG END NLAST)" t nil) + +(autoload 'org-table-analyze "org-table" "\ +Analyze table at point and store results. + +This function sets up the following dynamically scoped variables: + + `org-table-column-name-regexp', + `org-table-column-names', + `org-table-current-begin-pos', + `org-table-current-line-types', + `org-table-current-ncol', + `org-table-dlines', + `org-table-hlines', + `org-table-local-parameters', + `org-table-named-field-locations'." nil nil) + +(autoload 'turn-on-orgtbl "org-table" "\ +Unconditionally turn on `orgtbl-mode'." nil nil) + +(autoload 'orgtbl-mode "org-table" "\ +The Org mode table editor as a minor mode for use in other modes. + +If called interactively, enable Orgtbl mode if ARG is positive, and +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. + +\(fn &optional ARG)" t nil) + +(defvar orgtbl-exp-regexp "^\\([-+]?[0-9][0-9.]*\\)[eE]\\([-+]?[0-9]+\\)$" "\ +Regular expression matching exponentials as produced by calc.") + +(autoload 'org-table-to-lisp "org-table" "\ +Convert the table at point to a Lisp structure. + +The structure will be a list. Each item is either the symbol `hline' +for a horizontal separator line, or a list of field values as strings. +The table is taken from the parameter TXT, or from the buffer at point. + +\(fn &optional TXT)" nil nil) + +(autoload 'orgtbl-to-generic "org-table" "\ +Convert the `orgtbl-mode' TABLE to some other format. + +This generic routine can be used for many standard cases. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that +line. PARAMS is a property list of parameters that can +influence the conversion. + +Valid parameters are: + +:backend, :raw + + Export back-end used as a basis to transcode elements of the + table, when no specific parameter applies to it. It is also + used to translate cells contents. You can prevent this by + setting :raw property to a non-nil value. + +:splice + + When non-nil, only convert rows, not the table itself. This is + equivalent to setting to the empty string both :tstart + and :tend, which see. + +:skip + + When set to an integer N, skip the first N lines of the table. + Horizontal separation lines do count for this parameter! + +:skipcols + + List of columns that should be skipped. If the table has + a column with calculation marks, that column is automatically + discarded beforehand. + +:hline + + String to be inserted on horizontal separation lines. May be + nil to ignore these lines altogether. + +:sep + + Separator between two fields, as a string. + +Each in the following group may be either a string or a function +of no arguments returning a string: + +:tstart, :tend + + Strings to start and end the table. Ignored when :splice is t. + +:lstart, :lend + + Strings to start and end a new table line. + +:llstart, :llend + + Strings to start and end the last table line. Default, + respectively, to :lstart and :lend. + +Each in the following group may be a string or a function of one +argument (either the cells in the current row, as a list of +strings, or the current cell) returning a string: + +:lfmt + + Format string for an entire row, with enough %s to capture all + fields. When non-nil, :lstart, :lend, and :sep are ignored. + +:llfmt + + Format for the entire last line, defaults to :lfmt. + +:fmt + + A format to be used to wrap the field, should contain %s for + the original field value. For example, to wrap everything in + dollars, you could use :fmt \"$%s$\". This may also be + a property list with column numbers and format strings, or + functions, e.g., + + (:fmt (2 \"$%s$\" 4 (lambda (c) (format \"$%s$\" c)))) + +:hlstart :hllstart :hlend :hllend :hsep :hlfmt :hllfmt :hfmt + + Same as above, specific for the header lines in the table. + All lines before the first hline are treated as header. If + any of these is not present, the data line value is used. + +This may be either a string or a function of two arguments: + +:efmt + + Use this format to print numbers with exponential. The format + should have %s twice for inserting mantissa and exponent, for + example \"%s\\\\times10^{%s}\". This may also be a property + list with column numbers and format strings or functions. + :fmt will still be applied after :efmt. + +\(fn TABLE PARAMS)" nil nil) + +(autoload 'orgtbl-to-tsv "org-table" "\ +Convert the `orgtbl-mode' TABLE to TAB separated material. + +\(fn TABLE PARAMS)" nil nil) + +(autoload 'orgtbl-to-csv "org-table" "\ +Convert the `orgtbl-mode' TABLE to CSV material. +This does take care of the proper quoting of fields with comma or quotes. + +\(fn TABLE PARAMS)" nil nil) + +(autoload 'orgtbl-to-latex "org-table" "\ +Convert the `orgtbl-mode' TABLE to LaTeX. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +supported. It is also possible to use the following ones: + +:booktabs + + When non-nil, use formal \"booktabs\" style. + +:environment + + Specify environment to use, as a string. If you use + \"longtable\", you may also want to specify :language property, + as a string, to get proper continuation strings. + +\(fn TABLE PARAMS)" nil nil) + +(autoload 'orgtbl-to-html "org-table" "\ +Convert the `orgtbl-mode' TABLE to HTML. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +supported. It is also possible to use the following one: + +:attributes + + Attributes and values, as a plist, which will be used in + <table> tag. + +\(fn TABLE PARAMS)" nil nil) + +(autoload 'orgtbl-to-texinfo "org-table" "\ +Convert the `orgtbl-mode' TABLE to Texinfo. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +supported. It is also possible to use the following one: + +:columns + + Column widths, as a string. When providing column fractions, + \"@columnfractions\" command can be omitted. + +\(fn TABLE PARAMS)" nil nil) + +(autoload 'orgtbl-to-orgtbl "org-table" "\ +Convert the `orgtbl-mode' TABLE into another orgtbl-mode table. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +supported. + +Useful when slicing one table into many. The :hline, :sep, +:lstart, and :lend provide orgtbl framing. :tstart and :tend can +be set to provide ORGTBL directives for the generated table. + +\(fn TABLE PARAMS)" nil nil) + +(autoload 'orgtbl-ascii-plot "org-table" "\ +Draw an ASCII bar plot in a column. + +With cursor in a column containing numerical values, this function +will draw a plot in a new column. + +ASK, if given, is a numeric prefix to override the default 12 +characters width of the plot. ASK may also be the `\\[universal-argument]' prefix, +which will prompt for the width. + +\(fn &optional ASK)" t nil) + +;;;*** + +;;;### (autoloads nil "org-tempo" "org-tempo.el" (0 0 0 0)) +;;; Generated autoloads from org-tempo.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-tempo" '("org-tempo-"))) + +;;;*** + +;;;### (autoloads nil "org-timer" "org-timer.el" "75e6b4a24097d5c0fcac8b141b65ca47") +;;; Generated autoloads from org-timer.el + +(autoload 'org-timer-start "org-timer" "\ +Set the starting time for the relative timer to now. +When called with prefix argument OFFSET, prompt the user for an offset time, +with the default taken from a timer stamp at point, if any. +If OFFSET is a string or an integer, it is directly taken to be the offset +without user interaction. +When called with a double prefix arg, all timer strings in the active +region will be shifted by a specific amount. You will be prompted for +the amount, with the default to make the first timer string in +the region 0:00:00. + +\(fn &optional OFFSET)" t nil) + +(autoload 'org-timer-pause-or-continue "org-timer" "\ +Pause or continue the relative or countdown timer. +With prefix arg STOP, stop it entirely. + +\(fn &optional STOP)" t nil) + +(autoload 'org-timer-stop "org-timer" "\ +Stop the relative or countdown timer." t nil) + +(autoload 'org-timer "org-timer" "\ +Insert a H:MM:SS string from the timer into the buffer. +The first time this command is used, the timer is started. + +When used with a `\\[universal-argument]' prefix, force restarting the timer. + +When used with a `\\[universal-argument] \\[universal-argument]' prefix, change all the timer strings +in the region by a fixed amount. This can be used to re-calibrate +a timer that was not started at the correct moment. + +If NO-INSERT is non-nil, return the string instead of inserting +it in the buffer. + +\(fn &optional RESTART NO-INSERT)" t nil) + +(autoload 'org-timer-change-times-in-region "org-timer" "\ +Change all h:mm:ss time in region by a DELTA. + +\(fn BEG END DELTA)" t nil) + +(autoload 'org-timer-item "org-timer" "\ +Insert a description-type item with the current timer value. + +\(fn &optional ARG)" t nil) + +(autoload 'org-timer-set-timer "org-timer" "\ +Prompt for a duration in minutes or hh:mm:ss and set a timer. + +If `org-timer-default-timer' is not \"0\", suggest this value as +the default duration for the timer. If a timer is already set, +prompt the user if she wants to replace it. + +Called with a numeric prefix argument, use this numeric value as +the duration of the timer in minutes. + +Called with a \\[universal-argument] prefix arguments, use `org-timer-default-timer' +without prompting the user for a duration. + +With two \\[universal-argument] prefix arguments, use `org-timer-default-timer' +without prompting the user for a duration and automatically +replace any running timer. + +By default, the timer duration will be set to the number of +minutes in the Effort property, if any. You can ignore this by +using three \\[universal-argument] prefix arguments. + +\(fn &optional OPT)" t nil) + +;;;*** + +;;;### (autoloads nil "org-version" "org-version.el" (0 0 0 0)) +;;; Generated autoloads from org-version.el + +(autoload 'org-release "org-version" "\ +The release version of Org. +Inserted by installing Org mode or when a release is made." nil nil) + +(autoload 'org-git-version "org-version" "\ +The Git version of Org mode. +Inserted by installing Org or when a release is made." nil nil) + +;;;*** + +;;;### (autoloads nil "org" "org.el" (0 0 0 0)) +;;; Generated autoloads from org.el + +(autoload 'org-babel-do-load-languages "org" "\ +Load the languages defined in `org-babel-load-languages'. + +\(fn SYM VALUE)" nil nil) + +(autoload 'org-babel-load-file "org" "\ +Load Emacs Lisp source code blocks in the Org FILE. +This function exports the source code using `org-babel-tangle' +and then loads the resulting file using `load-file'. With +optional prefix argument COMPILE, the tangled Emacs Lisp file is +byte-compiled before it is loaded. + +\(fn FILE &optional COMPILE)" t nil) + +(autoload 'org-version "org" "\ +Show the Org version. +Interactively, or when MESSAGE is non-nil, show it in echo area. +With prefix argument, or when HERE is non-nil, insert it at point. +In non-interactive uses, a reduced version string is output unless +FULL is given. + +\(fn &optional HERE FULL MESSAGE)" t nil) + +(autoload 'org-load-modules-maybe "org" "\ +Load all extensions listed in `org-modules'. + +\(fn &optional FORCE)" nil nil) + +(autoload 'org-clock-persistence-insinuate "org" "\ +Set up hooks for clock persistence." nil nil) + +(autoload 'org-mode "org" "\ +Outline-based notes management and organizer, alias +\"Carsten's outline-mode for keeping track of everything.\" + +Org mode develops organizational tasks around a NOTES file which +contains information about projects as plain text. Org mode is +implemented on top of Outline mode, which is ideal to keep the content +of large files well structured. It supports ToDo items, deadlines and +time stamps, which magically appear in the diary listing of the Emacs +calendar. Tables are easily created with a built-in table editor. +Plain text URL-like links connect to websites, emails (VM), Usenet +messages (Gnus), BBDB entries, and any files related to the project. +For printing and sharing of notes, an Org file (or a part of it) +can be exported as a structured ASCII or HTML file. + +The following commands are available: + +\\{org-mode-map} + +\(fn)" t nil) + +(autoload 'org-cycle "org" "\ +TAB-action and visibility cycling for Org mode. + +This is the command invoked in Org mode by the `TAB' key. Its main +purpose is outline visibility cycling, but it also invokes other actions +in special contexts. + +When this function is called with a `\\[universal-argument]' prefix, rotate the entire +buffer through 3 states (global cycling) + 1. OVERVIEW: Show only top-level headlines. + 2. CONTENTS: Show all headlines of all levels, but no body text. + 3. SHOW ALL: Show everything. + +With a `\\[universal-argument] \\[universal-argument]' prefix argument, switch to the startup visibility, +determined by the variable `org-startup-folded', and by any VISIBILITY +properties in the buffer. + +With a `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix argument, show the entire buffer, including +any drawers. + +When inside a table, re-align the table and move to the next field. + +When point is at the beginning of a headline, rotate the subtree started +by this line through 3 different states (local cycling) + 1. FOLDED: Only the main headline is shown. + 2. CHILDREN: The main headline and the direct children are shown. + From this state, you can move to one of the children + and zoom in further. + 3. SUBTREE: Show the entire subtree, including body text. +If there is no subtree, switch directly from CHILDREN to FOLDED. + +When point is at the beginning of an empty headline and the variable +`org-cycle-level-after-item/entry-creation' is set, cycle the level +of the headline by demoting and promoting it to likely levels. This +speeds up creation document structure by pressing `TAB' once or several +times right after creating a new headline. + +When there is a numeric prefix, go up to a heading with level ARG, do +a `show-subtree' and return to the previous cursor position. If ARG +is negative, go up that many levels. + +When point is not at the beginning of a headline, execute the global +binding for `TAB', which is re-indenting the line. See the option +`org-cycle-emulate-tab' for details. + +As a special case, if point is at the very beginning of the buffer, if +there is no headline there, and if the variable `org-cycle-global-at-bob' +is non-nil, this function acts as if called with prefix argument (`\\[universal-argument] TAB', +same as `S-TAB') also when called without prefix argument. + +\(fn &optional ARG)" t nil) + +(autoload 'org-global-cycle "org" "\ +Cycle the global visibility. For details see `org-cycle'. +With `\\[universal-argument]' prefix ARG, switch to startup visibility. +With a numeric prefix, show all headlines up to that level. + +\(fn &optional ARG)" t nil) + +(autoload 'org-run-like-in-org-mode "org" "\ +Run a command, pretending that the current buffer is in Org mode. +This will temporarily bind local variables that are typically bound in +Org mode to the values they have in Org mode, and then interactively +call CMD. + +\(fn CMD)" nil nil) + +(autoload 'org-open-file "org" "\ +Open the file at PATH. +First, this expands any special file name abbreviations. Then the +configuration variable `org-file-apps' is checked if it contains an +entry for this file type, and if yes, the corresponding command is launched. + +If no application is found, Emacs simply visits the file. + +With optional prefix argument IN-EMACS, Emacs will visit the file. +With a double \\[universal-argument] \\[universal-argument] prefix arg, Org tries to avoid opening in Emacs +and to use an external application to visit the file. + +Optional LINE specifies a line to go to, optional SEARCH a string +to search for. If LINE or SEARCH is given, the file will be +opened in Emacs, unless an entry from `org-file-apps' that makes +use of groups in a regexp matches. + +If you want to change the way frames are used when following a +link, please customize `org-link-frame-setup'. + +If the file does not exist, throw an error. + +\(fn PATH &optional IN-EMACS LINE SEARCH)" nil nil) + +(autoload 'org-open-at-point-global "org" "\ +Follow a link or a time-stamp like Org mode does. +Also follow links and emails as seen by `thing-at-point'. +This command can be called in any mode to follow an external +link or a time-stamp that has Org mode syntax. Its behavior +is undefined when called on internal links like fuzzy links. +Raise a user error when there is nothing to follow." t nil) + +(autoload 'org-offer-links-in-entry "org" "\ +Offer links in the current entry and return the selected link. +If there is only one link, return it. +If NTH is an integer, return the NTH link found. +If ZERO is a string, check also this string for a link, and if +there is one, return it. + +\(fn BUFFER MARKER &optional NTH ZERO)" nil nil) + +(autoload 'org-switchb "org" "\ +Switch between Org buffers. + +With `\\[universal-argument]' prefix, restrict available buffers to files. + +With `\\[universal-argument] \\[universal-argument]' prefix, restrict available buffers to agenda files. + +\(fn &optional ARG)" t nil) + +(autoload 'org-cycle-agenda-files "org" "\ +Cycle through the files in `org-agenda-files'. +If the current buffer visits an agenda file, find the next one in the list. +If the current buffer does not, find the first agenda file." t nil) + +(autoload 'org-submit-bug-report "org" "\ +Submit a bug report on Org via mail. + +Don't hesitate to report any problems or inaccurate documentation. + +If you don't have setup sending mail from (X)Emacs, please copy the +output buffer into your mail program, as it gives us important +information about your Org version and configuration." t nil) + +(autoload 'org-reload "org" "\ +Reload all Org Lisp files. +With prefix arg UNCOMPILED, load the uncompiled versions. + +\(fn &optional UNCOMPILED)" t nil) + +(autoload 'org-customize "org" "\ +Call the customize function with org as argument." t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org" '("org-" "turn-on-org-cdlatex"))) + +;;;*** + +;;;### (autoloads nil "ox" "ox.el" "fce0b99b801c9b81cf28c50bc6218e8e") +;;; Generated autoloads from ox.el + +(autoload 'org-export-get-backend "ox" "\ +Return export back-end named after NAME. +NAME is a symbol. Return nil if no such back-end is found. + +\(fn NAME)" nil nil) + +(autoload 'org-export-derived-backend-p "ox" "\ +Non-nil if BACKEND is derived from one of BACKENDS. +BACKEND is an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. BACKENDS is constituted of symbols. + +\(fn BACKEND &rest BACKENDS)" nil nil) + +(autoload 'org-export-get-environment "ox" "\ +Collect export options from the current buffer. + +Optional argument BACKEND is an export back-end, as returned by +`org-export-create-backend'. + +When optional argument SUBTREEP is non-nil, assume the export is +done against the current sub-tree. + +Third optional argument EXT-PLIST is a property list with +external parameters overriding Org default settings, but still +inferior to file-local settings. + +\(fn &optional BACKEND SUBTREEP EXT-PLIST)" nil nil) + +(autoload 'org-export-data "ox" "\ +Convert DATA into current back-end format. + +DATA is a parse tree, an element or an object or a secondary +string. INFO is a plist holding export options. + +Return a string. + +\(fn DATA INFO)" nil nil) + +(autoload 'org-export-as "ox" "\ +Transcode current Org buffer into BACKEND code. + +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. + +If narrowing is active in the current buffer, only transcode its +narrowed part. + +If a region is active, transcode that region. + +When optional argument SUBTREEP is non-nil, transcode the +sub-tree at point, extracting information from the headline +properties first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only return body +code, without surrounding template. + +Optional argument EXT-PLIST, when provided, is a property list +with external parameters overriding Org default settings, but +still inferior to file-local settings. + +Return code as a string. + +\(fn BACKEND &optional SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" nil nil) + +(autoload 'org-export-string-as "ox" "\ +Transcode STRING into BACKEND code. + +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. + +When optional argument BODY-ONLY is non-nil, only return body +code, without preamble nor postamble. + +Optional argument EXT-PLIST, when provided, is a property list +with external parameters overriding Org default settings, but +still inferior to file-local settings. + +Return code as a string. + +\(fn STRING BACKEND &optional BODY-ONLY EXT-PLIST)" nil nil) + +(autoload 'org-export-replace-region-by "ox" "\ +Replace the active region by its export to BACKEND. +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. + +\(fn BACKEND)" nil nil) + +(autoload 'org-export-insert-default-template "ox" "\ +Insert all export keywords with default values at beginning of line. + +BACKEND is a symbol referring to the name of a registered export +back-end, for which specific export options should be added to +the template, or `default' for default template. When it is nil, +the user will be prompted for a category. + +If SUBTREEP is non-nil, export configuration will be set up +locally for the subtree through node properties. + +\(fn &optional BACKEND SUBTREEP)" t nil) + +(autoload 'org-export-raw-string "ox" "\ +Return a raw object containing string S. +A raw string is exported as-is, with no additional processing +from the export back-end. + +\(fn S)" nil nil) + +(autoload 'org-export-to-buffer "ox" "\ +Call `org-export-as' with output to a specified buffer. + +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. + +BUFFER is the name of the output buffer. If it already exists, +it will be erased first, otherwise, it will be created. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should then be accessible +through the `org-export-stack' interface. When ASYNC is nil, the +buffer is displayed if `org-export-show-temporary-export-buffer' +is non-nil. + +Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and +EXT-PLIST are similar to those used in `org-export-as', which +see. + +Optional argument POST-PROCESS is a function which should accept +no argument. It is always called within the current process, +from BUFFER, with point at its beginning. Export back-ends can +use it to set a major mode there, e.g, + + (defun org-latex-export-as-latex + (&optional async subtreep visible-only body-only ext-plist) + (interactive) + (org-export-to-buffer \\='latex \"*Org LATEX Export*\" + async subtreep visible-only body-only ext-plist + #'LaTeX-mode)) + +When expressed as an anonymous function, using `lambda', +POST-PROCESS needs to be quoted. + +This function returns BUFFER. + +\(fn BACKEND BUFFER &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST POST-PROCESS)" nil nil) + +(function-put 'org-export-to-buffer 'lisp-indent-function '2) + +(autoload 'org-export-to-file "ox" "\ +Call `org-export-as' with output to a specified file. + +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. FILE is the name of the output file, as +a string. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer will then be accessible +through the `org-export-stack' interface. + +Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and +EXT-PLIST are similar to those used in `org-export-as', which +see. + +Optional argument POST-PROCESS is called with FILE as its +argument and happens asynchronously when ASYNC is non-nil. It +has to return a file name, or nil. Export back-ends can use this +to send the output file through additional processing, e.g, + + (defun org-latex-export-to-latex + (&optional async subtreep visible-only body-only ext-plist) + (interactive) + (let ((outfile (org-export-output-file-name \".tex\" subtreep))) + (org-export-to-file \\='latex outfile + async subtreep visible-only body-only ext-plist + #'org-latex-compile))) + +When expressed as an anonymous function, using `lambda', +POST-PROCESS needs to be quoted. + +The function returns either a file name returned by POST-PROCESS, +or FILE. + +\(fn BACKEND FILE &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST POST-PROCESS)" nil nil) + +(function-put 'org-export-to-file 'lisp-indent-function '2) + +(autoload 'org-export-dispatch "ox" "\ +Export dispatcher for Org mode. + +It provides an access to common export related tasks in a buffer. +Its interface comes in two flavors: standard and expert. + +While both share the same set of bindings, only the former +displays the valid keys associations in a dedicated buffer. +Scrolling (resp. line-wise motion) in this buffer is done with +SPC and DEL (resp. C-n and C-p) keys. + +Set variable `org-export-dispatch-use-expert-ui' to switch to one +flavor or the other. + +When ARG is `\\[universal-argument]', repeat the last export action, with the same +set of options used back then, on the current buffer. + +When ARG is `\\[universal-argument] \\[universal-argument]', display the asynchronous export stack. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "ox-ascii" "ox-ascii.el" "6da0b9d11d3a8bbf67418522ae750701") +;;; Generated autoloads from ox-ascii.el + +(autoload 'org-ascii-convert-region-to-ascii "ox-ascii" "\ +Assume region has Org syntax, and convert it to plain ASCII." t nil) + +(autoload 'org-ascii-convert-region-to-utf8 "ox-ascii" "\ +Assume region has Org syntax, and convert it to UTF-8." t nil) + +(autoload 'org-ascii-export-as-ascii "ox-ascii" "\ +Export current buffer to a text buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, strip title and +table of contents from output. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org ASCII Export*\", which +will be displayed when `org-export-show-temporary-export-buffer' +is non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-ascii-export-to-ascii "ox-ascii" "\ +Export current buffer to a text file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, strip title and +table of contents from output. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-ascii-publish-to-ascii "ox-ascii" "\ +Publish an Org file to ASCII. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +(autoload 'org-ascii-publish-to-latin1 "ox-ascii" "\ +Publish an Org file to Latin-1. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +(autoload 'org-ascii-publish-to-utf8 "ox-ascii" "\ +Publish an org file to UTF-8. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +;;;*** + +;;;### (autoloads nil "ox-beamer" "ox-beamer.el" "807324453f67944065d6e758022d94fa") +;;; Generated autoloads from ox-beamer.el + +(autoload 'org-beamer-mode "ox-beamer" "\ +Support for editing Beamer oriented Org mode files. + +If called interactively, enable Org-Beamer mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. + +\(fn &optional ARG)" t nil) + +(autoload 'org-beamer-export-as-latex "ox-beamer" "\ +Export current buffer as a Beamer buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org BEAMER Export*\", which +will be displayed when `org-export-show-temporary-export-buffer' +is non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-beamer-export-to-latex "ox-beamer" "\ +Export current buffer as a Beamer presentation (tex). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-beamer-export-to-pdf "ox-beamer" "\ +Export current buffer as a Beamer presentation (PDF). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return PDF file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-beamer-select-environment "ox-beamer" "\ +Select the environment to be used by beamer for this entry. +While this uses (for convenience) a tag selection interface, the +result of this command will be that the BEAMER_env *property* of +the entry is set. + +In addition to this, the command will also set a tag as a visual +aid, but the tag does not have any semantic meaning." t nil) + +(autoload 'org-beamer-publish-to-latex "ox-beamer" "\ +Publish an Org file to a Beamer presentation (LaTeX). + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +(autoload 'org-beamer-publish-to-pdf "ox-beamer" "\ +Publish an Org file to a Beamer presentation (PDF, via LaTeX). + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +;;;*** + +;;;### (autoloads nil "ox-html" "ox-html.el" "f7468dd6deceb9c83ecb7f97defdcfaf") +;;; Generated autoloads from ox-html.el + +(put 'org-html-head-include-default-style 'safe-local-variable 'booleanp) + +(put 'org-html-head 'safe-local-variable 'stringp) + +(put 'org-html-head-extra 'safe-local-variable 'stringp) + +(autoload 'org-html-htmlize-generate-css "ox-html" "\ +Create the CSS for all font definitions in the current Emacs session. +Use this to create face definitions in your CSS style file that can then +be used by code snippets transformed by htmlize. +This command just produces a buffer that contains class definitions for all +faces used in the current Emacs session. You can copy and paste the ones you +need into your CSS file. + +If you then set `org-html-htmlize-output-type' to `css', calls +to the function `org-html-htmlize-region-for-paste' will +produce code that uses these same face definitions." t nil) + +(autoload 'org-html-export-as-html "ox-html" "\ +Export current buffer to an HTML buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"<body>\" and \"</body>\" tags. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org HTML Export*\", which +will be displayed when `org-export-show-temporary-export-buffer' +is non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-html-convert-region-to-html "ox-html" "\ +Assume the current region has Org syntax, and convert it to HTML. +This can be used in any buffer. For example, you can write an +itemized list in Org syntax in an HTML buffer and use this command +to convert it." t nil) + +(autoload 'org-html-export-to-html "ox-html" "\ +Export current buffer to a HTML file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"<body>\" and \"</body>\" tags. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-html-publish-to-html "ox-html" "\ +Publish an org file to HTML. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +;;;*** + +;;;### (autoloads nil "ox-icalendar" "ox-icalendar.el" "650f4a57adb693d64b07f18d5a4664b4") +;;; Generated autoloads from ox-icalendar.el + +(autoload 'org-icalendar-export-to-ics "ox-icalendar" "\ +Export current buffer to an iCalendar file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"BEGIN:VCALENDAR\" and \"END:VCALENDAR\". + +Return ICS file name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY)" t nil) + +(autoload 'org-icalendar-export-agenda-files "ox-icalendar" "\ +Export all agenda files to iCalendar files. +When optional argument ASYNC is non-nil, export happens in an +external process. + +\(fn &optional ASYNC)" t nil) + +(autoload 'org-icalendar-combine-agenda-files "ox-icalendar" "\ +Combine all agenda files into a single iCalendar file. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +The file is stored under the name chosen in +`org-icalendar-combined-agenda-file'. + +\(fn &optional ASYNC)" t nil) + +;;;*** + +;;;### (autoloads nil "ox-koma-letter" "ox-koma-letter.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from ox-koma-letter.el + +(autoload 'org-koma-letter-export-as-latex "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org KOMA-LETTER Export*\". It +will be displayed if `org-export-show-temporary-export-buffer' is +non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-koma-letter-export-to-latex "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter (tex). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +When optional argument PUB-DIR is set, use it as the publishing +directory. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-koma-letter-export-to-pdf "ox-koma-letter" "\ +Export current buffer as a KOMA Scrlttr2 letter (pdf). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return PDF file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-koma-letter" '("org-koma-letter-"))) + +;;;*** + +;;;### (autoloads nil "ox-latex" "ox-latex.el" "607c6ea48b6de117fe755f8f3be63ee9") +;;; Generated autoloads from ox-latex.el + +(autoload 'org-latex-make-preamble "ox-latex" "\ +Return a formatted LaTeX preamble. +INFO is a plist used as a communication channel. Optional +argument TEMPLATE, when non-nil, is the header template string, +as expected by `org-splice-latex-header'. When SNIPPET? is +non-nil, only includes packages relevant to image generation, as +specified in `org-latex-default-packages-alist' or +`org-latex-packages-alist'. + +\(fn INFO &optional TEMPLATE SNIPPET\\=\\?)" nil nil) + +(autoload 'org-latex-export-as-latex "ox-latex" "\ +Export current buffer as a LaTeX buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org LATEX Export*\", which +will be displayed when `org-export-show-temporary-export-buffer' +is non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-latex-convert-region-to-latex "ox-latex" "\ +Assume the current region has Org syntax, and convert it to LaTeX. +This can be used in any buffer. For example, you can write an +itemized list in Org syntax in an LaTeX buffer and use this +command to convert it." t nil) + +(autoload 'org-latex-export-to-latex "ox-latex" "\ +Export current buffer to a LaTeX file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-latex-export-to-pdf "ox-latex" "\ +Export current buffer to LaTeX then process through to PDF. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return PDF file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-latex-publish-to-latex "ox-latex" "\ +Publish an Org file to LaTeX. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +(autoload 'org-latex-publish-to-pdf "ox-latex" "\ +Publish an Org file to PDF (via LaTeX). + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +;;;*** + +;;;### (autoloads nil "ox-man" "ox-man.el" (0 0 0 0)) +;;; Generated autoloads from ox-man.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox-man" '("org-man-"))) + +;;;*** + +;;;### (autoloads nil "ox-md" "ox-md.el" "2b399d8c10668d24b7733db17b2861c2") +;;; Generated autoloads from ox-md.el + +(autoload 'org-md-export-as-markdown "ox-md" "\ +Export current buffer to a Markdown buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +Export is done in a buffer named \"*Org MD Export*\", which will +be displayed when `org-export-show-temporary-export-buffer' is +non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY)" t nil) + +(autoload 'org-md-convert-region-to-md "ox-md" "\ +Assume the current region has Org syntax, and convert it to Markdown. +This can be used in any buffer. For example, you can write an +itemized list in Org syntax in a Markdown buffer and use +this command to convert it." t nil) + +(autoload 'org-md-export-to-markdown "ox-md" "\ +Export current buffer to a Markdown file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY)" t nil) + +(autoload 'org-md-publish-to-md "ox-md" "\ +Publish an org file to Markdown. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +;;;*** + +;;;### (autoloads nil "ox-odt" "ox-odt.el" "2fea0df26eda2199b93c7af143ff5bd6") +;;; Generated autoloads from ox-odt.el + +(put 'org-odt-preferred-output-format 'safe-local-variable 'stringp) + +(autoload 'org-odt-export-as-odf "ox-odt" "\ +Export LATEX-FRAG as OpenDocument formula file ODF-FILE. +Use `org-create-math-formula' to convert LATEX-FRAG first to +MathML. When invoked as an interactive command, use +`org-latex-regexps' to infer LATEX-FRAG from currently active +region. If no LaTeX fragments are found, prompt for it. Push +MathML source to kill ring depending on the value of +`org-export-copy-to-kill-ring'. + +\(fn LATEX-FRAG &optional ODF-FILE)" t nil) + +(autoload 'org-odt-export-as-odf-and-open "ox-odt" "\ +Export LaTeX fragment as OpenDocument formula and immediately open it. +Use `org-odt-export-as-odf' to read LaTeX fragment and OpenDocument +formula file." t nil) + +(autoload 'org-odt-export-to-odt "ox-odt" "\ +Export current buffer to a ODT file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY EXT-PLIST)" t nil) + +(autoload 'org-odt-convert "ox-odt" "\ +Convert IN-FILE to format OUT-FMT using a command line converter. +IN-FILE is the file to be converted. If unspecified, it defaults +to variable `buffer-file-name'. OUT-FMT is the desired output +format. Use `org-odt-convert-process' as the converter. If OPEN +is non-nil then the newly converted file is opened using +`org-open-file'. + +\(fn &optional IN-FILE OUT-FMT OPEN)" t nil) + +;;;*** + +;;;### (autoloads nil "ox-org" "ox-org.el" "06cc9b2debce400a895409334551f10c") +;;; Generated autoloads from ox-org.el + +(autoload 'org-org-export-as-org "ox-org" "\ +Export current buffer to an Org buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, strip document +keywords from output. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org ORG Export*\", which will +be displayed when `org-export-show-temporary-export-buffer' is +non-nil. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-org-export-to-org "ox-org" "\ +Export current buffer to an Org file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, strip document +keywords from output. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-org-publish-to-org "ox-org" "\ +Publish an Org file to Org. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +;;;*** + +;;;### (autoloads nil "ox-publish" "ox-publish.el" "5a31bb72e99716b09561f75cfdf6f8ca") +;;; Generated autoloads from ox-publish.el + +(defalias 'org-publish-project 'org-publish) + +(autoload 'org-publish "ox-publish" "\ +Publish PROJECT. + +PROJECT is either a project name, as a string, or a project +alist (see `org-publish-project-alist' variable). + +When optional argument FORCE is non-nil, force publishing all +files in PROJECT. With a non-nil optional argument ASYNC, +publishing will be done asynchronously, in another process. + +\(fn PROJECT &optional FORCE ASYNC)" t nil) + +(autoload 'org-publish-all "ox-publish" "\ +Publish all projects. +With prefix argument FORCE, remove all files in the timestamp +directory and force publishing all projects. With a non-nil +optional argument ASYNC, publishing will be done asynchronously, +in another process. + +\(fn &optional FORCE ASYNC)" t nil) + +(autoload 'org-publish-current-file "ox-publish" "\ +Publish the current file. +With prefix argument FORCE, force publish the file. When +optional argument ASYNC is non-nil, publishing will be done +asynchronously, in another process. + +\(fn &optional FORCE ASYNC)" t nil) + +(autoload 'org-publish-current-project "ox-publish" "\ +Publish the project associated with the current file. +With a prefix argument, force publishing of all files in +the project. + +\(fn &optional FORCE ASYNC)" t nil) + +;;;*** + +;;;### (autoloads nil "ox-texinfo" "ox-texinfo.el" "e166211f62dbf7117777f8840ff4c2a6") +;;; Generated autoloads from ox-texinfo.el + +(autoload 'org-texinfo-export-to-texinfo "ox-texinfo" "\ +Export current buffer to a Texinfo file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-texinfo-export-to-info "ox-texinfo" "\ +Export current buffer to Texinfo then process through to INFO. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +When optional argument PUB-DIR is set, use it as the publishing +directory. + +Return INFO file's name. + +\(fn &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" t nil) + +(autoload 'org-texinfo-publish-to-texinfo "ox-texinfo" "\ +Publish an org file to Texinfo. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name. + +\(fn PLIST FILENAME PUB-DIR)" nil nil) + +(autoload 'org-texinfo-convert-region-to-texinfo "ox-texinfo" "\ +Assume the current region has Org syntax, and convert it to Texinfo. +This can be used in any buffer. For example, you can write an +itemized list in Org syntax in an Texinfo buffer and use this +command to convert it." t nil) + +;;;*** + +;;;### (autoloads nil "ox" "ox.el" (0 0 0 0)) +;;; Generated autoloads from ox.el + +(autoload 'org-export-get-backend "ox" "\ +Return export back-end named after NAME. +NAME is a symbol. Return nil if no such back-end is found. + +\(fn NAME)" nil nil) + +(autoload 'org-export-derived-backend-p "ox" "\ +Non-nil if BACKEND is derived from one of BACKENDS. +BACKEND is an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. BACKENDS is constituted of symbols. + +\(fn BACKEND &rest BACKENDS)" nil nil) + +(autoload 'org-export-get-environment "ox" "\ +Collect export options from the current buffer. + +Optional argument BACKEND is an export back-end, as returned by +`org-export-create-backend'. + +When optional argument SUBTREEP is non-nil, assume the export is +done against the current sub-tree. + +Third optional argument EXT-PLIST is a property list with +external parameters overriding Org default settings, but still +inferior to file-local settings. + +\(fn &optional BACKEND SUBTREEP EXT-PLIST)" nil nil) + +(autoload 'org-export-data "ox" "\ +Convert DATA into current back-end format. + +DATA is a parse tree, an element or an object or a secondary +string. INFO is a plist holding export options. + +Return a string. + +\(fn DATA INFO)" nil nil) + +(autoload 'org-export-as "ox" "\ +Transcode current Org buffer into BACKEND code. + +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. + +If narrowing is active in the current buffer, only transcode its +narrowed part. + +If a region is active, transcode that region. + +When optional argument SUBTREEP is non-nil, transcode the +sub-tree at point, extracting information from the headline +properties first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only return body +code, without surrounding template. + +Optional argument EXT-PLIST, when provided, is a property list +with external parameters overriding Org default settings, but +still inferior to file-local settings. + +Return code as a string. + +\(fn BACKEND &optional SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST)" nil nil) + +(autoload 'org-export-string-as "ox" "\ +Transcode STRING into BACKEND code. + +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. + +When optional argument BODY-ONLY is non-nil, only return body +code, without preamble nor postamble. + +Optional argument EXT-PLIST, when provided, is a property list +with external parameters overriding Org default settings, but +still inferior to file-local settings. + +Return code as a string. + +\(fn STRING BACKEND &optional BODY-ONLY EXT-PLIST)" nil nil) + +(autoload 'org-export-replace-region-by "ox" "\ +Replace the active region by its export to BACKEND. +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. + +\(fn BACKEND)" nil nil) + +(autoload 'org-export-insert-default-template "ox" "\ +Insert all export keywords with default values at beginning of line. + +BACKEND is a symbol referring to the name of a registered export +back-end, for which specific export options should be added to +the template, or `default' for default template. When it is nil, +the user will be prompted for a category. + +If SUBTREEP is non-nil, export configuration will be set up +locally for the subtree through node properties. + +\(fn &optional BACKEND SUBTREEP)" t nil) + +(autoload 'org-export-raw-string "ox" "\ +Return a raw object containing string S. +A raw string is exported as-is, with no additional processing +from the export back-end. + +\(fn S)" nil nil) + +(autoload 'org-export-to-buffer "ox" "\ +Call `org-export-as' with output to a specified buffer. + +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. + +BUFFER is the name of the output buffer. If it already exists, +it will be erased first, otherwise, it will be created. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should then be accessible +through the `org-export-stack' interface. When ASYNC is nil, the +buffer is displayed if `org-export-show-temporary-export-buffer' +is non-nil. + +Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and +EXT-PLIST are similar to those used in `org-export-as', which +see. + +Optional argument POST-PROCESS is a function which should accept +no argument. It is always called within the current process, +from BUFFER, with point at its beginning. Export back-ends can +use it to set a major mode there, e.g, + + (defun org-latex-export-as-latex + (&optional async subtreep visible-only body-only ext-plist) + (interactive) + (org-export-to-buffer \\='latex \"*Org LATEX Export*\" + async subtreep visible-only body-only ext-plist + #'LaTeX-mode)) + +When expressed as an anonymous function, using `lambda', +POST-PROCESS needs to be quoted. + +This function returns BUFFER. + +\(fn BACKEND BUFFER &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST POST-PROCESS)" nil nil) + +(function-put 'org-export-to-buffer 'lisp-indent-function '2) + +(autoload 'org-export-to-file "ox" "\ +Call `org-export-as' with output to a specified file. + +BACKEND is either an export back-end, as returned by, e.g., +`org-export-create-backend', or a symbol referring to +a registered back-end. FILE is the name of the output file, as +a string. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer will then be accessible +through the `org-export-stack' interface. + +Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and +EXT-PLIST are similar to those used in `org-export-as', which +see. + +Optional argument POST-PROCESS is called with FILE as its +argument and happens asynchronously when ASYNC is non-nil. It +has to return a file name, or nil. Export back-ends can use this +to send the output file through additional processing, e.g, + + (defun org-latex-export-to-latex + (&optional async subtreep visible-only body-only ext-plist) + (interactive) + (let ((outfile (org-export-output-file-name \".tex\" subtreep))) + (org-export-to-file \\='latex outfile + async subtreep visible-only body-only ext-plist + #'org-latex-compile))) + +When expressed as an anonymous function, using `lambda', +POST-PROCESS needs to be quoted. + +The function returns either a file name returned by POST-PROCESS, +or FILE. + +\(fn BACKEND FILE &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST POST-PROCESS)" nil nil) + +(function-put 'org-export-to-file 'lisp-indent-function '2) + +(autoload 'org-export-dispatch "ox" "\ +Export dispatcher for Org mode. + +It provides an access to common export related tasks in a buffer. +Its interface comes in two flavors: standard and expert. + +While both share the same set of bindings, only the former +displays the valid keys associations in a dedicated buffer. +Scrolling (resp. line-wise motion) in this buffer is done with +SPC and DEL (resp. C-n and C-p) keys. + +Set variable `org-export-dispatch-use-expert-ui' to switch to one +flavor or the other. + +When ARG is `\\[universal-argument]', repeat the last export action, with the same +set of options used back then, on the current buffer. + +When ARG is `\\[universal-argument] \\[universal-argument]', display the asynchronous export stack. + +\(fn &optional ARG)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ox" '("org-export-"))) + +;;;*** + +(provide 'org-loaddefs) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; org-loaddefs.el ends here diff --git a/elpa/org-9.5.2/org-macro.el b/elpa/org-9.5.2/org-macro.el new file mode 100644 index 0000000..c0287a2 --- /dev/null +++ b/elpa/org-9.5.2/org-macro.el @@ -0,0 +1,421 @@ +;;; org-macro.el --- Macro Replacement Code for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2013-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou <n.goaziou@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Macros are expanded with `org-macro-replace-all', which relies +;; internally on `org-macro-expand'. + +;; Default templates for expansion are stored in the buffer-local +;; variable `org-macro-templates'. This variable is updated by +;; `org-macro-initialize-templates', which recursively calls +;; `org-macro--collect-macros' in order to read setup files. + +;; Argument in macros are separated with commas. Proper escaping rules +;; are implemented in `org-macro-escape-arguments' and arguments can +;; be extracted from a string with `org-macro-extract-arguments'. + +;; Along with macros defined through #+MACRO: keyword, default +;; templates include the following hard-coded macros: +;; {{{time(format-string)}}}, +;; {{{property(node-property)}}}, +;; {{{input-file}}}, +;; {{{modification-time(format-string)}}}, +;; {{{n(counter,action}}}. + +;; Upon exporting, "ox.el" will also provide {{{author}}}, {{{date}}}, +;; {{{email}}} and {{{title}}} macros. + +;;; Code: +(require 'cl-lib) +(require 'org-macs) +(require 'org-compat) + +(declare-function org-collect-keywords "org" (keywords &optional unique directory)) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-context "org-element" (&optional element)) +(declare-function org-element-copy "org-element" (datum)) +(declare-function org-element-macro-parser "org-element" ()) +(declare-function org-element-parse-secondary-string "org-element" (string restriction &optional parent)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-restriction "org-element" (element)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) +(declare-function org-file-contents "org" (file &optional noerror nocache)) +(declare-function org-in-commented-heading-p "org" (&optional no-inheritance)) +(declare-function org-link-search "ol" (s &optional avoid-pos stealth)) +(declare-function org-mode "org" ()) +(declare-function vc-backend "vc-hooks" (f)) +(declare-function vc-call "vc-hooks" (fun file &rest args) t) +(declare-function vc-exec-after "vc-dispatcher" (code)) + +(defvar org-link-search-must-match-exact-headline) + +;;; Variables + +(defvar-local org-macro-templates nil + "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") + +;;; Functions + +(defun org-macro--makeargs (template) + "Compute the formal arglist to use for TEMPLATE." + (let ((max 0) (i 0)) + (while (string-match "\\$\\([0-9]+\\)" template i) + (setq i (match-end 0)) + (setq max (max max (string-to-number (match-string 1 template))))) + (let ((args '(&rest _))) + (if (< max 1) args ;Avoid `&optional &rest', refused by Emacs-26! + (while (> max 0) + (push (intern (format "$%d" max)) args) + (setq max (1- max))) + (cons '&optional args))))) + +(defun org-macro--set-templates (templates) + "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." + (let ((new-templates nil)) + (pcase-dolist (`(,name . ,value) templates) + (let ((old-definition (assoc name new-templates))) + (when (and (stringp value) (string-match-p "\\`(eval\\>" value)) + ;; Pre-process the evaluation form for faster macro expansion. + (let* ((args (org-macro--makeargs value)) + (body + (condition-case nil + ;; `value' is of the form "(eval ...)" but we + ;; don't want this to mean to pass the result to + ;; `eval' (which would cause double evaluation), + ;; so we strip the `eval' away with `cadr'. + (cadr (read value)) + (error + (user-error "Invalid definition for macro %S" name))))) + (setq value (eval (macroexpand-all `(lambda ,args ,body)) t)))) + (cond ((and value old-definition) (setcdr old-definition value)) + (old-definition) + (t (push (cons name (or value "")) new-templates))))) + new-templates)) + +(defun org-macro--collect-macros () + "Collect macro definitions in current buffer and setup files. +Return an alist containing all macro templates found." + (let ((templates + `(("author" . ,(org-macro--find-keyword-value "AUTHOR" t)) + ("email" . ,(org-macro--find-keyword-value "EMAIL")) + ("title" . ,(org-macro--find-keyword-value "TITLE" t)) + ("date" . ,(org-macro--find-date))))) + (pcase (org-collect-keywords '("MACRO")) + (`(("MACRO" . ,values)) + (dolist (value values) + (when (string-match "^\\(\\S-+\\)[ \t]*" value) + (let ((name (match-string 1 value)) + (definition (substring value (match-end 0)))) + (push (cons name definition) templates)))))) + templates)) + +(defun org-macro-initialize-templates (&optional default) + "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\"." + (require 'org-element) + (org-macro--counter-initialize) ;for "n" macro + (setq org-macro-templates + (nconc + ;; Install user-defined macros. Local macros have higher + ;; precedence than global ones. + (org-macro--set-templates (append default (org-macro--collect-macros))) + ;; Install file-specific macros. + (let ((visited-file (buffer-file-name (buffer-base-buffer)))) + (and visited-file + (file-exists-p visited-file) + (list + `("input-file" . ,(file-name-nondirectory visited-file)) + `("modification-time" . + ,(let ((modtime (file-attribute-modification-time + (file-attributes visited-file)))) + (lambda (arg1 &optional arg2 &rest _) + (format-time-string + arg1 + (or (and (org-string-nw-p arg2) + (org-macro--vc-modified-time visited-file)) + modtime)))))))) + ;; Install generic macros. + '(("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))))))) + +(defun org-macro-expand (macro templates) + "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." + (let ((template + ;; Macro names are case-insensitive. + (cdr (assoc-string (org-element-property :key macro) templates t)))) + (when template + (let* ((value + (if (functionp template) + (apply template (org-element-property :args macro)) + (replace-regexp-in-string + "\\$[0-9]+" + (lambda (m) + (or (nth (1- (string-to-number (substring m 1))) + (org-element-property :args macro)) + ;; No argument: remove place-holder. + "")) + template nil 'literal)))) + ;; Force return value to be a string. + (format "%s" (or value "")))))) + +(defun org-macro-replace-all (templates &optional keywords) + "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." + (org-with-wide-buffer + (goto-char (point-min)) + (let ((properties-regexp (format "\\`EXPORT_%s\\+?\\'" + (regexp-opt keywords))) + record) + (while (re-search-forward "{{{[-A-Za-z0-9_]" nil t) + (unless (save-match-data (org-in-commented-heading-p)) + (let* ((datum (save-match-data (org-element-context))) + (type (org-element-type datum)) + (macro + (cond + ((eq type 'macro) datum) + ;; In parsed keywords and associated node + ;; properties, force macro recognition. + ((or (and (eq type 'keyword) + (member (org-element-property :key datum) keywords)) + (and (eq type 'node-property) + (string-match-p properties-regexp + (org-element-property :key datum)))) + (save-excursion + (goto-char (match-beginning 0)) + (org-element-macro-parser)))))) + (when macro + (let* ((key (org-element-property :key macro)) + (value (org-macro-expand macro templates)) + (begin (org-element-property :begin macro)) + (signature (list begin + macro + (org-element-property :args macro)))) + ;; Avoid circular dependencies by checking if the same + ;; macro with the same arguments is expanded at the + ;; same position twice. + (cond ((member signature record) + (error "Circular macro expansion: %s" key)) + (value + (push signature record) + (delete-region + begin + ;; Preserve white spaces after the macro. + (progn (goto-char (org-element-property :end macro)) + (skip-chars-backward " \t") + (point))) + ;; Leave point before replacement in case of + ;; recursive expansions. + (save-excursion (insert value))) + ;; Special "results" macro: if it is not defined, + ;; simply leave it as-is. It will be expanded in + ;; a second phase. + ((equal key "results")) + (t + (error "Undefined Org macro: %s; aborting" + (org-element-property :key macro)))))))))))) + +(defun org-macro-escape-arguments (&rest args) + "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'." + (let ((s "")) + (dolist (arg (reverse args) (substring s 1)) + (setq s + (concat + "," + (replace-regexp-in-string + "\\(\\\\*\\)," + (lambda (m) + (concat (make-string (1+ (* 2 (length (match-string 1 m)))) ?\\) + ",")) + ;; If a non-terminal argument ends on backslashes, make + ;; sure to also escape them as they will be followed by + ;; a comma. + (concat arg (and (not (equal s "")) + (string-match "\\\\+\\'" arg) + (match-string 0 arg))) + nil t) + s))))) + +(defun org-macro-extract-arguments (s) + "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'." + ;; Do not use `org-split-string' since empty strings are + ;; meaningful here. + (split-string + (replace-regexp-in-string + "\\(\\\\*\\)," + (lambda (str) + (let ((len (length (match-string 1 str)))) + (concat (make-string (/ len 2) ?\\) + (if (zerop (mod len 2)) "\000" ",")))) + s nil t) + "\000")) + + +;;; Helper functions and variables for internal macros + +(defun org-macro--get-property (property location) + "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." + (save-excursion + (when (org-string-nw-p location) + (condition-case _ + (let ((org-link-search-must-match-exact-headline t)) + (org-link-search location nil t)) + (error + (error "Macro property failed: cannot find location %s" location)))) + (org-entry-get nil property 'selective))) + +(defun org-macro--find-keyword-value (name &optional collect) + "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." + (org-with-point-at 1 + (let ((regexp (format "^[ \t]*#\\+%s:" (regexp-quote name))) + (case-fold-search t) + (result nil)) + (catch :exit + (while (re-search-forward regexp nil t) + (let ((element (org-element-at-point))) + (when (eq 'keyword (org-element-type element)) + (let ((value (org-element-property :value element))) + (if (not collect) (throw :exit value) + (setq result (concat result " " value))))))) + (and result (org-trim result)))))) + +(defun org-macro--find-date () + "Find value for DATE in current buffer. +Return value as a string." + (let* ((value (org-macro--find-keyword-value "DATE")) + (date (org-element-parse-secondary-string + value (org-element-restriction 'keyword)))) + (if (and (consp date) + (not (cdr date)) + (eq 'timestamp (org-element-type (car date)))) + (format "(eval (if (org-string-nw-p $1) %s %S))" + (format "(org-timestamp-format '%S $1)" + (org-element-copy (car date))) + value) + value))) + +(defun org-macro--vc-modified-time (file) + (save-window-excursion + (when (vc-backend file) + (let ((buf (get-buffer-create " *org-vc*")) + (case-fold-search t) + date) + (unwind-protect + (progn + (vc-call print-log (list file) buf nil nil 1) + (with-current-buffer buf + (vc-exec-after + (lambda () + (goto-char (point-min)) + (when (re-search-forward "Date:?[ \t]*" nil t) + (let ((time (parse-time-string + (buffer-substring + (point) (line-end-position))))) + (when (cl-some #'identity time) + (setq date (apply #'encode-time time)))))))) + (let ((proc (get-buffer-process buf))) + (while (and proc (accept-process-output proc .5 nil t))))) + (kill-buffer buf)) + date)))) + +(defvar org-macro--counter-table nil + "Hash table containing counter value per name.") + +(defun org-macro--counter-initialize () + "Initialize `org-macro--counter-table'." + (setq org-macro--counter-table (make-hash-table :test #'equal))) + +(defun org-macro--counter-increment (name &optional action) + "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." + (let ((name-trimmed (if (stringp name) (org-trim name) "")) + (action-trimmed (when (org-string-nw-p action) + (org-trim action)))) + (puthash name-trimmed + (cond ((not (org-string-nw-p action-trimmed)) + (1+ (gethash name-trimmed org-macro--counter-table 0))) + ((string= "-" action-trimmed) + (gethash name-trimmed org-macro--counter-table 1)) + ((string-match-p "\\`[0-9]+\\'" action-trimmed) + (string-to-number action-trimmed)) + (t 1)) + org-macro--counter-table))) + +(provide 'org-macro) + +;;; org-macro.el ends here diff --git a/elpa/org-9.5.2/org-macro.elc b/elpa/org-9.5.2/org-macro.elc new file mode 100644 index 0000000..c4fc9b6 Binary files /dev/null and b/elpa/org-9.5.2/org-macro.elc differ diff --git a/elpa/org-9.5.2/org-macs.el b/elpa/org-9.5.2/org-macs.el new file mode 100644 index 0000000..0779c3a --- /dev/null +++ b/elpa/org-9.5.2/org-macs.el @@ -0,0 +1,1308 @@ +;;; org-macs.el --- Top-level Definitions for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains macro definitions, defsubst definitions, other +;; stuff needed for compilation and top-level forms in Org mode, as +;; well lots of small functions that are not Org mode specific but +;; simply generally useful stuff. + +;;; Code: + +(require 'cl-lib) +(require 'format-spec) + +(declare-function org-mode "org" ()) +(declare-function org-show-context "org" (&optional key)) +(declare-function org-string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case)) + +(defvar org-ts-regexp0) +(defvar ffap-url-regexp) + + +;;; Macros + +(defmacro org-with-gensyms (symbols &rest body) + (declare (debug (sexp body)) (indent 1)) + `(let ,(mapcar (lambda (s) + `(,s (make-symbol (concat "--" (symbol-name ',s))))) + symbols) + ,@body)) + +;; Use `with-silent-modifications' to ignore cosmetic changes and +;; `org-unmodified' to ignore real text modifications. +(defmacro org-unmodified (&rest body) + "Run BODY while preserving the buffer's `buffer-modified-p' state." + (declare (debug (body))) + (org-with-gensyms (was-modified) + `(let ((,was-modified (buffer-modified-p))) + (unwind-protect + (let ((buffer-undo-list t) + (inhibit-modification-hooks t)) + ,@body) + (set-buffer-modified-p ,was-modified))))) + +(defmacro org-without-partial-completion (&rest body) + (declare (debug (body))) + `(if (and (boundp 'partial-completion-mode) + partial-completion-mode + (fboundp 'partial-completion-mode)) + (unwind-protect + (progn + (partial-completion-mode -1) + ,@body) + (partial-completion-mode 1)) + ,@body)) + +(defmacro org-with-point-at (pom &rest body) + "Move to buffer and point of point-or-marker POM for the duration of BODY." + (declare (debug (form body)) (indent 1)) + (org-with-gensyms (mpom) + `(let ((,mpom ,pom)) + (save-excursion + (when (markerp ,mpom) (set-buffer (marker-buffer ,mpom))) + (org-with-wide-buffer + (goto-char (or ,mpom (point))) + ,@body))))) + +(defmacro org-with-remote-undo (buffer &rest body) + "Execute BODY while recording undo information in two buffers." + (declare (debug (form body)) (indent 1)) + (org-with-gensyms (cline cmd buf1 buf2 undo1 undo2 c1 c2) + `(let ((,cline (org-current-line)) + (,cmd this-command) + (,buf1 (current-buffer)) + (,buf2 ,buffer) + (,undo1 buffer-undo-list) + (,undo2 (with-current-buffer ,buffer buffer-undo-list)) + ,c1 ,c2) + ,@body + (when org-agenda-allow-remote-undo + (setq ,c1 (org-verify-change-for-undo + ,undo1 (with-current-buffer ,buf1 buffer-undo-list)) + ,c2 (org-verify-change-for-undo + ,undo2 (with-current-buffer ,buf2 buffer-undo-list))) + (when (or ,c1 ,c2) + ;; make sure there are undo boundaries + (and ,c1 (with-current-buffer ,buf1 (undo-boundary))) + (and ,c2 (with-current-buffer ,buf2 (undo-boundary))) + ;; remember which buffer to undo + (push (list ,cmd ,cline ,buf1 ,c1 ,buf2 ,c2) + org-agenda-undo-list)))))) + +(defmacro org-no-read-only (&rest body) + "Inhibit read-only for BODY." + (declare (debug (body))) + `(let ((inhibit-read-only t)) ,@body)) + +(defmacro org-save-outline-visibility (use-markers &rest body) + "Save and restore outline visibility around BODY. +If USE-MARKERS is non-nil, use markers for the positions. This +means that the buffer may change while running BODY, but it also +means that the buffer should stay alive during the operation, +because otherwise all these markers will point to nowhere." + (declare (debug (form body)) (indent 1)) + (org-with-gensyms (data invisible-types markers?) + `(let* ((,invisible-types '(org-hide-block outline)) + (,markers? ,use-markers) + (,data + (mapcar (lambda (o) + (let ((beg (overlay-start o)) + (end (overlay-end o)) + (type (overlay-get o 'invisible))) + (and beg end + (> end beg) + (memq type ,invisible-types) + (list (if ,markers? (copy-marker beg) beg) + (if ,markers? (copy-marker end t) end) + type)))) + (org-with-wide-buffer + (overlays-in (point-min) (point-max)))))) + (unwind-protect (progn ,@body) + (org-with-wide-buffer + (dolist (type ,invisible-types) + (remove-overlays (point-min) (point-max) 'invisible type)) + (pcase-dolist (`(,beg ,end ,type) (delq nil ,data)) + (org-flag-region beg end t type) + (when ,markers? + (set-marker beg nil) + (set-marker end nil)))))))) + +(defmacro org-with-wide-buffer (&rest body) + "Execute body while temporarily widening the buffer." + (declare (debug (body))) + `(save-excursion + (save-restriction + (widen) + ,@body))) + +(defmacro org-with-limited-levels (&rest body) + "Execute BODY with limited number of outline levels." + (declare (debug (body))) + `(progn + (defvar org-called-with-limited-levels) + (defvar org-outline-regexp) + (defvar outline-regexp) + (defvar org-outline-regexp-bol) + (let* ((org-called-with-limited-levels t) + (org-outline-regexp (org-get-limited-outline-regexp)) + (outline-regexp org-outline-regexp) + (org-outline-regexp-bol (concat "^" org-outline-regexp))) + ,@body))) + +(defmacro org-eval-in-environment (environment form) + (declare (debug (form form)) (indent 1) (obsolete cl-progv "2021")) + `(eval (list 'let ,environment ',form))) + +;;;###autoload +(defmacro org-load-noerror-mustsuffix (file) + "Load FILE with optional arguments NOERROR and MUSTSUFFIX." + `(load ,file 'noerror nil nil 'mustsuffix)) + +(defmacro org-preserve-local-variables (&rest body) + "Execute BODY while preserving local variables." + (declare (debug (body))) + `(let ((local-variables + (org-with-wide-buffer + (goto-char (point-max)) + (let ((case-fold-search t)) + (and (re-search-backward "^[ \t]*# +Local Variables:" + (max (- (point) 3000) 1) + t) + (delete-and-extract-region (point) (point-max))))))) + (unwind-protect (progn ,@body) + (when local-variables + (org-with-wide-buffer + (goto-char (point-max)) + ;; If last section is folded, make sure to also hide file + ;; local variables after inserting them back. + (let ((overlay + (cl-find-if (lambda (o) + (eq 'outline (overlay-get o 'invisible))) + (overlays-at (1- (point)))))) + (unless (bolp) (insert "\n")) + (insert local-variables) + (when overlay + (move-overlay overlay (overlay-start overlay) (point-max))))))))) + +(defmacro org-no-popups (&rest body) + "Suppress popup windows and evaluate BODY." + `(let (pop-up-frames pop-up-windows) + ,@body)) + + +;;; Buffer and windows + +(defun org-base-buffer (buffer) + "Return the base buffer of BUFFER, if it has one. Else return the buffer." + (when buffer + (or (buffer-base-buffer buffer) + buffer))) + +(defun org-find-base-buffer-visiting (file) + "Like `find-buffer-visiting' but always return the base buffer and +not an indirect buffer." + (let ((buf (or (get-file-buffer file) + (find-buffer-visiting file)))) + (org-base-buffer buf))) + +(defun org-switch-to-buffer-other-window (&rest args) + "Switch to buffer in a second window on the current frame. +In particular, do not allow pop-up frames. +Returns the newly created buffer." + (org-no-popups (apply #'switch-to-buffer-other-window args))) + +(defun org-fit-window-to-buffer (&optional window max-height min-height + shrink-only) + "Fit WINDOW to the buffer, but only if it is not a side-by-side window. +WINDOW defaults to the selected window. MAX-HEIGHT and MIN-HEIGHT are +passed through to `fit-window-to-buffer'. If SHRINK-ONLY is set, call +`shrink-window-if-larger-than-buffer' instead, the height limit is +ignored in this case." + (cond ((if (fboundp 'window-full-width-p) + (not (window-full-width-p window)) + ;; Do nothing if another window would suffer. + (> (frame-width) (window-width window)))) + ((and (fboundp 'fit-window-to-buffer) (not shrink-only)) + (fit-window-to-buffer window max-height min-height)) + ((fboundp 'shrink-window-if-larger-than-buffer) + (shrink-window-if-larger-than-buffer window))) + (or window (selected-window))) + + + +;;; File + +(defun org-file-newer-than-p (file time) + "Non-nil if FILE is newer than TIME. +FILE is a filename, as a string, TIME is a list of integers, as +returned by, e.g., `current-time'." + (and (file-exists-p file) + ;; Only compare times up to whole seconds as some file-systems + ;; (e.g. HFS+) do not retain any finer granularity. As + ;; a consequence, make sure we return non-nil when the two + ;; times are equal. + (not (time-less-p (cl-subseq (nth 5 (file-attributes file)) 0 2) + (cl-subseq time 0 2))))) + +(defun org-compile-file (source process ext &optional err-msg log-buf spec) + "Compile a SOURCE file using PROCESS. + +PROCESS is either a function or a list of shell commands, as +strings. EXT is a file extension, without the leading dot, as +a string. It is used to check if the process actually succeeded. + +PROCESS must create a file with the same base name and directory +as SOURCE, but ending with EXT. The function then returns its +filename. Otherwise, it raises an error. The error message can +then be refined by providing string ERR-MSG, which is appended to +the standard message. + +If PROCESS is a function, it is called with a single argument: +the SOURCE file. + +If it is a list of commands, each of them is called using +`shell-command'. By default, in each command, %b, %f, %F, %o and +%O are replaced with, respectively, SOURCE base name, name, full +name, directory and absolute output file name. It is possible, +however, to use more place-holders by specifying them in optional +argument SPEC, as an alist following the pattern + + (CHARACTER . REPLACEMENT-STRING). + +When PROCESS is a list of commands, optional argument LOG-BUF can +be set to a buffer or a buffer name. `shell-command' then uses +it for output." + (let* ((base-name (file-name-base source)) + (full-name (file-truename source)) + (out-dir (or (file-name-directory source) "./")) + (output (expand-file-name (concat base-name "." ext) out-dir)) + (time (current-time)) + (err-msg (if (stringp err-msg) (concat ". " err-msg) ""))) + (save-window-excursion + (pcase process + ((pred functionp) (funcall process (shell-quote-argument source))) + ((pred consp) + (let ((log-buf (and log-buf (get-buffer-create log-buf))) + (spec (append spec + `((?b . ,(shell-quote-argument base-name)) + (?f . ,(shell-quote-argument source)) + (?F . ,(shell-quote-argument full-name)) + (?o . ,(shell-quote-argument out-dir)) + (?O . ,(shell-quote-argument output)))))) + (dolist (command process) + (shell-command (format-spec command spec) log-buf)) + (when log-buf (with-current-buffer log-buf (compilation-mode))))) + (_ (error "No valid command to process %S%s" source err-msg)))) + ;; Check for process failure. Output file is expected to be + ;; located in the same directory as SOURCE. + (unless (org-file-newer-than-p output time) + (error (format "File %S wasn't produced%s" output err-msg))) + output)) + + + +;;; Indentation + +(defun org-do-remove-indentation (&optional n skip-fl) + "Remove the maximum common indentation from the buffer. +When optional argument N is a positive integer, remove exactly +that much characters from indentation, if possible. When +optional argument SKIP-FL is non-nil, skip the first +line. Return nil if it fails." + (catch :exit + (goto-char (point-min)) + ;; Find maximum common indentation, if not specified. + (let ((n (or n + (let ((min-ind (point-max))) + (save-excursion + (when skip-fl (forward-line)) + (while (re-search-forward "^[ \t]*\\S-" nil t) + (let ((ind (current-indentation))) + (if (zerop ind) (throw :exit nil) + (setq min-ind (min min-ind ind)))))) + min-ind)))) + (if (zerop n) (throw :exit nil) + ;; Remove exactly N indentation, but give up if not possible. + (when skip-fl (forward-line)) + (while (not (eobp)) + (let ((ind (progn (skip-chars-forward " \t") (current-column)))) + (cond ((eolp) (delete-region (line-beginning-position) (point))) + ((< ind n) (throw :exit nil)) + (t (indent-line-to (- ind n)))) + (forward-line))) + ;; Signal success. + t)))) + + + +;;; Input + +(defun org-read-function (prompt &optional allow-empty?) + "Prompt for a function. +If ALLOW-EMPTY? is non-nil, return nil rather than raising an +error when the user input is empty." + (let ((func (completing-read prompt obarray #'fboundp t))) + (cond ((not (string= func "")) + (intern func)) + (allow-empty? nil) + (t (user-error "Empty input is not valid"))))) + +(declare-function org-time-stamp-inactive "org" (&optional arg)) + +(defun org-completing-read (&rest args) + "Completing-read with SPACE being a normal character." + (let ((enable-recursive-minibuffers t) + (minibuffer-local-completion-map + (copy-keymap minibuffer-local-completion-map))) + (define-key minibuffer-local-completion-map " " #'self-insert-command) + (define-key minibuffer-local-completion-map "?" #'self-insert-command) + (define-key minibuffer-local-completion-map (kbd "C-c !") + #'org-time-stamp-inactive) + (apply #'completing-read args))) + +(defun org--mks-read-key (allowed-keys prompt navigation-keys) + "Read a key and ensure it is a member of ALLOWED-KEYS. +Enable keys to scroll the window if NAVIGATION-KEYS is set. +TAB, SPC and RET are treated equivalently." + (setq header-line-format (when navigation-keys "Use C-n, C-p, C-v, M-v to navigate.")) + (let ((char-key (read-char-exclusive prompt))) + (if (and navigation-keys (memq char-key '(14 16 22 134217846))) + (progn + (org-scroll char-key) + (org--mks-read-key allowed-keys prompt navigation-keys)) + (let ((key (char-to-string + (pcase char-key + ((or ?\s ?\t ?\r) ?\t) + (char char))))) + (if (member key allowed-keys) + key + (message "Invalid key: `%s'" key) + (sit-for 1) + (org--mks-read-key allowed-keys prompt navigation-keys)))))) + +(defun org-mks (table title &optional prompt specials) + "Select a member of an alist with multiple keys. + +TABLE is the alist which should contain entries where the car is a string. +There should be two types of entries. + +1. prefix descriptions like (\"a\" \"Description\") + This indicates that `a' is a prefix key for multi-letter selection, and + that there are entries following with keys like \"ab\", \"ax\"... + +2. Select-able members must have more than two elements, with the first + being the string of keys that lead to selecting it, and the second a + short description string of the item. + +The command will then make a temporary buffer listing all entries +that can be selected with a single key, and all the single key +prefixes. When you press the key for a single-letter entry, it is selected. +When you press a prefix key, the commands (and maybe further prefixes) +under this key will be shown and offered for selection. + +TITLE will be placed over the selection in the temporary buffer, +PROMPT will be used when prompting for a key. SPECIALS is an +alist with (\"key\" \"description\") entries. When one of these +is selected, only the bare key is returned." + (save-window-excursion + (let ((inhibit-quit t) + (buffer (org-switch-to-buffer-other-window "*Org Select*")) + (prompt (or prompt "Select: ")) + case-fold-search + current) + (unwind-protect + (catch 'exit + (while t + (erase-buffer) + (insert title "\n\n") + (let ((des-keys nil) + (allowed-keys '("\C-g")) + (tab-alternatives '("\s" "\t" "\r")) + (cursor-type nil)) + ;; Populate allowed keys and descriptions keys + ;; available with CURRENT selector. + (let ((re (format "\\`%s\\(.\\)\\'" + (if current (regexp-quote current) ""))) + (prefix (if current (concat current " ") ""))) + (dolist (entry table) + (pcase entry + ;; Description. + (`(,(and key (pred (string-match re))) ,desc) + (let ((k (match-string 1 key))) + (push k des-keys) + ;; Keys ending in tab, space or RET are equivalent. + (if (member k tab-alternatives) + (push "\t" allowed-keys) + (push k allowed-keys)) + (insert prefix "[" k "]" "..." " " desc "..." "\n"))) + ;; Usable entry. + (`(,(and key (pred (string-match re))) ,desc . ,_) + (let ((k (match-string 1 key))) + (insert prefix "[" k "]" " " desc "\n") + (push k allowed-keys))) + (_ nil)))) + ;; Insert special entries, if any. + (when specials + (insert "----------------------------------------------------\ +---------------------------\n") + (pcase-dolist (`(,key ,description) specials) + (insert (format "[%s] %s\n" key description)) + (push key allowed-keys))) + ;; Display UI and let user select an entry or + ;; a sub-level prefix. + (goto-char (point-min)) + (org-fit-window-to-buffer) + (message "") ; With this line the prompt appears in + ; the minibuffer. Else keystrokes may + ; appear, which is spurious. + (let ((pressed (org--mks-read-key + allowed-keys prompt + (not (pos-visible-in-window-p (1- (point-max))))))) + (setq current (concat current pressed)) + (cond + ((equal pressed "\C-g") (user-error "Abort")) + ;; Selection is a prefix: open a new menu. + ((member pressed des-keys)) + ;; Selection matches an association: return it. + ((let ((entry (assoc current table))) + (and entry (throw 'exit entry)))) + ;; Selection matches a special entry: return the + ;; selection prefix. + ((assoc current specials) (throw 'exit current)) + (t (error "No entry available"))))))) + (when buffer (kill-buffer buffer)))))) + + +;;; List manipulation + +(defsubst org-get-alist-option (option key) + (cond ((eq key t) t) + ((eq option t) t) + ((assoc key option) (cdr (assoc key option))) + (t (let ((r (cdr (assq 'default option)))) + (if (listp r) (delq nil r) r))))) + +(defsubst org-last (list) + "Return the last element of LIST." + (car (last list))) + +(defsubst org-uniquify (list) + "Non-destructively remove duplicate elements from LIST." + (let ((res (copy-sequence list))) (delete-dups res))) + +(defun org-uniquify-alist (alist) + "Merge elements of ALIST with the same key. + +For example, in this alist: + +\(org-uniquify-alist \\='((a 1) (b 2) (a 3))) + => \\='((a 1 3) (b 2)) + +merge (a 1) and (a 3) into (a 1 3). + +The function returns the new ALIST." + (let (rtn) + (dolist (e alist rtn) + (let (n) + (if (not (assoc (car e) rtn)) + (push e rtn) + (setq n (cons (car e) (append (cdr (assoc (car e) rtn)) (cdr e)))) + (setq rtn (assq-delete-all (car e) rtn)) + (push n rtn)))))) + +(defun org-delete-all (elts list) + "Remove all elements in ELTS from LIST. +Comparison is done with `equal'. It is a destructive operation +that may remove elements by altering the list structure." + (while elts + (setq list (delete (pop elts) list))) + list) + +(defun org-plist-delete-all (plist props) + "Delete all elements in PROPS from PLIST." + (dolist (e props plist) + (setq plist (org-plist-delete plist e)))) + +(defun org-plist-delete (plist property) + "Delete PROPERTY from PLIST. +This is in contrast to merely setting it to 0." + (let (p) + (while plist + (if (not (eq property (car plist))) + (setq p (plist-put p (car plist) (nth 1 plist)))) + (setq plist (cddr plist))) + p)) + +(defun org-combine-plists (&rest plists) + "Create a single property list from all plists in PLISTS. +The process starts by copying the first list, and then setting properties +from the other lists. Settings in the last list are the most significant +ones and overrule settings in the other lists." + (let ((rtn (copy-sequence (pop plists))) + p v ls) + (while plists + (setq ls (pop plists)) + (while ls + (setq p (pop ls) v (pop ls)) + (setq rtn (plist-put rtn p v)))) + rtn)) + + + +;;; Local variables + +(defconst org-unique-local-variables + '(org-element--cache + org-element--cache-objects + org-element--cache-sync-keys + org-element--cache-sync-requests + org-element--cache-sync-timer) + "List of local variables that cannot be transferred to another buffer.") + +(defun org-get-local-variables () + "Return a list of all local variables in an Org mode buffer." + (delq nil + (mapcar + (lambda (x) + (let* ((binding (if (symbolp x) (list x) (list (car x) (cdr x)))) + (name (car binding))) + (and (not (get name 'org-state)) + (not (memq name org-unique-local-variables)) + (string-match-p + "\\`\\(org-\\|orgtbl-\\|outline-\\|comment-\\|paragraph-\\|\ +auto-fill\\|normal-auto-fill\\|fill-paragraph\\|indent-\\)" + (symbol-name name)) + binding))) + (with-temp-buffer + (org-mode) + (buffer-local-variables))))) + +(defun org-clone-local-variables (from-buffer &optional regexp) + "Clone local variables from FROM-BUFFER. +Optional argument REGEXP selects variables to clone." + (dolist (pair (buffer-local-variables from-buffer)) + (pcase pair + (`(,name . ,value) ;ignore unbound variables + (when (and (not (memq name org-unique-local-variables)) + (or (null regexp) (string-match-p regexp (symbol-name name)))) + (ignore-errors (set (make-local-variable name) value))))))) + + +;;; Miscellaneous + +(defsubst org-call-with-arg (command arg) + "Call COMMAND interactively, but pretend prefix arg was ARG." + (let ((current-prefix-arg arg)) (call-interactively command))) + +(defsubst org-check-external-command (cmd &optional use no-error) + "Check if external program CMD for USE exists, error if not. +When the program does exist, return its path. +When it does not exist and NO-ERROR is set, return nil. +Otherwise, throw an error. The optional argument USE can describe what this +program is needed for, so that the error message can be more informative." + (or (executable-find cmd) + (if no-error + nil + (error "Can't find `%s'%s" cmd + (if use (format " (%s)" use) ""))))) + +(defun org-display-warning (message) + "Display the given MESSAGE as a warning." + (display-warning 'org message :warning)) + +(defun org-unlogged-message (&rest args) + "Display a message, but avoid logging it in the *Messages* buffer." + (let ((message-log-max nil)) + (apply #'message args))) + +(defmacro org-dlet (binders &rest body) + "Like `let*' but using dynamic scoping." + (declare (indent 1) (debug let)) + (let ((vars (mapcar (lambda (binder) + (if (consp binder) (car binder) binder)) + binders))) + `(progn + (with-no-warnings + ,@(mapcar (lambda (var) `(defvar ,var)) vars)) + (let* ,binders ,@body)))) + +(defmacro org-pushnew-to-end (val var) + "Like `cl-pushnew' but pushes to the end of the list. +Uses `equal' for comparisons. + +Beware: this performs O(N) memory allocations, so if you use it in a loop, you +get an unnecessary O(N²) space complexity, so you're usually better off using +`cl-pushnew' (with a final `reverse' if you care about the order of elements)." + (declare (debug (form gv-place))) + (let ((v (make-symbol "v"))) + `(let ((,v ,val)) + (unless (member ,v ,var) + (setf ,var (append ,var (list ,v))))))) + +(defun org-eval (form) + "Eval FORM and return result." + (condition-case error + (eval form t) + (error (format "%%![Error: %s]" error)))) + +(defvar org-outline-regexp) ; defined in org.el +(defvar org-odd-levels-only) ; defined in org.el +(defvar org-inlinetask-min-level) ; defined in org-inlinetask.el +(defun org-get-limited-outline-regexp () + "Return outline-regexp with limited number of levels. +The number of levels is controlled by `org-inlinetask-min-level'." + (cond ((not (derived-mode-p 'org-mode)) + outline-regexp) + ((not (featurep 'org-inlinetask)) + org-outline-regexp) + (t + (let* ((limit-level (1- org-inlinetask-min-level)) + (nstars (if org-odd-levels-only + (1- (* limit-level 2)) + limit-level))) + (format "\\*\\{1,%d\\} " nstars))))) + +(defun org--line-empty-p (n) + "Is the Nth next line empty? +Counts the current line as N = 1 and the previous line as N = 0; +see `beginning-of-line'." + (and (not (bobp)) + (save-excursion + (beginning-of-line n) + (looking-at-p "[ \t]*$")))) + +(defun org-previous-line-empty-p () + "Is the previous line a blank line? +When NEXT is non-nil, check the next line instead." + (org--line-empty-p 0)) + +(defun org-next-line-empty-p () + "Is the previous line a blank line? +When NEXT is non-nil, check the next line instead." + (org--line-empty-p 2)) + + + +;;; Motion + +(defsubst org-goto-line (N) + (save-restriction + (widen) + (goto-char (point-min)) + (forward-line (1- N)))) + +(defsubst org-current-line (&optional pos) + (save-excursion + (and pos (goto-char pos)) + ;; works also in narrowed buffer, because we start at 1, not point-min + (+ (if (bolp) 1 0) (count-lines 1 (point))))) + + + +;;; Overlays + +(defun org-overlay-display (ovl text &optional face evap) + "Make overlay OVL display TEXT with face FACE." + (overlay-put ovl 'display text) + (when face (overlay-put ovl 'face face)) + (when evap (overlay-put ovl 'evaporate t))) + +(defun org-overlay-before-string (ovl text &optional face evap) + "Make overlay OVL display TEXT with face FACE." + (when face (org-add-props text nil 'face face)) + (overlay-put ovl 'before-string text) + (when evap (overlay-put ovl 'evaporate t))) + +(defun org-find-overlays (prop &optional pos delete) + "Find all overlays specifying PROP at POS or point. +If DELETE is non-nil, delete all those overlays." + (let (found) + (dolist (ov (overlays-at (or pos (point))) found) + (cond ((not (overlay-get ov prop))) + (delete (delete-overlay ov)) + (t (push ov found)))))) + +(defun org-flag-region (from to flag spec) + "Hide or show lines from FROM to TO, according to FLAG. +SPEC is the invisibility spec, as a symbol." + (remove-overlays from to 'invisible spec) + ;; Use `front-advance' since text right before to the beginning of + ;; the overlay belongs to the visible line than to the contents. + (when flag + (let ((o (make-overlay from to nil 'front-advance))) + (overlay-put o 'evaporate t) + (overlay-put o 'invisible spec) + (overlay-put o + 'isearch-open-invisible + (lambda (&rest _) (org-show-context 'isearch)))))) + + + +;;; Regexp matching + +(defsubst org-pos-in-match-range (pos n) + (and (match-beginning n) + (<= (match-beginning n) pos) + (>= (match-end n) pos))) + +(defun org-skip-whitespace () + "Skip over space, tabs and newline characters." + (skip-chars-forward " \t\n\r")) + +(defun org-match-line (regexp) + "Match REGEXP at the beginning of the current line." + (save-excursion + (beginning-of-line) + (looking-at regexp))) + +(defun org-match-any-p (re list) + "Non-nil if regexp RE matches an element in LIST." + (cl-some (lambda (x) (string-match-p re x)) list)) + +(defun org-in-regexp (regexp &optional nlines visually) + "Check if point is inside a match of REGEXP. + +Normally only the current line is checked, but you can include +NLINES extra lines around point into the search. If VISUALLY is +set, require that the cursor is not after the match but really +on, so that the block visually is on the match. + +Return nil or a cons cell (BEG . END) where BEG and END are, +respectively, the positions at the beginning and the end of the +match." + (catch :exit + (let ((pos (point)) + (eol (line-end-position (if nlines (1+ nlines) 1)))) + (save-excursion + (beginning-of-line (- 1 (or nlines 0))) + (while (and (re-search-forward regexp eol t) + (<= (match-beginning 0) pos)) + (let ((end (match-end 0))) + (when (or (> end pos) (and (= end pos) (not visually))) + (throw :exit (cons (match-beginning 0) (match-end 0)))))))))) + +(defun org-point-in-group (point group &optional context) + "Check if POINT is in match-group GROUP. +If CONTEXT is non-nil, return a list with CONTEXT and the boundaries of the +match. If the match group does not exist or point is not inside it, +return nil." + (and (match-beginning group) + (>= point (match-beginning group)) + (<= point (match-end group)) + (if context + (list context (match-beginning group) (match-end group)) + t))) + +(defun org-url-p (s) + "Non-nil if string S is a URL." + (require 'ffap) + (and ffap-url-regexp (string-match-p ffap-url-regexp s))) + + +;;; String manipulation + +(defun org-string< (a b) + (org-string-collate-lessp a b)) + +(defun org-string<= (a b) + (or (string= a b) (org-string-collate-lessp a b))) + +(defun org-string>= (a b) + (not (org-string-collate-lessp a b))) + +(defun org-string> (a b) + (and (not (string= a b)) + (not (org-string-collate-lessp a b)))) + +(defun org-string<> (a b) + (not (string= a b))) + +(defsubst org-trim (s &optional keep-lead) + "Remove whitespace at the beginning and the end of string S. +When optional argument KEEP-LEAD is non-nil, removing blank lines +at the beginning of the string does not affect leading indentation." + (replace-regexp-in-string + (if keep-lead "\\`\\([ \t]*\n\\)+" "\\`[ \t\n\r]+") "" + (replace-regexp-in-string "[ \t\n\r]+\\'" "" s))) + +(defun org-string-nw-p (s) + "Return S if S is a string containing a non-blank character. +Otherwise, return nil." + (and (stringp s) + (string-match-p "[^ \r\t\n]" s) + s)) + +(defun org-reverse-string (string) + "Return the reverse of STRING." + (apply #'string (nreverse (string-to-list string)))) + +(defun org-split-string (string &optional separators) + "Splits STRING into substrings at SEPARATORS. + +SEPARATORS is a regular expression. When nil, it defaults to +\"[ \f\t\n\r\v]+\". + +Unlike `split-string', matching SEPARATORS at the beginning and +end of string are ignored." + (let ((separators (or separators "[ \f\t\n\r\v]+"))) + (if (not (string-match separators string)) (list string) + (let ((i (match-end 0)) + (results + (and (/= 0 (match-beginning 0)) ;skip leading separator + (list (substring string 0 (match-beginning 0)))))) + (while (string-match separators string i) + (push (substring string i (match-beginning 0)) + results) + (setq i (match-end 0))) + (nreverse (if (= i (length string)) + results ;skip trailing separator + (cons (substring string i) results))))))) + +(defun org--string-from-props (s property beg end) + "Return the visible part of string S. +Visible part is determined according to text PROPERTY, which is +either `invisible' or `display'. BEG and END are 0-indices +delimiting S." + (let ((width 0) + (cursor beg)) + (while (setq beg (text-property-not-all beg end property nil s)) + (let* ((next (next-single-property-change beg property s end)) + (props (text-properties-at beg s)) + (spec (plist-get props property)) + (value + (pcase property + (`invisible + ;; If `invisible' property in PROPS means text is to + ;; be invisible, return 0. Otherwise return nil so + ;; as to resume search. + (and (or (eq t buffer-invisibility-spec) + (assoc-string spec buffer-invisibility-spec)) + 0)) + (`display + (pcase spec + (`nil nil) + (`(space . ,props) + (let ((width (plist-get props :width))) + (and (wholenump width) width))) + (`(image . ,_) + (and (fboundp 'image-size) + (ceiling (car (image-size spec))))) + ((pred stringp) + ;; Displayed string could contain invisible parts, + ;; but no nested display. + (org--string-from-props spec 'invisible 0 (length spec))) + (_ + ;; Un-handled `display' value. Ignore it. + ;; Consider the original string instead. + nil))) + (_ (error "Unknown property: %S" property))))) + (when value + (cl-incf width + ;; When looking for `display' parts, we still need + ;; to look for `invisible' property elsewhere. + (+ (cond ((eq property 'display) + (org--string-from-props s 'invisible cursor beg)) + ((= cursor beg) 0) + (t (string-width (substring s cursor beg)))) + value)) + (setq cursor next)) + (setq beg next))) + (+ width + ;; Look for `invisible' property in the last part of the + ;; string. See above. + (cond ((eq property 'display) + (org--string-from-props s 'invisible cursor end)) + ((= cursor end) 0) + (t (string-width (substring s cursor end))))))) + +(defun org-string-width (string) + "Return width of STRING when displayed in the current buffer. +Unlike `string-width', this function takes into consideration +`invisible' and `display' text properties. It supports the +latter in a limited way, mostly for combinations used in Org. +Results may be off sometimes if it cannot handle a given +`display' value." + (org--string-from-props string 'display 0 (length string))) + +(defun org-not-nil (v) + "If V not nil, and also not the string \"nil\", then return V. +Otherwise return nil." + (and v (not (equal v "nil")) v)) + +(defun org-unbracket-string (pre post string) + "Remove PRE/POST from the beginning/end of STRING. +Both PRE and POST must be pre-/suffixes of STRING, or neither is +removed. Return the new string. If STRING is nil, return nil." + (declare (indent 2)) + (and string + (if (and (string-prefix-p pre string) + (string-suffix-p post string)) + (substring string (length pre) (- (length post))) + string))) + +(defun org-strip-quotes (string) + "Strip double quotes from around STRING, if applicable. +If STRING is nil, return nil." + (org-unbracket-string "\"" "\"" string)) + +(defsubst org-current-line-string (&optional to-here) + "Return current line, as a string. +If optional argument TO-HERE is non-nil, return string from +beginning of line up to point." + (buffer-substring (line-beginning-position) + (if to-here (point) (line-end-position)))) + +(defun org-shorten-string (s maxlength) + "Shorten string S so that it is no longer than MAXLENGTH characters. +If the string is shorter or has length MAXLENGTH, just return the +original string. If it is longer, the functions finds a space in the +string, breaks this string off at that locations and adds three dots +as ellipsis. Including the ellipsis, the string will not be longer +than MAXLENGTH. If finding a good breaking point in the string does +not work, the string is just chopped off in the middle of a word +if necessary." + (if (<= (length s) maxlength) + s + (let* ((n (max (- maxlength 4) 1)) + (re (concat "\\`\\(.\\{1," (number-to-string n) + "\\}[^ ]\\)\\([ ]\\|\\'\\)"))) + (if (string-match re s) + (concat (match-string 1 s) "...") + (concat (substring s 0 (max (- maxlength 3) 0)) "..."))))) + +(defun org-remove-tabs (s &optional width) + "Replace tabulators in S with spaces. +Assumes that s is a single line, starting in column 0." + (setq width (or width tab-width)) + (while (string-match "\t" s) + (setq s (replace-match + (make-string + (- (* width (/ (+ (match-beginning 0) width) width)) + (match-beginning 0)) ?\ ) + t t s))) + 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 +that costs. If there is a word longer than WIDTH, the text is actually +wrapped to the length of that word. +IF WIDTH is nil and LINES is non-nil, the string is forced into at most that +many lines, whatever width that takes. +The return value is a list of lines, without newlines at the end." + (let* ((words (split-string string)) + (maxword (apply #'max (mapcar #'org-string-width words))) + w ll) + (cond (width + (org--do-wrap words (max maxword width))) + (lines + (setq w maxword) + (setq ll (org--do-wrap words maxword)) + (if (<= (length ll) lines) + ll + (setq ll words) + (while (> (length ll) lines) + (setq w (1+ w)) + (setq ll (org--do-wrap words w))) + ll)) + (t (error "Cannot wrap this"))))) + +(defun org--do-wrap (words width) + "Create lines of maximum width WIDTH (in characters) from word list WORDS." + (let (lines line) + (while words + (setq line (pop words)) + (while (and words (< (+ (length line) (length (car words))) width)) + (setq line (concat line " " (pop words)))) + (setq lines (push line lines))) + (nreverse lines))) + +(defun org-remove-indentation (code &optional n) + "Remove maximum common indentation in string CODE and return it. +N may optionally be the number of columns to remove. Return CODE +as-is if removal failed." + (with-temp-buffer + (insert code) + (if (org-do-remove-indentation n) (buffer-string) code))) + +(defun org-fill-template (template alist) + "Find each %key of ALIST in TEMPLATE and replace it." + (let ((case-fold-search nil)) + (dolist (entry (sort (copy-sequence alist) + (lambda (a b) (< (length (car a)) (length (car b)))))) + (setq template + (replace-regexp-in-string + (concat "%" (regexp-quote (car entry))) + (or (cdr entry) "") template t t))) + template)) + +(defun org-replace-escapes (string table) + "Replace %-escapes in STRING with values in TABLE. +TABLE is an association list with keys like \"%a\" and string values. +The sequences in STRING may contain normal field width and padding information, +for example \"%-5s\". Replacements happen in the sequence given by TABLE, +so values can contain further %-escapes if they are define later in TABLE." + (let ((tbl (copy-alist table)) + (case-fold-search nil) + (pchg 0) + re rpl) + (dolist (e tbl) + (setq re (concat "%-?[0-9.]*" (substring (car e) 1))) + (when (and (cdr e) (string-match re (cdr e))) + (let ((sref (substring (cdr e) (match-beginning 0) (match-end 0))) + (safe "SREF")) + (add-text-properties 0 3 (list 'sref sref) safe) + (setcdr e (replace-match safe t t (cdr e))))) + (while (string-match re string) + (setq rpl (format (concat (substring (match-string 0 string) 0 -1) "s") + (cdr e))) + (setq string (replace-match rpl t t string)))) + (while (setq pchg (next-property-change pchg string)) + (let ((sref (get-text-property pchg 'sref string))) + (when (and sref (string-match "SREF" string pchg)) + (setq string (replace-match sref t t string))))) + string)) + + +;;; Text properties + +(defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t + rear-nonsticky t mouse-map t fontified t + org-emphasis t) + "Properties to remove when a string without properties is wanted.") + +(defsubst org-no-properties (s &optional restricted) + "Remove all text properties from string S. +When RESTRICTED is non-nil, only remove the properties listed +in `org-rm-props'." + (if restricted (remove-text-properties 0 (length s) org-rm-props s) + (set-text-properties 0 (length s) nil s)) + s) +(defun org-add-props (string plist &rest props) + "Add text properties to entire string, from beginning to end. +PLIST may be a list of properties, PROPS are individual properties and values +that will be added to PLIST. Returns the string that was modified." + (declare (indent 2)) + (add-text-properties + 0 (length string) (if props (append plist props) plist) string) + string) + +(defun org-make-parameter-alist (flat) + ;; FIXME: "flat" is called a "plist"! + "Return alist based on FLAT. +FLAT is a list with alternating symbol names and values. The +returned alist is a list of lists with the symbol name in car and +the value in cadr." + (when flat + (cons (list (car flat) (cadr flat)) + (org-make-parameter-alist (cddr flat))))) + +(defsubst org-get-at-bol (property) + "Get text property PROPERTY at the beginning of line." + (get-text-property (point-at-bol) property)) + +(defun org-get-at-eol (property n) + "Get text property PROPERTY at the end of line less N characters." + (get-text-property (- (point-at-eol) n) property)) + +(defun org-find-text-property-in-string (prop s) + "Return the first non-nil value of property PROP in string S." + (or (get-text-property 0 prop s) + (get-text-property (or (next-single-property-change 0 prop s) 0) + prop s))) + +(defun org-invisible-p (&optional pos folding-only) + "Non-nil if the character after POS is invisible. +If POS is nil, use `point' instead. When optional argument +FOLDING-ONLY is non-nil, only consider invisible parts due to +folding of a headline, a block or a drawer, i.e., not because of +fontification." + (let ((value (get-char-property (or pos (point)) 'invisible))) + (cond ((not value) nil) + (folding-only (memq value '(org-hide-block outline))) + (t value)))) + +(defun org-truely-invisible-p () + "Check if point is at a character currently not visible. +This version does not only check the character property, but also +`visible-mode'." + (unless (bound-and-true-p visible-mode) + (org-invisible-p))) + +(defun org-invisible-p2 () + "Check if point is at a character currently not visible. +If the point is at EOL (and not at the beginning of a buffer too), +move it back by one char before doing this check." + (save-excursion + (when (and (eolp) (not (bobp))) + (backward-char 1)) + (org-invisible-p))) + +(defun org-find-visible () + "Return closest visible buffer position, or `point-max'." + (if (org-invisible-p) + (next-single-char-property-change (point) 'invisible) + (point))) + +(defun org-find-invisible () + "Return closest invisible buffer position, or `point-max'." + (if (org-invisible-p) + (point) + (next-single-char-property-change (point) 'invisible))) + + +;;; Time + +(defun org-2ft (s) + "Convert S to a floating point time. +If S is already a number, just return it. If it is a string, +parse it as a time string and apply `float-time' to it. If S is +nil, just return 0." + (cond + ((numberp s) s) + ((stringp s) + (condition-case nil + (float-time (apply #'encode-time (org-parse-time-string s))) + (error 0))) + (t 0))) + +(defun org-time= (a b) + (let ((a (org-2ft a)) + (b (org-2ft b))) + (and (> a 0) (> b 0) (= a b)))) + +(defun org-time< (a b) + (let ((a (org-2ft a)) + (b (org-2ft b))) + (and (> a 0) (> b 0) (< a b)))) + +(defun org-time<= (a b) + (let ((a (org-2ft a)) + (b (org-2ft b))) + (and (> a 0) (> b 0) (<= a b)))) + +(defun org-time> (a b) + (let ((a (org-2ft a)) + (b (org-2ft b))) + (and (> a 0) (> b 0) (> a b)))) + +(defun org-time>= (a b) + (let ((a (org-2ft a)) + (b (org-2ft b))) + (and (> a 0) (> b 0) (>= a b)))) + +(defun org-time<> (a b) + (let ((a (org-2ft a)) + (b (org-2ft b))) + (and (> a 0) (> b 0) (\= a b)))) + +(defun org-parse-time-string (s &optional nodefault) + "Parse Org time string S. + +If time is not given, defaults to 0:00. However, with optional +NODEFAULT, hour and minute fields are nil if not given. + +Throw an error if S does not contain a valid Org time string. +Note that the first match for YYYY-MM-DD will be used (e.g., +\"-52000-02-03\" will be taken as \"2000-02-03\"). + +This should be a lot faster than the `parse-time-string'." + (unless (string-match org-ts-regexp0 s) + (error "Not an Org time string: %s" s)) + (list 0 + (cond ((match-beginning 8) (string-to-number (match-string 8 s))) + (nodefault nil) + (t 0)) + (cond ((match-beginning 7) (string-to-number (match-string 7 s))) + (nodefault nil) + (t 0)) + (string-to-number (match-string 4 s)) + (string-to-number (match-string 3 s)) + (string-to-number (match-string 2 s)) + nil nil nil)) + +(defun org-matcher-time (s) + "Interpret a time comparison value S as a floating point time. + +S can be an Org time stamp, a modifier, e.g., \"<+2d>\", or the +following special strings: \"<now>\", \"<today>\", +\"<tomorrow>\", and \"<yesterday>\". + +Return 0. if S is not recognized as a valid value." + (let ((today (float-time (apply #'encode-time + (append '(0 0 0) (nthcdr 3 (decode-time))))))) + (save-match-data + (cond + ((string= s "<now>") (float-time)) + ((string= s "<today>") today) + ((string= s "<tomorrow>") (+ 86400.0 today)) + ((string= s "<yesterday>") (- today 86400.0)) + ((string-match "\\`<\\([-+][0-9]+\\)\\([hdwmy]\\)>\\'" s) + (+ (if (string= (match-string 2 s) "h") (float-time) today) + (* (string-to-number (match-string 1 s)) + (cdr (assoc (match-string 2 s) + '(("h" . 3600.0) + ("d" . 86400.0) ("w" . 604800.0) + ("m" . 2678400.0) ("y" . 31557600.0))))))) + ((string-match org-ts-regexp0 s) (org-2ft s)) + (t 0.))))) + +(defun org-scroll (key &optional additional-keys) + "Receive KEY and scroll the current window accordingly. +When ADDITIONAL-KEYS is not nil, also include SPC and DEL in the +allowed keys for scrolling, as expected in the export dispatch +window." + (let ((scrlup (if additional-keys '(?\s ?\C-v) ?\C-v)) + (scrldn (if additional-keys `(?\d ?\M-v) ?\M-v))) + (pcase key + (?\C-n (if (not (pos-visible-in-window-p (point-max))) + (ignore-errors (scroll-up 1)) + (message "End of buffer") + (sit-for 1))) + (?\C-p (if (not (pos-visible-in-window-p (point-min))) + (ignore-errors (scroll-down 1)) + (message "Beginning of buffer") + (sit-for 1))) + ;; SPC or + ((guard (memq key scrlup)) + (if (not (pos-visible-in-window-p (point-max))) + (scroll-up nil) + (message "End of buffer") + (sit-for 1))) + ;; DEL + ((guard (memq key scrldn)) + (if (not (pos-visible-in-window-p (point-min))) + (scroll-down nil) + (message "Beginning of buffer") + (sit-for 1)))))) + +(provide 'org-macs) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-macs.el ends here diff --git a/elpa/org-9.5.2/org-macs.elc b/elpa/org-9.5.2/org-macs.elc new file mode 100644 index 0000000..513660c Binary files /dev/null and b/elpa/org-9.5.2/org-macs.elc differ diff --git a/elpa/org-9.5.2/org-mobile.el b/elpa/org-9.5.2/org-mobile.el new file mode 100644 index 0000000..e51258a --- /dev/null +++ b/elpa/org-9.5.2/org-mobile.el @@ -0,0 +1,1141 @@ +;;; org-mobile.el --- Code for Asymmetric Sync With a Mobile Device -*- lexical-binding: t; -*- +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. +;; +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; This file contains the code to interact with a mobile application, +;; such as Richard Moreland's iPhone application MobileOrg, or the +;; Android version by Matthew Jones. This code is documented in +;; Appendix B of the Org manual. The code is not specific for the +;; iPhone and Android - any external viewer/flagging/editing +;; application that uses the same conventions could be used. + +(require 'cl-lib) +(require 'org) +(require 'org-agenda) +(require 'ol) + +;;; Code: + +(defgroup org-mobile nil + "Options concerning support for a viewer/editor on a mobile device." + :tag "Org Mobile" + :group 'org) + +(defcustom org-mobile-files '(org-agenda-files) + "Files to be staged for the mobile application. + +This is basically a list of files and directories. Files will be staged +directly. Directories will be search for files with the extension \".org\". +In addition to this, the list may also contain the following symbols: + +`org-agenda-files' + This means include the complete, unrestricted list of files given in + the variable `org-agenda-files'. + +`org-agenda-text-search-extra-files' + Include the files given in the variable + `org-agenda-text-search-extra-files'." + :group 'org-mobile + :type '(list :greedy t + (option (const :tag "org-agenda-files" org-agenda-files)) + (option (const :tag "org-agenda-text-search-extra-files" + org-agenda-text-search-extra-files)) + (repeat :inline t :tag "Additional files" + (file)))) + +(defcustom org-mobile-files-exclude-regexp "" + "A regexp to exclude files from `org-mobile-files'." + :group 'org-mobile + :version "24.1" + :type 'regexp) + +(defcustom org-mobile-directory "" + "The WebDAV directory where the interaction with the mobile takes place." + :group 'org-mobile + :type 'directory) + +(defcustom org-mobile-allpriorities "A B C" + "Default set of priority cookies for the index file." + :version "24.4" + :package-version '(Org . "8.0") + :type 'string + :group 'org-mobile) + +(defcustom org-mobile-use-encryption nil + "Non-nil means keep only encrypted files on the WebDAV server. + +Encryption uses AES-256, with a password given in +`org-mobile-encryption-password'. When nil, plain files are kept +on the server. + +Turning on encryption requires setting the same password in the +mobile application. Before turning this on, check if the mobile +application does support it." + :group 'org-mobile + :version "24.1" + :type 'boolean) + +(defcustom org-mobile-encryption-tempfile "~/orgtmpcrypt" + "File that is being used as a temporary file for encryption. +This must be local file on your local machine (not on the WebDAV server). +You might want to put this file into a directory where only you have access." + :group 'org-mobile + :version "24.1" + :type 'directory) + +(defcustom org-mobile-encryption-password "" + "Password for encrypting files uploaded to the server. + +This is a single password which is used for AES-256 encryption. The same +password must also be set in the mobile application. All Org files, +including \"mobileorg.org\" will be encrypted using this password. + +SECURITY CONSIDERATIONS: + +Note that, when Org runs the encryption commands, the password could +be visible briefly on your system with the `ps' command. So this method is +only intended to keep the files secure on the server, not on your own machine. + +Also, if you set this variable in an init file (.emacs or .emacs.d/init.el +or custom.el...) and if that file is stored in a way so that other can read +it, this also limits the security of this approach. You can also leave +this variable empty - Org will then ask for the password once per Emacs +session." + :group 'org-mobile + :version "24.1" + :type '(string :tag "Password")) + +(defvar org-mobile-encryption-password-session nil) + +(defun org-mobile-encryption-password () + (or (org-string-nw-p org-mobile-encryption-password) + (org-string-nw-p org-mobile-encryption-password-session) + (setq org-mobile-encryption-password-session + (read-passwd "Password for mobile application: " t)))) + +(defcustom org-mobile-inbox-for-pull "~/org/from-mobile.org" + "The file where captured notes and flags will be appended to. +During the execution of `org-mobile-pull', the file +`org-mobile-capture-file' is emptied as soon as its contents have +been appended to the file given here. This file should be in +`org-directory', and not in the staging area or on the web server." + :group 'org-mobile + :type 'file) + +(defconst org-mobile-capture-file "mobileorg.org" + "The capture file where the mobile stores captured notes and flags. +This must not be changed, because the mobile application assumes this name.") + +(defcustom org-mobile-index-file "index.org" + "Index file with links to all Org files. +It should be loaded by the mobile application. The file name is +relative to `org-mobile-directory'. The \"Address\" field in the +mobile application setup should point to this file." + :group 'org-mobile + :type 'file) + +(defcustom org-mobile-agendas 'all + "The agendas that should be pushed to the mobile application. + +Allowed values: + +`default' the weekly agenda and the global TODO list +`custom' all custom agendas defined by the user +`all' the custom agendas and the default ones +`list' a list of selection key(s) as string." + :group 'org-mobile + :version "24.1" + :type '(choice + (const :tag "Default Agendas" default) + (const :tag "Custom Agendas" custom) + (const :tag "Default and Custom Agendas" all) + (repeat :tag "Selected" + (string :tag "Selection Keys")))) + +(defcustom org-mobile-force-id-on-agenda-items t + "Non-nil means make all agenda items carry an ID." + :group 'org-mobile + :type 'boolean) + +(defcustom org-mobile-force-mobile-change nil + "Non-nil means force the change made on the mobile device. +So even if there have been changes to the computer version of the entry, +force the new value set on the mobile. +When nil, mark the entry from the mobile with an error message. +Instead of nil or t, this variable can also be a list of symbols, indicating +the editing types for which the mobile version should always dominate." + :group 'org-mobile + :type '(choice + (const :tag "Always" t) + (const :tag "Never" nil) + (set :greedy t :tag "Specify" + (const todo) + (const tags) + (const priority) + (const heading) + (const body)))) + +(defcustom org-mobile-checksum-binary (or (executable-find "shasum") + (executable-find "sha1sum") + (executable-find "md5sum") + (executable-find "md5")) + "Executable used for computing checksums of agenda files." + :group 'org-mobile + :type 'string) + +(defvar org-mobile-pre-push-hook nil + "Hook run before running `org-mobile-push'. +This could be used to clean up `org-mobile-directory', for example to +remove files that used to be included in the agenda but no longer are. +The presence of such files would not really be a problem, but after time +they may accumulate.") + +(defvar org-mobile-post-push-hook nil + "Hook run after running `org-mobile-push'. +If Emacs does not have direct write access to the WebDAV directory used +by the mobile device, this hook should be used to copy all files from the +local staging directory `org-mobile-directory' to the WebDAV directory, +for example using `rsync' or `scp'.") + +(defvar org-mobile-pre-pull-hook nil + "Hook run before executing `org-mobile-pull'. +If Emacs does not have direct write access to the WebDAV directory used +by the mobile device, this hook should be used to copy the capture file +`mobileorg.org' from the WebDAV location to the local staging +directory `org-mobile-directory'.") + +(defvar org-mobile-post-pull-hook nil + "Hook run after running `org-mobile-pull', only if new items were found. +If Emacs does not have direct write access to the WebDAV directory used +by the mobile device, this hook should be used to copy the emptied +capture file `mobileorg.org' back to the WebDAV directory, for example +using `rsync' or `scp'.") + +(defconst org-mobile-action-alist '(("edit" . org-mobile-edit)) + "Alist with flags and actions for mobile sync. + +When flagging an entry, the mobile application creates entries +that look like + + * F(action:data) [[id:entry-id][entry title]] + +This alist defines that the ACTION in the parentheses of F() +should mean, i.e. what action should be taken. The :data part in +the parenthesis is optional. If present, the string after the +colon will be passed to the action function as the first argument +variable. + +The car of each elements of the alist is an actions string. The +cdr is a function that is called with the cursor on the headline +of that entry. It should accept three arguments, the :data part, +the old and new values for the entry.") + +(defvar org-mobile-last-flagged-files nil + "List of files containing entries flagged in the latest pull.") + +(defvar org-mobile-files-alist nil) +(defvar org-mobile-checksum-files nil) + +;; Add org mobile commands to the main org menu +(easy-menu-add-item + org-org-menu + nil + '("MobileOrg" + ["Push Files and Views" org-mobile-push t] + ["Get Captured and Flagged" org-mobile-pull t] + ["Find FLAGGED Tasks" (org-agenda nil "?") :active t :keys "\\[org-agenda] ?"] + "--" + ["Setup" (customize-group 'org-mobile) t])) + +(defun org-mobile-prepare-file-lists () + (setq org-mobile-files-alist (org-mobile-files-alist)) + (setq org-mobile-checksum-files nil)) + +(defun org-mobile-files-alist () + "Expand the list in `org-mobile-files' to a list of existing files. +Also exclude files matching `org-mobile-files-exclude-regexp'." + (let* ((include-archives + (and (member 'org-agenda-text-search-extra-files org-mobile-files) + (member 'agenda-archives org-agenda-text-search-extra-files) + t)) + (files + (apply 'append + (mapcar + (lambda (f) + (cond + ((eq f 'org-agenda-files) + (org-agenda-files t include-archives)) + ((eq f 'org-agenda-text-search-extra-files) + (delq 'agenda-archives + (copy-sequence + org-agenda-text-search-extra-files))) + ((and (stringp f) (file-directory-p f)) + (directory-files f 'full "\\.org\\'")) + ((and (stringp f) (file-exists-p f)) + (list f)) + (t nil))) + org-mobile-files))) + (files (delq + nil + (mapcar (lambda (f) + (unless (and (not (string= org-mobile-files-exclude-regexp "")) + (string-match org-mobile-files-exclude-regexp f)) + (identity f))) + files))) + (orgdir-uname (file-name-as-directory (file-truename org-directory))) + (orgdir-re (concat "\\`" (regexp-quote orgdir-uname))) + uname seen rtn file link-name) + ;; Make the files unique, and determine the name under which they will + ;; be listed. + (while (setq file (pop files)) + (if (not (file-name-absolute-p file)) + (setq file (expand-file-name file org-directory))) + (setq uname (file-truename file)) + (unless (member uname seen) + (push uname seen) + (if (string-match orgdir-re uname) + (setq link-name (substring uname (match-end 0))) + (setq link-name (file-name-nondirectory uname))) + (push (cons file link-name) rtn))) + (nreverse rtn))) + +;;;###autoload +(defun org-mobile-push () + "Push the current state of Org affairs to the target directory. +This will create the index file, copy all agenda files there, and also +create all custom agenda views, for upload to the mobile phone." + (interactive) + (let ((org-agenda-buffer-name "*SUMO*") + (org-agenda-tag-filter org-agenda-tag-filter) + (org-agenda-redo-command org-agenda-redo-command)) + ;; Offer to save agenda-related buffers before pushing, preventing + ;; "Non-existent agenda file" prompt for lock files (see #19448). + (let ((agenda-buffers (org-buffer-list 'agenda))) + (save-some-buffers nil + (lambda () (memq (current-buffer) agenda-buffers)))) + (save-excursion + (save-restriction + (save-window-excursion + (run-hooks 'org-mobile-pre-push-hook) + (org-mobile-check-setup) + (org-mobile-prepare-file-lists) + (message "Creating agendas...") + (let ((inhibit-redisplay t) + (org-agenda-files (mapcar 'car org-mobile-files-alist))) + (org-mobile-create-sumo-agenda)) + (message "Creating agendas...done") + (org-save-all-org-buffers) ; to save any IDs created by this process + (message "Copying files...") + (org-mobile-copy-agenda-files) + (message "Writing index file...") + (org-mobile-create-index-file) + (message "Writing checksums...") + (org-mobile-write-checksums) + (run-hooks 'org-mobile-post-push-hook))))) + (org-agenda-maybe-redo) + (message "Files for mobile viewer staged")) + +(defvar org-mobile-before-process-capture-hook nil + "Hook that is run after content was moved to `org-mobile-inbox-for-pull'. +The inbox file is visited by the current buffer, and the buffer is +narrowed to the newly captured data.") + +;;;###autoload +(defun org-mobile-pull () + "Pull the contents of `org-mobile-capture-file' and integrate them. +Apply all flagged actions, flag entries to be flagged and then call an +agenda view showing the flagged items." + (interactive) + (org-mobile-check-setup) + (run-hooks 'org-mobile-pre-pull-hook) + (let ((insertion-marker (org-mobile-move-capture))) + (if (not (markerp insertion-marker)) + (message "No new items") + (org-with-point-at insertion-marker + (save-restriction + (narrow-to-region (point) (point-max)) + (run-hooks 'org-mobile-before-process-capture-hook))) + (org-with-point-at insertion-marker + (org-mobile-apply (point) (point-max))) + (move-marker insertion-marker nil) + (run-hooks 'org-mobile-post-pull-hook) + (when org-mobile-last-flagged-files + ;; Make an agenda view of flagged entries, but only in the files + ;; where stuff has been added. + (put 'org-agenda-files 'org-restrict org-mobile-last-flagged-files) + (let ((org-agenda-keep-restricted-file-list t)) + (org-agenda nil "?")))))) + +(defun org-mobile-check-setup () + "Check if org-mobile-directory has been set up." + (org-mobile-cleanup-encryption-tempfile) + (unless (and org-directory + (stringp org-directory) + (string-match "\\S-" org-directory) + (file-exists-p org-directory) + (file-directory-p org-directory)) + (error + "Please set `org-directory' to the directory where your org files live")) + (unless (and org-mobile-directory + (stringp org-mobile-directory) + (string-match "\\S-" org-mobile-directory) + (file-exists-p org-mobile-directory) + (file-directory-p org-mobile-directory)) + (error + "Variable `org-mobile-directory' must point to an existing directory")) + (unless (and org-mobile-inbox-for-pull + (stringp org-mobile-inbox-for-pull) + (string-match "\\S-" org-mobile-inbox-for-pull) + (file-exists-p + (file-name-directory org-mobile-inbox-for-pull))) + (error + "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory")) + (unless (and org-mobile-checksum-binary + (string-match "\\S-" org-mobile-checksum-binary)) + (error "No executable found to compute checksums")) + (when org-mobile-use-encryption + (unless (string-match "\\S-" (org-mobile-encryption-password)) + (error + "To use encryption, you must set `org-mobile-encryption-password'")) + (unless (file-writable-p org-mobile-encryption-tempfile) + (error "Cannot write to encryption tempfile %s" + org-mobile-encryption-tempfile)) + (unless (executable-find "openssl") + (error "OpenSSL is needed to encrypt files")))) + +(defun org-mobile-create-index-file () + "Write the index file in the WebDAV directory." + (let ((files-alist (sort (copy-sequence org-mobile-files-alist) + (lambda (a b) (string< (cdr a) (cdr b))))) + (def-todo (default-value 'org-todo-keywords)) + (def-tags org-tag-alist) + (target-file (expand-file-name org-mobile-index-file + org-mobile-directory)) + todo-kwds done-kwds tags) + (when (stringp (car def-todo)) + (setq def-todo (list (cons 'sequence def-todo)))) + (org-agenda-prepare-buffers (mapcar 'car files-alist)) + (setq done-kwds (org-uniquify org-done-keywords-for-agenda)) + (setq todo-kwds (org-delete-all + done-kwds + (org-uniquify org-todo-keywords-for-agenda))) + (setq tags (mapcar 'car (org-global-tags-completion-table + (mapcar 'car files-alist)))) + (with-temp-file (if org-mobile-use-encryption org-mobile-encryption-tempfile + target-file) + (insert "#+READONLY\n") + (dolist (entry def-todo) + (let ((kwds (mapcar (lambda (x) + (if (string-match "(" x) + (substring x 0 (match-beginning 0)) + x)) + (cdr entry)))) + (insert "#+TODO: " (mapconcat #'identity kwds " ") "\n") + (let* ((dwds (or (member "|" kwds) (last kwds))) + (twds (org-delete-all dwds kwds))) + (setq todo-kwds (org-delete-all twds todo-kwds)) + (setq done-kwds (org-delete-all dwds done-kwds))))) + (when (or todo-kwds done-kwds) + (insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | " + (mapconcat 'identity done-kwds " ") "\n")) + (setq def-tags (split-string (org-tag-alist-to-string def-tags t))) + (setq tags (org-delete-all def-tags tags)) + (setq tags (sort tags (lambda (a b) (string< (downcase a) (downcase b))))) + (setq tags (append def-tags tags nil)) + (insert "#+TAGS: " (mapconcat 'identity tags " ") "\n") + (insert "#+ALLPRIORITIES: " org-mobile-allpriorities "\n") + (when (file-exists-p (expand-file-name + org-mobile-directory "agendas.org")) + (insert "* [[file:agendas.org][Agenda Views]]\n")) + (pcase-dolist (`(,_ . ,link-name) files-alist) + (insert (format "* [[file:%s][%s]]\n" link-name link-name))) + (push (cons org-mobile-index-file (md5 (buffer-string))) + org-mobile-checksum-files)) + (when org-mobile-use-encryption + (org-mobile-encrypt-and-move org-mobile-encryption-tempfile + target-file) + (org-mobile-cleanup-encryption-tempfile)))) + +(defun org-mobile-copy-agenda-files () + "Copy all agenda files to the stage or WebDAV directory." + (let ((files-alist org-mobile-files-alist) + file buf entry link-name target-path target-dir check) + (while (setq entry (pop files-alist)) + (setq file (car entry) link-name (cdr entry)) + (when (file-exists-p file) + (setq target-path (expand-file-name link-name org-mobile-directory) + target-dir (file-name-directory target-path)) + (unless (file-directory-p target-dir) + (make-directory target-dir 'parents)) + (if org-mobile-use-encryption + (org-mobile-encrypt-and-move file target-path) + (copy-file file target-path 'ok-if-already-exists)) + (setq check (shell-command-to-string + (concat (shell-quote-argument org-mobile-checksum-binary) + " " + (shell-quote-argument (expand-file-name file))))) + (when (string-match "[[:xdigit:]]\\{30,40\\}" check) + (push (cons link-name (match-string 0 check)) + org-mobile-checksum-files)))) + + (setq file (expand-file-name org-mobile-capture-file + org-mobile-directory)) + (save-excursion + (setq buf (find-file file)) + (when (and (= (point-min) (point-max))) + (insert "\n") + (save-buffer) + (when org-mobile-use-encryption + (write-file org-mobile-encryption-tempfile) + (org-mobile-encrypt-and-move org-mobile-encryption-tempfile file))) + (push (cons org-mobile-capture-file (md5 (buffer-string))) + org-mobile-checksum-files)) + (org-mobile-cleanup-encryption-tempfile) + (kill-buffer buf))) + +(defun org-mobile-write-checksums () + "Create checksums for all files in `org-mobile-directory'. +The table of checksums is written to the file mobile-checksums." + (let ((sumfile (expand-file-name "checksums.dat" org-mobile-directory)) + (files org-mobile-checksum-files) + entry file sum) + (with-temp-file sumfile + (set-buffer-file-coding-system 'undecided-unix nil) + (while (setq entry (pop files)) + (setq file (car entry) sum (cdr entry)) + (insert (format "%s %s\n" sum file)))))) + +(defun org-mobile-sumo-agenda-command () + "Return an agenda custom command that comprises all custom commands." + (let ((custom-list + ;; normalize different versions + (delq nil + (mapcar + (lambda (x) + (cond ((stringp (cdr x)) nil) + ((stringp (nth 1 x)) x) + ((not (nth 1 x)) (cons (car x) (cons "" (cddr x)))) + (t (cons (car x) (cons "" (cdr x)))))) + org-agenda-custom-commands))) + (default-list '(("a" "Agenda" agenda) ("t" "All TODO" alltodo))) + thelist atitle new e key desc type match settings cmds gkey gdesc gsettings cnt) + (cond + ((eq org-mobile-agendas 'custom) + (setq thelist custom-list)) + ((eq org-mobile-agendas 'default) + (setq thelist default-list)) + ((eq org-mobile-agendas 'all) + (setq thelist custom-list) + (unless (assoc "t" thelist) (push '("t" "ALL TODO" alltodo) thelist)) + (unless (assoc "a" thelist) (push '("a" "Agenda" agenda) thelist))) + ((listp org-mobile-agendas) + (setq thelist (append custom-list default-list)) + (setq thelist (delq nil (mapcar (lambda (k) (assoc k thelist)) + org-mobile-agendas))))) + (while (setq e (pop thelist)) + (cond + ((stringp (cdr e)) + ;; this is a description entry - skip it + ) + ((eq (nth 2 e) 'search) + ;; Search view is interactive, skip + ) + ((memq (nth 2 e) '(todo-tree tags-tree occur-tree)) + ;; These are trees, not really agenda commands + ) + ((and (memq (nth 2 e) '(todo tags tags-todo)) + (or (null (nth 3 e)) + (not (string-match "\\S-" (nth 3 e))))) + ;; These would be interactive because the match string is empty + ) + ((memq (nth 2 e) '(agenda alltodo todo tags tags-todo)) + ;; a normal command + (setq key (car e) desc (nth 1 e) type (nth 2 e) match (nth 3 e) + settings (nth 4 e)) + (setq settings + (cons (list 'org-agenda-title-append + (concat "<after>KEYS=" key " TITLE: " + (if (and (stringp desc) (> (length desc) 0)) + desc (symbol-name type)) + "</after>")) + settings)) + (push (list type match settings) new)) + ((or (functionp (nth 2 e)) (symbolp (nth 2 e))) + ;; A user-defined function, which can do anything, so simply + ;; ignore it. + ) + (t + ;; a block agenda + (setq gkey (car e) gdesc (nth 1 e) gsettings (nth 3 e) cmds (nth 2 e)) + (setq cnt 0) + (while (setq e (pop cmds)) + (setq type (car e) match (nth 1 e) settings (nth 2 e)) + (setq atitle (if (string= "" gdesc) match gdesc)) + (setq settings (append gsettings settings)) + (setq settings + (cons (list 'org-agenda-title-append + (concat "<after>KEYS=" gkey "#" (number-to-string + (setq cnt (1+ cnt))) + " TITLE: " atitle "</after>")) + settings)) + (push (list type match settings) new))))) + (and new (list "X" "SUMO" (reverse new) + '((org-agenda-compact-blocks nil)))))) + +(defvar org-mobile-creating-agendas nil) +(defun org-mobile-write-agenda-for-mobile (file) + (let ((all (buffer-string)) in-date id pl prefix line app short m sexp) + (with-temp-file file + (org-mode) + (insert "#+READONLY\n") + (insert all) + (goto-char (point-min)) + (while (not (eobp)) + (cond + ((looking-at "[ \t]*$")) ; keep empty lines + ((looking-at "=+$") + ;; remove underlining + (delete-region (point) (point-at-eol))) + ((get-text-property (point) 'org-agenda-structural-header) + (setq in-date nil) + (setq app (get-text-property (point) 'org-agenda-title-append)) + (setq short (get-text-property (point) 'short-heading)) + (when (and short (looking-at ".+")) + (replace-match short nil t) + (beginning-of-line 1)) + (when app + (end-of-line 1) + (insert app) + (beginning-of-line 1)) + (insert "* ")) + ((get-text-property (point) 'org-agenda-date-header) + (setq in-date t) + (insert "** ")) + ((setq m (or (get-text-property (point) 'org-hd-marker) + (get-text-property (point) 'org-marker))) + (setq sexp (member (get-text-property (point) 'type) + '("diary" "sexp"))) + (if (setq pl (text-property-any (point) (point-at-eol) 'org-heading t)) + (progn + (setq prefix (org-trim (buffer-substring + (point) pl)) + line (org-trim (buffer-substring + pl + (point-at-eol)))) + (delete-region (point-at-bol) (point-at-eol)) + (insert line "<before>" prefix "</before>") + (beginning-of-line 1)) + (and (looking-at "[ \t]+") (replace-match ""))) + (insert (if in-date "*** " "** ")) + (end-of-line 1) + (insert "\n") + (unless sexp + (insert (org-agenda-get-some-entry-text + m 10 " " 'planning) + "\n") + (when (setq id + (if (bound-and-true-p + org-mobile-force-id-on-agenda-items) + (org-id-get m 'create) + (or (org-entry-get m "ID") + (org-mobile-get-outline-path-link m)))) + (insert " :PROPERTIES:\n :ORIGINAL_ID: " id + "\n :END:\n"))))) + (beginning-of-line 2)) + (push (cons "agendas.org" (md5 (buffer-string))) + org-mobile-checksum-files)) + (message "Agenda written to Org file %s" file))) + +(defun org-mobile-get-outline-path-link (pom) + (org-with-point-at pom + (concat "olp:" + (org-mobile-escape-olp (file-name-nondirectory buffer-file-name)) + ":" + (mapconcat 'org-mobile-escape-olp + (org-get-outline-path) + "/") + "/" + (org-mobile-escape-olp (nth 4 (org-heading-components)))))) + +(defun org-mobile-escape-olp (s) + (org-link-encode s '(?: ?/))) + +(defun org-mobile-create-sumo-agenda () + "Create a file that contains all custom agenda views." + (interactive) + (let* ((file (expand-file-name "agendas.org" + org-mobile-directory)) + (file1 (if org-mobile-use-encryption + org-mobile-encryption-tempfile + file)) + (sumo (org-mobile-sumo-agenda-command)) + (org-agenda-custom-commands + (list (append sumo (list (list file1))))) + (org-mobile-creating-agendas t)) + (unless (file-writable-p file1) + (error "Cannot write to file %s" file1)) + (when sumo + (org-store-agenda-views)) + (when org-mobile-use-encryption + (org-mobile-encrypt-and-move file1 file) + (delete-file file1) + (org-mobile-cleanup-encryption-tempfile)))) + +(defun org-mobile-encrypt-and-move (infile outfile) + "Encrypt INFILE locally to INFILE_enc, then move it to OUTFILE. +We do this in two steps so that remote paths will work, even if the +encryption program does not understand them." + (let ((encfile (concat infile "_enc"))) + (org-mobile-encrypt-file infile encfile) + (when outfile + (copy-file encfile outfile 'ok-if-already-exists) + (delete-file encfile)))) + +(defun org-mobile-encrypt-file (infile outfile) + "Encrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." + (shell-command + (format "openssl enc -md md5 -aes-256-cbc -salt -pass %s -in %s -out %s" + (shell-quote-argument (concat "pass:" + (org-mobile-encryption-password))) + (shell-quote-argument (expand-file-name infile)) + (shell-quote-argument (expand-file-name outfile))))) + +(defun org-mobile-decrypt-file (infile outfile) + "Decrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." + (shell-command + (format "openssl enc -md md5 -d -aes-256-cbc -salt -pass %s -in %s -out %s" + (shell-quote-argument (concat "pass:" + (org-mobile-encryption-password))) + (shell-quote-argument (expand-file-name infile)) + (shell-quote-argument (expand-file-name outfile))))) + +(defun org-mobile-cleanup-encryption-tempfile () + "Remove the encryption tempfile if it exists." + (and (stringp org-mobile-encryption-tempfile) + (file-exists-p org-mobile-encryption-tempfile) + (delete-file org-mobile-encryption-tempfile))) + +(defun org-mobile-move-capture () + "Move the contents of the capture file to the inbox file. +Return a marker to the location where the new content has been added. +If nothing new has been added, return nil." + (interactive) + (let* ((encfile nil) + (capture-file (expand-file-name org-mobile-capture-file + org-mobile-directory)) + (inbox-buffer (find-file-noselect org-mobile-inbox-for-pull)) + (capture-buffer + (if (not org-mobile-use-encryption) + (find-file-noselect capture-file) + (org-mobile-cleanup-encryption-tempfile) + (setq encfile (concat org-mobile-encryption-tempfile "_enc")) + (copy-file capture-file encfile) + (org-mobile-decrypt-file encfile org-mobile-encryption-tempfile) + (find-file-noselect org-mobile-encryption-tempfile))) + (insertion-point (make-marker)) + not-empty content) + (with-current-buffer capture-buffer + (setq content (buffer-string)) + (setq not-empty (string-match "\\S-" content)) + (when not-empty + (set-buffer inbox-buffer) + (widen) + (goto-char (point-max)) + (or (bolp) (newline)) + (move-marker insertion-point + (prog1 (point) (insert content))) + (save-buffer) + (set-buffer capture-buffer) + (erase-buffer) + (save-buffer) + (org-mobile-update-checksum-for-capture-file (buffer-string)))) + (kill-buffer capture-buffer) + (when org-mobile-use-encryption + (org-mobile-encrypt-and-move org-mobile-encryption-tempfile + capture-file) + (org-mobile-cleanup-encryption-tempfile)) + (if not-empty insertion-point))) + +(defun org-mobile-update-checksum-for-capture-file (buffer-string) + "Find the checksum line and modify it to match BUFFER-STRING." + (let* ((file (expand-file-name "checksums.dat" org-mobile-directory)) + (buffer (find-file-noselect file))) + (when buffer + (with-current-buffer buffer + (when (re-search-forward (concat "\\([[:xdigit:]]\\{30,\\}\\).*?" + (regexp-quote org-mobile-capture-file) + "[ \t]*$") nil t) + (goto-char (match-beginning 1)) + (delete-region (match-beginning 1) (match-end 1)) + (insert (md5 buffer-string)) + (save-buffer))) + (kill-buffer buffer)))) + +(defun org-mobile-apply (&optional beg end) + "Apply all change requests in the current buffer. +If BEG and END are given, only do this in that region." + (interactive) + (require 'org-archive) + (setq org-mobile-last-flagged-files nil) + (setq beg (or beg (point-min)) end (or end (point-max))) + + ;; Remove all Note IDs + (goto-char beg) + (while (re-search-forward "^\\*\\* Note ID: [-0-9A-F]+[ \t]*\n" end t) + (replace-match "")) + + ;; Find all the referenced entries, without making any changes yet + (let ((marker (make-marker)) + (bos-marker (make-marker)) + (end (move-marker (make-marker) end)) + (cnt-new 0) + (cnt-edit 0) + (cnt-flag 0) + (cnt-error 0) + buf-list + org-mobile-error) + + ;; Count the new captures + (goto-char beg) + (while (re-search-forward "^\\* \\(.*\\)" end t) + (and (>= (- (match-end 1) (match-beginning 1)) 2) + (not (equal (downcase (substring (match-string 1) 0 2)) "f(")) + (cl-incf cnt-new))) + + ;; Find and apply the edits + (goto-char beg) + (while (re-search-forward + "^\\*+[ \t]+F(\\([^():\n]*\\)\\(:\\([^()\n]*\\)\\)?)[ \t]+\\[\\[\\(\\(id\\|olp\\):\\([^]\n]+\\)\\)" end t) + (catch 'next + (let* ((action (match-string 1)) + (data (and (match-end 3) (match-string 3))) + (id-pos (condition-case msg + (org-mobile-locate-entry (match-string 4)) + (error (nth 1 msg)))) + (bos (line-beginning-position)) + (eos (save-excursion (org-end-of-subtree t t))) + (cmd (if (equal action "") + (let ((note (buffer-substring-no-properties + (line-beginning-position 2) eos))) + (lambda (_data _old _new) + (cl-incf cnt-flag) + (org-toggle-tag "FLAGGED" 'on) + (org-entry-put + nil "THEFLAGGINGNOTE" + (replace-regexp-in-string "\n" "\\\\n" note)))) + (cl-incf cnt-edit) + (cdr (assoc action org-mobile-action-alist)))) + ;; Do not take notes interactively. + (org-inhibit-logging 'note) + old new) + + (goto-char bos) + (when (and (markerp id-pos) + (not (member (marker-buffer id-pos) buf-list))) + (org-mobile-timestamp-buffer (marker-buffer id-pos)) + (push (marker-buffer id-pos) buf-list)) + (unless (markerp id-pos) + (goto-char (+ 2 (point-at-bol))) + (if (stringp id-pos) + (insert id-pos " ") + (insert "BAD REFERENCE ")) + (cl-incf cnt-error) + (throw 'next t)) + (unless cmd + (insert "BAD FLAG ") + (cl-incf cnt-error) + (throw 'next t)) + (move-marker bos-marker (point)) + (if (re-search-forward "^\\** Old value[ \t]*$" eos t) + (setq old (buffer-substring + (1+ (match-end 0)) + (progn (outline-next-heading) (point))))) + (if (re-search-forward "^\\** New value[ \t]*$" eos t) + (setq new (buffer-substring + (1+ (match-end 0)) + (progn (outline-next-heading) + (if (eobp) (org-back-over-empty-lines)) + (point))))) + (setq old (org-string-nw-p old)) + (setq new (org-string-nw-p new)) + (unless (equal data "body") + (setq new (and new (org-trim new))) + (setq old (and old (org-trim old)))) + (goto-char (+ 2 bos-marker)) + ;; Remember this place so that we can return + (move-marker marker (point)) + (setq org-mobile-error nil) + (condition-case msg + (org-with-point-at id-pos + (funcall cmd data old new) + (unless (member data '("delete" "archive" "archive-sibling" + "addheading")) + (when (member "FLAGGED" (org-get-tags nil t)) + (add-to-list 'org-mobile-last-flagged-files + (buffer-file-name))))) + (error (setq org-mobile-error msg))) + (when org-mobile-error + (pop-to-buffer-same-window (marker-buffer marker)) + (goto-char marker) + (cl-incf cnt-error) + (insert (if (stringp (nth 1 org-mobile-error)) + (nth 1 org-mobile-error) + "EXECUTION FAILED") + " ") + (throw 'next t)) + ;; If we get here, the action has been applied successfully + ;; So remove the entry + (goto-char bos-marker) + (delete-region (point) (org-end-of-subtree t t))))) + (save-buffer) + (move-marker marker nil) + (move-marker end nil) + (message "%d new, %d edits, %d flags, %d errors" + cnt-new cnt-edit cnt-flag cnt-error) + (sit-for 1))) + +(defun org-mobile-timestamp-buffer (buf) + "Time stamp buffer BUF, just to make sure its checksum will change." + (with-current-buffer buf + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (if (re-search-forward + "^\\([ \t]*\\)#\\+LAST_MOBILE_CHANGE:.*\n?" nil t) + (progn + (goto-char (match-end 1)) + (delete-region (point) (match-end 0))) + (if (looking-at ".*?-\\*-.*-\\*-") + (forward-line 1))) + (insert "#+LAST_MOBILE_CHANGE: " + (format-time-string "%Y-%m-%d %T") "\n"))))) + +(defun org-mobile-smart-read () + "Parse the entry at point for shortcuts and expand them. +These shortcuts are meant for fast and easy typing on the limited +keyboards of a mobile device. Below we show a list of the shortcuts +currently implemented. + +The entry is expected to contain an inactive time stamp indicating when +the entry was created. When setting dates and +times (for example for deadlines), the time strings are interpreted +relative to that creation date. +Abbreviations are expected to take up entire lines, just because it is so +easy to type RET on a mobile device. Abbreviations start with one or two +letters, followed immediately by a dot and then additional information. +Generally the entire shortcut line is removed after action have been taken. +Time stamps will be constructed using `org-read-date'. So for example a +line \"dd. 2tue\" will set a deadline on the second Tuesday after the +creation date. + +Here are the shortcuts currently implemented: + +dd. string set deadline +ss. string set scheduling +tt. string set time tamp, here. +ti. string set inactive time + +tg. tag1 tag2 tag3 set all these tags, change case where necessary +td. kwd set this todo keyword, change case where necessary + +FIXME: Hmmm, not sure if we can make his work against the +auto-correction feature. Needs a bit more thinking. So this function +is currently a noop.") + +(defun org-mobile-locate-entry (link) + (if (string-match "\\`id:\\(.*\\)$" link) + (org-id-find (match-string 1 link) 'marker) + (if (not (string-match "\\`olp:\\(.*?\\):\\(.*\\)$" link)) + ; not found with path, but maybe it is to be inserted + ; in top level of the file? + (if (not (string-match "\\`olp:\\(.*?\\)$" link)) + nil + (let ((file (match-string 1 link))) + (setq file (org-link-decode file)) + (setq file (expand-file-name file org-directory)) + (save-excursion + (find-file file) + (goto-char (point-max)) + (newline) + (goto-char (point-max)) + (point-marker)))) + (let ((file (match-string 1 link)) + (path (match-string 2 link))) + (setq file (org-link-decode file)) + (setq file (expand-file-name file org-directory)) + (setq path (mapcar #'org-link-decode + (org-split-string path "/"))) + (org-find-olp (cons file path)))))) + +(defun org-mobile-edit (what old new) + "Edit item WHAT in the current entry by replacing OLD with NEW. +WHAT can be \"heading\", \"todo\", \"tags\", \"priority\", or \"body\". +The edit only takes place if the current value is equal (except for +white space) the OLD. If this is so, OLD will be replace by NEW +and the command will return t. If something goes wrong, a string will +be returned that indicates what went wrong." + (let (current old1 new1 level) + (if (stringp what) (setq what (intern what))) + + (cond + + ((memq what '(todo todostate)) + (setq current (org-get-todo-state)) + (cond + ((equal new "DONEARCHIVE") + (org-todo 'done) + (org-archive-subtree-default)) + ((equal new current) t) ; nothing needs to be done + ((or (equal current old) + (eq org-mobile-force-mobile-change t) + (memq 'todo org-mobile-force-mobile-change)) + (org-todo (or new 'none)) t) + (t (error "State before change was expected as \"%s\", but is \"%s\"" + old current)))) + + ((eq what 'tags) + (setq current (org-get-tags nil t) + new1 (and new (org-split-string new ":+")) + old1 (and old (org-split-string old ":+"))) + (cond + ((org-mobile-tags-same-p current new1) t) ; no change needed + ((or (org-mobile-tags-same-p current old1) + (eq org-mobile-force-mobile-change t) + (memq 'tags org-mobile-force-mobile-change)) + (org-set-tags new1) t) + (t (error "Tags before change were expected as \"%s\", but are \"%s\"" + (or old "") (or current ""))))) + + ((eq what 'priority) + (let ((case-fold-search nil)) + (when (looking-at org-complex-heading-regexp) + (let ((current (and (match-end 3) (substring (match-string 3) 2 3)))) + (cond + ((equal current new) t) ;no action required + ((or (equal current old) + (eq org-mobile-force-mobile-change t) + (memq 'tags org-mobile-force-mobile-change)) + (org-priority (and new (string-to-char new)))) + (t (error "Priority was expected to be %s, but is %s" + old current))))))) + + ((eq what 'heading) + (let ((case-fold-search nil)) + (when (looking-at org-complex-heading-regexp) + (let ((current (match-string 4))) + (cond + ((equal current new) t) ;no action required + ((or (equal current old) + (eq org-mobile-force-mobile-change t) + (memq 'heading org-mobile-force-mobile-change)) + (goto-char (match-beginning 4)) + (insert new) + (delete-region (point) (+ (point) (length current))) + (org-align-tags)) + (t + (error + "Heading changed in the mobile device and on the computer"))))))) + + ((eq what 'addheading) + (if (org-at-heading-p) ; if false we are in top-level of file + (progn + ;; Workaround a `org-insert-heading-respect-content' bug + ;; which prevents correct insertion when point is invisible + (org-show-subtree) + (end-of-line 1) + (org-insert-heading-respect-content t) + (org-demote)) + (beginning-of-line) + (insert "* ")) + (insert new)) + + ((eq what 'refile) + (org-copy-subtree) + (org-with-point-at (org-mobile-locate-entry new) + (if (org-at-heading-p) ; if false we are in top-level of file + (progn + (setq level (org-get-valid-level (funcall outline-level) 1)) + (org-end-of-subtree t t) + (org-paste-subtree level)) + (org-paste-subtree 1))) + (org-cut-subtree)) + + ((eq what 'delete) + (org-cut-subtree)) + + ((eq what 'archive) + (org-archive-subtree)) + + ((eq what 'archive-sibling) + (org-archive-to-archive-sibling)) + + ((eq what 'body) + (setq current (buffer-substring (min (1+ (point-at-eol)) (point-max)) + (save-excursion (outline-next-heading) + (point)))) + (if (not (string-match "\\S-" current)) (setq current nil)) + (cond + ((org-mobile-bodies-same-p current new) t) ; no action necessary + ((or (org-mobile-bodies-same-p current old) + (eq org-mobile-force-mobile-change t) + (memq 'body org-mobile-force-mobile-change)) + (save-excursion + (end-of-line 1) + (insert "\n" new) + (or (bolp) (insert "\n")) + (delete-region (point) (progn (org-back-to-heading t) + (outline-next-heading) + (point)))) + t) + (t (error + "Body was changed in the mobile device and on the computer"))))))) + +(defun org-mobile-tags-same-p (list1 list2) + "Are the two tag lists the same?" + (not (or (org-delete-all list1 list2) + (org-delete-all list2 list1)))) + +(defun org-mobile-bodies-same-p (a b) + "Compare if A and B are visually equal strings. +We first remove leading and trailing white space from the entire strings. +Then we split the strings into lines and remove leading/trailing whitespace +from each line. Then we compare. +A and B must be strings or nil." + (cond + ((and (not a) (not b)) t) + ((or (not a) (not b)) nil) + (t (setq a (org-trim a) b (org-trim b)) + (setq a (mapconcat 'identity (org-split-string a "[ \t]*\n[ \t]*") "\n")) + (setq b (mapconcat 'identity (org-split-string b "[ \t]*\n[ \t]*") "\n")) + (equal a b)))) + +(provide 'org-mobile) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-mobile.el ends here diff --git a/elpa/org-9.5.2/org-mobile.elc b/elpa/org-9.5.2/org-mobile.elc new file mode 100644 index 0000000..17d630a Binary files /dev/null and b/elpa/org-9.5.2/org-mobile.elc differ diff --git a/elpa/org-9.5.2/org-mouse.el b/elpa/org-9.5.2/org-mouse.el new file mode 100644 index 0000000..a35a19b --- /dev/null +++ b/elpa/org-9.5.2/org-mouse.el @@ -0,0 +1,1100 @@ +;;; org-mouse.el --- Better mouse support for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2006-2021 Free Software Foundation, Inc. + +;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com> +;; Maintainer: Carsten Dominik <carsten.dominik@gmail.com> + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: +;; +;; Org-mouse provides mouse support for org-mode. +;; +;; https://orgmode.org +;; +;; Org mouse implements the following features: +;; * following links with the left mouse button +;; * subtree expansion/collapse (org-cycle) with the left mouse button +;; * several context menus on the right mouse button: +;; + general text +;; + headlines +;; + timestamps +;; + priorities +;; + links +;; + tags +;; * promoting/demoting/moving subtrees with mouse-3 +;; + if the drag starts and ends in the same line then promote/demote +;; + otherwise move the subtree +;; +;; Use +;; --- +;; +;; To use this package, put the following line in your .emacs: +;; +;; (require 'org-mouse) +;; + +;; FIXME: +;; + deal with folding / unfolding issues + +;; TODO (This list is only theoretical, if you'd like to have some +;; feature implemented or a bug fix please send me an email, even if +;; something similar appears in the list below. This will help me get +;; the priorities right.): +;; +;; + org-store-link, insert link +;; + org tables +;; + occur with the current word/tag (same menu item) +;; + ctrl-c ctrl-c, for example, renumber the current list +;; + internal links + +;; Please email the maintainer with new feature suggestions / bugs + +;; History: +;; +;; Since version 5.10: Changes are listed in the general Org docs. +;; +;; Version 5.09;; + Version number synchronization with Org mode. +;; +;; Version 0.25 +;; + made compatible with Org 4.70 (thanks to Carsten for the patch) +;; +;; Version 0.24 +;; + minor changes to the table menu +;; +;; Version 0.23 +;; + preliminary support for tables and calculation marks +;; + context menu support for org-agenda-undo & org-sort-entries +;; +;; Version 0.22 +;; + handles undo support for the agenda buffer (requires Org >=4.58) +;; +;; Version 0.21 +;; + selected text activates its context menu +;; + shift-middleclick or right-drag inserts the text from the clipboard in the form of a link +;; +;; Version 0.20 +;; + the new "TODO Status" submenu replaces the "Cycle TODO" menu item +;; + the TODO menu can now list occurrences of a specific TODO keyword +;; + #+STARTUP line is now recognized +;; +;; Version 0.19 +;; + added support for dragging URLs to the org-buffer +;; +;; Version 0.18 +;; + added support for agenda blocks +;; +;; Version 0.17 +;; + toggle checkboxes with a single click +;; +;; Version 0.16 +;; + added support for checkboxes +;; +;; Version 0.15 +;; + Org now works with the Agenda buffer as well +;; +;; Version 0.14 +;; + added a menu option that converts plain list items to outline items +;; +;; Version 0.13 +;; + "Insert Heading" now inserts a sibling heading if the point is +;; on "***" and a child heading otherwise +;; +;; Version 0.12 +;; + compatible with Emacs 21 +;; + custom agenda commands added to the main menu +;; + moving trees should now work between windows in the same frame +;; +;; Version 0.11 +;; + fixed org-mouse-at-link (thanks to Carsten) +;; + removed [follow-link] bindings +;; +;; Version 0.10 +;; + added a menu option to remove highlights +;; + compatible with Org 4.21 now +;; +;; Version 0.08: +;; + trees can be moved/promoted/demoted by dragging with the right +;; mouse button (mouse-3) +;; + small changes in the above function +;; +;; Versions 0.01 -- 0.07: (I don't remember) + +;;; Code: + +(require 'org) +(require 'cl-lib) + +(defvar org-agenda-allow-remote-undo) +(defvar org-agenda-undo-list) +(defvar org-agenda-custom-commands) +(declare-function org-agenda-change-all-lines "org-agenda" + (newhead hdmarker &optional fixface just-this)) +(declare-function org-verify-change-for-undo "org-agenda" (l1 l2)) +(declare-function org-apply-on-list "org-list" (function init-value &rest args)) +(declare-function org-agenda-earlier "org-agenda" (arg)) +(declare-function org-agenda-later "org-agenda" (arg)) + +(defvar org-mouse-main-buffer nil + "Active buffer for mouse operations.") +(defvar org-mouse-plain-list-regexp "\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) " + "Regular expression that matches a plain list.") +(defvar org-mouse-direct t + "Internal variable indicating whether the current action is direct. + +If t, then the current action has been invoked directly through the buffer +it is intended to operate on. If nil, then the action has been invoked +indirectly, for example, through the agenda buffer.") + +(defgroup org-mouse nil + "Mouse support for `org-mode'." + :tag "Org Mouse" + :group 'org) + +(defcustom org-mouse-punctuation ":" + "Punctuation used when inserting text by drag and drop." + :type 'string) + +(defcustom org-mouse-features + '(context-menu yank-link activate-stars activate-bullets activate-checkboxes) + "The features of org-mouse that should be activated. +Changing this variable requires a restart of Emacs to get activated." + :type '(set :greedy t + (const :tag "Mouse-3 shows context menu" context-menu) + (const :tag "C-mouse-1 and mouse-3 move trees" move-tree) + (const :tag "S-mouse-2 and drag-mouse-3 yank link" yank-link) + (const :tag "Activate headline stars" activate-stars) + (const :tag "Activate item bullets" activate-bullets) + (const :tag "Activate checkboxes" activate-checkboxes))) + +(defun org-mouse-re-search-line (regexp) + "Search the current line for a given regular expression." + (beginning-of-line) + (re-search-forward regexp (point-at-eol) t)) + +(defun org-mouse-end-headline () + "Go to the end of current headline (ignoring tags)." + (interactive) + (end-of-line) + (skip-chars-backward "\t ") + (when (looking-back ":[A-Za-z]+:" (line-beginning-position)) + (skip-chars-backward ":A-Za-z") + (skip-chars-backward "\t "))) + +(defvar-local org-mouse-context-menu-function nil + "Function to create the context menu. +The value of this variable is the function invoked by +`org-mouse-context-menu' as the context menu.") + +(defun org-mouse-show-context-menu (event prefix) + "Invoke the context menu. + +If the value of `org-mouse-context-menu-function' is a function, then +this function is called. Otherwise, the current major mode menu is used." + (interactive "@e \nP") + (if (and (= (event-click-count event) 1) + (or (not mark-active) + (sit-for (/ double-click-time 1000.0)))) + (progn + (select-window (posn-window (event-start event))) + (when (not (org-mouse-mark-active)) + (goto-char (posn-point (event-start event))) + (when (not (eolp)) (save-excursion (run-hooks 'post-command-hook))) + (sit-for 0)) + (if (functionp org-mouse-context-menu-function) + (funcall org-mouse-context-menu-function event) + (if (fboundp 'mouse-menu-major-mode-map) + (popup-menu (mouse-menu-major-mode-map) event prefix) + (with-no-warnings ; don't warn about fallback, obsolete since 23.1 + (mouse-major-mode-menu event prefix))))) + (setq this-command 'mouse-save-then-kill) + (mouse-save-then-kill event))) + +(defun org-mouse-line-position () + "Return `:beginning' or `:middle' or `:end', depending on the point position. + +If the point is at the end of the line, return `:end'. +If the point is separated from the beginning of the line only by white +space and *'s (`org-mouse-bolp'), return `:beginning'. Otherwise, +return `:middle'." + (cond + ((eolp) :end) + ((org-mouse-bolp) :beginning) + (t :middle))) + +(defun org-mouse-empty-line () + "Return non-nil iff the line contains only white space." + (save-excursion (beginning-of-line) (looking-at "[ \t]*$"))) + +(defun org-mouse-next-heading () + "Go to the next heading. +If there is none, ensure that the point is at the beginning of an empty line." + (unless (outline-next-heading) + (beginning-of-line) + (unless (org-mouse-empty-line) + (end-of-line) + (newline)))) + +(defun org-mouse-insert-heading () + "Insert a new heading, as `org-insert-heading'. + +If the point is at the :beginning (`org-mouse-line-position') of the line, +insert the new heading before the current line. Otherwise, insert it +after the current heading." + (interactive) + (cl-case (org-mouse-line-position) + (:beginning (beginning-of-line) + (org-insert-heading)) + (t (org-mouse-next-heading) + (org-insert-heading)))) + +(defun org-mouse-timestamp-today (&optional shift units) + "Change the timestamp into SHIFT UNITS in the future. + +For the acceptable UNITS, see `org-timestamp-change'." + (interactive) + (org-time-stamp nil) + (when shift (org-timestamp-change shift units))) + +(defun org-mouse-keyword-menu (keywords function &optional selected itemformat) + "A helper function. + +Returns a menu fragment consisting of KEYWORDS. When a keyword +is selected by the user, FUNCTION is called with the selected +keyword as the only argument. + +If SELECTED is nil, then all items are normal menu items. If +SELECTED is a function, then each item is a checkbox, which is +enabled for a given keyword iff (funcall SELECTED keyword) return +non-nil. If SELECTED is neither nil nor a function, then the +items are radio buttons. A radio button is enabled for the +keyword `equal' to SELECTED. + +ITEMFORMAT governs formatting of the elements of KEYWORDS. If it +is a function, it is invoked with the keyword as the only +argument. If it is a string, it is interpreted as the format +string to (format ITEMFORMAT keyword). If it is neither a string +nor a function, elements of KEYWORDS are used directly." + (mapcar + (lambda (keyword) + (vector (cond + ((functionp itemformat) (funcall itemformat keyword)) + ((stringp itemformat) (format itemformat keyword)) + (t keyword)) + (list 'funcall function keyword) + :style (cond + ((null selected) t) + ((functionp selected) 'toggle) + (t 'radio)) + :selected (if (functionp selected) + (and (funcall selected keyword) t) + (equal selected keyword)))) + keywords)) + +(defun org-mouse-remove-match-and-spaces () + "Remove the match, make just one space around the point." + (interactive) + (replace-match "") + (just-one-space)) + +(defvar org-mouse-rest) +(defun org-mouse-replace-match-and-surround + (_newtext &optional _fixedcase _literal _string subexp) + "The same as `replace-match', but surrounds the replacement with spaces." + (apply #'replace-match org-mouse-rest) + (save-excursion + (goto-char (match-beginning (or subexp 0))) + (just-one-space) + (goto-char (match-end (or subexp 0))) + (just-one-space))) + +(defun org-mouse-keyword-replace-menu (keywords &optional group itemformat + nosurround) + "A helper function. + +Returns a menu fragment consisting of KEYWORDS. When a keyword +is selected, group GROUP of the current match is replaced by the +keyword. The method ensures that both ends of the replacement +are separated from the rest of the text in the buffer by +individual spaces (unless NOSURROUND is non-nil). + +The final entry of the menu is always \"None\", which removes the +match. + +ITEMFORMAT governs formatting of the elements of KEYWORDS. If it +is a function, it is invoked with the keyword as the only +argument. If it is a string, it is interpreted as the format +string to (format ITEMFORMAT keyword). If it is neither a string +nor a function, elements of KEYWORDS are used directly." + (setq group (or group 0)) + (let ((replace (org-mouse-match-closure + (if nosurround #'replace-match + #'org-mouse-replace-match-and-surround)))) + (append + (org-mouse-keyword-menu + keywords + (lambda (keyword) (funcall replace keyword t t nil group)) + (match-string group) + itemformat) + `(["None" org-mouse-remove-match-and-spaces + :style radio + :selected ,(not (member (match-string group) keywords))])))) + +(defun org-mouse-show-headlines () + "Change the visibility of the current org buffer to only show headlines." + (interactive) + (let ((this-command 'org-cycle) + (last-command 'org-cycle) + (org-cycle-global-status nil)) + (org-cycle '(4)) + (org-cycle '(4)))) + +(defun org-mouse-show-overview () + "Change visibility of current org buffer to first-level headlines only." + (interactive) + (let ((org-cycle-global-status nil)) + (org-cycle '(4)))) + +(defun org-mouse-set-priority (priority) + "Set the priority of the current headline to PRIORITY." + (org-priority priority)) + +(defvar org-mouse-priority-regexp "\\[#\\([A-Z]\\)\\]" + "Regular expression matching the priority indicator. +Differs from `org-priority-regexp' in that it doesn't contain the +leading `.*?'.") + +(defun org-mouse-get-priority (&optional default) + "Return the priority of the current headline. +DEFAULT is returned if no priority is given in the headline." + (save-excursion + (if (org-mouse-re-search-line org-mouse-priority-regexp) + (match-string 1) + (when default (char-to-string org-priority-default))))) + +(defun org-mouse-delete-timestamp () + "Deletes the current timestamp as well as the preceding keyword. +SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" + (when (or (org-at-date-range-p) (org-at-timestamp-p 'lax)) + (replace-match "") ;delete the timestamp + (skip-chars-backward " :A-Z") + (when (looking-at " *[A-Z][A-Z]+:") + (replace-match "")))) + +(defun org-mouse-looking-at (regexp skipchars &optional movechars) + (save-excursion + (let ((point (point))) + (if (looking-at regexp) t + (skip-chars-backward skipchars) + (forward-char (or movechars 0)) + (when (looking-at regexp) + (> (match-end 0) point)))))) + +(defun org-mouse-priority-list () + (cl-loop for priority from ?A to org-priority-lowest + collect (char-to-string priority))) + +(defun org-mouse-todo-menu (state) + "Create the menu with TODO keywords." + (append + (let ((kwds org-todo-keywords-1)) + (org-mouse-keyword-menu + kwds + #'org-todo + (lambda (kwd) (equal state kwd)))))) + +(defun org-mouse-tag-menu () ;todo + "Create the tags menu." + (append + (let ((tags (org-get-tags nil t))) + (org-mouse-keyword-menu + (sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp) + (lambda (tag) + (org-mouse-set-tags + (sort (if (member tag tags) + (delete tag tags) + (cons tag tags)) + #'string-lessp))) + (lambda (tag) (member tag tags)) + )) + '("--" + ["Align Tags Here" (org-align-tags) t] + ["Align Tags in Buffer" (org-align-tags t) t] + ["Set Tags ..." (org-set-tags-command) t]))) + +(defun org-mouse-set-tags (tags) + (org-set-tags tags)) + +(defun org-mouse-insert-checkbox () + (interactive) + (and (org-at-item-p) + (goto-char (match-end 0)) + (unless (org-at-item-checkbox-p) + (delete-horizontal-space) + (insert " [ ] ")))) + +(defun org-mouse-agenda-type (type) + (pcase type + (`tags "Tags: ") + (`todo "TODO: ") + (`tags-tree "Tags tree: ") + (`todo-tree "TODO tree: ") + (`occur-tree "Occur tree: ") + (_ "Agenda command ???"))) + +(defun org-mouse-list-options-menu (alloptions &optional function) + (let ((options (save-match-data + (split-string (match-string-no-properties 1))))) + (print options) + (cl-loop for name in alloptions + collect + (vector name + `(progn + (replace-match + (mapconcat 'identity + (sort (if (member ',name ',options) + (delete ',name ',options) + (cons ',name ',options)) + 'string-lessp) + " ") + nil nil nil 1) + (when (functionp ',function) (funcall ',function))) + :style 'toggle + :selected (and (member name options) t))))) + +(defun org-mouse-clip-text (text maxlength) + (if (> (length text) maxlength) + (concat (substring text 0 (- maxlength 3)) "...") + text)) + +(defun org-mouse-popup-global-menu () + (popup-menu + `("Main Menu" + ["Show Overview" org-mouse-show-overview t] + ["Show Headlines" org-mouse-show-headlines t] + ["Show All" org-show-all t] + ["Remove Highlights" org-remove-occur-highlights + :visible org-occur-highlights] + "--" + ["Check Deadlines" + (if (functionp 'org-check-deadlines-and-todos) + (org-check-deadlines-and-todos org-deadline-warning-days) + (org-check-deadlines org-deadline-warning-days)) + t] + ["Check TODOs" org-show-todo-tree t] + ("Check Tags" + ,@(org-mouse-keyword-menu + (sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp) + (lambda (tag) (org-tags-sparse-tree nil tag))) + "--" + ["Custom Tag ..." org-tags-sparse-tree t]) + ["Check Phrase ..." org-occur] + "--" + ["Display Agenda" org-agenda-list t] + ["Display TODO List" org-todo-list t] + ("Display Tags" + ,@(org-mouse-keyword-menu + (sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp) + (lambda (tag) (org-tags-view nil tag))) + "--" + ["Custom Tag ..." org-tags-view t]) + ["Display Calendar" org-goto-calendar t] + "--" + ,@(org-mouse-keyword-menu + (mapcar #'car org-agenda-custom-commands) + (lambda (key) + (org-agenda nil (string-to-char key))) + nil + (lambda (key) + (let ((entry (assoc key org-agenda-custom-commands))) + (org-mouse-clip-text + (cond + ((stringp (nth 1 entry)) (nth 1 entry)) + ((stringp (nth 2 entry)) + (concat (org-mouse-agenda-type (nth 1 entry)) + (nth 2 entry))) + (t "Agenda Command `%s'")) + 30)))) + "--" + ["Delete Blank Lines" delete-blank-lines + :visible (org-mouse-empty-line)] + ["Insert Checkbox" org-mouse-insert-checkbox + :visible (and (org-at-item-p) (not (org-at-item-checkbox-p)))] + ["Insert Checkboxes" + (org-mouse-for-each-item 'org-mouse-insert-checkbox) + :visible (and (org-at-item-p) (not (org-at-item-checkbox-p)))] + ["Plain List to Outline" org-mouse-transform-to-outline + :visible (org-at-item-p)]))) + +(defun org-mouse-get-context (contextlist context) + (let ((contextdata (assq context contextlist))) + (when contextdata + (save-excursion + (goto-char (nth 1 contextdata)) + (re-search-forward ".*" (nth 2 contextdata)))))) + +(defun org-mouse-for-each-item (funct) + ;; Functions called by `org-apply-on-list' need an argument. + (let ((wrap-fun (lambda (_) (funcall funct)))) + (when (ignore-errors (goto-char (org-in-item-p))) + (save-excursion (org-apply-on-list wrap-fun nil))))) + +(defun org-mouse-bolp () + "Return true if there only spaces, tabs, and `*' before point. +This means, between the beginning of line and the point." + (save-excursion + (skip-chars-backward " \t*") (bolp))) + +(defun org-mouse-insert-item (text) + (cl-case (org-mouse-line-position) + (:beginning ; insert before + (beginning-of-line) + (looking-at "[ \t]*") + (open-line 1) + (indent-to-column (- (match-end 0) (match-beginning 0))) + (insert "+ ")) + (:middle ; insert after + (end-of-line) + (newline t) + (indent-relative) + (insert "+ ")) + (:end ; insert text here + (skip-chars-backward " \t") + (kill-region (point) (point-at-eol)) + (unless (looking-back org-mouse-punctuation (line-beginning-position)) + (insert (concat org-mouse-punctuation " "))))) + (insert text) + (beginning-of-line)) + +(defadvice dnd-insert-text (around org-mouse-dnd-insert-text activate) + (if (derived-mode-p 'org-mode) + (org-mouse-insert-item text) + ad-do-it)) + +(defadvice dnd-open-file (around org-mouse-dnd-open-file activate) + (if (derived-mode-p 'org-mode) + (org-mouse-insert-item uri) + ad-do-it)) + +(defun org-mouse-match-closure (function) + (let ((match (match-data t))) + (lambda (&rest rest) + (save-match-data + (set-match-data match) + (apply function rest))))) + +(defun org-mouse-yank-link (click) + (interactive "e") + ;; Give temporary modes such as isearch a chance to turn off. + (run-hooks 'mouse-leave-buffer-hook) + (mouse-set-point click) + (setq mouse-selection-click-count 0) + (delete-horizontal-space) + (insert-for-yank (concat " [[" (current-kill 0) "]] "))) + +(defun org-mouse-context-menu (&optional event) + (let* ((stamp-prefixes (list org-deadline-string org-scheduled-string)) + (contextlist (org-context)) + (get-context (lambda (context) (org-mouse-get-context contextlist context)))) + (cond + ((org-mouse-mark-active) + (let ((region-string (buffer-substring (region-beginning) (region-end)))) + (popup-menu + `(nil + ["Sparse Tree" (org-occur ',region-string)] + ["Find in Buffer" (occur ',region-string)] + ["Grep in Current Dir" + (grep (format "grep -rnH -e '%s' *" ',region-string))] + ["Grep in Parent Dir" + (grep (format "grep -rnH -e '%s' ../*" ',region-string))] + "--" + ["Convert to Link" + (progn (save-excursion (goto-char (region-beginning)) (insert "[[")) + (save-excursion (goto-char (region-end)) (insert "]]")))] + ["Insert Link Here" (org-mouse-yank-link ',event)])))) + ((save-excursion (beginning-of-line) (looking-at "[ \t]*#\\+STARTUP: \\(.*\\)")) + (popup-menu + `(nil + ,@(org-mouse-list-options-menu (mapcar #'car org-startup-options) + 'org-mode-restart)))) + ((or (eolp) + (and (looking-at "\\( \\|\t\\)\\(\\+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$") + (looking-back " \\|\t" (- (point) 2) + (line-beginning-position)))) + (org-mouse-popup-global-menu)) + ((funcall get-context :checkbox) + (popup-menu + '(nil + ["Toggle" org-toggle-checkbox t] + ["Remove" org-mouse-remove-match-and-spaces t] + "" + ["All Clear" (org-mouse-for-each-item + (lambda () + (when (save-excursion (org-at-item-checkbox-p)) + (replace-match "[ ] "))))] + ["All Set" (org-mouse-for-each-item + (lambda () + (when (save-excursion (org-at-item-checkbox-p)) + (replace-match "[X] "))))] + ["All Toggle" (org-mouse-for-each-item 'org-toggle-checkbox) t] + ["All Remove" (org-mouse-for-each-item + (lambda () + (when (save-excursion (org-at-item-checkbox-p)) + (org-mouse-remove-match-and-spaces))))] + ))) + ((and (org-mouse-looking-at "\\b\\w+" "a-zA-Z0-9_") + (member (match-string 0) org-todo-keywords-1)) + (popup-menu + `(nil + ,@(org-mouse-todo-menu (match-string 0)) + "--" + ["Check TODOs" org-show-todo-tree t] + ["List all TODO keywords" org-todo-list t] + [,(format "List only %s" (match-string 0)) + (org-todo-list (match-string 0)) t] + ))) + ((and (org-mouse-looking-at "\\b[A-Z]+:" "A-Z") + (member (match-string 0) stamp-prefixes)) + (popup-menu + `(nil + ,@(org-mouse-keyword-replace-menu stamp-prefixes) + "--" + ["Check Deadlines" org-check-deadlines t] + ))) + ((org-mouse-looking-at org-mouse-priority-regexp "[]A-Z#") ; priority + (popup-menu `(nil ,@(org-mouse-keyword-replace-menu + (org-mouse-priority-list) 1 "Priority %s" t)))) + ((funcall get-context :link) + (popup-menu + '(nil + ["Open" org-open-at-point t] + ["Open in Emacs" (org-open-at-point t) t] + "--" + ["Copy link" (org-kill-new (match-string 0))] + ["Cut link" + (progn + (kill-region (match-beginning 0) (match-end 0)) + (just-one-space))] + "--" + ["Grep for TODOs" + (grep (format "grep -nH -i 'todo\\|fixme' %s*" (match-string 2)))] + ; ["Paste file link" ((insert "file:") (yank))] + ))) + ((org-mouse-looking-at ":\\([A-Za-z0-9_]+\\):" "A-Za-z0-9_" -1) ;tags + (popup-menu + `(nil + [,(format-message "Display `%s'" (match-string 1)) + (org-tags-view nil ,(match-string 1))] + [,(format-message "Sparse Tree `%s'" (match-string 1)) + (org-tags-sparse-tree nil ,(match-string 1))] + "--" + ,@(org-mouse-tag-menu)))) + ((org-at-timestamp-p 'lax) + (popup-menu + '(nil + ["Show Day" org-open-at-point t] + ["Change Timestamp" org-time-stamp t] + ["Delete Timestamp" (org-mouse-delete-timestamp) t] + ["Compute Time Range" org-evaluate-time-range (org-at-date-range-p)] + "--" + ["Set for Today" org-mouse-timestamp-today] + ["Set for Tomorrow" (org-mouse-timestamp-today 1 'day)] + ["Set in 1 Week" (org-mouse-timestamp-today 7 'day)] + ["Set in 2 Weeks" (org-mouse-timestamp-today 14 'day)] + ["Set in a Month" (org-mouse-timestamp-today 1 'month)] + "--" + ["+ 1 Day" (org-timestamp-change 1 'day)] + ["+ 1 Week" (org-timestamp-change 7 'day)] + ["+ 1 Month" (org-timestamp-change 1 'month)] + "--" + ["- 1 Day" (org-timestamp-change -1 'day)] + ["- 1 Week" (org-timestamp-change -7 'day)] + ["- 1 Month" (org-timestamp-change -1 'month)]))) + ((funcall get-context :table-special) + (let ((mdata (match-data))) + (cl-incf (car mdata) 2) + (store-match-data mdata)) + (message "match: %S" (match-string 0)) + (popup-menu `(nil ,@(org-mouse-keyword-replace-menu + '(" " "!" "^" "_" "$" "#" "*" "'") 0 + (lambda (mark) + (cl-case (string-to-char mark) + (? "( ) Nothing Special") + (?! "(!) Column Names") + (?^ "(^) Field Names Above") + (?_ "(^) Field Names Below") + (?$ "($) Formula Parameters") + (?# "(#) Recalculation: Auto") + (?* "(*) Recalculation: Manual") + (?' "(') Recalculation: None"))) + t)))) + ((assq :table contextlist) + (popup-menu + '(nil + ["Align Table" org-ctrl-c-ctrl-c] + ["Blank Field" org-table-blank-field] + ["Edit Field" org-table-edit-field] + "--" + ("Column" + ["Move Column Left" org-metaleft] + ["Move Column Right" org-metaright] + ["Delete Column" org-shiftmetaleft] + ["Insert Column" org-shiftmetaright] + "--" + ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :selected org-table-limit-column-width :style toggle]) + ("Row" + ["Move Row Up" org-metaup] + ["Move Row Down" org-metadown] + ["Delete Row" org-shiftmetaup] + ["Insert Row" org-shiftmetadown] + ["Sort lines in region" org-table-sort-lines (org-at-table-p)] + "--" + ["Insert Hline" org-table-insert-hline]) + ("Rectangle" + ["Copy Rectangle" org-copy-special] + ["Cut Rectangle" org-cut-special] + ["Paste Rectangle" org-paste-special] + ["Fill Rectangle" org-table-wrap-region]) + "--" + ["Set Column Formula" org-table-eval-formula] + ["Set Field Formula" (org-table-eval-formula '(4))] + ["Edit Formulas" org-table-edit-formulas] + "--" + ["Recalculate Line" org-table-recalculate] + ["Recalculate All" (org-table-recalculate '(4))] + ["Iterate All" (org-table-recalculate '(16))] + "--" + ["Toggle Recalculate Mark" org-table-rotate-recalc-marks] + ["Sum Column/Rectangle" org-table-sum + :active (or (org-at-table-p) (org-region-active-p))] + ["Field Info" org-table-field-info] + ["Debug Formulas" + (setq org-table-formula-debug (not org-table-formula-debug)) + :style toggle :selected org-table-formula-debug] + ))) + ((and (assq :headline contextlist) (not (eolp))) + (let ((priority (org-mouse-get-priority t))) + (popup-menu + `("Headline Menu" + ("Tags and Priorities" + ,@(org-mouse-keyword-menu + (org-mouse-priority-list) + (lambda (keyword) + (org-mouse-set-priority (string-to-char keyword))) + priority "Priority %s") + "--" + ,@(org-mouse-tag-menu)) + ("TODO Status" + ,@(org-mouse-todo-menu (org-get-todo-state))) + ["Show Tags" + (with-current-buffer org-mouse-main-buffer (org-agenda-show-tags)) + :visible (not org-mouse-direct)] + ["Show Priority" + (with-current-buffer org-mouse-main-buffer (org-agenda-show-priority)) + :visible (not org-mouse-direct)] + ,@(if org-mouse-direct '("--") nil) + ["New Heading" org-mouse-insert-heading :visible org-mouse-direct] + ["Set Deadline" + (progn (org-mouse-end-headline) (insert " ") (org-deadline)) + :active (not (save-excursion + (org-mouse-re-search-line org-deadline-regexp)))] + ["Schedule Task" + (progn (org-mouse-end-headline) (insert " ") (org-schedule)) + :active (not (save-excursion + (org-mouse-re-search-line org-scheduled-regexp)))] + ["Insert Timestamp" + (progn (org-mouse-end-headline) (insert " ") (org-time-stamp nil)) t] + ; ["Timestamp (inactive)" org-time-stamp-inactive t] + "--" + ["Archive Subtree" org-archive-subtree] + ["Cut Subtree" org-cut-special] + ["Copy Subtree" org-copy-special] + ["Paste Subtree" org-paste-special :visible org-mouse-direct] + ("Sort Children" + ["Alphabetically" (org-sort-entries nil ?a)] + ["Numerically" (org-sort-entries nil ?n)] + ["By Time/Date" (org-sort-entries nil ?t)] + "--" + ["Reverse Alphabetically" (org-sort-entries nil ?A)] + ["Reverse Numerically" (org-sort-entries nil ?N)] + ["Reverse By Time/Date" (org-sort-entries nil ?T)]) + "--" + ["Move Trees" org-mouse-move-tree :active nil] + )))) + (t + (org-mouse-popup-global-menu))))) + +(defun org-mouse-mark-active () + (and mark-active transient-mark-mode)) + +(defun org-mouse-in-region-p (pos) + (and (org-mouse-mark-active) + (>= pos (region-beginning)) + (< pos (region-end)))) + +(defun org-mouse-down-mouse (event) + (interactive "e") + (setq this-command last-command) + (unless (and (= 1 (event-click-count event)) + (org-mouse-in-region-p (posn-point (event-start event)))) + (mouse-drag-region event))) + +(add-hook 'org-mode-hook + (lambda () + (setq org-mouse-context-menu-function #'org-mouse-context-menu) + + (when (memq 'context-menu org-mouse-features) + (org-defkey org-mouse-map [mouse-3] nil) + (org-defkey org-mode-map [mouse-3] #'org-mouse-show-context-menu)) + (org-defkey org-mode-map [down-mouse-1] #'org-mouse-down-mouse) + (when (memq 'context-menu org-mouse-features) + (org-defkey org-mouse-map [C-drag-mouse-1] #'org-mouse-move-tree) + (org-defkey org-mouse-map [C-down-mouse-1] #'org-mouse-move-tree-start)) + (when (memq 'yank-link org-mouse-features) + (org-defkey org-mode-map [S-mouse-2] #'org-mouse-yank-link) + (org-defkey org-mode-map [drag-mouse-3] #'org-mouse-yank-link)) + (when (memq 'move-tree org-mouse-features) + (org-defkey org-mouse-map [drag-mouse-3] #'org-mouse-move-tree) + (org-defkey org-mouse-map [down-mouse-3] #'org-mouse-move-tree-start)) + + (when (memq 'activate-stars org-mouse-features) + (font-lock-add-keywords + nil + `((,org-outline-regexp + 0 `(face org-link mouse-face highlight keymap ,org-mouse-map) + 'prepend)) + t)) + + (when (memq 'activate-bullets org-mouse-features) + (font-lock-add-keywords + nil + `(("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +" + (1 `(face org-link keymap ,org-mouse-map mouse-face highlight) + 'prepend))) + t)) + + (when (memq 'activate-checkboxes org-mouse-features) + (font-lock-add-keywords + nil + `(("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)" + (1 `(face nil keymap ,org-mouse-map mouse-face highlight) prepend))) + t)) + + (defadvice org-open-at-point (around org-mouse-open-at-point activate) + (let ((context (org-context))) + (cond + ((assq :headline-stars context) (org-cycle)) + ((assq :checkbox context) (org-toggle-checkbox)) + ((assq :item-bullet context) + (let ((org-cycle-include-plain-lists t)) (org-cycle))) + ((org-footnote-at-reference-p) nil) + (t ad-do-it)))))) + +(defun org-mouse-move-tree-start (_event) + (interactive "e") + (message "Same line: promote/demote, (***):move before, (text): make a child")) + + +(defun org-mouse-make-marker (position) + (with-current-buffer (window-buffer (posn-window position)) + (copy-marker (posn-point position)))) + +(defun org-mouse-move-tree (event) + ;; todo: handle movements between different buffers + (interactive "e") + (save-excursion + (let* ((start (org-mouse-make-marker (event-start event))) + (end (org-mouse-make-marker (event-end event))) + (sbuf (marker-buffer start)) + (ebuf (marker-buffer end))) + + (when (and sbuf ebuf) + (set-buffer sbuf) + (goto-char start) + (org-back-to-heading) + (if (and (eq sbuf ebuf) + (equal + (point) + (save-excursion (goto-char end) (org-back-to-heading) (point)))) + ;; if the same line then promote/demote + (if (>= end start) (org-demote-subtree) (org-promote-subtree)) + ;; if different lines then move + (org-cut-subtree) + + (set-buffer ebuf) + (goto-char end) + (org-back-to-heading) + (when (and (eq sbuf ebuf) + (equal + (point) + (save-excursion (goto-char start) + (org-back-to-heading) (point)))) + (progn (org-end-of-subtree nil t) + (unless (eobp) (backward-char))) + (end-of-line) + (if (eobp) (newline) (forward-char))) + + (when (looking-at org-outline-regexp) + (let ((level (- (match-end 0) (match-beginning 0)))) + (when (> end (match-end 0)) + (progn (org-end-of-subtree nil t) + (unless (eobp) (backward-char))) + (end-of-line) + (if (eobp) (newline) (forward-char)) + (setq level (1+ level))) + (org-paste-subtree level) + (save-excursion + (progn (org-end-of-subtree nil t) + (unless (eobp) (backward-char))) + (when (bolp) (delete-char -1)))))))))) + + +(defun org-mouse-transform-to-outline () + (interactive) + (org-back-to-heading) + (let ((minlevel 1000) + (replace-text (concat (match-string 0) "* "))) + (beginning-of-line 2) + (save-excursion + (while (not (or (eobp) (looking-at org-outline-regexp))) + (when (looking-at org-mouse-plain-list-regexp) + (setq minlevel (min minlevel (- (match-end 1) (match-beginning 1))))) + (forward-line))) + (while (not (or (eobp) (looking-at org-outline-regexp))) + (when (and (looking-at org-mouse-plain-list-regexp) + (eq minlevel (- (match-end 1) (match-beginning 1)))) + (replace-match replace-text)) + (forward-line)))) + +(defvar org-mouse-cmd) ;dynamically scoped from `org-with-remote-undo'. + +(defun org-mouse-do-remotely (command) + ;; (org-agenda-check-no-diary) + (when (get-text-property (point) 'org-marker) + (let* ((anticol (- (point-at-eol) (point))) + (marker (get-text-property (point) 'org-marker)) + (buffer (marker-buffer marker)) + (pos (marker-position marker)) + (hdmarker (get-text-property (point) 'org-hd-marker)) + (buffer-read-only nil) + (newhead "--- removed ---") + (org-mouse-direct nil) + (org-mouse-main-buffer (current-buffer))) + (when (eq (with-current-buffer buffer major-mode) 'org-mode) + (let ((endmarker (with-current-buffer buffer + (org-end-of-subtree nil t) + (unless (eobp) (forward-char 1)) + (point-marker)))) + (org-with-remote-undo buffer + (with-current-buffer buffer + (widen) + (goto-char pos) + (org-show-hidden-entry) + (save-excursion + (and (outline-next-heading) + (org-flag-heading nil))) ; show the next heading + (org-back-to-heading) + (setq marker (point-marker)) + (goto-char (max (point-at-bol) (- (point-at-eol) anticol))) + (funcall command) + (message "_cmd: %S" org-mouse-cmd) + (message "this-command: %S" this-command) + (unless (eq (marker-position marker) (marker-position endmarker)) + (setq newhead (org-get-heading)))) + + (beginning-of-line 1) + (save-excursion + (org-agenda-change-all-lines newhead hdmarker 'fixface)))) + t)))) + +(defun org-mouse-agenda-context-menu (&optional _event) + (or (org-mouse-do-remotely 'org-mouse-context-menu) + (popup-menu + '("Agenda" + ("Agenda Files") + "--" + ["Undo" (progn (message "last command: %S" last-command) (setq this-command 'org-agenda-undo) (org-agenda-undo)) + :visible (if (eq last-command 'org-agenda-undo) + org-agenda-pending-undo-list + org-agenda-undo-list)] + ["Rebuild Buffer" org-agenda-redo t] + ["New Diary Entry" + org-agenda-diary-entry (org-agenda-check-type nil 'agenda) t] + "--" + ["Goto Today" org-agenda-goto-today + (org-agenda-check-type nil 'agenda) t] + ["Display Calendar" org-agenda-goto-calendar + (org-agenda-check-type nil 'agenda) t] + ("Calendar Commands" + ["Phases of the Moon" org-agenda-phases-of-moon + (org-agenda-check-type nil 'agenda)] + ["Sunrise/Sunset" org-agenda-sunrise-sunset + (org-agenda-check-type nil 'agenda)] + ["Holidays" org-agenda-holidays + (org-agenda-check-type nil 'agenda)] + ["Convert" org-agenda-convert-date + (org-agenda-check-type nil 'agenda)] + "--" + ["Create iCalendar file" org-icalendar-combine-agenda-files t]) + "--" + ["Day View" org-agenda-day-view + :active (org-agenda-check-type nil 'agenda) + :style radio :selected (eq org-agenda-current-span 'day)] + ["Week View" org-agenda-week-view + :active (org-agenda-check-type nil 'agenda) + :style radio :selected (eq org-agenda-current-span 'week)] + "--" + ["Show Logbook entries" org-agenda-log-mode + :style toggle :selected org-agenda-show-log + :active (org-agenda-check-type nil 'agenda)] + ["Include Diary" org-agenda-toggle-diary + :style toggle :selected org-agenda-include-diary + :active (org-agenda-check-type nil 'agenda)] + ["Use Time Grid" org-agenda-toggle-time-grid + :style toggle :selected org-agenda-use-time-grid + :active (org-agenda-check-type nil 'agenda)] + ["Follow Mode" org-agenda-follow-mode + :style toggle :selected org-agenda-follow-mode] + "--" + ["Quit" org-agenda-quit t] + ["Exit and Release Buffers" org-agenda-exit t] + )))) + +(defun org-mouse-get-gesture (event) + (let ((startxy (posn-x-y (event-start event))) + (endxy (posn-x-y (event-end event)))) + (if (< (car startxy) (car endxy)) :right :left))) + + + ; (setq org-agenda-mode-hook nil) +(defvar org-agenda-mode-map) +(add-hook 'org-agenda-mode-hook + (lambda () + (setq org-mouse-context-menu-function #'org-mouse-agenda-context-menu) + (org-defkey org-agenda-mode-map [mouse-3] #'org-mouse-show-context-menu) + (org-defkey org-agenda-mode-map [down-mouse-3] #'org-mouse-move-tree-start) + (org-defkey org-agenda-mode-map [C-mouse-4] #'org-agenda-earlier) + (org-defkey org-agenda-mode-map [C-mouse-5] #'org-agenda-later) + (org-defkey org-agenda-mode-map [drag-mouse-3] + (lambda (event) (interactive "e") + (cl-case (org-mouse-get-gesture event) + (:left (org-agenda-earlier 1)) + (:right (org-agenda-later 1))))))) + +(provide 'org-mouse) + +;;; org-mouse.el ends here diff --git a/elpa/org-9.5.2/org-mouse.elc b/elpa/org-9.5.2/org-mouse.elc new file mode 100644 index 0000000..207ed19 Binary files /dev/null and b/elpa/org-9.5.2/org-mouse.elc differ diff --git a/elpa/org-9.5.2/org-num.el b/elpa/org-9.5.2/org-num.el new file mode 100644 index 0000000..f00e6c4 --- /dev/null +++ b/elpa/org-9.5.2/org-num.el @@ -0,0 +1,476 @@ +;;; org-num.el --- Dynamic Headlines Numbering -*- lexical-binding: t; -*- + +;; Copyright (C) 2018-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr> +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This library provides dynamic numbering for Org headlines. Use +;; +;; <M-x org-num-mode> +;; +;; to toggle it. +;; +;; You can select what is numbered according to level, tags, COMMENT +;; keyword, or UNNUMBERED property. You can also skip footnotes +;; sections. See `org-num-max-level', `org-num-skip-tags', +;; `org-num-skip-commented', `org-num-skip-unnumbered', and +;; `org-num-skip-footnotes' for details. +;; +;; You can also control how the numbering is displayed by setting +;;`org-num-face' and `org-num-format-function'. +;; +;; Internally, the library handles an ordered list, per buffer +;; position, of overlays in `org-num--overlays'. These overlays are +;; marked with the `org-num' property set to a non-nil value. +;; +;; Overlays store the level of the headline in the `level' property, +;; and the face used for the numbering in `numbering-face'. +;; +;; The `skip' property is set to t when the corresponding headline has +;; some characteristic -- e.g., a node property, or a tag -- that +;; prevents it from being numbered. +;; +;; An overlay with `org-num' property set to `invalid' is called an +;; invalid overlay. Modified overlays automatically become invalid +;; and set `org-num--invalid-flag' to a non-nil value. After +;; a change, `org-num--invalid-flag' indicates numbering needs to be +;; updated and invalid overlays indicate where the buffer needs to be +;; parsed. So does `org-num--missing-overlay' variable. See +;; `org-num--verify' function for details. +;; +;; Numbering display is done through the `after-string' property. + + +;;; Code: + +(require 'cl-lib) +(require 'org-macs) +(require 'org) ;Otherwise `org-num--comment-re' burps on `org-comment-string' + +(defvar org-comment-string) +(defvar org-complex-heading-regexp) +(defvar org-cycle-level-faces) +(defvar org-footnote-section) +(defvar org-level-faces) +(defvar org-n-level-faces) +(defvar org-odd-levels-only) + +(declare-function org-back-to-heading "org" (&optional invisible-ok)) +(declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) +(declare-function org-reduced-level "org" (l)) + + +;;; Customization + +(defcustom org-num-face nil + "Face to use for numbering. +When nil, use the same face as the headline. This value is +ignored if `org-num-format-function' specifies a face for its +output." + :group 'org-appearance + :package-version '(Org . "9.3") + :type '(choice (const :tag "Like the headline" nil) + (face :tag "Use face")) + :safe (lambda (val) (or (null val) (facep val)))) + +(defcustom org-num-format-function #'org-num-default-format + "Function used to display numbering. +It is called with one argument, a list of numbers, and should +return a string, or nil. When nil, no numbering is displayed. +Any `face' text property on the returned string overrides +`org-num-face'." + :group 'org-appearance + :package-version '(Org . "9.3") + :type 'function) + +(defcustom org-num-max-level nil + "Level below which headlines are not numbered. +When set to nil, all headlines are numbered." + :group 'org-appearance + :package-version '(Org . "9.3") + :type '(choice (const :tag "Number everything" nil) + (integer :tag "Stop numbering at level")) + :safe (lambda (val) (or (null val) (wholenump val)))) + +(defcustom org-num-skip-commented nil + "Non-nil means commented sub-trees are not numbered." + :group 'org-appearance + :package-version '(Org . "9.3") + :type 'boolean + :safe #'booleanp) + +(defcustom org-num-skip-footnotes nil + "Non-nil means footnotes sections are not numbered." + :group 'org-appearance + :package-version '(Org . "9.3") + :type 'boolean + :safe #'booleanp) + +(defcustom org-num-skip-tags nil + "List of tags preventing the numbering of sub-trees. + +For example, add \"ARCHIVE\" to this list to avoid numbering +archived sub-trees. + +Tag in this list prevent numbering the whole sub-tree, +irrespective to `org-use-tag-inheritance', or other means to +control tag inheritance." + :group 'org-appearance + :package-version '(Org . "9.3") + :type '(repeat (string :tag "Tag")) + :safe (lambda (val) (and (listp val) (cl-every #'stringp val)))) + +(defcustom org-num-skip-unnumbered nil + "Non-nil means numbering obeys to UNNUMBERED property." + :group 'org-appearance + :package-version '(Org . "9.3") + :type 'boolean + :safe #'booleanp) + + +;;; Internal Variables + +(defconst org-num--comment-re (format "\\`%s\\(?: \\|$\\)" org-comment-string) + "Regexp matching a COMMENT keyword at headline beginning.") + +(defvar-local org-num--overlays nil + "Ordered list of overlays used for numbering outlines.") + +(defvar-local org-num--skip-level nil + "Level below which headlines from current tree are not numbered. +When nil, all headlines are numbered. It is used to handle +inheritance of no-numbering attributes.") + +(defvar-local org-num--numbering nil + "Current headline numbering. +A numbering is a list of integers, in reverse order. So numbering +for headline \"1.2.3\" is (3 2 1).") + +(defvar-local org-num--missing-overlay nil + "Buffer position signaling a headline without an overlay.") + +(defvar-local org-num--invalid-flag nil + "Non-nil means an overlay became invalid since last update.") + + +;;; Internal Functions + +(defsubst org-num--headline-regexp () + "Return regexp matching a numbered headline." + (if (null org-num-max-level) (org-with-limited-levels org-outline-regexp-bol) + (format "^\\*\\{1,%d\\} " + (if org-odd-levels-only (1- (* 2 org-num-max-level)) + org-num-max-level)))) + +(defsubst org-num--overlay-p (o) + "Non-nil if overlay O is a numbering overlay." + (overlay-get o 'org-num)) + +(defsubst org-num--valid-overlay-p (o) + "Non-nil if overlay O is still active in the buffer." + (not (eq 'invalid (overlay-get o 'org-num)))) + +(defsubst org-num--invalidate-overlay (o) + "Mark overlay O as invalid. +Update `org-num--invalid-flag' accordingly." + (overlay-put o 'org-num 'invalid) + (setq org-num--invalid-flag t)) + +(defun org-num--clear () + "Remove all numbering overlays in current buffer." + (mapc #'delete-overlay org-num--overlays) + (setq org-num--overlays nil)) + +(defun org-num--make-overlay (numbering level skip) + "Return overlay for numbering headline at point. + +NUMBERING is the numbering to use, as a list of integers, or nil +if nothing should be displayed. LEVEL is the level of the +headline. SKIP is its skip value. + +Assume point is at a headline." + (let ((after-edit-functions + (list (lambda (o &rest _) (org-num--invalidate-overlay o)))) + (o (save-excursion + (beginning-of-line) + (skip-chars-forward "*") + (make-overlay (line-beginning-position) (1+ (point)))))) + (overlay-put o 'org-num t) + (overlay-put o 'skip skip) + (overlay-put o 'level level) + (overlay-put o 'numbering-face + (or org-num-face + ;; Compute face that would be used at the + ;; headline. We cannot extract it from the + ;; buffer: at the time the overlay is created, + ;; Font Lock has not proceeded yet. + (nth (if org-cycle-level-faces + (% (1- level) org-n-level-faces) + (1- (min level org-n-level-faces))) + org-level-faces))) + (overlay-put o 'modification-hooks after-edit-functions) + (overlay-put o 'insert-in-front-hooks after-edit-functions) + (org-num--refresh-display o numbering) + o)) + +(defun org-num--refresh-display (overlay numbering) + "Refresh OVERLAY's display. +NUMBERING specifies the new numbering, as a list of integers, or +nil if nothing should be displayed. Assume OVERLAY is valid." + (let ((display (and numbering + (funcall org-num-format-function (reverse numbering))))) + (when (and display (not (get-text-property 0 'face display))) + (org-add-props display `(face ,(overlay-get overlay 'numbering-face)))) + (overlay-put overlay 'after-string display))) + +(defun org-num--skip-value () + "Return skip value for headline at point. +Value is t when headline should not be numbered, and nil +otherwise." + (org-match-line org-complex-heading-regexp) + (let ((title (match-string 4)) + (tags (and org-num-skip-tags + (match-end 5) + (org-split-string (match-string 5) ":")))) + (or (and org-num-skip-footnotes + org-footnote-section + (equal title org-footnote-section)) + (and org-num-skip-commented + title + (let ((case-fold-search nil)) + (string-match org-num--comment-re title)) + t) + (and org-num-skip-tags + (cl-some (lambda (tag) (member tag org-num-skip-tags)) + tags) + t) + (and org-num-skip-unnumbered + (org-entry-get (point) "UNNUMBERED") + t)))) + +(defun org-num--current-numbering (level skip) + "Return numbering for current headline. +LEVEL is headline's level, and SKIP its skip value. Return nil +if headline should be skipped." + (cond + ;; Skipped by inheritance. + ((and org-num--skip-level (> level org-num--skip-level)) nil) + ;; Skipped by a non-nil skip value; set `org-num--skip-level' + ;; to skip the whole sub-tree later on. + (skip (setq org-num--skip-level level) nil) + (t + (setq org-num--skip-level nil) + ;; Compute next numbering, and update `org-num--numbering'. + (let ((last-level (length org-num--numbering))) + (setq org-num--numbering + (cond + ;; First headline : nil => (1), or (1 0)... + ((null org-num--numbering) (cons 1 (make-list (1- level) 0))) + ;; Sibling: (1 1) => (2 1). + ((= level last-level) + (cons (1+ (car org-num--numbering)) (cdr org-num--numbering))) + ;; Parent: (1 1 1) => (2 1), or (2). + ((< level last-level) + (let ((suffix (nthcdr (- last-level level) org-num--numbering))) + (cons (1+ (car suffix)) (cdr suffix)))) + ;; Child: (1 1) => (1 1 1), or (1 0 1 1)... + (t + (append (cons 1 (make-list (- level last-level 1) 0)) + org-num--numbering)))))))) + +(defun org-num--number-region (start end) + "Add numbering overlays between START and END positions. +When START or END are nil, use buffer boundaries. Narrowing, if +any, is ignored. Return the list of created overlays, newest +first." + (org-with-point-at (or start 1) + ;; Do not match headline starting at START. + (when start (end-of-line)) + (let ((regexp (org-num--headline-regexp)) + (new nil)) + (while (re-search-forward regexp end t) + (let* ((level (org-reduced-level + (- (match-end 0) (match-beginning 0) 1))) + (skip (org-num--skip-value)) + (numbering (org-num--current-numbering level skip))) + ;; Apply numbering to current headline. Store overlay for + ;; the return value. + (push (org-num--make-overlay numbering level skip) + new))) + new))) + +(defun org-num--update () + "Update buffer's numbering. +This function removes invalid overlays and refreshes numbering +for the valid ones in the numbering overlays list. It also adds +missing overlays to that list." + (setq org-num--skip-level nil) + (setq org-num--numbering nil) + (let ((new-overlays nil) + (overlay nil)) + (while (setq overlay (pop org-num--overlays)) + (cond + ;; Valid overlay. + ;; + ;; First handle possible missing overlays OVERLAY. If missing + ;; overlay marker is pointing before next overlay and after the + ;; last known overlay, make sure to parse the buffer between + ;; these two overlays. + ((org-num--valid-overlay-p overlay) + (let ((next (overlay-start overlay)) + (last (and new-overlays (overlay-start (car new-overlays))))) + (cond + ((null org-num--missing-overlay)) + ((> org-num--missing-overlay next)) + ((or (null last) (> org-num--missing-overlay last)) + (setq org-num--missing-overlay nil) + (setq new-overlays (nconc (org-num--number-region last next) + new-overlays))) + ;; If it is already after the last known overlay, reset it: + ;; some previous invalid overlay already triggered the + ;; necessary parsing. + (t + (setq org-num--missing-overlay nil)))) + ;; Update OVERLAY's numbering. + (let* ((level (overlay-get overlay 'level)) + (skip (overlay-get overlay 'skip)) + (numbering (org-num--current-numbering level skip))) + (org-num--refresh-display overlay numbering) + (push overlay new-overlays))) + ;; Invalid overlay. It indicates that the buffer needs to be + ;; parsed again between the two surrounding valid overlays or + ;; buffer boundaries. + (t + ;; Delete all consecutive invalid overlays: we re-create all + ;; overlays between last valid overlay and the next one. + (delete-overlay overlay) + (while (and org-num--overlays + (not (org-num--valid-overlay-p (car org-num--overlays)))) + (delete-overlay (pop org-num--overlays))) + ;; Create and register new overlays. + (let ((last (and new-overlays (overlay-start (car new-overlays)))) + (next (and org-num--overlays + (overlay-start (car org-num--overlays))))) + (setq new-overlays (nconc (org-num--number-region last next) + new-overlays)))))) + ;; If invalid position hasn't been handled yet, it must be located + ;; between last valid overlay and end of the buffer. Parse that + ;; area before returning. + (when org-num--missing-overlay + (let ((last (and new-overlays (overlay-start (car new-overlays))))) + (setq new-overlays (nconc (org-num--number-region last nil) + new-overlays)))) + ;; Numbering is now up-to-date. Reset invalid flag. Also return + ;; `org-num--overlays' in a sorted fashion. + (setq org-num--invalid-flag nil) + (setq org-num--overlays (nreverse new-overlays)))) + +(defun org-num--verify (beg end _) + "Check numbering integrity; update it if necessary. +This function is meant to be used in `after-change-functions'. +See this variable for the meaning of BEG and END." + (setq org-num--missing-overlay nil) + (save-match-data + (org-with-point-at beg + (let ((regexp (org-num--headline-regexp))) + ;; At this point, directly altered overlays between BEG and + ;; END are marked as invalid and will trigger a full update. + ;; However, there are still two cases to handle. + ;; + ;; First, some valid overlays may need to be invalidated, due + ;; to an indirect change. That happens when the skip value -- + ;; see `org-num--skip-value' -- of the heading BEG belongs to + ;; is altered, or when deleting the newline character right + ;; before the next headline. + (save-excursion + ;; Bail out if we're before first headline or within + ;; a headline too deep to be numbered. + (when (and (org-with-limited-levels + (ignore-errors (org-back-to-heading t))) + (looking-at regexp)) + (pcase (get-char-property-and-overlay (point) 'org-num) + (`(nil) + ;; At a headline, without a numbering overlay: change + ;; just created one. Mark it for parsing. + (setq org-num--missing-overlay (point))) + (`(t . ,o) + ;; Check if skip value changed. Invalidate overlay + ;; accordingly. + (unless (eq (org-num--skip-value) (overlay-get o 'skip)) + (org-num--invalidate-overlay o))) + (_ nil)))) + ;; Deleting the newline character before a numbering overlay + ;; doesn't invalidate it, even though it could land in the + ;; middle of a line. Be sure to catch this case. + (when (and (= beg end) (not (bolp))) + (pcase (get-char-property-and-overlay (point) 'org-num) + (`(t . ,o) (org-num--invalidate-overlay o)) + (_ nil))) + ;; Second, if nothing is marked as invalid, and therefore if + ;; no full update is due so far, changes may still have + ;; created new headlines, at BEG -- which is actually handled + ;; by the previous phase --, or, in case of a multi-line + ;; insertion, at END, or in-between. + (unless (or org-num--invalid-flag + org-num--missing-overlay + (<= end (line-end-position))) ;single line change + (forward-line) + (when (or (re-search-forward regexp end 'move) + ;; Check if change created a headline after END. + (progn (skip-chars-backward "*") (looking-at regexp))) + (setq org-num--missing-overlay (line-beginning-position)))))) + ;; Update numbering only if a headline was altered or created. + (when (or org-num--missing-overlay org-num--invalid-flag) + (org-num--update)))) + + +;;; Public Functions + +;;;###autoload +(defun org-num-default-format (numbering) + "Default numbering display function. +NUMBERING is a list of numbers." + (concat (mapconcat #'number-to-string numbering ".") " ")) + +;;;###autoload +(define-minor-mode org-num-mode + "Dynamic numbering of headlines in an Org buffer." + :lighter " o#" + (cond + (org-num-mode + (unless (derived-mode-p 'org-mode) + (user-error "Cannot activate headline numbering outside Org mode")) + (setq org-num--numbering nil) + (setq org-num--overlays (nreverse (org-num--number-region nil nil))) + (add-hook 'after-change-functions #'org-num--verify nil t) + (add-hook 'change-major-mode-hook #'org-num--clear nil t)) + (t + (org-num--clear) + (remove-hook 'after-change-functions #'org-num--verify t) + (remove-hook 'change-major-mode-hook #'org-num--clear t)))) + +(provide 'org-num) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-num.el ends here diff --git a/elpa/org-9.5.2/org-num.elc b/elpa/org-9.5.2/org-num.elc new file mode 100644 index 0000000..72a882d Binary files /dev/null and b/elpa/org-9.5.2/org-num.elc differ diff --git a/elpa/org-9.5.2/org-pcomplete.el b/elpa/org-9.5.2/org-pcomplete.el new file mode 100644 index 0000000..b31dc33 --- /dev/null +++ b/elpa/org-9.5.2/org-pcomplete.el @@ -0,0 +1,451 @@ +;;; org-pcomplete.el --- In-buffer Completion Code -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; John Wiegley <johnw at gnu dot org> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Code: + +;;;; Require other packages + +(require 'org-macs) +(require 'org-compat) +(require 'pcomplete) + +(declare-function org-at-heading-p "org" (&optional ignored)) +(declare-function org-babel-combine-header-arg-lists "ob-core" (original &rest others)) +(declare-function org-babel-get-src-block-info "ob-core" (&optional light datum)) +(declare-function org-before-first-heading-p "org" ()) +(declare-function org-buffer-property-keys "org" (&optional specials defaults columns)) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-property "org-element" property element) +(declare-function org-element-type "org-element" (element)) +(declare-function org-end-of-meta-data "org" (&optional full)) +(declare-function org-entry-properties "org" (&optional pom which)) +(declare-function org-export-backend-options "ox" (cl-x) t) +(declare-function org-get-buffer-tags "org" ()) +(declare-function org-get-export-keywords "org" ()) +(declare-function org-get-heading "org" (&optional no-tags no-todo no-priority no-comment)) +(declare-function org-get-tags "org" (&optional pos local)) +(declare-function org-link-heading-search-string "ol" (&optional string)) +(declare-function org-tag-alist-to-string "org" (alist &optional skip-key)) + +(defvar org-babel-common-header-args-w-values) +(defvar org-current-tag-alist) +(defvar org-priority-default) +(defvar org-drawer-regexp) +(defvar org-element-affiliated-keywords) +(defvar org-entities) +(defvar org-export-default-language) +(defvar org-export-exclude-tags) +(defvar org-export-select-tags) +(defvar org-file-tags) +(defvar org-priority-highest) +(defvar org-link-abbrev-alist) +(defvar org-link-abbrev-alist-local) +(defvar org-priority-lowest) +(defvar org-options-keywords) +(defvar org-outline-regexp) +(defvar org-property-re) +(defvar org-startup-options) +(defvar org-tag-re) +(defvar org-time-stamp-formats) +(defvar org-todo-keywords-1) +(defvar org-todo-line-regexp) + + +;;; Internal Functions + +(defun org-thing-at-point () + "Examine the thing at point and let the caller know what it is. +The return value is a string naming the thing at point." + (let ((line-to-here (org-current-line-string t)) + (case-fold-search t)) + (cond + ;; Parameters on a clock table opening line. + ((org-match-line "[ \t]*#\\+BEGIN: clocktable[ \t]") + (cons "block-option" "clocktable")) + ;; Flags and parameters on a source block opening line. + ((org-match-line "[ \t]*#\\+BEGIN_SRC[ \t]") + (cons "block-option" "src")) + ;; Value for a known keyword. + ((org-match-line "[ \t]*#\\+\\(\\S-+\\):") + (cons "file-option" (match-string-no-properties 1))) + ;; Keyword name. + ((and (org-match-line "[ \t]*#\\+[a-zA-Z_]*$") + (looking-at-p "[ \t]*$")) + (cons "file-option" nil)) + ;; Link abbreviation. + ((save-excursion + (skip-chars-backward "-A-Za-z0-9_") + (and (eq ?\[ (char-before)) + (eq ?\[ (char-before (1- (point)))))) + (cons "link" nil)) + ;; Entities. Some of them accept numbers, but only at their end. + ;; So, we first skip numbers, then letters. + ((eq ?\\ (save-excursion + (skip-chars-backward "0-9") + (skip-chars-backward "a-zA-Z") + (char-before))) + (cons "tex" nil)) + ;; Tags on a headline. + ((and (org-match-line + (format "\\*+ \\(?:.+? \\)?\\(:\\)\\(\\(?::\\|%s\\)+\\)?[ \t]*$" + org-tag-re)) + (or (org-point-in-group (point) 2) + (= (point) (match-end 1)))) + (cons "tag" nil)) + ;; TODO keywords on an empty headline. + ((and (string-match "^\\*+ +\\S-*$" line-to-here) + (looking-at-p "[ \t]*$")) + (cons "todo" nil)) + ;; Heading after a star for search strings or links. + ((save-excursion + (skip-chars-backward "^*" (line-beginning-position)) + (and (eq ?* (char-before)) + (eq (char-before (1- (point))) '?\[) + (eq (char-before (- (point) 2)) '?\[))) + (cons "searchhead" nil)) + ;; Property or drawer name, depending on point. If point is at + ;; a valid location for a node property, offer completion on all + ;; node properties in the buffer. Otherwise, offer completion on + ;; all drawer names, including "PROPERTIES". + ((and (string-match "^[ \t]*:\\S-*$" line-to-here) + (looking-at-p "[ \t]*$")) + (let ((origin (line-beginning-position))) + (if (org-before-first-heading-p) (cons "drawer" nil) + (save-excursion + (org-end-of-meta-data) + (if (or (= origin (point)) + (not (org-match-line "[ \t]*:PROPERTIES:[ \t]*$"))) + (cons "drawer" nil) + (while (org-match-line org-property-re) + (forward-line)) + (if (= origin (point)) (cons "prop" nil) + (cons "drawer" nil))))))) + (t nil)))) + +(defun org-pcomplete-case-double (list) + "Return list with both upcase and downcase version of all strings in LIST." + (let (e res) + (while (setq e (pop list)) + (setq res (cons (downcase e) (cons (upcase e) res)))) + (nreverse res))) + + +;;; Completion API + +(defun org-command-at-point () + "Return the qualified name of the Org completion entity at point. +When completing for #+STARTUP, for example, this function returns +\"file-option/startup\"." + (let ((thing (org-thing-at-point))) + (cond + ((string= "file-option" (car thing)) + (concat (car thing) + (and (cdr thing) (concat "/" (downcase (cdr thing)))))) + ((string= "block-option" (car thing)) + (concat (car thing) "/" (downcase (cdr thing)))) + (t (car thing))))) + +(defun org-parse-arguments () + "Parse whitespace separated arguments in the current region." + (let ((begin (line-beginning-position)) + (end (line-end-position)) + begins args) + (save-restriction + (narrow-to-region begin end) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (skip-chars-forward " \t\n[") + (setq begins (cons (point) begins)) + (skip-chars-forward "^ \t\n[") + (setq args (cons (buffer-substring-no-properties + (car begins) (point)) + args))) + (cons (reverse args) (reverse begins)))))) + +(defun org-pcomplete-initial () + "Call the right completion function for first argument completions." + (ignore + (funcall (or (pcomplete-find-completion-function + (car (org-thing-at-point))) + pcomplete-default-completion-function)))) + + +;;; Completion functions + +(defun pcomplete/org-mode/file-option () + "Complete against all valid file options." + (require 'org-element) + (pcomplete-here + (org-pcomplete-case-double + (append (mapcar (lambda (keyword) (concat keyword " ")) + org-options-keywords) + (mapcar (lambda (keyword) (concat keyword ": ")) + org-element-affiliated-keywords) + (let (block-names) + (dolist (name + '("CENTER" "COMMENT" "EXAMPLE" "EXPORT" "QUOTE" "SRC" + "VERSE") + block-names) + (push (format "END_%s" name) block-names) + (push (concat "BEGIN_" + name + ;; Since language is compulsory in + ;; export blocks source blocks, add + ;; a space. + (and (member name '("EXPORT" "SRC")) " ")) + block-names) + (push (format "ATTR_%s: " name) block-names))) + (mapcar (lambda (keyword) (concat keyword ": ")) + (org-get-export-keywords)))) + (substring pcomplete-stub 2))) + +(defun pcomplete/org-mode/file-option/author () + "Complete arguments for the #+AUTHOR file option." + (pcomplete-here (list user-full-name))) + +(defun pcomplete/org-mode/file-option/date () + "Complete arguments for the #+DATE file option." + (pcomplete-here (list (format-time-string (car org-time-stamp-formats))))) + +(defun pcomplete/org-mode/file-option/email () + "Complete arguments for the #+EMAIL file option." + (pcomplete-here (list user-mail-address))) + +(defun pcomplete/org-mode/file-option/exclude_tags () + "Complete arguments for the #+EXCLUDE_TAGS file option." + (require 'ox) + (pcomplete-here + (and org-export-exclude-tags + (list (mapconcat #'identity org-export-exclude-tags " "))))) + +(defun pcomplete/org-mode/file-option/filetags () + "Complete arguments for the #+FILETAGS file option." + (pcomplete-here (and org-file-tags (mapconcat #'identity org-file-tags " ")))) + +(defun pcomplete/org-mode/file-option/language () + "Complete arguments for the #+LANGUAGE file option." + (require 'ox) + (pcomplete-here + (pcomplete-uniquify-list + (list org-export-default-language "en")))) + +(defun pcomplete/org-mode/file-option/priorities () + "Complete arguments for the #+PRIORITIES file option." + (pcomplete-here (list (format "%c %c %c" + org-priority-highest + org-priority-lowest + org-priority-default)))) + +(defun pcomplete/org-mode/file-option/select_tags () + "Complete arguments for the #+SELECT_TAGS file option." + (require 'ox) + (pcomplete-here + (and org-export-select-tags + (list (mapconcat #'identity org-export-select-tags " "))))) + +(defun pcomplete/org-mode/file-option/startup () + "Complete arguments for the #+STARTUP file option." + (while (pcomplete-here + (let ((opts (pcomplete-uniquify-list + (mapcar #'car org-startup-options)))) + ;; Some options are mutually exclusive, and shouldn't be completed + ;; against if certain other options have already been seen. + (dolist (arg pcomplete-args) + (cond + ((string= arg "hidestars") + (setq opts (delete "showstars" opts))))) + opts)))) + +(defun pcomplete/org-mode/file-option/tags () + "Complete arguments for the #+TAGS file option." + (pcomplete-here + (list (org-tag-alist-to-string org-current-tag-alist)))) + +(defun pcomplete/org-mode/file-option/title () + "Complete arguments for the #+TITLE file option." + (pcomplete-here + (let ((visited-file (buffer-file-name (buffer-base-buffer)))) + (list (or (and visited-file + (file-name-sans-extension + (file-name-nondirectory visited-file))) + (buffer-name (buffer-base-buffer))))))) + + +(defun pcomplete/org-mode/file-option/options () + "Complete arguments for the #+OPTIONS file option." + (while (pcomplete-here + (pcomplete-uniquify-list + (append + ;; Hard-coded OPTION items always available. + '("H:" "\\n:" "num:" "timestamp:" "arch:" "author:" "c:" + "creator:" "date:" "d:" "email:" "*:" "e:" "::" "f:" + "inline:" "tex:" "p:" "pri:" "':" "-:" "stat:" "^:" "toc:" + "|:" "tags:" "tasks:" "<:" "todo:") + ;; OPTION items from registered back-ends. + (let (items) + (dolist (backend (bound-and-true-p + org-export-registered-backends)) + (dolist (option (org-export-backend-options backend)) + (let ((item (nth 2 option))) + (when item (push (concat item ":") items))))) + items)))))) + +(defun pcomplete/org-mode/file-option/infojs_opt () + "Complete arguments for the #+INFOJS_OPT file option." + (while (pcomplete-here + (pcomplete-uniquify-list + (mapcar (lambda (item) (format "%s:" (car item))) + (bound-and-true-p org-html-infojs-opts-table)))))) + +(defun pcomplete/org-mode/file-option/bind () + "Complete arguments for the #+BIND file option, which are variable names." + (let (vars) + (mapatoms + (lambda (a) (when (boundp a) (setq vars (cons (symbol-name a) vars))))) + (pcomplete-here vars))) + +(defun pcomplete/org-mode/link () + "Complete against defined #+LINK patterns." + (pcomplete-here + (pcomplete-uniquify-list + (copy-sequence + (mapcar (lambda (e) (concat (car e) ":")) + (append org-link-abbrev-alist-local + org-link-abbrev-alist)))))) + +(defun pcomplete/org-mode/tex () + "Complete against TeX-style HTML entity names." + (require 'org-entities) + (while (pcomplete-here + (pcomplete-uniquify-list + (remove nil (mapcar #'car-safe org-entities))) + (substring pcomplete-stub 1)))) + +(defun pcomplete/org-mode/todo () + "Complete against known TODO keywords." + (pcomplete-here (pcomplete-uniquify-list (copy-sequence org-todo-keywords-1)))) + +(defun pcomplete/org-mode/searchhead () + "Complete against all headings. +This needs more work, to handle headings with lots of spaces in them." + (while (pcomplete-here + (save-excursion + (goto-char (point-min)) + (let (tbl) + (while (re-search-forward org-outline-regexp nil t) + ;; Remove the leading asterisk from + ;; `org-link-heading-search-string' result. + (push (substring (org-link-heading-search-string) 1) tbl)) + (pcomplete-uniquify-list tbl))) + ;; When completing a bracketed link, i.e., "[[*", argument + ;; starts at the star, so remove this character. + (substring pcomplete-stub 1)))) + +(defun pcomplete/org-mode/tag () + "Complete a tag name. Omit tags already set." + (while (pcomplete-here + (mapcar (lambda (x) (concat x ":")) + (let ((lst (pcomplete-uniquify-list + (or (remq + nil + (mapcar (lambda (x) (org-string-nw-p (car x))) + org-current-tag-alist)) + (mapcar #'car (org-get-buffer-tags)))))) + (dolist (tag (org-get-tags nil t)) + (setq lst (delete tag lst))) + lst)) + (and (string-match ".*:" pcomplete-stub) + (substring pcomplete-stub (match-end 0))) + t))) + +(defun pcomplete/org-mode/drawer () + "Complete a drawer name, including \"PROPERTIES\"." + (pcomplete-here + (org-pcomplete-case-double + (mapcar (lambda (x) (concat x ":")) + (let ((names (list "PROPERTIES"))) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward org-drawer-regexp nil t) + (let ((drawer (org-element-at-point))) + (when (memq (org-element-type drawer) + '(drawer property-drawer)) + (push (org-element-property :drawer-name drawer) names) + (goto-char (org-element-property :end drawer)))))) + (pcomplete-uniquify-list names)))) + (substring pcomplete-stub 1))) ;remove initial colon + +(defun pcomplete/org-mode/prop () + "Complete a property name. Omit properties already set." + (pcomplete-here + (org-pcomplete-case-double + (mapcar (lambda (x) + (concat x ": ")) + (let ((lst (pcomplete-uniquify-list + (copy-sequence (org-buffer-property-keys nil t t))))) + (dolist (prop (org-entry-properties)) + (setq lst (delete (car prop) lst))) + lst))) + (substring pcomplete-stub 1))) + +(defun pcomplete/org-mode/block-option/src () + "Complete the arguments of a source block. +Complete a language in the first field, the header arguments and +switches." + (pcomplete-here + (mapcar + (lambda(x) (symbol-name (nth 3 x))) + (cdr (car (cdr (memq :key-type (plist-get + (symbol-plist + 'org-babel-load-languages) + 'custom-type))))))) + (let* ((info (org-babel-get-src-block-info 'light)) + (lang (car info)) + (lang-headers (intern (concat "org-babel-header-args:" lang))) + (headers (org-babel-combine-header-arg-lists + org-babel-common-header-args-w-values + (and (boundp lang-headers) (eval lang-headers t))))) + (while (pcomplete-here + (append (mapcar + (lambda (arg) (format ":%s" (symbol-name (car arg)))) + headers) + '("-n" "-r" "-l")))))) + +(defun pcomplete/org-mode/block-option/clocktable () + "Complete keywords in a clocktable line." + (while (pcomplete-here '(":maxlevel" ":scope" ":lang" + ":tstart" ":tend" ":block" ":step" + ":stepskip0" ":fileskip0" + ":emphasize" ":link" ":narrow" ":indent" + ":hidefiles" ":tcolumns" ":level" ":compact" + ":timestamp" ":formula" ":formatter" + ":wstart" ":mstart")))) + + +;;; Finish up + +(provide 'org-pcomplete) + +;;; org-pcomplete.el ends here diff --git a/elpa/org-9.5.2/org-pcomplete.elc b/elpa/org-9.5.2/org-pcomplete.elc new file mode 100644 index 0000000..554d729 Binary files /dev/null and b/elpa/org-9.5.2/org-pcomplete.elc differ diff --git a/elpa/org-9.5.2/org-pkg.el b/elpa/org-9.5.2/org-pkg.el new file mode 100644 index 0000000..68f10a5 --- /dev/null +++ b/elpa/org-9.5.2/org-pkg.el @@ -0,0 +1,2 @@ +;; Generated package description from org.el -*- no-byte-compile: t -*- +(define-package "org" "9.5.2" "Outline-based notes management and organizer" '((emacs "25.1")) :authors '(("Carsten Dominik" . "carsten.dominik@gmail.com")) :maintainer '("Bastien Guerry" . "bzg@gnu.org") :keywords '("outlines" "hypermedia" "calendar" "wp") :url "https://orgmode.org") diff --git a/elpa/org-9.5.2/org-plot.el b/elpa/org-9.5.2/org-plot.el new file mode 100644 index 0000000..4f14c7d --- /dev/null +++ b/elpa/org-9.5.2/org-plot.el @@ -0,0 +1,730 @@ +;;; org-plot.el --- Support for Plotting from Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. +;; +;; Author: Eric Schulte <schulte dot eric at gmail dot com> +;; Maintainer: TEC <tecosaur@gmail.com> +;; Keywords: tables, plotting +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Borrows ideas and a couple of lines of code from org-exp.el. + +;; Thanks to the Org mailing list for testing and implementation and +;; feature suggestions + +;;; Code: + +(require 'cl-lib) +(require 'org) +(require 'org-table) + +(declare-function gnuplot-delchar-or-maybe-eof "ext:gnuplot" (arg)) +(declare-function gnuplot-mode "ext:gnuplot" ()) +(declare-function gnuplot-send-buffer-to-gnuplot "ext:gnuplot" ()) + +(defvar org-plot/gnuplot-default-options + '((:plot-type . 2d) + (:with . lines) + (:ind . 0)) + "Default options to gnuplot used by `org-plot/gnuplot'.") + +(defvar org-plot-timestamp-fmt nil) + +(defun org-plot/add-options-to-plist (p options) + "Parse an OPTIONS line and set values in the property list P. +Returns the resulting property list." + (when options + (let ((op '(("type" . :plot-type) + ("script" . :script) + ("line" . :line) + ("set" . :set) + ("title" . :title) + ("ind" . :ind) + ("deps" . :deps) + ("with" . :with) + ("file" . :file) + ("labels" . :labels) + ("map" . :map) + ("timeind" . :timeind) + ("timefmt" . :timefmt) + ("min" . :ymin) + ("ymin" . :ymin) + ("max" . :ymax) + ("ymax" . :ymax) + ("xmin" . :xmin) + ("xmax" . :xmax) + ("ticks" . :ticks) + ("trans" . :transpose) + ("transpose" . :transpose))) + (multiples '("set" "line")) + (regexp ":\\([\"][^\"]+?[\"]\\|[(][^)]+?[)]\\|[^ \t\n\r;,.]*\\)") + (start 0)) + (dolist (o op) + (if (member (car o) multiples) ;; keys with multiple values + (while (string-match + (concat (regexp-quote (car o)) regexp) + options start) + (setq start (match-end 0)) + (setq p (plist-put p (cdr o) + (cons (car (read-from-string + (match-string 1 options))) + (plist-get p (cdr o))))) + p) + (if (string-match (concat (regexp-quote (car o)) regexp) + options) + (setq p (plist-put p (cdr o) + (car (read-from-string + (match-string 1 options)))))))))) + p) + +(defun org-plot/goto-nearest-table () + "Move the point forward to the beginning of nearest table. +Return value is the point at the beginning of the table." + (interactive) (move-beginning-of-line 1) + (while (not (or (org-at-table-p) (< 0 (forward-line 1))))) + (goto-char (org-table-begin))) + +(defun org-plot/collect-options (&optional params) + "Collect options from an org-plot `#+Plot:' line. +Accepts an optional property list PARAMS, to which the options +will be added. Returns the resulting property list." + (interactive) + (let ((line (thing-at-point 'line))) + (if (string-match "#\\+PLOT: +\\(.*\\)$" line) + (org-plot/add-options-to-plist params (match-string 1 line)) + params))) + +(defun org-plot-quote-timestamp-field (s) + "Convert field S from timestamp to Unix time and export to gnuplot." + (format-time-string org-plot-timestamp-fmt (org-time-string-to-time s))) + +(defun org-plot-quote-tsv-field (s) + "Quote field S for export to gnuplot." + (if (string-match org-table-number-regexp s) s + (if (string-match org-ts-regexp3 s) + (org-plot-quote-timestamp-field s) + (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"")))) + +(defun org-plot/gnuplot-to-data (table data-file params) + "Export TABLE to DATA-FILE in a format readable by gnuplot. +Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE." + (with-temp-file + data-file + (setq-local org-plot-timestamp-fmt (or + (plist-get params :timefmt) + "%Y-%m-%d-%H:%M:%S")) + (insert (orgtbl-to-generic + table + (org-combine-plists + '(:sep "\t" :fmt org-plot-quote-tsv-field) + params)))) + nil) + +(defun org-plot/gnuplot-to-grid-data (table data-file params) + "Export the data in TABLE to DATA-FILE for gnuplot. +This means in a format appropriate for grid plotting by gnuplot. +PARAMS specifies which columns of TABLE should be plotted as independent +and dependent variables." + (interactive) + (let* ((ind (- (plist-get params :ind) 1)) + (deps (if (plist-member params :deps) + (mapcar (lambda (val) (- val 1)) (plist-get params :deps)) + (let (collector) + (dotimes (col (length (nth 0 table))) + (setf collector (cons col collector))) + collector))) + (counter 0) + row-vals) + (when (>= ind 0) ;; collect values of ind col + (setf row-vals (mapcar (lambda (row) (setf counter (+ 1 counter)) + (cons counter (nth ind row))) + table))) + (when (or deps (>= ind 0)) ;; remove non-plotting columns + (setf deps (delq ind deps)) + (setf table (mapcar (lambda (row) + (dotimes (col (length row)) + (unless (memq col deps) + (setf (nth col row) nil))) + (delq nil row)) + table))) + ;; write table to gnuplot grid datafile format + (with-temp-file data-file + (let ((num-rows (length table)) (num-cols (length (nth 0 table))) + (gnuplot-row (lambda (col row value) + (setf col (+ 1 col)) (setf row (+ 1 row)) + (format "%f %f %f\n%f %f %f\n" + col (- row 0.5) value ;; lower edge + col (+ row 0.5) value))) ;; upper edge + front-edge back-edge) + (dotimes (col num-cols) + (dotimes (row num-rows) + (setf back-edge + (concat back-edge + (funcall gnuplot-row (- col 1) row + (string-to-number (nth col (nth row table)))))) + (setf front-edge + (concat front-edge + (funcall gnuplot-row col row + (string-to-number (nth col (nth row table))))))) + ;; only insert once per row + (insert back-edge) (insert "\n") ;; back edge + (insert front-edge) (insert "\n") ;; front edge + (setf back-edge "") (setf front-edge "")))) + row-vals)) + +(defun org--plot/values-stats (nums &optional hard-min hard-max) + "Rudimentary statistics about NUMS, useful for guessing axis ticks. +If HARD-MIN or HARD-MAX are set, they will be used instead of the min/max +of the NUMS." + (let* ((minimum (or hard-min (apply #'min nums))) + (maximum (or hard-max (apply #'max nums))) + (range (- maximum minimum)) + (rangeOrder (if (= range 0) 0 + (ceiling (- 1 (log range 10))))) + (range-factor (expt 10 rangeOrder)) + (nice-min (if (= range 0) (car nums) + (/ (float (floor (* minimum range-factor))) range-factor))) + (nice-max (if (= range 0) (car nums) + (/ (float (ceiling (* maximum range-factor))) range-factor)))) + `(:min ,minimum :max ,maximum :range ,range + :range-factor ,range-factor + :nice-min ,nice-min :nice-max ,nice-max :nice-range ,(- nice-max nice-min)))) + +(defun org--plot/sensible-tick-num (table &optional hard-min hard-max) + "From a the values in a TABLE of data, guess an appropriate number of ticks. +If HARD-MIN and HARD-MAX can be used to fix the ends of the axis." + (let* ((row-data + (mapcar (lambda (row) (org--plot/values-stats + (mapcar #'string-to-number (cdr row)) + hard-min + hard-max)) table)) + (row-normalised-ranges (mapcar (lambda (r-data) + (let ((val (round (* + (plist-get r-data :range-factor) + (plist-get r-data :nice-range))))) + (if (= (% val 10) 0) (/ val 10) val))) + row-data)) + (range-prime-decomposition (mapcar #'org--plot/prime-factors row-normalised-ranges)) + (weighted-factors (sort (apply #'org--plot/merge-alists #'+ 0 + (mapcar (lambda (factors) (org--plot/item-frequencies factors t)) + range-prime-decomposition)) + (lambda (a b) (> (cdr a) (cdr b)))))) + (apply #'* (org--plot/nice-frequency-pick weighted-factors)))) + +(defun org--plot/nice-frequency-pick (frequencies) + "From a list of FREQUENCIES, try to sensibly pick a sample of the most frequent." + ;; TODO this mosly works decently, but could do with some tweaking to work more consistently. + (cl-case (length frequencies) + (1 (list (car (nth 0 frequencies)))) + (2 (if (<= 3 (/ (cdr (nth 0 frequencies)) + (cdr (nth 1 frequencies)))) + (make-list 2 + (car (nth 0 frequencies))) + (list (car (nth 0 frequencies)) + (car (nth 1 frequencies))))) + (t + (let* ((total-count (apply #'+ (mapcar #'cdr frequencies))) + (n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies)) + (f-pick (list (car (car n-freq)))) + (1-2-ratio (/ (cdr (nth 0 n-freq)) + (cdr (nth 1 n-freq)))) + (2-3-ratio (/ (cdr (nth 1 n-freq)) + (cdr (nth 2 n-freq)))) + (1-3-ratio (* 1-2-ratio 2-3-ratio)) + (1-val (car (nth 0 n-freq))) + (2-val (car (nth 1 n-freq))) + (3-val (car (nth 2 n-freq)))) + (when (> 1-2-ratio 4) (push 1-val f-pick)) + (when (and (< 1-2-ratio 2-val) + (< (* (apply #'* f-pick) 2-val) 30)) + (push 2-val f-pick)) + (when (and (< 1-3-ratio 3-val) + (< (* (apply #'* f-pick) 3-val) 30)) + (push 3-val f-pick)) + f-pick)))) + +(defun org--plot/merge-alists (function default alist1 alist2 &rest alists) + "Using FUNCTION, combine the elements of ALIST1, ALIST2 and any other ALISTS. +When an element is only present in one alist, DEFAULT is used as the second +argument for the FUNCTION." + (when (> (length alists) 0) + (setq alist2 (apply #'org--plot/merge-alists function default alist2 alists))) + (cl-flet ((keys (alist) (mapcar #'car alist)) + (lookup (key alist) (or (cdr (assoc key alist)) default))) + (cl-loop with keys = (cl-union (keys alist1) (keys alist2) :test 'equal) + for k in keys collect + (cons k (funcall function (lookup k alist1) (lookup k alist2)))))) + +(defun org--plot/item-frequencies (values &optional normalise) + "Return an alist indicating the frequency of values in VALUES list. +When NORMALISE is non-nil, the count is divided by the number of values." + (let ((normaliser (if normalise (float (length values)) 1))) + (cl-loop for (n . m) in (seq-group-by #'identity values) + collect (cons n (/ (length m) normaliser))))) + +(defun org--plot/prime-factors (value) + "Return the prime decomposition of VALUE, e.g. for 12, '(3 2 2)." + (let ((factors '(1)) (i 1)) + (while (/= 1 value) + (setq i (1+ i)) + (when (eq 0 (% value i)) + (push i factors) + (setq value (/ value i)) + (setq i (1- i)) + )) + (cl-subseq factors 0 -1))) + +(defcustom org-plot/gnuplot-script-preamble "" + "String of function to be inserted before the gnuplot plot command is run. + +Note that this is in addition to, not instead of other content generated in +`org-plot/gnuplot-script'. If a function, it is called with the plot type as +the argument, and must return a string to be used." + :group 'org-plot + :type '(choice string function)) + +(defcustom org-plot/preset-plot-types + '((2d :plot-cmd "plot" + :check-ind-type t + :plot-func + (lambda (_table data-file num-cols params plot-str) + (let* ((type (plist-get params :plot-type)) + (with (if (eq type 'grid) 'pm3d (plist-get params :with))) + (ind (plist-get params :ind)) + (deps (if (plist-member params :deps) (plist-get params :deps))) + (text-ind (or (plist-get params :textind) + (eq (plist-get params :with) 'histograms))) + (col-labels (plist-get params :labels)) + res) + (dotimes (col num-cols res) + (unless (and (eq type '2d) + (or (and ind (equal (1+ col) ind)) + (and deps (not (member (1+ col) deps))))) + (setf res + (cons + (format plot-str data-file + (or (and ind (> ind 0) + (not text-ind) + (format "%d:" ind)) "") + (1+ col) + (if text-ind (format ":xticlabel(%d)" ind) "") + with + (or (nth col col-labels) + (format "%d" (1+ col)))) + res))))))) + (3d :plot-cmd "splot" + :plot-pre (lambda (_table _data-file _num-cols params _plot-str) + (if (plist-get params :map) "set map")) + :plot-func + (lambda (_table data-file _num-cols params _plot-str) + (let* ((type (plist-get params :plot-type)) + (with (if (eq type 'grid) 'pm3d (plist-get params :with)))) + (list (format "'%s' matrix with %s title ''" + data-file with))))) + (grid :plot-cmd "splot" + :plot-pre (lambda (_table _data-file _num-cols params _plot-str) + (if (plist-get params :map) "set pm3d map" "set map")) + :data-dump (lambda (table data-file params _num-cols) + (let ((y-labels (org-plot/gnuplot-to-grid-data + table data-file params))) + (when y-labels (plist-put params :ylabels y-labels)))) + :plot-func + (lambda (table data-file _num-cols params _plot-str) + (let* ((type (plist-get params :plot-type)) + (with (if (eq type 'grid) 'pm3d (plist-get params :with)))) + (list (format "'%s' with %s title ''" + data-file with))))) + (radar :plot-func + (lambda (table _data-file _num-cols params plot-str) + (list (org--plot/radar table params))))) + "List of plists describing the available plot types. +The car is the type name, and the property :plot-func must be +set. The value of :plot-func is a lambda which yields plot-lines +\(a list of strings) as the cdr. + +All lambda functions have the parameters of +`org-plot/gnuplot-script' and PLOT-STR passed to them. i.e. they +are called with the following signature: (TABLE DATA-FILE +NUM-COLS PARAMS PLOT-STR) + +Potentially useful parameters in PARAMS include: + :set :line :map :title :file :ind :timeind :timefmt :textind + :deps :labels :xlabels :ylabels :xmin :xmax :ymin :ymax :ticks + +In addition to :plot-func, the following optional properties may +be set. + +- :plot-cmd - A gnuplot command appended to each plot-line. + Accepts string or nil. Default value: nil. + +- :check-ind-type - Whether the types of ind values should be checked. + Accepts boolean. + +- :plot-str - the formula string passed to :plot-func as PLOT-STR + Accepts string. Default value: \"'%s' using %s%d%s with %s title '%s'\" + +- :data-dump - Function to dump the table to a datafile for ease of + use. + + Accepts lambda function. Default lambda body: + (org-plot/gnuplot-to-data table data-file params) + +- :plot-pre - Gnuplot code to be inserted early into the script, just + after term and output have been set. + + Accepts string, nil, or lambda function which returns string + or nil. Defaults to nil." + :group 'org-plot + :type 'alist) + +(defvar org--plot/radar-template + "### spider plot/chart with gnuplot +# also known as: radar chart, web chart, star chart, cobweb chart, +# radar plot, web plot, star plot, cobweb plot, etc. ... +set datafile separator ' ' +set size square +unset tics +set angles degree +set key bmargin center horizontal +unset border + +# Load data and setup +load \"%s\" + +# General settings +DataColCount = words($Data[1])-1 +AxesCount = |$Data|-HeaderLines-1 +AngleOffset = 90 +Max = 1 +d=0.1*Max +Direction = -1 # counterclockwise=1, clockwise = -1 + +# Tic settings +TicCount = %s +TicOffset = 0.1 +TicValue(axis,i) = real(i)*(word($Settings[axis],3)-word($Settings[axis],2)) \\ + / word($Settings[axis],4)+word($Settings[axis],2) +TicLabelPosX(axis,i) = PosX(axis,i/TicCount) + PosY(axis, TicOffset) +TicLabelPosY(axis,i) = PosY(axis,i/TicCount) - PosX(axis, TicOffset) +TicLen = 0.03 +TicdX(axis,i) = 0.5*TicLen*cos(alpha(axis)-90) +TicdY(axis,i) = 0.5*TicLen*sin(alpha(axis)-90) + +# Label +LabOffset = 0.10 +LabX(axis) = PosX(axis+1,Max+2*d) + PosY(axis, LabOffset) +LabY(axis) = PosY($0+1,Max+2*d) + +# Functions +alpha(axis) = (axis-1)*Direction*360.0/AxesCount+AngleOffset +PosX(axis,R) = R*cos(alpha(axis)) +PosY(axis,R) = R*sin(alpha(axis)) +Scale(axis,value) = real(value-word($Settings[axis],2))/(word($Settings[axis],3)-word($Settings[axis],2)) + +# Spider settings +set style arrow 1 dt 1 lw 1.0 @fgal head filled size 0.06,25 # style for axes +set style arrow 2 dt 2 lw 0.5 @fgal nohead # style for weblines +set style arrow 3 dt 1 lw 1 @fgal nohead # style for axis tics +set samples AxesCount +set isosamples TicCount +set urange[1:AxesCount] +set vrange[1:TicCount] +set style fill transparent solid 0.2 + +set xrange[-Max-4*d:Max+4*d] +set yrange[-Max-4*d:Max+4*d] +plot \\ + '+' u (0):(0):(PosX($0,Max+d)):(PosY($0,Max+d)) w vec as 1 not, \\ + $Data u (LabX($0)): \\ + (LabY($0)):1 every ::HeaderLines w labels center enhanced @fgt not, \\ + for [i=1:DataColCount] $Data u (PosX($0+1,Scale($0+1,column(i+1)))): \\ + (PosY($0+1,Scale($0+1,column(i+1)))) every ::HeaderLines w filledcurves lt i title word($Data[1],i+1), \\ +%s +# '++' u (PosX($1,$2/TicCount)-TicdX($1,$2/TicCount)): \\ +# (PosY($1,$2/TicCount)-TicdY($1,$2/TicCount)): \\ +# (2*TicdX($1,$2/TicCount)):(2*TicdY($1,$2/TicCount)) \\ +# w vec as 3 not, \\ +### end of code +") + +(defvar org--plot/radar-ticks + " '++' u (PosX($1,$2/TicCount)):(PosY($1,$2/TicCount)): \\ + (PosX($1+1,$2/TicCount)-PosX($1,$2/TicCount)): \\ + (PosY($1+1,$2/TicCount)-PosY($1,$2/TicCount)) w vec as 2 not, \\ + '++' u (TicLabelPosX(%s,$2)):(TicLabelPosY(%s,$2)): \\ + (sprintf('%%g',TicValue(%s,$2))) w labels font ',8' @fgat not") + +(defvar org--plot/radar-setup-template + "# Data +$Data <<HEREHAVESOMEDATA +%s +HEREHAVESOMEDATA +HeaderLines = 1 + +# Settings for scale and offset adjustments +# axis min max tics axisLabelXoff axisLabelYoff +$Settings <<EOD +%s +EOD +") + +(defun org--plot/radar (table params) + "Create gnuplot code for a radar plot of TABLE with PARAMS." + (let* ((data + (concat "\"" (mapconcat #'identity (plist-get params :labels) "\" \"") "\"" + "\n" + (mapconcat (lambda (row) + (format + "\"%s\" %s" + (car row) + (mapconcat #'identity (cdr row) " "))) + (append table (list (car table))) + "\n"))) + (ticks (or (plist-get params :ticks) + (org--plot/sensible-tick-num table + (plist-get params :ymin) + (plist-get params :ymax)))) + (settings + (mapconcat (lambda (row) + (let ((data (org--plot/values-stats + (mapcar #'string-to-number (cdr row))))) + (format + "\"%s\" %s %s %s" + (car row) + (or (plist-get params :ymin) + (plist-get data :nice-min)) + (or (plist-get params :ymax) + (plist-get data :nice-max)) + (if (eq ticks 0) 2 ticks) + ))) + (append table (list (car table))) + "\n")) + (setup-file (make-temp-file "org-plot-setup"))) + (let ((coding-system-for-write 'utf-8)) + (write-region (format org--plot/radar-setup-template data settings) nil setup-file nil :silent)) + (format org--plot/radar-template + setup-file + (if (eq ticks 0) 2 ticks) + (if (eq ticks 0) "" + (apply #'format org--plot/radar-ticks + (make-list 3 (if (and (plist-get params :ymin) + (plist-get params :ymax)) + ;; FIXME multi-drawing of tick labels with "1" + "1" "$1"))))))) + +(defcustom org-plot/gnuplot-term-extra "" + "String or function which provides the extra term options. +E.g. a value of \"size 1050,650\" would cause +\"set term ... size 1050,650\" to be used. +If a function, it is called with the plot type as the argument." + :group 'org-plot + :type '(choice string function)) + +(defun org-plot/gnuplot-script (table data-file num-cols params &optional preface) + "Write a gnuplot script for TABLE to DATA-FILE respecting options in PARAMS. +NUM-COLS controls the number of columns plotted in a 2-d plot. +Optional argument PREFACE returns only option parameters in a +manner suitable for prepending to a user-specified script." + (let* ((type-name (plist-get params :plot-type)) + (type (cdr (assoc type-name org-plot/preset-plot-types)))) + (unless type + (user-error "Org-plot type `%s' is undefined" type-name)) + (let* ((sets (plist-get params :set)) + (lines (plist-get params :line)) + (title (plist-get params :title)) + (file (plist-get params :file)) + (time-ind (plist-get params :timeind)) + (timefmt (plist-get params :timefmt)) + (x-labels (plist-get params :xlabels)) + (y-labels (plist-get params :ylabels)) + (plot-str (or (plist-get type :plot-str) + "'%s' using %s%d%s with %s title '%s'")) + (plot-cmd (plist-get type :plot-cmd)) + (plot-pre (plist-get type :plot-pre)) + (script "reset") + ;; ats = add-to-script + (ats (lambda (line) (when line (setf script (concat script "\n" line))))) + plot-lines) + + + ;; handle output file, background, and size + (funcall ats (format "set term %s %s" + (if file (file-name-extension file) "GNUTERM") + (if (stringp org-plot/gnuplot-term-extra) + org-plot/gnuplot-term-extra + (funcall org-plot/gnuplot-term-extra type)))) + (when file ; output file + (funcall ats (format "set output '%s'" (expand-file-name file)))) + + (when plot-pre + (funcall ats (funcall plot-pre table data-file num-cols params plot-str))) + + (funcall ats + (if (stringp org-plot/gnuplot-script-preamble) + org-plot/gnuplot-script-preamble + (funcall org-plot/gnuplot-script-preamble type))) + + (when title (funcall ats (format "set title '%s'" title))) ; title + (mapc ats lines) ; line + (dolist (el sets) (funcall ats (format "set %s" el))) ; set + ;; Unless specified otherwise, values are TAB separated. + (unless (string-match-p "^set datafile separator" script) + (funcall ats "set datafile separator \"\\t\"")) + (when x-labels ; x labels (xtics) + (funcall ats + (format "set xtics (%s)" + (mapconcat (lambda (pair) + (format "\"%s\" %d" (cdr pair) (car pair))) + x-labels ", ")))) + (when y-labels ; y labels (ytics) + (funcall ats + (format "set ytics (%s)" + (mapconcat (lambda (pair) + (format "\"%s\" %d" (cdr pair) (car pair))) + y-labels ", ")))) + (when time-ind ; timestamp index + (funcall ats "set xdata time") + (funcall ats (concat "set timefmt \"" + (or timefmt ; timefmt passed to gnuplot + "%Y-%m-%d-%H:%M:%S") "\""))) + (unless preface + (let ((type-func (plist-get type :plot-func))) + (when type-func + (setq plot-lines + (funcall type-func table data-file num-cols params plot-str)))) + (funcall ats + (concat plot-cmd + (when plot-cmd " ") + (mapconcat #'identity + (reverse plot-lines) + ",\\\n ")))) + script))) + +(defun org-plot/redisplay-img-in-buffer (img-file) + "Find any overlays for IMG-FILE in the current Org buffer, and refresh them." + (dolist (img-overlay org-inline-image-overlays) + (when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file)) + (when (file-exists-p img-file) + (image-refresh (overlay-get img-overlay 'display)))))) + +;;----------------------------------------------------------------------------- +;; facade functions +;;;###autoload +(defun org-plot/gnuplot (&optional params) + "Plot table using gnuplot. Gnuplot options can be specified with PARAMS. +If not given options will be taken from the +PLOT +line directly before or after the table." + (interactive) + (require 'gnuplot) + (save-window-excursion + (delete-other-windows) + (when (get-buffer "*gnuplot*") ; reset *gnuplot* if it already running + (with-current-buffer "*gnuplot*" + (goto-char (point-max)))) + (save-excursion + (org-plot/goto-nearest-table) + ;; Set default options. + (dolist (pair org-plot/gnuplot-default-options) + (unless (plist-member params (car pair)) + (setf params (plist-put params (car pair) (cdr pair))))) + ;; Collect options. + (while (and (equal 0 (forward-line -1)) + (looking-at "[[:space:]]*#\\+")) + (setf params (org-plot/collect-options params)))) + ;; collect table and table information + (let* ((data-file (make-temp-file "org-plot")) + (table (let ((tbl (save-excursion + (org-plot/goto-nearest-table) + (org-table-to-lisp)))) + (when (pcase (plist-get params :transpose) + (`y t) + (`yes t) + (`t t)) + (if (not (memq 'hline tbl)) + (setq tbl (apply #'cl-mapcar #'list tbl)) + ;; When present, remove hlines as they can't (currentily) be easily transposed. + (setq tbl (apply #'cl-mapcar #'list + (remove 'hline tbl))) + (push 'hline (cdr tbl)))) + tbl)) + (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table) + (nth 0 table)))) + (type (assoc (plist-get params :plot-type) + org-plot/preset-plot-types))) + + (unless type + (user-error "Org-plot type `%s' is undefined" (plist-get params :plot-type))) + + (run-with-idle-timer 0.1 nil #'delete-file data-file) + (when (eq (cadr table) 'hline) + (setf params + (plist-put params :labels (car table))) ; headers to labels + (setf table (delq 'hline (cdr table)))) ; clean non-data from table + ;; Collect options. + (save-excursion (while (and (equal 0 (forward-line -1)) + (looking-at "[[:space:]]*#\\+")) + (setf params (org-plot/collect-options params)))) + ;; Dump table to datafile + (if-let ((dump-func (plist-get type :data-dump))) + (funcall dump-func table data-file num-cols params) + (org-plot/gnuplot-to-data table data-file params)) + ;; Check type of ind column (timestamp? text?) + (when (plist-get params :check-ind-type) + (let* ((ind (1- (plist-get params :ind))) + (ind-column (mapcar (lambda (row) (nth ind row)) table))) + (cond ((< ind 0) nil) ; ind is implicit + ((cl-every (lambda (el) + (string-match org-ts-regexp3 el)) + ind-column) + (plist-put params :timeind t)) ; ind holds timestamps + ((or (string= (plist-get params :with) "hist") + (cl-notevery (lambda (el) + (string-match org-table-number-regexp el)) + ind-column)) + (plist-put params :textind t))))) ; ind holds text + ;; Write script. + (with-temp-buffer + (if (plist-get params :script) ; user script + (progn (insert + (org-plot/gnuplot-script table data-file num-cols params t)) + (insert "\n") + (insert-file-contents (plist-get params :script)) + (goto-char (point-min)) + (while (re-search-forward "\\$datafile" nil t) + (replace-match data-file nil nil))) + (insert (org-plot/gnuplot-script table data-file num-cols params))) + ;; Graph table. + (gnuplot-mode) + (condition-case nil + (gnuplot-send-buffer-to-gnuplot) + (buffer-read-only nil))) + ;; Cleanup. + (bury-buffer (get-buffer "*gnuplot*")) + ;; Refresh any displayed images + (when (plist-get params :file) + (org-plot/redisplay-img-in-buffer (expand-file-name (plist-get params :file))))))) + +(provide 'org-plot) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-plot.el ends here diff --git a/elpa/org-9.5.2/org-plot.elc b/elpa/org-9.5.2/org-plot.elc new file mode 100644 index 0000000..68aed45 Binary files /dev/null and b/elpa/org-9.5.2/org-plot.elc differ diff --git a/elpa/org-9.5.2/org-protocol.el b/elpa/org-9.5.2/org-protocol.el new file mode 100644 index 0000000..ca3249d --- /dev/null +++ b/elpa/org-9.5.2/org-protocol.el @@ -0,0 +1,777 @@ +;;; org-protocol.el --- Intercept Calls from Emacsclient to Trigger Custom Actions -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. +;; +;; Authors: Bastien Guerry <bzg@gnu.org> +;; Daniel M German <dmg AT uvic DOT org> +;; 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 + +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Commentary: +;; +;; Intercept calls from emacsclient to trigger custom actions. +;; +;; This is done by advising `server-visit-files' to scan the list of filenames +;; for `org-protocol-the-protocol' and sub-protocols defined in +;; `org-protocol-protocol-alist' and `org-protocol-protocol-alist-default'. +;; +;; Any application that supports calling external programs with an URL +;; as argument may be used with this functionality. +;; +;; +;; Usage: +;; ------ +;; +;; 1.) Add this to your init file (.emacs probably): +;; +;; (add-to-list 'load-path "/path/to/org-protocol/") +;; (require 'org-protocol) +;; +;; 3.) Ensure emacs-server is up and running. +;; 4.) Try this from the command line (adjust the URL as needed): +;; +;; $ emacsclient \ +;; "org-protocol://store-link?url=http:%2F%2Flocalhost%2Findex.html&title=The%20title" +;; +;; 5.) Optionally add custom sub-protocols and handlers: +;; +;; (setq org-protocol-protocol-alist +;; '(("my-protocol" +;; :protocol "my-protocol" +;; :function my-protocol-handler-function))) +;; +;; A "sub-protocol" will be found in URLs like this: +;; +;; org-protocol://sub-protocol?key=val&key2=val2 +;; +;; If it works, you can now setup other applications for using this feature. +;; +;; +;; As of March 2009 Firefox users follow the steps documented on +;; http://kb.mozillazine.org/Register_protocol, Opera setup is described here: +;; http://www.opera.com/support/kb/view/535/ +;; +;; +;; Documentation +;; ------------- +;; +;; org-protocol.el comes with and installs handlers to open sources of published +;; online content, store and insert the browser's URLs and cite online content +;; by clicking on a bookmark in Firefox, Opera and probably other browsers and +;; applications: +;; +;; * `org-protocol-open-source' uses the sub-protocol \"open-source\" and maps +;; URLs to local filenames defined in `org-protocol-project-alist'. +;; +;; * `org-protocol-store-link' stores an Org link (if Org is present) and +;; pushes the browsers URL to the `kill-ring' for yanking. This handler is +;; triggered through the sub-protocol \"store-link\". +;; +;; * Call `org-protocol-capture' by using the sub-protocol \"capture\". If +;; Org is loaded, Emacs will pop-up a capture buffer and fill the +;; template with the data provided. I.e. the browser's URL is inserted as an +;; Org-link of which the page title will be the description part. If text +;; was select in the browser, that text will be the body of the entry. +;; +;; You may use the same bookmark URL for all those standard handlers and just +;; adjust the sub-protocol used: +;; +;; javascript:location.href='org-protocol://sub-protocol?'+ +;; new URLSearchParams({ +;; url: location.href, +;; title: document.title, +;; body: window.getSelection()}) +;; +;; Alternatively use the following expression that encodes space as \"%20\" +;; instead of \"+\", so it is compatible with Org versions from 9.0 to 9.4: +;; +;; location.href='org-protocol://sub-protocol?url='+ +;; encodeURIComponent(location.href)+'&title='+ +;; encodeURIComponent(document.title)+'&body='+ +;; encodeURIComponent(window.getSelection()) +;; +;; The handler for the sub-protocol \"capture\" detects an optional template +;; char that, if present, triggers the use of a special template. +;; Example: +;; +;; location.href='org-protocol://capture?'+ +;; new URLSearchParams({template:'x', /* ... */}) +;; +;; or +;; +;; location.href='org-protocol://capture?template=x'+ ... +;; +;; uses template ?x. +;; +;; Note that using double slashes is optional from org-protocol.el's point of +;; view because emacsclient squashes the slashes to one. +;; +;; +;; provides: 'org-protocol +;; +;;; Code: + +(require 'org) +(require 'ol) + +(declare-function org-publish-get-project-from-filename "ox-publish" + (filename &optional up)) +(declare-function server-edit "server" (&optional arg)) + +(defvar org-capture-link-is-already-stored) +(defvar org-capture-templates) + +(defgroup org-protocol nil + "Intercept calls from emacsclient to trigger custom actions. + +This is done by advising `server-visit-files' to scan the list of filenames +for `org-protocol-the-protocol' and sub-protocols defined in +`org-protocol-protocol-alist' and `org-protocol-protocol-alist-default'." + :version "22.1" + :group 'convenience + :group 'org) + + +;;; Variables: + +(defconst org-protocol-protocol-alist-default + '(("org-capture" :protocol "capture" :function org-protocol-capture :kill-client t) + ("org-store-link" :protocol "store-link" :function org-protocol-store-link) + ("org-open-source" :protocol "open-source" :function org-protocol-open-source)) + "Default protocols to use. +See `org-protocol-protocol-alist' for a description of this variable.") + +(defconst org-protocol-the-protocol "org-protocol" + "This is the protocol to detect if org-protocol.el is loaded. +`org-protocol-protocol-alist-default' and `org-protocol-protocol-alist' hold +the sub-protocols that trigger the required action. You will have to define +just one protocol handler OS-wide (MS-Windows) or per application (Linux). +That protocol handler should call emacsclient.") + +;;; User variables: + +(defcustom org-protocol-reverse-list-of-files t + "Non-nil means re-reverse the list of filenames passed on the command line. +The filenames passed on the command line are passed to the emacs-server in +reverse order. Set to t (default) to re-reverse the list, i.e. use the +sequence on the command line. If nil, the sequence of the filenames is +unchanged." + :group 'org-protocol + :type 'boolean) + +(defcustom org-protocol-project-alist nil + "Map URLs to local filenames for `org-protocol-open-source' (open-source). + +Each element of this list must be of the form: + + (module-name :property value property: value ...) + +where module-name is an arbitrary name. All the values are strings. + +Possible properties are: + + :online-suffix - the suffix to strip from the published URLs + :working-suffix - the replacement for online-suffix + :base-url - the base URL, e.g. https://www.example.com/project/ + Last slash required. + :working-directory - the local working directory. This is what + base-url will be replaced with. + :redirects - A list of cons cells, each of which maps a + regular expression to match to a path relative + to `:working-directory'. + +Example: + + (setq org-protocol-project-alist + \\='((\"https://orgmode.org/worg/\" + :online-suffix \".php\" + :working-suffix \".org\" + :base-url \"https://orgmode.org/worg/\" + :working-directory \"/home/user/org/Worg/\") + (\"localhost org-notes/\" + :online-suffix \".html\" + :working-suffix \".org\" + :base-url \"http://localhost/org/\" + :working-directory \"/home/user/org/\" + :rewrites ((\"org/?$\" . \"index.php\"))) + (\"Hugo based blog\" + :base-url \"https://www.site.com/\" + :working-directory \"~/site/content/post/\" + :online-suffix \".html\" + :working-suffix \".md\" + :rewrites ((\"\\(https://site.com/[0-9]+/[0-9]+/[0-9]+/\\)\" + . \".md\"))) + (\"GNU emacs OpenGrok\" + :base-url \"https://opengrok.housegordon.com/source/xref/emacs/\" + :working-directory \"~/dev/gnu-emacs/\"))) + + The :rewrites line of \"localhost org-notes\" entry tells + `org-protocol-open-source' to open /home/user/org/index.php, + if the URL cannot be mapped to an existing file, and ends with + either \"org\" or \"org/\". The \"GNU emacs OpenGrok\" entry + does not include any suffix properties, allowing local source + file to be opened as found by OpenGrok. + +Consider using the interactive functions `org-protocol-create' +and `org-protocol-create-for-org' to help you filling this +variable with valid contents." + :group 'org-protocol + :type 'alist) + +(defcustom org-protocol-protocol-alist nil + "Register custom handlers for org-protocol. + +Each element of this list must be of the form: + + (module-name :protocol protocol :function func :kill-client nil) + +protocol - protocol to detect in a filename without trailing + colon and slashes. See rfc1738 section 2.1 for more + on this. If you define a protocol \"my-protocol\", + `org-protocol-check-filename-for-protocol' will search + filenames for \"org-protocol:/my-protocol\" and + trigger your action for every match. `org-protocol' + is defined in `org-protocol-the-protocol'. Double and + triple slashes are compressed to one by emacsclient. + +function - function that handles requests with protocol and takes + one argument. If a new-style link (key=val&key2=val2) + is given, the argument will be a property list with + the values from the link. If an old-style link is + given (val1/val2), the argument will be the filename + with all protocols stripped. + + If the function returns nil, emacsclient and -server + do nothing. Any non-nil return value is considered a + valid filename and thus passed to the server. + + `org-protocol.el' provides some support for handling + old-style filenames, if you follow the conventions + used for the standard handlers in + `org-protocol-protocol-alist-default'. See + `org-protocol-parse-parameters'. + +kill-client - If t, kill the client immediately, once the sub-protocol is + detected. This is necessary for actions that can be interrupted by + `C-g' to avoid dangling emacsclients. Note that all other command + line arguments but the this one will be discarded. Greedy handlers + still receive the whole list of arguments though. + +Here is an example: + + (setq org-protocol-protocol-alist + \\='((\"my-protocol\" + :protocol \"my-protocol\" + :function my-protocol-handler-function) + (\"your-protocol\" + :protocol \"your-protocol\" + :function your-protocol-handler-function)))" + :group 'org-protocol + :type '(alist)) + +(defcustom org-protocol-default-template-key nil + "The default template key to use. +This is usually a single character string but can also be a +string with two characters." + :group 'org-protocol + :type '(choice (const nil) (string))) + +(defcustom org-protocol-data-separator "/+\\|\\?" + "The default data separator to use. +This should be a single regexp string." + :group 'org-protocol + :version "24.4" + :package-version '(Org . "8.0") + :type 'regexp) + +;;; Helper functions: + +(defun org-protocol-sanitize-uri (uri) + "Sanitize slashes to double-slashes in URI. +Emacsclient compresses double and triple slashes." + (when (string-match "^\\([a-z]+\\):/" uri) + (let* ((splitparts (split-string uri "/+"))) + (setq uri (concat (car splitparts) "//" (mapconcat 'identity (cdr splitparts) "/"))))) + uri) + +(defun org-protocol-split-data (data &optional unhexify separator) + "Split the DATA argument for an org-protocol handler function. +If UNHEXIFY is non-nil, hex-decode each split part. If UNHEXIFY +is a function, use that function to decode each split part. The +string is split at each occurrence of SEPARATOR (regexp). If no +SEPARATOR is specified or SEPARATOR is nil, assume \"/+\". The +results of that splitting are returned as a list." + (let* ((sep (or separator "/+\\|\\?")) + (split-parts (split-string data sep))) + (cond ((not unhexify) split-parts) + ((fboundp unhexify) (mapcar unhexify split-parts)) + (t (mapcar #'org-link-decode split-parts))))) + +(defun org-protocol-flatten-greedy (param-list &optional strip-path replacement) + "Transform PARAM-LIST into a flat list for greedy handlers. + +Greedy handlers might receive a list like this from emacsclient: +\((\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\")) +where \"/dir/\" is the absolute path to emacsclient's working directory. This +function transforms it into a flat list using `org-protocol-flatten' and +transforms the elements of that list as follows: + +If STRIP-PATH is non-nil, remove the \"/dir/\" prefix from all members of +param-list. + +If REPLACEMENT is string, replace the \"/dir/\" prefix with it. + +The first parameter, the one that contains the protocols, is always changed. +Everything up to the end of the protocols is stripped. + +Note, that this function will always behave as if +`org-protocol-reverse-list-of-files' was set to t and the returned list will +reflect that. emacsclient's first parameter will be the first one in the +returned list." + (let* ((l (org-protocol-flatten (if org-protocol-reverse-list-of-files + param-list + (reverse param-list)))) + (trigger (car l)) + (len 0) + dir + ret) + (when (string-match "^\\(.*\\)\\(org-protocol:/+[a-zA-Z0-9][-_a-zA-Z0-9]*:/+\\)\\(.*\\)" trigger) + (setq dir (match-string 1 trigger)) + (setq len (length dir)) + (setcar l (concat dir (match-string 3 trigger)))) + (if strip-path + (progn + (dolist (e l ret) + (setq ret + (append ret + (list + (if (stringp e) + (if (stringp replacement) + (setq e (concat replacement (substring e len))) + (setq e (substring e len))) + e))))) + ret) + l))) + +(defalias 'org-protocol-flatten + (if (fboundp 'flatten-tree) 'flatten-tree + (lambda (list) + "Transform LIST into a flat list. + +Greedy handlers might receive a list like this from emacsclient: +\((\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\")) +where \"/dir/\" is the absolute path to emacsclients working directory. +This function transforms it into a flat list." + (if list + (if (consp list) + (append (org-protocol-flatten (car list)) + (org-protocol-flatten (cdr list))) + (list list)))))) + +(defun org-protocol-parse-parameters (info &optional new-style default-order) + "Return a property list of parameters from INFO. +If NEW-STYLE is non-nil, treat INFO as a query string (ex: +url=URL&title=TITLE). If old-style links are used (ex: +org-protocol://store-link/url/title), assign them to attributes +following DEFAULT-ORDER. + +If no DEFAULT-ORDER is specified, return the list of values. + +If INFO is already a property list, return it unchanged." + (if (listp info) + info + (if new-style + (let ((data (org-protocol-convert-query-to-plist info)) + result) + (while data + (setq result + (append result + (list (pop data) (org-link-decode (pop data)))))) + result) + (let ((data (org-protocol-split-data info t org-protocol-data-separator))) + (if default-order + (org-protocol-assign-parameters data default-order) + data))))) + +(defun org-protocol-assign-parameters (data default-order) + "Return a property list of parameters from DATA. +Key names are taken from DEFAULT-ORDER, which should be a list of +symbols. If DEFAULT-ORDER is shorter than the number of values +specified, the rest of the values are treated as :key value pairs." + (let (result) + (while default-order + (setq result + (append result + (list (pop default-order) + (pop data))))) + (while data + (setq result + (append result + (list (intern (concat ":" (pop data))) + (pop data))))) + result)) + +;;; Standard protocol handlers: + +(defun org-protocol-store-link (fname) + "Process an org-protocol://store-link style url. +Additionally store a browser URL as an org link. Also pushes the +link's URL to the `kill-ring'. + +Parameters: url, title (optional), body (optional) + +Old-style links such as org-protocol://store-link://URL/TITLE are +also recognized. + +The location for a browser's bookmark may look like this: + + javascript:location.href = \\='org-protocol://store-link?\\=' + + new URLSearchParams({url:location.href, title:document.title}); + +or to keep compatibility with Org versions from 9.0 to 9.4 it may be: + + javascript:location.href = \\ + \\='org-protocol://store-link?url=\\=' + \\ + encodeURIComponent(location.href) + \\='&title=\\=' + \\ + encodeURIComponent(document.title); + +Don't use `escape()'! Use `encodeURIComponent()' instead. The +title of the page could contain slashes and the location +definitely will. Org 9.4 and earlier could not decode \"+\" +to space, that is why less readable latter expression may be necessary +for backward compatibility. + +The sub-protocol used to reach this function is set in +`org-protocol-protocol-alist'. + +FNAME should be a property list. If not, an old-style link of the +form URL/TITLE can also be used." + (let* ((splitparts (org-protocol-parse-parameters fname nil '(:url :title))) + (uri (org-protocol-sanitize-uri (plist-get splitparts :url))) + (title (plist-get splitparts :title))) + (when (boundp 'org-stored-links) + (push (list uri title) org-stored-links)) + (kill-new uri) + (message "`%s' to insert new Org link, `%s' to insert %S" + (substitute-command-keys "\\[org-insert-link]") + (substitute-command-keys "\\[yank]") + uri)) + nil) + +(defun org-protocol-capture (info) + "Process an org-protocol://capture style url with INFO. + +The sub-protocol used to reach this function is set in +`org-protocol-protocol-alist'. + +This function detects an URL, title and optional text, separated +by `/'. The location for a browser's bookmark looks like this: + + javascript:location.href = \\='org-protocol://capture?\\=' + + new URLSearchParams({ + url: location.href, + title: document.title, + body: window.getSelection()}) + +or to keep compatibility with Org versions from 9.0 to 9.4: + + javascript:location.href = \\='org-protocol://capture?url=\\='+ \\ + encodeURIComponent(location.href) + \\='&title=\\=' + \\ + encodeURIComponent(document.title) + \\='&body=\\=' + \\ + encodeURIComponent(window.getSelection()) + +By default, it uses the character `org-protocol-default-template-key', +which should be associated with a template in `org-capture-templates'. +You may specify the template with a template= query parameter, like this: + + javascript:location.href = \\='org-protocol://capture?template=b\\='+ ... + +Now template ?b will be used." + (let* ((parts + (pcase (org-protocol-parse-parameters info) + ;; New style links are parsed as a plist. + ((let `(,(pred keywordp) . ,_) info) info) + ;; Old style links, with or without template key, are + ;; parsed as a list of strings. + (p + (let ((k (if (= 1 (length (car p))) + '(:template :url :title :body) + '(:url :title :body)))) + (org-protocol-assign-parameters p k))))) + (template (or (plist-get parts :template) + org-protocol-default-template-key)) + (url (and (plist-get parts :url) + (org-protocol-sanitize-uri (plist-get parts :url)))) + (type (and url + (string-match "^\\([a-z]+\\):" url) + (match-string 1 url))) + (title (or (plist-get parts :title) "")) + (region (or (plist-get parts :body) "")) + (orglink + (if (null url) title + (org-link-make-string url (or (org-string-nw-p title) url)))) + ;; Avoid call to `org-store-link'. + (org-capture-link-is-already-stored t)) + ;; Only store link if there's a URL to insert later on. + (when url (push (list url title) org-stored-links)) + (org-link-store-props :type type + :link url + :description title + :annotation orglink + :initial region + :query parts) + (raise-frame) + (org-capture nil template) + (message "Item captured.") + ;; Make sure we do not return a string, as `server-visit-files', + ;; through `server-edit', would interpret it as a file name. + nil)) + +(defun org-protocol-convert-query-to-plist (query) + "Convert QUERY key=value pairs in the URL to a property list." + (when query + (let ((plus-decoded (replace-regexp-in-string "\\+" " " query t t))) + (apply 'append (mapcar (lambda (x) + (let ((c (split-string x "="))) + (list (intern (concat ":" (car c))) (cadr c)))) + (split-string plus-decoded "&")))))) + +(defun org-protocol-open-source (fname) + "Process an org-protocol://open-source?url= style URL with FNAME. + +Change a filename by mapping URLs to local filenames as set +in `org-protocol-project-alist'. + +The location for a browser's bookmark should look like this: + + javascript:location.href = \\='org-protocol://open-source?\\=' + + new URLSearchParams({url: location.href}) + +or if you prefer to keep compatibility with older Org versions (9.0 to 9.4), +consider the following expression: + + javascript:location.href = \\='org-protocol://open-source?url=\\=' + \\ + encodeURIComponent(location.href)" + ;; As we enter this function for a match on our protocol, the return value + ;; defaults to nil. + (let (;; (result nil) + (f (org-protocol-sanitize-uri + (plist-get (org-protocol-parse-parameters fname nil '(:url)) + :url)))) + (catch 'result + (dolist (prolist org-protocol-project-alist) + (let* ((base-url (plist-get (cdr prolist) :base-url)) + (wsearch (regexp-quote base-url))) + + (when (string-match wsearch f) + (let* ((wdir (plist-get (cdr prolist) :working-directory)) + (strip-suffix (plist-get (cdr prolist) :online-suffix)) + (add-suffix (plist-get (cdr prolist) :working-suffix)) + ;; Strip "[?#].*$" if `f' is a redirect with another + ;; ending than strip-suffix here: + (f1 (substring f 0 (string-match "\\([\\?#].*\\)?$" f))) + (start-pos (+ (string-match wsearch f1) (length base-url))) + (end-pos (if strip-suffix + (string-match (regexp-quote strip-suffix) f1) + (length f1))) + ;; We have to compare redirects without suffix below: + (f2 (concat wdir (substring f1 start-pos end-pos))) + (the-file (if add-suffix (concat f2 add-suffix) f2))) + + ;; Note: the-file may still contain `%C3' et al here because browsers + ;; tend to encode `ä' in URLs to `%25C3' - `%25' being `%'. + ;; So the results may vary. + + ;; -- start redirects -- + (unless (file-exists-p the-file) + (message "File %s does not exist.\nTesting for rewritten URLs." the-file) + (let ((rewrites (plist-get (cdr prolist) :rewrites))) + (when rewrites + (message "Rewrites found: %S" rewrites) + (dolist (rewrite rewrites) + ;; Try to match a rewritten URL and map it to + ;; a real file. Compare redirects without + ;; suffix. + (when (string-match (car rewrite) f1) + (let ((replacement + (concat (directory-file-name + (replace-match "" nil nil f1 1)) + (cdr rewrite)))) + (throw 'result (concat wdir replacement)))))))) + ;; -- end of redirects -- + + (if (file-readable-p the-file) + (throw 'result the-file)) + (if (file-exists-p the-file) + (message "%s: permission denied!" the-file) + (message "%s: no such file or directory." the-file)))))) + nil))) ;; FIXME: Really? + + +;;; Core functions: + +(defun org-protocol-check-filename-for-protocol (fname restoffiles _client) + "Check if `org-protocol-the-protocol' and a valid protocol are used in FNAME. +Sub-protocols are registered in `org-protocol-protocol-alist' and +`org-protocol-protocol-alist-default'. This is how the matching is done: + + (string-match \"protocol:/+sub-protocol\\\\(://\\\\|\\\\?\\\\)\" ...) + +protocol and sub-protocol are regexp-quoted. + +Old-style links such as \"protocol://sub-protocol://param1/param2\" are +also recognized. + +If a matching protocol is found, the protocol is stripped from +fname and the result is passed to the protocol function as the +first parameter. The second parameter will be non-nil if FNAME +uses key=val&key2=val2-type arguments, or nil if FNAME uses +val/val2-type arguments. If the function returns nil, the +filename is removed from the list of filenames passed from +emacsclient to the server. If the function returns a non-nil +value, that value is passed to the server as filename. + +If the handler function is greedy, RESTOFFILES will also be passed to it. + +CLIENT is ignored." + (let ((sub-protocols (append org-protocol-protocol-alist + org-protocol-protocol-alist-default))) + (catch 'fname + (let ((the-protocol (concat (regexp-quote org-protocol-the-protocol) + ":/+"))) + (when (string-match the-protocol fname) + (dolist (prolist sub-protocols) + (let ((proto + (concat the-protocol + (regexp-quote (plist-get (cdr prolist) :protocol)) + "\\(:/+\\|/*\\?\\)"))) + (when (string-match proto fname) + (let* ((func (plist-get (cdr prolist) :function)) + (greedy (plist-get (cdr prolist) :greedy)) + (split (split-string fname proto)) + (result (if greedy restoffiles (cadr split))) + (new-style (not (= ?: (aref (match-string 1 fname) 0))))) + (when (plist-get (cdr prolist) :kill-client) + (message "Greedy org-protocol handler. Killing client.") + (server-edit)) + (when (fboundp func) + (unless greedy + (throw 'fname + (if new-style + (funcall func (org-protocol-parse-parameters + result new-style)) + (warn "Please update your Org Protocol handler \ +to deal with new-style links.") + (funcall func result)))) + ;; Greedy protocol handlers are responsible for + ;; parsing their own filenames. + (funcall func result) + (throw 'fname t)))))))) + fname))) + +(defadvice server-visit-files (before org-protocol-detect-protocol-server activate) + "Advice server-visit-flist to call `org-protocol-modify-filename-for-protocol'." + (let ((flist (if org-protocol-reverse-list-of-files + (reverse (ad-get-arg 0)) + (ad-get-arg 0))) + (client (ad-get-arg 1))) + (catch 'greedy + (dolist (var flist) + ;; `\' to `/' on windows. FIXME: could this be done any better? + (let ((fname (expand-file-name (car var)))) + (setq fname (org-protocol-check-filename-for-protocol + fname (member var flist) client)) + (if (eq fname t) ;; greedy? We need the t return value. + (progn + (ad-set-arg 0 nil) + (throw 'greedy t)) + (if (stringp fname) ;; probably filename + (setcar var fname) + (ad-set-arg 0 (delq var (ad-get-arg 0)))))))))) + +;;; Org specific functions: + +(defun org-protocol-create-for-org () + "Create an Org protocol project for the current file's project. +The visited file needs to be part of a publishing project in +`org-publish-project-alist' for this to work. The function +delegates most of the work to `org-protocol-create'." + (interactive) + (require 'ox-publish) + (let ((all (or (org-publish-get-project-from-filename buffer-file-name)))) + (if all (org-protocol-create (cdr all)) + (message "%s" + (substitute-command-keys + "Not in an Org project. \ +Did you mean `\\[org-protocol-create]'?"))))) + +(defun org-protocol-create (&optional project-plist) + "Create a new org-protocol project interactively. +An org-protocol project is an entry in +`org-protocol-project-alist' which is used by +`org-protocol-open-source'. Optionally use PROJECT-PLIST to +initialize the defaults for this project. If PROJECT-PLIST is +the cdr of an element in `org-publish-project-alist', reuse +:base-directory, :html-extension and :base-extension." + (interactive) + (let ((working-dir (expand-file-name + (or (plist-get project-plist :base-directory) + default-directory))) + (base-url "https://orgmode.org/worg/") + (strip-suffix (or (plist-get project-plist :html-extension) ".html")) + (working-suffix (if (plist-get project-plist :base-extension) + (concat "." (plist-get project-plist :base-extension)) + ".org")) + (insert-default-directory t) + (minibuffer-allow-text-properties nil)) + + (setq base-url (read-string "Base URL of published content: " base-url nil base-url t)) + (or (string-suffix-p "/" base-url) + (setq base-url (concat base-url "/"))) + + (setq working-dir + (expand-file-name + (read-directory-name "Local working directory: " working-dir working-dir t))) + (or (string-suffix-p "/" working-dir) + (setq working-dir (concat working-dir "/"))) + + (setq strip-suffix + (read-string + (concat "Extension to strip from published URLs (" strip-suffix "): ") + strip-suffix nil strip-suffix t)) + + (setq working-suffix + (read-string + (concat "Extension of editable files (" working-suffix "): ") + working-suffix nil working-suffix t)) + + (when (yes-or-no-p "Save the new org-protocol-project to your init file? ") + (setq org-protocol-project-alist + (cons `(,base-url . (:base-url ,base-url + :working-directory ,working-dir + :online-suffix ,strip-suffix + :working-suffix ,working-suffix)) + org-protocol-project-alist)) + (customize-save-variable 'org-protocol-project-alist org-protocol-project-alist)))) + +(provide 'org-protocol) + +;;; org-protocol.el ends here diff --git a/elpa/org-9.5.2/org-protocol.elc b/elpa/org-9.5.2/org-protocol.elc new file mode 100644 index 0000000..4b8f26c Binary files /dev/null and b/elpa/org-9.5.2/org-protocol.elc differ diff --git a/elpa/org-9.5.2/org-refile.el b/elpa/org-9.5.2/org-refile.el new file mode 100644 index 0000000..678759e --- /dev/null +++ b/elpa/org-9.5.2/org-refile.el @@ -0,0 +1,752 @@ +;;; org-refile.el --- Refile Org Subtrees -*- lexical-binding: t; -*- + +;; Copyright (C) 2010-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp +;; +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Org Refile allows you to refile subtrees to various locations. + +;;; Code: + +(require 'org) + +(declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) + +(defgroup org-refile nil + "Options concerning refiling entries in Org mode." + :tag "Org Refile" + :group 'org) + +(defcustom org-log-refile nil + "Information to record when a task is refiled. + +Possible values are: + +nil Don't add anything +time Add a time stamp to the task +note Prompt for a note and add it with template `org-log-note-headings' + +This option can also be set with on a per-file-basis with + + #+STARTUP: nologrefile + #+STARTUP: logrefile + #+STARTUP: lognoterefile + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords. + +When bulk-refiling, e.g., from the agenda, the value `note' is +forbidden and will temporarily be changed to `time'." + :group 'org-refile + :group 'org-progress + :version "24.1" + :type '(choice + (const :tag "No logging" nil) + (const :tag "Record timestamp" time) + (const :tag "Record timestamp with note." note))) + +(defcustom org-refile-targets nil + "Targets for refiling entries with `\\[org-refile]'. +This is a list of cons cells. Each cell contains: +- a specification of the files to be considered, either a list of files, + or a symbol whose function or variable value will be used to retrieve + a file name or a list of file names. If you use `org-agenda-files' for + that, all agenda files will be scanned for targets. Nil means consider + headings in the current buffer. +- A specification of how to find candidate refile targets. This may be + any of: + - a cons cell (:tag . \"TAG\") to identify refile targets by a tag. + This tag has to be present in all target headlines, inheritance will + not be considered. + - a cons cell (:todo . \"KEYWORD\") to identify refile targets by + todo keyword. + - a cons cell (:regexp . \"REGEXP\") with a regular expression matching + headlines that are refiling targets. + - a cons cell (:level . N). Any headline of level N is considered a target. + Note that, when `org-odd-levels-only' is set, level corresponds to + order in hierarchy, not to the number of stars. + - a cons cell (:maxlevel . N). Any headline with level <= N is a target. + Note that, when `org-odd-levels-only' is set, level corresponds to + order in hierarchy, not to the number of stars. + +Each element of this list generates a set of possible targets. +The union of these sets is presented (with completion) to +the user by `org-refile'. + +You can set the variable `org-refile-target-verify-function' to a function +to verify each headline found by the simple criteria above. + +When this variable is nil, all top-level headlines in the current buffer +are used, equivalent to the value `((nil . (:level . 1))'." + :group 'org-refile + :type '(repeat + (cons + (choice :value org-agenda-files + (const :tag "All agenda files" org-agenda-files) + (const :tag "Current buffer" nil) + (function) (variable) (file)) + (choice :tag "Identify target headline by" + (cons :tag "Specific tag" (const :value :tag) (string)) + (cons :tag "TODO keyword" (const :value :todo) (string)) + (cons :tag "Regular expression" (const :value :regexp) (regexp)) + (cons :tag "Level number" (const :value :level) (integer)) + (cons :tag "Max Level number" (const :value :maxlevel) (integer)))))) + +(defcustom org-refile-target-verify-function nil + "Function to verify if the headline at point should be a refile target. +The function will be called without arguments, with point at the +beginning of the headline. It should return t and leave point +where it is if the headline is a valid target for refiling. + +If the target should not be selected, the function must return nil. +In addition to this, it may move point to a place from where the search +should be continued. For example, the function may decide that the entire +subtree of the current entry should be excluded and move point to the end +of the subtree." + :group 'org-refile + :type '(choice + (const nil) + (function))) + +(defcustom org-refile-use-cache nil + "Non-nil means cache refile targets to speed up the process. +\\<org-mode-map>\ +The cache for a particular file will be updated automatically when +the buffer has been killed, or when any of the marker used for flagging +refile targets no longer points at a live buffer. +If you have added new entries to a buffer that might themselves be targets, +you need to clear the cache manually by pressing `C-0 \\[org-refile]' or, +if you find that easier, \ +`\\[universal-argument] \\[universal-argument] \\[universal-argument] \ +\\[org-refile]'." + :group 'org-refile + :version "24.1" + :type 'boolean) + +(defcustom org-refile-use-outline-path nil + "Non-nil means provide refile targets as paths. +So a level 3 headline will be available as level1/level2/level3. + +When the value is `file', also include the file name (without directory) +into the path. In this case, you can also stop the completion after +the file name, to get entries inserted as top level in the file. + +When `full-file-path', include the full file path. + +When `buffer-name', use the buffer name." + :group 'org-refile + :type '(choice + (const :tag "Not" nil) + (const :tag "Yes" t) + (const :tag "Start with file name" file) + (const :tag "Start with full file path" full-file-path) + (const :tag "Start with buffer name" buffer-name))) + +(defcustom org-outline-path-complete-in-steps t + "Non-nil means complete the outline path in hierarchical steps. +When Org uses the refile interface to select an outline path (see +`org-refile-use-outline-path'), the completion of the path can be +done in a single go, or it can be done in steps down the headline +hierarchy. Going in steps is probably the best if you do not use +a special completion package like `ido' or `icicles'. However, +when using these packages, going in one step can be very fast, +while still showing the whole path to the entry." + :group 'org-refile + :type 'boolean) + +(defcustom org-refile-allow-creating-parent-nodes nil + "Non-nil means allow the creation of new nodes as refile targets. +New nodes are then created by adding \"/new node name\" to the completion +of an existing node. When the value of this variable is `confirm', +new node creation must be confirmed by the user (recommended). +When nil, the completion must match an existing entry. + +Note that, if the new heading is not seen by the criteria +listed in `org-refile-targets', multiple instances of the same +heading would be created by trying again to file under the new +heading." + :group 'org-refile + :type '(choice + (const :tag "Never" nil) + (const :tag "Always" t) + (const :tag "Prompt for confirmation" confirm))) + +(defcustom org-refile-active-region-within-subtree nil + "Non-nil means also refile active region within a subtree. + +By default `org-refile' doesn't allow refiling regions if they +don't contain a set of subtrees, but it might be convenient to +do so sometimes: in that case, the first line of the region is +converted to a headline before refiling." + :group 'org-refile + :version "24.1" + :type 'boolean) + +(defvar org-refile-target-table nil + "The list of refile targets, created by `org-refile'.") + +(defvar org-refile-cache nil + "Cache for refile targets.") + +(defvar org-refile-markers nil + "All the markers used for caching refile locations.") + +;; Add org refile commands to the main org menu +(mapc (lambda (i) (easy-menu-add-item + org-org-menu + '("Edit Structure") i)) + '(["Refile Subtree" org-refile (org-in-subtree-not-table-p)] + ["Refile and copy Subtree" org-refile-copy (org-in-subtree-not-table-p)])) + +(defun org-refile-marker (pos) + "Get a new refile marker, but only if caching is in use." + (if (not org-refile-use-cache) + pos + (let ((m (make-marker))) + (move-marker m pos) + (push m org-refile-markers) + m))) + +(defun org-refile-cache-clear () + "Clear the refile cache and disable all the markers." + (dolist (m org-refile-markers) (move-marker m nil)) + (setq org-refile-markers nil) + (setq org-refile-cache nil) + (message "Refile cache has been cleared")) + +(defun org-refile-cache-check-set (set) + "Check if all the markers in the cache still have live buffers." + (let (marker) + (catch 'exit + (while (and set (setq marker (nth 3 (pop set)))) + ;; If `org-refile-use-outline-path' is 'file, marker may be nil + (when (and marker (null (marker-buffer marker))) + (message "Please regenerate the refile cache with `C-0 C-c C-w'") + (sit-for 3) + (throw 'exit nil))) + t))) + +(defun org-refile-cache-put (set &rest identifiers) + "Push the refile targets SET into the cache, under IDENTIFIERS." + (let* ((key (sha1 (prin1-to-string identifiers))) + (entry (assoc key org-refile-cache))) + (if entry + (setcdr entry set) + (push (cons key set) org-refile-cache)))) + +(defun org-refile-cache-get (&rest identifiers) + "Retrieve the cached value for refile targets given by IDENTIFIERS." + (cond + ((not org-refile-cache) nil) + ((not org-refile-use-cache) (org-refile-cache-clear) nil) + (t + (let ((set (cdr (assoc (sha1 (prin1-to-string identifiers)) + org-refile-cache)))) + (and set (org-refile-cache-check-set set) set))))) + +(defun org-refile-get-targets (&optional default-buffer) + "Produce a table with refile targets." + (let ((case-fold-search nil) + ;; otherwise org confuses "TODO" as a kw and "Todo" as a word + (entries (or org-refile-targets '((nil . (:level . 1))))) + targets tgs files desc descre) + (message "Getting targets...") + (with-current-buffer (or default-buffer (current-buffer)) + (dolist (entry entries) + (setq files (car entry) desc (cdr entry)) + (cond + ((null files) (setq files (list (current-buffer)))) + ((eq files 'org-agenda-files) + (setq files (org-agenda-files 'unrestricted))) + ((and (symbolp files) (fboundp files)) + (setq files (funcall files))) + ((and (symbolp files) (boundp files)) + (setq files (symbol-value files)))) + (when (stringp files) (setq files (list files))) + (cond + ((eq (car desc) :tag) + (setq descre (concat "^\\*+[ \t]+.*?:" (regexp-quote (cdr desc)) ":"))) + ((eq (car desc) :todo) + (setq descre (concat "^\\*+[ \t]+" (regexp-quote (cdr desc)) "[ \t]"))) + ((eq (car desc) :regexp) + (setq descre (cdr desc))) + ((eq (car desc) :level) + (setq descre (concat "^\\*\\{" (number-to-string + (if org-odd-levels-only + (1- (* 2 (cdr desc))) + (cdr desc))) + "\\}[ \t]"))) + ((eq (car desc) :maxlevel) + (setq descre (concat "^\\*\\{1," (number-to-string + (if org-odd-levels-only + (1- (* 2 (cdr desc))) + (cdr desc))) + "\\}[ \t]"))) + (t (error "Bad refiling target description %s" desc))) + (dolist (f files) + (with-current-buffer (if (bufferp f) f (org-get-agenda-file-buffer f)) + (or + (setq tgs (org-refile-cache-get (buffer-file-name) descre)) + (progn + (when (bufferp f) + (setq f (buffer-file-name (buffer-base-buffer f)))) + (setq f (and f (expand-file-name f))) + (when (eq org-refile-use-outline-path 'file) + (push (list (and f (file-name-nondirectory f)) f nil nil) tgs)) + (when (eq org-refile-use-outline-path 'buffer-name) + (push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs)) + (when (eq org-refile-use-outline-path 'full-file-path) + (push (list (and (buffer-file-name (buffer-base-buffer)) + (file-truename (buffer-file-name (buffer-base-buffer)))) + f nil nil) tgs)) + (org-with-wide-buffer + (goto-char (point-min)) + (setq org-outline-path-cache nil) + (while (re-search-forward descre nil t) + (beginning-of-line) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp)) + (let ((begin (point)) + (heading (match-string-no-properties 4))) + (unless (or (and + org-refile-target-verify-function + (not + (funcall org-refile-target-verify-function))) + (not heading)) + (let ((re (format org-complex-heading-regexp-format + (regexp-quote heading))) + (target + (if (not org-refile-use-outline-path) heading + (mapconcat + #'identity + (append + (pcase org-refile-use-outline-path + (`file (list + (and (buffer-file-name (buffer-base-buffer)) + (file-name-nondirectory + (buffer-file-name (buffer-base-buffer)))))) + (`full-file-path + (list (buffer-file-name + (buffer-base-buffer)))) + (`buffer-name + (list (buffer-name + (buffer-base-buffer)))) + (_ nil)) + (mapcar (lambda (s) (replace-regexp-in-string + "/" "\\/" s nil t)) + (org-get-outline-path t t))) + "/")))) + (push (list target f re (org-refile-marker (point))) + tgs))) + (when (= (point) begin) + ;; Verification function has not moved point. + (end-of-line))))))) + (when org-refile-use-cache + (org-refile-cache-put tgs (buffer-file-name) descre)) + (setq targets (append tgs targets)))))) + (message "Getting targets...done") + (delete-dups (nreverse targets)))) + +(defvar org-refile-history nil + "History for refiling operations.") + +(defvar org-after-refile-insert-hook nil + "Hook run after `org-refile' has inserted its stuff at the new location. +Note that this is still *before* the stuff will be removed from +the *old* location.") + +(defvar org-refile-keep nil + "Non-nil means `org-refile' will copy instead of refile.") + +;;;###autoload +(defun org-refile-copy () + "Like `org-refile', but preserve the refiled subtree." + (interactive) + (let ((org-refile-keep t)) + (org-refile nil nil nil "Copy"))) + +;;;###autoload +(defun org-refile-reverse (&optional arg default-buffer rfloc msg) + "Refile while temporarily toggling `org-reverse-note-order'. +So if `org-refile' would append the entry as the last entry under +the target heading, `org-refile-reverse' will prepend it as the +first entry, and vice-versa." + (interactive "P") + (let ((org-reverse-note-order (not (org-notes-order-reversed-p)))) + (org-refile arg default-buffer rfloc msg))) + +(defvar org-capture-last-stored-marker) + + +;;;###autoload +(defun org-refile (&optional arg default-buffer rfloc msg) + "Move the entry or entries at point to another heading. + +The list of target headings is compiled using the information in +`org-refile-targets', which see. + +At the target location, the entry is filed as a subitem of the +target heading. Depending on `org-reverse-note-order', the new +subitem will either be the first or the last subitem. + +If there is an active region, all entries in that region will be +refiled. However, the region must fulfill the requirement that +the first heading sets the top-level of the moved text. + +With a `\\[universal-argument]' ARG, the command will only visit the target \ +location +and not actually move anything. + +With a prefix `\\[universal-argument] \\[universal-argument]', go to the \ +location where the last +refiling operation has put the subtree. + +With a numeric prefix argument of `2', refile to the running clock. + +With a numeric prefix argument of `3', emulate `org-refile-keep' +being set to t and copy to the target location, don't move it. +Beware that keeping refiled entries may result in duplicated ID +properties. + +RFLOC can be a refile location obtained in a different way. It +should be a list with the following 4 elements: + +1. Name - an identifier for the refile location, typically the +headline text +2. File - the file the refile location is in +3. nil - used for generating refile location candidates, not +needed when passing RFLOC +4. Position - the position in the specified file of the +headline to refile under + +MSG is a string to replace \"Refile\" in the default prompt with +another verb. E.g. `org-refile-copy' sets this parameter to \"Copy\". + +See also `org-refile-use-outline-path'. + +If you are using target caching (see `org-refile-use-cache'), you +have to clear the target cache in order to find new targets. +This can be done with a `0' prefix (`C-0 C-c C-w') or a triple +prefix argument (`C-u C-u C-u C-c C-w')." + (interactive "P") + (if (member arg '(0 (64))) + (org-refile-cache-clear) + (let* ((actionmsg (cond (msg msg) + ((equal arg 3) "Refile (and keep)") + (t "Refile"))) + (regionp (org-region-active-p)) + (region-start (and regionp (region-beginning))) + (region-end (and regionp (region-end))) + (org-refile-keep (if (equal arg 3) t org-refile-keep)) + pos it nbuf file level reversed) + (setq last-command nil) + (when regionp + (goto-char region-start) + (beginning-of-line) + (setq region-start (point)) + (unless (or (org-kill-is-subtree-p + (buffer-substring region-start region-end)) + (prog1 org-refile-active-region-within-subtree + (let ((s (point-at-eol))) + (org-toggle-heading) + (setq region-end (+ (- (point-at-eol) s) region-end))))) + (user-error "The region is not a (sequence of) subtree(s)"))) + (if (equal arg '(16)) + (org-refile-goto-last-stored) + (when (or + (and (equal arg 2) + org-clock-hd-marker (marker-buffer org-clock-hd-marker) + (prog1 + (setq it (list (or org-clock-heading "running clock") + (buffer-file-name + (marker-buffer org-clock-hd-marker)) + "" + (marker-position org-clock-hd-marker))) + (setq arg nil))) + (setq it + (or rfloc + (let (heading-text) + (save-excursion + (unless (and arg (listp arg)) + (org-back-to-heading t) + (setq heading-text + (replace-regexp-in-string + org-link-bracket-re + "\\2" + (or (nth 4 (org-heading-components)) + "")))) + (org-refile-get-location + (cond ((and arg (listp arg)) "Goto") + (regionp (concat actionmsg " region to")) + (t (concat actionmsg " subtree \"" + heading-text "\" to"))) + default-buffer + (and (not (equal '(4) arg)) + org-refile-allow-creating-parent-nodes))))))) + (setq file (nth 1 it) + pos (nth 3 it)) + (when (and (not arg) + pos + (equal (buffer-file-name) file) + (if regionp + (and (>= pos region-start) + (<= pos region-end)) + (and (>= pos (point)) + (< pos (save-excursion + (org-end-of-subtree t t)))))) + (error "Cannot refile to position inside the tree or region")) + (setq nbuf (or (find-buffer-visiting file) + (find-file-noselect file))) + (if (and arg (not (equal arg 3))) + (progn + (pop-to-buffer-same-window nbuf) + (goto-char (cond (pos) + ((org-notes-order-reversed-p) (point-min)) + (t (point-max)))) + (org-show-context 'org-goto)) + (if regionp + (progn + (org-kill-new (buffer-substring region-start region-end)) + (org-save-markers-in-region region-start region-end)) + (org-copy-subtree 1 nil t)) + (with-current-buffer (setq nbuf (or (find-buffer-visiting file) + (find-file-noselect file))) + (setq reversed (org-notes-order-reversed-p)) + (org-with-wide-buffer + (if pos + (progn + (goto-char pos) + (setq level (org-get-valid-level (funcall outline-level) 1)) + (goto-char + (if reversed + (or (outline-next-heading) (point-max)) + (or (save-excursion (org-get-next-sibling)) + (org-end-of-subtree t t) + (point-max))))) + (setq level 1) + (if (not reversed) + (goto-char (point-max)) + (goto-char (point-min)) + (or (outline-next-heading) (goto-char (point-max))))) + (unless (bolp) (newline)) + (org-paste-subtree level nil nil t) + ;; Record information, according to `org-log-refile'. + ;; Do not prompt for a note when refiling multiple + ;; headlines, however. Simply add a time stamp. + (cond + ((not org-log-refile)) + (regionp + (org-map-region + (lambda () (org-add-log-setup 'refile nil nil 'time)) + (point) + (+ (point) (- region-end region-start)))) + (t + (org-add-log-setup 'refile nil nil org-log-refile))) + (and org-auto-align-tags + (let ((org-loop-over-headlines-in-active-region nil)) + (org-align-tags))) + (let ((bookmark-name (plist-get org-bookmark-names-plist + :last-refile))) + (when bookmark-name + (with-demoted-errors + (bookmark-set bookmark-name)))) + ;; If we are refiling for capture, make sure that the + ;; last-capture pointers point here + (when (bound-and-true-p org-capture-is-refiling) + (let ((bookmark-name (plist-get org-bookmark-names-plist + :last-capture-marker))) + (when bookmark-name + (with-demoted-errors + (bookmark-set bookmark-name)))) + (move-marker org-capture-last-stored-marker (point))) + (when (fboundp 'deactivate-mark) (deactivate-mark)) + (run-hooks 'org-after-refile-insert-hook))) + (unless org-refile-keep + (if regionp + (delete-region (point) (+ (point) (- region-end region-start))) + (org-preserve-local-variables + (delete-region + (and (org-back-to-heading t) (point)) + (min (1+ (buffer-size)) (org-end-of-subtree t t) (point)))))) + (when (featurep 'org-inlinetask) + (org-inlinetask-remove-END-maybe)) + (setq org-markers-to-move nil) + (message "%s to \"%s\" in file %s: done" actionmsg + (car it) file))))))) + +(defun org-refile-goto-last-stored () + "Go to the location where the last refile was stored." + (interactive) + (bookmark-jump (plist-get org-bookmark-names-plist :last-refile)) + (message "This is the location of the last refile")) + +(defun org-refile--get-location (refloc tbl) + "When user refile to REFLOC, find the associated target in TBL. +Also check `org-refile-target-table'." + (car (delq + nil + (mapcar + (lambda (r) (or (assoc r tbl) + (assoc r org-refile-target-table))) + (list (replace-regexp-in-string "/$" "" refloc) + (replace-regexp-in-string "\\([^/]\\)$" "\\1/" refloc)))))) + +(defun org-refile-get-location (&optional prompt default-buffer new-nodes) + "Prompt the user for a refile location, using PROMPT. +PROMPT should not be suffixed with a colon and a space, because +this function appends the default value from +`org-refile-history' automatically, if that is not empty." + (let ((org-refile-targets org-refile-targets) + (org-refile-use-outline-path org-refile-use-outline-path)) + (setq org-refile-target-table (org-refile-get-targets default-buffer))) + (unless org-refile-target-table + (user-error "No refile targets")) + (let* ((cbuf (current-buffer)) + (cfn (buffer-file-name (buffer-base-buffer cbuf))) + (cfunc (if (and org-refile-use-outline-path + org-outline-path-complete-in-steps) + #'org-olpath-completing-read + #'completing-read)) + (extra (if org-refile-use-outline-path "/" "")) + (cbnex (concat (buffer-name) extra)) + (filename (and cfn (expand-file-name cfn))) + (tbl (mapcar + (lambda (x) + (if (and (not (member org-refile-use-outline-path + '(file full-file-path))) + (not (equal filename (nth 1 x)))) + (cons (concat (car x) extra " (" + (file-name-nondirectory (nth 1 x)) ")") + (cdr x)) + (cons (concat (car x) extra) (cdr x)))) + org-refile-target-table)) + (completion-ignore-case t) + cdef + (prompt (concat prompt + (or (and (car org-refile-history) + (concat " (default " (car org-refile-history) ")")) + (and (assoc cbnex tbl) (setq cdef cbnex) + (concat " (default " cbnex ")"))) ": ")) + pa answ parent-target child parent old-hist) + (setq old-hist org-refile-history) + (setq answ (funcall cfunc prompt tbl nil (not new-nodes) + nil 'org-refile-history + (or cdef (car org-refile-history)))) + (if (setq pa (org-refile--get-location answ tbl)) + (let ((last-refile-loc (car org-refile-history))) + (org-refile-check-position pa) + (when (or (not org-refile-history) + (not (eq old-hist org-refile-history)) + (not (equal (car pa) last-refile-loc))) + (setq org-refile-history + (cons (car pa) (if (assoc last-refile-loc tbl) + org-refile-history + (cdr org-refile-history)))) + (when (equal last-refile-loc (nth 1 org-refile-history)) + (pop org-refile-history))) + pa) + (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ) + (progn + (setq parent (match-string 1 answ) + child (match-string 2 answ)) + (setq parent-target (org-refile--get-location parent tbl)) + (when (and parent-target + (or (eq new-nodes t) + (and (eq new-nodes 'confirm) + (y-or-n-p (format "Create new node \"%s\"? " + child))))) + (org-refile-new-child parent-target child))) + (user-error "Invalid target location"))))) + +(defun org-refile-check-position (refile-pointer) + "Check if the refile pointer matches the headline to which it points." + (let* ((file (nth 1 refile-pointer)) + (re (nth 2 refile-pointer)) + (pos (nth 3 refile-pointer)) + buffer) + (if (and (not (markerp pos)) (not file)) + (user-error "Please indicate a target file in the refile path") + (when (org-string-nw-p re) + (setq buffer (if (markerp pos) + (marker-buffer pos) + (or (find-buffer-visiting file) + (find-file-noselect file)))) + (with-current-buffer buffer + (org-with-wide-buffer + (goto-char pos) + (beginning-of-line 1) + (unless (looking-at-p re) + (user-error "Invalid refile position, please clear the cache with `C-0 C-c C-w' before refiling")))))))) + +(defun org-refile-new-child (parent-target child) + "Use refile target PARENT-TARGET to add new CHILD below it." + (unless parent-target + (error "Cannot find parent for new node")) + (let ((file (nth 1 parent-target)) + (pos (nth 3 parent-target)) + level) + (with-current-buffer (or (find-buffer-visiting file) + (find-file-noselect file)) + (org-with-wide-buffer + (if pos + (goto-char pos) + (goto-char (point-max)) + (unless (bolp) (newline))) + (when (looking-at org-outline-regexp) + (setq level (funcall outline-level)) + (org-end-of-subtree t t)) + (org-back-over-empty-lines) + (insert "\n" (make-string + (if pos (org-get-valid-level level 1) 1) ?*) + " " child "\n") + (beginning-of-line 0) + (list (concat (car parent-target) "/" child) file "" (point)))))) + +(defun org-olpath-completing-read (prompt collection &rest args) + "Read an outline path like a file name." + (let ((thetable collection)) + (apply #'completing-read + prompt + (lambda (string predicate &optional flag) + (cond + ((eq flag nil) (try-completion string thetable)) + ((eq flag t) + (let ((l (length string))) + (mapcar (lambda (x) + (let ((r (substring x l)) + (f (if (string-match " ([^)]*)$" x) + (match-string 0 x) + ""))) + (if (string-match "/" r) + (concat string (substring r 0 (match-end 0)) f) + x))) + (all-completions string thetable predicate)))) + ;; Exact match? + ((eq flag 'lambda) (assoc string thetable)))) + args))) + +(provide 'org-refile) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-refile.el ends here diff --git a/elpa/org-9.5.2/org-refile.elc b/elpa/org-9.5.2/org-refile.elc new file mode 100644 index 0000000..df7fc03 Binary files /dev/null and b/elpa/org-9.5.2/org-refile.elc differ diff --git a/elpa/org-9.5.2/org-src.el b/elpa/org-9.5.2/org-src.el new file mode 100644 index 0000000..8d02cf4 --- /dev/null +++ b/elpa/org-9.5.2/org-src.el @@ -0,0 +1,1311 @@ +;;; org-src.el --- Source code examples in Org -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. +;; +;; 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 +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the code dealing with source code examples in +;; Org mode. + +;;; Code: + +(require 'cl-lib) +(require 'ob-comint) +(require 'org-macs) +(require 'org-compat) +(require 'org-keys) + +(declare-function org-mode "org" ()) +(declare-function org--get-expected-indentation "org" (element contentsp)) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-class "org-element" (datum &optional parent)) +(declare-function org-element-context "org-element" (&optional element)) +(declare-function org-element-lineage "org-element" + (blob &optional types with-self)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-footnote-goto-definition "org-footnote" + (label &optional location)) + +(defvar org-inhibit-startup) + +(defcustom org-edit-src-turn-on-auto-save nil + "Non-nil means turn `auto-save-mode' on when editing a source block. +This will save the content of the source code editing buffer into +a newly created file, not the base buffer for this source block. + +If you want to regularly save the base buffer instead of the source +code editing buffer, see `org-edit-src-auto-save-idle-delay' instead." + :group 'org-edit-structure + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-edit-src-auto-save-idle-delay 0 + "Delay before saving a source code buffer back into its base buffer. +When a positive integer N, save after N seconds of idle time. +When 0 (the default), don't auto-save. + +If you want to save the source code buffer itself, don't use this. +Check `org-edit-src-turn-on-auto-save' instead." + :group 'org-edit-structure + :version "24.4" + :package-version '(Org . "8.0") + :type 'integer) + +(defcustom org-coderef-label-format "(ref:%s)" + "The default coderef format. +This format string will be used to search for coderef labels in literal +examples (EXAMPLE and SRC blocks). The format can be overwritten in +an individual literal example with the -l option, like + +#+BEGIN_SRC pascal +n -r -l \"((%s))\" +... +#+END_SRC + +If you want to use this for HTML export, make sure that the format does +not introduce special font-locking, and avoid the HTML special +characters `<', `>', and `&'. The reason for this restriction is that +the labels are searched for only after htmlize has done its job." + :group 'org-edit-structure ; FIXME this is not in the right group + :type 'string) + +(defcustom org-edit-fixed-width-region-mode 'artist-mode + "The mode that should be used to edit fixed-width regions. +These are the regions where each line starts with a colon." + :group 'org-edit-structure + :type '(choice + (const artist-mode) + (const picture-mode) + (const fundamental-mode) + (function :tag "Other (specify)"))) + +(defcustom org-src-preserve-indentation nil + "If non-nil preserve leading whitespace characters on export. +\\<org-mode-map> +If non-nil leading whitespace characters in source code blocks +are preserved on export, and when switching between the org +buffer and the language mode edit buffer. + +When this variable is nil, after editing with `\\[org-edit-src-code]', +the minimum (across-lines) number of leading whitespace characters +are removed from all lines, and the code block is uniformly indented +according to the value of `org-edit-src-content-indentation'." + :group 'org-edit-structure + :type 'boolean) + +(defcustom org-edit-src-content-indentation 2 + "Indentation for the content of a source code block. + +This should be the number of spaces added to the indentation of the #+begin +line in order to compute the indentation of the block content after +editing it with `\\[org-edit-src-code]'. + +It has no effect if `org-src-preserve-indentation' is non-nil." + :group 'org-edit-structure + :type 'integer + :safe #'wholenump) + +(defcustom org-edit-src-persistent-message t + "Non-nil means show persistent exit help message while editing src examples. +The message is shown in the header-line, which will be created in the +first line of the window showing the editing buffer." + :group 'org-edit-structure + :type 'boolean) + +(defcustom org-src-ask-before-returning-to-edit-buffer t + "Non-nil means ask before switching to an existing edit buffer. +If nil, when `org-edit-src-code' is used on a block that already +has an active edit buffer, it will switch to that edit buffer +immediately; otherwise it will ask whether you want to return to +the existing edit buffer." + :group 'org-edit-structure + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-src-window-setup 'reorganize-frame + "How the source code edit buffer should be displayed. +Possible values for this option are: + +plain Show edit buffer using `display-buffer'. Users can + further control the display behavior by modifying + `display-buffer-alist' and its relatives. +current-window Show edit buffer in the current window, keeping all other + windows. +split-window-below Show edit buffer below the current window, keeping all + other windows. +split-window-right Show edit buffer to the right of the current window, + keeping all other windows. +other-window Use `switch-to-buffer-other-window' to display edit buffer. +reorganize-frame Show only two windows on the current frame, the current + window and the edit buffer. +other-frame Use `switch-to-buffer-other-frame' to display edit buffer. + Also, when exiting the edit buffer, kill that frame. + +Values that modify the window layout (reorganize-frame, split-window-below, +split-window-right) will restore the layout after exiting the edit buffer." + :group 'org-edit-structure + :type '(choice + (const current-window) + (const split-window-below) + (const split-window-right) + (const other-frame) + (const other-window) + (const reorganize-frame))) + +(defvar org-src-mode-hook nil + "Hook run after Org switched a source code snippet to its Emacs mode. +\\<org-mode-map> +This hook will run: +- when editing a source code snippet with `\\[org-edit-special]' +- when formatting a source code snippet for export with htmlize. + +You may want to use this hook for example to turn off `outline-minor-mode' +or similar things which you want to have when editing a source code file, +but which mess up the display of a snippet in Org exported files.") + +(defcustom org-src-lang-modes + '(("C" . c) + ("C++" . c++) + ("asymptote" . asy) + ("bash" . sh) + ("beamer" . latex) + ("calc" . fundamental) + ("cpp" . c++) + ("ditaa" . artist) + ("dot" . fundamental) + ("elisp" . emacs-lisp) + ("ocaml" . tuareg) + ("screen" . shell-script) + ("shell" . sh) + ("sqlite" . sql)) + "Alist mapping languages to their major mode. + +The key is the language name. The value is the mode name, as +a string or a symbol, without the \"-mode\" suffix. + +For many languages this is simple, but for language where this is +not the case, this variable provides a way to simplify things on +the user side. For example, there is no `ocaml-mode' in Emacs, +but the mode to use is `tuareg-mode'." + :group 'org-edit-structure + :type '(repeat + (cons + (string "Language name") + (symbol "Major mode")))) + +(defcustom org-src-block-faces nil + "Alist of faces to be used for source-block. +Each element is a cell of the format + + (\"language\" FACE) + +Where FACE is either a defined face or an anonymous face. + +For instance, the following value would color the background of +emacs-lisp source blocks and python source blocks in purple and +green, respectability. + + \\='((\"emacs-lisp\" (:background \"#EEE2FF\")) + (\"python\" (:background \"#e5ffb8\")))" + :group 'org-edit-structure + :type '(repeat (list (string :tag "language") + (choice + (face :tag "Face") + (sexp :tag "Anonymous face")))) + :version "26.1" + :package-version '(Org . "9.0")) + +(defcustom org-src-tab-acts-natively t + "If non-nil, the effect of TAB in a code block is as if it were +issued in the language major mode buffer." + :type 'boolean + :package-version '(Org . "9.4") + :group 'org-babel) + + + +;;; Internal functions and variables + +(defvar org-src--auto-save-timer nil + "Idle Timer auto-saving remote editing buffers.") + +(defvar-local org-src--allow-write-back t) +(put 'org-src--allow-write-back 'permanent-local t) + +(defvar-local org-src--babel-info nil) +(put 'org-src--babel-info 'permanent-local t) + +(defvar-local org-src--beg-marker nil) +(put 'org-src--beg-marker 'permanent-local t) + +(defvar-local org-src--block-indentation nil) +(put 'org-src--block-indentation 'permanent-local t) + +(defvar-local org-src--content-indentation nil) +(put 'org-src--content-indentation 'permanent-local t) + +(defvar-local org-src--end-marker nil) +(put 'org-src--end-marker 'permanent-local t) + +(defvar-local org-src--from-org-mode nil) +(put 'org-src--from-org-mode 'permanent-local t) + +(defvar-local org-src--overlay nil) +(put 'org-src--overlay 'permanent-local t) + +(defvar-local org-src--preserve-indentation nil) +(put 'org-src--preserve-indentation 'permanent-local t) + +(defvar-local org-src--remote nil) +(put 'org-src--remote 'permanent-local t) + +(defvar-local org-src--saved-temp-window-config nil) +(put 'org-src--saved-temp-window-config 'permanent-local t) + +(defvar-local org-src--source-type nil + "Type of element being edited, as a symbol.") +(put 'org-src--source-type 'permanent-local t) + +(defvar-local org-src--tab-width nil + "Contains `tab-width' value from Org source buffer. +However, if `indent-tabs-mode' is nil in that buffer, its value +is 0.") +(put 'org-src--tab-width 'permanent-local t) + +(defvar-local org-src-source-file-name nil + "File name associated to Org source buffer, or nil.") +(put 'org-src-source-file-name 'permanent-local t) + +(defvar-local org-src--preserve-blank-line nil) +(put 'org-src--preserve-blank-line 'permanent-local t) + +(defun org-src--construct-edit-buffer-name (org-buffer-name lang) + "Construct the buffer name for a source editing buffer." + (concat "*Org Src " org-buffer-name "[ " lang " ]*")) + +(defun org-src--edit-buffer (beg end) + "Return buffer editing area between BEG and END. +Return nil if there is no such buffer." + (catch 'exit + (dolist (b (buffer-list)) + (with-current-buffer b + (and (org-src-edit-buffer-p) + (= beg org-src--beg-marker) + (eq (marker-buffer beg) (marker-buffer org-src--beg-marker)) + (= end org-src--end-marker) + (eq (marker-buffer end) (marker-buffer org-src--end-marker)) + (throw 'exit b)))))) + +(defun org-src--coordinates (pos beg end) + "Return coordinates of POS relatively to BEG and END. +POS, BEG and END are buffer positions. Return value is either +a cons cell (LINE . COLUMN) or symbol `end'. See also +`org-src--goto-coordinates'." + (if (>= pos end) 'end + (org-with-wide-buffer + (goto-char (max beg pos)) + (cons (count-lines (save-excursion (goto-char beg) (line-beginning-position)) + (line-beginning-position)) + ;; Column is relative to the end of line to avoid problems of + ;; comma escaping or colons appended in front of the line. + (- (point) (min end (line-end-position))))))) + +(defun org-src--goto-coordinates (coord beg end) + "Move to coordinates COORD relatively to BEG and END. +COORD are coordinates, as returned by `org-src--coordinates', +which see. BEG and END are buffer positions." + (goto-char + (if (eq coord 'end) (max (1- end) beg) + ;; If BEG happens to be located outside of the narrowed part of + ;; the buffer, widen it first. + (org-with-wide-buffer + (goto-char beg) + (forward-line (car coord)) + (max (point) + (+ (min end (line-end-position)) + (cdr coord))))))) + +(defun org-src--contents-area (datum) + "Return contents boundaries of DATUM. +DATUM is an element or object. Return a list (BEG END CONTENTS) +where BEG and END are buffer positions and CONTENTS is a string." + (let ((type (org-element-type datum))) + (org-with-wide-buffer + (cond + ((eq type 'footnote-definition) + (let* ((beg (progn + (goto-char (org-element-property :post-affiliated datum)) + (search-forward "]"))) + (end (or (org-element-property :contents-end datum) beg))) + (list beg end (buffer-substring-no-properties beg end)))) + ((eq type 'inline-src-block) + (let ((beg (progn (goto-char (org-element-property :begin datum)) + (search-forward "{" (line-end-position) t))) + (end (progn (goto-char (org-element-property :end datum)) + (search-backward "}" (line-beginning-position) t)))) + (list beg end (buffer-substring-no-properties beg end)))) + ((eq type 'latex-fragment) + (let ((beg (org-element-property :begin datum)) + (end (org-with-point-at (org-element-property :end datum) + (skip-chars-backward " \t") + (point)))) + (list beg end (buffer-substring-no-properties beg end)))) + ((org-element-property :contents-begin datum) + (let ((beg (org-element-property :contents-begin datum)) + (end (org-element-property :contents-end datum))) + (list beg end (buffer-substring-no-properties beg end)))) + ((memq type '(example-block export-block src-block)) + (list (progn (goto-char (org-element-property :post-affiliated datum)) + (line-beginning-position 2)) + (progn (goto-char (org-element-property :end datum)) + (skip-chars-backward " \r\t\n") + (line-beginning-position 1)) + (org-element-property :value datum))) + ((memq type '(fixed-width latex-environment table)) + (let ((beg (org-element-property :post-affiliated datum)) + (end (progn (goto-char (org-element-property :end datum)) + (skip-chars-backward " \r\t\n") + (line-beginning-position 2)))) + (list beg + end + (if (eq type 'fixed-width) (org-element-property :value datum) + (buffer-substring-no-properties beg end))))) + (t (error "Unsupported element or object: %s" type)))))) + +(defun org-src--make-source-overlay (beg end edit-buffer) + "Create overlay between BEG and END positions and return it. +EDIT-BUFFER is the buffer currently editing area between BEG and +END." + (let ((overlay (make-overlay beg end))) + (overlay-put overlay 'face 'secondary-selection) + (overlay-put overlay 'edit-buffer edit-buffer) + (overlay-put overlay 'help-echo + "Click with mouse-1 to switch to buffer editing this segment") + (overlay-put overlay 'face 'secondary-selection) + (overlay-put overlay 'keymap + (let ((map (make-sparse-keymap))) + (define-key map [mouse-1] 'org-edit-src-continue) + map)) + (let ((read-only + (list + (lambda (&rest _) + (user-error + "Cannot modify an area being edited in a dedicated buffer"))))) + (overlay-put overlay 'modification-hooks read-only) + (overlay-put overlay 'insert-in-front-hooks read-only) + (overlay-put overlay 'insert-behind-hooks read-only)) + overlay)) + +(defun org-src--remove-overlay () + "Remove overlay from current source buffer." + (when (overlayp org-src--overlay) (delete-overlay org-src--overlay))) + +(defun org-src--on-datum-p (datum) + "Non-nil when point is on DATUM. +DATUM is an element or an object. Consider blank lines or white +spaces after it as being outside." + (and (>= (point) (org-element-property :begin datum)) + (<= (point) + (org-with-wide-buffer + (goto-char (org-element-property :end datum)) + (skip-chars-backward " \r\t\n") + (if (eq (org-element-class datum) 'element) + (line-end-position) + (point)))))) + +(defun org-src--contents-for-write-back (write-back-buf) + "Populate WRITE-BACK-BUF with contents in the appropriate format. +Assume point is in the corresponding edit buffer." + (let ((indentation-offset + (if org-src--preserve-indentation 0 + (+ (or org-src--block-indentation 0) + (if (memq org-src--source-type '(example-block src-block)) + org-src--content-indentation + 0)))) + (use-tabs? (and (> org-src--tab-width 0) t)) + (preserve-fl (eq org-src--source-type 'latex-fragment)) + (source-tab-width org-src--tab-width) + (contents (org-with-wide-buffer + (let ((eol (line-end-position))) + (list (buffer-substring (point-min) eol) + (buffer-substring eol (point-max)))))) + (write-back org-src--allow-write-back) + (preserve-blank-line org-src--preserve-blank-line) + marker) + (with-current-buffer write-back-buf + ;; Reproduce indentation parameters from source buffer. + (setq indent-tabs-mode use-tabs?) + (when (> source-tab-width 0) (setq tab-width source-tab-width)) + ;; Apply WRITE-BACK function on edit buffer contents. + (insert (org-no-properties (car contents))) + (setq marker (point-marker)) + (insert (org-no-properties (car (cdr contents)))) + (goto-char (point-min)) + (when (functionp write-back) (save-excursion (funcall write-back))) + ;; Add INDENTATION-OFFSET to every line in buffer, + ;; unless indentation is meant to be preserved. + (when (> indentation-offset 0) + (when preserve-fl (forward-line)) + (while (not (eobp)) + (skip-chars-forward " \t") + (when (or (not (eolp)) ; not a blank line + (and (eq (point) (marker-position marker)) ; current line + preserve-blank-line)) + (let ((i (current-column))) + (delete-region (line-beginning-position) (point)) + (indent-to (+ i indentation-offset)))) + (forward-line))) + (set-marker marker nil)))) + +(defun org-src--edit-element + (datum name &optional initialize write-back contents remote) + "Edit DATUM contents in a dedicated buffer NAME. + +INITIALIZE is a function to call upon creating the buffer. + +When WRITE-BACK is non-nil, assume contents will replace original +region. Moreover, if it is a function, apply it in the edit +buffer, from point min, before returning the contents. + +When CONTENTS is non-nil, display them in the edit buffer. +Otherwise, show DATUM contents as specified by +`org-src--contents-area'. + +When REMOTE is non-nil, do not try to preserve point or mark when +moving from the edit area to the source. + +Leave point in edit buffer." + (when (memq org-src-window-setup '(reorganize-frame + split-window-below + split-window-right)) + (setq org-src--saved-temp-window-config (current-window-configuration))) + (let* ((area (org-src--contents-area datum)) + (beg (copy-marker (nth 0 area))) + (end (copy-marker (nth 1 area) t)) + (old-edit-buffer (org-src--edit-buffer beg end)) + (contents (or contents (nth 2 area)))) + (if (and old-edit-buffer + (or (not org-src-ask-before-returning-to-edit-buffer) + (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? "))) + ;; Move to existing buffer. + (org-src-switch-to-buffer old-edit-buffer 'return) + ;; Discard old edit buffer. + (when old-edit-buffer + (with-current-buffer old-edit-buffer (org-src--remove-overlay)) + (kill-buffer old-edit-buffer)) + (let* ((org-mode-p (derived-mode-p 'org-mode)) + (source-file-name (buffer-file-name (buffer-base-buffer))) + (source-tab-width (if indent-tabs-mode tab-width 0)) + (type (org-element-type datum)) + (block-ind (org-with-point-at (org-element-property :begin datum) + (cond + ((save-excursion (skip-chars-backward " \t") (bolp)) + (current-indentation)) + ((org-element-property :parent datum) + (org--get-expected-indentation + (org-element-property :parent datum) nil)) + (t (current-indentation))))) + (content-ind org-edit-src-content-indentation) + (blank-line (save-excursion (beginning-of-line) + (looking-at-p "^[[:space:]]*$"))) + (empty-line (and blank-line (looking-at-p "^$"))) + (preserve-blank-line (or (and blank-line (not empty-line)) + (and empty-line (= (+ block-ind content-ind) 0)))) + (preserve-ind + (and (memq type '(example-block src-block)) + (or (org-element-property :preserve-indent datum) + org-src-preserve-indentation))) + ;; Store relative positions of mark (if any) and point + ;; within the edited area. + (point-coordinates (and (not remote) + (org-src--coordinates (point) beg end))) + (mark-coordinates (and (not remote) + (org-region-active-p) + (let ((m (mark))) + (and (>= m beg) (>= end m) + (org-src--coordinates m beg end))))) + ;; Generate a new edit buffer. + (buffer (generate-new-buffer name)) + ;; Add an overlay on top of source. + (overlay (org-src--make-source-overlay beg end buffer))) + ;; Switch to edit buffer. + (org-src-switch-to-buffer buffer 'edit) + ;; Insert contents. + (insert contents) + (remove-text-properties (point-min) (point-max) + '(display nil invisible nil intangible nil)) + (let ((lf (eq type 'latex-fragment))) + (unless preserve-ind (org-do-remove-indentation (and lf block-ind) lf))) + (set-buffer-modified-p nil) + (setq buffer-file-name nil) + ;; Initialize buffer. + (when (functionp initialize) + (let ((org-inhibit-startup t)) + (condition-case e + (funcall initialize) + (error (message "Initialization fails with: %S" + (error-message-string e)))))) + ;; Transmit buffer-local variables for exit function. It must + ;; be done after initializing major mode, as this operation + ;; may reset them otherwise. + (setq org-src--tab-width source-tab-width) + (setq org-src--from-org-mode org-mode-p) + (setq org-src--beg-marker beg) + (setq org-src--end-marker end) + (setq org-src--remote remote) + (setq org-src--source-type type) + (setq org-src--block-indentation block-ind) + (setq org-src--content-indentation content-ind) + (setq org-src--preserve-indentation preserve-ind) + (setq org-src--overlay overlay) + (setq org-src--allow-write-back write-back) + (setq org-src-source-file-name source-file-name) + (setq org-src--preserve-blank-line preserve-blank-line) + ;; Start minor mode. + (org-src-mode) + ;; Clear undo information so we cannot undo back to the + ;; initial empty buffer. + (buffer-disable-undo (current-buffer)) + (buffer-enable-undo) + ;; Move mark and point in edit buffer to the corresponding + ;; location. + (if remote + (progn + ;; Put point at first non read-only character after + ;; leading blank. + (goto-char + (or (text-property-any (point-min) (point-max) 'read-only nil) + (point-max))) + (skip-chars-forward " \r\t\n")) + ;; Set mark and point. + (when mark-coordinates + (org-src--goto-coordinates mark-coordinates (point-min) (point-max)) + (push-mark (point) 'no-message t) + (setq deactivate-mark nil)) + (org-src--goto-coordinates + point-coordinates (point-min) (point-max))))))) + + + +;;; Fontification of source blocks + +(defun org-src-font-lock-fontify-block (lang start end) + "Fontify code block. +This function is called by Emacs' automatic fontification, as long +as `org-src-fontify-natively' is non-nil." + (let ((lang-mode (org-src-get-lang-mode lang))) + (when (fboundp lang-mode) + (let ((string (buffer-substring-no-properties start end)) + (modified (buffer-modified-p)) + (org-buffer (current-buffer))) + (remove-text-properties start end '(face nil)) + (with-current-buffer + (get-buffer-create + (format " *org-src-fontification:%s*" lang-mode)) + (let ((inhibit-modification-hooks nil)) + (erase-buffer) + ;; Add string and a final space to ensure property change. + (insert string " ")) + (unless (eq major-mode lang-mode) (funcall lang-mode)) + (org-font-lock-ensure) + (let ((pos (point-min)) next) + (while (setq next (next-property-change pos)) + ;; Handle additional properties from font-lock, so as to + ;; preserve, e.g., composition. + (dolist (prop (cons 'face font-lock-extra-managed-props)) + (let ((new-prop (get-text-property pos prop))) + (put-text-property + (+ start (1- pos)) (1- (+ start next)) prop new-prop + org-buffer))) + (setq pos next)))) + ;; Add Org faces. + (let ((src-face (nth 1 (assoc-string lang org-src-block-faces t)))) + (when (or (facep src-face) (listp src-face)) + (font-lock-append-text-property start end 'face src-face)) + (font-lock-append-text-property start end 'face 'org-block)) + (add-text-properties + start end + '(font-lock-fontified t fontified t font-lock-multiline t)) + (set-buffer-modified-p modified))))) + + +;;; Escape contents + +(defun org-escape-code-in-region (beg end) + "Escape lines between BEG and END. +Escaping happens when a line starts with \"*\", \"#+\", \",*\" or +\",#+\" by appending a comma to it." + (interactive "r") + (save-excursion + (goto-char end) + (while (re-search-backward "^[ \t]*\\(,*\\(?:\\*\\|#\\+\\)\\)" beg t) + (save-excursion (replace-match ",\\1" nil nil nil 1))))) + +(defun org-escape-code-in-string (s) + "Escape lines in string S. +Escaping happens when a line starts with \"*\", \"#+\", \",*\" or +\",#+\" by appending a comma to it." + (replace-regexp-in-string "^[ \t]*\\(,*\\(?:\\*\\|#\\+\\)\\)" ",\\1" + s nil nil 1)) + +(defun org-unescape-code-in-region (beg end) + "Un-escape lines between BEG and END. +Un-escaping happens by removing the first comma on lines starting +with \",*\", \",#+\", \",,*\" and \",,#+\"." + (interactive "r") + (save-excursion + (goto-char end) + (while (re-search-backward "^[ \t]*,*\\(,\\)\\(?:\\*\\|#\\+\\)" beg t) + (save-excursion (replace-match "" nil nil nil 1))))) + +(defun org-unescape-code-in-string (s) + "Un-escape lines in string S. +Un-escaping happens by removing the first comma on lines starting +with \",*\", \",#+\", \",,*\" and \",,#+\"." + (replace-regexp-in-string + "^[ \t]*,*\\(,\\)\\(?:\\*\\|#\\+\\)" "" s nil nil 1)) + + + +;;; Org src minor mode + +(defvar org-src-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-c'" 'org-edit-src-exit) + (define-key map "\C-c\C-k" 'org-edit-src-abort) + (define-key map "\C-x\C-s" 'org-edit-src-save) + map)) + +(define-minor-mode org-src-mode + "Minor mode for language major mode buffers generated by Org. +\\<org-mode-map> +This minor mode is turned on in two situations: + - when editing a source code snippet with `\\[org-edit-special]' + - when formatting a source code snippet for export with htmlize. + +\\{org-src-mode-map} + +See also `org-src-mode-hook'." + :lighter " OrgSrc" + (when org-edit-src-persistent-message + (setq header-line-format + (substitute-command-keys + (if org-src--allow-write-back + "Edit, then exit with `\\[org-edit-src-exit]' or abort with \ +`\\[org-edit-src-abort]'" + "Exit with `\\[org-edit-src-exit]' or abort with \ +`\\[org-edit-src-abort]'")))) + ;; Possibly activate various auto-save features (for the edit buffer + ;; or the source buffer). + (when org-edit-src-turn-on-auto-save + (setq buffer-auto-save-file-name + (concat (make-temp-name "org-src-") + (format-time-string "-%Y-%d-%m") + ".txt"))) + (unless (or org-src--auto-save-timer + (= 0 org-edit-src-auto-save-idle-delay)) + (setq org-src--auto-save-timer + (run-with-idle-timer + org-edit-src-auto-save-idle-delay t + (lambda () + (save-excursion + (let (edit-flag) + (dolist (b (buffer-list)) + (with-current-buffer b + (when (org-src-edit-buffer-p) + (unless edit-flag (setq edit-flag t)) + (when (buffer-modified-p) (org-edit-src-save))))) + (unless edit-flag + (cancel-timer org-src--auto-save-timer) + (setq org-src--auto-save-timer nil))))))))) + +(defun org-src-mode-configure-edit-buffer () + "Configure the src edit buffer." + (when (bound-and-true-p org-src--from-org-mode) + (add-hook 'kill-buffer-hook #'org-src--remove-overlay nil 'local) + (if (bound-and-true-p org-src--allow-write-back) + (progn + (setq buffer-offer-save t) + (setq write-contents-functions '(org-edit-src-save))) + (setq buffer-read-only t)))) + +(add-hook 'org-src-mode-hook #'org-src-mode-configure-edit-buffer) + + + +;;; Babel related functions + +(defun org-src-associate-babel-session (info) + "Associate edit buffer with comint session." + (interactive) + (let ((session (cdr (assq :session (nth 2 info))))) + (and session (not (string= session "none")) + (org-babel-comint-buffer-livep session) + (let ((f (intern (format "org-babel-%s-associate-session" + (nth 0 info))))) + (and (fboundp f) (funcall f session)))))) + +(defun org-src-babel-configure-edit-buffer () + (when org-src--babel-info + (org-src-associate-babel-session org-src--babel-info))) + +(add-hook 'org-src-mode-hook #'org-src-babel-configure-edit-buffer) + + +;;; Public API + +(defmacro org-src-do-at-code-block (&rest body) + "Execute BODY from an edit buffer in the Org mode buffer." + (declare (debug (body))) + `(let ((beg-marker org-src--beg-marker)) + (when beg-marker + (with-current-buffer (marker-buffer beg-marker) + (goto-char beg-marker) + ,@body)))) + +(defun org-src-do-key-sequence-at-code-block (&optional key) + "Execute key sequence at code block in the source Org buffer. +The command bound to KEY in the Org-babel key map is executed +remotely with point temporarily at the start of the code block in +the Org buffer. + +This command is not bound to a key by default, to avoid conflicts +with language major mode bindings. To bind it to C-c @ in all +language major modes, you could use + + (add-hook \\='org-src-mode-hook + (lambda () (define-key org-src-mode-map \"\\C-c@\" + \\='org-src-do-key-sequence-at-code-block))) + +In that case, for example, C-c @ t issued in code edit buffers +would tangle the current Org code block, C-c @ e would execute +the block and C-c @ h would display the other available +Org-babel commands." + (interactive "kOrg-babel key: ") + (if (equal key (kbd "C-g")) (keyboard-quit) + (org-edit-src-save) + (org-src-do-at-code-block + (call-interactively (lookup-key org-babel-map key))))) + +(defun org-src-get-lang-mode (lang) + "Return major mode that should be used for LANG. +LANG is a string, and the returned major mode is a symbol." + (intern + (concat + (let ((l (or (cdr (assoc lang org-src-lang-modes)) lang))) + (if (symbolp l) (symbol-name l) l)) + "-mode"))) + +(defun org-src-edit-buffer-p (&optional buffer) + "Non-nil when current buffer is a source editing buffer. +If BUFFER is non-nil, test it instead." + (let ((buffer (org-base-buffer (or buffer (current-buffer))))) + (and (buffer-live-p buffer) + (local-variable-p 'org-src--beg-marker buffer) + (local-variable-p 'org-src--end-marker buffer)))) + +(defun org-src-source-buffer () + "Return source buffer edited in current buffer. +Raise an error when current buffer is not a source editing buffer." + (unless (org-src-edit-buffer-p) (error "Not in a source buffer")) + (or (marker-buffer org-src--beg-marker) + (error "No source buffer available for current editing session"))) + +(defun org-src-source-type () + "Return type of element edited in current buffer. +Raise an error when current buffer is not a source editing buffer." + (unless (org-src-edit-buffer-p) (error "Not in a source buffer")) + org-src--source-type) + +(defun org-src-switch-to-buffer (buffer context) + (pcase org-src-window-setup + (`plain + (when (eq context 'exit) (quit-restore-window)) + (pop-to-buffer buffer)) + (`current-window (pop-to-buffer-same-window buffer)) + (`other-window + (let ((cur-win (selected-window))) + (org-switch-to-buffer-other-window buffer) + (when (eq context 'exit) (quit-restore-window cur-win)))) + (`split-window-below + (if (eq context 'exit) + (delete-window) + (select-window (split-window-vertically))) + (pop-to-buffer-same-window buffer)) + (`split-window-right + (if (eq context 'exit) + (delete-window) + (select-window (split-window-horizontally))) + (pop-to-buffer-same-window buffer)) + (`other-frame + (pcase context + (`exit + (let ((frame (selected-frame))) + (switch-to-buffer-other-frame buffer) + (delete-frame frame))) + (`save + (kill-buffer (current-buffer)) + (pop-to-buffer-same-window buffer)) + (_ (switch-to-buffer-other-frame buffer)))) + (`reorganize-frame + (when (eq context 'edit) (delete-other-windows)) + (org-switch-to-buffer-other-window buffer) + (when (eq context 'exit) (delete-other-windows))) + (`switch-invisibly (set-buffer buffer)) + (_ + (message "Invalid value %s for `org-src-window-setup'" + org-src-window-setup) + (pop-to-buffer-same-window buffer)))) + +(defun org-src-coderef-format (&optional element) + "Return format string for block at point. + +When optional argument ELEMENT is provided, use that block. +Otherwise, assume point is either at a source block, at an +example block. + +If point is in an edit buffer, retrieve format string associated +to the remote source block." + (cond + ((and element (org-element-property :label-fmt element))) + ((org-src-edit-buffer-p) (org-src-do-at-code-block (org-src-coderef-format))) + ((org-element-property :label-fmt (org-element-at-point))) + (t org-coderef-label-format))) + +(defun org-src-coderef-regexp (fmt &optional label) + "Return regexp matching a coderef format string FMT. + +When optional argument LABEL is non-nil, match coderef for that +label only. + +Match group 1 contains the full coderef string with surrounding +white spaces. Match group 2 contains the same string without any +surrounding space. Match group 3 contains the label. + +A coderef format regexp can only match at the end of a line." + (format "\\([ \t]*\\(%s\\)[ \t]*\\)$" + (replace-regexp-in-string + "%s" + (if label (regexp-quote label) "\\([-a-zA-Z0-9_][-a-zA-Z0-9_ ]*\\)") + (regexp-quote fmt) + nil t))) + +(defun org-edit-footnote-reference () + "Edit definition of footnote reference at point." + (interactive) + (let* ((context (org-element-context)) + (label (org-element-property :label context))) + (unless (and (eq (org-element-type context) 'footnote-reference) + (org-src--on-datum-p context)) + (user-error "Not on a footnote reference")) + (unless label (user-error "Cannot edit remotely anonymous footnotes")) + (let* ((definition (org-with-wide-buffer + (org-footnote-goto-definition label) + (backward-char) + (org-element-context))) + (inline? (eq 'footnote-reference (org-element-type definition))) + (contents + (org-with-wide-buffer + (buffer-substring-no-properties + (or (org-element-property :post-affiliated definition) + (org-element-property :begin definition)) + (cond + (inline? (1+ (org-element-property :contents-end definition))) + ((org-element-property :contents-end definition)) + (t (goto-char (org-element-property :post-affiliated definition)) + (line-end-position))))))) + (add-text-properties + 0 + (progn (string-match (if inline? "\\`\\[fn:.*?:" "\\`.*?\\]") contents) + (match-end 0)) + '(read-only "Cannot edit footnote label" front-sticky t rear-nonsticky t) + contents) + (when inline? + (let ((l (length contents))) + (add-text-properties + (1- l) l + '(read-only "Cannot edit past footnote reference" + front-sticky nil rear-nonsticky nil) + contents))) + (org-src--edit-element + definition + (format "*Edit footnote [%s]*" label) + (let ((source (current-buffer))) + (lambda () + (org-mode) + (org-clone-local-variables source))) + (lambda () + (if (not inline?) (delete-region (point) (search-forward "]")) + (delete-region (point) (search-forward ":" nil t 2)) + (delete-region (1- (point-max)) (point-max)) + (when (re-search-forward "\n[ \t]*\n" nil t) + (user-error "Inline definitions cannot contain blank lines")) + ;; If footnote reference belongs to a table, make sure to + ;; remove any newline characters in order to preserve + ;; table's structure. + (when (org-element-lineage definition '(table-cell)) + (while (search-forward "\n" nil t) (replace-match " "))))) + contents + 'remote)) + ;; Report success. + t)) + +(defun org-edit-table.el () + "Edit \"table.el\" table at point. +\\<org-src-mode-map> +A new buffer is created and the table is copied into it. Then +the table is recognized with `table-recognize'. When done +editing, exit with `\\[org-edit-src-exit]'. The edited text will \ +then replace +the area in the Org mode buffer. + +Throw an error when not at such a table." + (interactive) + (let ((element (org-element-at-point))) + (unless (and (eq (org-element-type element) 'table) + (eq (org-element-property :type element) 'table.el) + (org-src--on-datum-p element)) + (user-error "Not in a table.el table")) + (org-src--edit-element + element + (org-src--construct-edit-buffer-name (buffer-name) "Table") + #'text-mode t) + (when (bound-and-true-p flyspell-mode) (flyspell-mode -1)) + (table-recognize) + t)) + +(defun org-edit-latex-fragment () + "Edit LaTeX fragment at point." + (interactive) + (let ((context (org-element-context))) + (unless (and (eq 'latex-fragment (org-element-type context)) + (org-src--on-datum-p context)) + (user-error "Not on a LaTeX fragment")) + (let* ((contents + (buffer-substring-no-properties + (org-element-property :begin context) + (- (org-element-property :end context) + (org-element-property :post-blank context)))) + (delim-length (if (string-match "\\`\\$[^$]" contents) 1 2))) + ;; Make the LaTeX deliminators read-only. + (add-text-properties 0 delim-length + (list 'read-only "Cannot edit LaTeX deliminator" + 'front-sticky t + 'rear-nonsticky t) + contents) + (let ((l (length contents))) + (add-text-properties (- l delim-length) l + (list 'read-only "Cannot edit LaTeX deliminator" + 'front-sticky nil + 'rear-nonsticky nil) + contents)) + (org-src--edit-element + context + (org-src--construct-edit-buffer-name (buffer-name) "LaTeX fragment") + (org-src-get-lang-mode "latex") + (lambda () + ;; Blank lines break things, replace with a single newline. + (while (re-search-forward "\n[ \t]*\n" nil t) (replace-match "\n")) + ;; If within a table a newline would disrupt the structure, + ;; so remove newlines. + (goto-char (point-min)) + (when (org-element-lineage context '(table-cell)) + (while (search-forward "\n" nil t) (replace-match " ")))) + contents)) + t)) + +(defun org-edit-latex-environment () + "Edit LaTeX environment at point. +\\<org-src-mode-map> +The LaTeX environment is copied into a new buffer. Major mode is +set to the one associated to \"latex\" in `org-src-lang-modes', +or to `latex-mode' if there is none. + +When done, exit with `\\[org-edit-src-exit]'. The edited text \ +will then replace +the LaTeX environment in the Org mode buffer." + (interactive) + (let ((element (org-element-at-point))) + (unless (and (eq (org-element-type element) 'latex-environment) + (org-src--on-datum-p element)) + (user-error "Not in a LaTeX environment")) + (org-src--edit-element + element + (org-src--construct-edit-buffer-name (buffer-name) "LaTeX environment") + (org-src-get-lang-mode "latex") + t) + t)) + +(defun org-edit-export-block () + "Edit export block at point. +\\<org-src-mode-map> +A new buffer is created and the block is copied into it, and the +buffer is switched into an appropriate major mode. See also +`org-src-lang-modes'. + +When done, exit with `\\[org-edit-src-exit]'. The edited text \ +will then replace +the area in the Org mode buffer. + +Throw an error when not at an export block." + (interactive) + (let ((element (org-element-at-point))) + (unless (and (eq (org-element-type element) 'export-block) + (org-src--on-datum-p element)) + (user-error "Not in an export block")) + (let* ((type (downcase (or (org-element-property :type element) + ;; Missing export-block type. Fallback + ;; to default mode. + "fundamental"))) + (mode (org-src-get-lang-mode type))) + (unless (functionp mode) (error "No such language mode: %s" mode)) + (org-src--edit-element + element + (org-src--construct-edit-buffer-name (buffer-name) type) + mode + (lambda () (org-escape-code-in-region (point-min) (point-max))))) + t)) + +(defun org-edit-src-code (&optional code edit-buffer-name) + "Edit the source or example block at point. +\\<org-src-mode-map> +The code is copied to a separate buffer and the appropriate mode +is turned on. When done, exit with `\\[org-edit-src-exit]'. This \ +will remove the +original code in the Org buffer, and replace it with the edited +version. See `org-src-window-setup' to configure the display of +windows containing the Org buffer and the code buffer. + +When optional argument CODE is a string, edit it in a dedicated +buffer instead. + +When optional argument EDIT-BUFFER-NAME is non-nil, use it as the +name of the sub-editing buffer." + (interactive) + (let* ((element (org-element-at-point)) + (type (org-element-type element))) + (unless (and (memq type '(example-block src-block)) + (org-src--on-datum-p element)) + (user-error "Not in a source or example block")) + (let* ((lang + (if (eq type 'src-block) (org-element-property :language element) + "example")) + (lang-f (and (eq type 'src-block) (org-src-get-lang-mode lang))) + (babel-info (and (eq type 'src-block) + (org-babel-get-src-block-info 'light))) + deactivate-mark) + (when (and (eq type 'src-block) (not (functionp lang-f))) + (error "No such language mode: %s" lang-f)) + (org-src--edit-element + element + (or edit-buffer-name + (org-src--construct-edit-buffer-name (buffer-name) lang)) + lang-f + (and (null code) + (lambda () (org-escape-code-in-region (point-min) (point-max)))) + (and code (org-unescape-code-in-string code))) + ;; Finalize buffer. + (setq-local org-coderef-label-format + (or (org-element-property :label-fmt element) + org-coderef-label-format)) + (when (eq type 'src-block) + (setq org-src--babel-info babel-info) + (let ((edit-prep-func (intern (concat "org-babel-edit-prep:" lang)))) + (when (fboundp edit-prep-func) + (funcall edit-prep-func babel-info)))) + t))) + +(defun org-edit-inline-src-code () + "Edit inline source code at point." + (interactive) + (let ((context (org-element-context))) + (unless (and (eq (org-element-type context) 'inline-src-block) + (org-src--on-datum-p context)) + (user-error "Not on inline source code")) + (let* ((lang (org-element-property :language context)) + (lang-f (org-src-get-lang-mode lang)) + (babel-info (org-babel-get-src-block-info 'light)) + deactivate-mark) + (unless (functionp lang-f) (error "No such language mode: %s" lang-f)) + (org-src--edit-element + context + (org-src--construct-edit-buffer-name (buffer-name) lang) + lang-f + (lambda () + ;; Inline source blocks are limited to one line. + (while (re-search-forward "\n[ \t]*" nil t) (replace-match " ")) + ;; Trim contents. + (goto-char (point-min)) + (skip-chars-forward " \t") + (delete-region (point-min) (point)) + (goto-char (point-max)) + (skip-chars-backward " \t") + (delete-region (point) (point-max)))) + ;; Finalize buffer. + (setq org-src--babel-info babel-info) + (setq org-src--preserve-indentation t) + (let ((edit-prep-func (intern (concat "org-babel-edit-prep:" lang)))) + (when (fboundp edit-prep-func) (funcall edit-prep-func babel-info))) + ;; Return success. + t))) + +(defun org-edit-fixed-width-region () + "Edit the fixed-width ASCII drawing at point. +\\<org-src-mode-map> +This must be a region where each line starts with a colon +followed by a space or a newline character. + +A new buffer is created and the fixed-width region is copied into +it, and the buffer is switched into the major mode defined in +`org-edit-fixed-width-region-mode', which see. + +When done, exit with `\\[org-edit-src-exit]'. The edited text \ +will then replace +the area in the Org mode buffer." + (interactive) + (let ((element (org-element-at-point))) + (unless (and (eq (org-element-type element) 'fixed-width) + (org-src--on-datum-p element)) + (user-error "Not in a fixed-width area")) + (org-src--edit-element + element + (org-src--construct-edit-buffer-name (buffer-name) "Fixed Width") + org-edit-fixed-width-region-mode + (lambda () (while (not (eobp)) (insert ": ") (forward-line)))) + ;; Return success. + t)) + +(defun org-edit-src-abort () + "Abort editing of the src code and return to the Org buffer." + (interactive) + (let (org-src--allow-write-back) (org-edit-src-exit))) + +(defun org-edit-src-continue (e) + "Unconditionally return to buffer editing area under point. +Throw an error if there is no such buffer." + (interactive "e") + (mouse-set-point e) + (let ((buf (get-char-property (point) 'edit-buffer))) + (if buf (org-src-switch-to-buffer buf 'continue) + (user-error "No sub-editing buffer for area at point")))) + +(defun org-edit-src-save () + "Save parent buffer with current state source-code buffer." + (interactive) + (unless (org-src-edit-buffer-p) (user-error "Not in a sub-editing buffer")) + (set-buffer-modified-p nil) + (let ((write-back-buf (generate-new-buffer "*org-src-write-back*")) + (beg org-src--beg-marker) + (end org-src--end-marker) + (overlay org-src--overlay)) + (org-src--contents-for-write-back write-back-buf) + (with-current-buffer (org-src-source-buffer) + (undo-boundary) + (goto-char beg) + ;; Temporarily disable read-only features of OVERLAY in order to + ;; insert new contents. + (delete-overlay overlay) + (let ((expecting-bol (bolp))) + (if (version< emacs-version "27.1") + (progn (delete-region beg end) + (insert (with-current-buffer write-back-buf (buffer-string)))) + (save-restriction + (narrow-to-region beg end) + (replace-buffer-contents write-back-buf 0.1 nil) + (goto-char (point-max)))) + (when (and expecting-bol (not (bolp))) (insert "\n"))) + (kill-buffer write-back-buf) + (save-buffer) + (move-overlay overlay beg (point)))) + ;; `write-contents-functions' requires the function to return + ;; a non-nil value so that other functions are not called. + t) + +(defun org-edit-src-exit () + "Kill current sub-editing buffer and return to source buffer." + (interactive) + (unless (org-src-edit-buffer-p) + (error "Not in a sub-editing buffer")) + (let* ((beg org-src--beg-marker) + (end org-src--end-marker) + (write-back org-src--allow-write-back) + (remote org-src--remote) + (coordinates (and (not remote) + (org-src--coordinates (point) 1 (point-max)))) + (write-back-buf + (and write-back (generate-new-buffer "*org-src-write-back*")))) + (when write-back (org-src--contents-for-write-back write-back-buf)) + (set-buffer-modified-p nil) + ;; Switch to source buffer. Kill sub-editing buffer. + (let ((edit-buffer (current-buffer)) + (source-buffer (marker-buffer beg))) + (unless source-buffer + (when write-back-buf (kill-buffer write-back-buf)) + (error "Source buffer disappeared. Aborting")) + (org-src-switch-to-buffer source-buffer 'exit) + (kill-buffer edit-buffer)) + ;; Insert modified code. Ensure it ends with a newline character. + (org-with-wide-buffer + (when (and write-back + (not (equal (buffer-substring beg end) + (with-current-buffer write-back-buf + (buffer-string))))) + (undo-boundary) + (goto-char beg) + (let ((expecting-bol (bolp))) + (if (version< emacs-version "27.1") + (progn (delete-region beg end) + (insert (with-current-buffer write-back-buf + (buffer-string)))) + (save-restriction + (narrow-to-region beg end) + (replace-buffer-contents write-back-buf 0.1 nil) + (goto-char (point-max)))) + (when (and expecting-bol (not (bolp))) (insert "\n"))))) + (when write-back-buf (kill-buffer write-back-buf)) + ;; If we are to return to source buffer, put point at an + ;; appropriate location. In particular, if block is hidden, move + ;; to the beginning of the block opening line. + (unless remote + (goto-char beg) + (cond + ;; Block is hidden; move at start of block. + ((cl-some (lambda (o) (eq (overlay-get o 'invisible) 'org-hide-block)) + (overlays-at (point))) + (beginning-of-line 0)) + (write-back (org-src--goto-coordinates coordinates beg end)))) + ;; Clean up left-over markers and restore window configuration. + (set-marker beg nil) + (set-marker end nil) + (when org-src--saved-temp-window-config + (unwind-protect + (set-window-configuration org-src--saved-temp-window-config) + (setq org-src--saved-temp-window-config nil))))) + +(provide 'org-src) + +;;; org-src.el ends here diff --git a/elpa/org-9.5.2/org-src.elc b/elpa/org-9.5.2/org-src.elc new file mode 100644 index 0000000..a473a80 Binary files /dev/null and b/elpa/org-9.5.2/org-src.elc differ diff --git a/elpa/org-9.5.2/org-table.el b/elpa/org-9.5.2/org-table.el new file mode 100644 index 0000000..e34872f --- /dev/null +++ b/elpa/org-9.5.2/org-table.el @@ -0,0 +1,6340 @@ +;;; org-table.el --- The Table Editor for Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file contains the table editor and spreadsheet for Org mode. + +;; Watch out: Here we are talking about two different kind of tables. +;; Most of the code is for the tables created with the Org mode table editor. +;; Sometimes, we talk about tables created and edited with the table.el +;; Emacs package. We call the former org-type tables, and the latter +;; table.el-type tables. + +;;; Code: + +(require 'cl-lib) +(require 'org-macs) +(require 'org-compat) +(require 'org-keys) + +(declare-function calc-eval "calc" (str &optional separator &rest args)) +(declare-function face-remap-remove-relative "face-remap" (cookie)) +(declare-function face-remap-add-relative "face-remap" (face &rest specs)) +(declare-function org-at-timestamp-p "org" (&optional extended)) +(declare-function org-delete-backward-char "org" (N)) +(declare-function org-mode "org" ()) +(declare-function org-duration-p "org-duration" (duration &optional canonical)) +(declare-function org-duration-to-minutes "org-duration" (duration &optional canonical)) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-contents "org-element" (element)) +(declare-function org-element-extract-element "org-element" (element)) +(declare-function org-element-interpret-data "org-element" (data)) +(declare-function org-element-lineage "org-element" (blob &optional types with-self)) +(declare-function org-element-map "org-element" (data types fun &optional info first-match no-recursion with-affiliated)) +(declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-type "org-element" (element)) +(declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) +(declare-function org-export-create-backend "ox" (&rest rest) t) +(declare-function org-export-data-with-backend "ox" (data backend info)) +(declare-function org-export-filter-apply-functions "ox" (filters value info)) +(declare-function org-export-first-sibling-p "ox" (blob info)) +(declare-function org-export-get-backend "ox" (name)) +(declare-function org-export-get-environment "ox" (&optional backend subtreep ext-plist)) +(declare-function org-export-install-filters "ox" (info)) +(declare-function org-export-table-has-special-column-p "ox" (table)) +(declare-function org-export-table-row-is-special-p "ox" (table-row info)) +(declare-function org-forward-paragraph "org" (&optional arg)) +(declare-function org-id-find "org-id" (id &optional markerp)) +(declare-function org-indent-line "org" ()) +(declare-function org-load-modules-maybe "org" (&optional force)) +(declare-function org-restart-font-lock "org" ()) +(declare-function org-sort-remove-invisible "org" (s)) +(declare-function org-time-stamp-format "org" (&optional long inactive)) +(declare-function org-time-string-to-absolute "org" (s &optional daynr prefer buffer pos)) +(declare-function org-time-string-to-time "org" (s)) +(declare-function org-timestamp-up-day "org" (&optional arg)) + +(defvar constants-unit-system) +(defvar org-M-RET-may-split-line) +(defvar org-element-use-cache) +(defvar org-export-filters-alist) +(defvar org-finish-function) +(defvar org-inhibit-highlight-removal) +(defvar org-inhibit-startup) +(defvar org-selected-window) +(defvar org-self-insert-cluster-for-undo) +(defvar org-self-insert-command-undo-counter) +(defvar org-ts-regexp) +(defvar org-ts-regexp-both) +(defvar org-ts-regexp-inactive) +(defvar org-ts-regexp3) +(defvar org-window-configuration) +(defvar sort-fold-case) + + +;;; Customizables + +(defgroup org-table nil + "Options concerning tables in Org mode." + :tag "Org Table" + :group 'org) + +(defcustom orgtbl-optimized t + "Non-nil means use the optimized table editor version for `orgtbl-mode'. + +In the optimized version, the table editor takes over all simple keys that +normally just insert a character. In tables, the characters are inserted +in a way to minimize disturbing the table structure (i.e. in overwrite mode +for empty fields). Outside tables, the correct binding of the keys is +restored. + +Changing this variable requires a restart of Emacs to become +effective." + :group 'org-table + :type 'boolean) + +(defcustom orgtbl-radio-table-templates + '((latex-mode "% BEGIN RECEIVE ORGTBL %n +% END RECEIVE ORGTBL %n +\\begin{comment} +#+ORGTBL: SEND %n orgtbl-to-latex :splice nil :skip 0 +| | | +\\end{comment}\n") + (texinfo-mode "@c BEGIN RECEIVE ORGTBL %n +@c END RECEIVE ORGTBL %n +@ignore +#+ORGTBL: SEND %n orgtbl-to-html :splice nil :skip 0 +| | | +@end ignore\n") + (html-mode "<!-- BEGIN RECEIVE ORGTBL %n --> +<!-- END RECEIVE ORGTBL %n --> +<!-- +#+ORGTBL: SEND %n orgtbl-to-html :splice nil :skip 0 +| | | +-->\n") + (org-mode "#+ BEGIN RECEIVE ORGTBL %n +#+ END RECEIVE ORGTBL %n + +#+ORGTBL: SEND %n orgtbl-to-orgtbl :splice nil :skip 0 +| | | +")) + "Templates for radio tables in different major modes. +Each template must define lines that will be treated as a comment and that +must contain the \"BEGIN RECEIVE ORGTBL %n\" and \"END RECEIVE ORGTBL\" +lines where \"%n\" will be replaced with the name of the table during +insertion of the template. The transformed table will later be inserted +between these lines. + +The template should also contain a minimal table in a multiline comment. +If multiline comments are not possible in the buffer language, +you can pack it into a string that will not be used when the code +is compiled or executed. Above the table will you need a line with +the fixed string \"#+ORGTBL: SEND\", followed by instruction on how to +convert the table into a data structure useful in the +language of the buffer. Check the manual for the section on +\"Translator functions\", and more generally check out +the Info node `(org)Tables in arbitrary syntax'. + +All occurrences of %n in a template will be replaced with the name of the +table, obtained by prompting the user." + :group 'org-table + :type '(repeat + (list (symbol :tag "Major mode") + (string :tag "Format")))) + +(defgroup org-table-settings nil + "Settings for tables in Org mode." + :tag "Org Table Settings" + :group 'org-table) + +(defcustom org-table-header-line-p nil + "Activate `org-table-header-line-mode' by default?" + :type 'boolean + :package-version '(Org . "9.4") + :group 'org-table) + +(defcustom org-table-default-size "5x2" + "The default size for newly created tables, Columns x Rows." + :group 'org-table-settings + :type 'string) + +(defcustom org-table-number-regexp + "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|[<>]?[-+]?0[xX][[:xdigit:].]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$" + "Regular expression for recognizing numbers in table columns. +If a table column contains mostly numbers, it will be aligned to the +right. If not, it will be aligned to the left. + +The default value of this option is a regular expression which allows +anything which looks remotely like a number as used in scientific +context. For example, all of the following will be considered a +number: + 12 12.2 2.4e-08 2x10^12 4.034+-0.02 2.7(10) >3.5 + +Other options offered by the customize interface are more restrictive." + :group 'org-table-settings + :type '(choice + (const :tag "Positive Integers" + "^[0-9]+$") + (const :tag "Integers" + "^[-+]?[0-9]+$") + (const :tag "Floating Point Numbers" + "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.[0-9]*\\)$") + (const :tag "Floating Point Number or Integer" + "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.?[0-9]*\\)$") + (const :tag "Exponential, Floating point, Integer" + "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$") + (const :tag "Very General Number-Like, including hex and Calc radix" + "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*\\|[<>]?[-+]?0[xX][[:xdigit:].]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$") + (const :tag "Very General Number-Like, including hex and Calc radix, allows comma as decimal mark" + "^\\([<>]?[-+^.,0-9]*[0-9][-+^.0-9eEdDx()%]*\\|[<>]?[-+]?0[xX][[:xdigit:].]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$") + (regexp :tag "Regexp:"))) + +(defcustom org-table-number-fraction 0.5 + "Fraction of numbers in a column required to make the column align right. +In a column all non-white fields are considered. If at least +this fraction of fields is matched by `org-table-number-regexp', +alignment to the right border applies." + :group 'org-table-settings + :type 'number) + +(defcustom org-table-formula-field-format "%s" + "Format for fields which contain the result of a formula. +For example, using \"~%s~\" will display the result within tilde +characters. Beware that modifying the display can prevent the +field from being used in another formula." + :group 'org-table-settings + :version "24.1" + :type 'string) + +(defgroup org-table-editing nil + "Behavior of tables during editing in Org mode." + :tag "Org Table Editing" + :group 'org-table) + +(defcustom org-table-automatic-realign t + "Non-nil means automatically re-align table when pressing TAB or RETURN. +When nil, aligning is only done with `\\[org-table-align]', or after column +removal/insertion." + :group 'org-table-editing + :type 'boolean) + +(defcustom org-table-auto-blank-field t + "Non-nil means automatically blank table field when starting to type into it. +This only happens when typing immediately after a field motion +command (TAB, S-TAB or RET)." + :group 'org-table-editing + :type 'boolean) + +(defcustom org-table-exit-follow-field-mode-when-leaving-table t + "Non-nil means automatically exit the follow mode. +When nil, the follow mode will stay on and be active in any table +the cursor enters. Since the table follow filed mode messes with the +window configuration, it is not recommended to set this variable to nil, +except maybe locally in a special file that has mostly tables with long +fields." + :group 'org-table + :version "24.1" + :type 'boolean) + +(defcustom org-table-fix-formulas-confirm nil + "Whether the user should confirm when Org fixes formulas." + :group 'org-table-editing + :version "24.1" + :type '(choice + (const :tag "with yes-or-no" yes-or-no-p) + (const :tag "with y-or-n" y-or-n-p) + (const :tag "no confirmation" nil))) + +(defcustom org-table-tab-jumps-over-hlines t + "Non-nil means tab in the last column of a table with jump over a hline. +If a horizontal separator line is following the current line, +`org-table-next-field' can either create a new row before that line, or jump +over the line. When this option is nil, a new line will be created before +this line." + :group 'org-table-editing + :type 'boolean) + +(defcustom org-table-shrunk-column-indicator "…" + "String to be displayed in a shrunk column." + :group 'org-table-editing + :type 'string + :package-version '(Org . "9.2") + :safe (lambda (v) (and (stringp v) (not (equal v ""))))) + +(defgroup org-table-calculation nil + "Options concerning tables in Org mode." + :tag "Org Table Calculation" + :group 'org-table) + +(defcustom org-table-use-standard-references 'from + "Non-nil means using table references like B3 instead of @3$2. +Possible values are: +nil never use them +from accept as input, do not present for editing +t accept as input and present for editing" + :group 'org-table-calculation + :type '(choice + (const :tag "Never, don't even check user input for them" nil) + (const :tag "Always, both as user input, and when editing" t) + (const :tag "Convert user input, don't offer during editing" from))) + +(defcustom org-table-copy-increment t + "Non-nil means increment when copying current field with \ +`\\[org-table-copy-down]'." + :group 'org-table-calculation + :version "26.1" + :package-version '(Org . "8.3") + :type '(choice + (const :tag "Use the difference between the current and the above fields" t) + (integer :tag "Use a number" 1) + (const :tag "Don't increment the value when copying a field" nil))) + +(defcustom org-calc-default-modes + '(calc-internal-prec 12 + calc-float-format (float 8) + calc-angle-mode deg + calc-prefer-frac nil + calc-symbolic-mode nil + calc-date-format (YYYY "-" MM "-" DD " " Www (" " hh ":" mm)) + calc-display-working-message t) + "List with Calc mode settings for use in `calc-eval' for table formulas. +The list must contain alternating symbols (Calc modes variables and values). +Don't remove any of the default settings, just change the values. Org mode +relies on the variables to be present in the list." + :group 'org-table-calculation + :type 'plist) + +(defcustom org-table-duration-custom-format 'hours + "Format for the output of calc computations like $1+$2;t. +The default value is `hours', and will output the results as a +number of hours. Other allowed values are `seconds', `minutes' and +`days', and the output will be a fraction of seconds, minutes or +days. `hh:mm' selects to use hours and minutes, ignoring seconds. +The `U' flag in a table formula will select this specific format for +a single formula." + :group 'org-table-calculation + :version "24.1" + :type '(choice (symbol :tag "Seconds" 'seconds) + (symbol :tag "Minutes" 'minutes) + (symbol :tag "Hours " 'hours) + (symbol :tag "Days " 'days) + (symbol :tag "HH:MM " 'hh:mm))) + +(defcustom org-table-duration-hour-zero-padding t + "Non-nil means hours in table duration computations should be zero-padded. +So this is about 08:32:34 versus 8:33:34." + :group 'org-table-calculation + :version "26.1" + :package-version '(Org . "9.1") + :type 'boolean + :safe #'booleanp) + +(defcustom org-table-formula-evaluate-inline t + "Non-nil means TAB and RET evaluate a formula in current table field. +If the current field starts with an equal sign, it is assumed to be a formula +which should be evaluated as described in the manual and in the documentation +string of the command `org-table-eval-formula'. This feature requires the +Emacs calc package. +When this variable is nil, formula calculation is only available through +the command `\\[org-table-eval-formula]'." + :group 'org-table-calculation + :type 'boolean) + +(defcustom org-table-formula-use-constants t + "Non-nil means interpret constants in formulas in tables. +A constant looks like `$c' or `$Grav' and will be replaced before evaluation +by the value given in `org-table-formula-constants', or by a value obtained +from the `constants.el' package." + :group 'org-table-calculation + :type 'boolean) + +(defcustom org-table-formula-constants nil + "Alist with constant names and values, for use in table formulas. +The car of each element is a name of a constant, without the `$' before it. +The cdr is the value as a string. For example, if you'd like to use the +speed of light in a formula, you would configure + + (setq org-table-formula-constants \\='((\"c\" . \"299792458.\"))) + +and then use it in an equation like `$1*$c'. + +Constants can also be defined on a per-file basis using a line like + +#+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6" + :group 'org-table-calculation + :type '(repeat + (cons (string :tag "name") + (string :tag "value")))) + +(defcustom org-table-allow-automatic-line-recalculation t + "Non-nil means lines marked with |#| or |*| will be recomputed automatically. +\\<org-mode-map>\ +Automatically means when `TAB' or `RET' or `\\[org-ctrl-c-ctrl-c]' \ +are pressed in the line." + :group 'org-table-calculation + :type 'boolean) + +(defcustom org-table-relative-ref-may-cross-hline t + "Non-nil means relative formula references may cross hlines. +Here are the allowed values: + +nil Relative references may not cross hlines. They will reference the + field next to the hline instead. Coming from below, the reference + will be to the field below the hline. Coming from above, it will be + to the field above. +t Relative references may cross hlines. +error An attempt to cross a hline will throw an error. + +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 "Stick to hline" nil) + (const :tag "Error on attempt to cross" error))) + +(defcustom org-table-formula-create-columns nil + "Non-nil means evaluation of formula can add new columns. +When non-nil, evaluating an out-of-bounds field can insert as +many columns as needed. When set to `warn', issue a warning when +doing so. When set to `prompt', ask user before creating a new +column. Otherwise, throw an error." + :group 'org-table-calculation + :package-version '(Org . "8.3") + :type '(choice + (const :tag "Out-of-bounds field generates an error (default)" nil) + (const :tag "Out-of-bounds field silently adds columns as needed" t) + (const :tag "Out-of-bounds field adds columns, but issues a warning" warn) + (const :tag "Prompt user when setting an out-of-bounds field" prompt))) + +(defgroup org-table-import-export nil + "Options concerning table import and export in Org mode." + :tag "Org Table Import Export" + :group 'org-table) + +(defcustom org-table-export-default-format "orgtbl-to-tsv" + "Default export parameters for `org-table-export'. +These can be overridden for a specific table by setting the +TABLE_EXPORT_FORMAT property. See the manual section on orgtbl +radio tables for the different export transformations and +available parameters." + :group 'org-table-import-export + :type 'string) + +(defcustom org-table-convert-region-max-lines 999 + "Max lines that `org-table-convert-region' will attempt to process. + +The function can be slow on larger regions; this safety feature +prevents it from hanging Emacs." + :group 'org-table-import-export + :type 'integer + :package-version '(Org . "8.3")) + + +;;; Org table header minor mode +(defun org-table-row-get-visible-string (&optional pos) + "Get the visible string of a table row. +This may be useful when columns have been shrunk." + (save-excursion + (when pos (goto-char pos)) + (goto-char (line-beginning-position)) + (let ((end (line-end-position)) str) + (backward-char) + (while (progn (forward-char 1) (< (point) end)) + (let ((ov (car (overlays-at (point))))) + (if (not ov) + (push (char-to-string (char-after)) str) + (push (overlay-get ov 'display) str) + (goto-char (1- (overlay-end ov)))))) + (format "%s" (mapconcat #'identity (reverse str) ""))))) + +(defvar-local org-table-header-overlay nil) +(defun org-table-header-set-header () + "Display the header of the table at point." + (let ((gcol temporary-goal-column)) + (unwind-protect + (progn + (when (overlayp org-table-header-overlay) + (delete-overlay org-table-header-overlay)) + (let* ((ws (window-start)) + (beg (save-excursion + (goto-char (org-table-begin)) + (while (or (org-at-table-hline-p) + (looking-at-p ".*|\\s-+<[rcl]?\\([0-9]+\\)?>")) + (move-beginning-of-line 2)) + (line-beginning-position))) + (end (save-excursion (goto-char beg) (point-at-eol)))) + (if (pos-visible-in-window-p beg) + (when (overlayp org-table-header-overlay) + (delete-overlay org-table-header-overlay)) + (setq org-table-header-overlay + (make-overlay ws (+ ws (- end beg)))) + (org-overlay-display + org-table-header-overlay + (org-table-row-get-visible-string beg) + 'org-table-header)))) + (setq temporary-goal-column gcol)))) + +;;;###autoload +(define-minor-mode org-table-header-line-mode + "Display the first row of the table at point in the header line." + :lighter " TblHeader" + (unless (eq major-mode 'org-mode) + (user-error "Cannot turn org table header mode outside org-mode buffers")) + (if org-table-header-line-mode + (add-hook 'post-command-hook #'org-table-header-set-header nil t) + (when (overlayp org-table-header-overlay) + (delete-overlay org-table-header-overlay) + (setq org-table-header-overlay nil)) + (remove-hook 'post-command-hook #'org-table-header-set-header t))) + + +;;; Regexps Constants + +(defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)" + "Detect an org-type or table-type table.") + +(defconst org-table-line-regexp "^[ \t]*|" + "Detect an org-type table line.") + +(defconst org-table-dataline-regexp "^[ \t]*|[^-]" + "Detect an org-type table line.") + +(defconst org-table-hline-regexp "^[ \t]*|-" + "Detect an org-type table hline.") + +(defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]" + "Detect a table-type table hline.") + +(defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]" + "Detect the first line outside a table when searching from within it. +This works for both table types.") + +(defconst org-TBLFM-regexp "^[ \t]*#\\+TBLFM: " + "Detect a #+TBLFM line.") + +(defvar org-table-TBLFM-begin-regexp "^[ \t]*|.*\n[ \t]*#\\+TBLFM: ") + +(defconst org-table-auto-recalculate-regexp "^[ \t]*| *# *\\(|\\|$\\)" + "Regexp matching a line marked for automatic recalculation.") + +(defconst org-table-recalculate-regexp "^[ \t]*| *[#*] *\\(|\\|$\\)" + "Regexp matching a line marked for recalculation.") + +(defconst org-table-calculate-mark-regexp "^[ \t]*| *[!$^_#*] *\\(|\\|$\\)" + "Regexp matching a line marked for calculation.") + +(defconst org-table-border-regexp "^[ \t]*[^| \t]" + "Regexp matching any line outside an Org table.") + +(defconst org-table-range-regexp + "@\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\)?" + ;; 1 2 3 4 5 + "Regular expression for matching ranges in formulas.") + +(defconst org-table-range-regexp2 + (concat + "\\(" "@[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[a-zA-Z0-9]+" "\\)" + "\\.\\." + "\\(" "@?[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[a-zA-Z0-9]+" "\\)") + "Match a range for reference display.") + +(defconst org-table-translate-regexp + (concat "\\(" "@[-0-9I$]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\)") + "Match a reference that needs translation, for reference display.") + +(defconst org-table-separator-space + (propertize " " 'display '(space :relative-width 1)) + "Space used around fields when aligning the table. +This space serves as a segment separator for the purposes of the +bidirectional reordering.") + + +;;; Internal Variables + +(defvar org-table-last-highlighted-reference nil) + +(defvar org-table-formula-history nil) + +(defvar org-field-marker nil) +(defvar org-table-buffer-is-an nil) + +(defvar-local org-table-formula-constants-local nil + "Local version of `org-table-formula-constants'.") + +(defvar org-table-may-need-update t + "Indicates that a table might need an update. +This variable is set by `org-before-change-function'. +`org-table-align' sets it back to nil.") + +(defvar orgtbl-after-send-table-hook nil + "Hook for functions attaching to `C-c C-c', if the table is sent. +This can be used to add additional functionality after the table is sent +to the receiver position, otherwise, if table is not sent, the functions +are not run.") + +(defvar org-table-column-names nil + "Alist with column names, derived from the `!' line. +This variable is initialized with `org-table-analyze'.") + +(defvar org-table-column-name-regexp nil + "Regular expression matching the current column names. +This variable is initialized with `org-table-analyze'.") + +(defvar org-table-local-parameters nil + "Alist with parameter names, derived from the `$' line. +This variable is initialized with `org-table-analyze'.") + +(defvar org-table-named-field-locations nil + "Alist with locations of named fields. +Associations follow the pattern (NAME LINE COLUMN) where + NAME is the name of the field as a string, + LINE is the number of lines from the beginning of the table, + COLUMN is the column of the field, as an integer. +This variable is initialized with `org-table-analyze'.") + +(defvar org-table-current-line-types nil + "Table row types in current table. +This variable is initialized with `org-table-analyze'.") + +(defvar org-table-current-begin-pos nil + "Current table begin position, as a marker. +This variable is initialized with `org-table-analyze'.") + +(defvar org-table-current-ncol nil + "Number of columns in current table. +This variable is initialized with `org-table-analyze'.") + +(defvar org-table-dlines nil + "Vector of data line line numbers in the current table. +Line numbers are counted from the beginning of the table. This +variable is initialized with `org-table-analyze'.") + +(defvar org-table-hlines nil + "Vector of hline line numbers in the current table. +Line numbers are counted from the beginning of the table. This +variable is initialized with `org-table-analyze'.") + +(defvar org-table-aligned-begin-marker (make-marker) + "Marker at the beginning of the table last aligned. +Used to check if cursor still is in that table, to minimize realignment.") + +(defvar org-table-aligned-end-marker (make-marker) + "Marker at the end of the table last aligned. +Used to check if cursor still is in that table, to minimize realignment.") + +(defvar org-table-last-alignment nil + "List of flags for flushright alignment, from the last re-alignment. +This is being used to correctly align a single field after TAB or RET.") + +(defvar org-table-last-column-widths nil + "List of max width of fields in each column. +This is being used to correctly align a single field after TAB or RET.") + +(defvar-local org-table-formula-debug nil + "Non-nil means debug table formulas. +When nil, simply write \"#ERROR\" in corrupted fields.") + +(defvar-local org-table-overlay-coordinates nil + "Overlay coordinates after each align of a table.") + +(defvar org-last-recalc-line nil) + +(defvar org-show-positions nil) + +(defvar org-table-rectangle-overlays nil) + +(defvar org-table-clip nil + "Clipboard for table regions.") + +(defvar org-timecnt nil) + +(defvar org-recalc-commands nil + "List of commands triggering the recalculation of a line. +Will be filled automatically during use.") + +(defvar org-recalc-marks + '((" " . "Unmarked: no special line, no automatic recalculation") + ("#" . "Automatically recalculate this line upon TAB, RET, and C-c C-c in the line") + ("*" . "Recalculate only when entire table is recalculated with `C-u C-c *'") + ("!" . "Column name definition line. Reference in formula as $name.") + ("$" . "Parameter definition line name=value. Reference in formula as $name.") + ("_" . "Names for values in row below this one.") + ("^" . "Names for values in row above this one."))) + +(defvar org-pos nil) + + +;;; Macros and Inlined Functions + +(defmacro org-table-with-shrunk-columns (&rest body) + "Expand all columns before executing BODY, then shrink them again." + (declare (debug (body))) + (org-with-gensyms (shrunk-columns begin end) + `(let ((,begin (copy-marker (org-table-begin))) + (,end (copy-marker (org-table-end) t)) + (,shrunk-columns (org-table--list-shrunk-columns))) + (org-with-point-at ,begin (org-table-expand ,begin ,end)) + (unwind-protect + (progn ,@body) + (org-table--shrink-columns ,shrunk-columns ,begin ,end) + (set-marker ,begin nil) + (set-marker ,end nil))))) + +(defmacro org-table-with-shrunk-field (&rest body) + "Save field shrunk state, execute BODY and restore state." + (declare (debug (body))) + (org-with-gensyms (end shrunk size) + `(let* ((,shrunk (save-match-data (org-table--shrunk-field))) + (,end (and ,shrunk (copy-marker (overlay-end ,shrunk) t))) + (,size (and ,shrunk (- ,end (overlay-start ,shrunk))))) + (when ,shrunk (delete-overlay ,shrunk)) + (unwind-protect (progn ,@body) + (when ,shrunk (move-overlay ,shrunk (- ,end ,size) ,end)))))) + +(defmacro org-table-save-field (&rest body) + "Save current field; execute BODY; restore field. +Field is restored even in case of abnormal exit." + (declare (debug (body))) + (org-with-gensyms (line column) + `(let ((,line (copy-marker (line-beginning-position))) + (,column (org-table-current-column))) + (unwind-protect + (progn ,@body) + (goto-char ,line) + (org-table-goto-column ,column) + (set-marker ,line nil))))) + + +;;; Predicates + +(defun org-at-TBLFM-p (&optional pos) + "Non-nil when point (or POS) is in #+TBLFM line." + (save-excursion + (goto-char (or pos (point))) + (beginning-of-line) + (and (let ((case-fold-search t)) (looking-at org-TBLFM-regexp)) + (eq (org-element-type (org-element-at-point)) 'table)))) + +(defun org-at-table-p (&optional table-type) + "Non-nil if the cursor is inside an Org table. +If TABLE-TYPE is non-nil, also check for table.el-type tables." + (and (org-match-line (if table-type "[ \t]*[|+]" "[ \t]*|")) + (or (not (derived-mode-p 'org-mode)) + (let ((e (org-element-lineage (org-element-at-point) '(table) t))) + (and e (or table-type + (eq 'org (org-element-property :type e)))))))) + +(defun org-at-table.el-p () + "Non-nil when point is at a table.el table." + (and (org-match-line "[ \t]*[|+]") + (let ((element (org-element-at-point))) + (and (eq (org-element-type element) 'table) + (eq (org-element-property :type element) 'table.el))))) + +(defun org-at-table-hline-p () + "Non-nil when point is inside a hline in a table. +Assume point is already in a table." + (org-match-line org-table-hline-regexp)) + +(defun org-table-check-inside-data-field (&optional noerror assume-table) + "Non-nil when point is inside a table data field. +Raise an error otherwise, unless NOERROR is non-nil. In that +case, return nil if point is not inside a data field. When +optional argument ASSUME-TABLE is non-nil, assume point is within +a table." + (cond ((and (or assume-table (org-at-table-p)) + (not (save-excursion (skip-chars-backward " \t") (bolp))) + (not (org-at-table-hline-p)) + (not (looking-at-p "[ \t]*$")))) + (noerror nil) + (t (user-error "Not in table data field")))) + + +;;; Create, Import, and Convert Tables + +;;;###autoload +(defun org-table-create-with-table.el () + "Use the table.el package to insert a new table. +If there is already a table at point, convert between Org tables +and table.el tables." + (interactive) + (require 'table) + (cond + ((and (org-at-table.el-p) + (y-or-n-p "Convert table to Org table? ")) + (org-table-convert)) + ((and (org-at-table-p) + (y-or-n-p "Convert table to table.el table? ")) + (org-table-align) + (org-table-convert)) + (t (call-interactively 'table-insert)))) + +;;;###autoload +(defun org-table-create-or-convert-from-region (arg) + "Convert region to table, or create an empty table. +If there is an active region, convert it to a table, using the function +`org-table-convert-region'. See the documentation of that function +to learn how the prefix argument is interpreted to determine the field +separator. +If there is no such region, create an empty table with `org-table-create'." + (interactive "P") + (if (org-region-active-p) + (org-table-convert-region (region-beginning) (region-end) arg) + (org-table-create arg))) + +;;;###autoload +(defun org-table-create (&optional size) + "Query for a size and insert a table skeleton. +SIZE is a string Columns x Rows like for example \"3x2\"." + (interactive "P") + (unless size + (setq size (read-string + (concat "Table size Columns x Rows [e.g. " + org-table-default-size "]: ") + "" nil org-table-default-size))) + + (let* ((pos (point)) + (indent (make-string (current-column) ?\ )) + (split (org-split-string size " *x *")) + (rows (string-to-number (nth 1 split))) + (columns (string-to-number (car split))) + (line (concat (apply 'concat indent "|" (make-list columns " |")) + "\n"))) + (if (string-match "^[ \t]*$" (buffer-substring-no-properties + (point-at-bol) (point))) + (beginning-of-line 1) + (newline)) + ;; (mapcar (lambda (x) (insert line)) (make-list rows t)) + (dotimes (_ rows) (insert line)) + (goto-char pos) + (when (> rows 1) + ;; Insert a hline after the first row. + (end-of-line 1) + (insert "\n|-") + (goto-char pos)) + (org-table-align))) + +;;;###autoload +(defun org-table-convert-region (beg0 end0 &optional separator) + "Convert region to a table. + +The region goes from BEG0 to END0, but these borders will be moved +slightly, to make sure a beginning of line in the first line is included. + +SEPARATOR specifies the field separator in the lines. It can have the +following values: + +(4) Use the comma as a field separator +(16) Use a TAB as field separator +(64) Prompt for a regular expression as field separator +integer When a number, use that many spaces, or a TAB, as field separator +regexp When a regular expression, use it to match the separator +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." + (interactive "r\nP") + (let* ((beg (min beg0 end0)) + (end (max beg0 end0)) + re) + (when (> (count-lines beg end) org-table-convert-region-max-lines) + (user-error "Region is longer than `org-table-convert-region-max-lines' (%s) lines; not converting" + org-table-convert-region-max-lines)) + (when (equal separator '(64)) + (setq separator (read-regexp "Regexp for field separator"))) + (goto-char beg) + (beginning-of-line 1) + (setq beg (point-marker)) + (goto-char end) + (if (bolp) (backward-char 1) (end-of-line 1)) + (setq end (point-marker)) + ;; Get the right field separator + (unless separator + (goto-char beg) + (setq separator + (cond + ((not (re-search-forward "^[^\n\t]+$" end t)) '(16)) + ((not (re-search-forward "^[^\n,]+$" end t)) '(4)) + (t 1)))) + (goto-char beg) + (if (equal separator '(4)) + (while (< (point) end) + ;; parse the csv stuff + (cond + ((looking-at "^") (insert "| ")) + ((looking-at "[ \t]*$") (replace-match " |") (beginning-of-line 2)) + ((looking-at "[ \t]*\"\\([^\"\n]*\\)\"") + (replace-match "\\1") + (if (looking-at "\"") (insert "\""))) + ((looking-at "[^,\n]+") (goto-char (match-end 0))) + ((looking-at "[ \t]*,") (replace-match " | ")) + (t (beginning-of-line 2)))) + (setq re (cond + ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?") + ((equal separator '(16)) "^\\|\t") + ((integerp separator) + (if (< separator 1) + (user-error "Number of spaces in separator must be >= 1") + (format "^ *\\| *\t *\\| \\{%d,\\}" separator))) + ((stringp separator) + (format "^ *\\|%s" separator)) + (t (error "This should not happen")))) + (while (re-search-forward re end t) + (replace-match "| " t t))) + (goto-char beg) + (org-table-align))) + +;;;###autoload +(defun org-table-import (file separator) + "Import FILE as a table. + +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. + +When non-nil, SEPARATOR specifies the field separator in the +lines. It can have the following values: + +- (4) Use the comma as a field separator. +- (16) Use a TAB as field separator. +- (64) Prompt for a regular expression as field separator. +- integer When a number, use that many spaces, or a TAB, as field separator. +- regexp When a regular expression, use it to match the separator." + (interactive "f\nP") + (when (and (called-interactively-p 'any) + (not (string-match-p (rx "." (or "txt" "tsv" "csv") eos) file)) + (not (yes-or-no-p "The file's extension is not .txt, .tsv or .csv. Import? "))) + (user-error "Cannot import such file")) + (unless (bolp) (insert "\n")) + (let ((beg (point)) + (pm (point-max))) + (insert-file-contents file) + (org-table-convert-region beg (+ (point) (- (point-max) pm)) separator))) + +(defun org-table-convert () + "Convert from Org table to table.el and back. +Obviously, this only works within limits. When an Org table is converted +to table.el, all horizontal separator lines get lost, because table.el uses +these as cell boundaries and has no notion of horizontal lines. A table.el +table can be converted to an Org table only if it does not do row or column +spanning. Multiline cells will become multiple cells. Beware, Org mode +does not test if the table can be successfully converted - it blindly +applies a recipe that works for simple tables." + (interactive) + (require 'table) + (if (org-at-table.el-p) + ;; convert to Org table + (let ((beg (copy-marker (org-table-begin t))) + (end (copy-marker (org-table-end t)))) + (table-unrecognize-region beg end) + (goto-char beg) + (while (re-search-forward "^\\([ \t]*\\)\\+-.*\n" end t) + (replace-match "")) + (goto-char beg)) + (if (org-at-table-p) + ;; convert to table.el table + (let ((beg (copy-marker (org-table-begin))) + (end (copy-marker (org-table-end)))) + ;; first, get rid of all horizontal lines + (goto-char beg) + (while (re-search-forward "^\\([ \t]*\\)|-.*\n" end t) + (replace-match "")) + ;; insert a hline before first + (goto-char beg) + (org-table-insert-hline 'above) + (beginning-of-line -1) + ;; insert a hline after each line + (while (progn (beginning-of-line 3) (< (point) end)) + (org-table-insert-hline)) + (goto-char beg) + (setq end (move-marker end (org-table-end))) + ;; replace "+" at beginning and ending of hlines + (while (re-search-forward "^\\([ \t]*\\)|-" end t) + (replace-match "\\1+-")) + (goto-char beg) + (while (re-search-forward "-|[ \t]*$" end t) + (replace-match "-+")) + (goto-char beg))))) + + +;;; Navigation and Structure Editing + +;;;###autoload +(defun org-table-begin (&optional table-type) + "Find the beginning of the table and return its position. +With a non-nil optional argument TABLE-TYPE, return the beginning +of a table.el-type table. This function assumes point is on +a table." + (cond (table-type + (org-element-property :post-affiliated (org-element-at-point))) + ((save-excursion + (and (re-search-backward org-table-border-regexp nil t) + (line-beginning-position 2)))) + (t (point-min)))) + +;;;###autoload +(defun org-table-end (&optional table-type) + "Find the end of the table and return its position. +With a non-nil optional argument TABLE-TYPE, return the end of +a table.el-type table. This function assumes point is on +a table." + (save-excursion + (cond (table-type + (goto-char (org-element-property :end (org-element-at-point))) + (skip-chars-backward " \t\n") + (line-beginning-position 2)) + ((re-search-forward org-table-border-regexp nil t) + (match-beginning 0)) + ;; When the line right after the table is the last line in + ;; the buffer with trailing spaces but no final newline + ;; character, be sure to catch the correct ending at its + ;; beginning. In any other case, ending is expected to be + ;; at point max. + (t (goto-char (point-max)) + (skip-chars-backward " \t") + (if (bolp) (point) (line-end-position)))))) + +;;;###autoload +(defun org-table-next-field () + "Go to the next field in the current table, creating new lines as needed. +Before doing so, re-align the table if necessary." + (interactive) + (org-table-maybe-eval-formula) + (org-table-maybe-recalculate-line) + (when (and org-table-automatic-realign + org-table-may-need-update) + (org-table-align)) + (let ((end (org-table-end))) + (if (org-at-table-hline-p) + (end-of-line 1)) + (condition-case nil + (progn + (re-search-forward "|" end) + (if (looking-at "[ \t]*$") + (re-search-forward "|" end)) + (if (and (looking-at "-") + org-table-tab-jumps-over-hlines + (re-search-forward "^[ \t]*|\\([^-]\\)" end t)) + (goto-char (match-beginning 1))) + (if (looking-at "-") + (progn + (beginning-of-line 0) + (org-table-insert-row 'below)) + (if (looking-at " ") (forward-char 1)))) + (error + (org-table-insert-row 'below))))) + +;;;###autoload +(defun org-table-previous-field () + "Go to the previous field in the table. +Before doing so, re-align the table if necessary." + (interactive) + (org-table-justify-field-maybe) + (org-table-maybe-recalculate-line) + (when (and org-table-automatic-realign + org-table-may-need-update) + (org-table-align)) + (when (org-at-table-hline-p) + (end-of-line)) + (let ((start (org-table-begin)) + (origin (point))) + (condition-case nil + (progn + (search-backward "|" start nil 2) + (while (looking-at-p "|\\(?:-\\|[ \t]*$\\)") + (search-backward "|" start))) + (error + (goto-char origin) + (user-error "Cannot move to previous table field")))) + (when (looking-at "| ?") + (goto-char (match-end 0)))) + +(defun org-table-beginning-of-field (&optional n) + "Move to the beginning of the current table field. +If already at or before the beginning, move to the beginning of the +previous field. +With numeric argument N, move N-1 fields backward first." + (interactive "p") + (let ((pos (point))) + (while (> n 1) + (setq n (1- n)) + (org-table-previous-field)) + (if (not (re-search-backward "|" (point-at-bol 0) t)) + (user-error "No more table fields before the current") + (goto-char (match-end 0)) + (and (looking-at " ") (forward-char 1))) + (when (>= (point) pos) (org-table-beginning-of-field 2)))) + +(defun org-table-end-of-field (&optional n) + "Move to the end of the current table field. +If already at or after the end, move to the end of the next table field. +With numeric argument N, move N-1 fields forward first." + (interactive "p") + (let ((pos (point))) + (while (> n 1) + (setq n (1- n)) + (org-table-next-field)) + (when (re-search-forward "|" (point-at-eol 1) t) + (backward-char 1) + (skip-chars-backward " ") + (when (and (equal (char-before (point)) ?|) (equal (char-after (point)) ?\s)) + (forward-char 1))) + (when (<= (point) pos) (org-table-end-of-field 2)))) + +;;;###autoload +(defun org-table-next-row () + "Go to the next row (same column) in the current table. +Before doing so, re-align the table if necessary." + (interactive) + (org-table-maybe-eval-formula) + (org-table-maybe-recalculate-line) + (if (and org-table-automatic-realign + org-table-may-need-update) + (org-table-align)) + (let ((col (org-table-current-column))) + (beginning-of-line 2) + (unless (bolp) (insert "\n")) ;missing newline at eob + (when (or (not (org-at-table-p)) + (org-at-table-hline-p)) + (beginning-of-line 0) + (org-table-insert-row 'below)) + (org-table-goto-column col) + (skip-chars-backward "^|\n\r") + (when (looking-at " ") (forward-char)))) + +(defun org-table-get (line column) + "Get the field in table line LINE, column COLUMN. +If LINE is larger than the number of data lines in the table, the function +returns nil. However, if COLUMN is too large, we will simply return an +empty string. +If LINE is nil, use the current line. +If COLUMN is nil, use the current column." + (setq column (or column (org-table-current-column))) + (save-excursion + (and (or (not line) (org-table-goto-line line)) + (org-trim (org-table-get-field column))))) + +(defun org-table-put (line column value &optional align) + "Put VALUE into line LINE, column COLUMN. +When ALIGN is set, also realign the table." + (setq column (or column (org-table-current-column))) + (prog1 (save-excursion + (and (or (not line) (org-table-goto-line line)) + (progn (org-table-goto-column column nil 'force) t) + (org-table-get-field column value))) + (and align (org-table-align)))) + +(defun org-table-current-line () + "Return the index of the current data line." + (let ((pos (point)) (end (org-table-end)) (cnt 0)) + (save-excursion + (goto-char (org-table-begin)) + (while (and (re-search-forward org-table-dataline-regexp end t) + (setq cnt (1+ cnt)) + (< (point-at-eol) pos)))) + cnt)) + +(defun org-table-current-column () + "Return current column number." + (interactive) + (save-excursion + (let ((pos (point))) + (beginning-of-line) + (if (not (search-forward "|" pos t)) 0 + (let ((column 1) + (separator (if (org-at-table-hline-p) "[+|]" "|"))) + (while (re-search-forward separator pos t) (cl-incf column)) + column))))) + +(defun org-table-current-dline () + "Find out what table data line we are in. +Only data lines count for this." + (save-excursion + (let ((c 0) + (pos (line-beginning-position))) + (goto-char (org-table-begin)) + (while (<= (point) pos) + (when (looking-at org-table-dataline-regexp) (cl-incf c)) + (forward-line)) + c))) + +(defun org-table-goto-line (N) + "Go to the Nth data line in the current table. +Return t when the line exists, nil if it does not exist." + (goto-char (org-table-begin)) + (let ((end (org-table-end)) (cnt 0)) + (while (and (re-search-forward org-table-dataline-regexp end t) + (< (setq cnt (1+ cnt)) N))) + (= cnt N))) + +;;;###autoload +(defun org-table-blank-field () + "Blank the current table field or active region." + (interactive) + (org-table-check-inside-data-field) + (if (and (called-interactively-p 'any) (org-region-active-p)) + (let (org-table-clip) + (org-table-cut-region (region-beginning) (region-end))) + (skip-chars-backward "^|") + (backward-char 1) + (if (looking-at "|[^|\n]+") + (let* ((pos (match-beginning 0)) + (match (match-string 0)) + (len (org-string-width match))) + (replace-match (concat "|" (make-string (1- len) ?\ ))) + (goto-char (+ 2 pos)) + (substring match 1))))) + +(defun org-table-get-field (&optional n replace) + "Return the value of the field in column N of current row. +N defaults to current column. If REPLACE is a string, replace +field with this value. The return value is always the old +value." + (when n (org-table-goto-column n)) + (skip-chars-backward "^|\n") + (if (or (bolp) (looking-at-p "[ \t]*$")) + ;; Before first column or after last one. + "" + (looking-at "[^|\r\n]*") + (let* ((pos (match-beginning 0)) + (val (buffer-substring pos (match-end 0)))) + (when replace + (org-table-with-shrunk-field + (replace-match (if (equal replace "") " " replace) t t))) + (goto-char (min (line-end-position) (1+ pos))) + val))) + +;;;###autoload +(defun org-table-field-info (_arg) + "Show info about the current field, and highlight any reference at point." + (interactive "P") + (unless (org-at-table-p) (user-error "Not at a table")) + (org-table-analyze) + (save-excursion + (let* ((pos (point)) + (col (org-table-current-column)) + (cname (car (rassoc (number-to-string col) org-table-column-names))) + (name (car (rassoc (list (count-lines org-table-current-begin-pos + (line-beginning-position)) + col) + org-table-named-field-locations))) + (eql (org-table-expand-lhs-ranges + (mapcar + (lambda (e) + (cons (org-table-formula-handle-first/last-rc (car e)) + (cdr e))) + (org-table-get-stored-formulas)))) + (dline (org-table-current-dline)) + (ref (format "@%d$%d" dline col)) + (ref1 (org-table-convert-refs-to-an ref)) + ;; Prioritize field formulas over column formulas. + (fequation (or (assoc name eql) (assoc ref eql))) + (cequation (assoc (format "$%d" col) eql)) + (eqn (or fequation cequation))) + (let ((p (and eqn (get-text-property 0 :orig-eqn (car eqn))))) + (when p (setq eqn p))) + (goto-char pos) + (ignore-errors (org-table-show-reference 'local)) + (message "line @%d, col $%s%s, ref @%d$%d or %s%s%s" + dline col + (if cname (concat " or $" cname) "") + dline col ref1 + (if name (concat " or $" name) "") + ;; FIXME: formula info not correct if special table line + (if eqn + (concat ", formula: " + (org-table-formula-to-user + (concat + (if (or (string-prefix-p "$" (car eqn)) + (string-prefix-p "@" (car eqn))) + "" + "$") + (car eqn) "=" (cdr eqn)))) + ""))))) + +(defun org-table-goto-field (ref &optional create-column-p) + "Move point to a specific field in the current table. + +REF is either the name of a field its absolute reference, as +a string. No column is created unless CREATE-COLUMN-P is +non-nil. If it is a function, it is called with the column +number as its argument as is used as a predicate to know if the +column can be created. + +This function assumes the table is already analyzed (i.e., using +`org-table-analyze')." + (let* ((coordinates + (cond + ((cdr (assoc ref org-table-named-field-locations))) + ((string-match "\\`@\\([1-9][0-9]*\\)\\$\\([1-9][0-9]*\\)\\'" ref) + (list (condition-case nil + (aref org-table-dlines + (string-to-number (match-string 1 ref))) + (error (user-error "Invalid row number in %s" ref))) + (string-to-number (match-string 2 ref)))) + (t (user-error "Unknown field: %s" ref)))) + (line (car coordinates)) + (column (nth 1 coordinates)) + (create-new-column (if (functionp create-column-p) + (funcall create-column-p column) + create-column-p))) + (when coordinates + (goto-char org-table-current-begin-pos) + (forward-line line) + (org-table-goto-column column nil create-new-column)))) + +;;;###autoload +(defun org-table-goto-column (n &optional on-delim force) + "Move the cursor to the Nth column in the current table line. +With optional argument ON-DELIM, stop with point before the left delimiter +of the field. +If there are less than N fields, just go to after the last delimiter. +However, when FORCE is non-nil, create new columns if necessary." + (interactive "p") + (beginning-of-line 1) + (when (> n 0) + (while (and (> (setq n (1- n)) -1) + (or (search-forward "|" (point-at-eol) t) + (and force + (progn (end-of-line 1) + (skip-chars-backward "^|") + (insert " | ") + t))))) + (when (and force (not (looking-at ".*|"))) + (save-excursion (end-of-line 1) (insert " | "))) + (if on-delim + (backward-char 1) + (if (looking-at " ") (forward-char 1))))) + +;;;###autoload +(defun org-table-insert-column () + "Insert a new column into the table." + (interactive) + (unless (org-at-table-p) (user-error "Not at a table")) + (org-table-find-dataline) + (let ((col (max 1 (org-table-current-column))) + (beg (org-table-begin)) + (end (copy-marker (org-table-end))) + (shrunk-columns (org-table--list-shrunk-columns))) + (org-table-expand beg end) + (save-excursion + (goto-char beg) + (while (< (point) end) + (unless (org-at-table-hline-p) + (org-table-goto-column col t) + (insert "|")) + (forward-line))) + (org-table-goto-column col) + (org-table-align) + ;; Shift appropriately stored shrunk column numbers, then hide the + ;; columns again. + (org-table--shrink-columns (mapcar (lambda (c) (if (< c col) c (1+ c))) + shrunk-columns) + beg end) + (set-marker end nil) + ;; Fix TBLFM formulas, if desirable. + (when (or (not org-table-fix-formulas-confirm) + (funcall org-table-fix-formulas-confirm "Fix formulas? ")) + (org-table-fix-formulas "$" nil (1- col) 1)))) + +(defun org-table-find-dataline () + "Find a data line in the current table, which is needed for column commands. +This function assumes point is in a table. Raise an error when +there is no data row below." + (or (not (org-at-table-hline-p)) + (let ((col (current-column)) + (end (org-table-end))) + (forward-line) + (while (and (< (point) end) (org-at-table-hline-p)) + (forward-line)) + (when (>= (point) end) + (user-error "Cannot find data row for column operation")) + (org-move-to-column col) + t))) + +(defun org-table-line-to-dline (line &optional above) + "Turn a buffer line number into a data line number. + +If there is no data line in this line, return nil. + +If there is no matching dline (most likely the reference was +a hline), the first dline below it is used. When ABOVE is +non-nil, the one above is used." + (let ((min 1) + (max (1- (length org-table-dlines)))) + (cond ((or (> (aref org-table-dlines min) line) + (< (aref org-table-dlines max) line)) + nil) + ((= line (aref org-table-dlines max)) max) + (t (catch 'exit + (while (> (- max min) 1) + (let* ((mean (/ (+ max min) 2)) + (v (aref org-table-dlines mean))) + (cond ((= v line) (throw 'exit mean)) + ((> v line) (setq max mean)) + (t (setq min mean))))) + (cond ((= line (aref org-table-dlines max)) max) + ((= line (aref org-table-dlines min)) min) + (above min) + (t max))))))) + +(defun org-table--swap-cells (row1 col1 row2 col2) + "Swap two cells indicated by the coordinates provided. +ROW1, COL1, ROW2, COL2 are integers indicating the row/column +position of the two cells that will be swapped in the table." + (let ((content1 (org-table-get row1 col1)) + (content2 (org-table-get row2 col2))) + (org-table-put row1 col1 content2) + (org-table-put row2 col2 content1))) + +(defun org-table--move-cell (direction) + "Move the current cell in a cardinal direction. +DIRECTION is a symbol among `up', `down', `left', and `right'. +The contents the current cell are swapped with cell in the +indicated direction. Raise an error if the move cannot be done." + (let ((row-shift (pcase direction (`up -1) (`down 1) (_ 0))) + (column-shift (pcase direction (`left -1) (`right 1) (_ 0)))) + (when (and (= 0 row-shift) (= 0 column-shift)) + (error "Invalid direction: %S" direction)) + ;; Initialize `org-table-current-ncol' and `org-table-dlines'. + (org-table-analyze) + (let* ((row (org-table-current-line)) + (column (org-table-current-column)) + (target-row (+ row row-shift)) + (target-column (+ column column-shift)) + (org-table-current-nrow (1- (length org-table-dlines)))) + (when (or (< target-column 1) + (< target-row 1) + (> target-column org-table-current-ncol) + (> target-row org-table-current-nrow)) + (user-error "Cannot move cell further")) + (org-table--swap-cells row column target-row target-column) + (org-table-goto-line target-row) + (org-table-goto-column target-column)))) + +;;;###autoload +(defun org-table-move-cell-up () + "Move a single cell up in a table. +Swap with anything in target cell." + (interactive) + (unless (org-table-check-inside-data-field) + (error "No table at point")) + (org-table--move-cell 'up) + (org-table-align)) + +;;;###autoload +(defun org-table-move-cell-down () + "Move a single cell down in a table. +Swap with anything in target cell." + (interactive) + (unless (org-table-check-inside-data-field) + (error "No table at point")) + (org-table--move-cell 'down) + (org-table-align)) + +;;;###autoload +(defun org-table-move-cell-left () + "Move a single cell left in a table. +Swap with anything in target cell." + (interactive) + (unless (org-table-check-inside-data-field) + (error "No table at point")) + (org-table--move-cell 'left) + (org-table-align)) + +;;;###autoload +(defun org-table-move-cell-right () + "Move a single cell right in a table. +Swap with anything in target cell." + (interactive) + (unless (org-table-check-inside-data-field) + (error "No table at point")) + (org-table--move-cell 'right) + (org-table-align)) + +;;;###autoload +(defun org-table-delete-column () + "Delete a column from the table." + (interactive) + (unless (org-at-table-p) (user-error "Not at a table")) + (org-table-find-dataline) + (when (save-excursion (skip-chars-forward " \t") (eolp)) + (search-backward "|")) ;snap into last column + (org-table-check-inside-data-field nil t) + (let* ((col (org-table-current-column)) + (beg (org-table-begin)) + (end (copy-marker (org-table-end))) + (shrunk-columns (remq col (org-table--list-shrunk-columns)))) + (org-table-expand beg end) + (org-table-save-field + (goto-char beg) + (while (< (point) end) + (if (org-at-table-hline-p) + nil + (org-table-goto-column col t) + (and (looking-at "|[^|\n]+|") + (replace-match "|"))) + (forward-line))) + (org-table-align) + ;; Shift appropriately stored shrunk column numbers, then hide the + ;; columns again. + (org-table--shrink-columns (mapcar (lambda (c) (if (< c col) c (1- c))) + shrunk-columns) + beg end) + (set-marker end nil) + ;; Fix TBLFM formulas, if desirable. + (when (or (not org-table-fix-formulas-confirm) + (funcall org-table-fix-formulas-confirm "Fix formulas? ")) + (org-table-fix-formulas + "$" (list (cons (number-to-string col) "INVALID")) col -1 col)))) + +;;;###autoload +(defun org-table-move-column-right () + "Move column to the right." + (interactive) + (org-table-move-column nil)) + +;;;###autoload +(defun org-table-move-column-left () + "Move column to the left." + (interactive) + (org-table-move-column 'left)) + +;;;###autoload +(defun org-table-move-column (&optional left) + "Move the current column to the right. With arg LEFT, move to the left." + (interactive "P") + (unless (org-at-table-p) (user-error "Not at a table")) + (org-table-find-dataline) + (org-table-check-inside-data-field nil t) + (let* ((col (org-table-current-column)) + (col1 (if left (1- col) col)) + (colpos (if left (1- col) (1+ col))) + (beg (org-table-begin)) + (end (copy-marker (org-table-end)))) + (when (and left (= col 1)) + (user-error "Cannot move column further left")) + (when (and (not left) (looking-at "[^|\n]*|[^|\n]*$")) + (user-error "Cannot move column further right")) + (let ((shrunk-columns (org-table--list-shrunk-columns))) + (org-table-expand beg end) + (org-table-save-field + (goto-char beg) + (while (< (point) end) + (unless (org-at-table-hline-p) + (org-table-goto-column col1 t) + (when (looking-at "|\\([^|\n]+\\)|\\([^|\n]+\\)|") + (transpose-regions + (match-beginning 1) (match-end 1) + (match-beginning 2) (match-end 2)))) + (forward-line))) + (org-table-goto-column colpos) + (org-table-align) + ;; Shift appropriately stored shrunk column numbers, then shrink + ;; the columns again. + (org-table--shrink-columns + (mapcar (lambda (c) + (cond ((and (= col c) left) (1- c)) + ((= col c) (1+ c)) + ((and (= col (1+ c)) left) (1+ c)) + ((and (= col (1- c)) (not left) (1- c))) + (t c))) + shrunk-columns) + beg end) + (set-marker end nil) + ;; Fix TBLFM formulas, if desirable. + (when (or (not org-table-fix-formulas-confirm) + (funcall org-table-fix-formulas-confirm "Fix formulas? ")) + (org-table-fix-formulas + "$" (list (cons (number-to-string col) (number-to-string colpos)) + (cons (number-to-string colpos) (number-to-string col)))))))) + +;;;###autoload +(defun org-table-move-row-down () + "Move table row down." + (interactive) + (org-table-move-row nil)) + +;;;###autoload +(defun org-table-move-row-up () + "Move table row up." + (interactive) + (org-table-move-row 'up)) + +;;;###autoload +(defun org-table-move-row (&optional up) + "Move the current table line down. With arg UP, move it up." + (interactive "P") + (let* ((col (current-column)) + (pos (point)) + (hline1p (save-excursion (beginning-of-line 1) + (looking-at org-table-hline-regexp))) + (dline1 (org-table-current-dline)) + (dline2 (+ dline1 (if up -1 1))) + (tonew (if up 0 2)) + hline2p) + (when (and up (= (point-min) (line-beginning-position))) + (user-error "Cannot move row further")) + (beginning-of-line tonew) + (when (or (and (not up) (eobp)) (not (org-at-table-p))) + (goto-char pos) + (user-error "Cannot move row further")) + (org-table-with-shrunk-columns + (setq hline2p (looking-at org-table-hline-regexp)) + (goto-char pos) + (let ((row (delete-and-extract-region (line-beginning-position) + (line-beginning-position 2)))) + (beginning-of-line tonew) + (unless (bolp) (insert "\n")) ;at eob without a newline + (insert row) + (unless (bolp) (insert "\n")) ;missing final newline in ROW + (beginning-of-line 0) + (org-move-to-column col) + (unless (or hline1p hline2p + (not (or (not org-table-fix-formulas-confirm) + (funcall org-table-fix-formulas-confirm + "Fix formulas? ")))) + (org-table-fix-formulas + "@" (list + (cons (number-to-string dline1) (number-to-string dline2)) + (cons (number-to-string dline2) (number-to-string dline1))))))))) + +;;;###autoload +(defun org-table-insert-row (&optional arg) + "Insert a new row above the current line into the table. +With prefix ARG, insert below the current line." + (interactive "P") + (unless (org-at-table-p) (user-error "Not at a table")) + (org-table-with-shrunk-columns + (let* ((line (buffer-substring (line-beginning-position) (line-end-position))) + (new (org-table-clean-line line))) + ;; Fix the first field if necessary + (when (string-match "^[ \t]*| *[#*$] *|" line) + (setq new (replace-match (match-string 0 line) t t new))) + (beginning-of-line (if arg 2 1)) + ;; Buffer may not end of a newline character, so ensure + ;; (beginning-of-line 2) moves point to a new line. + (unless (bolp) (insert "\n")) + (let (org-table-may-need-update) (insert-before-markers new "\n")) + (beginning-of-line 0) + (re-search-forward "| ?" (line-end-position) t) + (when (or org-table-may-need-update org-table-overlay-coordinates) + (org-table-align)) + (when (or (not org-table-fix-formulas-confirm) + (funcall org-table-fix-formulas-confirm "Fix formulas? ")) + (org-table-fix-formulas "@" nil (1- (org-table-current-dline)) 1))))) + +;;;###autoload +(defun org-table-insert-hline (&optional above) + "Insert a horizontal-line below the current line into the table. +With prefix ABOVE, insert above the current line." + (interactive "P") + (unless (org-at-table-p) (user-error "Not at a table")) + (when (eobp) (save-excursion (insert "\n"))) + (unless (string-match-p "|[ \t]*$" (org-current-line-string)) + (org-table-align)) + (org-table-with-shrunk-columns + (let ((line (org-table-clean-line + (buffer-substring (point-at-bol) (point-at-eol)))) + (col (current-column))) + (while (string-match "|\\( +\\)|" line) + (setq line (replace-match + (concat "+" (make-string (- (match-end 1) (match-beginning 1)) + ?-) "|") t t line))) + (and (string-match "\\+" line) (setq line (replace-match "|" t t line))) + (beginning-of-line (if above 1 2)) + (insert line "\n") + (beginning-of-line (if above 1 -1)) + (org-move-to-column col) + (when org-table-overlay-coordinates (org-table-align))))) + +;;;###autoload +(defun org-table-hline-and-move (&optional same-column) + "Insert a hline and move to the row below that line." + (interactive "P") + (let ((col (org-table-current-column))) + (org-table-maybe-eval-formula) + (org-table-maybe-recalculate-line) + (org-table-insert-hline) + (end-of-line 2) + (if (looking-at "\n[ \t]*|-") + (progn (insert "\n|") (org-table-align)) + (org-table-next-field)) + (if same-column (org-table-goto-column col)))) + +(defun org-table-clean-line (s) + "Convert a table line S into a string with only \"|\" and space. +In particular, this does handle wide and invisible characters." + (if (string-match "^[ \t]*|-" s) + ;; It's a hline, just map the characters + (setq s (mapconcat (lambda (x) (if (member x '(?| ?+)) "|" " ")) s "")) + (while (string-match "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|" s) + (setq s (replace-match + (concat "|" (make-string (org-string-width (match-string 1 s)) + ?\ ) "|") + t t s))) + s)) + +;;;###autoload +(defun org-table-kill-row () + "Delete the current row or horizontal line from the table." + (interactive) + (unless (org-at-table-p) (user-error "Not at a table")) + (let ((col (current-column)) + (dline (and (not (org-match-line org-table-hline-regexp)) + (org-table-current-dline)))) + (org-table-with-shrunk-columns + (kill-region (point-at-bol) (min (1+ (point-at-eol)) (point-max))) + (if (not (org-at-table-p)) (beginning-of-line 0)) + (org-move-to-column col) + (when (and dline + (or (not org-table-fix-formulas-confirm) + (funcall org-table-fix-formulas-confirm "Fix formulas? "))) + (org-table-fix-formulas + "@" (list (cons (number-to-string dline) "INVALID")) dline -1 dline))))) + +;;;###autoload +(defun org-table-cut-region (beg end) + "Copy region in table to the clipboard and blank all relevant fields. +If there is no active region, use just the field at point." + (interactive (list + (if (org-region-active-p) (region-beginning) (point)) + (if (org-region-active-p) (region-end) (point)))) + (org-table-copy-region beg end 'cut)) + +(defun org-table--increment-field (field previous) + "Increment string FIELD according to PREVIOUS field. + +Increment FIELD only if it is a string representing a number, per +Emacs Lisp syntax, a timestamp, or is either prefixed or suffixed +with a number. In any other case, return FIELD as-is. + +If PREVIOUS has the same structure as FIELD, e.g., +a number-prefixed string with the same pattern, the increment +step is the difference between numbers (or timestamps, measured +in days) in PREVIOUS and FIELD. Otherwise, it uses +`org-table-copy-increment', if the variable contains a number, or +default to 1. + +The function assumes `org-table-copy-increment' is non-nil." + (let* ((default-step (if (numberp org-table-copy-increment) + org-table-copy-increment + 1)) + (number-regexp ;Lisp read syntax for numbers + (rx (and string-start + (opt (any "+-")) + (or (and (one-or-more digit) (opt ".")) + (and (zero-or-more digit) "." (one-or-more digit))) + (opt (any "eE") (opt (opt (any "+-")) (one-or-more digit))) + string-end))) + (number-prefix-regexp (rx (and string-start (one-or-more digit)))) + (number-suffix-regexp (rx (and (one-or-more digit) string-end))) + (analyze + (lambda (field) + ;; Analyze string FIELD and return information related to + ;; increment or nil. When non-nil, return value has the + ;; following scheme: (TYPE VALUE PATTERN) where + ;; - TYPE is a symbol among `number', `prefix', `suffix' + ;; and `timestamp', + ;; - VALUE is a timestamp if TYPE is `timestamp', or + ;; a number otherwise, + ;; - PATTERN is the field without its prefix, or suffix if + ;; TYPE is either `prefix' or `suffix' , or nil + ;; otherwise. + (cond ((not (org-string-nw-p field)) nil) + ((string-match-p number-regexp field) + (list 'number + (string-to-number field) + nil)) + ((string-match number-prefix-regexp field) + (list 'prefix + (string-to-number (match-string 0 field)) + (substring field (match-end 0)))) + ((string-match number-suffix-regexp field) + (list 'suffix + (string-to-number (match-string 0 field)) + (substring field 0 (match-beginning 0)))) + ((string-match-p org-ts-regexp3 field) + (list 'timestamp field nil)) + (t nil)))) + (next-number-string + (lambda (n1 &optional n2) + ;; Increment number N1 and return it as a string. If N2 + ;; is also a number, deduce increment step from the + ;; difference between N1 and N2. Otherwise, increment + ;; step is `default-step'. + (number-to-string (if n2 (+ n1 (- n1 n2)) (+ n1 default-step))))) + (shift-timestamp + (lambda (t1 &optional t2) + ;; Increment timestamp T1 and return it. If T2 is also + ;; a timestamp, deduce increment step from the difference, + ;; in days, between T1 and T2. Otherwise, increment by + ;; `default-step' days. + (with-temp-buffer + (insert t1) + (org-timestamp-up-day (if (not t2) default-step + (- (org-time-string-to-absolute t1) + (org-time-string-to-absolute t2)))) + (buffer-string))))) + ;; Check if both PREVIOUS and FIELD have the same type. Also, if + ;; the case of prefixed or suffixed numbers, make sure their + ;; pattern, i.e., the part of the string without the prefix or the + ;; suffix, is the same. + (pcase (cons (funcall analyze field) (funcall analyze previous)) + (`((number ,n1 ,_) . (number ,n2 ,_)) + (funcall next-number-string n1 n2)) + (`((number ,n ,_) . ,_) + (funcall next-number-string n)) + (`((prefix ,n1 ,p1) . (prefix ,n2 ,p2)) + (concat (funcall next-number-string n1 (and (equal p1 p2) n2)) p1)) + (`((prefix ,n ,p) . ,_) + (concat (funcall next-number-string n) p)) + (`((suffix ,n1 ,p1) . (suffix ,n2 ,p2)) + (concat p1 (funcall next-number-string n1 (and (equal p1 p2) n2)))) + (`((suffix ,n ,p) . ,_) + (concat p (funcall next-number-string n))) + (`((timestamp ,t1 ,_) . (timestamp ,t2 ,_)) + (funcall shift-timestamp t1 t2)) + (`((timestamp ,t1 ,_) . ,_) + (funcall shift-timestamp t1)) + (_ field)))) + +;;;###autoload +(defun org-table-copy-down (n) + "Copy the value of the current field one row below. + +If the field at the cursor is empty, copy the content of the +nearest non-empty field above. With argument N, use the Nth +non-empty field. + +If the current field is not empty, it is copied down to the next +row, and the cursor is moved with it. Therefore, repeating this +command causes the column to be filled row-by-row. + +If the variable `org-table-copy-increment' is non-nil and the +field is a number, a timestamp, or is either prefixed or suffixed +with a number, it will be incremented while copying. By default, +increment by the difference between the value in the current +field and the one in the field above, if any. To increment using +a fixed integer, set `org-table-copy-increment' to a number. In +the case of a timestamp, increment by days. + +However, when N is 0, do not increment the field at all." + (interactive "p") + (org-table-check-inside-data-field) + (let* ((beg (org-table-begin)) + (column (org-table-current-column)) + (initial-field (save-excursion + (let ((f (org-string-nw-p (org-table-get-field)))) + (and f (org-trim f))))) + field field-above next-field) + (save-excursion + ;; Get reference field. + (if initial-field (setq field initial-field) + (beginning-of-line) + (setq field + (catch :exit + (while (re-search-backward org-table-dataline-regexp beg t) + (let ((f (org-string-nw-p (org-table-get-field column)))) + (cond ((and (> n 1) f) (cl-decf n)) + (f (throw :exit (org-trim f))) + (t nil)) + (beginning-of-line))) + (user-error "No non-empty field found")))) + ;; Check if increment is appropriate, and how it should be done. + (when (and org-table-copy-increment (/= n 0)) + ;; If increment step is not explicit, get non-empty field just + ;; above the field being incremented to guess it. + (unless (numberp org-table-copy-increment) + (setq field-above + (let ((f (unless (= beg (line-beginning-position)) + (forward-line -1) + (not (org-at-table-hline-p)) + (org-table-get-field column)))) + (and (org-string-nw-p f) + (org-trim f))))) + ;; Compute next field. + (setq next-field (org-table--increment-field field field-above)))) + ;; Since initial field in not empty, we modify row below instead. + ;; Skip alignment since we do it at the end of the process anyway. + (when initial-field + (let ((org-table-may-need-update nil)) (org-table-next-row)) + (org-table-blank-field)) + ;; Insert the new field. NEW-FIELD may be nil if + ;; `org-table-increment' is nil, or N = 0. In that case, copy + ;; FIELD. + (insert (or next-field field)) + (org-table-maybe-recalculate-line) + (org-table-align))) + +;;;###autoload +(defun org-table-copy-region (beg end &optional cut) + "Copy rectangular region in table to clipboard. +A special clipboard is used which can only be accessed with +`org-table-paste-rectangle'. Return the region copied, as a list +of lists of fields." + (interactive (list + (if (org-region-active-p) (region-beginning) (point)) + (if (org-region-active-p) (region-end) (point)) + current-prefix-arg)) + (goto-char (min beg end)) + (org-table-check-inside-data-field) + (let ((beg (line-beginning-position)) + (c01 (org-table-current-column)) + region) + (goto-char (max beg end)) + (org-table-check-inside-data-field nil t) + (let* ((end (copy-marker (line-end-position))) + (c02 (org-table-current-column)) + (column-start (min c01 c02)) + (column-end (max c01 c02)) + (column-number (1+ (- column-end column-start))) + (rpl (and cut " "))) + (goto-char beg) + (while (< (point) end) + (unless (org-at-table-hline-p) + ;; Collect every cell between COLUMN-START and COLUMN-END. + (let (cols) + (dotimes (c column-number) + (push (org-table-get-field (+ c column-start) rpl) cols)) + (push (nreverse cols) region))) + (forward-line)) + (set-marker end nil)) + (when cut (org-table-align)) + (when (called-interactively-p 'any) + (message (substitute-command-keys "Cells in the region copied, use \ +\\[org-table-paste-rectangle] to paste them in a table."))) + (setq org-table-clip (nreverse region)))) + +;;;###autoload +(defun org-table-paste-rectangle () + "Paste a rectangular region into a table. +The upper right corner ends up in the current field. All involved fields +will be overwritten. If the rectangle does not fit into the present table, +the table is enlarged as needed. The process ignores horizontal separator +lines." + (interactive) + (unless (consp org-table-clip) + (user-error "First cut/copy a region to paste!")) + (org-table-check-inside-data-field) + (let* ((column (org-table-current-column)) + (org-table-automatic-realign nil)) + (org-table-save-field + (dolist (row org-table-clip) + (while (org-at-table-hline-p) (forward-line)) + ;; If we left the table, create a new row. + (when (and (bolp) (not (looking-at "[ \t]*|"))) + (end-of-line 0) + (org-table-next-field)) + (let ((c column)) + (dolist (field row) + (org-table-goto-column c nil 'force) + (org-table-get-field nil field) + (cl-incf c))) + (forward-line))) + (org-table-align))) + + +;;; Follow Field minor mode + +(define-minor-mode org-table-follow-field-mode + "Minor mode to make the table field editor window follow the cursor. +When this mode is active, the field editor window will always show the +current field. The mode exits automatically when the cursor leaves the +table (but see `org-table-exit-follow-field-mode-when-leaving-table')." + :lighter " TblFollow" + (if org-table-follow-field-mode + (add-hook 'post-command-hook 'org-table-follow-fields-with-editor + 'append 'local) + (remove-hook 'post-command-hook 'org-table-follow-fields-with-editor 'local) + (let* ((buf (get-buffer "*Org Table Edit Field*")) + (win (and buf (get-buffer-window buf)))) + (when win (delete-window win)) + (when buf + (with-current-buffer buf + (move-marker org-field-marker nil)) + (kill-buffer buf))))) + +;;;###autoload +(defun org-table-edit-field (arg) + "Edit table field in a different window. +This is mainly useful for fields that contain hidden parts. + +When called with a `\\[universal-argument]' prefix, just make the full field +visible so that it can be edited in place. + +When called with a `\\[universal-argument] \\[universal-argument]' prefix, \ +toggle `org-table-follow-field-mode'." + (interactive "P") + (unless (org-at-table-p) (user-error "Not at a table")) + (cond + ((equal arg '(16)) + (org-table-follow-field-mode (if org-table-follow-field-mode -1 1))) + (arg + (let ((b (save-excursion (skip-chars-backward "^|") (point))) + (e (save-excursion (skip-chars-forward "^|\r\n") (point)))) + (remove-text-properties b e '(invisible t intangible t)) + (if font-lock-mode + (font-lock-fontify-block)))) + (t + (let ((pos (point-marker)) + (coord + (if (eq org-table-use-standard-references t) + (concat (org-number-to-letters (org-table-current-column)) + (number-to-string (org-table-current-dline))) + (concat "@" (number-to-string (org-table-current-dline)) + "$" (number-to-string (org-table-current-column))))) + (field (org-table-get-field)) + (cw (current-window-configuration)) + p) + (goto-char pos) + (org-switch-to-buffer-other-window "*Org Table Edit Field*") + (when (and (local-variable-p 'org-field-marker) + (markerp org-field-marker)) + (move-marker org-field-marker nil)) + (erase-buffer) + (insert "#\n# Edit field " coord " and finish with C-c C-c\n#\n") + (let ((org-inhibit-startup t)) (org-mode)) + (auto-fill-mode -1) + (setq truncate-lines nil) + (setq word-wrap t) + (goto-char (setq p (point-max))) + (insert (org-trim field)) + (remove-text-properties p (point-max) '(invisible t intangible t)) + (goto-char p) + (setq-local org-finish-function 'org-table-finish-edit-field) + (setq-local org-window-configuration cw) + (setq-local org-field-marker pos) + (message "Edit and finish with C-c C-c"))))) + +(defun org-table-follow-fields-with-editor () + (if (and org-table-exit-follow-field-mode-when-leaving-table + (not (org-at-table-p))) + ;; We have left the table, exit the follow mode + (org-table-follow-field-mode -1) + (when (org-table-check-inside-data-field 'noerror) + (let ((win (selected-window))) + (org-table-edit-field nil) + (org-fit-window-to-buffer) + (select-window win))))) + +(defun org-table-finish-edit-field () + "Finish editing a table data field. +Remove all newline characters, insert the result into the table, realign +the table and kill the editing buffer." + (let ((pos org-field-marker) + (cw org-window-configuration) + (cb (current-buffer)) + text) + (goto-char (point-min)) + (while (re-search-forward "^#.*\n?" nil t) (replace-match "")) + (while (re-search-forward "[ \t]*\n[ \t\n]*" nil t) + (replace-match " ")) + (setq text (org-trim (buffer-string))) + (set-window-configuration cw) + (kill-buffer cb) + (select-window (get-buffer-window (marker-buffer pos))) + (goto-char pos) + (move-marker pos nil) + (org-table-check-inside-data-field) + (org-table-get-field nil text) + (org-table-align) + (message "New field value inserted"))) + + +;;; Formulas + +(defun org-table-current-field-formula (&optional key noerror) + "Return the formula active for the current field. + +Assumes that table is already analyzed. If KEY is given, return +the key to this formula. Otherwise return the formula preceded +with \"=\" or \":=\"." + (let* ((line (count-lines org-table-current-begin-pos + (line-beginning-position))) + (row (org-table-line-to-dline line))) + (cond + (row + (let* ((col (org-table-current-column)) + (name (car (rassoc (list line col) + org-table-named-field-locations))) + (scol (format "$%d" col)) + (ref (format "@%d$%d" (org-table-current-dline) col)) + (stored-list (org-table-get-stored-formulas noerror)) + (ass (or (assoc name stored-list) + (assoc ref stored-list) + (assoc scol stored-list)))) + (cond (key (car ass)) + (ass (concat (if (string-match-p "^[0-9]+$" (car ass)) "=" ":=") + (cdr ass)))))) + (noerror nil) + (t (error "No formula active for the current field"))))) + +(defun org-table-get-formula (&optional equation named) + "Read a formula from the minibuffer, offer stored formula as default. +When NAMED is non-nil, look for a named equation." + (let* ((stored-list (org-table-get-stored-formulas)) + (name (car (rassoc (list (count-lines org-table-current-begin-pos + (line-beginning-position)) + (org-table-current-column)) + org-table-named-field-locations))) + (ref (format "@%d$%d" + (org-table-current-dline) + (org-table-current-column))) + (scol (cond + ((not named) (format "$%d" (org-table-current-column))) + (name) + (t ref))) + (name (or name ref)) + (org-table-may-need-update nil) + (stored (cdr (assoc scol stored-list))) + (eq (cond + ((and stored equation (string-match-p "^ *=? *$" equation)) + stored) + ((stringp equation) equation) + (t + (org-table-formula-from-user + (read-string + (org-table-formula-to-user + (format "%s formula %s=" (if named "Field" "Column") scol)) + (if stored (org-table-formula-to-user stored) "") + 'org-table-formula-history))))) + mustsave) + (unless (org-string-nw-p eq) + ;; Remove formula. + (setq stored-list (delq (assoc scol stored-list) stored-list)) + (org-table-store-formulas stored-list) + (user-error "Formula removed")) + (when (string-match "^ *=?" eq) (setq eq (replace-match "" t t eq))) + (when (string-match " *$" eq) (setq eq (replace-match "" t t eq))) + (when (and name (not named)) + ;; We set the column equation, delete the named one. + (setq stored-list (delq (assoc name stored-list) stored-list) + mustsave t)) + (if stored + (setcdr (assoc scol stored-list) eq) + (setq stored-list (cons (cons scol eq) stored-list))) + (when (or mustsave (not (equal stored eq))) + (org-table-store-formulas stored-list)) + eq)) + +(defun org-table-store-formulas (alist &optional location) + "Store the list of formulas below the current table. +If optional argument LOCATION is a buffer position, insert it at +LOCATION instead." + (save-excursion + (if location + (progn (goto-char location) (beginning-of-line)) + (goto-char (org-table-end))) + (let ((case-fold-search t)) + (if (looking-at "\\([ \t]*\n\\)*[ \t]*\\(#\\+TBLFM:\\)\\(.*\n?\\)") + (progn + ;; Don't overwrite TBLFM, we might use text properties to + ;; store stuff. + (goto-char (match-beginning 3)) + (delete-region (match-beginning 3) (match-end 0))) + (org-indent-line) + (insert "#+TBLFM:")) + (insert " " + (mapconcat (lambda (x) (concat (car x) "=" (cdr x))) + (sort alist #'org-table-formula-less-p) + "::") + "\n")))) + +(defsubst org-table-formula-make-cmp-string (a) + (when (string-match "\\`\\$[<>]" a) + (let ((arrow (string-to-char (substring a 1)))) + ;; Fake a high number to make sure this is sorted at the end. + (setq a (org-table-formula-handle-first/last-rc a)) + (setq a (format "$%d" (+ 10000 + (if (= arrow ?<) -1000 0) + (string-to-number (substring a 1))))))) + (when (string-match + "^\\(@\\([0-9]+\\)\\)?\\(\\$?\\([0-9]+\\)\\)?\\(\\$?[a-zA-Z0-9]+\\)?" + a) + (concat + (if (match-end 2) + (format "@%05d" (string-to-number (match-string 2 a))) "") + (if (match-end 4) + (format "$%05d" (string-to-number (match-string 4 a))) "") + (if (match-end 5) + (concat "@@" (match-string 5 a)))))) + +(defun org-table-formula-less-p (a b) + "Compare two formulas for sorting." + (let ((as (org-table-formula-make-cmp-string (car a))) + (bs (org-table-formula-make-cmp-string (car b)))) + (and as bs (string< as bs)))) + +;;;###autoload +(defun org-table-get-stored-formulas (&optional noerror location) + "Return an alist with the stored formulas directly after current table. +By default, only return active formulas, i.e., formulas located +on the first line after the table. However, if optional argument +LOCATION is a buffer position, consider the formulas there." + (save-excursion + (if location + (progn (goto-char location) (beginning-of-line)) + (goto-char (org-table-end))) + (let ((case-fold-search t)) + (when (looking-at "\\([ \t]*\n\\)*[ \t]*#\\+TBLFM: *\\(.*\\)") + (let ((strings (org-split-string (match-string-no-properties 2) + " *:: *")) + eq-alist seen) + (dolist (string strings (nreverse eq-alist)) + (when (string-match "\\`\\(@[-+I<>0-9.$@]+\\|\\$\\([_a-zA-Z0-9]+\\|\ +\[<>]+\\)\\) *= *\\(.*[^ \t]\\)" + string) + (let ((lhs + (let ((m (match-string 1 string))) + (cond + ((not (match-end 2)) m) + ;; Is it a column reference? + ((string-match-p "\\`\\$\\([0-9]+\\|[<>]+\\)\\'" m) m) + ;; Since named columns are not possible in + ;; LHS, assume this is a named field. + (t (match-string 2 string))))) + (rhs (match-string 3 string))) + (push (cons lhs rhs) eq-alist) + (cond + ((not (member lhs seen)) (push lhs seen)) + (noerror + (message + "Double definition `%s=' in TBLFM line, please fix by hand" + lhs) + (ding) + (sit-for 2)) + (t + (user-error + "Double definition `%s=' in TBLFM line, please fix by hand" + lhs))))))))))) + +(defun org-table-fix-formulas (key replace &optional limit delta remove) + "Modify the equations after the table structure has been edited. +KEY is \"@\" or \"$\". REPLACE is an alist of numbers to replace. +For all numbers larger than LIMIT, shift them by DELTA." + (save-excursion + (goto-char (org-table-end)) + (while (let ((case-fold-search t)) (looking-at "[ \t]*#\\+tblfm:")) + (let ((re (concat key "\\([0-9]+\\)")) + (re2 + (when remove + (if (equal key "$") + (format "\\(@[0-9]+\\)?%s%d=.*?\\(::\\|$\\)" + (regexp-quote key) remove) + (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove)))) + s n a) + (when remove + (while (re-search-forward re2 (point-at-eol) t) + (unless (save-match-data (org-in-regexp "remote([^)]+?)")) + (if (equal (char-before (match-beginning 0)) ?.) + (user-error + "Change makes TBLFM term %s invalid, use undo to recover" + (match-string 0)) + (replace-match ""))))) + (while (re-search-forward re (point-at-eol) t) + (unless (save-match-data (org-in-regexp "remote([^)]+?)")) + (setq s (match-string 1) n (string-to-number s)) + (cond + ((setq a (assoc s replace)) + (replace-match (concat key (cdr a)) t t)) + ((and limit (> n limit)) + (replace-match (concat key (number-to-string (+ n delta))) t t))))) + (message "The formulas in #+TBLFM have been updated")) + (forward-line)))) + +;;;###autoload +(defun org-table-maybe-eval-formula () + "Check if the current field starts with \"=\" or \":=\". +If yes, store the formula and apply it." + ;; We already know we are in a table. Get field will only return a formula + ;; when appropriate. It might return a separator line, but no problem. + (when org-table-formula-evaluate-inline + (let* ((field (org-trim (or (org-table-get-field) ""))) + named eq) + (when (string-match "^:?=\\(.*[^=]\\)$" field) + (setq named (equal (string-to-char field) ?:) + eq (match-string 1 field)) + (org-table-eval-formula (and named '(4)) + (org-table-formula-from-user eq)))))) + +;;;###autoload +(defun org-table-rotate-recalc-marks (&optional newchar) + "Rotate the recalculation mark in the first column. +If in any row, the first field is not consistent with a mark, +insert a new column for the markers. +When there is an active region, change all the lines in the region, +after prompting for the marking character. +After each change, a message will be displayed indicating the meaning +of the new mark." + (interactive) + (unless (org-at-table-p) (user-error "Not at a table")) + (let* ((region (org-region-active-p)) + (l1 (and region + (save-excursion (goto-char (region-beginning)) + (copy-marker (line-beginning-position))))) + (l2 (and region + (save-excursion (goto-char (region-end)) + (copy-marker (line-beginning-position))))) + (l (copy-marker (line-beginning-position))) + (col (org-table-current-column)) + (newchar (if region + (char-to-string + (read-char-exclusive + "Change region to what mark? Type # * ! $ or SPC: ")) + newchar)) + (no-special-column + (save-excursion + (goto-char (org-table-begin)) + (re-search-forward + "^[ \t]*|[^-|][^|]*[^#!$*_^| \t][^|]*|" (org-table-end) t)))) + (when (and newchar (not (assoc newchar org-recalc-marks))) + (user-error "Invalid character `%s' in `org-table-rotate-recalc-marks'" + newchar)) + (when l1 (goto-char l1)) + (save-excursion + (beginning-of-line) + (unless (looking-at org-table-dataline-regexp) + (user-error "Not at a table data line"))) + (when no-special-column + (org-table-goto-column 1) + (org-table-insert-column)) + (let ((previous-line-end (line-end-position)) + (newchar + (save-excursion + (beginning-of-line) + (cond ((not (looking-at "^[ \t]*| *\\([#!$*^_ ]\\) *|")) "#") + (newchar) + (t (cadr (member (match-string 1) + (append (mapcar #'car org-recalc-marks) + '(" "))))))))) + ;; Rotate mark in first row. + (org-table-get-field 1 (format " %s " newchar)) + ;; Rotate marks in additional rows if a region is active. + (when region + (save-excursion + (forward-line) + (while (<= (point) l2) + (when (looking-at org-table-dataline-regexp) + (org-table-get-field 1 (format " %s " newchar))) + (forward-line)))) + ;; Only align if rotation actually changed lines' length. + (when (/= previous-line-end (line-end-position)) (org-table-align))) + (goto-char l) + (org-table-goto-column (if no-special-column (1+ col) col)) + (when l1 (set-marker l1 nil)) + (when l2 (set-marker l2 nil)) + (set-marker l nil) + (when (called-interactively-p 'interactive) + (message "%s" (cdr (assoc newchar org-recalc-marks)))))) + +;;;###autoload +(defun org-table-maybe-recalculate-line () + "Recompute the current line if marked for it, and if we haven't just done it." + (interactive) + (and org-table-allow-automatic-line-recalculation + (not (and (memq last-command org-recalc-commands) + (eq org-last-recalc-line (line-beginning-position)))) + (save-excursion (beginning-of-line 1) + (looking-at org-table-auto-recalculate-regexp)) + (org-table-recalculate) t)) + +;;;###autoload +(defun org-table-eval-formula (&optional arg equation + suppress-align suppress-const + suppress-store suppress-analysis) + "Replace the table field value at the cursor by the result of a calculation. + +In a table, this command replaces the value in the current field with the +result of a formula. It also installs the formula as the \"current\" column +formula, by storing it in a special line below the table. When called +with a `\\[universal-argument]' prefix the formula is installed as a \ +field formula. + +When called with a `\\[universal-argument] \\[universal-argument]' prefix, \ +insert the active equation for the field +back into the current field, so that it can be edited there. This is \ +useful +in order to use \\<org-table-fedit-map>`\\[org-table-show-reference]' to \ +check the referenced fields. + +When called, the command first prompts for a formula, which is read in +the minibuffer. Previously entered formulas are available through the +history list, and the last used formula is offered as a default. +These stored formulas are adapted correctly when moving, inserting, or +deleting columns with the corresponding commands. + +The formula can be any algebraic expression understood by the Calc package. +For details, see the Org mode manual. + +This function can also be called from Lisp programs and offers +additional arguments: EQUATION can be the formula to apply. If this +argument is given, the user will not be prompted. + +SUPPRESS-ALIGN is used to speed-up recursive calls by by-passing +unnecessary aligns. + +SUPPRESS-CONST suppresses the interpretation of constants in the +formula, assuming that this has been done already outside the +function. + +SUPPRESS-STORE means the formula should not be stored, either +because it is already stored, or because it is a modified +equation that should not overwrite the stored one. + +SUPPRESS-ANALYSIS prevents analyzing the table and checking +location of point." + (interactive "P") + (unless suppress-analysis + (org-table-check-inside-data-field nil t) + (org-table-analyze)) + (if (equal arg '(16)) + (let ((eq (org-table-current-field-formula))) + (org-table-get-field nil eq) + (org-table-align) + (setq org-table-may-need-update t)) + (let* (fields + (ndown (if (integerp arg) arg 1)) + (org-table-automatic-realign nil) + (case-fold-search nil) + (down (> ndown 1)) + (formula (if (and equation suppress-store) + equation + (org-table-get-formula equation (equal arg '(4))))) + (n0 (org-table-current-column)) + (calc-modes (copy-sequence org-calc-default-modes)) + (numbers nil) ; was a variable, now fixed default + (keep-empty nil) + form form0 formrpl formrg bw fmt ev orig lispp literal + duration duration-output-format) + ;; Parse the format string. Since we have a lot of modes, this is + ;; a lot of work. However, I think calc still uses most of the time. + (if (string-match "\\(.*\\);\\(.*\\)" formula) + (progn + (setq fmt (concat (cdr (assoc "%" org-table-local-parameters)) + (match-string-no-properties 2 formula))) + (setq formula (match-string-no-properties 1 formula)) + (while (string-match "\\([pnfse]\\)\\(-?[0-9]+\\)" fmt) + (let ((c (string-to-char (match-string 1 fmt))) + (n (string-to-number (match-string 2 fmt)))) + (cl-case c + (?p (setf (cl-getf calc-modes 'calc-internal-prec) n)) + (?n (setf (cl-getf calc-modes 'calc-float-format) (list 'float n))) + (?f (setf (cl-getf calc-modes 'calc-float-format) (list 'fix n))) + (?s (setf (cl-getf calc-modes 'calc-float-format) (list 'sci n))) + (?e (setf (cl-getf calc-modes 'calc-float-format) (list 'eng n))))) + ;; Remove matched flags from the mode string. + (setq fmt (replace-match "" t t fmt))) + (while (string-match "\\([tTUNLEDRFSu]\\)" fmt) + (let ((c (string-to-char (match-string 1 fmt)))) + (cl-case c + (?t (setq duration t numbers t + duration-output-format org-table-duration-custom-format)) + (?T (setq duration t numbers t duration-output-format nil)) + (?U (setq duration t numbers t duration-output-format 'hh:mm)) + (?N (setq numbers t)) + (?L (setq literal t)) + (?E (setq keep-empty t)) + (?D (setf (cl-getf calc-modes 'calc-angle-mode) 'deg)) + (?R (setf (cl-getf calc-modes 'calc-angle-mode) 'rad)) + (?F (setf (cl-getf calc-modes 'calc-prefer-frac) t)) + (?S (setf (cl-getf calc-modes 'calc-symbolic-mode) t)) + (?u (setf (cl-getf calc-modes 'calc-simplify-mode) 'units)))) + ;; Remove matched flags from the mode string. + (setq fmt (replace-match "" t t fmt))) + (unless (string-match "\\S-" fmt) + (setq fmt nil)))) + (when (and (not suppress-const) org-table-formula-use-constants) + (setq formula (org-table-formula-substitute-names formula))) + (setq orig (or (get-text-property 1 :orig-formula formula) "?")) + (setq formula (org-table-formula-handle-first/last-rc formula)) + (while (> ndown 0) + (setq fields (org-split-string + (org-trim + (buffer-substring-no-properties + (line-beginning-position) (line-end-position))) + " *| *")) + ;; replace fields with duration values if relevant + (if duration + (setq fields + (mapcar (lambda (x) (org-table-time-string-to-seconds x)) + fields))) + (if (eq numbers t) + (setq fields (mapcar + (lambda (x) + (if (string-match "\\S-" x) + (number-to-string (string-to-number x)) + x)) + fields))) + (setq ndown (1- ndown)) + (setq form (copy-sequence formula) + lispp (and (> (length form) 2) (equal (substring form 0 2) "'("))) + (if (and lispp literal) (setq lispp 'literal)) + + ;; Insert row and column number of formula result field + (while (string-match "[@$]#" form) + (setq form + (replace-match + (format "%d" + (save-match-data + (if (equal (substring form (match-beginning 0) + (1+ (match-beginning 0))) + "@") + (org-table-current-dline) + (org-table-current-column)))) + t t form))) + + ;; Check for old vertical references + (org-table--error-on-old-row-references form) + ;; Insert remote references + (setq form (org-table-remote-reference-indirection form)) + (while (string-match "\\<remote([ \t]*\\([^,)]+\\)[ \t]*,[ \t]*\\([^\n)]+\\))" form) + (setq form + (replace-match + (save-match-data + (org-table-make-reference + (let ((rmtrng (org-table-get-remote-range + (match-string 1 form) (match-string 2 form)))) + (if duration + (if (listp rmtrng) + (mapcar (lambda(x) (org-table-time-string-to-seconds x)) rmtrng) + (org-table-time-string-to-seconds rmtrng)) + rmtrng)) + keep-empty numbers lispp)) + t t form))) + ;; Insert complex ranges + (while (and (string-match org-table-range-regexp form) + (> (length (match-string 0 form)) 1)) + (setq formrg + (save-match-data + (org-table-get-range + (match-string 0 form) org-table-current-begin-pos n0))) + (setq formrpl + (save-match-data + (org-table-make-reference + ;; possibly handle durations + (if duration + (if (listp formrg) + (mapcar (lambda(x) (org-table-time-string-to-seconds x)) formrg) + (org-table-time-string-to-seconds formrg)) + formrg) + keep-empty numbers lispp))) + (if (not (save-match-data + (string-match (regexp-quote form) formrpl))) + (setq form (replace-match formrpl t t form)) + (user-error "Spreadsheet error: invalid reference \"%s\"" form))) + ;; Insert simple ranges, i.e. included in the current row. + (while (string-match + "\\$\\(\\([-+]\\)?[0-9]+\\)\\.\\.\\$\\(\\([-+]\\)?[0-9]+\\)" + form) + (setq form + (replace-match + (save-match-data + (org-table-make-reference + (cl-subseq fields + (+ (if (match-end 2) n0 0) + (string-to-number (match-string 1 form)) + -1) + (+ (if (match-end 4) n0 0) + (string-to-number (match-string 3 form)))) + keep-empty numbers lispp)) + t t form))) + (setq form0 form) + ;; Insert the references to fields in same row + (while (string-match "\\$\\(\\([-+]\\)?[0-9]+\\)" form) + (let* ((n (+ (string-to-number (match-string 1 form)) + (if (match-end 2) n0 0))) + (x (nth (1- (if (= n 0) n0 (max n 1))) fields))) + (setq formrpl (save-match-data + (org-table-make-reference + x keep-empty numbers lispp))) + (when (or (not x) + (save-match-data + (string-match (regexp-quote formula) formrpl))) + (user-error "Invalid field specifier \"%s\"" + (match-string 0 form)))) + (setq form (replace-match formrpl t t form))) + + (if lispp + (setq ev (condition-case nil + (eval (eval (read form))) + (error "#ERROR")) + ev (if (numberp ev) (number-to-string ev) ev) + ev (if duration (org-table-time-seconds-to-string + (string-to-number ev) + duration-output-format) + ev)) + + ;; Use <...> time-stamps so that Calc can handle them. + (setq form + (replace-regexp-in-string org-ts-regexp-inactive "<\\1>" form)) + ;; Internationalize local time-stamps by setting locale to + ;; "C". + (setq form + (replace-regexp-in-string + org-ts-regexp + (lambda (ts) + (let ((system-time-locale "C")) + (format-time-string + (org-time-stamp-format + (string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts)) + (apply #'encode-time + (save-match-data (org-parse-time-string ts)))))) + form t t)) + + (setq ev (if (and duration (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form)) + form + (calc-eval (cons form calc-modes) + (when (and (not keep-empty) numbers) 'num))) + ev (if duration (org-table-time-seconds-to-string + (if (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" ev) + (string-to-number (org-table-time-string-to-seconds ev)) + (string-to-number ev)) + duration-output-format) + ev))) + + (when org-table-formula-debug + (let ((wcf (current-window-configuration))) + (with-output-to-temp-buffer "*Substitution History*" + (princ (format "Substitution history of formula +Orig: %s +$xyz-> %s +@r$c-> %s +$1-> %s\n" orig formula form0 form)) + (if (consp ev) + (princ (format " %s^\nError: %s" + (make-string (car ev) ?\-) (nth 1 ev))) + (princ (format "Result: %s\nFormat: %s\nFinal: %s" + ev (or fmt "NONE") + (if fmt (format fmt (string-to-number ev)) ev))))) + (setq bw (get-buffer-window "*Substitution History*")) + (org-fit-window-to-buffer bw) + (unless (and (called-interactively-p 'any) (not ndown)) + (unless (let (inhibit-redisplay) + (y-or-n-p "Debugging Formula. Continue to next? ")) + (org-table-align) + (user-error "Abort")) + (delete-window bw) + (message "") + (set-window-configuration wcf)))) + (when (consp ev) (setq fmt nil ev "#ERROR")) + (org-table-justify-field-maybe + (format org-table-formula-field-format + (cond + ((not (stringp ev)) ev) + (fmt (format fmt (string-to-number ev))) + ;; Replace any active time stamp in the result with + ;; an inactive one. Dates in tables are likely + ;; piece of regular data, not meant to appear in the + ;; agenda. + (t (replace-regexp-in-string org-ts-regexp "[\\1]" ev))))) + (if (and down (> ndown 0) (looking-at ".*\n[ \t]*|[^-]")) + (call-interactively 'org-return) + (setq ndown 0))) + (and down (org-table-maybe-recalculate-line)) + (or suppress-align (and org-table-may-need-update + (org-table-align)))))) + +(defun org-table-put-field-property (prop value) + (save-excursion + (put-text-property (progn (skip-chars-backward "^|") (point)) + (progn (skip-chars-forward "^|") (point)) + prop value))) + +(defun org-table-get-range (desc &optional tbeg col highlight corners-only) + "Get a calc vector from a column, according to descriptor DESC. + +Optional arguments TBEG and COL can give the beginning of the table and +the current column, to avoid unnecessary parsing. + +HIGHLIGHT means just highlight the range. + +When CORNERS-ONLY is set, only return the corners of the range as +a list (line1 column1 line2 column2) where line1 and line2 are +line numbers relative to beginning of table, or TBEG, and column1 +and column2 are table column numbers." + (let* ((desc (if (string-match-p "\\`\\$[0-9]+\\.\\.\\$[0-9]+\\'" desc) + (replace-regexp-in-string "\\$" "@0$" desc) + desc)) + (col (or col (org-table-current-column))) + (tbeg (or tbeg (org-table-begin))) + (thisline (count-lines tbeg (line-beginning-position)))) + (unless (string-match org-table-range-regexp desc) + (user-error "Invalid table range specifier `%s'" desc)) + (let ((rangep (match-end 3)) + (r1 (let ((r (and (match-end 1) (match-string 1 desc)))) + (or (save-match-data + (and (org-string-nw-p r) + (org-table--descriptor-line r thisline))) + thisline))) + (r2 (let ((r (and (match-end 4) (match-string 4 desc)))) + (or (save-match-data + (and (org-string-nw-p r) + (org-table--descriptor-line r thisline))) + thisline))) + (c1 (let ((c (and (match-end 2) (substring (match-string 2 desc) 1)))) + (if (or (not c) (= (string-to-number c) 0)) col + (+ (string-to-number c) + (if (memq (string-to-char c) '(?- ?+)) col 0))))) + (c2 (let ((c (and (match-end 5) (substring (match-string 5 desc) 1)))) + (if (or (not c) (= (string-to-number c) 0)) col + (+ (string-to-number c) + (if (memq (string-to-char c) '(?- ?+)) col 0)))))) + (save-excursion + (if (and (not corners-only) + (or (not rangep) (and (= r1 r2) (= c1 c2)))) + ;; Just one field. + (progn + (forward-line (- r1 thisline)) + (while (not (looking-at org-table-dataline-regexp)) + (forward-line)) + (prog1 (org-trim (org-table-get-field c1)) + (when highlight (org-table-highlight-rectangle)))) + ;; A range, return a vector. First sort the numbers to get + ;; a regular rectangle. + (let ((first-row (min r1 r2)) + (last-row (max r1 r2)) + (first-column (min c1 c2)) + (last-column (max c1 c2))) + (if corners-only (list first-row first-column last-row last-column) + ;; Copy the range values into a list. + (forward-line (- first-row thisline)) + (while (not (looking-at org-table-dataline-regexp)) + (forward-line) + (cl-incf first-row)) + (org-table-goto-column first-column) + (let ((beg (point))) + (forward-line (- last-row first-row)) + (while (not (looking-at org-table-dataline-regexp)) + (forward-line -1)) + (org-table-goto-column last-column) + (let ((end (point))) + (when highlight + (org-table-highlight-rectangle + beg (progn (skip-chars-forward "^|\n") (point)))) + ;; Return string representation of calc vector. + (mapcar #'org-trim + (apply #'append + (org-table-copy-region beg end)))))))))))) + +(defun org-table--descriptor-line (desc cline) + "Return relative line number corresponding to descriptor DESC. +The cursor is currently in relative line number CLINE." + (if (string-match "\\`[0-9]+\\'" desc) + (aref org-table-dlines (string-to-number desc)) + (when (or (not (string-match + "^\\(\\([-+]\\)?\\(I+\\)\\)?\\(\\([-+]\\)?\\([0-9]+\\)\\)?" + ;; 1 2 3 4 5 6 + desc)) + (and (not (match-end 3)) (not (match-end 6))) + (and (match-end 3) (match-end 6) (not (match-end 5)))) + (user-error "Invalid row descriptor `%s'" desc)) + (let* ((hn (and (match-end 3) (- (match-end 3) (match-beginning 3)))) + (hdir (match-string 2 desc)) + (odir (match-string 5 desc)) + (on (and (match-end 6) (string-to-number (match-string 6 desc)))) + (rel (and (match-end 6) + (or (and (match-end 1) (not (match-end 3))) + (match-end 5))))) + (when (and hn (not hdir)) + (setq cline 0) + (setq hdir "+") + (when (eq (aref org-table-current-line-types 0) 'hline) (cl-decf hn))) + (when (and (not hn) on (not odir)) (user-error "Should never happen")) + (when hn + (setq cline + (org-table--row-type 'hline hn cline (equal hdir "-") nil desc))) + (when on + (setq cline + (org-table--row-type 'dline on cline (equal odir "-") rel desc))) + cline))) + +(defun org-table--row-type (type n i backwards relative desc) + "Return relative line of Nth row with type TYPE. +Search starts from relative line I. When BACKWARDS in non-nil, +look before I. When RELATIVE is non-nil, the reference is +relative. DESC is the original descriptor that started the +search, as a string." + (let ((l (length org-table-current-line-types))) + (catch :exit + (dotimes (_ n) + (while (and (cl-incf i (if backwards -1 1)) + (>= i 0) + (< i l) + (not (eq (aref org-table-current-line-types i) type)) + ;; We are going to cross a hline. Check if this is + ;; an authorized move. + (cond + ((not relative)) + ((not (eq (aref org-table-current-line-types i) 'hline))) + ((eq org-table-relative-ref-may-cross-hline t)) + ((eq org-table-relative-ref-may-cross-hline 'error) + (user-error "Row descriptor %s crosses hline" desc)) + (t (cl-decf i (if backwards -1 1)) ; Step back. + (throw :exit nil))))))) + (cond ((or (< i 0) (>= i l)) + (user-error "Row descriptor %s leads outside table" desc)) + ;; The last hline doesn't exist. Instead, point to last row + ;; in table. + ((= i (1- l)) (1- i)) + (t i)))) + +(defun org-table--error-on-old-row-references (s) + (when (string-match "&[-+0-9I]" s) + (user-error "Formula contains old &row reference, please rewrite using @-syntax"))) + +(defun org-table-make-reference (elements keep-empty numbers lispp) + "Convert list ELEMENTS to something appropriate to insert into formula. +KEEP-EMPTY indicated to keep empty fields, default is to skip them. +NUMBERS indicates that everything should be converted to numbers. +LISPP non-nil means to return something appropriate for a Lisp +list, `literal' is for the format specifier L." + ;; Calc nan (not a number) is used for the conversion of the empty + ;; field to a reference for several reasons: (i) It is accepted in a + ;; Calc formula (e. g. "" or "()" would result in a Calc error). + ;; (ii) In a single field (not in range) it can be distinguished + ;; from "(nan)" which is the reference made from a single field + ;; containing "nan". + (if (stringp elements) + ;; field reference + (if lispp + (if (eq lispp 'literal) + elements + (if (and (eq elements "") (not keep-empty)) + "" + (prin1-to-string + (if numbers (string-to-number elements) elements)))) + (if (string-match "\\S-" elements) + (progn + (when numbers (setq elements (number-to-string + (string-to-number elements)))) + (concat "(" elements ")")) + (if (or (not keep-empty) numbers) "(0)" "nan"))) + ;; range reference + (unless keep-empty + (setq elements + (delq nil + (mapcar (lambda (x) (if (string-match "\\S-" x) x nil)) + elements)))) + (setq elements (or elements '())) ; if delq returns nil then we need '() + (if lispp + (mapconcat + (lambda (x) + (if (eq lispp 'literal) + x + (prin1-to-string (if numbers (string-to-number x) x)))) + elements " ") + (concat "[" (mapconcat + (lambda (x) + (if (string-match "\\S-" x) + (if numbers + (number-to-string (string-to-number x)) + x) + (if (or (not keep-empty) numbers) "0" "nan"))) + elements + ",") "]")))) + +(defun org-table-message-once-per-second (t1 &rest args) + "If there has been more than one second since T1, display message. +ARGS are passed as arguments to the `message' function. Returns +current time if a message is printed, otherwise returns T1. If +T1 is nil, always messages." + (let ((curtime (current-time))) + (if (or (not t1) (org-time-less-p 1 (org-time-subtract curtime t1))) + (progn (apply 'message args) + curtime) + t1))) + +;;;###autoload +(defun org-table-recalculate (&optional all noalign) + "Recalculate the current table line by applying all stored formulas. + +With prefix arg ALL, do this for all lines in the table. + +When called with a `\\[universal-argument] \\[universal-argument]' prefix, or \ +if ALL is the symbol `iterate', +recompute the table until it no longer changes. + +If NOALIGN is not nil, do not re-align the table after the computations +are done. This is typically used internally to save time, if it is +known that the table will be realigned a little later anyway." + (interactive "P") + (unless (memq this-command org-recalc-commands) + (push this-command org-recalc-commands)) + (unless (org-at-table-p) (user-error "Not at a table")) + (if (or (eq all 'iterate) (equal all '(16))) + (org-table-iterate) + (org-table-analyze) + (let* ((eqlist (sort (org-table-get-stored-formulas) + (lambda (a b) (string< (car a) (car b))))) + (inhibit-redisplay (not debug-on-error)) + (line-re org-table-dataline-regexp) + (log-first-time (current-time)) + (log-last-time log-first-time) + (cnt 0) + beg end eqlcol eqlfield) + ;; Insert constants in all formulas. + (when eqlist + (org-table-with-shrunk-columns + (org-table-save-field + ;; Expand equations, then split the equation list between + ;; column formulas and field formulas. + (dolist (eq eqlist) + (let* ((rhs (org-table-formula-substitute-names + (org-table-formula-handle-first/last-rc (cdr eq)))) + (old-lhs (car eq)) + (lhs + (org-table-formula-handle-first/last-rc + (cond + ((string-match "\\`@-?I+" old-lhs) + (user-error "Can't assign to hline relative reference")) + ((string-match "\\`\\$[<>]" old-lhs) + (let ((new (org-table-formula-handle-first/last-rc + old-lhs))) + (when (assoc new eqlist) + (user-error "\"%s=\" formula tries to overwrite \ +existing formula for column %s" + old-lhs + new)) + new)) + (t old-lhs))))) + (if (string-match-p "\\`\\$[0-9]+\\'" lhs) + (push (cons lhs rhs) eqlcol) + (push (cons lhs rhs) eqlfield)))) + (setq eqlcol (nreverse eqlcol)) + ;; Expand ranges in lhs of formulas + (setq eqlfield (org-table-expand-lhs-ranges (nreverse eqlfield))) + ;; Get the correct line range to process. + (if all + (progn + (setq end (copy-marker (org-table-end))) + (goto-char (setq beg org-table-current-begin-pos)) + (cond + ((re-search-forward org-table-calculate-mark-regexp end t) + ;; This is a table with marked lines, compute selected + ;; lines. + (setq line-re org-table-recalculate-regexp)) + ;; Move forward to the first non-header line. + ((and (re-search-forward org-table-dataline-regexp end t) + (re-search-forward org-table-hline-regexp end t) + (re-search-forward org-table-dataline-regexp end t)) + (setq beg (match-beginning 0))) + ;; Just leave BEG at the start of the table. + (t nil))) + (setq beg (line-beginning-position) + end (copy-marker (line-beginning-position 2)))) + (goto-char beg) + ;; Mark named fields untouchable. Also check if several + ;; field/range formulas try to set the same field. + (remove-text-properties beg end '(:org-untouchable t)) + (let ((current-line (count-lines org-table-current-begin-pos + (line-beginning-position))) + seen-fields) + (dolist (eq eqlfield) + (let* ((name (car eq)) + (location (assoc name org-table-named-field-locations)) + (eq-line (or (nth 1 location) + (and (string-match "\\`@\\([0-9]+\\)" name) + (aref org-table-dlines + (string-to-number + (match-string 1 name)))))) + (reference + (if location + ;; Turn field coordinates associated to NAME + ;; into an absolute reference. + (format "@%d$%d" + (org-table-line-to-dline eq-line) + (nth 2 location)) + name))) + (when (member reference seen-fields) + (user-error "Several field/range formulas try to set %s" + reference)) + (push reference seen-fields) + (when (or all (eq eq-line current-line)) + (org-table-goto-field name) + (org-table-put-field-property :org-untouchable t))))) + ;; Evaluate the column formulas, but skip fields covered by + ;; field formulas. + (goto-char beg) + (while (re-search-forward line-re end t) + (unless (string-match "\\` *[_^!$/] *\\'" (org-table-get-field 1)) + ;; Unprotected line, recalculate. + (cl-incf cnt) + (when all + (setq log-last-time + (org-table-message-once-per-second + log-last-time + "Re-applying formulas to full table...(line %d)" cnt))) + (if (markerp org-last-recalc-line) + (move-marker org-last-recalc-line (line-beginning-position)) + (setq org-last-recalc-line + (copy-marker (line-beginning-position)))) + (dolist (entry eqlcol) + (goto-char org-last-recalc-line) + (org-table-goto-column + (string-to-number (substring (car entry) 1)) nil 'force) + (unless (get-text-property (point) :org-untouchable) + (org-table-eval-formula + nil (cdr entry) 'noalign 'nocst 'nostore 'noanalysis))))) + ;; Evaluate the field formulas. + (dolist (eq eqlfield) + (let ((reference (car eq)) + (formula (cdr eq))) + (setq log-last-time + (org-table-message-once-per-second + (and all log-last-time) + "Re-applying formula to field: %s" (car eq))) + (org-table-goto-field + reference + ;; Possibly create a new column, as long as + ;; `org-table-formula-create-columns' allows it. + (let ((column-count (progn (end-of-line) + (1- (org-table-current-column))))) + (lambda (column) + (when (> column 1000) + (user-error "Formula column target too large")) + (and (> column column-count) + (or (eq org-table-formula-create-columns t) + (and (eq org-table-formula-create-columns 'warn) + (progn + (org-display-warning + "Out-of-bounds formula added columns") + t)) + (and (eq org-table-formula-create-columns 'prompt) + (yes-or-no-p + "Out-of-bounds formula. Add columns? ")) + (user-error + "Missing columns in the table. Aborting")))))) + (org-table-eval-formula nil formula t t t t))) + ;; Clean up marker. + (set-marker end nil))) + (unless noalign + (when org-table-may-need-update (org-table-align)) + (when all + (org-table-message-once-per-second + log-first-time "Re-applying formulas to %d lines... done" cnt))) + (org-table-message-once-per-second + (and all log-first-time) "Re-applying formulas... done"))))) + +;;;###autoload +(defun org-table-iterate (&optional arg) + "Recalculate the table until it does not change anymore. +The maximum number of iterations is 10, but you can choose a different value +with the prefix ARG." + (interactive "P") + (let ((imax (if arg (prefix-numeric-value arg) 10)) + (i 0) + (lasttbl (buffer-substring (org-table-begin) (org-table-end))) + thistbl) + (catch 'exit + (while (< i imax) + (setq i (1+ i)) + (org-table-recalculate 'all) + (setq thistbl (buffer-substring (org-table-begin) (org-table-end))) + (if (not (string= lasttbl thistbl)) + (setq lasttbl thistbl) + (if (> i 1) + (message "Convergence after %d iterations" i) + (message "Table was already stable")) + (throw 'exit t))) + (user-error "No convergence after %d iterations" i)))) + +;;;###autoload +(defun org-table-recalculate-buffer-tables () + "Recalculate all tables in the current buffer." + (interactive) + (org-with-wide-buffer + (org-table-map-tables + (lambda () + ;; Reason for separate `org-table-align': When repeating + ;; (org-table-recalculate t) `org-table-may-need-update' gets in + ;; the way. + (org-table-recalculate t t) + (org-table-align)) + t))) + +;;;###autoload +(defun org-table-iterate-buffer-tables () + "Iterate all tables in the buffer, to converge inter-table dependencies." + (interactive) + (let* ((imax 10) + (i imax) + (checksum (md5 (buffer-string))) + c1) + (org-with-wide-buffer + (catch 'exit + (while (> i 0) + (setq i (1- i)) + (org-table-map-tables (lambda () (org-table-recalculate t t)) t) + (if (equal checksum (setq c1 (md5 (buffer-string)))) + (progn + (org-table-map-tables #'org-table-align t) + (message "Convergence after %d iterations" (- imax i)) + (throw 'exit t)) + (setq checksum c1))) + (org-table-map-tables #'org-table-align t) + (user-error "No convergence after %d iterations" imax))))) + +(defun org-table-calc-current-TBLFM (&optional arg) + "Apply the #+TBLFM in the line at point to the table." + (interactive "P") + (unless (org-at-TBLFM-p) (user-error "Not at a #+TBLFM line")) + (let ((formula (buffer-substring + (line-beginning-position) + (line-end-position)))) + (save-excursion + ;; Insert a temporary formula at right after the table + (goto-char (org-table-TBLFM-begin)) + (let ((s (point-marker))) + (insert formula "\n") + (let ((e (point-marker))) + ;; Recalculate the table. + (beginning-of-line 0) ; move to the inserted line + (skip-chars-backward " \r\n\t") + (unwind-protect + (org-call-with-arg #'org-table-recalculate (or arg t)) + ;; Delete the formula inserted temporarily. + (delete-region s e) + (set-marker s nil) + (set-marker e nil))))))) + +(defun org-table-TBLFM-begin () + "Find the beginning of the TBLFM lines and return its position. +Return nil when the beginning of TBLFM line was not found." + (save-excursion + (when (progn (forward-line 1) + (re-search-backward org-table-TBLFM-begin-regexp nil t)) + (line-beginning-position 2)))) + +(defun org-table-expand-lhs-ranges (equations) + "Expand list of formulas. +If some of the RHS in the formulas are ranges or a row reference, +expand them to individual field equations for each field. This +function assumes the table is already analyzed (i.e., using +`org-table-analyze')." + (let (res) + (dolist (e equations (nreverse res)) + (let ((lhs (car e)) + (rhs (cdr e))) + (cond + ((string-match-p "\\`@[-+0-9]+\\$-?[0-9]+\\'" lhs) + ;; This just refers to one fixed field. + (push e res)) + ((string-match-p "\\`[a-zA-Z][_a-zA-Z0-9]*\\'" lhs) + ;; This just refers to one fixed named field. + (push e res)) + ((string-match-p "\\`\\$[0-9]+\\'" lhs) + ;; Column formulas are treated specially and are not + ;; expanded. + (push e res)) + ((string-match "\\`@[0-9]+\\'" lhs) + (dotimes (ic org-table-current-ncol) + (push (cons (propertize (format "%s$%d" lhs (1+ ic)) :orig-eqn e) + rhs) + res))) + (t + (let* ((range (org-table-get-range + lhs org-table-current-begin-pos 1 nil 'corners)) + (r1 (org-table-line-to-dline (nth 0 range))) + (c1 (nth 1 range)) + (r2 (org-table-line-to-dline (nth 2 range) 'above)) + (c2 (nth 3 range))) + (cl-loop for ir from r1 to r2 do + (cl-loop for ic from c1 to c2 do + (push (cons (propertize + (format "@%d$%d" ir ic) :orig-eqn e) + rhs) + res)))))))))) + +(defun org-table-formula-handle-first/last-rc (s) + "Replace @<, @>, $<, $> with first/last row/column of the table. +So @< and $< will always be replaced with @1 and $1, respectively. +The advantage of these special markers are that structure editing of +the table will not change them, while @1 and $1 will be modified +when a line/row is swapped out of that privileged position. So for +formulas that use a range of rows or columns, it may often be better +to anchor the formula with \"I\" row markers, or to offset from the +borders of the table using the @< @> $< $> makers." + (let (n nmax len char (start 0)) + (while (string-match "\\([@$]\\)\\(<+\\|>+\\)\\|\\(remote([^)]+)\\)" + s start) + (if (match-end 3) + (setq start (match-end 3)) + (setq nmax (if (equal (match-string 1 s) "@") + (1- (length org-table-dlines)) + org-table-current-ncol) + len (- (match-end 2) (match-beginning 2)) + char (string-to-char (match-string 2 s)) + n (if (= char ?<) + len + (- nmax len -1))) + (if (or (< n 1) (> n nmax)) + (user-error "Reference \"%s\" in expression \"%s\" points outside table" + (match-string 0 s) s)) + (setq start (match-beginning 0)) + (setq s (replace-match (format "%s%d" (match-string 1 s) n) t t s))))) + s) + +(defun org-table-formula-substitute-names (f) + "Replace $const with values in string F." + (let ((start 0) + (pp (/= (string-to-char f) ?')) + (duration (string-match-p ";.*[Tt].*\\'" f)) + (new (replace-regexp-in-string ; Check for column names. + org-table-column-name-regexp + (lambda (m) + (concat "$" (cdr (assoc (match-string 1 m) + org-table-column-names)))) + f t t))) + ;; Parameters and constants. + (while (setq start + (string-match + "\\$\\([a-zA-Z][_a-zA-Z0-9]*\\)\\|\\(\\<remote([^)]*)\\)" + new start)) + (if (match-end 2) (setq start (match-end 2)) + (cl-incf start) + ;; When a duration is expected, convert value on the fly. + (let ((value + (save-match-data + (let ((v (org-table-get-constant (match-string 1 new)))) + (if (and (org-string-nw-p v) duration) + (org-table-time-string-to-seconds v) + v))))) + (when value + (setq new (replace-match + (concat (and pp "(") value (and pp ")")) t t new)))))) + (if org-table-formula-debug (propertize new :orig-formula f) new))) + +(defun org-table-get-constant (const) + "Find the value for a parameter or constant in a formula. +Parameters get priority." + (or (cdr (assoc const org-table-local-parameters)) + (cdr (assoc const org-table-formula-constants-local)) + (cdr (assoc const org-table-formula-constants)) + (and (fboundp 'constants-get) (constants-get const)) + (and (string= (substring const 0 (min 5 (length const))) "PROP_") + (org-entry-get nil (substring const 5) 'inherit)) + "#UNDEFINED_NAME")) + +(defvar org-table-fedit-map + (let ((map (make-sparse-keymap))) + (org-defkey map "\C-x\C-s" 'org-table-fedit-finish) + (org-defkey map "\C-c\C-s" 'org-table-fedit-finish) + (org-defkey map "\C-c\C-c" 'org-table-fedit-finish) + (org-defkey map "\C-c'" 'org-table-fedit-finish) + (org-defkey map "\C-c\C-q" 'org-table-fedit-abort) + (org-defkey map "\C-c?" 'org-table-show-reference) + (org-defkey map [(meta shift up)] 'org-table-fedit-line-up) + (org-defkey map [(meta shift down)] 'org-table-fedit-line-down) + (org-defkey map [(shift up)] 'org-table-fedit-ref-up) + (org-defkey map [(shift down)] 'org-table-fedit-ref-down) + (org-defkey map [(shift left)] 'org-table-fedit-ref-left) + (org-defkey map [(shift right)] 'org-table-fedit-ref-right) + (org-defkey map [(meta up)] 'org-table-fedit-scroll-down) + (org-defkey map [(meta down)] 'org-table-fedit-scroll) + (org-defkey map [(meta tab)] 'lisp-complete-symbol) + (org-defkey map "\M-\C-i" 'lisp-complete-symbol) + (org-defkey map [(tab)] 'org-table-fedit-lisp-indent) + (org-defkey map "\C-i" 'org-table-fedit-lisp-indent) + (org-defkey map "\C-c\C-r" 'org-table-fedit-toggle-ref-type) + (org-defkey map "\C-c}" 'org-table-fedit-toggle-coordinates) + map)) + +(easy-menu-define org-table-fedit-menu org-table-fedit-map "Org Edit Formulas Menu." + '("Edit-Formulas" + ["Finish and Install" org-table-fedit-finish t] + ["Finish, Install, and Apply" (org-table-fedit-finish t) :keys "C-u C-c C-c"] + ["Abort" org-table-fedit-abort t] + "--" + ["Pretty-Print Lisp Formula" org-table-fedit-lisp-indent t] + ["Complete Lisp Symbol" lisp-complete-symbol t] + "--" + "Shift Reference at Point" + ["Up" org-table-fedit-ref-up t] + ["Down" org-table-fedit-ref-down t] + ["Left" org-table-fedit-ref-left t] + ["Right" org-table-fedit-ref-right t] + "-" + "Change Test Row for Column Formulas" + ["Up" org-table-fedit-line-up t] + ["Down" org-table-fedit-line-down t] + "--" + ["Scroll Table Window" org-table-fedit-scroll t] + ["Scroll Table Window down" org-table-fedit-scroll-down t] + ["Show Table Grid" org-table-fedit-toggle-coordinates + :style toggle :selected (with-current-buffer (marker-buffer org-pos) + org-table-overlay-coordinates)] + "--" + ["Standard Refs (B3 instead of @3$2)" org-table-fedit-toggle-ref-type + :style toggle :selected org-table-buffer-is-an])) + +(defvar org-table--fedit-source nil + "Position of the TBLFM line being edited.") + +;;;###autoload +(defun org-table-edit-formulas () + "Edit the formulas of the current table in a separate buffer." + (interactive) + (let ((at-tblfm (org-at-TBLFM-p))) + (unless (or at-tblfm (org-at-table-p)) + (user-error "Not at a table")) + (save-excursion + ;; Move point within the table before analyzing it. + (when at-tblfm (re-search-backward "^[ \t]*|")) + (org-table-analyze)) + (let ((key (org-table-current-field-formula 'key 'noerror)) + (eql (sort (org-table-get-stored-formulas t (and at-tblfm (point))) + #'org-table-formula-less-p)) + (pos (point-marker)) + (source (copy-marker (line-beginning-position))) + (startline 1) + (wc (current-window-configuration)) + (sel-win (selected-window)) + (titles '((column . "# Column Formulas\n") + (field . "# Field and Range Formulas\n") + (named . "# Named Field Formulas\n")))) + (org-switch-to-buffer-other-window "*Edit Formulas*") + (erase-buffer) + ;; Keep global-font-lock-mode from turning on font-lock-mode + (let ((font-lock-global-modes '(not fundamental-mode))) + (fundamental-mode)) + (setq-local font-lock-global-modes (list 'not major-mode)) + (setq-local org-pos pos) + (setq-local org-table--fedit-source source) + (setq-local org-window-configuration wc) + (setq-local org-selected-window sel-win) + (use-local-map org-table-fedit-map) + (add-hook 'post-command-hook #'org-table-fedit-post-command t t) + (setq startline (org-current-line)) + (dolist (entry eql) + (let* ((type (cond + ((string-match "\\`\\$\\([0-9]+\\|[<>]+\\)\\'" + (car entry)) + 'column) + ((equal (string-to-char (car entry)) ?@) 'field) + (t 'named))) + (title (assq type titles))) + (when title + (unless (bobp) (insert "\n")) + (insert + (org-add-props (cdr title) nil 'face font-lock-comment-face)) + (setq titles (remove title titles))) + (when (equal key (car entry)) (setq startline (org-current-line))) + (let ((s (concat + (if (memq (string-to-char (car entry)) '(?@ ?$)) "" "$") + (car entry) " = " (cdr entry) "\n"))) + (remove-text-properties 0 (length s) '(face nil) s) + (insert s)))) + (when (eq org-table-use-standard-references t) + (org-table-fedit-toggle-ref-type)) + (org-goto-line startline) + (message "%s" (substitute-command-keys "\\<org-mode-map>\ +Edit formulas, finish with `\\[org-ctrl-c-ctrl-c]' or `\\[org-edit-special]'. \ +See menu for more commands."))))) + +(defun org-table-fedit-post-command () + (when (not (memq this-command '(lisp-complete-symbol))) + (let ((win (selected-window))) + (save-excursion + (ignore-errors (org-table-show-reference)) + (select-window win))))) + +(defun org-table-formula-to-user (s) + "Convert a formula from internal to user representation." + (if (eq org-table-use-standard-references t) + (org-table-convert-refs-to-an s) + s)) + +(defun org-table-formula-from-user (s) + "Convert a formula from user to internal representation." + (if org-table-use-standard-references + (org-table-convert-refs-to-rc s) + s)) + +(defun org-table-convert-refs-to-rc (s) + "Convert spreadsheet references from A7 to @7$28. +Works for single references, but also for entire formulas and even the +full TBLFM line." + (let ((start 0)) + (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^,)]*)\\)" s start) + (cond + ((match-end 3) + ;; format match, just advance + (setq start (match-end 0))) + ((and (> (match-beginning 0) 0) + (equal ?. (aref s (max (1- (match-beginning 0)) 0))) + (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0))))) + ;; 3.e5 or something like this. + (setq start (match-end 0))) + ((or (> (- (match-end 1) (match-beginning 1)) 2) + ;; (member (match-string 1 s) + ;; '("arctan" "exp" "expm" "lnp" "log" "stir")) + ) + ;; function name, just advance + (setq start (match-end 0))) + (t + (setq start (match-beginning 0) + s (replace-match + (if (equal (match-string 2 s) "&") + (format "$%d" (org-letters-to-number (match-string 1 s))) + (format "@%d$%d" + (string-to-number (match-string 2 s)) + (org-letters-to-number (match-string 1 s)))) + t t s))))) + s)) + +(defun org-table-convert-refs-to-an (s) + "Convert spreadsheet references from to @7$28 to AB7. +Works for single references, but also for entire formulas and even the +full TBLFM line." + (while (string-match "@\\([0-9]+\\)\\$\\([0-9]+\\)" s) + (setq s (replace-match + (format "%s%d" + (org-number-to-letters + (string-to-number (match-string 2 s))) + (string-to-number (match-string 1 s))) + t t s))) + (while (string-match "\\(^\\|[^0-9a-zA-Z]\\)\\$\\([0-9]+\\)" s) + (setq s (replace-match (concat "\\1" + (org-number-to-letters + (string-to-number (match-string 2 s))) "&") + t nil s))) + s) + +(defun org-letters-to-number (s) + "Convert a base 26 number represented by letters into an integer. +For example: AB -> 28." + (let ((n 0)) + (setq s (upcase s)) + (while (> (length s) 0) + (setq n (+ (* n 26) (string-to-char s) (- ?A) 1) + s (substring s 1))) + n)) + +(defun org-number-to-letters (n) + "Convert an integer into a base 26 number represented by letters. +For example: 28 -> AB." + (let ((s "")) + (while (> n 0) + (setq s (concat (char-to-string (+ (mod (1- n) 26) ?A)) s) + n (/ (1- n) 26))) + s)) + +(defun org-table-time-string-to-seconds (s) + "Convert a time string into numerical duration in seconds. +S can be a string matching either -?HH:MM:SS or -?HH:MM. +If S is a string representing a number, keep this number." + (if (equal s "") + s + (let (hour minus min sec res) + (cond + ((and (string-match "\\(-?\\)\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)" s)) + (setq minus (< 0 (length (match-string 1 s))) + hour (string-to-number (match-string 2 s)) + min (string-to-number (match-string 3 s)) + sec (string-to-number (match-string 4 s))) + (if minus + (setq res (- (+ (* hour 3600) (* min 60) sec))) + (setq res (+ (* hour 3600) (* min 60) sec)))) + ((and (not (string-match org-ts-regexp-both s)) + (string-match "\\(-?\\)\\([0-9]+\\):\\([0-9]+\\)" s)) + (setq minus (< 0 (length (match-string 1 s))) + hour (string-to-number (match-string 2 s)) + min (string-to-number (match-string 3 s))) + (if minus + (setq res (- (+ (* hour 3600) (* min 60)))) + (setq res (+ (* hour 3600) (* min 60))))) + (t (setq res (string-to-number s)))) + (number-to-string res)))) + +(defun org-table-time-seconds-to-string (secs &optional output-format) + "Convert a number of seconds to a time string. +If OUTPUT-FORMAT is non-nil, return a number of days, hours, +minutes or seconds." + (let* ((secs0 (abs secs)) + (res + (cond ((eq output-format 'days) + (format "%.3f" (/ (float secs0) 86400))) + ((eq output-format 'hours) + (format "%.2f" (/ (float secs0) 3600))) + ((eq output-format 'minutes) + (format "%.1f" (/ (float secs0) 60))) + ((eq output-format 'seconds) + (format "%d" secs0)) + ((eq output-format 'hh:mm) + ;; Ignore seconds + (substring (format-seconds + (if org-table-duration-hour-zero-padding + "%.2h:%.2m:%.2s" "%h:%.2m:%.2s") + secs0) + 0 -3)) + (t (format-seconds + (if org-table-duration-hour-zero-padding + "%.2h:%.2m:%.2s" "%h:%.2m:%.2s") + secs0))))) + (if (< secs 0) (concat "-" res) res))) + +(defun org-table-fedit-convert-buffer (function) + "Convert all references in this buffer, using FUNCTION." + (let ((origin (copy-marker (line-beginning-position)))) + (goto-char (point-min)) + (while (not (eobp)) + (insert (funcall function (buffer-substring (point) (line-end-position)))) + (delete-region (point) (line-end-position)) + (forward-line)) + (goto-char origin) + (set-marker origin nil))) + +(defun org-table-fedit-toggle-ref-type () + "Convert all references in the buffer from B3 to @3$2 and back." + (interactive) + (setq-local org-table-buffer-is-an (not org-table-buffer-is-an)) + (org-table-fedit-convert-buffer + (if org-table-buffer-is-an + 'org-table-convert-refs-to-an 'org-table-convert-refs-to-rc)) + (message "Reference type switched to %s" + (if org-table-buffer-is-an "A1 etc" "@row$column"))) + +(defun org-table-fedit-ref-up () + "Shift the reference at point one row/hline up." + (interactive) + (org-table-fedit-shift-reference 'up)) + +(defun org-table-fedit-ref-down () + "Shift the reference at point one row/hline down." + (interactive) + (org-table-fedit-shift-reference 'down)) + +(defun org-table-fedit-ref-left () + "Shift the reference at point one field to the left." + (interactive) + (org-table-fedit-shift-reference 'left)) + +(defun org-table-fedit-ref-right () + "Shift the reference at point one field to the right." + (interactive) + (org-table-fedit-shift-reference 'right)) + +(defun org-table--rematch-and-replace (n &optional decr hline) + "Re-match the group N, and replace it with the shifted reference." + (or (match-end n) (user-error "Cannot shift reference in this direction")) + (goto-char (match-beginning n)) + (and (looking-at (regexp-quote (match-string n))) + (replace-match (org-table-shift-refpart (match-string 0) decr hline) + t t))) + +(defun org-table-fedit-shift-reference (dir) + (cond + ((org-in-regexp "\\(\\<[a-zA-Z]\\)&") + (if (memq dir '(left right)) + (org-table--rematch-and-replace 1 (eq dir 'left)) + (user-error "Cannot shift reference in this direction"))) + ((org-in-regexp "\\(\\<[a-zA-Z]\\{1,2\\}\\)\\([0-9]+\\)") + ;; A B3-like reference + (if (memq dir '(up down)) + (org-table--rematch-and-replace 2 (eq dir 'up)) + (org-table--rematch-and-replace 1 (eq dir 'left)))) + ((org-in-regexp + "\\(@\\|\\.\\.\\)\\([-+]?\\(I+\\>\\|[0-9]+\\)\\)\\(\\$\\([-+]?[0-9]+\\)\\)?") + ;; An internal reference + (if (memq dir '(up down)) + (org-table--rematch-and-replace 2 (eq dir 'up) (match-end 3)) + (org-table--rematch-and-replace 5 (eq dir 'left)))))) + +(defun org-table-shift-refpart (ref &optional decr hline) + "Shift a reference part REF. +If DECR is set, decrease the references row/column, else increase. +If HLINE is set, this may be a hline reference, it certainly is not +a translation reference." + (save-match-data + (let* ((sign (string-match "^[-+]" ref)) n) + + (if sign (setq sign (substring ref 0 1) ref (substring ref 1))) + (cond + ((and hline (string-match "^I+" ref)) + (setq n (string-to-number (concat sign (number-to-string (length ref))))) + (setq n (+ n (if decr -1 1))) + (if (= n 0) (setq n (+ n (if decr -1 1)))) + (if sign + (setq sign (if (< n 0) "-" "+") n (abs n)) + (setq n (max 1 n))) + (concat sign (make-string n ?I))) + + ((string-match "^[0-9]+" ref) + (setq n (string-to-number (concat sign ref))) + (setq n (+ n (if decr -1 1))) + (if sign + (concat (if (< n 0) "-" "+") (number-to-string (abs n))) + (number-to-string (max 1 n)))) + + ((string-match "^[a-zA-Z]+" ref) + (org-number-to-letters + (max 1 (+ (org-letters-to-number ref) (if decr -1 1))))) + + (t (user-error "Cannot shift reference")))))) + +(defun org-table-fedit-toggle-coordinates () + "Toggle the display of coordinates in the referenced table." + (interactive) + (let ((pos (marker-position org-pos))) + (with-current-buffer (marker-buffer org-pos) + (save-excursion + (goto-char pos) + (org-table-toggle-coordinate-overlays))))) + +(defun org-table-fedit-finish (&optional arg) + "Parse the buffer for formula definitions and install them. +With prefix ARG, apply the new formulas to the table." + (interactive "P") + (org-table-remove-rectangle-highlight) + (when org-table-use-standard-references + (org-table-fedit-convert-buffer 'org-table-convert-refs-to-rc) + (setq org-table-buffer-is-an nil)) + (let ((pos org-pos) + (sel-win org-selected-window) + (source org-table--fedit-source) + eql) + (goto-char (point-min)) + (while (re-search-forward + "^\\(@[-+I<>0-9.$@]+\\|@?[0-9]+\\|\\$\\([a-zA-Z0-9]+\\|[<>]+\\)\\) *= *\\(.*\\(\n[ \t]+.*$\\)*\\)" + nil t) + (let ((var (match-string 1)) + (form (org-trim (match-string 3)))) + (unless (equal form "") + (while (string-match "[ \t]*\n[ \t]*" form) + (setq form (replace-match " " t t form))) + (when (assoc var eql) + (user-error "Double formulas for %s" var)) + (push (cons var form) eql)))) + (set-window-configuration org-window-configuration) + (select-window sel-win) + (goto-char source) + (org-table-store-formulas eql) + (set-marker pos nil) + (set-marker source nil) + (kill-buffer "*Edit Formulas*") + (if arg + (org-table-recalculate 'all) + (message "New formulas installed - press C-u C-c C-c to apply.")))) + +(defun org-table-fedit-abort () + "Abort editing formulas, without installing the changes." + (interactive) + (org-table-remove-rectangle-highlight) + (let ((pos org-pos) (sel-win org-selected-window)) + (set-window-configuration org-window-configuration) + (select-window sel-win) + (goto-char pos) + (move-marker pos nil) + (message "Formula editing aborted without installing changes"))) + +(defun org-table-fedit-lisp-indent () + "Pretty-print and re-indent Lisp expressions in the Formula Editor." + (interactive) + (let ((pos (point)) beg end ind) + (beginning-of-line 1) + (cond + ((looking-at "[ \t]") + (goto-char pos) + (call-interactively 'lisp-indent-line)) + ((looking-at "[$&@0-9a-zA-Z]+ *= *[^ \t\n']") (goto-char pos)) + ((not (fboundp 'pp-buffer)) + (user-error "Cannot pretty-print. Command `pp-buffer' is not available")) + ((looking-at "[$&@0-9a-zA-Z]+ *= *'(") + (goto-char (- (match-end 0) 2)) + (setq beg (point)) + (setq ind (make-string (current-column) ?\ )) + (condition-case nil (forward-sexp 1) + (error + (user-error "Cannot pretty-print Lisp expression: Unbalanced parenthesis"))) + (setq end (point)) + (save-restriction + (narrow-to-region beg end) + (if (eq last-command this-command) + (progn + (goto-char (point-min)) + (setq this-command nil) + (while (re-search-forward "[ \t]*\n[ \t]*" nil t) + (replace-match " "))) + (pp-buffer) + (untabify (point-min) (point-max)) + (goto-char (1+ (point-min))) + (while (re-search-forward "^." nil t) + (beginning-of-line 1) + (insert ind)) + (goto-char (point-max)) + (org-delete-backward-char 1))) + (goto-char beg)) + (t nil)))) + +(defun org-table-fedit-line-up () + "Move cursor one line up in the window showing the table." + (interactive) + (org-table-fedit-move 'previous-line)) + +(defun org-table-fedit-line-down () + "Move cursor one line down in the window showing the table." + (interactive) + (org-table-fedit-move 'next-line)) + +(defun org-table-fedit-move (command) + "Move the cursor in the window showing the table. +Use COMMAND to do the motion, repeat if necessary to end up in a data line." + (let ((org-table-allow-automatic-line-recalculation nil) + (pos org-pos) (win (selected-window)) p) + (select-window (get-buffer-window (marker-buffer org-pos))) + (setq p (point)) + (call-interactively command) + (while (and (org-at-table-p) + (org-at-table-hline-p)) + (call-interactively command)) + (or (org-at-table-p) (goto-char p)) + (move-marker pos (point)) + (select-window win))) + +(defun org-table-fedit-scroll (N) + (interactive "p") + (let ((other-window-scroll-buffer (marker-buffer org-pos))) + (scroll-other-window N))) + +(defun org-table-fedit-scroll-down (N) + (interactive "p") + (org-table-fedit-scroll (- N))) + +(defun org-table-add-rectangle-overlay (beg end &optional face) + "Add a new overlay." + (let ((ov (make-overlay beg end))) + (overlay-put ov 'face (or face 'secondary-selection)) + (push ov org-table-rectangle-overlays))) + +(defun org-table-highlight-rectangle (&optional beg end face) + "Highlight rectangular region in a table. +When buffer positions BEG and END are provided, use them to +delimit the region to highlight. Otherwise, refer to point. Use +FACE, when non-nil, for the highlight." + (let* ((beg (or beg (point))) + (end (or end (point))) + (b (min beg end)) + (e (max beg end)) + (start-coordinates + (save-excursion + (goto-char b) + (cons (line-beginning-position) (org-table-current-column)))) + (end-coordinates + (save-excursion + (goto-char e) + (cons (line-beginning-position) (org-table-current-column))))) + (when (boundp 'org-show-positions) + (setq org-show-positions (cons b (cons e org-show-positions)))) + (goto-char (car start-coordinates)) + (let ((column-start (min (cdr start-coordinates) (cdr end-coordinates))) + (column-end (max (cdr start-coordinates) (cdr end-coordinates))) + (last-row (car end-coordinates))) + (while (<= (point) last-row) + (when (looking-at org-table-dataline-regexp) + (org-table-goto-column column-start) + (skip-chars-backward "^|\n") + (let ((p (point))) + (org-table-goto-column column-end) + (skip-chars-forward "^|\n") + (org-table-add-rectangle-overlay p (point) face))) + (forward-line))) + (goto-char (car start-coordinates))) + (add-hook 'before-change-functions #'org-table-remove-rectangle-highlight)) + +(defun org-table-remove-rectangle-highlight (&rest _ignore) + "Remove the rectangle overlays." + (unless org-inhibit-highlight-removal + (remove-hook 'before-change-functions 'org-table-remove-rectangle-highlight) + (mapc 'delete-overlay org-table-rectangle-overlays) + (setq org-table-rectangle-overlays nil))) + +(defvar-local org-table-coordinate-overlays nil + "Collects the coordinate grid overlays, so that they can be removed.") + +(defun org-table-overlay-coordinates () + "Add overlays to the table at point, to show row/column coordinates." + (interactive) + (mapc 'delete-overlay org-table-coordinate-overlays) + (setq org-table-coordinate-overlays nil) + (save-excursion + (let ((id 0) (ih 0) hline eol str ov) + (goto-char (org-table-begin)) + (while (org-at-table-p) + (setq eol (point-at-eol)) + (setq ov (make-overlay (point-at-bol) (1+ (point-at-bol)))) + (push ov org-table-coordinate-overlays) + (setq hline (looking-at org-table-hline-regexp)) + (setq str (if hline (format "I*%-2d" (setq ih (1+ ih))) + (format "%4d" (setq id (1+ id))))) + (org-overlay-before-string ov str 'org-special-keyword 'evaporate) + (when hline + (let ((ic 0)) + (while (re-search-forward "[+|]\\(-+\\)" eol t) + (cl-incf ic) + (let* ((beg (1+ (match-beginning 0))) + (s1 (format "$%d" ic)) + (s2 (org-number-to-letters ic)) + (str (if (eq t org-table-use-standard-references) s2 s1)) + (ov (make-overlay beg (+ beg (length str))))) + (push ov org-table-coordinate-overlays) + (org-overlay-display ov str 'org-special-keyword 'evaporate))))) + (forward-line))))) + +;;;###autoload +(defun org-table-toggle-coordinate-overlays () + "Toggle the display of Row/Column numbers in tables." + (interactive) + (if (not (org-at-table-p)) + (user-error "Not on a table") + (setq org-table-overlay-coordinates (not org-table-overlay-coordinates)) + (when (and (org-at-table-p) org-table-overlay-coordinates) + (org-table-align)) + (unless org-table-overlay-coordinates + (mapc 'delete-overlay org-table-coordinate-overlays) + (setq org-table-coordinate-overlays nil)) + (message "Tables Row/Column numbers display turned %s" + (if org-table-overlay-coordinates "on" "off")))) + +;;;###autoload +(defun org-table-toggle-formula-debugger () + "Toggle the formula debugger in tables." + (interactive) + (setq org-table-formula-debug (not org-table-formula-debug)) + (message "Formula debugging has been turned %s" + (if org-table-formula-debug "on" "off"))) + + +;;; Columns Shrinking + +(defun org-table--shrunk-field () + "Non-nil if current field is narrowed. +When non-nil, return the overlay narrowing the field." + (cl-some (lambda (o) + (and (eq 'table-column-hide (overlay-get o 'org-overlay-type)) + o)) + (overlays-at (save-excursion + (skip-chars-forward (if (org-at-table-hline-p) "^+|" + "^|") + (line-end-position)) + (1- (point)))))) + +(defun org-table--list-shrunk-columns () + "List currently shrunk columns in table at point." + (save-excursion + ;; We really check shrunk columns in current row only. It could + ;; be wrong if all rows do not contain the same number of columns + ;; (i.e. the table is not properly aligned). As a consequence, + ;; some columns may not be shrunk again upon aligning the table. + ;; + ;; For example, in the following table, cursor is on first row and + ;; "<>" indicates a shrunk column. + ;; + ;; | | + ;; | | <> | + ;; + ;; 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 + ;; slow on large tables. Moreover, the hindrance of this + ;; pathological case is very limited. + (beginning-of-line) + (search-forward "|") + (let ((separator (if (org-at-table-hline-p) "+" "|")) + (column 1) + (shrunk (and (org-table--shrunk-field) (list 1))) + (end (line-end-position))) + (while (search-forward separator end t) + (cl-incf column) + (when (org-table--shrunk-field) (push column shrunk))) + (nreverse shrunk)))) + +(defun org-table--make-shrinking-overlay (start end display field &optional pre) + "Create an overlay to shrink text between START and END. + +Use string DISPLAY instead of the real text between the two +buffer positions. FIELD is the real contents of the field, as +a string, or nil. It is meant to be displayed upon moving the +mouse onto the overlay. + +When optional argument PRE is non-nil, assume the overlay is +located at the beginning of the field, and prepend +`org-table-separator-space' to it. Otherwise, concatenate +`org-table-shrunk-column-indicator' at its end. + +Return the overlay." + (let ((show-before-edit + (lambda (o &rest _) + ;; Removing one overlay removes all other overlays in the + ;; same column. + (mapc #'delete-overlay + (cdr (overlay-get o 'org-table-column-overlays))))) + (o (make-overlay start end))) + (overlay-put o 'insert-behind-hooks (list show-before-edit)) + (overlay-put o 'insert-in-front-hooks (list show-before-edit)) + (overlay-put o 'modification-hooks (list show-before-edit)) + (overlay-put o 'org-overlay-type 'table-column-hide) + (when (stringp field) (overlay-put o 'help-echo field)) + ;; Make sure overlays stays on top of table coordinates overlays. + ;; See `org-table-overlay-coordinates'. + (overlay-put o 'priority 1) + (let ((d (if pre (concat org-table-separator-space display) + (concat display org-table-shrunk-column-indicator)))) + (org-overlay-display o d 'org-table t)) + o)) + +(defun org-table--shrink-field (width align start end contents) + "Shrink a table field to a specified width. + +WIDTH is an integer representing the number of characters to +display, in addition to `org-table-shrunk-column-indicator'. +ALIGN is the alignment of the current column, as either \"l\", +\"c\" or \"r\". START and END are, respectively, the beginning +and ending positions of the field. CONTENTS is its trimmed +contents, as a string, or `hline' for table rules. + +Real field is hidden under one or two overlays. They have the +following properties: + + `org-overlay-type' + + Set to `table-column-hide'. Used to identify overlays + responsible for shrinking columns in a table. + + `org-table-column-overlays' + + It is a list with the pattern (siblings . COLUMN-OVERLAYS) + where COLUMN-OVERLAYS is the list of all overlays hiding the + same column. + +Whenever the text behind or next to the overlay is modified, all +the overlays in the column are deleted, effectively displaying +the column again. + +Return a list of overlays hiding the field, or nil if field is +already hidden." + (cond + ((= start end) nil) ;no field to narrow + ((org-table--shrunk-field) nil) ;already shrunk + ((= 0 width) ;shrink to one character + (list (org-table--make-shrinking-overlay + start end "" (if (eq 'hline contents) "" contents)))) + ((eq contents 'hline) + (list (org-table--make-shrinking-overlay + start end (make-string (1+ width) ?-) ""))) + ((equal contents "") ;no contents to hide + (list + (let ((w (org-string-width (buffer-substring start end))) + ;; We really want WIDTH + 2 whitespace, to include blanks + ;; around fields. + (full (+ 2 width))) + (if (<= w full) + (org-table--make-shrinking-overlay + (1- end) end (make-string (- full w) ?\s) "") + (org-table--make-shrinking-overlay (- end (- w full) 1) end "" ""))))) + (t + ;; If the field is not empty, display exactly WIDTH characters. + ;; It can mean to partly hide the field, or extend it with virtual + ;; blanks. To that effect, we use one or two overlays. The + ;; first, optional, one may add or hide white spaces before the + ;; contents of the field. The other, mandatory, one cuts the + ;; field or displays white spaces at the end of the field. It + ;; also always displays `org-table-shrunk-column-indicator'. + (let* ((lead (org-with-point-at start (skip-chars-forward " "))) + (trail (org-with-point-at end (abs (skip-chars-backward " ")))) + (contents-width (org-string-width + (buffer-substring (+ start lead) (- end trail))))) + (cond + ;; Contents are too large to fit in WIDTH character. Limit, if + ;; possible, blanks at the beginning of the field to a single + ;; white space, and cut the field at an appropriate location. + ((<= width contents-width) + (let ((pre + (and (> lead 0) + (org-table--make-shrinking-overlay + start (+ start lead) "" contents t))) + (post + (org-table--make-shrinking-overlay + ;; Find cut location so that WIDTH characters are + ;; visible using dichotomy. + (let* ((begin (+ start lead)) + (lower begin) + (upper (1- end)) + ;; Compensate the absence of leading space, + ;; thus preserving alignment. + (width (if (= lead 0) (1+ width) width))) + (catch :exit + (while (> (- upper lower) 1) + (let ((mean (+ (ash lower -1) + (ash upper -1) + (logand lower upper 1)))) + (pcase (org-string-width (buffer-substring begin mean)) + ((pred (= width)) (throw :exit mean)) + ((pred (< width)) (setq upper mean)) + (_ (setq lower mean))))) + upper)) + end "" contents))) + (if pre (list pre post) (list post)))) + ;; Contents fit it WIDTH characters. First compute number of + ;; white spaces needed on each side of contents, then expand or + ;; compact blanks on each side of the field in order to + ;; preserve width and obey to alignment constraints. + (t + (let* ((required (- width contents-width)) + (before + (pcase align + ;; Compensate the absence of leading space, thus + ;; preserving alignment. + ((guard (= lead 0)) -1) + ("l" 0) + ("r" required) + ("c" (/ required 2)))) + (after (- required before)) + (pre + (pcase (1- lead) + ((or (guard (= lead 0)) (pred (= before))) nil) + ((pred (< before)) + (org-table--make-shrinking-overlay + start (+ start (- lead before)) "" contents t)) + (_ + (org-table--make-shrinking-overlay + start (1+ start) + (make-string (- before (1- lead)) ?\s) + contents t)))) + (post + (pcase (1- trail) + ((pred (= after)) + (org-table--make-shrinking-overlay (1- end) end "" contents)) + ((pred (< after)) + (org-table--make-shrinking-overlay + (+ after (- end trail)) end "" contents)) + (_ + (org-table--make-shrinking-overlay + (1- end) end + (make-string (- after (1- trail)) ?\s) + contents))))) + (if pre (list pre post) (list post))))))))) + +(defun org-table--read-column-selection (select max) + "Read column selection select as a list of numbers. + +SELECT is a string containing column ranges, separated by white +space characters, see `org-table-hide-column' for details. MAX +is the maximum column number. + +Return value is a sorted list of numbers. Ignore any number +outside of the [1;MAX] range." + (catch :all + (sort + (delete-dups + (cl-mapcan + (lambda (s) + (cond + ((member s '("-" "1-")) (throw :all (number-sequence 1 max))) + ((string-match-p "\\`[0-9]+\\'" s) + (let ((n (string-to-number s))) + (and (> n 0) (<= n max) (list n)))) + ((string-match "\\`\\([0-9]+\\)?-\\([0-9]+\\)?\\'" s) + (let ((n (match-string 1 s)) + (m (match-string 2 s))) + (number-sequence (if n (max 1 (string-to-number n)) + 1) + (if m (min max (string-to-number m)) + max)))) + (t nil))) ;invalid specification + (split-string select))) + #'<))) + +(defun org-table--shrink-columns (columns beg end) + "Shrink COLUMNS in a table. +COLUMNS is a sorted list of column numbers. BEG and END are, +respectively, the beginning position and the end position of the +table." + (org-with-wide-buffer + (org-font-lock-ensure beg end) + (dolist (c columns) + (goto-char beg) + (let ((align nil) + (width nil) + (fields nil)) + (while (< (point) end) + (catch :continue + (let* ((hline? (org-at-table-hline-p)) + (separator (if hline? "+" "|"))) + ;; Move to COLUMN. + (search-forward "|") + (or (= c 1) ;already there + (search-forward separator (line-end-position) t (1- c)) + (throw :continue nil)) ;skip invalid columns + ;; Extract boundaries and contents from current field. + ;; Also set the column's width if we encounter a width + ;; cookie for the first time. + (let* ((start (point)) + (end (progn + (skip-chars-forward (concat "^|" separator) + (line-end-position)) + (point))) + (contents (if hline? 'hline + (org-trim (buffer-substring start end))))) + (push (list start end contents) fields) + (when (and (not hline?) + (string-match "\\`<\\([lrc]\\)?\\([0-9]+\\)>\\'" + contents)) + (unless align (setq align (match-string 1 contents))) + (unless width + (setq width (string-to-number (match-string 2 contents)))))))) + (forward-line)) + ;; Link overlays for current field to the other overlays in the + ;; same column. + (let ((chain (list 'siblings))) + (dolist (field fields) + (dolist (new (apply #'org-table--shrink-field + (or width 0) (or align "l") field)) + (push new (cdr chain)) + (overlay-put new 'org-table-column-overlays chain)))))))) + +;;;###autoload +(defun org-table-toggle-column-width (&optional arg) + "Shrink or expand current column in an Org table. + +If a width cookie specifies a width W for the column, the first +W visible characters are displayed. Otherwise, the column is +shrunk to a single character. + +When point is before the first column or after the last one, ask +for the columns to shrink or expand, as a list of ranges. +A column range can be one of the following patterns: + + N column N only + N-M every column between N and M (both inclusive) + N- every column between N (inclusive) and the last column + -M every column between the first one and M (inclusive) + - every column + +When optional argument ARG is a string, use it as white space +separated list of column ranges. + +When called with `\\[universal-argument]' prefix, call \ +`org-table-shrink', i.e., +shrink columns with a width cookie and expand the others. + +When called with `\\[universal-argument] \\[universal-argument]' \ +prefix, expand all columns." + (interactive "P") + (unless (org-at-table-p) (user-error "Not in a table")) + (let* ((begin (org-table-begin)) + (end (org-table-end)) + ;; Compute an upper bound for the number of columns. + ;; Nonexistent columns are ignored anyway. + (max-columns (/ (- (line-end-position) (line-beginning-position)) 2)) + (shrunk (org-table--list-shrunk-columns)) + (columns + (pcase arg + (`nil + (if (save-excursion + (skip-chars-backward "^|" (line-beginning-position)) + (or (bolp) (looking-at-p "[ \t]*$"))) + ;; Point is either before first column or past last + ;; one. Ask for columns to operate on. + (org-table--read-column-selection + (read-string "Column ranges (e.g. 2-4 6-): ") + max-columns) + (list (org-table-current-column)))) + ((pred stringp) (org-table--read-column-selection arg max-columns)) + ((or `(4) `(16)) nil) + (_ (user-error "Invalid argument: %S" arg))))) + (pcase arg + (`(4) (org-table-shrink begin end)) + (`(16) (org-table-expand begin end)) + (_ + (org-table-expand begin end) + (org-table--shrink-columns + (cl-set-exclusive-or columns shrunk) begin end))))) + +;;;###autoload +(defun org-table-shrink (&optional begin end) + "Shrink all columns with a width cookie in the table at point. + +Columns without a width cookie are expanded. + +Optional arguments BEGIN and END, when non-nil, specify the +beginning and end position of the current table." + (interactive) + (unless (or begin (org-at-table-p)) (user-error "Not at a table")) + (org-with-wide-buffer + (let ((begin (or begin (org-table-begin))) + (end (or end (org-table-end))) + (regexp "|[ \t]*<[lrc]?[0-9]+>[ \t]*\\(|\\|$\\)") + (columns)) + (goto-char begin) + (while (re-search-forward regexp end t) + (goto-char (match-beginning 1)) + (cl-pushnew (org-table-current-column) columns)) + (org-table-expand begin end) + ;; Make sure invisible characters in the table are at the right + ;; place since column widths take them into account. + (org-font-lock-ensure begin end) + (org-table--shrink-columns (sort columns #'<) begin end)))) + +;;;###autoload +(defun org-table-expand (&optional begin end) + "Expand all columns in the table at point. +Optional arguments BEGIN and END, when non-nil, specify the +beginning and end position of the current table." + (interactive) + (unless (or begin (org-at-table-p)) (user-error "Not at a table")) + (org-with-wide-buffer + (let ((begin (or begin (org-table-begin))) + (end (or end (org-table-end)))) + (remove-overlays begin end 'org-overlay-type 'table-column-hide)))) + + +;;; Generic Tools + +;;;###autoload +(defun org-table-map-tables (f &optional quietly) + "Apply function F to the start of all tables in the buffer." + (org-with-point-at 1 + (while (re-search-forward org-table-line-regexp nil t) + (let ((table (org-element-lineage (org-element-at-point) '(table) t))) + (when table + (unless quietly + (message "Mapping tables: %d%%" + (floor (* 100.0 (point)) (buffer-size)))) + (goto-char (org-element-property :post-affiliated table)) + (let ((end (copy-marker (org-element-property :end table)))) + (unwind-protect + (progn (funcall f) (goto-char end)) + (set-marker end nil))))))) + (unless quietly (message "Mapping tables: done"))) + +;;;###autoload +(defun org-table-export (&optional file format) + "Export table to a file, with configurable format. +Such a file can be imported into usual spreadsheet programs. + +FILE can be the output file name. If not given, it will be taken +from a TABLE_EXPORT_FILE property in the current entry or higher +up in the hierarchy, or the user will be prompted for a file +name. FORMAT can be an export format, of the same kind as it +used when `-mode' sends a table in a different format. + +The command suggests a format depending on TABLE_EXPORT_FORMAT, +whether it is set locally or up in the hierarchy, then on the +extension of the given file name, and finally on the variable +`org-table-export-default-format'." + (interactive) + (unless (org-at-table-p) (user-error "No table at point")) + (org-table-align) ; Make sure we have everything we need. + (let ((file (or file (org-entry-get (point) "TABLE_EXPORT_FILE" t)))) + (unless file + (setq file (read-file-name "Export table to: ")) + (unless (or (not (file-exists-p file)) + (y-or-n-p (format "Overwrite file %s? " file))) + (user-error "File not written"))) + (when (file-directory-p file) + (user-error "This is a directory path, not a file")) + (when (and (buffer-file-name (buffer-base-buffer)) + (file-equal-p + (file-truename file) + (file-truename (buffer-file-name (buffer-base-buffer))))) + (user-error "Please specify a file name that is different from current")) + (let ((fileext (concat (file-name-extension file) "$")) + (format (or format (org-entry-get (point) "TABLE_EXPORT_FORMAT" t)))) + (unless format + (let* ((formats '("orgtbl-to-tsv" "orgtbl-to-csv" "orgtbl-to-latex" + "orgtbl-to-html" "orgtbl-to-generic" + "orgtbl-to-texinfo" "orgtbl-to-orgtbl" + "orgtbl-to-unicode")) + (deffmt-readable + (replace-regexp-in-string + "\t" "\\t" + (replace-regexp-in-string + "\n" "\\n" + (or (car (delq nil + (mapcar + (lambda (f) + (and (string-match-p fileext f) f)) + formats))) + org-table-export-default-format) + t t) + t t))) + (setq format + (org-completing-read + "Format: " formats nil nil deffmt-readable)))) + (if (string-match "\\([^ \t\r\n]+\\)\\( +.*\\)?" format) + (let ((transform (intern (match-string 1 format))) + (params (and (match-end 2) + (read (concat "(" (match-string 2 format) ")")))) + (table (org-table-to-lisp))) + (unless (fboundp transform) + (user-error "No such transformation function %s" transform)) + (let (buf) + (with-current-buffer (find-file-noselect file) + (setq buf (current-buffer)) + (erase-buffer) + (fundamental-mode) + (insert (funcall transform table params) "\n") + (save-buffer)) + (kill-buffer buf)) + (message "Export done.")) + (user-error "TABLE_EXPORT_FORMAT invalid"))))) + +;;;###autoload +(defun org-table--align-field (field width align) + "Format FIELD according to column WIDTH and alignment ALIGN. +FIELD is a string. WIDTH is a number. ALIGN is either \"c\", +\"l\" or\"r\"." + (let* ((spaces (- width (org-string-width field))) + (prefix (pcase align + ("l" "") + ("r" (make-string spaces ?\s)) + ("c" (make-string (/ spaces 2) ?\s)))) + (suffix (make-string (- spaces (length prefix)) ?\s))) + (concat org-table-separator-space + prefix + field + suffix + org-table-separator-space))) + +(defun org-table-align () + "Align the table at point by aligning all vertical bars." + (interactive) + (let ((beg (org-table-begin)) + (end (copy-marker (org-table-end)))) + (org-table-save-field + ;; Make sure invisible characters in the table are at the right + ;; place since column widths take them into account. + (org-font-lock-ensure beg end) + (move-marker org-table-aligned-begin-marker beg) + (move-marker org-table-aligned-end-marker end) + (goto-char beg) + (org-table-with-shrunk-columns + (let* ((table (org-table-to-lisp)) + (rows (remq 'hline table)) + (widths nil) + (alignments nil) + (columns-number 1)) + (if (null rows) + ;; Table contains only horizontal rules. Compute the + ;; number of columns anyway, and choose an arbitrary width + ;; and alignment. + (let ((end (line-end-position))) + (save-excursion + (while (search-forward "+" end t) + (cl-incf columns-number))) + (setq widths (make-list columns-number 1)) + (setq alignments (make-list columns-number "l"))) + ;; Compute alignment and width for each column. + (setq columns-number (apply #'max (mapcar #'length rows))) + (dotimes (i columns-number) + (let ((max-width 1) + (fixed-align? nil) + (numbers 0) + (non-empty 0)) + (dolist (row rows) + (let ((cell (or (nth i row) ""))) + (setq max-width (max max-width (org-string-width cell))) + (cond (fixed-align? nil) + ((equal cell "") nil) + ((string-match "\\`<\\([lrc]\\)[0-9]*>\\'" cell) + (setq fixed-align? (match-string 1 cell))) + (t + (cl-incf non-empty) + (when (string-match-p org-table-number-regexp cell) + (cl-incf numbers)))))) + (push max-width widths) + (push (cond + (fixed-align?) + ((>= numbers (* org-table-number-fraction non-empty)) "r") + (t "l")) + alignments))) + (setq widths (nreverse widths)) + (setq alignments (nreverse alignments))) + ;; Store alignment of this table, for later editing of single + ;; fields. + (setq org-table-last-alignment alignments) + (setq org-table-last-column-widths widths) + ;; Build new table rows. Only replace rows that actually + ;; changed. + (let ((rule (and (memq 'hline table) + (mapconcat (lambda (w) (make-string (+ 2 w) ?-)) + widths + "+"))) + (indent (progn (looking-at "[ \t]*|") (match-string 0)))) + (dolist (row table) + (let ((previous (buffer-substring (point) (line-end-position))) + (new + (concat indent + (if (eq row 'hline) rule + (let* ((offset (- columns-number (length row))) + (fields (if (= 0 offset) row + ;; Add missing fields. + (append row + (make-list offset ""))))) + (mapconcat #'identity + (cl-mapcar #'org-table--align-field + fields + widths + alignments) + "|"))) + "|"))) + (if (equal new previous) + (forward-line) + (insert new "\n") + (delete-region (point) (line-beginning-position 2)))))) + (set-marker end nil) + (when org-table-overlay-coordinates (org-table-overlay-coordinates)) + (setq org-table-may-need-update nil)))))) + +;;;###autoload +(defun org-table-justify-field-maybe (&optional new) + "Justify the current field, text to left, number to right. +Optional argument NEW may specify text to replace the current field content." + (cond + ((and (not new) org-table-may-need-update)) ; Realignment will happen anyway + ((org-at-table-hline-p)) + ((and (not new) + (or (not (eq (marker-buffer org-table-aligned-begin-marker) + (current-buffer))) + (< (point) org-table-aligned-begin-marker) + (>= (point) org-table-aligned-end-marker))) + ;; This is not the same table, force a full re-align. + (setq org-table-may-need-update t)) + (t + ;; Realign the current field, based on previous full realign. + (let ((pos (point)) + (col (org-table-current-column))) + (when (> col 0) + (skip-chars-backward "^|") + (if (not (looking-at " *\\(?:\\([^|\n]*?\\) *\\(|\\)\\|\\([^|\n]+?\\) *\\($\\)\\)")) + (setq org-table-may-need-update t) + (let* ((align (nth (1- col) org-table-last-alignment)) + (width (nth (1- col) org-table-last-column-widths)) + (cell (match-string 0)) + (field (match-string 1)) + (properly-closed? (/= (match-beginning 2) (match-end 2))) + (new-cell + (save-match-data + (cond (org-table-may-need-update + (format " %s |" (or new field))) + ((not properly-closed?) + (setq org-table-may-need-update t) + (format " %s |" (or new field))) + ((not new) + (concat (org-table--align-field field width align) + "|")) + ((and width (<= (org-string-width new) width)) + (concat (org-table--align-field new width align) + "|")) + (t + (setq org-table-may-need-update t) + (format " %s |" new)))))) + (unless (equal new-cell cell) + (let (org-table-may-need-update) + (replace-match new-cell t t))) + (goto-char pos)))))))) + +;;;###autoload +(defun org-table-sort-lines + (&optional with-case sorting-type getkey-func compare-func interactive?) + "Sort table lines according to the column at point. + +The position of point indicates the column to be used for +sorting, and the range of lines is the range between the nearest +horizontal separator lines, or the entire table of no such lines +exist. If point is before the first column, you will be prompted +for the sorting column. If there is an active region, the mark +specifies the first line and the sorting column, while point +should be in the last line to be included into the sorting. + +The command then prompts for the sorting type which can be +alphabetically, numerically, or by time (as given in a time stamp +in the field, or as a HH:MM value). Sorting in reverse order is +also possible. + +With prefix argument WITH-CASE, alphabetic sorting will be case-sensitive +if the locale allows for it. + +If SORTING-TYPE is specified when this function is called from a Lisp +program, no prompting will take place. SORTING-TYPE must be a character, +any of (?a ?A ?n ?N ?t ?T ?f ?F) where the capital letters indicate that +sorting should be done in reverse order. + +If the SORTING-TYPE is ?f or ?F, then GETKEY-FUNC specifies +a function to be called to extract the key. It must return a value +that is compatible with COMPARE-FUNC, the function used to compare +entries. + +A non-nil value for INTERACTIVE? is used to signal that this +function is being called interactively." + (interactive (list current-prefix-arg nil nil nil t)) + (when (org-region-active-p) (goto-char (region-beginning))) + ;; Point must be either within a field or before a data line. + (save-excursion + (skip-chars-backward " \t") + (when (bolp) (search-forward "|" (line-end-position) t)) + (org-table-check-inside-data-field)) + ;; Set appropriate case sensitivity and column used for sorting. + (let ((column (let ((c (org-table-current-column))) + (cond ((> c 0) c) + (interactive? + (read-number "Use column N for sorting: ")) + (t 1)))) + (sorting-type + (or sorting-type + (read-char-exclusive "Sort Table: [a]lphabetic, [n]umeric, \ +\[t]ime, [f]unc. A/N/T/F means reversed: "))) + (start (org-table-begin)) + (end (org-table-end))) + (save-restriction + ;; Narrow buffer to appropriate sorting area. + (if (org-region-active-p) + (progn (goto-char (region-beginning)) + (narrow-to-region + (point) + (save-excursion (goto-char (region-end)) + (line-beginning-position 2)))) + (narrow-to-region + (save-excursion + (if (re-search-backward org-table-hline-regexp start t) + (line-beginning-position 2) + start)) + (if (save-excursion (re-search-forward org-table-hline-regexp end t)) + (match-beginning 0) + end))) + ;; Determine arguments for `sort-subr'. Also record original + ;; position. `org-table-save-field' cannot help here since + ;; sorting is too much destructive. + (let* ((coordinates + (cons (count-lines (point-min) (line-beginning-position)) + (current-column))) + (extract-key-from-field + ;; Function to be called on the contents of the field + ;; used for sorting in the current row. + (cl-case sorting-type + ((?n ?N) #'string-to-number) + ((?a ?A) #'org-sort-remove-invisible) + ((?t ?T) + (lambda (f) + (cond ((string-match org-ts-regexp-both f) + (float-time + (org-time-string-to-time (match-string 0 f)))) + ((org-duration-p f) (org-duration-to-minutes f)) + ((string-match "\\<[0-9]+:[0-9]\\{2\\}\\>" f) + (org-duration-to-minutes (match-string 0 f))) + (t 0)))) + ((?f ?F) + (or getkey-func + (and interactive? + (org-read-function "Function for extracting keys: ")) + (error "Missing key extractor to sort rows"))) + (t (user-error "Invalid sorting type `%c'" sorting-type)))) + (predicate + (cl-case sorting-type + ((?n ?N ?t ?T) #'<) + ((?a ?A) (if with-case #'org-string-collate-lessp + (lambda (s1 s2) (org-string-collate-lessp s1 s2 nil t)))) + ((?f ?F) + (or compare-func + (and interactive? + (org-read-function + "Function for comparing keys (empty for default \ +`sort-subr' predicate): " + 'allow-empty)))))) + (shrunk-columns (remq column (org-table--list-shrunk-columns)))) + (goto-char (point-min)) + (sort-subr (memq sorting-type '(?A ?N ?T ?F)) + (lambda () + (forward-line) + (while (and (not (eobp)) + (not (looking-at org-table-dataline-regexp))) + (forward-line))) + #'end-of-line + (lambda () + (funcall extract-key-from-field + (org-trim (org-table-get-field column)))) + nil + predicate) + ;; Hide all columns but the one being sorted. + (org-table--shrink-columns shrunk-columns start end) + ;; Move back to initial field. + (forward-line (car coordinates)) + (move-to-column (cdr coordinates)))))) + +(defun org-table-transpose-table-at-point () + "Transpose Org table at point and eliminate hlines. +So a table like + +| 1 | 2 | 4 | 5 | +|---+---+---+---| +| a | b | c | d | +| e | f | g | h | + +will be transposed as + +| 1 | a | e | +| 2 | b | f | +| 4 | c | g | +| 5 | d | h | + +Note that horizontal lines disappear." + (interactive) + (let* ((table (delete 'hline (org-table-to-lisp))) + (dline_old (org-table-current-line)) + (col_old (org-table-current-column)) + (contents (mapcar (lambda (_) + (let ((tp table)) + (mapcar + (lambda (_) + (prog1 + (pop (car tp)) + (setq tp (cdr tp)))) + table))) + (car table)))) + (goto-char (org-table-begin)) + (re-search-forward "|") + (backward-char) + (delete-region (point) (org-table-end)) + (insert (mapconcat + (lambda(x) + (concat "| " (mapconcat 'identity x " | " ) " |\n" )) + contents "")) + (org-table-goto-line col_old) + (org-table-goto-column dline_old)) + (org-table-align)) + +;;;###autoload +(defun org-table-wrap-region (arg) + "Wrap several fields in a column like a paragraph. +This is useful if you'd like to spread the contents of a field over several +lines, in order to keep the table compact. + +If there is an active region, and both point and mark are in the same column, +the text in the column is wrapped to minimum width for the given number of +lines. Generally, this makes the table more compact. A prefix ARG may be +used to change the number of desired lines. For example, \ +`C-2 \\[org-table-wrap-region]' +formats the selected text to two lines. If the region was longer than two +lines, the remaining lines remain empty. A negative prefix argument reduces +the current number of lines by that amount. The wrapped text is pasted back +into the table. If you formatted it to more lines than it was before, fields +further down in the table get overwritten - so you might need to make space in +the table first. + +If there is no region, the current field is split at the cursor position and +the text fragment to the right of the cursor is prepended to the field one +line down. + +If there is no region, but you specify a prefix ARG, the current field gets +blank, and the content is appended to the field above." + (interactive "P") + (org-table-check-inside-data-field) + (if (org-region-active-p) + ;; There is a region: fill as a paragraph. + (let ((start (region-beginning))) + (save-restriction + (narrow-to-region + (save-excursion (goto-char start) (move-beginning-of-line 1)) + (save-excursion (org-forward-paragraph) (point))) + (org-table-cut-region (region-beginning) (region-end)) + (when (> (length (car org-table-clip)) 1) + (user-error "Region must be limited to single column")) + (let ((nlines (cond ((not arg) (length org-table-clip)) + ((< arg 1) (+ (length org-table-clip) arg)) + (t arg)))) + (setq org-table-clip + (mapcar #'list + (org-wrap (mapconcat #'car org-table-clip " ") + nil + nlines)))) + (goto-char start) + (org-table-paste-rectangle)) + (org-table-align)) + ;; No region, split the current field at point. + (unless (org-get-alist-option org-M-RET-may-split-line 'table) + (skip-chars-forward "^\r\n|")) + (cond + (arg ; Combine with field above. + (let ((s (org-table-blank-field)) + (col (org-table-current-column))) + (forward-line -1) + (while (org-at-table-hline-p) (forward-line -1)) + (org-table-goto-column col) + (skip-chars-forward "^|") + (skip-chars-backward " ") + (insert " " (org-trim s)) + (org-table-align))) + ((looking-at "\\([^|]+\\)|") ; Split field. + (let ((s (match-string 1))) + (replace-match " |") + (goto-char (match-beginning 0)) + (org-table-next-row) + (insert (org-trim s) " ") + (org-table-align))) + (t (org-table-next-row))))) + +(defun org-table--number-for-summing (s) + (let (n) + (if (string-match "^ *|? *" s) + (setq s (replace-match "" nil nil s))) + (if (string-match " *|? *$" s) + (setq s (replace-match "" nil nil s))) + (setq n (string-to-number s)) + (cond + ((and (string-match "0" s) + (string-match "\\`[-+ \t0.edED]+\\'" s)) 0) + ((string-match "\\`[ \t]+\\'" s) nil) + ((string-match "\\`\\([0-9]+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?\\'" s) + (let ((h (string-to-number (or (match-string 1 s) "0"))) + (m (string-to-number (or (match-string 2 s) "0"))) + (s (string-to-number (or (match-string 4 s) "0")))) + (if (boundp 'org-timecnt) (setq org-timecnt (1+ org-timecnt))) + (* 1.0 (+ h (/ m 60.0) (/ s 3600.0))))) + ((equal n 0) nil) + (t n)))) + +;;;###autoload +(defun org-table-sum (&optional beg end nlast) + "Sum numbers in region of current table column. +The result will be displayed in the echo area, and will be available +as kill to be inserted with \\[yank]. + +If there is an active region, it is interpreted as a rectangle and all +numbers in that rectangle will be summed. If there is no active +region and point is located in a table column, sum all numbers in that +column. + +If at least one number looks like a time HH:MM or HH:MM:SS, all other +numbers are assumed to be times as well (in decimal hours) and the +numbers are added as such. + +If NLAST is a number, only the NLAST fields will actually be summed." + (interactive) + (save-excursion + (let (col (org-timecnt 0) diff h m s org-table-clip) + (cond + ((and beg end)) ; beg and end given explicitly + ((org-region-active-p) + (setq beg (region-beginning) end (region-end))) + (t + (setq col (org-table-current-column)) + (goto-char (org-table-begin)) + (unless (re-search-forward "^[ \t]*|[^-]" nil t) + (user-error "No table data")) + (org-table-goto-column col) + (setq beg (point)) + (goto-char (org-table-end)) + (unless (re-search-backward "^[ \t]*|[^-]" nil t) + (user-error "No table data")) + (org-table-goto-column col) + (setq end (point)))) + (let* ((items (apply 'append (org-table-copy-region beg end))) + (items1 (cond ((not nlast) items) + ((>= nlast (length items)) items) + (t (setq items (reverse items)) + (setcdr (nthcdr (1- nlast) items) nil) + (nreverse items)))) + (numbers (delq nil (mapcar #'org-table--number-for-summing + items1))) + (res (apply '+ numbers)) + (sres (if (= org-timecnt 0) + (number-to-string res) + (setq diff (* 3600 res) + h (floor diff 3600) diff (mod diff 3600) + m (floor diff 60) diff (mod diff 60) + s diff) + (format "%.0f:%02.0f:%02.0f" h m s)))) + (kill-new sres) + (when (called-interactively-p 'interactive) + (message (substitute-command-keys + (format "Sum of %d items: %-20s \ +\(\\[yank] will insert result into buffer)" + (length numbers) + sres)))) + sres)))) + +;;;###autoload +(defun org-table-analyze () + "Analyze table at point and store results. + +This function sets up the following dynamically scoped variables: + + `org-table-column-name-regexp', + `org-table-column-names', + `org-table-current-begin-pos', + `org-table-current-line-types', + `org-table-current-ncol', + `org-table-dlines', + `org-table-hlines', + `org-table-local-parameters', + `org-table-named-field-locations'." + (let ((beg (org-table-begin)) + (end (org-table-end))) + (save-excursion + (goto-char beg) + ;; Extract column names. + (setq org-table-column-names nil) + (when (save-excursion + (re-search-forward "^[ \t]*| *! *\\(|.*\\)" end t)) + (let ((c 1)) + (dolist (name (org-split-string (match-string 1) " *| *")) + (cl-incf c) + (when (string-match "\\`[a-zA-Z][_a-zA-Z0-9]*\\'" name) + (push (cons name (number-to-string c)) org-table-column-names))))) + (setq org-table-column-names (nreverse org-table-column-names)) + (setq org-table-column-name-regexp + (format "\\$\\(%s\\)\\>" + (regexp-opt (mapcar #'car org-table-column-names) t))) + ;; Extract local parameters. + (setq org-table-local-parameters nil) + (save-excursion + (while (re-search-forward "^[ \t]*| *\\$ *\\(|.*\\)" end t) + (dolist (field (org-split-string (match-string 1) " *| *")) + (when (string-match + "\\`\\([a-zA-Z][_a-zA-Z0-9]*\\|%\\) *= *\\(.*\\)" field) + (push (cons (match-string 1 field) (match-string 2 field)) + org-table-local-parameters))))) + ;; Update named fields locations. We minimize `count-lines' + ;; processing by storing last known number of lines in LAST. + (setq org-table-named-field-locations nil) + (save-excursion + (let ((last (cons (point) 0))) + (while (re-search-forward "^[ \t]*| *\\([_^]\\) *\\(|.*\\)" end t) + (let ((c (match-string 1)) + (fields (org-split-string (match-string 2) " *| *"))) + (save-excursion + (forward-line (if (equal c "_") 1 -1)) + (let ((fields1 + (and (looking-at "^[ \t]*|[^|]*\\(|.*\\)") + (org-split-string (match-string 1) " *| *"))) + (line (cl-incf (cdr last) (count-lines (car last) (point)))) + (col 1)) + (setcar last (point)) ; Update last known position. + (while (and fields fields1) + (let ((field (pop fields)) + (v (pop fields1))) + (cl-incf col) + (when (and (stringp field) + (stringp v) + (string-match "\\`[a-zA-Z][_a-zA-Z0-9]*\\'" + field)) + (push (cons field v) org-table-local-parameters) + (push (list field line col) + org-table-named-field-locations)))))))))) + ;; Re-use existing markers when possible. + (if (markerp org-table-current-begin-pos) + (move-marker org-table-current-begin-pos (point)) + (setq org-table-current-begin-pos (point-marker))) + ;; Analyze the line types. + (let ((l 0) hlines dlines types) + (while (looking-at "[ \t]*|\\(-\\)?") + (push (if (match-end 1) 'hline 'dline) types) + (if (match-end 1) (push l hlines) (push l dlines)) + (forward-line) + (cl-incf l)) + (push 'hline types) ; Add an imaginary extra hline to the end. + (setq org-table-current-line-types (apply #'vector (nreverse types))) + (setq org-table-dlines (apply #'vector (cons nil (nreverse dlines)))) + (setq org-table-hlines (apply #'vector (cons nil (nreverse hlines))))) + ;; Get the number of columns from the first data line in table. + (goto-char beg) + (forward-line (aref org-table-dlines 1)) + (setq org-table-current-ncol + (length (org-split-string + (buffer-substring (line-beginning-position) (line-end-position)) + "[ \t]*|[ \t]*")))))) + +(defun org-table--force-dataline () + "Move point to the closest data line in a table. +Raise an error if the table contains no data line. Preserve +column when moving point." + (unless (org-match-line org-table-dataline-regexp) + (let* ((re org-table-dataline-regexp) + (column (current-column)) + (p1 (save-excursion (re-search-forward re (org-table-end) t))) + (p2 (save-excursion (re-search-backward re (org-table-begin) t)))) + (cond ((and p1 p2) + (goto-char (if (< (abs (- p1 (point))) (abs (- p2 (point)))) + p1 + p2))) + ((or p1 p2) (goto-char (or p1 p2))) + (t (user-error "No table data line around here"))) + (org-move-to-column column)))) + +(defun org-table-show-reference (&optional local) + "Show the location/value of the $ expression at point. +When LOCAL is non-nil, show references for the table at point." + (interactive) + (org-table-remove-rectangle-highlight) + (when local (org-table-analyze)) + (catch 'exit + (let ((pos (if local (point) org-pos)) + (face2 'highlight) + (org-inhibit-highlight-removal t) + (win (selected-window)) + (org-show-positions nil) + var name e what match dest) + (setq what (cond + ((org-in-regexp "^@[0-9]+[ \t=]") + (setq match (concat (substring (match-string 0) 0 -1) + "$1.." + (substring (match-string 0) 0 -1) + "$100")) + 'range) + ((or (org-in-regexp org-table-range-regexp2) + (org-in-regexp org-table-translate-regexp) + (org-in-regexp org-table-range-regexp)) + (setq match + (save-match-data + (org-table-convert-refs-to-rc (match-string 0)))) + 'range) + ((org-in-regexp "\\$[a-zA-Z][a-zA-Z0-9]*") 'name) + ((org-in-regexp "\\$[0-9]+") 'column) + ((not local) nil) + (t (user-error "No reference at point"))) + match (and what (or match (match-string 0)))) + (when (and match (not (equal (match-beginning 0) (point-at-bol)))) + (org-table-add-rectangle-overlay (match-beginning 0) (match-end 0) + 'secondary-selection)) + (add-hook 'before-change-functions + #'org-table-remove-rectangle-highlight) + (when (eq what 'name) (setq var (substring match 1))) + (when (eq what 'range) + (unless (eq (string-to-char match) ?@) (setq match (concat "@" match))) + (setq match (org-table-formula-substitute-names match))) + (unless local + (save-excursion + (end-of-line) + (re-search-backward "^\\S-" nil t) + (beginning-of-line) + (when (looking-at "\\(\\$[0-9a-zA-Z]+\\|@[0-9]+\\$[0-9]+\\|[a-zA-Z]+\ +\\([0-9]+\\|&\\)\\) *=") + (setq dest + (save-match-data + (org-table-convert-refs-to-rc (match-string 1)))) + (org-table-add-rectangle-overlay + (match-beginning 1) (match-end 1) face2)))) + (if (and (markerp pos) (marker-buffer pos)) + (if (get-buffer-window (marker-buffer pos)) + (select-window (get-buffer-window (marker-buffer pos))) + (org-switch-to-buffer-other-window (get-buffer-window + (marker-buffer pos))))) + (goto-char pos) + (org-table--force-dataline) + (let ((table-start + (if local org-table-current-begin-pos (org-table-begin)))) + (when dest + (setq name (substring dest 1)) + (cond + ((string-match-p "\\`\\$[a-zA-Z][a-zA-Z0-9]*" dest) + (org-table-goto-field dest)) + ((string-match-p "\\`@\\([1-9][0-9]*\\)\\$\\([1-9][0-9]*\\)\\'" + dest) + (org-table-goto-field dest)) + (t (org-table-goto-column (string-to-number name)))) + (move-marker pos (point)) + (org-table-highlight-rectangle nil nil face2)) + (cond + ((equal dest match)) + ((not match)) + ((eq what 'range) + (ignore-errors (org-table-get-range match table-start nil 'highlight))) + ((setq e (assoc var org-table-named-field-locations)) + (org-table-goto-field var) + (org-table-highlight-rectangle) + (message "Named field, column %d of line %d" (nth 2 e) (nth 1 e))) + ((setq e (assoc var org-table-column-names)) + (org-table-goto-column (string-to-number (cdr e))) + (org-table-highlight-rectangle) + (goto-char table-start) + (if (re-search-forward (concat "^[ \t]*| *! *.*?| *\\(" var "\\) *|") + (org-table-end) t) + (progn + (goto-char (match-beginning 1)) + (org-table-highlight-rectangle) + (message "Named column (column %s)" (cdr e))) + (user-error "Column name not found"))) + ((eq what 'column) + ;; Column number. + (org-table-goto-column (string-to-number (substring match 1))) + (org-table-highlight-rectangle) + (message "Column %s" (substring match 1))) + ((setq e (assoc var org-table-local-parameters)) + (goto-char table-start) + (if (re-search-forward (concat "^[ \t]*| *\\$ *.*?| *\\(" var "=\\)") nil t) + (progn + (goto-char (match-beginning 1)) + (org-table-highlight-rectangle) + (message "Local parameter.")) + (user-error "Parameter not found"))) + ((not var) (user-error "No reference at point")) + ((setq e (assoc var org-table-formula-constants-local)) + (message "Local Constant: $%s=%s in #+CONSTANTS line." + var (cdr e))) + ((setq e (assoc var org-table-formula-constants)) + (message "Constant: $%s=%s in `org-table-formula-constants'." + var (cdr e))) + ((setq e (and (fboundp 'constants-get) (constants-get var))) + (message "Constant: $%s=%s, from `constants.el'%s." + var e (format " (%s units)" constants-unit-system))) + (t (user-error "Undefined name $%s" var))) + (goto-char pos) + (when (and org-show-positions + (not (memq this-command '(org-table-fedit-scroll + org-table-fedit-scroll-down)))) + (push pos org-show-positions) + (push table-start org-show-positions) + (let ((min (apply 'min org-show-positions)) + (max (apply 'max org-show-positions))) + (set-window-start (selected-window) min) + (goto-char max) + (or (pos-visible-in-window-p max) + (set-window-start (selected-window) max))))) + (select-window win)))) + + +;;; The Orgtbl minor mode + +;; Define a minor mode which can be used in other modes in order to +;; integrate the Org table editor. + +;; This is really a hack, because the Org table editor uses several +;; keys which normally belong to the major mode, for example the TAB +;; and RET keys. Here is how it works: The minor mode defines all the +;; keys necessary to operate the table editor, but wraps the commands +;; into a function which tests if the cursor is currently inside +;; a table. If that is the case, the table editor command is +;; executed. However, when any of those keys is used outside a table, +;; the function uses `key-binding' to look up if the key has an +;; associated command in another currently active keymap (minor modes, +;; major mode, global), and executes that command. There might be +;; problems if any of the keys used by the table editor is otherwise +;; used as a prefix key. + +;; Another challenge is that the key binding for TAB can be tab or \C-i, +;; likewise the binding for RET can be return or \C-m. Orgtbl-mode +;; addresses this by checking explicitly for both bindings. + +;; The optimized version (see variable `orgtbl-optimized') takes over +;; all keys which are bound to `self-insert-command' in the *global map*. +;; Some modes bind other commands to simple characters, for example +;; AUCTeX binds the double quote to `Tex-insert-quote'. With orgtbl-mode +;; active, this binding is ignored inside tables and replaced with a +;; modified self-insert. + +(defvar orgtbl-mode-map (make-keymap) + "Keymap for `orgtbl-mode'.") + +(defvar org-old-auto-fill-inhibit-regexp nil + "Local variable used by `orgtbl-mode'.") + +(defconst orgtbl-line-start-regexp + "[ \t]*\\(|\\|#\\+\\(tblfm\\|orgtbl\\|tblname\\):\\)" + "Matches a line belonging to an orgtbl.") + +(defconst orgtbl-extra-font-lock-keywords + (list (list (concat "^" orgtbl-line-start-regexp ".*") + 0 (quote 'org-table) 'prepend)) + "Extra `font-lock-keywords' to be added when `orgtbl-mode' is active.") + +;;;###autoload +(defun turn-on-orgtbl () + "Unconditionally turn on `orgtbl-mode'." + (require 'org-table) + (orgtbl-mode 1)) + +;; Install it as a minor mode. +(put 'orgtbl-mode :included t) +(put 'orgtbl-mode :menu-tag "Org Table Mode") + +(easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu." + '("OrgTbl" + ["Create or convert" org-table-create-or-convert-from-region + :active (not (org-at-table-p)) :keys "C-c |" ] + "--" + ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p) :keys "C-c C-c"] + ["Next Field" org-cycle :active (org-at-table-p) :keys "TAB"] + ["Previous Field" org-shifttab :active (org-at-table-p) :keys "S-TAB"] + ["Next Row" org-return :active (org-at-table-p) :keys "RET"] + "--" + ["Blank Field" org-table-blank-field :active (org-at-table-p) :keys "C-c SPC"] + ["Edit Field" org-table-edit-field :active (org-at-table-p) :keys "C-c ` "] + ["Copy Field from Above" + org-table-copy-down :active (org-at-table-p) :keys "S-RET"] + "--" + ("Column" + ["Move Column Left" org-metaleft :active (org-at-table-p) :keys "M-<left>"] + ["Move Column Right" org-metaright :active (org-at-table-p) :keys "M-<right>"] + ["Delete Column" org-shiftmetaleft :active (org-at-table-p) :keys "M-S-<left>"] + ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-<right>"]) + ("Row" + ["Move Row Up" org-metaup :active (org-at-table-p) :keys "M-<up>"] + ["Move Row Down" org-metadown :active (org-at-table-p) :keys "M-<down>"] + ["Delete Row" org-shiftmetaup :active (org-at-table-p) :keys "M-S-<up>"] + ["Insert Row" org-shiftmetadown :active (org-at-table-p) :keys "M-S-<down>"] + ["Sort lines in region" org-table-sort-lines :active (org-at-table-p) :keys "C-c ^"] + "--" + ["Insert Hline" org-table-insert-hline :active (org-at-table-p) :keys "C-c -"]) + ("Rectangle" + ["Copy Rectangle" org-copy-special :active (org-at-table-p)] + ["Cut Rectangle" org-cut-special :active (org-at-table-p)] + ["Paste Rectangle" org-paste-special :active (org-at-table-p)] + ["Fill Rectangle" org-table-wrap-region :active (org-at-table-p)]) + "--" + ("Radio tables" + ["Insert table template" orgtbl-insert-radio-table + (cl-assoc-if #'derived-mode-p orgtbl-radio-table-templates)] + ["Comment/uncomment table" orgtbl-toggle-comment t]) + "--" + ["Set Column Formula" org-table-eval-formula :active (org-at-table-p) :keys "C-c ="] + ["Set Field Formula" (org-table-eval-formula '(4)) :active (org-at-table-p) :keys "C-u C-c ="] + ["Edit Formulas" org-table-edit-formulas :active (org-at-table-p) :keys "C-c '"] + ["Recalculate line" org-table-recalculate :active (org-at-table-p) :keys "C-c *"] + ["Recalculate all" (org-table-recalculate '(4)) :active (org-at-table-p) :keys "C-u C-c *"] + ["Iterate all" (org-table-recalculate '(16)) :active (org-at-table-p) :keys "C-u C-u C-c *"] + ["Toggle Recalculate Mark" org-table-rotate-recalc-marks :active (org-at-table-p) :keys "C-c #"] + ["Sum Column/Rectangle" org-table-sum + :active (or (org-at-table-p) (org-region-active-p)) :keys "C-c +"] + ["Which Column?" org-table-current-column :active (org-at-table-p) :keys "C-c ?"] + ["Debug Formulas" + org-table-toggle-formula-debugger :active (org-at-table-p) + :keys "C-c {" + :style toggle :selected org-table-formula-debug] + ["Show Col/Row Numbers" + org-table-toggle-coordinate-overlays :active (org-at-table-p) + :keys "C-c }" + :style toggle :selected org-table-overlay-coordinates] + "--" + ("Plot" + ["Ascii plot" orgtbl-ascii-plot :active (org-at-table-p) :keys "C-c \" a"] + ["Gnuplot" org-plot/gnuplot :active (org-at-table-p) :keys "C-c \" g"]))) + +;;;###autoload +(define-minor-mode orgtbl-mode + "The Org mode table editor as a minor mode for use in other modes." + :lighter " OrgTbl" + (org-load-modules-maybe) + (cond + ((derived-mode-p 'org-mode) + ;; Exit without error, in case some hook functions calls this by + ;; 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!?! + ;; 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? + (and c (setq minor-mode-map-alist + (cons c (delq c minor-mode-map-alist))))) + (setq-local org-table-may-need-update t) + (add-hook 'before-change-functions 'org-before-change-function + nil 'local) + (setq-local org-old-auto-fill-inhibit-regexp + auto-fill-inhibit-regexp) + (setq-local auto-fill-inhibit-regexp + (if auto-fill-inhibit-regexp + (concat orgtbl-line-start-regexp "\\|" + auto-fill-inhibit-regexp) + orgtbl-line-start-regexp)) + (when (fboundp 'font-lock-add-keywords) + (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords) + (org-restart-font-lock))) + (t + (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) + (remove-hook 'before-change-functions 'org-before-change-function t) + (when (fboundp 'font-lock-remove-keywords) + (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords) + (org-restart-font-lock)) + (force-mode-line-update 'all)))) + +(defun orgtbl-make-binding (fun n &rest keys) + "Create a function for binding in the table minor mode. +FUN is the command to call inside a table. N is used to create a unique +command name. KEYS are keys that should be checked in for a command +to execute outside of tables." + (eval + (list 'defun + (intern (concat "orgtbl-hijacker-command-" (number-to-string n))) + '(arg) + (concat "In tables, run `" (symbol-name fun) "'.\n" + "Outside of tables, run the binding of `" + (mapconcat #'key-description keys "' or `") + "'.") + '(interactive "p") + (list 'if + '(org-at-table-p) + (list 'call-interactively (list 'quote fun)) + (list 'let '(orgtbl-mode) + (list 'call-interactively + (append '(or) + (mapcar (lambda (k) + (list 'key-binding k)) + keys) + '('orgtbl-error)))))))) + +(defun orgtbl-error () + "Error when there is no default binding for a table key." + (interactive) + (user-error "This key has no function outside tables")) + +(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-backward-char 'org-delete-backward-char) + (org-defkey orgtbl-mode-map "|" 'org-force-self-insert)) + t)) + +(defun orgtbl-ctrl-c-ctrl-c (arg) + "If the cursor is inside a table, realign the table. +If it is a table to be sent away to a receiver, do it. +With prefix arg, also recompute table." + (interactive "P") + (let ((case-fold-search t) (pos (point)) action) + (save-excursion + (beginning-of-line 1) + (setq action (cond + ((looking-at "[ \t]*#\\+ORGTBL:.*\n[ \t]*|") (match-end 0)) + ((looking-at "[ \t]*|") pos) + ((looking-at "[ \t]*#\\+tblfm:") 'recalc)))) + (cond + ((integerp action) + (goto-char action) + (org-table-maybe-eval-formula) + (if arg + (call-interactively 'org-table-recalculate) + (org-table-maybe-recalculate-line)) + (call-interactively 'org-table-align) + (when (orgtbl-send-table 'maybe) + (run-hooks 'orgtbl-after-send-table-hook))) + ((eq action 'recalc) + (save-excursion + (beginning-of-line 1) + (skip-chars-backward " \r\n\t") + (if (org-at-table-p) + (org-call-with-arg 'org-table-recalculate t)))) + (t (let (orgtbl-mode) + (call-interactively (key-binding "\C-c\C-c"))))))) + +(defun orgtbl-create-or-convert-from-region (_arg) + "Create table or convert region to table, if no conflicting binding. +This installs the table binding `C-c |', but only if there is no +conflicting binding to this key outside `orgtbl-mode'." + (interactive "P") + (let* (orgtbl-mode (cmd (key-binding "\C-c|"))) + (if cmd + (call-interactively cmd) + (call-interactively 'org-table-create-or-convert-from-region)))) + +(defun orgtbl-tab (arg) + "Justification and field motion for `orgtbl-mode'." + (interactive "P") + (if arg (org-table-edit-field t) + (org-table-justify-field-maybe) + (org-table-next-field))) + +(defun orgtbl-ret () + "Justification and field motion for `orgtbl-mode'." + (interactive) + (if (bobp) + (newline) + (org-table-justify-field-maybe) + (org-table-next-row))) + +(defun orgtbl-self-insert-command (N) + "Like `self-insert-command', use overwrite-mode for whitespace in tables. +If the cursor is in a table looking at whitespace, the whitespace is +overwritten, and the table is not marked as requiring realignment." + (interactive "p") + (if (and (org-at-table-p) + (or + (and org-table-auto-blank-field + (member last-command + '(orgtbl-hijacker-command-100 + orgtbl-hijacker-command-101 + orgtbl-hijacker-command-102 + orgtbl-hijacker-command-103 + orgtbl-hijacker-command-104 + orgtbl-hijacker-command-105 + yas/expand)) + (org-table-blank-field)) + t) + (eq N 1) + (looking-at "[^|\n]* \\( \\)|")) + (let (org-table-may-need-update) + (delete-region (match-beginning 1) (match-end 1)) + (self-insert-command N)) + (setq org-table-may-need-update t) + (let* (orgtbl-mode + a + (cmd (or (key-binding + (or (and (listp function-key-map) + (setq a (assoc last-input-event function-key-map)) + (cdr a)) + (vector last-input-event))) + 'self-insert-command))) + (call-interactively cmd) + (if (and org-self-insert-cluster-for-undo + (eq cmd 'self-insert-command)) + (if (not (eq last-command 'orgtbl-self-insert-command)) + (setq org-self-insert-command-undo-counter 1) + (if (>= org-self-insert-command-undo-counter 20) + (setq org-self-insert-command-undo-counter 1) + (and (> org-self-insert-command-undo-counter 0) + buffer-undo-list + (not (cadr buffer-undo-list)) ; remove nil entry + (setcdr buffer-undo-list (cddr buffer-undo-list))) + (setq org-self-insert-command-undo-counter + (1+ org-self-insert-command-undo-counter)))))))) + +;;;###autoload +(defvar orgtbl-exp-regexp "^\\([-+]?[0-9][0-9.]*\\)[eE]\\([-+]?[0-9]+\\)$" + "Regular expression matching exponentials as produced by calc.") + +(defun orgtbl-gather-send-defs () + "Gather a plist of :name, :transform, :params for each destination before +a radio table." + (save-excursion + (goto-char (org-table-begin)) + (let (rtn) + (beginning-of-line 0) + (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) + (beginning-of-line 0))) + rtn))) + +(defun orgtbl-send-replace-tbl (name text) + "Find and replace table NAME with TEXT." + (save-excursion + (goto-char (point-min)) + (let* ((location-flag nil) + (name (regexp-quote name)) + (begin-re (format "BEGIN +RECEIVE +ORGTBL +%s\\([ \t]\\|$\\)" name)) + (end-re (format "END +RECEIVE +ORGTBL +%s\\([ \t]\\|$\\)" name))) + (while (re-search-forward begin-re nil t) + (unless location-flag (setq location-flag t)) + (let ((beg (line-beginning-position 2))) + (unless (re-search-forward end-re nil t) + (user-error "Cannot find end of receiver location at %d" beg)) + (beginning-of-line) + (delete-region beg (point)) + (insert text "\n"))) + (unless location-flag + (user-error "No valid receiver location found in the buffer"))))) + +;;;###autoload +(defun org-table-to-lisp (&optional txt) + "Convert the table at point to a Lisp structure. + +The structure will be a list. Each item is either the symbol `hline' +for a horizontal separator line, or a list of field values as strings. +The table is taken from the parameter TXT, or from the buffer at point." + (if txt + (with-temp-buffer + (insert txt) + (goto-char (point-min)) + (org-table-to-lisp)) + (save-excursion + (goto-char (org-table-begin)) + (let ((table nil)) + (while (re-search-forward "\\=[ \t]*|" nil t) + (let ((row nil)) + (if (looking-at "-") + (push 'hline table) + (while (not (progn (skip-chars-forward " \t") (eolp))) + (push (buffer-substring + (point) + (progn (re-search-forward "[ \t]*\\(|\\|$\\)") + (match-beginning 0))) + row)) + (push (nreverse row) table))) + (forward-line)) + (nreverse table))))) + +(defun org-table-collapse-header (table &optional separator max-header-lines) + "Collapse the lines before 'hline into a single header. + +The given TABLE is a list of lists as returned by `org-table-to-lisp'. +The leading lines before the first `hline' symbol are considered +forming the table header. This function collapses all leading header +lines into a single header line, followed by the `hline' symbol, and +the rest of the TABLE. Header cells are glued together with a space, +or the given SEPARATOR." + (while (eq (car table) 'hline) (pop table)) + (let* ((separator (or separator " ")) + (max-header-lines (or max-header-lines 4)) + (trailer table) + (header-lines (cl-loop for line in table + until (eq 'hline line) + collect (pop trailer)))) + (if (and trailer (<= (length header-lines) max-header-lines)) + (cons (apply #'cl-mapcar + (lambda (&rest x) + (org-trim + (mapconcat #'identity x separator))) + header-lines) + trailer) + table))) + +(defun orgtbl-send-table (&optional maybe) + "Send a transformed version of table at point to the receiver position. +With argument MAYBE, fail quietly if no transformation is defined +for this table." + (interactive) + (catch 'exit + (unless (org-at-table-p) (user-error "Not at a table")) + ;; when non-interactive, we assume align has just happened. + (when (called-interactively-p 'any) (org-table-align)) + (let ((dests (orgtbl-gather-send-defs)) + (table (org-table-to-lisp)) + (ntbl 0)) + (unless dests + (if maybe (throw 'exit nil) + (user-error "Don't know how to transform this table"))) + (dolist (dest dests) + (let ((name (plist-get dest :name)) + (transform (plist-get dest :transform)) + (params (plist-get dest :params))) + (unless (fboundp transform) + (user-error "No such transformation function %s" transform)) + (orgtbl-send-replace-tbl name (funcall transform table params))) + (cl-incf ntbl)) + (message "Table converted and installed at %d receiver location%s" + ntbl (if (> ntbl 1) "s" "")) + (and (> ntbl 0) ntbl)))) + +(defun org-remove-by-index (list indices &optional i0) + "Remove the elements in LIST with indices in INDICES. +First element has index 0, or I0 if given." + (if (not indices) + list + (if (integerp indices) (setq indices (list indices))) + (setq i0 (1- (or i0 0))) + (delq :rm (mapcar (lambda (x) + (setq i0 (1+ i0)) + (if (memq i0 indices) :rm x)) + list)))) + +(defun orgtbl-toggle-comment () + "Comment or uncomment the orgtbl at point." + (interactive) + (let* ((case-fold-search t) + (re1 (concat "^" (regexp-quote comment-start) orgtbl-line-start-regexp)) + (re2 (concat "^" orgtbl-line-start-regexp)) + (commented (save-excursion (beginning-of-line 1) + (cond ((looking-at re1) t) + ((looking-at re2) nil) + (t (user-error "Not at an org table"))))) + (re (if commented re1 re2)) + beg end) + (save-excursion + (beginning-of-line 1) + (while (looking-at re) (beginning-of-line 0)) + (beginning-of-line 2) + (setq beg (point)) + (while (looking-at re) (beginning-of-line 2)) + (setq end (point))) + (comment-region beg end (if commented '(4) nil)))) + +(defun orgtbl-insert-radio-table () + "Insert a radio table template appropriate for this major mode." + (interactive) + (let* ((e (cl-assoc-if #'derived-mode-p orgtbl-radio-table-templates)) + (txt (nth 1 e)) + name pos) + (unless e (user-error "No radio table setup defined for %s" major-mode)) + (setq name (read-string "Table name: ")) + (while (string-match "%n" txt) + (setq txt (replace-match name t t txt))) + (or (bolp) (insert "\n")) + (setq pos (point)) + (insert txt) + (goto-char pos))) + +;;;###autoload +(defun orgtbl-to-generic (table params) + "Convert the `orgtbl-mode' TABLE to some other format. + +This generic routine can be used for many standard cases. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that +line. PARAMS is a property list of parameters that can +influence the conversion. + +Valid parameters are: + +:backend, :raw + + Export back-end used as a basis to transcode elements of the + table, when no specific parameter applies to it. It is also + used to translate cells contents. You can prevent this by + setting :raw property to a non-nil value. + +:splice + + When non-nil, only convert rows, not the table itself. This is + equivalent to setting to the empty string both :tstart + and :tend, which see. + +:skip + + When set to an integer N, skip the first N lines of the table. + Horizontal separation lines do count for this parameter! + +:skipcols + + List of columns that should be skipped. If the table has + a column with calculation marks, that column is automatically + discarded beforehand. + +:hline + + String to be inserted on horizontal separation lines. May be + nil to ignore these lines altogether. + +:sep + + Separator between two fields, as a string. + +Each in the following group may be either a string or a function +of no arguments returning a string: + +:tstart, :tend + + Strings to start and end the table. Ignored when :splice is t. + +:lstart, :lend + + Strings to start and end a new table line. + +:llstart, :llend + + Strings to start and end the last table line. Default, + respectively, to :lstart and :lend. + +Each in the following group may be a string or a function of one +argument (either the cells in the current row, as a list of +strings, or the current cell) returning a string: + +:lfmt + + Format string for an entire row, with enough %s to capture all + fields. When non-nil, :lstart, :lend, and :sep are ignored. + +:llfmt + + Format for the entire last line, defaults to :lfmt. + +:fmt + + A format to be used to wrap the field, should contain %s for + the original field value. For example, to wrap everything in + dollars, you could use :fmt \"$%s$\". This may also be + a property list with column numbers and format strings, or + functions, e.g., + + (:fmt (2 \"$%s$\" 4 (lambda (c) (format \"$%s$\" c)))) + +:hlstart :hllstart :hlend :hllend :hsep :hlfmt :hllfmt :hfmt + + Same as above, specific for the header lines in the table. + All lines before the first hline are treated as header. If + any of these is not present, the data line value is used. + +This may be either a string or a function of two arguments: + +:efmt + + Use this format to print numbers with exponential. The format + should have %s twice for inserting mantissa and exponent, for + example \"%s\\\\times10^{%s}\". This may also be a property + list with column numbers and format strings or functions. + :fmt will still be applied after :efmt." + ;; Make sure `org-export-create-backend' is available. + (require 'ox) + (let* ((backend (plist-get params :backend)) + (custom-backend + ;; Build a custom back-end according to PARAMS. Before + ;; defining a translator, check if there is anything to do. + ;; When there isn't, let BACKEND handle the element. + (org-export-create-backend + :parent (or backend 'org) + :transcoders + `((table . ,(org-table--to-generic-table params)) + (table-row . ,(org-table--to-generic-row params)) + (table-cell . ,(org-table--to-generic-cell params)) + ;; Macros are not going to be expanded. However, no + ;; regular back-end has a transcoder for them. We + ;; provide one so they are not ignored, but displayed + ;; as-is instead. + (macro . (lambda (m c i) (org-element-macro-interpreter m nil)))))) + data info) + ;; Store TABLE as Org syntax in DATA. Tolerate non-string cells. + ;; Initialize communication channel in INFO. + (with-temp-buffer + (let ((org-inhibit-startup t)) (org-mode)) + (let ((standard-output (current-buffer)) + (org-element-use-cache nil)) + (dolist (e table) + (cond ((eq e 'hline) (princ "|--\n")) + ((consp e) + (princ "| ") (dolist (c e) (princ c) (princ " |")) + (princ "\n"))))) + ;; Add back-end specific filters, but not user-defined ones. In + ;; particular, make sure to call parse-tree filters on the + ;; table. + (setq info + (let ((org-export-filters-alist nil)) + (org-export-install-filters + (org-combine-plists + (org-export-get-environment backend nil params) + `(:back-end ,(org-export-get-backend backend)))))) + (setq data + (org-export-filter-apply-functions + (plist-get info :filter-parse-tree) + (org-element-map (org-element-parse-buffer) 'table + #'identity nil t) + info))) + (when (and backend (symbolp backend) (not (org-export-get-backend backend))) + (user-error "Unknown :backend value")) + (when (or (not backend) (plist-get info :raw)) (require 'ox-org)) + ;; Handle :skip parameter. + (let ((skip (plist-get info :skip))) + (when skip + (unless (wholenump skip) (user-error "Wrong :skip value")) + (let ((n 0)) + (org-element-map data 'table-row + (lambda (row) + (if (>= n skip) t + (org-element-extract-element row) + (cl-incf n) + nil)) + nil t)))) + ;; Handle :skipcols parameter. + (let ((skipcols (plist-get info :skipcols))) + (when skipcols + (unless (consp skipcols) (user-error "Wrong :skipcols value")) + (org-element-map data 'table + (lambda (table) + (let ((specialp (org-export-table-has-special-column-p table))) + (dolist (row (org-element-contents table)) + (when (eq (org-element-property :type row) 'standard) + (let ((c 1)) + (dolist (cell (nthcdr (if specialp 1 0) + (org-element-contents row))) + (when (memq c skipcols) + (org-element-extract-element cell)) + (cl-incf c)))))))))) + ;; Since we are going to export using a low-level mechanism, + ;; ignore special column and special rows manually. + (let ((special? (org-export-table-has-special-column-p data)) + ignore) + (org-element-map data (if special? '(table-cell table-row) 'table-row) + (lambda (datum) + (when (if (eq (org-element-type datum) 'table-row) + (org-export-table-row-is-special-p datum nil) + (org-export-first-sibling-p datum nil)) + (push datum ignore)))) + (setq info (plist-put info :ignore-list ignore))) + ;; We use a low-level mechanism to export DATA so as to skip all + ;; usual pre-processing and post-processing, i.e., hooks, Babel + ;; code evaluation, include keywords and macro expansion. Only + ;; back-end specific filters are retained. + (let ((output (org-export-data-with-backend data custom-backend info))) + ;; Remove final newline. + (if (org-string-nw-p output) (substring-no-properties output 0 -1) "")))) + +(defun org-table--generic-apply (value name &optional with-cons &rest args) + (cond ((null value) nil) + ((functionp value) `(funcall ',value ,@args)) + ((stringp value) + (cond ((consp (car args)) `(apply #'format ,value ,@args)) + (args `(format ,value ,@args)) + (t value))) + ((and with-cons (consp value)) + `(let ((val (cadr (memq column ',value)))) + (cond ((null val) contents) + ((stringp val) (format val ,@args)) + ((functionp val) (funcall val ,@args)) + (t (user-error "Wrong %s value" ,name))))) + (t (user-error "Wrong %s value" name)))) + +(defun org-table--to-generic-table (params) + "Return custom table transcoder according to PARAMS. +PARAMS is a plist. See `orgtbl-to-generic' for more +information." + (let ((backend (plist-get params :backend)) + (splice (plist-get params :splice)) + (tstart (plist-get params :tstart)) + (tend (plist-get params :tend))) + `(lambda (table contents info) + (concat + ,(and tstart (not splice) + `(concat ,(org-table--generic-apply tstart ":tstart") "\n")) + ,(if (or (not backend) tstart tend splice) 'contents + `(org-export-with-backend ',backend table contents info)) + ,(org-table--generic-apply (and (not splice) tend) ":tend"))))) + +(defun org-table--to-generic-row (params) + "Return custom table row transcoder according to PARAMS. +PARAMS is a plist. See `orgtbl-to-generic' for more +information." + (let* ((backend (plist-get params :backend)) + (lstart (plist-get params :lstart)) + (llstart (plist-get params :llstart)) + (hlstart (plist-get params :hlstart)) + (hllstart (plist-get params :hllstart)) + (lend (plist-get params :lend)) + (llend (plist-get params :llend)) + (hlend (plist-get params :hlend)) + (hllend (plist-get params :hllend)) + (lfmt (plist-get params :lfmt)) + (llfmt (plist-get params :llfmt)) + (hlfmt (plist-get params :hlfmt)) + (hllfmt (plist-get params :hllfmt))) + `(lambda (row contents info) + (if (eq (org-element-property :type row) 'rule) + ,(cond + ((plist-member params :hline) + (org-table--generic-apply (plist-get params :hline) ":hline")) + (backend `(org-export-with-backend ',backend row nil info))) + (let ((headerp ,(and (or hlfmt hlstart hlend) + '(org-export-table-row-in-header-p row info))) + (last-header-p + ,(and (or hllfmt hllstart hllend) + '(org-export-table-row-ends-header-p row info))) + (lastp (not (org-export-get-next-element row info)))) + (when contents + ;; Check if we can apply `:lfmt', `:llfmt', `:hlfmt', or + ;; `:hllfmt' to CONTENTS. Otherwise, fallback on + ;; `:lstart', `:lend' and their relatives. + ,(let ((cells + '(org-element-map row 'table-cell + (lambda (cell) + ;; Export all cells, without separators. + ;; + ;; Use `org-export-data-with-backend' + ;; instead of `org-export-data' to eschew + ;; cached values, which + ;; ignore :orgtbl-ignore-sep parameter. + (org-export-data-with-backend + cell + (plist-get info :back-end) + (org-combine-plists info '(:orgtbl-ignore-sep t)))) + info))) + `(cond + ,(and hllfmt + `(last-header-p ,(org-table--generic-apply + hllfmt ":hllfmt" nil cells))) + ,(and hlfmt + `(headerp ,(org-table--generic-apply + hlfmt ":hlfmt" nil cells))) + ,(and llfmt + `(lastp ,(org-table--generic-apply + llfmt ":llfmt" nil cells))) + (t + ,(if lfmt (org-table--generic-apply lfmt ":lfmt" nil cells) + `(concat + (cond + ,(and + (or hllstart hllend) + `(last-header-p + (concat + ,(org-table--generic-apply hllstart ":hllstart") + contents + ,(org-table--generic-apply hllend ":hllend")))) + ,(and + (or hlstart hlend) + `(headerp + (concat + ,(org-table--generic-apply hlstart ":hlstart") + contents + ,(org-table--generic-apply hlend ":hlend")))) + ,(and + (or llstart llend) + `(lastp + (concat + ,(org-table--generic-apply llstart ":llstart") + contents + ,(org-table--generic-apply llend ":llend")))) + (t + ,(cond + ((or lstart lend) + `(concat + ,(org-table--generic-apply lstart ":lstart") + contents + ,(org-table--generic-apply lend ":lend"))) + (backend + `(org-export-with-backend + ',backend row contents info)) + (t 'contents))))))))))))))) + +(defun org-table--to-generic-cell (params) + "Return custom table cell transcoder according to PARAMS. +PARAMS is a plist. See `orgtbl-to-generic' for more +information." + (let* ((backend (plist-get params :backend)) + (efmt (plist-get params :efmt)) + (fmt (plist-get params :fmt)) + (hfmt (plist-get params :hfmt)) + (sep (plist-get params :sep)) + (hsep (plist-get params :hsep))) + `(lambda (cell contents info) + ;; Make sure that contents are exported as Org data when :raw + ;; parameter is non-nil. + ,(when (and backend (plist-get params :raw)) + `(setq contents + ;; Since we don't know what are the pseudo object + ;; types defined in backend, we cannot pass them to + ;; `org-element-interpret-data'. As a consequence, + ;; they will be treated as pseudo elements, and will + ;; have newlines appended instead of spaces. + ;; Therefore, we must make sure :post-blank value is + ;; really turned into spaces. + (replace-regexp-in-string + "\n" " " + (org-trim + (org-element-interpret-data + (org-element-contents cell)))))) + + (let ((headerp ,(and (or hfmt hsep) + '(org-export-table-row-in-header-p + (org-export-get-parent-element cell) info))) + (column + ;; Call costly `org-export-table-cell-address' only if + ;; absolutely necessary, i.e., if one + ;; of :fmt :efmt :hfmt has a "plist type" value. + ,(and (cl-some (lambda (v) (integerp (car-safe v))) + (list efmt hfmt fmt)) + '(1+ (cdr (org-export-table-cell-address cell info)))))) + (when contents + ;; Check if we can apply `:efmt' on CONTENTS. + ,(when efmt + `(when (string-match orgtbl-exp-regexp contents) + (let ((mantissa (match-string 1 contents)) + (exponent (match-string 2 contents))) + (setq contents ,(org-table--generic-apply + efmt ":efmt" t 'mantissa 'exponent))))) + ;; Check if we can apply FMT (or HFMT) on CONTENTS. + (cond + ,(and hfmt `(headerp (setq contents ,(org-table--generic-apply + hfmt ":hfmt" t 'contents)))) + ,(and fmt `(t (setq contents ,(org-table--generic-apply + fmt ":fmt" t 'contents)))))) + ;; If a separator is provided, use it instead of BACKEND's. + ;; Separators are ignored when LFMT (or equivalent) is + ;; provided. + ,(cond + ((or hsep sep) + `(if (or ,(and (not sep) '(not headerp)) + (plist-get info :orgtbl-ignore-sep) + (not (org-export-get-next-element cell info))) + ,(if (not backend) 'contents + `(org-export-with-backend ',backend cell contents info)) + (concat contents + ,(if (and sep hsep) `(if headerp ,hsep ,sep) + (or hsep sep))))) + (backend `(org-export-with-backend ',backend cell contents info)) + (t 'contents)))))) + +;;;###autoload +(defun orgtbl-to-tsv (table params) + "Convert the `orgtbl-mode' TABLE to TAB separated material." + (orgtbl-to-generic table (org-combine-plists '(:sep "\t") params))) + +;;;###autoload +(defun orgtbl-to-csv (table params) + "Convert the `orgtbl-mode' TABLE to CSV material. +This does take care of the proper quoting of fields with comma or quotes." + (orgtbl-to-generic table + (org-combine-plists '(:sep "," :fmt org-quote-csv-field) + params))) + +;;;###autoload +(defun orgtbl-to-latex (table params) + "Convert the `orgtbl-mode' TABLE to LaTeX. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +supported. It is also possible to use the following ones: + +:booktabs + + When non-nil, use formal \"booktabs\" style. + +:environment + + Specify environment to use, as a string. If you use + \"longtable\", you may also want to specify :language property, + as a string, to get proper continuation strings." + (require 'ox-latex) + (orgtbl-to-generic + table + (org-combine-plists + ;; Provide sane default values. + (list :backend 'latex + :latex-default-table-mode 'table + :latex-tables-centered nil + :latex-tables-booktabs (plist-get params :booktabs) + :latex-table-scientific-notation nil + :latex-default-table-environment + (or (plist-get params :environment) "tabular")) + params))) + +;;;###autoload +(defun orgtbl-to-html (table params) + "Convert the `orgtbl-mode' TABLE to HTML. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +supported. It is also possible to use the following one: + +:attributes + + Attributes and values, as a plist, which will be used in + <table> tag." + (require 'ox-html) + (orgtbl-to-generic + table + (org-combine-plists + ;; Provide sane default values. + (list :backend 'html + :html-table-data-tags '("<td%s>" . "</td>") + :html-table-use-header-tags-for-first-column nil + :html-table-align-individual-fields t + :html-table-row-tags '("<tr>" . "</tr>") + :html-table-attributes + (if (plist-member params :attributes) + (plist-get params :attributes) + '(:border "2" :cellspacing "0" :cellpadding "6" :rules "groups" + :frame "hsides"))) + params))) + +;;;###autoload +(defun orgtbl-to-texinfo (table params) + "Convert the `orgtbl-mode' TABLE to Texinfo. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +supported. It is also possible to use the following one: + +:columns + + Column widths, as a string. When providing column fractions, + \"@columnfractions\" command can be omitted." + (require 'ox-texinfo) + (let ((output + (orgtbl-to-generic + table + (org-combine-plists + (list :backend 'texinfo + :texinfo-tables-verbatim nil + :texinfo-table-scientific-notation nil) + params))) + (columns (let ((w (plist-get params :columns))) + (cond ((not w) nil) + ((string-match-p "{\\|@columnfractions " w) w) + (t (concat "@columnfractions " w)))))) + (if (not columns) output + (replace-regexp-in-string + "@multitable \\(.*\\)" columns output t nil 1)))) + +;;;###autoload +(defun orgtbl-to-orgtbl (table params) + "Convert the `orgtbl-mode' TABLE into another orgtbl-mode table. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +supported. + +Useful when slicing one table into many. The :hline, :sep, +:lstart, and :lend provide orgtbl framing. :tstart and :tend can +be set to provide ORGTBL directives for the generated table." + (require 'ox-org) + (orgtbl-to-generic table (org-combine-plists params (list :backend 'org)))) + +(defun orgtbl-to-table.el (table params) + "Convert the `orgtbl-mode' TABLE into a table.el table. +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +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)))))) + +(defun orgtbl-to-unicode (table params) + "Convert the `orgtbl-mode' TABLE into a table with unicode characters. + +TABLE is a list, each entry either the symbol `hline' for +a horizontal separator line, or a list of fields for that line. +PARAMS is a property list of parameters that can influence the +conversion. All parameters from `orgtbl-to-generic' are +supported. It is also possible to use the following ones: + +:ascii-art + + When non-nil, use \"ascii-art-to-unicode\" package to translate + the table. You can download it here: + https://gnuvola.org/software/j/aa2u/ascii-art-to-unicode.el. + +:narrow + + When non-nil, narrow columns width than provided width cookie, + using \"=>\" as an ellipsis, just like in an Org mode buffer." + (require 'ox-ascii) + (orgtbl-to-generic + table + (org-combine-plists + (list :backend 'ascii + :ascii-charset 'utf-8 + :ascii-table-widen-columns (not (plist-get params :narrow)) + :ascii-table-use-ascii-art (plist-get params :ascii-art)) + params))) + +;; Put the cursor in a column containing numerical values +;; of an Org table, +;; type C-c " a +;; A new column is added with a bar plot. +;; When the table is refreshed (C-u C-c *), +;; the plot is updated to reflect the new values. + +(defun orgtbl-ascii-draw (value min max &optional width characters) + "Draw an ascii bar in a table. +VALUE is the value to plot, it determines the width of the bar to draw. +MIN is the value that will be displayed as empty (zero width bar). +MAX is the value that will draw a bar filling all the WIDTH. +WIDTH is the span in characters from MIN to MAX. +CHARACTERS is a string that will compose the bar, with shades of grey +from pure white to pure black. It defaults to a 10 characters string +of regular ascii characters." + (let* ((width (ceiling (or width 12))) + (characters (or characters " .:;c!lhVHW")) + (len (1- (length characters))) + (value (float (if (numberp value) + value (string-to-number value)))) + (relative (/ (- value min) (- max min))) + (steps (round (* relative width len)))) + (cond ((< steps 0) "too small") + ((> steps (* width len)) "too large") + (t (let* ((int-division (/ steps len)) + (remainder (- steps (* int-division len)))) + (concat (make-string int-division (elt characters len)) + (string (elt characters remainder)))))))) + +;;;###autoload +(defun orgtbl-ascii-plot (&optional ask) + "Draw an ASCII bar plot in a column. + +With cursor in a column containing numerical values, this function +will draw a plot in a new column. + +ASK, if given, is a numeric prefix to override the default 12 +characters width of the plot. ASK may also be the `\\[universal-argument]' \ +prefix, +which will prompt for the width." + (interactive "P") + (let ((col (org-table-current-column)) + (min 1e999) ; 1e999 will be converted to infinity + (max -1e999) ; which is the desired result + (table (org-table-to-lisp)) + (length + (cond ((consp ask) + (read-number "Length of column " 12)) + ((numberp ask) ask) + (t 12)))) + ;; Skip any hline a the top of table. + (while (eq (car table) 'hline) (pop table)) + ;; Skip table header if any. + (dolist (x (or (cdr (memq 'hline table)) table)) + (when (consp x) + (setq x (nth (1- col) x)) + (when (string-match + "^[-+]?\\([0-9]*[.]\\)?[0-9]*\\([eE][+-]?[0-9]+\\)?$" + x) + (setq x (string-to-number x)) + (when (> min x) (setq min x)) + (when (< max x) (setq max x))))) + (org-table-insert-column) + (org-table-move-column-right) + (org-table-store-formulas + (cons + (cons + (concat "$" (number-to-string (1+ col))) + (format "'(%s $%s %s %s %s)" + "orgtbl-ascii-draw" col min max length)) + (org-table-get-stored-formulas))) + (org-table-recalculate t))) + +;; Example of extension: unicode characters +;; Here are two examples of different styles. + +;; Unicode block characters are used to give a smooth effect. +;; See https://en.wikipedia.org/wiki/Block_Elements +;; Use one of those drawing functions +;; - orgtbl-ascii-draw (the default ascii) +;; - orgtbl-uc-draw-grid (unicode with a grid effect) +;; - orgtbl-uc-draw-cont (smooth unicode) + +;; This is best viewed with the "DejaVu Sans Mono" font +;; (use M-x set-frame-font). + +(defun orgtbl-uc-draw-grid (value min max &optional width) + "Draw a bar in a table using block unicode characters. +It is a variant of `orgtbl-ascii-draw' with Unicode block +characters, for a smooth display. Bars appear as grids (to the +extent the font allows)." + ;; https://en.wikipedia.org/wiki/Block_Elements + ;; best viewed with the "DejaVu Sans Mono" font. + (orgtbl-ascii-draw value min max width + " \u258F\u258E\u258D\u258C\u258B\u258A\u2589")) + +(defun orgtbl-uc-draw-cont (value min max &optional width) + "Draw a bar in a table using block unicode characters. +It is a variant of `orgtbl-ascii-draw' with Unicode block +characters, for a smooth display. Bars are solid (to the extent +the font allows)." + (orgtbl-ascii-draw value min max width + " \u258F\u258E\u258D\u258C\u258B\u258A\u2589\u2588")) + +(defun org-table-get-remote-range (name-or-id form) + "Get a field value or a list of values in a range from table at ID. + +NAME-OR-ID may be the name of a table in the current file as set +by a \"#+NAME:\" directive. The first table following this line +will then be used. Alternatively, it may be an ID referring to +any entry, also in a different file. In this case, the first +table in that entry will be referenced. +FORM is a field or range descriptor like \"@2$3\" or \"B3\" or +\"@I$2..@II$2\". All the references must be absolute, not relative. + +The return value is either a single string for a single field, or a +list of the fields in the rectangle." + (save-match-data + (let ((case-fold-search t) (id-loc nil) + ;; Protect a bunch of variables from being overwritten by + ;; the context of the remote table. + org-table-column-names org-table-column-name-regexp + org-table-local-parameters org-table-named-field-locations + org-table-current-line-types + org-table-current-begin-pos org-table-dlines + org-table-current-ncol + org-table-hlines + org-table-last-column-widths + org-table-last-alignment + buffer loc) + (setq form (org-table-convert-refs-to-rc form)) + (org-with-wide-buffer + (goto-char (point-min)) + (if (re-search-forward + (concat "^[ \t]*#\\+\\(tbl\\)?name:[ \t]*" + (regexp-quote name-or-id) "[ \t]*$") + nil t) + (setq buffer (current-buffer) loc (match-beginning 0)) + (setq id-loc (org-id-find name-or-id 'marker)) + (unless (and id-loc (markerp id-loc)) + (user-error "Can't find remote table \"%s\"" name-or-id)) + (setq buffer (marker-buffer id-loc) + loc (marker-position id-loc)) + (move-marker id-loc nil)) + (with-current-buffer buffer + (org-with-wide-buffer + (goto-char loc) + (forward-char 1) + (unless (and (re-search-forward "^\\(\\*+ \\)\\|^[ \t]*|" nil t) + (not (match-beginning 1))) + (user-error "Cannot find a table at NAME or ID %s" name-or-id)) + (org-table-analyze) + (setq form (org-table-formula-substitute-names + (org-table-formula-handle-first/last-rc form))) + (if (and (string-match org-table-range-regexp form) + (> (length (match-string 0 form)) 1)) + (org-table-get-range + (match-string 0 form) org-table-current-begin-pos 1) + form))))))) + +(defun org-table-remote-reference-indirection (form) + "Return formula with table remote references substituted by indirection. +For example \"remote($1, @>$2)\" => \"remote(year_2013, @>$1)\". +This indirection works only with the format @ROW$COLUMN. The +format \"B3\" is not supported because it can not be +distinguished from a plain table name or ID." + (let ((regexp + ;; Same as in `org-table-eval-formula'. + (concat "\\<remote([ \t]*\\(" + ;; Allow "$1", "@<", "$-1", "@<<$1" etc. + "[@$][^ \t,]+" + "\\)[ \t]*,[ \t]*\\([^\n)]+\\))"))) + (replace-regexp-in-string + regexp + (lambda (m) + (save-match-data + (let ((eq (org-table-formula-handle-first/last-rc (match-string 1 m)))) + (org-table-get-range + (if (string-match-p "\\`\\$[0-9]+\\'" eq) + (concat "@0" eq) + eq))))) + form t t 1))) + +(defmacro org-define-lookup-function (mode) + (let ((mode-str (symbol-name mode)) + (first-p (eq mode 'first)) + (all-p (eq mode 'all))) + (let ((plural-str (if all-p "s" ""))) + `(defun ,(intern (format "org-lookup-%s" mode-str)) (val s-list r-list &optional predicate) + ,(format "Find %s occurrence%s of VAL in S-LIST; return corresponding element%s of R-LIST. +If R-LIST is nil, return matching element%s of S-LIST. +If PREDICATE is not nil, use it instead of `equal' to match VAL. +Matching is done by (PREDICATE VAL S), where S is an element of S-LIST. +This function is generated by a call to the macro `org-define-lookup-function'." + mode-str plural-str plural-str plural-str) + (let ,(let ((lvars '((p (or predicate 'equal)) + (sl s-list) + (rl (or r-list s-list)) + (ret nil)))) + (if first-p (cons '(match-p nil) lvars) lvars)) + (while ,(if first-p '(and (not match-p) sl) 'sl) + (when (funcall p val (car sl)) + ,(when first-p '(setq match-p t)) + (let ((rval (car rl))) + (setq ret ,(if all-p '(append ret (list rval)) 'rval)))) + (setq sl (cdr sl) rl (cdr rl))) + ret))))) + +(org-define-lookup-function first) +(org-define-lookup-function last) +(org-define-lookup-function all) + +(provide 'org-table) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-table.el ends here diff --git a/elpa/org-9.5.2/org-table.elc b/elpa/org-9.5.2/org-table.elc new file mode 100644 index 0000000..ffb9f72 Binary files /dev/null and b/elpa/org-9.5.2/org-table.elc differ diff --git a/elpa/org-9.5.2/org-tempo.el b/elpa/org-9.5.2/org-tempo.el new file mode 100644 index 0000000..c121b8e --- /dev/null +++ b/elpa/org-9.5.2/org-tempo.el @@ -0,0 +1,188 @@ +;;; org-tempo.el --- Template expansion for Org structures -*- lexical-binding: t; -*- + +;; Copyright (C) 2017-2021 Free Software Foundation, Inc. +;; +;; Author: Rasmus Pank Roulund <emacs at pank dot eu> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;; +;;; Commentary: +;; +;; Org Tempo reimplements completions of structure template before +;; point like `org-try-structure-completion' in Org v9.1 and earlier. +;; For example, strings like "<e" at the beginning of the line will be +;; expanded to an example block. +;; +;; All blocks defined in `org-structure-template-alist' are added as +;; Org Tempo shortcuts, in addition to keywords defined in +;; `org-tempo-keywords-alist'. +;; +;; `tempo' can also be used to define more sophisticated keywords +;; completions. See the section "Additional keywords" below for +;; examples. +;; +;;; Code: + +(require 'tempo) +(require 'cl-lib) +(require 'org) + +(defvar org-structure-template-alist) + + +(defgroup org-tempo nil + "Template expansion of Org structures." + :tag "Org structure" + :group 'org) + +(defvar org-tempo-tags nil + "Tempo tags for Org mode.") + +(defcustom org-tempo-keywords-alist + '(("L" . "latex") + ("H" . "html") + ("A" . "ascii") + ("i" . "index")) + "Keyword completion elements. + +This is an alist of KEY characters and corresponding KEYWORDS, +just like `org-structure-template-alist'. The tempo snippet +\"<KEY\" will be expanded using the KEYWORD value. For example +\"<L\" at the beginning of a line is expanded to \"#+latex:\". + +Do not use \"I\" as a KEY, as it is reserved for expanding +\"#+include\"." + :group 'org-tempo + :type '(repeat (cons (string :tag "Key") + (string :tag "Keyword"))) + :package-version '(Org . "9.2")) + + + +;;; Org Tempo functions and setup. + +(defun org-tempo-setup () + "Setup tempo tags and match finder for the current buffer." + (org-tempo--update-maybe) + (tempo-use-tag-list 'org-tempo-tags) + (setq-local tempo-match-finder "^ *\\(<[[:word:]]+\\)\\=")) + +(defun org-tempo--keys () + "Return a list of all Org Tempo expansion strings, like \"<s\"." + (mapcar (lambda (pair) (format "<%s" (car pair))) + (append org-structure-template-alist + org-tempo-keywords-alist))) + +(defun org-tempo--update-maybe () + "Check and add new Org Tempo templates if necessary. +In particular, if new entries were added to +`org-structure-template-alist' or `org-tempo-keywords-alist', new +Tempo templates will be added." + (unless (cl-every (lambda (key) (assoc key org-tempo-tags)) + (org-tempo--keys)) + (org-tempo-add-templates))) + +(defun org-tempo-add-templates () + "Update all Org Tempo templates. + +Go through `org-structure-template-alist' and +`org-tempo-keywords-alist' and update tempo templates." + (mapc 'org--check-org-structure-template-alist '(org-structure-template-alist + org-tempo-keywords-alist)) + (let ((keys (org-tempo--keys))) + ;; Check for duplicated snippet keys and warn if any are found. + (when (> (length keys) (length (delete-dups keys))) + (warn + "Duplicated keys in `org-structure-template-alist' and `org-tempo-keywords-alist'")) + ;; Remove any keys already defined in case they have been updated. + (setq org-tempo-tags + (cl-remove-if (lambda (tag) (member (car tag) keys)) org-tempo-tags)) + (mapc #'org-tempo-add-block org-structure-template-alist) + (mapc #'org-tempo-add-keyword org-tempo-keywords-alist))) + +(defun org-tempo-add-block (entry) + "Add block entry from `org-structure-template-alist'." + (let* ((key (format "<%s" (car entry))) + (name (cdr entry)) + (special (member name '("src" "export")))) + (tempo-define-template (format "org-%s" (replace-regexp-in-string " " "-" name)) + `(,(format "#+begin_%s%s" name (if special " " "")) + ,(when special 'p) '> n ,(unless special 'p) n + ,(format "#+end_%s" (car (split-string name " "))) + >) + key + (format "Insert a %s block" name) + 'org-tempo-tags))) + +(defun org-tempo-add-keyword (entry) + "Add keyword entry from `org-tempo-keywords-alist'." + (let* ((key (format "<%s" (car entry))) + (name (cdr entry))) + (tempo-define-template (format "org-%s" (replace-regexp-in-string " " "-" name)) + `(,(format "#+%s: " name) p '>) + key + (format "Insert a %s keyword" name) + 'org-tempo-tags))) + +(defun org-tempo-complete-tag (&rest _) + "Look for a tag and expand it silently. +Unlike to `tempo-complete-tag', do not give a signal if a partial +completion or no match at all is found. Return nil if expansion +didn't succeed." + (org-tempo--update-maybe) + ;; `tempo-complete-tag' returns its SILENT argument when there is no + ;; completion available at all. + (not (eq 'fail (tempo-complete-tag 'fail)))) + + +;;; Additional keywords + +(defun org-tempo--include-file () + "Add #+include: and a file name." + (let ((inhibit-quit t)) + (unless (with-local-quit + (prog1 t + (insert + (format "#+include: %S " + (file-relative-name + (read-file-name "Include file: ")))))) + (insert "<I") + (setq quit-flag nil)))) + +(tempo-define-template "org-include" + '((org-tempo--include-file) + p >) + "<I" + "Include keyword" + 'org-tempo-tags) + +;;; Setup of Org Tempo +;; +;; Org Tempo is set up with each new Org buffer and potentially in the +;; current Org buffer. + +(add-hook 'org-mode-hook 'org-tempo-setup) +(add-hook 'org-tab-before-tab-emulation-hook 'org-tempo-complete-tag) + +;; Enable Org Tempo in all open Org buffers. +(dolist (b (org-buffer-list 'files)) + (with-current-buffer b (org-tempo-setup))) + +(provide 'org-tempo) + +;;; org-tempo.el ends here diff --git a/elpa/org-9.5.2/org-tempo.elc b/elpa/org-9.5.2/org-tempo.elc new file mode 100644 index 0000000..da9bb85 Binary files /dev/null and b/elpa/org-9.5.2/org-tempo.elc differ diff --git a/elpa/org-9.5.2/org-timer.el b/elpa/org-9.5.2/org-timer.el new file mode 100644 index 0000000..bfcea44 --- /dev/null +++ b/elpa/org-9.5.2/org-timer.el @@ -0,0 +1,494 @@ +;;; org-timer.el --- Timer code for Org mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements two types of timers for Org buffers: +;; +;; - A relative timer that counts up (from 0 or a specified offset) +;; - A countdown timer that counts down from a specified time +;; +;; The relative and countdown timers differ in their entry points. +;; Use `org-timer' or `org-timer-start' to start the relative timer, +;; and `org-timer-set-timer' to start the countdown timer. + +;;; Code: + +(require 'cl-lib) +(require 'org-clock) + +(declare-function org-agenda-error "org-agenda" ()) + +(defvar org-timer-start-time nil + "t=0 for the running timer.") + +(defvar org-timer-pause-time nil + "Time when the timer was paused.") + +(defvar org-timer-countdown-timer nil + "Current countdown timer. +This is a timer object if there is an active countdown timer, +`paused' if there is a paused countdown timer, and nil +otherwise.") + +(defvar org-timer-countdown-timer-title nil + "Title for notification displayed when a countdown finishes.") + +(defconst org-timer-re "\\([-+]?[0-9]+\\):\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)" + "Regular expression used to match timer stamps.") + +(defcustom org-timer-format "%s " + "The format to insert the time of the timer. +This format must contain one instance of \"%s\" which will be replaced by +the value of the timer." + :group 'org-time + :type 'string) + +(defcustom org-timer-default-timer "0" + "The default timer when a timer is set, in minutes or hh:mm:ss format. +When 0, the user is prompted for a value." + :group 'org-time + :version "26.1" + :package-version '(Org . "8.3") + :type 'string) + +(defcustom org-timer-display 'mode-line + "Define where running timer is displayed, if at all. +When a timer is running, Org can display it in the mode line +and/or frame title. Allowed values are: + +both displays in both mode line and frame title +mode-line displays only in mode line (default) +frame-title displays only in frame title +nil current timer is not displayed" + :group 'org-time + :type '(choice + (const :tag "Mode line" mode-line) + (const :tag "Frame title" frame-title) + (const :tag "Both" both) + (const :tag "None" nil))) + +(defvar org-timer-start-hook nil + "Hook run after relative timer is started.") + +(defvar org-timer-stop-hook nil + "Hook run before relative or countdown timer is stopped.") + +(defvar org-timer-pause-hook nil + "Hook run before relative or countdown timer is paused.") + +(defvar org-timer-continue-hook nil + "Hook run after relative or countdown timer is continued.") + +(defvar org-timer-set-hook nil + "Hook run after countdown timer is set.") + +(defvar org-timer-done-hook nil + "Hook run after countdown timer reaches zero.") + +;;;###autoload +(defun org-timer-start (&optional offset) + "Set the starting time for the relative timer to now. +When called with prefix argument OFFSET, prompt the user for an offset time, +with the default taken from a timer stamp at point, if any. +If OFFSET is a string or an integer, it is directly taken to be the offset +without user interaction. +When called with a double prefix arg, all timer strings in the active +region will be shifted by a specific amount. You will be prompted for +the amount, with the default to make the first timer string in +the region 0:00:00." + (interactive "P") + (cond + ((equal offset '(16)) + (call-interactively 'org-timer-change-times-in-region)) + (org-timer-countdown-timer + (user-error "Countdown timer is running. Cancel first")) + (t + (let (delta def s) + (if (not offset) + (setq org-timer-start-time (current-time)) + (cond + ((integerp offset) (setq delta offset)) + ((stringp offset) (setq delta (org-timer-hms-to-secs offset))) + (t + (setq def (if (org-in-regexp org-timer-re) + (match-string 0) + "0:00:00") + s (read-string + (format "Restart timer with offset [%s]: " def))) + (unless (string-match "\\S-" s) (setq s def)) + (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s))))) + (setq org-timer-start-time (org-time-since delta))) + (setq org-timer-pause-time nil) + (org-timer-set-mode-line 'on) + (message "Timer start time set to %s, current value is %s" + (format-time-string "%T" org-timer-start-time) + (org-timer-secs-to-hms (or delta 0))) + (run-hooks 'org-timer-start-hook))))) + +;;;###autoload +(defun org-timer-pause-or-continue (&optional stop) + "Pause or continue the relative or countdown timer. +With prefix arg STOP, stop it entirely." + (interactive "P") + (cond + (stop (org-timer-stop)) + ((not org-timer-start-time) (error "No timer is running")) + (org-timer-pause-time + (let ((start-secs (float-time org-timer-start-time)) + (pause-secs (float-time org-timer-pause-time))) + (if org-timer-countdown-timer + (let ((new-secs (- start-secs pause-secs))) + (setq org-timer-countdown-timer + (org-timer--run-countdown-timer + new-secs org-timer-countdown-timer-title)) + (setq org-timer-start-time (org-time-add nil new-secs))) + (setq org-timer-start-time + (org-time-since (- pause-secs start-secs)))) + (setq org-timer-pause-time nil) + (org-timer-set-mode-line 'on) + (run-hooks 'org-timer-continue-hook) + (message "Timer continues at %s" (org-timer-value-string)))) + (t + ;; pause timer + (when org-timer-countdown-timer + (cancel-timer org-timer-countdown-timer) + (setq org-timer-countdown-timer 'paused)) + (run-hooks 'org-timer-pause-hook) + (setq org-timer-pause-time (current-time)) + (org-timer-set-mode-line 'paused) + (message "Timer paused at %s" (org-timer-value-string))))) + +;;;###autoload +(defun org-timer-stop () + "Stop the relative or countdown timer." + (interactive) + (unless org-timer-start-time + (user-error "No timer running")) + (when (timerp org-timer-countdown-timer) + (cancel-timer org-timer-countdown-timer)) + (run-hooks 'org-timer-stop-hook) + (setq org-timer-start-time nil + org-timer-pause-time nil + org-timer-countdown-timer nil) + (org-timer-set-mode-line 'off) + (message "Timer stopped")) + +;;;###autoload +(defun org-timer (&optional restart no-insert) + "Insert a H:MM:SS string from the timer into the buffer. +The first time this command is used, the timer is started. + +When used with a `\\[universal-argument]' prefix, force restarting the timer. + +When used with a `\\[universal-argument] \\[universal-argument]' \ +prefix, change all the timer strings +in the region by a fixed amount. This can be used to re-calibrate +a timer that was not started at the correct moment. + +If NO-INSERT is non-nil, return the string instead of inserting +it in the buffer." + (interactive "P") + (if (equal restart '(16)) + (org-timer-start restart) + (when (or (equal restart '(4)) (not org-timer-start-time)) + (org-timer-start)) + (if no-insert + (org-timer-value-string) + (insert (org-timer-value-string))))) + +(defun org-timer-value-string () + "Return current timer string." + (format org-timer-format + (org-timer-secs-to-hms + (let ((time (- (float-time org-timer-pause-time) + (float-time org-timer-start-time)))) + (abs (floor (if org-timer-countdown-timer (- time) time))))))) + +;;;###autoload +(defun org-timer-change-times-in-region (beg end delta) + "Change all h:mm:ss time in region by a DELTA." + (interactive + "r\nsEnter time difference like \"-1:08:26\". Default is first time to zero: ") + (let ((re "[-+]?[0-9]+:[0-9]\\{2\\}:[0-9]\\{2\\}") p) + (unless (string-match "\\S-" delta) + (save-excursion + (goto-char beg) + (when (re-search-forward re end t) + (setq delta (match-string 0)) + (if (equal (string-to-char delta) ?-) + (setq delta (substring delta 1)) + (setq delta (concat "-" delta)))))) + (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete delta))) + (when (= delta 0) (error "No change")) + (save-excursion + (goto-char end) + (while (re-search-backward re beg t) + (setq p (point)) + (replace-match + (save-match-data + (org-timer-secs-to-hms (+ (org-timer-hms-to-secs (match-string 0)) delta))) + t t) + (goto-char p))))) + +;;;###autoload +(defun org-timer-item (&optional arg) + "Insert a description-type item with the current timer value." + (interactive "P") + (let ((itemp (org-in-item-p)) (pos (point))) + (cond + ;; In a timer list, insert with `org-list-insert-item', + ;; then fix the list. + ((and itemp (goto-char itemp) (org-at-item-timer-p)) + (let* ((struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (s (concat (org-timer (when arg '(4)) t) ":: "))) + (setq struct (org-list-insert-item pos struct prevs nil s)) + (org-list-write-struct struct (org-list-parents-alist struct)) + (looking-at org-list-full-item-re) + (goto-char (match-end 0)))) + ;; In a list of another type, don't break anything: throw an error. + (itemp (goto-char pos) (error "This is not a timer list")) + ;; Else, start a new list. + (t + (beginning-of-line) + (org-indent-line) + (insert "- ") + (org-timer (when arg '(4))) + (insert ":: "))))) + +(defun org-timer-fix-incomplete (hms) + "If hms is a H:MM:SS string with missing hour or hour and minute, fix it." + (if (string-match "\\(?:\\([0-9]+:\\)?\\([0-9]+:\\)\\)?\\([0-9]+\\)" hms) + (replace-match + (format "%d:%02d:%02d" + (if (match-end 1) (string-to-number (match-string 1 hms)) 0) + (if (match-end 2) (string-to-number (match-string 2 hms)) 0) + (string-to-number (match-string 3 hms))) + t t hms) + (error "Cannot parse HMS string \"%s\"" hms))) + +(defun org-timer-hms-to-secs (hms) + "Convert h:mm:ss string to an integer time. +If the string starts with a minus sign, the integer will be negative." + (if (not (string-match + "\\([-+]?[0-9]+\\):\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)" + hms)) + 0 + (let* ((h (string-to-number (match-string 1 hms))) + (m (string-to-number (match-string 2 hms))) + (s (string-to-number (match-string 3 hms))) + (sign (equal (substring (match-string 1 hms) 0 1) "-"))) + (setq h (abs h)) + (* (if sign -1 1) (+ s (* 60 (+ m (* 60 h)))))))) + +(defun org-timer-secs-to-hms (s) + "Convert integer S into h:mm:ss. +If the integer is negative, the string will start with \"-\"." + (let (sign m h) + (setq sign (if (< s 0) "-" "") + s (abs s) + m (/ s 60) s (- s (* 60 m)) + h (/ m 60) m (- m (* 60 h))) + (format "%s%d:%02d:%02d" sign h m s))) + +(defvar org-timer-mode-line-timer nil) +(defvar org-timer-mode-line-string nil) + +(defun org-timer-set-mode-line (value) + "Set the mode-line display for relative or countdown timer. +VALUE can be `on', `off', or `paused'." + (when (or (eq org-timer-display 'mode-line) + (eq org-timer-display 'both)) + (or global-mode-string (setq global-mode-string '(""))) + (or (memq 'org-timer-mode-line-string global-mode-string) + (setq global-mode-string + (append global-mode-string '(org-timer-mode-line-string))))) + (when (or (eq org-timer-display 'frame-title) + (eq org-timer-display 'both)) + (or (memq 'org-timer-mode-line-string frame-title-format) + (setq frame-title-format + (append frame-title-format '(org-timer-mode-line-string))))) + (cl-case value + (off + (when org-timer-mode-line-timer + (cancel-timer org-timer-mode-line-timer) + (setq org-timer-mode-line-timer nil)) + (when (or (eq org-timer-display 'mode-line) + (eq org-timer-display 'both)) + (setq global-mode-string + (delq 'org-timer-mode-line-string global-mode-string))) + (when (or (eq org-timer-display 'frame-title) + (eq org-timer-display 'both)) + (setq frame-title-format + (delq 'org-timer-mode-line-string frame-title-format))) + (force-mode-line-update)) + (paused + (when org-timer-mode-line-timer + (cancel-timer org-timer-mode-line-timer) + (setq org-timer-mode-line-timer nil))) + (on + (when (or (eq org-timer-display 'mode-line) + (eq org-timer-display 'both)) + (or global-mode-string (setq global-mode-string '(""))) + (or (memq 'org-timer-mode-line-string global-mode-string) + (setq global-mode-string + (append global-mode-string '(org-timer-mode-line-string))))) + (when (or (eq org-timer-display 'frame-title) + (eq org-timer-display 'both)) + (or (memq 'org-timer-mode-line-string frame-title-format) + (setq frame-title-format + (append frame-title-format '(org-timer-mode-line-string))))) + (org-timer-update-mode-line) + (when org-timer-mode-line-timer + (cancel-timer org-timer-mode-line-timer) + (setq org-timer-mode-line-timer nil)) + (when org-timer-display + (setq org-timer-mode-line-timer + (run-with-timer 1 1 #'org-timer-update-mode-line)))))) + +(defun org-timer-update-mode-line () + "Update the timer time in the mode line." + (if org-timer-pause-time + nil + (setq org-timer-mode-line-string + (concat " <" (substring (org-timer-value-string) 0 -1) ">")) + (force-mode-line-update))) + +(defun org-timer-show-remaining-time () + "Display the remaining time before the timer ends." + (interactive) + (message + (if (not org-timer-countdown-timer) + "No timer set" + (format-seconds + "%m minute(s) %s seconds left before next time out" + ;; Note: Once our minimal require is Emacs 27, we can drop this + ;; org-time-convert-to-integer call. + (org-time-convert-to-integer + (org-time-subtract (timer--time org-timer-countdown-timer) nil)))))) + +;;;###autoload +(defun org-timer-set-timer (&optional opt) + "Prompt for a duration in minutes or hh:mm:ss and set a timer. + +If `org-timer-default-timer' is not \"0\", suggest this value as +the default duration for the timer. If a timer is already set, +prompt the user if she wants to replace it. + +Called with a numeric prefix argument, use this numeric value as +the duration of the timer in minutes. + +Called with a \\[universal-argument] prefix arguments, use `org-timer-default-timer' +without prompting the user for a duration. + +With two \\[universal-argument] prefix arguments, use `org-timer-default-timer' +without prompting the user for a duration and automatically +replace any running timer. + +By default, the timer duration will be set to the number of +minutes in the Effort property, if any. You can ignore this by +using three \\[universal-argument] prefix arguments." + (interactive "P") + (when (and org-timer-start-time + (not org-timer-countdown-timer)) + (user-error "Relative timer is running. Stop first")) + (let* ((default-timer + ;; `org-timer-default-timer' used to be a number, don't choke: + (if (numberp org-timer-default-timer) + (number-to-string org-timer-default-timer) + org-timer-default-timer)) + (effort-minutes (let ((effort (org-entry-get nil org-effort-property))) + (when (org-string-nw-p effort) + (floor (org-duration-to-minutes effort))))) + (minutes (or (and (numberp opt) (number-to-string opt)) + (and (not (equal opt '(64))) + effort-minutes + (number-to-string effort-minutes)) + (and (consp opt) default-timer) + (and (stringp opt) opt) + (read-from-minibuffer + "How much time left? (minutes or h:mm:ss) " + (and (not (string-equal default-timer "0")) default-timer))))) + (when (string-match "\\`[0-9]+\\'" minutes) + (setq minutes (concat minutes ":00"))) + (if (not (string-match "[0-9]+" minutes)) + (org-timer-show-remaining-time) + (let ((secs (org-timer-hms-to-secs (org-timer-fix-incomplete minutes)))) + (if (and org-timer-countdown-timer + (not (or (equal opt '(16)) + (y-or-n-p "Replace current timer? ")))) + (message "No timer set") + (when (timerp org-timer-countdown-timer) + (cancel-timer org-timer-countdown-timer)) + (setq org-timer-countdown-timer-title + (org-timer--get-timer-title)) + (setq org-timer-countdown-timer + (org-timer--run-countdown-timer + secs org-timer-countdown-timer-title)) + (run-hooks 'org-timer-set-hook) + (setq org-timer-start-time (org-time-add nil secs)) + (setq org-timer-pause-time nil) + (org-timer-set-mode-line 'on)))))) + +(defun org-timer--run-countdown-timer (secs title) + "Start countdown timer that will last SECS. +TITLE will be appended to the notification message displayed when +time is up." + (let ((msg (format "%s: time out" title)) + (sound org-clock-sound)) + (run-with-timer + secs nil (lambda () + (setq org-timer-countdown-timer nil + org-timer-start-time nil) + (org-notify msg sound) + (org-timer-set-mode-line 'off) + (run-hooks 'org-timer-done-hook))))) + +(defun org-timer--get-timer-title () + "Construct timer title. +Try to use an Org header, otherwise use the buffer name." + (cond + ((derived-mode-p 'org-agenda-mode) + (let* ((marker (or (get-text-property (point) 'org-marker))) + (hdmarker (or (get-text-property (point) 'org-hd-marker) + marker))) + (when (and marker (marker-buffer marker)) + (with-current-buffer (marker-buffer marker) + (org-with-wide-buffer + (goto-char hdmarker) + (org-show-entry) + (or (ignore-errors (org-get-heading)) + (buffer-name (buffer-base-buffer)))))))) + ((derived-mode-p 'org-mode) + (ignore-errors (org-get-heading))) + (t (buffer-name (buffer-base-buffer))))) + +(provide 'org-timer) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; org-timer.el ends here diff --git a/elpa/org-9.5.2/org-timer.elc b/elpa/org-9.5.2/org-timer.elc new file mode 100644 index 0000000..3d3d7b0 Binary files /dev/null and b/elpa/org-9.5.2/org-timer.elc differ diff --git a/elpa/org-9.5.2/org-version.el b/elpa/org-9.5.2/org-version.el new file mode 100644 index 0000000..a80e50a --- /dev/null +++ b/elpa/org-9.5.2/org-version.el @@ -0,0 +1,24 @@ +;;; org-version.el --- autogenerated file, do not edit -*- lexical-binding: t -*- +;; +;;; Code: +;;;###autoload +(defun org-release () + "The release version of Org. +Inserted by installing Org mode or when a release is made." + (let ((org-release "9.5.2")) + org-release)) +;;;###autoload +(defun org-git-version () + "The Git version of Org mode. +Inserted by installing Org or when a release is made." + (let ((org-git-version "9.5.2-gfbff08")) + org-git-version)) + +(provide 'org-version) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; coding: utf-8 +;; End: +;;; org-version.el ends here diff --git a/elpa/org-9.5.2/org.el b/elpa/org-9.5.2/org.el new file mode 100644 index 0000000..d58f6af --- /dev/null +++ b/elpa/org-9.5.2/org.el @@ -0,0 +1,21484 @@ +;;; org.el --- Outline-based notes management and organizer -*- lexical-binding: t; -*- + +;; Carstens outline-mode for keeping track of everything. +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Maintainer: Bastien Guerry <bzg@gnu.org> +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org +;; Package-Requires: ((emacs "25.1")) + +;; Version: 9.5.2 + +;; This file is part of GNU Emacs. +;; +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;; +;;; Commentary: +;; +;; Org is a mode for keeping notes, maintaining ToDo lists, and doing +;; project planning with a fast and effective plain-text system. +;; +;; Org mode develops organizational tasks around NOTES files that +;; contain information about projects as plain text. Org mode is +;; implemented on top of outline-mode, which makes it possible to keep +;; the content of large files well structured. Visibility cycling and +;; structure editing help to work with the tree. Tables are easily +;; created with a built-in table editor. Org mode supports ToDo +;; items, deadlines, time stamps, and scheduling. It dynamically +;; compiles entries into an agenda that utilizes and smoothly +;; integrates much of the Emacs calendar and diary. Plain text +;; URL-like links connect to websites, emails, Usenet messages, BBDB +;; entries, and any files related to the projects. For printing and +;; sharing of notes, an Org file can be exported as a structured ASCII +;; file, as HTML, or (todo and agenda items only) as an iCalendar +;; file. It can also serve as a publishing tool for a set of linked +;; webpages. +;; +;; Installation and Activation +;; --------------------------- +;; See the corresponding sections in the manual at +;; +;; https://orgmode.org/org.html#Installation +;; +;; Documentation +;; ------------- +;; The documentation of Org mode can be found in the TeXInfo file. The +;; distribution also contains a PDF version of it. At the homepage of +;; Org mode, you can read the same text online as HTML. There is also an +;; excellent reference card made by Philip Rooke. This card can be found +;; in the doc/ directory. +;; +;; A list of recent changes can be found at +;; https://orgmode.org/Changes.html +;; +;;; Code: + +(defvar org-inhibit-highlight-removal nil) ; dynamically scoped param +(defvar org-inlinetask-min-level) + +;;;; Require other packages + +(require 'cl-lib) + +(eval-when-compile (require 'gnus-sum)) + +(require 'calendar) +(require 'find-func) +(require 'format-spec) + +(or (eq this-command 'eval-buffer) + (condition-case nil + (load (concat (file-name-directory load-file-name) + "org-loaddefs.el") + nil t t t) + (error + (message "WARNING: No org-loaddefs.el file could be found from where org.el is loaded.") + (sit-for 3) + (message "You need to run \"make\" or \"make autoloads\" from Org lisp directory") + (sit-for 3)))) + +(eval-and-compile (require 'org-macs)) +(require 'org-compat) +(require 'org-keys) +(require 'ol) +(require 'oc) +(require 'oc-basic) +(require 'org-table) + +;; `org-outline-regexp' ought to be a defconst but is let-bound in +;; some places -- e.g. see the macro `org-with-limited-levels'. +(defvar org-outline-regexp "\\*+ " + "Regexp to match Org headlines.") + +(defvar org-outline-regexp-bol "^\\*+ " + "Regexp to match Org headlines. +This is similar to `org-outline-regexp' but additionally makes +sure that we are at the beginning of the line.") + +(defvar org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" + "Matches a headline, putting stars and text into groups. +Stars are put in group 1 and the trimmed body in group 2.") + +(declare-function calendar-check-holidays "holidays" (date)) +(declare-function cdlatex-environment "ext:cdlatex" (environment item)) +(declare-function cdlatex-math-symbol "ext:cdlatex") +(declare-function Info-goto-node "info" (nodename &optional fork strict-case)) +(declare-function isearch-no-upper-case-p "isearch" (string regexp-flag)) +(declare-function org-add-archive-files "org-archive" (files)) +(declare-function org-agenda-entry-get-agenda-timestamp "org-agenda" (pom)) +(declare-function org-agenda-list "org-agenda" (&optional arg start-day span with-hour)) +(declare-function org-agenda-redo "org-agenda" (&optional all)) +(declare-function org-agenda-remove-restriction-lock "org-agenda" (&optional noupdate)) +(declare-function org-archive-subtree "org-archive" (&optional find-done)) +(declare-function org-archive-subtree-default "org-archive" ()) +(declare-function org-archive-to-archive-sibling "org-archive" ()) +(declare-function org-attach "org-attach" ()) +(declare-function org-attach-dir "org-attach" + (&optional create-if-not-exists-p no-fs-check)) +(declare-function org-babel-do-in-edit-buffer "ob-core" (&rest body) t) +(declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang)) +(declare-function org-beamer-mode "ox-beamer" (&optional prefix) t) +(declare-function org-clock-auto-clockout "org-clock" ()) +(declare-function org-clock-cancel "org-clock" ()) +(declare-function org-clock-display "org-clock" (&optional arg)) +(declare-function org-clock-get-last-clock-out-time "org-clock" ()) +(declare-function org-clock-goto "org-clock" (&optional select)) +(declare-function org-clock-in "org-clock" (&optional select start-time)) +(declare-function org-clock-in-last "org-clock" (&optional arg)) +(declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time)) +(declare-function org-clock-out-if-current "org-clock" ()) +(declare-function org-clock-remove-overlays "org-clock" (&optional beg end noremove)) +(declare-function org-clock-report "org-clock" (&optional arg)) +(declare-function org-clock-sum "org-clock" (&optional tstart tend headline-filter propname)) +(declare-function org-clock-sum-current-item "org-clock" (&optional tstart)) +(declare-function org-clock-timestamps-down "org-clock" (&optional n)) +(declare-function org-clock-timestamps-up "org-clock" (&optional n)) +(declare-function org-clock-update-time-maybe "org-clock" ()) +(declare-function org-clocktable-shift "org-clock" (dir n)) +(declare-function org-columns-quit "org-colview" ()) +(declare-function org-columns-insert-dblock "org-colview" ()) +(declare-function org-duration-from-minutes "org-duration" (minutes &optional fmt canonical)) +(declare-function org-duration-to-minutes "org-duration" (duration &optional canonical)) +(declare-function org-element-at-point "org-element" ()) +(declare-function org-element-cache-refresh "org-element" (pos)) +(declare-function org-element-cache-reset "org-element" (&optional all)) +(declare-function org-element-contents "org-element" (element)) +(declare-function org-element-context "org-element" (&optional element)) +(declare-function org-element-copy "org-element" (datum)) +(declare-function org-element-create "org-element" (type &optional props &rest children)) +(declare-function org-element-extract-element "org-element" (element)) +(declare-function org-element-insert-before "org-element" (element location)) +(declare-function org-element-interpret-data "org-element" (data)) +(declare-function org-element-lineage "org-element" (blob &optional types with-self)) +(declare-function org-element-link-parser "org-element" ()) +(declare-function org-element-map "org-element" (data types fun &optional info first-match no-recursion with-affiliated)) +(declare-function org-element-nested-p "org-element" (elem-a elem-b)) +(declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only)) +(declare-function org-element-parse-secondary-string "org-element" (string restriction &optional parent)) +(declare-function org-element-property "org-element" (property element)) +(declare-function org-element-put-property "org-element" (element property value)) +(declare-function org-element-restriction "org-element" (element)) +(declare-function org-element-swap-A-B "org-element" (elem-a elem-b)) +(declare-function org-element-timestamp-parser "org-element" ()) +(declare-function org-element-type "org-element" (element)) +(declare-function org-export-dispatch "ox" (&optional arg)) +(declare-function org-export-get-backend "ox" (name)) +(declare-function org-export-get-environment "ox" (&optional backend subtreep ext-plist)) +(declare-function org-feed-goto-inbox "org-feed" (feed)) +(declare-function org-feed-update-all "org-feed" ()) +(declare-function org-goto "org-goto" (&optional alternative-interface)) +(declare-function org-id-find-id-file "org-id" (id)) +(declare-function org-id-get-create "org-id" (&optional force)) +(declare-function org-inlinetask-at-task-p "org-inlinetask" ()) +(declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) +(declare-function org-inlinetask-toggle-visibility "org-inlinetask" ()) +(declare-function org-latex-make-preamble "ox-latex" (info &optional template snippet?)) +(declare-function org-num-mode "org-num" (&optional arg)) +(declare-function org-plot/gnuplot "org-plot" (&optional params)) +(declare-function org-tags-view "org-agenda" (&optional todo-only match)) +(declare-function org-timer "org-timer" (&optional restart no-insert)) +(declare-function org-timer-item "org-timer" (&optional arg)) +(declare-function org-timer-pause-or-continue "org-timer" (&optional stop)) +(declare-function org-timer-set-timer "org-timer" (&optional opt)) +(declare-function org-timer-start "org-timer" (&optional offset)) +(declare-function org-timer-stop "org-timer" ()) +(declare-function org-toggle-archive-tag "org-archive" (&optional find-done)) +(declare-function org-update-radio-target-regexp "ol" ()) + +(defvar org-element-paragraph-separate) +(defvar org-indent-indentation-per-level) +(defvar org-radio-target-regexp) +(defvar org-target-link-regexp) +(defvar org-target-regexp) +(defvar org-id-overriding-file-name) + +;; load languages based on value of `org-babel-load-languages' +(defvar org-babel-load-languages) + +(defvar crm-separator) ; dynamically scoped param + +;;;###autoload +(defun org-babel-do-load-languages (sym value) + "Load the languages defined in `org-babel-load-languages'." + (set-default sym value) + (dolist (pair org-babel-load-languages) + (let ((active (cdr pair)) (lang (symbol-name (car pair)))) + (if active + (require (intern (concat "ob-" lang))) + (fmakunbound + (intern (concat "org-babel-execute:" lang))) + (fmakunbound + (intern (concat "org-babel-expand-body:" lang))))))) + + +;;;###autoload +(defun org-babel-load-file (file &optional compile) + "Load Emacs Lisp source code blocks in the Org FILE. +This function exports the source code using `org-babel-tangle' +and then loads the resulting file using `load-file'. With +optional prefix argument COMPILE, the tangled Emacs Lisp file is +byte-compiled before it is loaded." + (interactive "fFile to load: \nP") + (let ((tangled-file (concat (file-name-sans-extension file) ".el"))) + ;; Tangle only if the Org file is newer than the Elisp file. + (unless (org-file-newer-than-p + tangled-file + (file-attribute-modification-time + (file-attributes (file-truename file)))) + (org-babel-tangle-file file + tangled-file + (rx string-start + (or "emacs-lisp" "elisp") + string-end))) + (if compile + (progn + (byte-compile-file tangled-file) + (load tangled-file) + (message "Compiled and loaded %s" tangled-file)) + (load-file tangled-file) + (message "Loaded %s" tangled-file)))) + +(defcustom org-babel-load-languages '((emacs-lisp . t)) + "Languages which can be evaluated in Org buffers. +\\<org-mode-map> +This list can be used to load support for any of the languages +below. Each language will depend on a different set of system +executables and/or Emacs modes. + +When a language is \"loaded\", code blocks in that language can +be evaluated with `org-babel-execute-src-block', which is bound +by default to \\[org-ctrl-c-ctrl-c]. + +The `org-babel-no-eval-on-ctrl-c-ctrl-c' option can be set to +remove code block evaluation from \\[org-ctrl-c-ctrl-c]. By +default, only Emacs Lisp is loaded, since it has no specific +requirement." + :group 'org-babel + :set 'org-babel-do-load-languages + :version "24.1" + :type '(alist :tag "Babel Languages" + :key-type + (choice + (const :tag "Awk" awk) + (const :tag "C" C) + (const :tag "R" R) + (const :tag "Calc" calc) + (const :tag "Clojure" clojure) + (const :tag "CSS" css) + (const :tag "Ditaa" ditaa) + (const :tag "Dot" dot) + (const :tag "Emacs Lisp" emacs-lisp) + (const :tag "Forth" forth) + (const :tag "Fortran" fortran) + (const :tag "Gnuplot" gnuplot) + (const :tag "Haskell" haskell) + (const :tag "Java" java) + (const :tag "Javascript" js) + (const :tag "LaTeX" latex) + (const :tag "Lilypond" lilypond) + (const :tag "Lisp" lisp) + (const :tag "Makefile" makefile) + (const :tag "Maxima" maxima) + (const :tag "Matlab" matlab) + (const :tag "Ocaml" ocaml) + (const :tag "Octave" octave) + (const :tag "Org" org) + (const :tag "Perl" perl) + (const :tag "Pico Lisp" picolisp) + (const :tag "PlantUML" plantuml) + (const :tag "Python" python) + (const :tag "Ruby" ruby) + (const :tag "Sass" sass) + (const :tag "Scala" scala) + (const :tag "Scheme" scheme) + (const :tag "Screen" screen) + (const :tag "Shell Script" shell) + (const :tag "Sql" sql) + (const :tag "Sqlite" sqlite) + (const :tag "Stan" stan)) + :value-type (boolean :tag "Activate" :value t))) + +;;;; Customization variables +(defcustom org-clone-delete-id nil + "Remove ID property of clones of a subtree. +When non-nil, clones of a subtree don't inherit the ID property. +Otherwise they inherit the ID property with a new unique +identifier." + :type 'boolean + :version "24.1" + :group 'org-id) + +;;; Version +(org-check-version) + +;;;###autoload +(defun org-version (&optional here full message) + "Show the Org version. +Interactively, or when MESSAGE is non-nil, show it in echo area. +With prefix argument, or when HERE is non-nil, insert it at point. +In non-interactive uses, a reduced version string is output unless +FULL is given." + (interactive (list current-prefix-arg t (not current-prefix-arg))) + (let ((org-dir (ignore-errors (org-find-library-dir "org"))) + (save-load-suffixes (when (boundp 'load-suffixes) load-suffixes)) + (load-suffixes (list ".el")) + (org-install-dir + (ignore-errors (org-find-library-dir "org-loaddefs")))) + (unless (and (fboundp 'org-release) (fboundp 'org-git-version)) + (org-load-noerror-mustsuffix (concat org-dir "org-version"))) + (let* ((load-suffixes save-load-suffixes) + (release (org-release)) + (git-version (org-git-version)) + (version (format "Org mode version %s (%s @ %s)" + release + git-version + (if org-install-dir + (if (string= org-dir org-install-dir) + org-install-dir + (concat "mixed installation! " + org-install-dir + " and " + org-dir)) + "org-loaddefs.el can not be found!"))) + (version1 (if full version release))) + (when here (insert version1)) + (when message (message "%s" version1)) + version1))) + +(defconst org-version (org-version)) + + +;;; Syntax Constants +;;;; Comments +(defconst org-comment-regexp + (rx (seq bol (zero-or-more (any "\t ")) "#" (or " " eol))) + "Regular expression for comment lines.") + +;;;; Keyword +(defconst org-keyword-regexp "^[ \t]*#\\+\\(\\S-+?\\):[ \t]*\\(.*\\)$" + "Regular expression for keyword-lines.") + +;;;; Block + +(defconst org-block-regexp + "^[ \t]*#\\+begin_?\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$" + "Regular expression for hiding blocks.") + +(defconst org-dblock-start-re + "^[ \t]*#\\+\\(?:BEGIN\\|begin\\):[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?" + "Matches the start line of a dynamic block, with parameters.") + +(defconst org-dblock-end-re "^[ \t]*#\\+\\(?:END\\|end\\)\\([: \t\r\n]\\|$\\)" + "Matches the end of a dynamic block.") + +;;;; Timestamp + +(defconst org-ts--internal-regexp + (rx (seq + (= 4 digit) "-" (= 2 digit) "-" (= 2 digit) + (optional " " (*? nonl)))) + "Regular expression matching the innards of a time stamp.") + +(defconst org-ts-regexp (format "<\\(%s\\)>" org-ts--internal-regexp) + "Regular expression for fast time stamp matching.") + +(defconst org-ts-regexp-inactive + (format "\\[\\(%s\\)\\]" org-ts--internal-regexp) + "Regular expression for fast inactive time stamp matching.") + +(defconst org-ts-regexp-both (format "[[<]\\(%s\\)[]>]" org-ts--internal-regexp) + "Regular expression for fast time stamp matching.") + +(defconst org-ts-regexp0 + "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\( +[^]+0-9>\r\n -]+\\)?\\( +\\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" + "Regular expression matching time strings for analysis. +This one does not require the space after the date, so it can be used +on a string that terminates immediately after the date.") + +(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" + "Regular expression matching time strings for analysis.") + +(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>") + "Regular expression matching time stamps, with groups.") + +(defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,16\\}[]>]") + "Regular expression matching time stamps (also [..]), with groups.") + +(defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp) + "Regular expression matching a time stamp range.") + +(defconst org-tr-regexp-both + (concat org-ts-regexp-both "--?-?" org-ts-regexp-both) + "Regular expression matching a time stamp range.") + +(defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?" + org-ts-regexp "\\)?") + "Regular expression matching a time stamp or time stamp range.") + +(defconst org-tsr-regexp-both + (concat org-ts-regexp-both "\\(--?-?" + org-ts-regexp-both "\\)?") + "Regular expression matching a time stamp or time stamp range. +The time stamps may be either active or inactive.") + +(defconst org-repeat-re + "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*?\ +\\([.+]?\\+[0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)" + "Regular expression for specifying repeated events. +After a match, group 1 contains the repeat expression.") + +(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") + "Formats for `format-time-string' which are used for time stamps.") + +;;;; Clock and Planning + +(defconst org-clock-string "CLOCK:" + "String used as prefix for timestamps clocking work hours on an item.") + +(defvar org-closed-string "CLOSED:" + "String used as the prefix for timestamps logging closing a TODO entry.") + +(defvar org-deadline-string "DEADLINE:" + "String to mark deadline entries. +\\<org-mode-map> +A deadline is this string, followed by a time stamp. It must be +a word, terminated by a colon. You can insert a schedule keyword +and a timestamp with `\\[org-deadline]'.") + +(defvar org-scheduled-string "SCHEDULED:" + "String to mark scheduled TODO entries. +\\<org-mode-map> +A schedule is this string, followed by a time stamp. It must be +a word, terminated by a colon. You can insert a schedule keyword +and a timestamp with `\\[org-schedule]'.") + +(defconst org-ds-keyword-length + (+ 2 + (apply #'max + (mapcar #'length + (list org-deadline-string org-scheduled-string + org-clock-string org-closed-string)))) + "Maximum length of the DEADLINE and SCHEDULED keywords.") + +(defconst org-planning-line-re + (concat "^[ \t]*" + (regexp-opt + (list org-closed-string org-deadline-string org-scheduled-string) + t)) + "Matches a line with planning info. +Matched keyword is in group 1.") + +(defconst org-clock-line-re + (concat "^[ \t]*" org-clock-string) + "Matches a line with clock info.") + +(defconst org-deadline-regexp (concat "\\<" org-deadline-string) + "Matches the DEADLINE keyword.") + +(defconst org-deadline-time-regexp + (concat "\\<" org-deadline-string " *<\\([^>]+\\)>") + "Matches the DEADLINE keyword together with a time stamp.") + +(defconst org-deadline-time-hour-regexp + (concat "\\<" org-deadline-string + " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9+:hdwmy/ \t.-]*\\)>") + "Matches the DEADLINE keyword together with a time-and-hour stamp.") + +(defconst org-deadline-line-regexp + (concat "\\<\\(" org-deadline-string "\\).*") + "Matches the DEADLINE keyword and the rest of the line.") + +(defconst org-scheduled-regexp (concat "\\<" org-scheduled-string) + "Matches the SCHEDULED keyword.") + +(defconst org-scheduled-time-regexp + (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>") + "Matches the SCHEDULED keyword together with a time stamp.") + +(defconst org-scheduled-time-hour-regexp + (concat "\\<" org-scheduled-string + " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9+:hdwmy/ \t.-]*\\)>") + "Matches the SCHEDULED keyword together with a time-and-hour stamp.") + +(defconst org-closed-time-regexp + (concat "\\<" org-closed-string " *\\[\\([^]]+\\)\\]") + "Matches the CLOSED keyword together with a time stamp.") + +(defconst org-keyword-time-regexp + (concat "\\<" + (regexp-opt + (list org-scheduled-string org-deadline-string org-closed-string + org-clock-string) + t) + " *[[<]\\([^]>]+\\)[]>]") + "Matches any of the 4 keywords, together with the time stamp.") + +(defconst org-keyword-time-not-clock-regexp + (concat + "\\<" + (regexp-opt + (list org-scheduled-string org-deadline-string org-closed-string) t) + " *[[<]\\([^]>]+\\)[]>]") + "Matches any of the 3 keywords, together with the time stamp.") + +(defconst org-all-time-keywords + (mapcar (lambda (w) (substring w 0 -1)) + (list org-scheduled-string org-deadline-string + org-clock-string org-closed-string)) + "List of time keywords.") + +;;;; Drawer + +(defconst org-drawer-regexp "^[ \t]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ \t]*$" + "Matches first or last line of a hidden block. +Group 1 contains drawer's name or \"END\".") + +(defconst org-property-start-re "^[ \t]*:PROPERTIES:[ \t]*$" + "Regular expression matching the first line of a property drawer.") + +(defconst org-property-end-re "^[ \t]*:END:[ \t]*$" + "Regular expression matching the last line of a property drawer.") + +(defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$" + "Regular expression matching the first line of a clock drawer.") + +(defconst org-clock-drawer-end-re "^[ \t]*:END:[ \t]*$" + "Regular expression matching the last line of a clock drawer.") + +(defconst org-logbook-drawer-re + (rx (seq bol (0+ (any "\t ")) ":LOGBOOK:" (0+ (any "\t ")) "\n" + (*? (0+ nonl) "\n") + (0+ (any "\t ")) ":END:" (0+ (any "\t ")) eol)) + "Matches an entire LOGBOOK drawer.") + +(defconst org-property-drawer-re + (concat "^[ \t]*:PROPERTIES:[ \t]*\n" + "\\(?:[ \t]*:\\S-+:\\(?: .*\\)?[ \t]*\n\\)*?" + "[ \t]*:END:[ \t]*$") + "Matches an entire property drawer.") + +(defconst org-clock-drawer-re + (concat "\\(" org-clock-drawer-start-re "\\)[^\000]*?\\(" + org-clock-drawer-end-re "\\)\n?") + "Matches an entire clock drawer.") + +;;;; Headline + +(defconst org-heading-keyword-regexp-format + "^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" + "Printf format for a regexp matching a headline with some keyword. +This regexp will match the headline of any node which has the +exact keyword that is put into the format. The keyword isn't in +any group by default, but the stars and the body are.") + +(defconst org-heading-keyword-maybe-regexp-format + "^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$" + "Printf format for a regexp matching a headline, possibly with some keyword. +This regexp can match any headline with the specified keyword, or +without a keyword. The keyword isn't in any group by default, +but the stars and the body are.") + +(defconst org-archive-tag "ARCHIVE" + "The tag that marks a subtree as archived. +An archived subtree does not open during visibility cycling, and does +not contribute to the agenda listings.") + +(defconst org-tag-re "[[:alnum:]_@#%]+" + "Regexp matching a single tag.") + +(defconst org-tag-group-re "[ \t]+\\(:\\([[:alnum:]_@#%:]+\\):\\)[ \t]*$" + "Regexp matching the tag group at the end of a line, with leading spaces. +Tags are stored in match group 1. Match group 2 stores the tags +without the enclosing colons.") + +(defconst org-tag-line-re + "^\\*+ \\(?:.*[ \t]\\)?\\(:\\([[:alnum:]_@#%:]+\\):\\)[ \t]*$" + "Regexp matching tags in a headline. +Tags are stored in match group 1. Match group 2 stores the tags +without the enclosing colons.") + +(eval-and-compile + (defconst org-comment-string "COMMENT" + "Entries starting with this keyword will never be exported. +\\<org-mode-map> +An entry can be toggled between COMMENT and normal with +`\\[org-toggle-comment]'.")) + + +;;;; LaTeX Environments and Fragments + +(defconst org-latex-regexps + '(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t) + ;; ("$" "\\([ \t(]\\|^\\)\\(\\(\\([$]\\)\\([^ \t\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \t\n,.$]\\)\\4\\)\\)\\([ \t.,?;:'\")]\\|$\\)" 2 nil) + ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p + ("$1" "\\([^$]\\|^\\)\\(\\$[^ \t\r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2 nil) + ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \t\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \t\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2 nil) + ("\\(" "\\\\([^\000]*?\\\\)" 0 nil) + ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 nil) + ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil)) + "Regular expressions for matching embedded LaTeX.") + +;;;; Node Property + +(defconst org-effort-property "Effort" + "The property that is being used to keep track of effort estimates. +Effort estimates given in this property need to be in the format +defined in org-duration.el.") + + +;;; The custom variables + +(defgroup org nil + "Outline-based notes management and organizer." + :tag "Org" + :group 'outlines + :group 'calendar) + +(defcustom org-mode-hook nil + "Mode hook for Org mode, run after the mode was turned on." + :group 'org + :type 'hook) + +(defcustom org-load-hook nil + "Hook that is run after org.el has been loaded." + :group 'org + :type 'hook) + +(make-obsolete-variable + 'org-load-hook + "use `with-eval-after-load' instead." "9.5") + +(defcustom org-log-buffer-setup-hook nil + "Hook that is run after an Org log buffer is created." + :group 'org + :version "24.1" + :type 'hook) + +(defvar org-modules) ; defined below +(defvar org-modules-loaded nil + "Have the modules been loaded already?") + +;;;###autoload +(defun org-load-modules-maybe (&optional force) + "Load all extensions listed in `org-modules'." + (when (or force (not org-modules-loaded)) + (dolist (ext org-modules) + (condition-case nil (require ext) + (error (message "Problems while trying to load feature `%s'" ext)))) + (setq org-modules-loaded t))) + +(defun org-set-modules (var value) + "Set VAR to VALUE and call `org-load-modules-maybe' with the force flag." + (set var value) + (when (featurep 'org) + (org-load-modules-maybe 'force) + (org-element-cache-reset 'all))) + +(defcustom org-modules '(ol-doi ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww) + "Modules that should always be loaded together with org.el. + +If a description starts with <C>, the file is not part of Emacs and Org mode, +so loading it will require that you have properly installed org-contrib +package from NonGNU Emacs Lisp Package Archive +https://elpa.nongnu.org/nongnu/org-contrib.html + +You can also use this system to load external packages (i.e. neither Org +core modules, nor org-contrib modules). Just add symbols +to the end of the list. If the package is called org-xyz.el, then you need +to add the symbol `xyz', and the package must have a call to: + + (provide \\='org-xyz) + +For export specific modules, see also `org-export-backends'." + :group 'org + :set 'org-set-modules + :package-version '(Org . "9.5") + :type + '(set :greedy t + (const :tag " bbdb: Links to BBDB entries" ol-bbdb) + (const :tag " bibtex: Links to BibTeX entries" ol-bibtex) + (const :tag " crypt: Encryption of subtrees" org-crypt) + (const :tag " ctags: Access to Emacs tags with links" org-ctags) + (const :tag " docview: Links to Docview buffers" ol-docview) + (const :tag " doi: Links to DOI references" ol-doi) + (const :tag " eww: Store link to URL of Eww" ol-eww) + (const :tag " gnus: Links to GNUS folders/messages" ol-gnus) + (const :tag " habit: Track your consistency with habits" org-habit) + (const :tag " id: Global IDs for identifying entries" org-id) + (const :tag " info: Links to Info nodes" ol-info) + (const :tag " inlinetask: Tasks independent of outline hierarchy" org-inlinetask) + (const :tag " irc: Links to IRC/ERC chat sessions" ol-irc) + (const :tag " mhe: Links to MHE folders/messages" ol-mhe) + (const :tag " mouse: Additional mouse support" org-mouse) + (const :tag " protocol: Intercept calls from emacsclient" org-protocol) + (const :tag " rmail: Links to RMAIL folders/messages" ol-rmail) + (const :tag " tempo: Fast completion for structures" org-tempo) + (const :tag " w3m: Special cut/paste from w3m to Org mode." ol-w3m) + (const :tag " eshell: Links to working directories in Eshell" ol-eshell) + + (const :tag "C annotate-file: Annotate a file with Org syntax" org-annotate-file) + (const :tag "C bookmark: Links to bookmarks" ol-bookmark) + (const :tag "C checklist: Extra functions for checklists in repeated tasks" org-checklist) + (const :tag "C choose: Use TODO keywords to mark decisions states" org-choose) + (const :tag "C collector: Collect properties into tables" org-collector) + (const :tag "C depend: TODO dependencies for Org mode\n\t\t\t(PARTIALLY OBSOLETE, see built-in dependency support))" org-depend) + (const :tag "C elisp-symbol: Links to emacs-lisp symbols" ol-elisp-symbol) + (const :tag "C eval-light: Evaluate inbuffer-code on demand" org-eval-light) + (const :tag "C eval: Include command output as text" org-eval) + (const :tag "C expiry: Expiry mechanism for Org entries" org-expiry) + (const :tag "C git-link: Links to specific file version" ol-git-link) + (const :tag "C interactive-query: Interactive modification of tags query\n\t\t\t(PARTIALLY OBSOLETE, see secondary filtering)" org-interactive-query) + (const :tag "C invoice: Help manage client invoices in Org mode" org-invoice) + (const :tag "C learn: SuperMemo's incremental learning algorithm" org-learn) + (const :tag "C mac-iCal: Imports events from iCal.app to the Emacs diary" org-mac-iCal) + (const :tag "C mac-link: Grab links and url from various mac Applications" org-mac-link) + (const :tag "C mairix: Hook mairix search into Org for different MUAs" org-mairix) + (const :tag "C man: Links to man pages in Org mode" ol-man) + (const :tag "C mew: Links to Mew folders/messages" ol-mew) + (const :tag "C notify: Notifications for Org mode" org-notify) + (const :tag "C notmuch: Provide Org links to notmuch searches or messages" ol-notmuch) + (const :tag "C panel: Simple routines for us with bad memory" org-panel) + (const :tag "C registry: A registry for Org links" org-registry) + (const :tag "C screen: Visit screen sessions through links" org-screen) + (const :tag "C screenshot: Take and manage screenshots in Org files" org-screenshot) + (const :tag "C secretary: Team management with Org" org-secretary) + (const :tag "C sqlinsert: Convert Org tables to SQL insertions" orgtbl-sqlinsert) + (const :tag "C toc: Table of contents for Org buffer" org-toc) + (const :tag "C track: Keep up with Org mode development" org-track) + (const :tag "C velocity Something like Notational Velocity for Org" org-velocity) + (const :tag "C vm: Links to VM folders/messages" ol-vm) + (const :tag "C wikinodes: CamelCase wiki-like links" org-wikinodes) + (const :tag "C wl: Links to Wanderlust folders/messages" ol-wl) + (repeat :tag "External packages" :inline t (symbol :tag "Package")))) + +(defvar org-export-registered-backends) ; From ox.el. +(declare-function org-export-derived-backend-p "ox" (backend &rest backends)) +(declare-function org-export-backend-name "ox" (backend) t) +(defcustom org-export-backends '(ascii html icalendar latex odt) + "List of export back-ends that should be always available. + +If a description starts with <C>, the file is not part of Emacs and Org mode, +so loading it will require that you have properly installed org-contrib +package from NonGNU Emacs Lisp Package Archive +https://elpa.nongnu.org/nongnu/org-contrib.html + +Unlike to `org-modules', libraries in this list will not be +loaded along with Org, but only once the export framework is +needed. + +This variable needs to be set before org.el is loaded. If you +need to make a change while Emacs is running, use the customize +interface or run the following code, where VAL stands for the new +value of the variable, after updating it: + + (progn + (setq org-export-registered-backends + (cl-remove-if-not + (lambda (backend) + (let ((name (org-export-backend-name backend))) + (or (memq name val) + (catch \\='parentp + (dolist (b val) + (and (org-export-derived-backend-p b name) + (throw \\='parentp t))))))) + org-export-registered-backends)) + (let ((new-list (mapcar #\\='org-export-backend-name + org-export-registered-backends))) + (dolist (backend val) + (cond + ((not (load (format \"ox-%s\" backend) t t)) + (message \"Problems while trying to load export back-end \\=`%s\\='\" + backend)) + ((not (memq backend new-list)) (push backend new-list)))) + (set-default \\='org-export-backends new-list))) + +Adding a back-end to this list will also pull the back-end it +depends on, if any." + :group 'org + :group 'org-export + :version "26.1" + :package-version '(Org . "9.0") + :initialize 'custom-initialize-set + :set (lambda (var val) + (if (not (featurep 'ox)) (set-default var val) + ;; Any back-end not required anymore (not present in VAL and not + ;; a parent of any back-end in the new value) is removed from the + ;; list of registered back-ends. + (setq org-export-registered-backends + (cl-remove-if-not + (lambda (backend) + (let ((name (org-export-backend-name backend))) + (or (memq name val) + (catch 'parentp + (dolist (b val) + (and (org-export-derived-backend-p b name) + (throw 'parentp t))))))) + org-export-registered-backends)) + ;; Now build NEW-LIST of both new back-ends and required + ;; parents. + (let ((new-list (mapcar #'org-export-backend-name + org-export-registered-backends))) + (dolist (backend val) + (cond + ((not (load (format "ox-%s" backend) t t)) + (message "Problems while trying to load export back-end `%s'" + backend)) + ((not (memq backend new-list)) (push backend new-list)))) + ;; Set VAR to that list with fixed dependencies. + (set-default var new-list)))) + :type '(set :greedy t + (const :tag " ascii Export buffer to ASCII format" ascii) + (const :tag " beamer Export buffer to Beamer presentation" beamer) + (const :tag " html Export buffer to HTML format" html) + (const :tag " icalendar Export buffer to iCalendar format" icalendar) + (const :tag " latex Export buffer to LaTeX format" latex) + (const :tag " man Export buffer to MAN format" man) + (const :tag " md Export buffer to Markdown format" md) + (const :tag " odt Export buffer to ODT format" odt) + (const :tag " org Export buffer to Org format" org) + (const :tag " texinfo Export buffer to Texinfo format" texinfo) + (const :tag "C confluence Export buffer to Confluence Wiki format" confluence) + (const :tag "C deck Export buffer to deck.js presentations" deck) + (const :tag "C freemind Export buffer to Freemind mindmap format" freemind) + (const :tag "C groff Export buffer to Groff format" groff) + (const :tag "C koma-letter Export buffer to KOMA Scrlttrl2 format" koma-letter) + (const :tag "C RSS 2.0 Export buffer to RSS 2.0 format" rss) + (const :tag "C s5 Export buffer to s5 presentations" s5) + (const :tag "C taskjuggler Export buffer to TaskJuggler format" taskjuggler))) + +(eval-after-load 'ox + '(dolist (backend org-export-backends) + (condition-case nil (require (intern (format "ox-%s" backend))) + (error (message "Problems while trying to load export back-end `%s'" + backend))))) + +(defcustom org-support-shift-select nil + "Non-nil means make shift-cursor commands select text when possible. +\\<org-mode-map> +In Emacs 23, when `shift-select-mode' is on, shifted cursor keys +start selecting a region, or enlarge regions started in this way. +In Org mode, in special contexts, these same keys are used for +other purposes, important enough to compete with shift selection. +Org tries to balance these needs by supporting `shift-select-mode' +outside these special contexts, under control of this variable. + +The default of this variable is nil, to avoid confusing behavior. Shifted +cursor keys will then execute Org commands in the following contexts: +- on a headline, changing TODO state (left/right) and priority (up/down) +- on a time stamp, changing the time +- in a plain list item, changing the bullet type +- in a property definition line, switching between allowed values +- in the BEGIN line of a clock table (changing the time block). +- in a table, moving the cell in the specified direction. +Outside these contexts, the commands will throw an error. + +When this variable is t and the cursor is not in a special +context, Org mode will support shift-selection for making and +enlarging regions. To make this more effective, the bullet +cycling will no longer happen anywhere in an item line, but only +if the cursor is exactly on the bullet. + +If you set this variable to the symbol `always', then the keys +will not be special in headlines, property lines, item lines, and +table cells, to make shift selection work there as well. If this is +what you want, you can use the following alternative commands: +`\\[org-todo]' and `\\[org-priority]' \ +to change TODO state and priority, +`\\[universal-argument] \\[universal-argument] \\[org-todo]' \ +can be used to switch TODO sets, +`\\[org-ctrl-c-minus]' to cycle item bullet types, +and properties can be edited by hand or in column view. + +However, when the cursor is on a timestamp, shift-cursor commands +will still edit the time stamp - this is just too good to give up." + :group 'org + :type '(choice + (const :tag "Never" nil) + (const :tag "When outside special context" t) + (const :tag "Everywhere except timestamps" always))) + +(defcustom org-loop-over-headlines-in-active-region t + "Shall some commands act upon headlines in the active region? + +When set to t, some commands will be performed in all headlines +within the active region. + +When set to `start-level', some commands will be performed in all +headlines within the active region, provided that these headlines +are of the same level than the first one. + +When set to a string, those commands will be performed on the +matching headlines within the active region. Such string must be +a tags/property/todo match as it is used in the agenda tags view. + +The list of commands is: `org-schedule', `org-deadline', +`org-todo', `org-set-tags-command', `org-archive-subtree', +`org-archive-set-tag', `org-toggle-archive-tag' and +`org-archive-to-archive-sibling'. The archiving commands skip +already archived entries. + +See `org-agenda-loop-over-headlines-in-active-region' for the +equivalent option for agenda views." + :type '(choice (const :tag "Don't loop" nil) + (const :tag "All headlines in active region" t) + (const :tag "In active region, headlines at the same level than the first one" start-level) + (string :tag "Tags/Property/Todo matcher")) + :package-version '(Org . "9.4") + :group 'org-todo + :group 'org-archive) + +(defcustom org-startup-folded 'showeverything + "Non-nil means entering Org mode will switch to OVERVIEW. + +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + + #+STARTUP: fold (or `overview', this is equivalent) + #+STARTUP: nofold (or `showall', this is equivalent) + #+STARTUP: content + #+STARTUP: show<n>levels (<n> = 2..5) + #+STARTUP: showeverything + +Set `org-agenda-inhibit-startup' to a non-nil value if you want +to ignore this option when Org opens agenda files for the first +time." + :group 'org-startup + :package-version '(Org . "9.4") + :type '(choice + (const :tag "nofold: show all" nil) + (const :tag "fold: overview" t) + (const :tag "fold: show two levels" show2levels) + (const :tag "fold: show three levels" show3levels) + (const :tag "fold: show four levels" show4evels) + (const :tag "fold: show five levels" show5levels) + (const :tag "content: all headlines" content) + (const :tag "show everything, even drawers" showeverything))) + +(defcustom org-startup-truncated t + "Non-nil means entering Org mode will set `truncate-lines'. +This is useful since some lines containing links can be very long and +uninteresting. Also tables look terrible when wrapped. + +The variable `org-startup-truncated' allows to configure +truncation for Org mode different to the other modes that use the +variable `truncate-lines' and as a shortcut instead of putting +the variable `truncate-lines' into the `org-mode-hook'. If one +wants to configure truncation for Org mode not statically but +dynamically e.g. in a hook like `ediff-prepare-buffer-hook' then +the variable `truncate-lines' has to be used because in such a +case it is too late to set the variable `org-startup-truncated'." + :group 'org-startup + :type 'boolean) + +(defcustom org-startup-indented nil + "Non-nil means turn on `org-indent-mode' on startup. +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + + #+STARTUP: indent + #+STARTUP: noindent" + :group 'org-structure + :type '(choice + (const :tag "Not" nil) + (const :tag "Globally (slow on startup in large files)" t))) + +(defcustom org-startup-numerated nil + "Non-nil means turn on `org-num-mode' on startup. +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + + #+STARTUP: num + #+STARTUP: nonum" + :group 'org-structure + :package-version '(Org . "9.4") + :type '(choice + (const :tag "Not" nil) + (const :tag "Globally" t))) + +(defcustom org-use-sub-superscripts t + "Non-nil means interpret \"_\" and \"^\" for display. + +If you want to control how Org exports those characters, see +`org-export-with-sub-superscripts'. + +When this option is turned on, you can use TeX-like syntax for +sub- and superscripts within the buffer. 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." + :group 'org-startup + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Always interpret" t) + (const :tag "Only with braces" {}) + (const :tag "Never interpret" nil))) + +(defcustom org-startup-with-beamer-mode nil + "Non-nil means turn on `org-beamer-mode' on startup. +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + + #+STARTUP: beamer" + :group 'org-startup + :version "24.1" + :type 'boolean) + +(defcustom org-startup-align-all-tables nil + "Non-nil means align all tables when visiting a file. +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + #+STARTUP: align + #+STARTUP: noalign" + :group 'org-startup + :type 'boolean) + +(defcustom org-startup-shrink-all-tables nil + "Non-nil means shrink all table columns with a width cookie. +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + #+STARTUP: shrink" + :group 'org-startup + :type 'boolean + :version "27.1" + :package-version '(Org . "9.2") + :safe #'booleanp) + +(defcustom org-startup-with-inline-images nil + "Non-nil means show inline images when loading a new Org file. +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + #+STARTUP: inlineimages + #+STARTUP: noinlineimages" + :group 'org-startup + :version "24.1" + :type 'boolean) + +(defcustom org-startup-with-latex-preview nil + "Non-nil means preview LaTeX fragments when loading a new Org file. + +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + #+STARTUP: latexpreview + #+STARTUP: nolatexpreview" + :group 'org-startup + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-insert-mode-line-in-empty-file nil + "Non-nil means insert the first line setting Org mode in empty files. +When the function `org-mode' is called interactively in an empty file, this +normally means that the file name does not automatically trigger Org mode. +To ensure that the file will always be in Org mode in the future, a +line enforcing Org mode will be inserted into the buffer, if this option +has been set." + :group 'org-startup + :type 'boolean) + +(defcustom org-ellipsis nil + "The ellipsis to use in the Org mode outline. + +When nil, just use the standard three dots. When a non-empty string, +use that string instead. + +The change affects only Org mode (which will then use its own display table). +Changing this requires executing `\\[org-mode]' in a buffer to become +effective. It cannot be set as a local variable." + :group 'org-startup + :type '(choice (const :tag "Default" nil) + (string :tag "String" :value "...#"))) + +(defvar org-display-table nil + "The display table for Org mode, in case `org-ellipsis' is non-nil.") + +(defcustom org-directory "~/org" + "Directory with Org files. +This is just a default location to look for Org files. There is no need +at all to put your files into this directory. It is used in the +following situations: + +1. When a capture template specifies a target file that is not an + absolute path. The path will then be interpreted relative to + `org-directory' +2. When the value of variable `org-agenda-files' is a single file, any + relative paths in this file will be taken as relative to + `org-directory'." + :group 'org-refile + :group 'org-capture + :type 'directory) + +(defcustom org-default-notes-file (convert-standard-filename "~/.notes") + "Default target for storing notes. +Used as a fall back file for org-capture.el, for templates that +do not specify a target file." + :group 'org-refile + :group 'org-capture + :type 'file) + +(defcustom org-reverse-note-order nil + "Non-nil means store new notes at the beginning of a file or entry. +When nil, new notes will be filed to the end of a file or entry. +This can also be a list with cons cells of regular expressions that +are matched against file names, and values." + :group 'org-capture + :group 'org-refile + :type '(choice + (const :tag "Reverse always" t) + (const :tag "Reverse never" nil) + (repeat :tag "By file name regexp" + (cons regexp boolean)))) + +(defgroup org-keywords nil + "Keywords in Org mode." + :tag "Org Keywords" + :group 'org) + +(defcustom org-closed-keep-when-no-todo nil + "Remove CLOSED: time-stamp when switching back to a non-todo state?" + :group 'org-todo + :group 'org-keywords + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defgroup org-structure nil + "Options concerning the general structure of Org files." + :tag "Org Structure" + :group 'org) + +(defgroup org-reveal-location nil + "Options about how to make context of a location visible." + :tag "Org Reveal Location" + :group 'org-structure) + +(defcustom org-show-context-detail '((agenda . local) + (bookmark-jump . lineage) + (isearch . lineage) + (default . ancestors)) + "Alist between context and visibility span when revealing a location. + +\\<org-mode-map>Some actions may move point into invisible +locations. As a consequence, Org always exposes a neighborhood +around point. How much is shown depends on the initial action, +or context. Valid contexts are + + agenda when exposing an entry from the agenda + org-goto when using the command `org-goto' (`\\[org-goto]') + occur-tree when using the command `org-occur' (`\\[org-sparse-tree] /') + tags-tree when constructing a sparse tree based on tags matches + link-search when exposing search matches associated with a link + mark-goto when exposing the jump goal of a mark + bookmark-jump when exposing a bookmark location + isearch when exiting from an incremental search + default default for all contexts not set explicitly + +Allowed visibility spans are + + minimal show current headline; if point is not on headline, + also show entry + + local show current headline, entry and next headline + + ancestors show current headline and its direct ancestors; if + point is not on headline, also show entry + + ancestors-full show current subtree and its direct ancestors + + lineage show current headline, its direct ancestors and all + their children; if point is not on headline, also show + entry and first child + + tree show current headline, its direct ancestors and all + their children; if point is not on headline, also show + entry and all children + + canonical show current headline, its direct ancestors along with + their entries and children; if point is not located on + the headline, also show current entry and all children + +As special cases, a nil or t value means show all contexts in +`minimal' or `canonical' view, respectively. + +Some views can make displayed information very compact, but also +make it harder to edit the location of the match. In such +a case, use the command `org-reveal' (`\\[org-reveal]') to show +more context." + :group 'org-reveal-location + :version "26.1" + :package-version '(Org . "9.0") + :type '(choice + (const :tag "Canonical" t) + (const :tag "Minimal" nil) + (repeat :greedy t :tag "Individual contexts" + (cons + (choice :tag "Context" + (const agenda) + (const org-goto) + (const occur-tree) + (const tags-tree) + (const link-search) + (const mark-goto) + (const bookmark-jump) + (const isearch) + (const default)) + (choice :tag "Detail level" + (const minimal) + (const local) + (const ancestors) + (const ancestors-full) + (const lineage) + (const tree) + (const canonical)))))) + +(defcustom org-indirect-buffer-display 'other-window + "How should indirect tree buffers be displayed? + +This applies to indirect buffers created with the commands +`org-tree-to-indirect-buffer' and `org-agenda-tree-to-indirect-buffer'. + +Valid values are: +current-window Display in the current window +other-window Just display in another window. +dedicated-frame Create one new frame, and re-use it each time. +new-frame Make a new frame each time. Note that in this case + previously-made indirect buffers are kept, and you need to + kill these buffers yourself." + :group 'org-structure + :group 'org-agenda-windows + :type '(choice + (const :tag "In current window" current-window) + (const :tag "In current frame, other window" other-window) + (const :tag "Each time a new frame" new-frame) + (const :tag "One dedicated frame" dedicated-frame))) + +(defconst org-file-apps-gnu + '((remote . emacs) + (system . mailcap) + (t . mailcap)) + "Default file applications on a UNIX or GNU/Linux system. +See `org-file-apps'.") + +(defconst org-file-apps-macos + '((remote . emacs) + (system . "open %s") + ("ps.gz" . "gv %s") + ("eps.gz" . "gv %s") + ("dvi" . "xdvi %s") + ("fig" . "xfig %s") + (t . "open %s")) + "Default file applications on a macOS system. +The system \"open\" is known as a default, but we use X11 applications +for some files for which the OS does not have a good default. +See `org-file-apps'.") + +(defconst org-file-apps-windowsnt + (list '(remote . emacs) + (cons 'system (lambda (file _path) + (with-no-warnings (w32-shell-execute "open" file)))) + (cons t (lambda (file _path) + (with-no-warnings (w32-shell-execute "open" file))))) + "Default file applications on a Windows NT system. +The system \"open\" is used for most files. +See `org-file-apps'.") + +(defcustom org-file-apps + '((auto-mode . emacs) + (directory . emacs) + ("\\.mm\\'" . default) + ("\\.x?html?\\'" . default) + ("\\.pdf\\'" . default)) + "Applications for opening `file:path' items in a document. + +\\<org-mode-map> +Org mode uses system defaults for different file types, but you +can use this variable to set the application for a given file +extension. The entries in this list are cons cells where the car +identifies files and the cdr the corresponding command. + +Possible values for the file identifier are: + + \"string\" A string as a file identifier can be interpreted in different + ways, depending on its contents: + + - Alphanumeric characters only: + Match links with this file extension. + Example: (\"pdf\" . \"evince %s\") + to open PDFs with evince. + + - Regular expression: Match links where the + filename matches the regexp. If you want to + use groups here, use shy groups. + + Example: (\"\\\\.x?html\\\\\\='\" . \"firefox %s\") + (\"\\\\(?:xhtml\\\\|html\\\\)\\\\\\='\" . \"firefox %s\") + to open *.html and *.xhtml with firefox. + + - Regular expression which contains (non-shy) groups: + Match links where the whole link, including \"::\", and + anything after that, matches the regexp. + In a custom command string, %1, %2, etc. are replaced with + the parts of the link that were matched by the groups. + For backwards compatibility, if a command string is given + that does not use any of the group matches, this case is + handled identically to the second one (i.e. match against + file name only). + In a custom function, you can access the group matches with + (match-string n link). + + Example: (\"\\\\.pdf::\\\\([0-9]+\\\\)\\\\\\='\" . \ +\"evince -p %1 %s\") + to open [[file:document.pdf::5]] with evince at page 5. + + `directory' Matches a directory + `remote' Matches a remote file, accessible through tramp or efs. + Remote files most likely should be visited through Emacs + because external applications cannot handle such paths. +`auto-mode' Matches files that are matched by any entry in `auto-mode-alist', + so all files Emacs knows how to handle. Using this with + command `emacs' will open most files in Emacs. Beware that this + will also open html files inside Emacs, unless you add + (\"html\" . default) to the list as well. + `system' The system command to open files, like `open' on Windows + and macOS, and mailcap under GNU/Linux. This is the command + that will be selected if you call `org-open-at-point' with a + double prefix argument (`\\[universal-argument] \ +\\[universal-argument] \\[org-open-at-point]'). + t Default for files not matched by any of the other options. + +Possible values for the command are: + + `emacs' The file will be visited by the current Emacs process. + `default' Use the default application for this file type, which is the + association for t in the list, most likely in the system-specific + part. This can be used to overrule an unwanted setting in the + system-specific variable. + `system' Use the system command for opening files, like \"open\". + This command is specified by the entry whose car is `system'. + Most likely, the system-specific version of this variable + does define this command, but you can overrule/replace it + here. +`mailcap' Use command specified in the mailcaps. + string A command to be executed by a shell; %s will be replaced + by the path to the file. + function A Lisp function, which will be called with two arguments: + the file path and the original link string, without the + \"file:\" prefix. + +For more examples, see the system specific constants +`org-file-apps-macos' +`org-file-apps-windowsnt' +`org-file-apps-gnu'." + :group 'org + :package-version '(Org . "9.4") + :type '(repeat + (cons (choice :value "" + (string :tag "Extension") + (const :tag "System command to open files" system) + (const :tag "Default for unrecognized files" t) + (const :tag "Remote file" remote) + (const :tag "Links to a directory" directory) + (const :tag "Any files that have Emacs modes" + auto-mode)) + (choice :value "" + (const :tag "Visit with Emacs" emacs) + (const :tag "Use default" default) + (const :tag "Use the system command" system) + (string :tag "Command") + (function :tag "Function"))))) + +(defcustom org-open-non-existing-files nil + "Non-nil means `org-open-file' opens non-existing files. + +When nil, an error is thrown. + +This variable applies only to external applications because they +might choke on non-existing files. If the link is to a file that +will be opened in Emacs, the variable is ignored." + :group 'org + :type 'boolean + :safe #'booleanp) + +(defcustom org-open-directory-means-index-dot-org nil + "When non-nil a link to a directory really means to \"index.org\". +When nil, following a directory link runs Dired or opens +a finder/explorer window on that directory." + :group 'org + :type 'boolean + :safe #'booleanp) + +(defcustom org-bookmark-names-plist + '(:last-capture "org-capture-last-stored" + :last-refile "org-refile-last-stored" + :last-capture-marker "org-capture-last-stored-marker") + "Names for bookmarks automatically set by some Org commands. +This can provide strings as names for a number of bookmarks Org sets +automatically. The following keys are currently implemented: + :last-capture + :last-capture-marker + :last-refile +When a key does not show up in the property list, the corresponding bookmark +is not set." + :group 'org-structure + :type 'plist) + +(defgroup org-cycle nil + "Options concerning visibility cycling in Org mode." + :tag "Org Cycle" + :group 'org-structure) + +(defcustom org-cycle-skip-children-state-if-no-children t + "Non-nil means skip CHILDREN state in entries that don't have any." + :group 'org-cycle + :type 'boolean) + +(defcustom org-cycle-max-level nil + "Maximum level which should still be subject to visibility cycling. +Levels higher than this will, for cycling, be treated as text, not a headline. +When `org-odd-levels-only' is set, a value of N in this variable actually +means 2N-1 stars as the limiting headline. +When nil, cycle all levels. +Note that the limiting level of cycling is also influenced by +`org-inlinetask-min-level'. When `org-cycle-max-level' is not set but +`org-inlinetask-min-level' is, cycling will be limited to levels one less +than its value." + :group 'org-cycle + :type '(choice + (const :tag "No limit" nil) + (integer :tag "Maximum level"))) + +(defcustom org-hide-block-startup nil + "Non-nil means entering Org mode will fold all blocks. +This can also be set in on a per-file basis with + +#+STARTUP: hideblocks +#+STARTUP: showblocks" + :group 'org-startup + :group 'org-cycle + :type 'boolean) + +(defcustom org-cycle-global-at-bob nil + "Cycle globally if cursor is at beginning of buffer and not at a headline. + +This makes it possible to do global cycling without having to use `S-TAB' +or `\\[universal-argument] TAB'. For this special case to work, the first \ +line of the buffer +must not be a headline -- it may be empty or some other text. + +When used in this way, `org-cycle-hook' is disabled temporarily to make +sure the cursor stays at the beginning of the buffer. + +When this option is nil, don't do anything special at the beginning of +the buffer." + :group 'org-cycle + :type 'boolean) + +(defcustom org-cycle-level-after-item/entry-creation t + "Non-nil means cycle entry level or item indentation in new empty entries. + +When the cursor is at the end of an empty headline, i.e., with only stars +and maybe a TODO keyword, TAB will then switch the entry to become a child, +and then all possible ancestor states, before returning to the original state. +This makes data entry extremely fast: M-RET to create a new headline, +on TAB to make it a child, two or more tabs to make it a (grand-)uncle. + +When the cursor is at the end of an empty plain list item, one TAB will +make it a subitem, two or more tabs will back up to make this an item +higher up in the item hierarchy." + :group 'org-cycle + :type 'boolean) + +(defcustom org-cycle-emulate-tab t + "Where should `org-cycle' emulate TAB. +nil Never +white Only in completely white lines +whitestart Only at the beginning of lines, before the first non-white char +t Everywhere except in headlines +exc-hl-bol Everywhere except at the start of a headline +If TAB is used in a place where it does not emulate TAB, the current subtree +visibility is cycled." + :group 'org-cycle + :type '(choice (const :tag "Never" nil) + (const :tag "Only in completely white lines" white) + (const :tag "Before first char in a line" whitestart) + (const :tag "Everywhere except in headlines" t) + (const :tag "Everywhere except at bol in headlines" exc-hl-bol))) + +(defcustom org-cycle-separator-lines 2 + "Number of empty lines needed to keep an empty line between collapsed trees. +If you leave an empty line between the end of a subtree and the following +headline, this empty line is hidden when the subtree is folded. +Org mode will leave (exactly) one empty line visible if the number of +empty lines is equal or larger to the number given in this variable. +So the default 2 means at least 2 empty lines after the end of a subtree +are needed to produce free space between a collapsed subtree and the +following headline. + +If the number is negative, and the number of empty lines is at least -N, +all empty lines are shown. + +Special case: when 0, never leave empty lines in collapsed view." + :group 'org-cycle + :type 'integer) +(put 'org-cycle-separator-lines 'safe-local-variable 'integerp) + +(defcustom org-pre-cycle-hook nil + "Hook that is run before visibility cycling is happening. +The function(s) in this hook must accept a single argument which indicates +the new state that will be set right after running this hook. The +argument is a symbol. Before a global state change, it can have the values +`overview', `content', or `all'. Before a local state change, it can have +the values `folded', `children', or `subtree'." + :group 'org-cycle + :type 'hook) + +(defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees + org-cycle-hide-drawers + org-cycle-show-empty-lines + org-optimize-window-after-visibility-change) + "Hook that is run after `org-cycle' has changed the buffer visibility. +The function(s) in this hook must accept a single argument which indicates +the new state that was set by the most recent `org-cycle' command. The +argument is a symbol. After a global state change, it can have the values +`overview', `contents', or `all'. After a local state change, it can have +the values `folded', `children', or `subtree'." + :group 'org-cycle + :package-version '(Org . "9.4") + :type 'hook) + +(defgroup org-edit-structure nil + "Options concerning structure editing in Org mode." + :tag "Org Edit Structure" + :group 'org-structure) + +(defcustom org-odd-levels-only nil + "Non-nil means skip even levels and only use odd levels for the outline. +This has the effect that two stars are being added/taken away in +promotion/demotion commands. It also influences how levels are +handled by the exporters. +Changing it requires restart of `font-lock-mode' to become effective +for fontification also in regions already fontified. +You may also set this on a per-file basis by adding one of the following +lines to the buffer: + + #+STARTUP: odd + #+STARTUP: oddeven" + :group 'org-edit-structure + :group 'org-appearance + :type 'boolean) + +(defcustom org-adapt-indentation nil + "Non-nil means adapt indentation to outline node level. + +When set to t, Org assumes that you write outlines by indenting +text in each node to align with the headline, after the stars. + +When this variable is set to `headline-data', Org only adapts the +indentation of the data lines right below the headline, such as +planning/clock lines and property/logbook drawers. + +The following issues are influenced by this variable: + +- The indentation is increased by one space in a demotion + command, and decreased by one in a promotion command. However, + in the latter case, if shifting some line in the entry body + would alter document structure (e.g., insert a new headline), + indentation is not changed at all. + +- Property drawers and planning information is inserted indented + when this variable is set. When nil, they will not be indented. + +- TAB indents a line relative to current level. The lines below + a headline will be indented when this variable is set to t. + +Note that this is all about true indentation, by adding and +removing space characters. See also \"org-indent.el\" which does +level-dependent indentation in a virtual way, i.e. at display +time in Emacs." + :group 'org-edit-structure + :type '(choice + (const :tag "Adapt indentation for all lines" t) + (const :tag "Adapt indentation for headline data lines" + headline-data) + (const :tag "Do not adapt indentation at all" nil)) + :safe (lambda (x) (memq x '(t nil headline-data)))) + +(defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e) + +(defcustom org-special-ctrl-a/e nil + "Non-nil means `C-a' and `C-e' behave specially in headlines and items. + +When t, `C-a' will bring back the cursor to the beginning of the +headline text, i.e. after the stars and after a possible TODO +keyword. In an item, this will be the position after bullet and +check-box, if any. When the cursor is already at that position, +another `C-a' will bring it to the beginning of the line. + +`C-e' will jump to the end of the headline, ignoring the presence +of tags in the headline. A second `C-e' will then jump to the +true end of the line, after any tags. This also means that, when +this variable is non-nil, `C-e' also will never jump beyond the +end of the heading of a folded section, i.e. not after the +ellipses. + +When set to the symbol `reversed', the first `C-a' or `C-e' works +normally, going to the true line boundary first. Only a directly +following, identical keypress will bring the cursor to the +special positions. + +This may also be a cons cell where the behavior for `C-a' and +`C-e' is set separately." + :group 'org-edit-structure + :type '(choice + (const :tag "off" nil) + (const :tag "on: after stars/bullet and before tags first" t) + (const :tag "reversed: true line boundary first" reversed) + (cons :tag "Set C-a and C-e separately" + (choice :tag "Special C-a" + (const :tag "off" nil) + (const :tag "on: after stars/bullet first" t) + (const :tag "reversed: before stars/bullet first" reversed)) + (choice :tag "Special C-e" + (const :tag "off" nil) + (const :tag "on: before tags first" t) + (const :tag "reversed: after tags first" reversed))))) + +(defcustom org-special-ctrl-k nil + "Non-nil means `C-k' will behave specially in headlines. +When nil, `C-k' will call the default `kill-line' command. +When t, the following will happen while the cursor is in the headline: + +- When at the beginning of a headline, kill the entire subtree. +- When in the middle of the headline text, kill the text up to the tags. +- When after the headline text and before the tags, kill all the tags." + :group 'org-edit-structure + :type 'boolean) + +(defcustom org-ctrl-k-protect-subtree nil + "Non-nil means, do not delete a hidden subtree with `C-k'. +When set to the symbol `error', simply throw an error when `C-k' is +used to kill (part-of) a headline that has hidden text behind it. +Any other non-nil value will result in a query to the user, if it is +OK to kill that hidden subtree. When nil, kill without remorse." + :group 'org-edit-structure + :version "24.1" + :type '(choice + (const :tag "Do not protect hidden subtrees" nil) + (const :tag "Protect hidden subtrees with a security query" t) + (const :tag "Never kill a hidden subtree with C-k" error))) + +(defcustom org-special-ctrl-o t + "Non-nil means, make `C-o' insert a row in tables." + :group 'org-edit-structure + :type 'boolean) + +(defcustom org-catch-invisible-edits nil + "Check if in invisible region before inserting or deleting a character. +Valid values are: + +nil Do not check, so just do invisible edits. +error Throw an error and do nothing. +show Make point visible, and do the requested edit. +show-and-error Make point visible, then throw an error and abort the edit. +smart Make point visible, and do insertion/deletion if it is + adjacent to visible text and the change feels predictable. + Never delete a previously invisible character or add in the + middle or right after an invisible region. Basically, this + allows insertion and backward-delete right before ellipses. + FIXME: maybe in this case we should not even show?" + :group 'org-edit-structure + :version "24.1" + :type '(choice + (const :tag "Do not check" nil) + (const :tag "Throw error when trying to edit" error) + (const :tag "Unhide, but do not do the edit" show-and-error) + (const :tag "Show invisible part and do the edit" show) + (const :tag "Be smart and do the right thing" smart))) + +(defcustom org-yank-folded-subtrees t + "Non-nil means when yanking subtrees, fold them. +If the kill is a single subtree, or a sequence of subtrees, i.e. if +it starts with a heading and all other headings in it are either children +or siblings, then fold all the subtrees. However, do this only if no +text after the yank would be swallowed into a folded tree by this action." + :group 'org-edit-structure + :type 'boolean) + +(defcustom org-yank-adjusted-subtrees nil + "Non-nil means when yanking subtrees, adjust the level. +With this setting, `org-paste-subtree' is used to insert the subtree, see +this function for details." + :group 'org-edit-structure + :type 'boolean) + +(defcustom org-M-RET-may-split-line '((default . t)) + "Non-nil means M-RET will split the line at the cursor position. +When nil, it will go to the end of the line before making a +new line. +You may also set this option in a different way for different +contexts. Valid contexts are: + +headline when creating a new headline +item when creating a new item +table in a table field +default the value to be used for all contexts not explicitly + customized" + :group 'org-structure + :group 'org-table + :type '(choice + (const :tag "Always" t) + (const :tag "Never" nil) + (repeat :greedy t :tag "Individual contexts" + (cons + (choice :tag "Context" + (const headline) + (const item) + (const table) + (const default)) + (boolean))))) + + +(defcustom org-insert-heading-respect-content nil + "Non-nil means insert new headings after the current subtree. +\\<org-mode-map> +When nil, the new heading is created directly after the current line. +The commands `\\[org-insert-heading-respect-content]' and \ +`\\[org-insert-todo-heading-respect-content]' turn this variable on +for the duration of the command." + :group 'org-structure + :type 'boolean) + +(defcustom org-blank-before-new-entry '((heading . auto) + (plain-list-item . auto)) + "Should `org-insert-heading' leave a blank line before new heading/item? +The value is an alist, with `heading' and `plain-list-item' as CAR, +and a boolean flag as CDR. The cdr may also be the symbol `auto', in +which case Org will look at the surrounding headings/items and try to +make an intelligent decision whether to insert a blank line or not." + :group 'org-edit-structure + :type '(list + (cons (const heading) + (choice (const :tag "Never" nil) + (const :tag "Always" t) + (const :tag "Auto" auto))) + (cons (const plain-list-item) + (choice (const :tag "Never" nil) + (const :tag "Always" t) + (const :tag "Auto" auto))))) + +(defcustom org-insert-heading-hook nil + "Hook being run after inserting a new heading." + :group 'org-edit-structure + :type 'hook) + +(defgroup org-sparse-trees nil + "Options concerning sparse trees in Org mode." + :tag "Org Sparse Trees" + :group 'org-structure) + +(defcustom org-highlight-sparse-tree-matches t + "Non-nil means highlight all matches that define a sparse tree. +The highlights will automatically disappear the next time the buffer is +changed by an edit command." + :group 'org-sparse-trees + :type 'boolean) + +(defcustom org-remove-highlights-with-change t + "Non-nil means any change to the buffer will remove temporary highlights. +\\<org-mode-map>\ +Such highlights are created by `org-occur' and `org-clock-display'. +When nil, `\\[org-ctrl-c-ctrl-c]' needs to be used \ +to get rid of the highlights. +The highlights created by `org-latex-preview' always need +`\\[org-latex-preview]' to be removed." + :group 'org-sparse-trees + :group 'org-time + :type 'boolean) + +(defcustom org-occur-case-fold-search t + "Non-nil means `org-occur' should be case-insensitive. +If set to `smart' the search will be case-insensitive only if it +doesn't specify any upper case character." + :group 'org-sparse-trees + :version "26.1" + :type '(choice + (const :tag "Case-sensitive" nil) + (const :tag "Case-insensitive" t) + (const :tag "Case-insensitive for lower case searches only" smart))) + +(defcustom org-occur-hook '(org-first-headline-recenter) + "Hook that is run after `org-occur' has constructed a sparse tree. +This can be used to recenter the window to show as much of the structure +as possible." + :group 'org-sparse-trees + :type 'hook) + +(defcustom org-self-insert-cluster-for-undo nil + "Non-nil means cluster self-insert commands for undo when possible. +If this is set, then, like in the Emacs command loop, 20 consecutive +characters will be undone together. +This is configurable, because there is some impact on typing performance." + :group 'org-table + :type 'boolean) + +(defvaralias 'org-activate-links 'org-highlight-links) +(defcustom org-highlight-links '(bracket angle plain radio tag date footnote) + "Types of links that should be highlighted in Org files. + +This is a list of symbols, each one of them leading to the +highlighting of a certain link type. + +You can still open links that are not highlighted. + +In principle, it does not hurt to turn on highlighting for all +link types. There may be a small gain when turning off unused +link types. The types are: + +bracket The recommended [[link][description]] or [[link]] links with hiding. +angle Links in angular brackets that may contain whitespace like + <bbdb:Carsten Dominik>. +plain Plain links in normal text, no whitespace, like https://gnu.org. +radio Text that is matched by a radio target, see manual for details. +tag Tag settings in a headline (link to tag search). +date Time stamps (link to calendar). +footnote Footnote labels. + +If you set this variable during an Emacs session, use `org-mode-restart' +in the Org buffer so that the change takes effect." + :group 'org-appearance + :type '(set :greedy t + (const :tag "Double bracket links" bracket) + (const :tag "Angular bracket links" angle) + (const :tag "Plain text links" plain) + (const :tag "Radio target matches" radio) + (const :tag "Tags" tag) + (const :tag "Timestamps" date) + (const :tag "Footnotes" footnote))) + +(defcustom org-mark-ring-length 4 + "Number of different positions to be recorded in the ring. +Changing this requires a restart of Emacs to work correctly." + :group 'org-link-follow + :type 'integer) + +(defgroup org-todo nil + "Options concerning TODO items in Org mode." + :tag "Org TODO" + :group 'org) + +(defgroup org-progress nil + "Options concerning Progress logging in Org mode." + :tag "Org Progress" + :group 'org-time) + +(defvar org-todo-interpretation-widgets + '((:tag "Sequence (cycling hits every state)" sequence) + (:tag "Type (cycling directly to DONE)" type)) + "The available interpretation symbols for customizing `org-todo-keywords'. +Interested libraries should add to this list.") + +(defcustom org-todo-keywords '((sequence "TODO" "DONE")) + "List of TODO entry keyword sequences and their interpretation. +\\<org-mode-map>This is a list of sequences. + +Each sequence starts with a symbol, either `sequence' or `type', +indicating if the keywords should be interpreted as a sequence of +action steps, or as different types of TODO items. The first +keywords are states requiring action - these states will select a headline +for inclusion into the global TODO list Org produces. If one of the +\"keywords\" is the vertical bar, \"|\", the remaining keywords +signify that no further action is necessary. If \"|\" is not found, +the last keyword is treated as the only DONE state of the sequence. + +The command `\\[org-todo]' cycles an entry through these states, and one +additional state where no keyword is present. For details about this +cycling, see the manual. + +TODO keywords and interpretation can also be set on a per-file basis with +the special #+SEQ_TODO and #+TYP_TODO lines. + +Each keyword can optionally specify a character for fast state selection +\(in combination with the variable `org-use-fast-todo-selection') +and specifiers for state change logging, using the same syntax that +is used in the \"#+TODO:\" lines. For example, \"WAIT(w)\" says that +the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\" +indicates to record a time stamp each time this state is selected. + +Each keyword may also specify if a timestamp or a note should be +recorded when entering or leaving the state, by adding additional +characters in the parenthesis after the keyword. This looks like this: +\"WAIT(w@/!)\". \"@\" means to add a note (with time), \"!\" means to +record only the time of the state change. With X and Y being either +\"@\" or \"!\", \"X/Y\" means use X when entering the state, and use +Y when leaving the state if and only if the *target* state does not +define X. You may omit any of the fast-selection key or X or /Y, +so WAIT(w@), WAIT(w/@) and WAIT(@/@) are all valid. + +For backward compatibility, this variable may also be just a list +of keywords. In this case the interpretation (sequence or type) will be +taken from the (otherwise obsolete) variable `org-todo-interpretation'." + :group 'org-todo + :group 'org-keywords + :type '(choice + (repeat :tag "Old syntax, just keywords" + (string :tag "Keyword")) + (repeat :tag "New syntax" + (cons + (choice + :tag "Interpretation" + ;;Quick and dirty way to see + ;;`org-todo-interpretation'. This takes the + ;;place of item arguments + :convert-widget + (lambda (widget) + (widget-put widget + :args (mapcar + (lambda (x) + (widget-convert + (cons 'const x))) + org-todo-interpretation-widgets)) + widget)) + (repeat + (string :tag "Keyword")))))) + +(defvar-local org-todo-keywords-1 nil + "All TODO and DONE keywords active in a buffer.") +(defvar org-todo-keywords-for-agenda nil) +(defvar org-done-keywords-for-agenda nil) +(defvar org-todo-keyword-alist-for-agenda nil) +(defvar org-tag-alist-for-agenda nil + "Alist of all tags from all agenda files.") +(defvar org-tag-groups-alist-for-agenda nil + "Alist of all groups tags from all current agenda files.") +(defvar-local org-tag-groups-alist nil) +(defvar org-agenda-contributing-files nil) +(defvar-local org-current-tag-alist nil + "Alist of all tag groups in current buffer. +This variable takes into consideration `org-tag-alist', +`org-tag-persistent-alist' and TAGS keywords in the buffer.") +(defvar-local org-not-done-keywords nil) +(defvar-local org-done-keywords nil) +(defvar-local org-todo-heads nil) +(defvar-local org-todo-sets nil) +(defvar-local org-todo-log-states nil) +(defvar-local org-todo-kwd-alist nil) +(defvar-local org-todo-key-alist nil) +(defvar-local org-todo-key-trigger nil) + +(defcustom org-todo-interpretation 'sequence + "Controls how TODO keywords are interpreted. +This variable is in principle obsolete and is only used for +backward compatibility, if the interpretation of todo keywords is +not given already in `org-todo-keywords'. See that variable for +more information." + :group 'org-todo + :group 'org-keywords + :type '(choice (const sequence) + (const type))) + +(defcustom org-use-fast-todo-selection 'auto + "\\<org-mode-map>\ +Non-nil means use the fast todo selection scheme with `\\[org-todo]'. +This variable describes if and under what circumstances the cycling +mechanism for TODO keywords will be replaced by a single-key, direct +selection scheme, where the choices are displayed in a little window. + +When nil, fast selection is never used. This means that the command +will always switch to the next state. + +When it is the symbol `auto', fast selection is whenever selection +keys have been defined. + +`expert' is like `auto', but no special window with the keyword +will be shown, choices will only be listed in the prompt. + +In all cases, the special interface is only used if access keys have +actually been assigned by the user, i.e. if keywords in the configuration +are followed by a letter in parenthesis, like TODO(t)." + :group 'org-todo + :set (lambda (var val) + (cond + ((eq var t) (set var 'auto)) + ((eq var 'prefix) (set var nil)) + (t (set var val)))) + :type '(choice + (const :tag "Never" nil) + (const :tag "Automatically, when key letter have been defined" auto) + (const :tag "Automatically, but don't show the selection window" expert))) + +(defcustom org-provide-todo-statistics t + "Non-nil means update todo statistics after insert and toggle. +ALL-HEADLINES means update todo statistics by including headlines +with no TODO keyword as well, counting them as not done. +A list of TODO keywords means the same, but skip keywords that are +not in this list. +When set to a list of two lists, the first list contains keywords +to consider as TODO keywords, the second list contains keywords +to consider as DONE keywords. + +When this is set, todo statistics is updated in the parent of the +current entry each time a todo state is changed." + :group 'org-todo + :type '(choice + (const :tag "Yes, only for TODO entries" t) + (const :tag "Yes, including all entries" all-headlines) + (repeat :tag "Yes, for TODOs in this list" + (string :tag "TODO keyword")) + (list :tag "Yes, for TODOs and DONEs in these lists" + (repeat (string :tag "TODO keyword")) + (repeat (string :tag "DONE keyword"))) + (other :tag "No TODO statistics" nil))) + +(defcustom org-hierarchical-todo-statistics t + "Non-nil means TODO statistics covers just direct children. +When nil, all entries in the subtree are considered. +This has only an effect if `org-provide-todo-statistics' is set. +To set this to nil for only a single subtree, use a COOKIE_DATA +property and include the word \"recursive\" into the value." + :group 'org-todo + :type 'boolean) + +(defcustom org-after-todo-state-change-hook nil + "Hook which is run after the state of a TODO item was changed. +The new state (a string with a TODO keyword, or nil) is available in the +Lisp variable `org-state'." + :group 'org-todo + :type 'hook) + +(defvar org-blocker-hook nil + "Hook for functions that are allowed to block a state change. + +Functions in this hook should not modify the buffer. +Each function gets as its single argument a property list, +see `org-trigger-hook' for more information about this list. + +If any of the functions in this hook returns nil, the state change +is blocked.") + +(defvar org-trigger-hook nil + "Hook for functions that are triggered by a state change. + +Each function gets as its single argument a property list with at +least the following elements: + + (:type type-of-change :position pos-at-entry-start + :from old-state :to new-state) + +Depending on the type, more properties may be present. + +This mechanism is currently implemented for: + +TODO state changes +------------------ +:type todo-state-change +:from previous state (keyword as a string), or nil, or a symbol + `todo' or `done', to indicate the general type of state. +:to new state, like in :from") + +(defcustom org-enforce-todo-dependencies nil + "Non-nil means undone TODO entries will block switching the parent to DONE. +Also, if a parent has an :ORDERED: property, switching an entry to DONE will +be blocked if any prior sibling is not yet done. +Finally, if the parent is blocked because of ordered siblings of its own, +the child will also be blocked." + :set (lambda (var val) + (set var val) + (if val + (add-hook 'org-blocker-hook + 'org-block-todo-from-children-or-siblings-or-parent) + (remove-hook 'org-blocker-hook + 'org-block-todo-from-children-or-siblings-or-parent))) + :group 'org-todo + :type 'boolean) + +(defcustom org-enforce-todo-checkbox-dependencies nil + "Non-nil means unchecked boxes will block switching the parent to DONE. +When this is nil, checkboxes have no influence on switching TODO states. +When non-nil, you first need to check off all check boxes before the TODO +entry can be switched to DONE. +This variable needs to be set before org.el is loaded, and you need to +restart Emacs after a change to make the change effective. The only way +to change it while Emacs is running is through the customize interface." + :set (lambda (var val) + (set var val) + (if val + (add-hook 'org-blocker-hook + 'org-block-todo-from-checkboxes) + (remove-hook 'org-blocker-hook + 'org-block-todo-from-checkboxes))) + :group 'org-todo + :type 'boolean) + +(defcustom org-treat-insert-todo-heading-as-state-change nil + "Non-nil means inserting a TODO heading is treated as state change. +So when the command `\\[org-insert-todo-heading]' is used, state change +logging will apply if appropriate. When nil, the new TODO item will +be inserted directly, and no logging will take place." + :group 'org-todo + :type 'boolean) + +(defcustom org-treat-S-cursor-todo-selection-as-state-change t + "Non-nil means switching TODO states with S-cursor counts as state change. +This is the default behavior. However, setting this to nil allows a +convenient way to select a TODO state and bypass any logging associated +with that." + :group 'org-todo + :type 'boolean) + +(defcustom org-todo-state-tags-triggers nil + "Tag changes that should be triggered by TODO state changes. +This is a list. Each entry is + + (state-change (tag . flag) .......) + +State-change can be a string with a state, and empty string to indicate the +state that has no TODO keyword, or it can be one of the symbols `todo' +or `done', meaning any not-done or done state, respectively." + :group 'org-todo + :group 'org-tags + :type '(repeat + (cons (choice :tag "When changing to" + (const :tag "Not-done state" todo) + (const :tag "Done state" done) + (string :tag "State")) + (repeat + (cons :tag "Tag action" + (string :tag "Tag") + (choice (const :tag "Add" t) (const :tag "Remove" nil))))))) + +(defcustom org-log-done nil + "Information to record when a task moves to the DONE state. + +Possible values are: + +nil Don't add anything, just change the keyword +time Add a time stamp to the task +note Prompt for a note and add it with template `org-log-note-headings' + +This option can also be set with on a per-file-basis with + + #+STARTUP: nologdone + #+STARTUP: logdone + #+STARTUP: lognotedone + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords." + :group 'org-todo + :group 'org-progress + :type '(choice + (const :tag "No logging" nil) + (const :tag "Record CLOSED timestamp" time) + (const :tag "Record CLOSED timestamp with note." note))) + +;; Normalize old uses of org-log-done. +(cond + ((eq org-log-done t) (setq org-log-done 'time)) + ((and (listp org-log-done) (memq 'done org-log-done)) + (setq org-log-done 'note))) + +(defcustom org-log-reschedule nil + "Information to record when the scheduling date of a task is modified. + +Possible values are: + +nil Don't add anything, just change the date +time Add a time stamp to the task +note Prompt for a note and add it with template `org-log-note-headings' + +This option can also be set with on a per-file-basis with + + #+STARTUP: nologreschedule + #+STARTUP: logreschedule + #+STARTUP: lognotereschedule + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords. + +This variable has an effect when calling `org-schedule' or +`org-agenda-schedule' only." + :group 'org-todo + :group 'org-progress + :type '(choice + (const :tag "No logging" nil) + (const :tag "Record timestamp" time) + (const :tag "Record timestamp with note" note))) + +(defcustom org-log-redeadline nil + "Information to record when the deadline date of a task is modified. + +Possible values are: + +nil Don't add anything, just change the date +time Add a time stamp to the task +note Prompt for a note and add it with template `org-log-note-headings' + +This option can also be set with on a per-file-basis with + + #+STARTUP: nologredeadline + #+STARTUP: logredeadline + #+STARTUP: lognoteredeadline + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords. + +This variable has an effect when calling `org-deadline' or +`org-agenda-deadline' only." + :group 'org-todo + :group 'org-progress + :type '(choice + (const :tag "No logging" nil) + (const :tag "Record timestamp" time) + (const :tag "Record timestamp with note." note))) + +(defcustom org-log-note-clock-out nil + "Non-nil means record a note when clocking out of an item. +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + + #+STARTUP: lognoteclock-out + #+STARTUP: nolognoteclock-out" + :group 'org-todo + :group 'org-progress + :type 'boolean) + +(defcustom org-log-done-with-time t + "Non-nil means the CLOSED time stamp will contain date and time. +When nil, only the date will be recorded." + :group 'org-progress + :type 'boolean) + +(defcustom org-log-note-headings + '((done . "CLOSING NOTE %t") + (state . "State %-12s from %-12S %t") + (note . "Note taken on %t") + (reschedule . "Rescheduled from %S on %t") + (delschedule . "Not scheduled, was %S on %t") + (redeadline . "New deadline from %S on %t") + (deldeadline . "Removed deadline, was %S on %t") + (refile . "Refiled on %t") + (clock-out . "")) + "Headings for notes added to entries. + +The value is an alist, with the car being a symbol indicating the +note context, and the cdr is the heading to be used. The heading +may also be the empty string. The following placeholders can be +used: + + %t a time stamp. + %T an active time stamp instead the default inactive one + %d a short-format time stamp. + %D an active short-format time stamp. + %s the new TODO state or time stamp (inactive), in double quotes. + %S the old TODO state or time stamp (inactive), in double quotes. + %u the user name. + %U full user name. + +In fact, it is not a good idea to change the `state' entry, +because Agenda Log mode depends on the format of these entries." + :group 'org-todo + :group 'org-progress + :type '(list :greedy t + (cons (const :tag "Heading when closing an item" done) string) + (cons (const :tag + "Heading when changing todo state (todo sequence only)" + state) string) + (cons (const :tag "Heading when just taking a note" note) string) + (cons (const :tag "Heading when rescheduling" reschedule) string) + (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string) + (cons (const :tag "Heading when changing deadline" redeadline) string) + (cons (const :tag "Heading when deleting a deadline" deldeadline) string) + (cons (const :tag "Heading when refiling" refile) string) + (cons (const :tag "Heading when clocking out" clock-out) string))) + +(unless (assq 'note org-log-note-headings) + (push '(note . "%t") org-log-note-headings)) + +(defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer) + +(defcustom org-log-into-drawer nil + "Non-nil means insert state change notes and time stamps into a drawer. +When nil, state changes notes will be inserted after the headline and +any scheduling and clock lines, but not inside a drawer. + +The value of this variable should be the name of the drawer to use. +LOGBOOK is proposed as the default drawer for this purpose, you can +also set this to a string to define the drawer of your choice. + +A value of t is also allowed, representing \"LOGBOOK\". + +A value of t or nil can also be set with on a per-file-basis with + + #+STARTUP: logdrawer + #+STARTUP: nologdrawer + +If this variable is set, `org-log-state-notes-insert-after-drawers' +will be ignored. + +You can set the property LOG_INTO_DRAWER to overrule this setting for +a subtree. + +Do not check directly this variable in a Lisp program. Call +function `org-log-into-drawer' instead." + :group 'org-todo + :group 'org-progress + :type '(choice + (const :tag "Not into a drawer" nil) + (const :tag "LOGBOOK" t) + (string :tag "Other"))) + +(defun org-log-into-drawer () + "Name of the log drawer, as a string, or nil. +This is the value of `org-log-into-drawer'. However, if the +current entry has or inherits a LOG_INTO_DRAWER property, it will +be used instead of the default value." + (let ((p (org-entry-get nil "LOG_INTO_DRAWER" 'inherit t))) + (cond ((equal p "nil") nil) + ((equal p "t") "LOGBOOK") + ((stringp p) p) + (p "LOGBOOK") + ((stringp org-log-into-drawer) org-log-into-drawer) + (org-log-into-drawer "LOGBOOK")))) + +(defcustom org-log-state-notes-insert-after-drawers nil + "Non-nil means insert state change notes after any drawers in entry. +Only the drawers that *immediately* follow the headline and the +deadline/scheduled line are skipped. +When nil, insert notes right after the heading and perhaps the line +with deadline/scheduling if present. + +This variable will have no effect if `org-log-into-drawer' is +set." + :group 'org-todo + :group 'org-progress + :type 'boolean) + +(defcustom org-log-states-order-reversed t + "Non-nil means the latest state note will be directly after heading. +When nil, the state change notes will be ordered according to time. + +This option can also be set with on a per-file-basis with + + #+STARTUP: logstatesreversed + #+STARTUP: nologstatesreversed" + :group 'org-todo + :group 'org-progress + :type 'boolean) + +(defcustom org-todo-repeat-to-state nil + "The TODO state to which a repeater should return the repeating task. +By default this is the first task of a TODO sequence or the +previous state of a TYPE_TODO set. But you can specify to use +the previous state in a TODO sequence or a string. + +Alternatively, you can set the :REPEAT_TO_STATE: property of the +entry, which has precedence over this option." + :group 'org-todo + :version "24.1" + :type '(choice (const :tag "Use the previous TODO state" t) + (const :tag "Use the head of the TODO sequence" nil) + (string :tag "Use a specific TODO state"))) + +(defcustom org-log-repeat 'time + "Non-nil means record moving through the DONE state when triggering repeat. +An auto-repeating task is immediately switched back to TODO when +marked DONE. If you are not logging state changes (by adding \"@\" +or \"!\" to the TODO keyword definition), or set `org-log-done' to +record a closing note, there will be no record of the task moving +through DONE. This variable forces taking a note anyway. + +nil Don't force a record +time Record a time stamp +note Prompt for a note and add it with template `org-log-note-headings' + +This option can also be set with on a per-file-basis with + + #+STARTUP: nologrepeat + #+STARTUP: logrepeat + #+STARTUP: lognoterepeat + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords." + :group 'org-todo + :group 'org-progress + :type '(choice + (const :tag "Don't force a record" nil) + (const :tag "Force recording the DONE state" time) + (const :tag "Force recording a note with the DONE state" note))) + +(defcustom org-todo-repeat-hook nil + "Hook that is run after a task has been repeated." + :package-version '(Org . "9.2") + :group 'org-todo + :type 'hook) + +(defgroup org-priorities nil + "Priorities in Org mode." + :tag "Org Priorities" + :group 'org-todo) + +(defvaralias 'org-enable-priority-commands 'org-priority-enable-commands) +(defcustom org-priority-enable-commands t + "Non-nil means priority commands are active. +When nil, these commands will be disabled, so that you never accidentally +set a priority." + :group 'org-priorities + :type 'boolean) + +(defvaralias 'org-highest-priority 'org-priority-highest) + +(defcustom org-priority-highest ?A + "The highest priority of TODO items. + +A character like ?A, ?B, etc., or a numeric value like 1, 2, etc. + +The default is the character ?A, which is 65 as a numeric value. + +If you set `org-priority-highest' to a numeric value inferior to +65, Org assumes you want to use digits for the priority cookie. +If you set it to >=65, Org assumes you want to use alphabetical +characters. + +In both cases, the value of `org-priority-highest' must be +smaller than `org-priority-lowest': for example, if \"A\" is the +highest priority, it is smaller than the lowest \"C\" priority: +65 < 67." + :group 'org-priorities + :type '(choice + (character :tag "Character") + (integer :tag "Integer (< 65)"))) + +(defvaralias 'org-lowest-priority 'org-priority-lowest) +(defcustom org-priority-lowest ?C + "The lowest priority of TODO items. + +A character like ?C, ?B, etc., or a numeric value like 9, 8, etc. + +The default is the character ?C, which is 67 as a numeric value. + +If you set `org-priority-lowest' to a numeric value inferior to +65, Org assumes you want to use digits for the priority cookie. +If you set it to >=65, Org assumes you want to use alphabetical +characters. + +In both cases, the value of `org-priority-lowest' must be greater +than `org-priority-highest': for example, if \"C\" is the lowest +priority, it is greater than the highest \"A\" priority: 67 > +65." + :group 'org-priorities + :type '(choice + (character :tag "Character") + (integer :tag "Integer (< 65)"))) + +(defvaralias 'org-default-priority 'org-priority-default) +(defcustom org-priority-default ?B + "The default priority of TODO items. +This is the priority an item gets if no explicit priority is given. +When starting to cycle on an empty priority the first step in the cycle +depends on `org-priority-start-cycle-with-default'. The resulting first +step priority must not exceed the range from `org-priority-highest' to +`org-priority-lowest' which means that `org-priority-default' has to be +in this range exclusive or inclusive to the range boundaries. Else the +first step refuses to set the default and the second will fall back on +\(depending on the command used) the highest or lowest priority." + :group 'org-priorities + :type '(choice + (character :tag "Character") + (integer :tag "Integer (< 65)"))) + +(defcustom org-priority-start-cycle-with-default t + "Non-nil means start with default priority when starting to cycle. +When this is nil, the first step in the cycle will be (depending on the +command used) one higher or lower than the default priority. +See also `org-priority-default'." + :group 'org-priorities + :type 'boolean) + +(defvaralias 'org-get-priority-function 'org-priority-get-priority-function) +(defcustom org-priority-get-priority-function nil + "Function to extract the priority from a string. +The string is normally the headline. If this is nil, Org +computes the priority from the priority cookie like [#A] in the +headline. It returns an integer, increasing by 1000 for each +priority level. + +The user can set a different function here, which should take a +string as an argument and return the numeric priority." + :group 'org-priorities + :version "24.1" + :type '(choice + (const nil) + (function))) + +(defgroup org-time nil + "Options concerning time stamps and deadlines in Org mode." + :tag "Org Time" + :group 'org) + +(defcustom org-time-stamp-rounding-minutes '(0 5) + "Number of minutes to round time stamps to. +\\<org-mode-map>\ +These are two values, the first applies when first creating a time stamp. +The second applies when changing it with the commands `S-up' and `S-down'. +When changing the time stamp, this means that it will change in steps +of N minutes, as given by the second value. + +When a setting is 0 or 1, insert the time unmodified. Useful rounding +numbers should be factors of 60, so for example 5, 10, 15. + +When this is larger than 1, you can still force an exact time stamp by using +a double prefix argument to a time stamp command like \ +`\\[org-time-stamp]' or `\\[org-time-stamp-inactive], +and by using a prefix arg to `S-up/down' to specify the exact number +of minutes to shift." + :group 'org-time + :get (lambda (var) ; Make sure both elements are there + (if (integerp (default-value var)) + (list (default-value var) 5) + (default-value var))) + :type '(list + (integer :tag "when inserting times") + (integer :tag "when modifying times"))) + +;; Normalize old customizations of this variable. +(when (integerp org-time-stamp-rounding-minutes) + (setq org-time-stamp-rounding-minutes + (list org-time-stamp-rounding-minutes + org-time-stamp-rounding-minutes))) + +(defcustom org-display-custom-times nil + "Non-nil means overlay custom formats over all time stamps. +The formats are defined through the variable `org-time-stamp-custom-formats'. +To turn this on on a per-file basis, insert anywhere in the file: + #+STARTUP: customtime" + :group 'org-time + :set 'set-default + :type 'sexp) +(make-variable-buffer-local 'org-display-custom-times) + +(defcustom org-time-stamp-custom-formats + '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american + "Custom formats for time stamps. See `format-time-string' for the syntax. +These are overlaid over the default ISO format if the variable +`org-display-custom-times' is set. Time like %H:%M should be at the +end of the second format. The custom formats are also honored by export +commands, if custom time display is turned on at the time of export." + :group 'org-time + :type 'sexp) + +(defun org-time-stamp-format (&optional long inactive) + "Get the right format for a time string." + (let ((f (if long (cdr org-time-stamp-formats) + (car org-time-stamp-formats)))) + (if inactive + (concat "[" (substring f 1 -1) "]") + f))) + +(defcustom org-deadline-warning-days 14 + "Number of days before expiration during which a deadline becomes active. +This variable governs the display in sparse trees and in the agenda. +When 0 or negative, it means use this number (the absolute value of it) +even if a deadline has a different individual lead time specified. + +Custom commands can set this variable in the options section." + :group 'org-time + :group 'org-agenda-daily/weekly + :type 'integer) + +(defcustom org-scheduled-delay-days 0 + "Number of days before a scheduled item becomes active. +This variable governs the display in sparse trees and in the agenda. +The default value (i.e. 0) means: don't delay scheduled item. +When negative, it means use this number (the absolute value of it) +even if a scheduled item has a different individual delay time +specified. + +Custom commands can set this variable in the options section." + :group 'org-time + :group 'org-agenda-daily/weekly + :version "24.4" + :package-version '(Org . "8.0") + :type 'integer) + +(defcustom org-read-date-prefer-future t + "Non-nil means assume future for incomplete date input from user. +This affects the following situations: +1. The user gives a month but not a year. + For example, if it is April and you enter \"feb 2\", this will be read + as Feb 2, *next* year. \"May 5\", however, will be this year. +2. The user gives a day, but no month. + For example, if today is the 15th, and you enter \"3\", Org will read + this as the third of *next* month. However, if you enter \"17\", + it will be considered as *this* month. + +If you set this variable to the symbol `time', then also the following +will work: + +3. If the user gives a time. + If the time is before now, it will be interpreted as tomorrow. + +Currently none of this works for ISO week specifications. + +When this option is nil, the current day, month and year will always be +used as defaults. + +See also `org-agenda-jump-prefer-future'." + :group 'org-time + :type '(choice + (const :tag "Never" nil) + (const :tag "Check month and day" t) + (const :tag "Check month, day, and time" time))) + +(defcustom org-agenda-jump-prefer-future 'org-read-date-prefer-future + "Should the agenda jump command prefer the future for incomplete dates? +The default is to do the same as configured in `org-read-date-prefer-future'. +But you can also set a deviating value here. +This may t or nil, or the symbol `org-read-date-prefer-future'." + :group 'org-agenda + :group 'org-time + :version "24.1" + :type '(choice + (const :tag "Use org-read-date-prefer-future" + org-read-date-prefer-future) + (const :tag "Never" nil) + (const :tag "Always" t))) + +(defcustom org-read-date-force-compatible-dates t + "Should date/time prompt force dates that are guaranteed to work in Emacs? + +Depending on the system Emacs is running on, certain dates cannot +be represented with the type used internally to represent time. +Dates between 1970-1-1 and 2038-1-1 can always be represented +correctly. Some systems allow for earlier dates, some for later, +some for both. One way to find out is to insert any date into an +Org buffer, putting the cursor on the year and hitting S-up and +S-down to test the range. + +When this variable is set to t, the date/time prompt will not let +you specify dates outside the 1970-2037 range, so it is certain that +these dates will work in whatever version of Emacs you are +running, and also that you can move a file from one Emacs implementation +to another. Whenever Org is forcing the year for you, it will display +a message and beep. + +When this variable is nil, Org will check if the date is +representable in the specific Emacs implementation you are using. +If not, it will force a year, usually the current year, and beep +to remind you. Currently this setting is not recommended because +the likelihood that you will open your Org files in an Emacs that +has limited date range is not negligible. + +A workaround for this problem is to use diary sexp dates for time +stamps outside of this range." + :group 'org-time + :version "24.1" + :type 'boolean) + +(defcustom org-read-date-display-live t + "Non-nil means display current interpretation of date prompt live. +This display will be in an overlay, in the minibuffer. Note that +live display is only active when `org-read-date-popup-calendar' +is non-nil." + :group 'org-time + :type 'boolean) + +(defvaralias 'org-popup-calendar-for-date-prompt + 'org-read-date-popup-calendar) + +(defcustom org-read-date-popup-calendar t + "Non-nil means pop up a calendar when prompting for a date. +In the calendar, the date can be selected with mouse-1. However, the +minibuffer will also be active, and you can simply enter the date as well. +When nil, only the minibuffer will be available." + :group 'org-time + :type 'boolean) + +(defcustom org-extend-today-until 0 + "The hour when your day really ends. Must be an integer. +This has influence for the following applications: +- When switching the agenda to \"today\". If it is still earlier than + the time given here, the day recognized as TODAY is actually yesterday. +- When a date is read from the user and it is still before the time given + here, the current date and time will be assumed to be yesterday, 23:59. + Also, timestamps inserted in capture templates follow this rule. + +IMPORTANT: This is a feature whose implementation is and likely will +remain incomplete. Really, it is only here because past midnight seems to +be the favorite working time of John Wiegley :-)" + :group 'org-time + :type 'integer) + +(defcustom org-use-effective-time nil + "If non-nil, consider `org-extend-today-until' when creating timestamps. +For example, if `org-extend-today-until' is 8, and it's 4am, then the +\"effective time\" of any timestamps between midnight and 8am will be +23:59 of the previous day." + :group 'org-time + :version "24.1" + :type 'boolean) + +(defcustom org-use-last-clock-out-time-as-effective-time nil + "When non-nil, use the last clock out time for `org-todo'. +Note that this option has precedence over the combined use of +`org-use-effective-time' and `org-extend-today-until'." + :group 'org-time + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-edit-timestamp-down-means-later nil + "Non-nil means S-down will increase the time in a time stamp. +When nil, S-up will increase." + :group 'org-time + :type 'boolean) + +(defcustom org-calendar-follow-timestamp-change t + "Non-nil means make the calendar window follow timestamp changes. +When a timestamp is modified and the calendar window is visible, it will be +moved to the new date." + :group 'org-time + :type 'boolean) + +(defgroup org-tags nil + "Options concerning tags in Org mode." + :tag "Org Tags" + :group 'org) + +(defcustom org-tag-alist nil + "Default tags available in Org files. + +The value of this variable is an alist. Associations either: + + (TAG) + (TAG . SELECT) + (SPECIAL) + +where TAG is a tag as a string, SELECT is character, used to +select that tag through the fast tag selection interface, and +SPECIAL is one of the following keywords: `:startgroup', +`:startgrouptag', `:grouptags', `:endgroup', `:endgrouptag' or +`:newline'. These keywords are used to define a hierarchy of +tags. See manual for details. + +When this variable is nil, Org mode bases tag input on what is +already in the buffer. The value can be overridden locally by +using a TAGS keyword, e.g., + + #+TAGS: tag1 tag2 + +See also `org-tag-persistent-alist' to sidestep this behavior." + :group 'org-tags + :type '(repeat + (choice + (cons :tag "Tag with key" + (string :tag "Tag name") + (character :tag "Access char")) + (list :tag "Tag" (string :tag "Tag name")) + (const :tag "Start radio group" (:startgroup)) + (const :tag "Start tag group, non distinct" (:startgrouptag)) + (const :tag "Group tags delimiter" (:grouptags)) + (const :tag "End radio group" (:endgroup)) + (const :tag "End tag group, non distinct" (:endgrouptag)) + (const :tag "New line" (:newline))))) + +(defcustom org-tag-persistent-alist nil + "Tags always available in Org files. + +The value of this variable is an alist. Associations either: + + (TAG) + (TAG . SELECT) + (SPECIAL) + +where TAG is a tag as a string, SELECT is a character, used to +select that tag through the fast tag selection interface, and +SPECIAL is one of the following keywords: `:startgroup', +`:startgrouptag', `:grouptags', `:endgroup', `:endgrouptag' or +`:newline'. These keywords are used to define a hierarchy of +tags. See manual for details. + +Unlike to `org-tag-alist', tags defined in this variable do not +depend on a local TAGS keyword. Instead, to disable these tags +on a per-file basis, insert anywhere in the file: + + #+STARTUP: noptag" + :group 'org-tags + :type '(repeat + (choice + (cons :tag "Tag with key" + (string :tag "Tag name") + (character :tag "Access char")) + (list :tag "Tag" (string :tag "Tag name")) + (const :tag "Start radio group" (:startgroup)) + (const :tag "Start tag group, non distinct" (:startgrouptag)) + (const :tag "Group tags delimiter" (:grouptags)) + (const :tag "End radio group" (:endgroup)) + (const :tag "End tag group, non distinct" (:endgrouptag)) + (const :tag "New line" (:newline))))) + +(defcustom org-complete-tags-always-offer-all-agenda-tags nil + "If non-nil, always offer completion for all tags of all agenda files. + +Setting this variable locally allows for dynamic generation of tag +completions in capture buffers. + + (add-hook \\='org-capture-mode-hook + (lambda () + (setq-local org-complete-tags-always-offer-all-agenda-tags t)))" + :group 'org-tags + :version "24.1" + :type 'boolean) + +(defvar org-file-tags nil + "List of tags that can be inherited by all entries in the file. +The tags will be inherited if the variable `org-use-tag-inheritance' +says they should be. +This variable is populated from #+FILETAGS lines.") + +(defcustom org-use-fast-tag-selection 'auto + "Non-nil means use fast tag selection scheme. +This is a special interface to select and deselect tags with single keys. +When nil, fast selection is never used. +When the symbol `auto', fast selection is used if and only if selection +characters for tags have been configured, either through the variable +`org-tag-alist' or through a #+TAGS line in the buffer. +When t, fast selection is always used and selection keys are assigned +automatically if necessary." + :group 'org-tags + :type '(choice + (const :tag "Always" t) + (const :tag "Never" nil) + (const :tag "When selection characters are configured" auto))) + +(defcustom org-fast-tag-selection-single-key nil + "Non-nil means fast tag selection exits after first change. +When nil, you have to press RET to exit it. +During fast tag selection, you can toggle this flag with `C-c'. +This variable can also have the value `expert'. In this case, the window +displaying the tags menu is not even shown, until you press `C-c' again." + :group 'org-tags + :type '(choice + (const :tag "No" nil) + (const :tag "Yes" t) + (const :tag "Expert" expert))) + +(defvar org-fast-tag-selection-include-todo nil + "Non-nil means fast tags selection interface will also offer TODO states. +This is an undocumented feature, you should not rely on it.") + +(defcustom org-tags-column -77 + "The column to which tags should be indented in a headline. +If this number is positive, it specifies the column. If it is negative, +it means that the tags should be flushright to that column. For example, +-80 works well for a normal 80 character screen. +When 0, place tags directly after headline text, with only one space in +between." + :group 'org-tags + :type 'integer) + +(defcustom org-auto-align-tags t + "Non-nil keeps tags aligned when modifying headlines. +Some operations (i.e. demoting) change the length of a headline and +therefore shift the tags around. With this option turned on, after +each such operation the tags are again aligned to `org-tags-column'." + :group 'org-tags + :type 'boolean) + +(defcustom org-use-tag-inheritance t + "Non-nil means tags in levels apply also for sublevels. +When nil, only the tags directly given in a specific line apply there. +This may also be a list of tags that should be inherited, or a regexp that +matches tags that should be inherited. Additional control is possible +with the variable `org-tags-exclude-from-inheritance' which gives an +explicit list of tags to be excluded from inheritance, even if the value of +`org-use-tag-inheritance' would select it for inheritance. + +If this option is t, a match early-on in a tree can lead to a large +number of matches in the subtree when constructing the agenda or creating +a sparse tree. If you only want to see the first match in a tree during +a search, check out the variable `org-tags-match-list-sublevels'." + :group 'org-tags + :type '(choice + (const :tag "Not" nil) + (const :tag "Always" t) + (repeat :tag "Specific tags" (string :tag "Tag")) + (regexp :tag "Tags matched by regexp"))) + +(defcustom org-tags-exclude-from-inheritance nil + "List of tags that should never be inherited. +This is a way to exclude a few tags from inheritance. For way to do +the opposite, to actively allow inheritance for selected tags, +see the variable `org-use-tag-inheritance'." + :group 'org-tags + :type '(repeat (string :tag "Tag"))) + +(defun org-tag-inherit-p (tag) + "Check if TAG is one that should be inherited." + (cond + ((member tag org-tags-exclude-from-inheritance) nil) + ((eq org-use-tag-inheritance t) t) + ((not org-use-tag-inheritance) nil) + ((stringp org-use-tag-inheritance) + (string-match org-use-tag-inheritance tag)) + ((listp org-use-tag-inheritance) + (member tag org-use-tag-inheritance)) + (t (error "Invalid setting of `org-use-tag-inheritance'")))) + +(defcustom org-tags-match-list-sublevels t + "Non-nil means list also sublevels of headlines matching a search. +This variable applies to tags/property searches, and also to stuck +projects because this search is based on a tags match as well. + +When set to the symbol `indented', sublevels are indented with +leading dots. + +Because of tag inheritance (see variable `org-use-tag-inheritance'), +the sublevels of a headline matching a tag search often also match +the same search. Listing all of them can create very long lists. +Setting this variable to nil causes subtrees of a match to be skipped. + +This variable is semi-obsolete and probably should always be true. It +is better to limit inheritance to certain tags using the variables +`org-use-tag-inheritance' and `org-tags-exclude-from-inheritance'." + :group 'org-tags + :type '(choice + (const :tag "No, don't list them" nil) + (const :tag "Yes, do list them" t) + (const :tag "List them, indented with leading dots" indented))) + +(defcustom org-tags-sort-function nil + "When set, tags are sorted using this function as a comparator." + :group 'org-tags + :type '(choice + (const :tag "No sorting" nil) + (const :tag "Alphabetical" org-string-collate-lessp) + (const :tag "Reverse alphabetical" org-string-collate-greaterp) + (function :tag "Custom function" nil))) + +(defvar org-tags-history nil + "History of minibuffer reads for tags.") +(defvar org-last-tags-completion-table nil + "The last used completion table for tags.") +(defvar org-after-tags-change-hook nil + "Hook that is run after the tags in a line have changed.") + +(defgroup org-properties nil + "Options concerning properties in Org mode." + :tag "Org Properties" + :group 'org) + +(defcustom org-property-format "%-10s %s" + "How property key/value pairs should be formatted by `indent-line'. +When `indent-line' hits a property definition, it will format the line +according to this format, mainly to make sure that the values are +lined-up with respect to each other." + :group 'org-properties + :type 'string) + +(defcustom org-properties-postprocess-alist nil + "Alist of properties and functions to adjust inserted values. +Elements of this alist must be of the form + + ([string] [function]) + +where [string] must be a property name and [function] must be a +lambda expression: this lambda expression must take one argument, +the value to adjust, and return the new value as a string. + +For example, this element will allow the property \"Remaining\" +to be updated wrt the relation between the \"Effort\" property +and the clock summary: + + ((\"Remaining\" (lambda(value) + (let ((clocksum (org-clock-sum-current-item)) + (effort (org-duration-to-minutes + (org-entry-get (point) \"Effort\")))) + (org-minutes-to-clocksum-string (- effort clocksum))))))" + :group 'org-properties + :version "24.1" + :type '(alist :key-type (string :tag "Property") + :value-type (function :tag "Function"))) + +(defcustom org-use-property-inheritance nil + "Non-nil means properties apply also for sublevels. + +This setting is chiefly used during property searches. Turning it on can +cause significant overhead when doing a search, which is why it is not +on by default. + +When nil, only the properties directly given in the current entry count. +When t, every property is inherited. The value may also be a list of +properties that should have inheritance, or a regular expression matching +properties that should be inherited. + +However, note that some special properties use inheritance under special +circumstances (not in searches). Examples are CATEGORY, ARCHIVE, COLUMNS, +and the properties ending in \"_ALL\" when they are used as descriptor +for valid values of a property. + +Note for programmers: +When querying an entry with `org-entry-get', you can control if inheritance +should be used. By default, `org-entry-get' looks only at the local +properties. You can request inheritance by setting the inherit argument +to t (to force inheritance) or to `selective' (to respect the setting +in this variable)." + :group 'org-properties + :type '(choice + (const :tag "Not" nil) + (const :tag "Always" t) + (repeat :tag "Specific properties" (string :tag "Property")) + (regexp :tag "Properties matched by regexp"))) + +(defun org-property-inherit-p (property) + "Return a non-nil value if PROPERTY should be inherited." + (cond + ((eq org-use-property-inheritance t) t) + ((not org-use-property-inheritance) nil) + ((stringp org-use-property-inheritance) + (string-match org-use-property-inheritance property)) + ((listp org-use-property-inheritance) + (member-ignore-case property org-use-property-inheritance)) + (t (error "Invalid setting of `org-use-property-inheritance'")))) + +(defcustom org-columns-default-format "%25ITEM %TODO %3PRIORITY %TAGS" + "The default column format, if no other format has been defined. +This variable can be set on the per-file basis by inserting a line + +#+COLUMNS: %25ITEM ....." + :group 'org-properties + :type 'string) + +(defcustom org-columns-default-format-for-agenda nil + "The default column format in an agenda buffer. +This will be used for column view in the agenda unless a format has +been set by adding `org-overriding-columns-format' to the local +settings list of a custom agenda view. When nil, the columns format +for the first item in the agenda list will be used, or as a fall-back, +`org-columns-default-format'." + :group 'org-properties + :type '(choice + (const :tag "No default" nil) + (string :tag "Format string"))) + +(defcustom org-columns-ellipses ".." + "The ellipses to be used when a field in column view is truncated. +When this is the empty string, as many characters as possible are shown, +but then there will be no visual indication that the field has been truncated. +When this is a string of length N, the last N characters of a truncated +field are replaced by this string. If the column is narrower than the +ellipses string, only part of the ellipses string will be shown." + :group 'org-properties + :type 'string) + +(defconst org-global-properties-fixed + '(("VISIBILITY_ALL" . "folded children content all") + ("CLOCK_MODELINE_TOTAL_ALL" . "current today repeat all auto")) + "List of property/value pairs that can be inherited by any entry. + +These are fixed values, for the preset properties. The user variable +that can be used to add to this list is `org-global-properties'. + +The entries in this list are cons cells where the car is a property +name and cdr is a string with the value. If the value represents +multiple items like an \"_ALL\" property, separate the items by +spaces.") + +(defcustom org-global-properties nil + "List of property/value pairs that can be inherited by any entry. + +This list will be combined with the constant `org-global-properties-fixed'. + +The entries in this list are cons cells where the car is a property +name and cdr is a string with the value. + +Buffer local properties are added either by a document property drawer + +:PROPERTIES: +:NAME: VALUE +:END: + +or by adding lines like + +#+PROPERTY: NAME VALUE" + :group 'org-properties + :type '(repeat + (cons (string :tag "Property") + (string :tag "Value")))) + +(defvar-local org-keyword-properties nil + "List of property/value pairs inherited by any entry. + +Valid for the current buffer. This variable is populated from +PROPERTY keywords. + +Note that properties are defined also in property drawers. +Properties defined there take precedence over properties defined +as keywords.") + +(defgroup org-agenda nil + "Options concerning agenda views in Org mode." + :tag "Org Agenda" + :group 'org) + +(defvar-local org-category nil + "Variable used by Org files to set a category for agenda display. +There are multiple ways to set the category. One way is to set +it in the document property drawer. For example: + +:PROPERTIES: +:CATEGORY: ELisp +:END: + +Other ways to define it is as an Emacs file variable, for example + +# -*- mode: org; org-category: \"ELisp\" + +or for the file to contain a special line: + +#+CATEGORY: ELisp + +If the file does not specify a category, then file's base name +is used instead.") +(put 'org-category 'safe-local-variable (lambda (x) (or (symbolp x) (stringp x)))) + +(defcustom org-agenda-files nil + "The files to be used for agenda display. + +If an entry is a directory, all files in that directory that are matched +by `org-agenda-file-regexp' will be part of the file list. + +If the value of the variable is not a list but a single file name, then +the list of agenda files is actually stored and maintained in that file, +one agenda file per line. In this file paths can be given relative to +`org-directory'. Tilde expansion and environment variable substitution +are also made. + +Entries may be added to this list with `\\[org-agenda-file-to-front]' +and removed with `\\[org-remove-file]'." + :group 'org-agenda + :type '(choice + (repeat :tag "List of files and directories" file) + (file :tag "Store list in a file\n" :value "~/.agenda_files"))) + +(defcustom org-agenda-file-regexp "\\`[^.].*\\.org\\'" + "Regular expression to match files for `org-agenda-files'. +If any element in the list in that variable contains a directory instead +of a normal file, all files in that directory that are matched by this +regular expression will be included." + :group 'org-agenda + :type 'regexp) + +(defvaralias 'org-agenda-multi-occur-extra-files + 'org-agenda-text-search-extra-files) + +(defcustom org-agenda-text-search-extra-files nil + "List of extra files to be searched by text search commands. +These files will be searched in addition to the agenda files by the +commands `org-search-view' (`\\[org-agenda] s') \ +and `org-occur-in-agenda-files'. +Note that these files will only be searched for text search commands, +not for the other agenda views like todo lists, tag searches or the weekly +agenda. This variable is intended to list notes and possibly archive files +that should also be searched by these two commands. +In fact, if the first element in the list is the symbol `agenda-archives', +then all archive files of all agenda files will be added to the search +scope." + :group 'org-agenda + :type '(set :greedy t + (const :tag "Agenda Archives" agenda-archives) + (repeat :inline t (file)))) + +(defcustom org-agenda-skip-unavailable-files nil + "Non-nil means to just skip non-reachable files in `org-agenda-files'. +A nil value means to remove them, after a query, from the list." + :group 'org-agenda + :type 'boolean) + +(defgroup org-latex nil + "Options for embedding LaTeX code into Org mode." + :tag "Org LaTeX" + :group 'org) + +(defcustom org-format-latex-options + '(:foreground default :background default :scale 1.0 + :html-foreground "Black" :html-background "Transparent" + :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) + "Options for creating images from LaTeX fragments. +This is a property list with the following properties: +:foreground the foreground color for images embedded in Emacs, e.g. \"Black\". + `default' means use the foreground of the default face. + `auto' means use the foreground from the text face. +:background the background color, or \"Transparent\". + `default' means use the background of the default face. + `auto' means use the background from the text face. +:scale a scaling factor for the size of the images, to get more pixels +:html-foreground, :html-background, :html-scale + the same numbers for HTML export. +:matchers a list indicating which matchers should be used to + find LaTeX fragments. Valid members of this list are: + \"begin\" find environments + \"$1\" find single characters surrounded by $.$ + \"$\" find math expressions surrounded by $...$ + \"$$\" find math expressions surrounded by $$....$$ + \"\\(\" find math expressions surrounded by \\(...\\) + \"\\=\\[\" find math expressions surrounded by \\=\\[...\\]" + :group 'org-latex + :type 'plist) + +(defcustom org-format-latex-signal-error t + "Non-nil means signal an error when image creation of LaTeX snippets fails. +When nil, just push out a message." + :group 'org-latex + :version "24.1" + :type 'boolean) + +(defcustom org-latex-to-mathml-jar-file nil + "Value of\"%j\" in `org-latex-to-mathml-convert-command'. +Use this to specify additional executable file say a jar file. + +When using MathToWeb as the converter, specify the full-path to +your mathtoweb.jar file." + :group 'org-latex + :version "24.1" + :type '(choice + (const :tag "None" nil) + (file :tag "JAR file" :must-match t))) + +(defcustom org-latex-to-mathml-convert-command nil + "Command to convert LaTeX fragments to MathML. +Replace format-specifiers in the command as noted below and use +`shell-command' to convert LaTeX to MathML. +%j: Executable file in fully expanded form as specified by + `org-latex-to-mathml-jar-file'. +%I: Input LaTeX file in fully expanded form. +%i: The latex fragment to be converted. +%o: Output MathML file. + +This command is used by `org-create-math-formula'. + +When using MathToWeb as the converter, set this option to +\"java -jar %j -unicode -force -df %o %I\". + +When using LaTeXML set this option to +\"latexmlmath \"%i\" --presentationmathml=%o\"." + :group 'org-latex + :version "24.1" + :type '(choice + (const :tag "None" nil) + (string :tag "\nShell command"))) + +(defcustom org-latex-to-html-convert-command nil + "Command to convert LaTeX fragments to HTML. +This command is very open-ended: the output of the command will +directly replace the LaTeX fragment in the resulting HTML. +Replace format-specifiers in the command as noted below and use +`shell-command' to convert LaTeX to HTML. +%i: The LaTeX fragment to be converted. + +For example, this could be used with LaTeXML as +\"latexmlc 'literal:%i' --profile=math --preload=siunitx.sty 2>/dev/null\"." + :group 'org-latex + :package-version '(Org . "9.4") + :type '(choice + (const :tag "None" nil) + (string :tag "Shell command"))) + +(defcustom org-preview-latex-default-process 'dvipng + "The default process to convert LaTeX fragments to image files. +All available processes and theirs documents can be found in +`org-preview-latex-process-alist', which see." + :group 'org-latex + :version "26.1" + :package-version '(Org . "9.0") + :type 'symbol) + +(defcustom org-preview-latex-process-alist + '((dvipng + :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 ("latex -interaction nonstopmode -output-directory %o %f") + :image-converter ("dvipng -D %D -T tight -bg Transparent -o %O %f")) + (dvisvgm + :programs ("latex" "dvisvgm") + :description "dvi > svg" + :message "you need to install the programs: latex and dvisvgm." + :image-input-type "dvi" + :image-output-type "svg" + :image-size-adjust (1.7 . 1.5) + :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") + :image-converter ("dvisvgm %f -n -b min -c %S -o %O")) + (imagemagick + :programs ("latex" "convert") + :description "pdf > png" + :message "you need to install the programs: latex and imagemagick." + :image-input-type "pdf" + :image-output-type "png" + :image-size-adjust (1.0 . 1.0) + :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f") + :image-converter + ("convert -density %D -trim -antialias %f -quality 100 %O"))) + "Definitions of external processes for LaTeX previewing. +Org mode can use some external commands to generate TeX snippet's images for +previewing or inserting into HTML files, e.g., \"dvipng\". This variable tells +`org-create-formula-image' how to call them. + +The value is an alist with the pattern (NAME . PROPERTIES). NAME is a symbol. +PROPERTIES accepts the following attributes: + + :programs list of strings, required programs. + :description string, describe the process. + :message string, message it when required programs cannot be found. + :image-input-type string, input file type of image converter (e.g., \"dvi\"). + :image-output-type string, output file type of image converter (e.g., \"png\"). + :image-size-adjust cons of numbers, the car element is used to adjust LaTeX + image size showed in buffer and the cdr element is for + HTML file. This option is only useful for process + developers, users should use variable + `org-format-latex-options' instead. + :post-clean list of strings, files matched are to be cleaned up once + the image is generated. When nil, the files with \".dvi\", + \".xdv\", \".pdf\", \".tex\", \".aux\", \".log\", \".svg\", + \".png\", \".jpg\", \".jpeg\" or \".out\" extension will + be cleaned up. + :latex-header list of strings, the LaTeX header of the snippet file. + When nil, the fallback value is used instead, which is + controlled by `org-format-latex-header', + `org-latex-default-packages-alist' and + `org-latex-packages-alist', which see. + :latex-compiler list of LaTeX commands, as strings. Each of them is given + to the shell. Place-holders \"%t\", \"%b\" and \"%o\" are + replaced with values defined below. + :image-converter list of image converter commands strings. Each of them is + given to the shell and supports any of the following + place-holders defined below. + +Place-holders used by `:image-converter' and `:latex-compiler': + + %f input file name + %b base name of input file + %o base directory of input file + %O absolute output file name + +Place-holders only used by `:image-converter': + + %D dpi, which is used to adjust image size by some processing commands. + %S the image size scale ratio, which is used to adjust image size by some + processing commands." + :group 'org-latex + :version "26.1" + :package-version '(Org . "9.0") + :type '(alist :tag "LaTeX to image backends" + :value-type (plist))) + +(defcustom org-preview-latex-image-directory "ltximg/" + "Path to store latex preview images. +A relative path here creates many directories relative to the +processed Org files paths. An absolute path puts all preview +images at the same place." + :group 'org-latex + :version "26.1" + :package-version '(Org . "9.0") + :type 'string) + +(defun org-format-latex-mathml-available-p () + "Return t if `org-latex-to-mathml-convert-command' is usable." + (save-match-data + (when (and (boundp 'org-latex-to-mathml-convert-command) + org-latex-to-mathml-convert-command) + (let ((executable (car (split-string + org-latex-to-mathml-convert-command)))) + (when (executable-find executable) + (if (string-match + "%j" org-latex-to-mathml-convert-command) + (file-readable-p org-latex-to-mathml-jar-file) + t)))))) + +(defcustom org-format-latex-header "\\documentclass{article} +\\usepackage[usenames]{color} +\[PACKAGES] +\[DEFAULT-PACKAGES] +\\pagestyle{empty} % do not remove +% The settings below are copied from fullpage.sty +\\setlength{\\textwidth}{\\paperwidth} +\\addtolength{\\textwidth}{-3cm} +\\setlength{\\oddsidemargin}{1.5cm} +\\addtolength{\\oddsidemargin}{-2.54cm} +\\setlength{\\evensidemargin}{\\oddsidemargin} +\\setlength{\\textheight}{\\paperheight} +\\addtolength{\\textheight}{-\\headheight} +\\addtolength{\\textheight}{-\\headsep} +\\addtolength{\\textheight}{-\\footskip} +\\addtolength{\\textheight}{-3cm} +\\setlength{\\topmargin}{1.5cm} +\\addtolength{\\topmargin}{-2.54cm}" + "The document header used for processing LaTeX fragments. +It is imperative that this header make sure that no page number +appears on the page. The package defined in the variables +`org-latex-default-packages-alist' and `org-latex-packages-alist' +will either replace the placeholder \"[PACKAGES]\" in this +header, or they will be appended." + :group 'org-latex + :type 'string) + +(defun org-set-packages-alist (var val) + "Set the packages alist and make sure it has 3 elements per entry." + (set var (mapcar (lambda (x) + (if (and (consp x) (= (length x) 2)) + (list (car x) (nth 1 x) t) + x)) + val))) + +(defun org-get-packages-alist (var) + "Get the packages alist and make sure it has 3 elements per entry." + (mapcar (lambda (x) + (if (and (consp x) (= (length x) 2)) + (list (car x) (nth 1 x) t) + x)) + (default-value var))) + +(defcustom org-latex-default-packages-alist + '(("AUTO" "inputenc" t ("pdflatex")) + ("T1" "fontenc" t ("pdflatex")) + ("" "graphicx" t) + ("" "longtable" nil) + ("" "wrapfig" nil) + ("" "rotating" nil) + ("normalem" "ulem" t) + ("" "amsmath" t) + ("" "amssymb" t) + ("" "capt-of" nil) + ("" "hyperref" nil)) + "Alist of default packages to be inserted in the header. + +Change this only if one of the packages here causes an +incompatibility with another package you are using. + +The packages in this list are needed by one part or another of +Org mode to function properly: + +- inputenc, fontenc: for basic font and character selection +- graphicx: for including images +- longtable: For multipage tables +- wrapfig: for figure placement +- rotating: for sideways figures and tables +- ulem: for underline and strike-through +- amsmath: for subscript and superscript and math environments +- amssymb: for various symbols used for interpreting the entities + in `org-entities'. You can skip some of this package if you don't + use any of the symbols. +- capt-of: for captions outside of floats +- hyperref: for cross references + +Therefore you should not modify this variable unless you know +what you are doing. The one reason to change it anyway is that +you might be loading some other package that conflicts with one +of the default packages. Each element is either a cell or +a string. + +A cell is of the format + + (\"options\" \"package\" SNIPPET-FLAG COMPILERS) + +If SNIPPET-FLAG is non-nil, the package also needs to be included +when compiling LaTeX snippets into images for inclusion into +non-LaTeX output. + +COMPILERS is a list of compilers that should include the package, +see `org-latex-compiler'. If the document compiler is not in the +list, and the list is non-nil, the package will not be inserted +in the final document. + +A string will be inserted as-is in the header of the document." + :group 'org-latex + :group 'org-export-latex + :set 'org-set-packages-alist + :get 'org-get-packages-alist + :version "26.1" + :package-version '(Org . "8.3") + :type '(repeat + (choice + (list :tag "options/package pair" + (string :tag "options") + (string :tag "package") + (boolean :tag "Snippet") + (choice + (const :tag "For all compilers" nil) + (repeat :tag "Allowed compiler" string))) + (string :tag "A line of LaTeX")))) + +(defcustom org-latex-packages-alist nil + "Alist of packages to be inserted in every LaTeX header. + +These will be inserted after `org-latex-default-packages-alist'. +Each element is either a cell or a string. + +A cell is of the format: + + (\"options\" \"package\" SNIPPET-FLAG COMPILERS) + +SNIPPET-FLAG, when non-nil, indicates that this package is also +needed when turning LaTeX snippets into images for inclusion into +non-LaTeX output. + +COMPILERS is a list of compilers that should include the package, +see `org-latex-compiler'. If the document compiler is not in the +list, and the list is non-nil, the package will not be inserted +in the final document. + +A string will be inserted as-is in the header of the document. + +Make sure that you only list packages here which: + + - you want in every file; + - do not conflict with the setup in `org-format-latex-header'; + - do not conflict with the default packages in + `org-latex-default-packages-alist'." + :group 'org-latex + :group 'org-export-latex + :set 'org-set-packages-alist + :get 'org-get-packages-alist + :type '(repeat + (choice + (list :tag "options/package pair" + (string :tag "options") + (string :tag "package") + (boolean :tag "Snippet")) + (string :tag "A line of LaTeX")))) + +(defgroup org-appearance nil + "Settings for Org mode appearance." + :tag "Org Appearance" + :group 'org) + +(defcustom org-level-color-stars-only nil + "Non-nil means fontify only the stars in each headline. +When nil, the entire headline is fontified. +Changing it requires restart of `font-lock-mode' to become effective +also in regions already fontified." + :group 'org-appearance + :type 'boolean) + +(defcustom org-hide-leading-stars nil + "Non-nil means hide the first N-1 stars in a headline. +This works by using the face `org-hide' for these stars. This +face is white for a light background, and black for a dark +background. You may have to customize the face `org-hide' to +make this work. +Changing it requires restart of `font-lock-mode' to become effective +also in regions already fontified. +You may also set this on a per-file basis by adding one of the following +lines to the buffer: + + #+STARTUP: hidestars + #+STARTUP: showstars" + :group 'org-appearance + :type 'boolean) + +(defcustom org-hidden-keywords nil + "List of symbols corresponding to keywords to be hidden in the Org buffer. +For example, a value \\='(title) for this list makes the document's title +appear in the buffer without the initial \"#+TITLE:\" part." + :group 'org-appearance + :package-version '(Org . "9.5") + :type '(set (const :tag "#+AUTHOR" author) + (const :tag "#+DATE" date) + (const :tag "#+EMAIL" email) + (const :tag "#+SUBTITLE" subtitle) + (const :tag "#+TITLE" title))) + +(defcustom org-custom-properties nil + "List of properties (as strings) with a special meaning. +The default use of these custom properties is to let the user +hide them with `org-toggle-custom-properties-visibility'." + :group 'org-properties + :group 'org-appearance + :version "24.3" + :type '(repeat (string :tag "Property Name"))) + +(defcustom org-fontify-todo-headline nil + "Non-nil means change the face of a headline if it is marked as TODO. +Normally, only the TODO/DONE keyword indicates the state of a headline. +When this is non-nil, the headline after the keyword is set to the +`org-headline-todo' as an additional indication." + :group 'org-appearance + :package-version '(Org . "9.4") + :type 'boolean + :safe #'booleanp) + +(defcustom org-fontify-done-headline t + "Non-nil means change the face of a headline if it is marked DONE. +Normally, only the TODO/DONE keyword indicates the state of a headline. +When this is non-nil, the headline after the keyword is set to the +`org-headline-done' as an additional indication." + :group 'org-appearance + :package-version '(Org . "9.4") + :type 'boolean) + +(defcustom org-fontify-emphasized-text t + "Non-nil means fontify *bold*, /italic/ and _underlined_ text. +Changing this variable requires a restart of Emacs to take effect." + :group 'org-appearance + :type 'boolean) + +(defcustom org-fontify-whole-heading-line nil + "Non-nil means fontify the whole line for headings. +This is useful when setting a background color for the +org-level-* faces." + :group 'org-appearance + :type 'boolean) + +(defcustom org-fontify-whole-block-delimiter-line t + "Non-nil means fontify the whole line for begin/end lines of blocks. +This is useful when setting a background color for the +org-block-begin-line and org-block-end-line faces." + :group 'org-appearance + :type 'boolean) + +(defcustom org-highlight-latex-and-related nil + "Non-nil means highlight LaTeX related syntax in the buffer. +When non-nil, the value should be a list containing any of the +following symbols: + `native' Highlight LaTeX snippets and environments natively. + `latex' Highlight LaTeX snippets and environments. + `script' Highlight subscript and superscript. + `entities' Highlight entities." + :group 'org-appearance + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "No highlighting" nil) + (set :greedy t :tag "Highlight" + (const :tag "LaTeX snippets and environments (native)" native) + (const :tag "LaTeX snippets and environments" latex) + (const :tag "Subscript and superscript" script) + (const :tag "Entities" entities)))) + +(defcustom org-hide-emphasis-markers nil + "Non-nil mean font-lock should hide the emphasis marker characters." + :group 'org-appearance + :type 'boolean + :safe #'booleanp) + +(defcustom org-hide-macro-markers nil + "Non-nil mean font-lock should hide the brackets marking macro calls." + :group 'org-appearance + :type 'boolean) + +(defcustom org-pretty-entities nil + "Non-nil means show entities as UTF8 characters. +When nil, the \\name form remains in the buffer." + :group 'org-appearance + :version "24.1" + :type 'boolean) + +(defcustom org-pretty-entities-include-sub-superscripts t + "Non-nil means, pretty entity display includes formatting sub/superscripts." + :group 'org-appearance + :version "24.1" + :type 'boolean) + +(defvar org-emph-re nil + "Regular expression for matching emphasis. +After a match, the match groups contain these elements: +0 The match of the full regular expression, including the characters + before and after the proper match +1 The character before the proper match, or empty at beginning of line +2 The proper match, including the leading and trailing markers +3 The leading marker like * or /, indicating the type of highlighting +4 The text between the emphasis markers, not including the markers +5 The character after the match, empty at the end of a line") + +(defvar org-verbatim-re nil + "Regular expression for matching verbatim text.") + +(defvar org-emphasis-regexp-components) ; defined just below +(defvar org-emphasis-alist) ; defined just below +(defun org-set-emph-re (var val) + "Set variable and compute the emphasis regular expression." + (set var val) + (when (and (boundp 'org-emphasis-alist) + (boundp 'org-emphasis-regexp-components) + org-emphasis-alist org-emphasis-regexp-components) + (pcase-let* + ((`(,pre ,post ,border ,body ,nl) org-emphasis-regexp-components) + (body (if (<= nl 0) body + (format "%s*?\\(?:\n%s*?\\)\\{0,%d\\}" body body nl))) + (template + (format (concat "\\([%s]\\|^\\)" ;before markers + "\\(\\([%%s]\\)\\([^%s]\\|[^%s]%s[^%s]\\)\\3\\)" + "\\([%s]\\|$\\)") ;after markers + pre border border body border post))) + (setq org-emph-re (format template "*/_+")) + (setq org-verbatim-re (format template "=~"))))) + +;; This used to be a defcustom (Org <8.0) but allowing the users to +;; set this option proved cumbersome. See this message/thread: +;; https://orgmode.org/list/B72CDC2B-72F6-43A8-AC70-E6E6295766EC@gmail.com +(defvar org-emphasis-regexp-components + '("-[:space:]('\"{" "-[:space:].,:!?;'\")}\\[" "[:space:]" "." 1) + "Components used to build the regular expression for emphasis. +This is a list with five entries. Terminology: In an emphasis string +like \" *strong word* \", we call the initial space PREMATCH, the final +space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters +and \"trong wor\" is the body. The different components in this variable +specify what is allowed/forbidden in each part: + +pre Chars allowed as prematch. Beginning of line will be allowed too. +post Chars allowed as postmatch. End of line will be allowed too. +border The chars *forbidden* as border characters. +body-regexp A regexp like \".\" to match a body character. Don't use + non-shy groups here, and don't allow newline here. +newline The maximum number of newlines allowed in an emphasis exp. + +You need to reload Org or to restart Emacs after setting this.") + +(defcustom org-emphasis-alist + '(("*" bold) + ("/" italic) + ("_" underline) + ("=" org-verbatim verbatim) + ("~" org-code verbatim) + ("+" (:strike-through t))) + "Alist of characters and faces to emphasize text. +Text starting and ending with a special character will be emphasized, +for example *bold*, _underlined_ and /italic/. This variable sets the +marker characters and the face to be used by font-lock for highlighting +in Org buffers. + +You need to reload Org or to restart Emacs after customizing this." + :group 'org-appearance + :set 'org-set-emph-re + :version "24.4" + :package-version '(Org . "8.0") + :type '(repeat + (list + (string :tag "Marker character") + (choice + (face :tag "Font-lock-face") + (plist :tag "Face property list")) + (option (const verbatim))))) + +(defvar org-protecting-blocks '("src" "example" "export") + "Blocks that contain text that is quoted, i.e. not processed as Org syntax. +This is needed for font-lock setup.") + +;;; Functions and variables from their packages +;; Declared here to avoid compiler warnings +(defvar mark-active) + +;; Various packages +(declare-function calc-eval "calc" (str &optional separator &rest args)) +(declare-function calendar-forward-day "cal-move" (arg)) +(declare-function calendar-goto-date "cal-move" (date)) +(declare-function calendar-goto-today "cal-move" ()) +(declare-function calendar-iso-from-absolute "cal-iso" (date)) +(declare-function calendar-iso-to-absolute "cal-iso" (date)) +(declare-function cdlatex-compute-tables "ext:cdlatex" ()) +(declare-function cdlatex-tab "ext:cdlatex" ()) +(declare-function dired-get-filename + "dired" + (&optional localp no-error-if-not-filep)) +(declare-function iswitchb-read-buffer + "iswitchb" + (prompt &optional + default require-match _predicate start matches-set)) +(declare-function org-agenda-change-all-lines + "org-agenda" + (newhead hdmarker &optional fixface just-this)) +(declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item + "org-agenda" + (&optional end)) +(declare-function org-agenda-copy-local-variable "org-agenda" (var)) +(declare-function org-agenda-format-item + "org-agenda" + (extra txt &optional level category tags dotime + remove-re habitp)) +(declare-function org-agenda-new-marker "org-agenda" (&optional pos)) +(declare-function org-agenda-save-markers-for-cut-and-paste + "org-agenda" + (beg end)) +(declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type)) +(declare-function org-agenda-skip "org-agenda" ()) +(declare-function org-attach-expand "org-attach" (file)) +(declare-function org-attach-reveal "org-attach" ()) +(declare-function org-attach-reveal-in-emacs "org-attach" ()) +(declare-function org-gnus-follow-link "org-gnus" (&optional group article)) +(declare-function org-indent-mode "org-indent" (&optional arg)) +(declare-function org-inlinetask-goto-beginning "org-inlinetask" ()) +(declare-function org-inlinetask-goto-end "org-inlinetask" ()) +(declare-function org-inlinetask-in-task-p "org-inlinetask" ()) +(declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) +(declare-function parse-time-string "parse-time" (string)) + +(defvar align-mode-rules-list) +(defvar calc-embedded-close-formula) +(defvar calc-embedded-open-formula) +(defvar calc-embedded-open-mode) +(defvar font-lock-unfontify-region-function) +(defvar iswitchb-temp-buflist) +(defvar org-agenda-tags-todo-honor-ignore-options) +(defvar remember-data-file) +(defvar texmathp-why) + +(declare-function org-clock-save-markers-for-cut-and-paste "org-clock" (beg end)) +(declare-function org-clock-update-mode-line "org-clock" (&optional refresh)) +(declare-function org-resolve-clocks "org-clock" + (&optional also-non-dangling-p prompt last-valid)) + +(defvar org-clock-start-time) +(defvar org-clock-marker (make-marker) + "Marker recording the last clock-in.") +(defvar org-clock-hd-marker (make-marker) + "Marker recording the last clock-in, but the headline position.") +(defvar org-clock-heading "" + "The heading of the current clock entry.") +(defun org-clocking-buffer () + "Return the buffer where the clock is currently running. +Return nil if no clock is running." + (marker-buffer org-clock-marker)) +(defalias 'org-clock-is-active #'org-clocking-buffer) + +(defun org-check-running-clock () + "Check if the current buffer contains the running clock. +If yes, offer to stop it and to save the buffer with the changes." + (when (and (equal (marker-buffer org-clock-marker) (current-buffer)) + (y-or-n-p (format "Clock-out in buffer %s before killing it? " + (buffer-name)))) + (org-clock-out) + (when (y-or-n-p "Save changed buffer?") + (save-buffer)))) + +(defun org-clocktable-try-shift (dir n) + "Check if this line starts a clock table, if yes, shift the time block." + (when (org-match-line "^[ \t]*#\\+BEGIN:[ \t]+clocktable\\>") + (org-clocktable-shift dir n))) + +;;;###autoload +(defun org-clock-persistence-insinuate () + "Set up hooks for clock persistence." + (require 'org-clock) + (add-hook 'org-mode-hook 'org-clock-load) + (add-hook 'kill-emacs-hook 'org-clock-save)) + +(defun org-clock-auto-clockout-insinuate () + "Set up hook for auto clocking out when Emacs is idle. +See `org-clock-auto-clockout-timer'. + +This function is meant to be added to the user configuration." + (require 'org-clock) + (add-hook 'org-clock-in-hook #'org-clock-auto-clockout t)) + +(defgroup org-archive nil + "Options concerning archiving in Org mode." + :tag "Org Archive" + :group 'org-structure) + +(defcustom org-archive-location "%s_archive::" + "The location where subtrees should be archived. + +The value of this variable is a string, consisting of two parts, +separated by a double-colon. The first part is a filename and +the second part is a headline. + +When the filename is omitted, archiving happens in the same file. +%s in the filename will be replaced by the current file +name (without the directory part). Archiving to a different file +is useful to keep archived entries from contributing to the +Org Agenda. + +The archived entries will be filed as subtrees of the specified +headline. When the headline is omitted, the subtrees are simply +filed away at the end of the file, as top-level entries. Also in +the heading you can use %s to represent the file name, this can be +useful when using the same archive for a number of different files. + +Here are a few examples: +\"%s_archive::\" + If the current file is Projects.org, archive in file + Projects.org_archive, as top-level trees. This is the default. + +\"::* Archived Tasks\" + Archive in the current file, under the top-level headline + \"* Archived Tasks\". + +\"~/org/archive.org::\" + Archive in file ~/org/archive.org (absolute path), as top-level trees. + +\"~/org/archive.org::* From %s\" + Archive in file ~/org/archive.org (absolute path), under headlines + \"From FILENAME\" where file name is the current file name. + +\"~/org/datetree.org::datetree/* Finished Tasks\" + The \"datetree/\" string is special, signifying to archive + items to the datetree. Items are placed in either the CLOSED + date of the item, or the current date if there is no CLOSED date. + The heading will be a subentry to the current date. There doesn't + need to be a heading, but there always needs to be a slash after + datetree. For example, to store archived items directly in the + datetree, use \"~/org/datetree.org::datetree/\". + +\"basement::** Finished Tasks\" + Archive in file ./basement (relative path), as level 3 trees + below the level 2 heading \"** Finished Tasks\". + +You may define it locally by setting an ARCHIVE property. If +such a property is found in the file or in an entry, and anywhere +up the hierarchy, it will be used. + +You can also set it for the whole file using the keyword-syntax: + +#+ARCHIVE: basement::** Finished Tasks" + :group 'org-archive + :type 'string) + +(defcustom org-agenda-skip-archived-trees t + "Non-nil means the agenda will skip any items located in archived trees. +An archived tree is a tree marked with the tag ARCHIVE. The use of this +variable is no longer recommended, you should leave it at the value t. +Instead, use the key `v' to cycle the archives-mode in the agenda." + :group 'org-archive + :group 'org-agenda-skip + :type 'boolean) + +(defcustom org-columns-skip-archived-trees t + "Non-nil means ignore archived trees when creating column view." + :group 'org-archive + :group 'org-properties + :type 'boolean) + +(defcustom org-cycle-open-archived-trees nil + "Non-nil means `org-cycle' will open archived trees. +An archived tree is a tree marked with the tag ARCHIVE. +When nil, archived trees will stay folded. You can still open them with +normal outline commands like `show-all', but not with the cycling commands." + :group 'org-archive + :group 'org-cycle + :type 'boolean) + +(defcustom org-sparse-tree-open-archived-trees nil + "Non-nil means sparse tree construction shows matches in archived trees. +When nil, matches in these trees are highlighted, but the trees are kept in +collapsed state." + :group 'org-archive + :group 'org-sparse-trees + :type 'boolean) + +(defcustom org-sparse-tree-default-date-type nil + "The default date type when building a sparse tree. +When this is nil, a date is a scheduled or a deadline timestamp. +Otherwise, these types are allowed: + + all: all timestamps + active: only active timestamps (<...>) + inactive: only inactive timestamps ([...]) + scheduled: only scheduled timestamps + deadline: only deadline timestamps" + :type '(choice (const :tag "Scheduled or deadline" nil) + (const :tag "All timestamps" all) + (const :tag "Only active timestamps" active) + (const :tag "Only inactive timestamps" inactive) + (const :tag "Only scheduled timestamps" scheduled) + (const :tag "Only deadline timestamps" deadline) + (const :tag "Only closed timestamps" closed)) + :version "26.1" + :package-version '(Org . "8.3") + :group 'org-sparse-trees) + +(defun org-cycle-hide-archived-subtrees (state) + "Re-hide all archived subtrees after a visibility state change. +STATE should be one of the symbols listed in the docstring of +`org-cycle-hook'." + (when (and (not org-cycle-open-archived-trees) + (not (memq state '(overview folded)))) + (save-excursion + (let* ((globalp (memq state '(contents all))) + (beg (if globalp (point-min) (point))) + (end (if globalp (point-max) (org-end-of-subtree t)))) + (org-hide-archived-subtrees beg end) + (goto-char beg) + (when (looking-at-p (concat ".*:" org-archive-tag ":")) + (message "%s" (substitute-command-keys + "Subtree is archived and stays closed. Use \ +`\\[org-force-cycle-archived]' to cycle it anyway."))))))) + +(defun org-force-cycle-archived () + "Cycle subtree even if it is archived." + (interactive) + (setq this-command 'org-cycle) + (let ((org-cycle-open-archived-trees t)) + (call-interactively 'org-cycle))) + +(defun org-hide-archived-subtrees (beg end) + "Re-hide all archived subtrees after a visibility state change." + (org-with-wide-buffer + (let ((case-fold-search nil) + (re (concat org-outline-regexp-bol ".*:" org-archive-tag ":"))) + (goto-char beg) + ;; Include headline point is currently on. + (beginning-of-line) + (while (and (< (point) end) (re-search-forward re end t)) + (when (member org-archive-tag (org-get-tags nil t)) + (org-flag-subtree t) + (org-end-of-subtree t)))))) + +(defun org-flag-subtree (flag) + (save-excursion + (org-back-to-heading t) + (org-flag-region (line-end-position) + (progn (org-end-of-subtree t) (point)) + flag + 'outline))) + +(defalias 'org-advertized-archive-subtree 'org-archive-subtree) + +;; Declare Column View Code + +(declare-function org-columns-get-format-and-top-level "org-colview" ()) +(declare-function org-columns-compute "org-colview" (property)) + +;; Declare ID code + +(declare-function org-id-store-link "org-id") +(declare-function org-id-locations-load "org-id") +(declare-function org-id-locations-save "org-id") +(defvar org-id-track-globally) + +;;; Variables for pre-computed regular expressions, all buffer local + +(defvar-local org-todo-regexp nil + "Matches any of the TODO state keywords. +Since TODO keywords are case-sensitive, `case-fold-search' is +expected to be bound to nil when matching against this regexp.") + +(defvar-local org-not-done-regexp nil + "Matches any of the TODO state keywords except the last one. +Since TODO keywords are case-sensitive, `case-fold-search' is +expected to be bound to nil when matching against this regexp.") + +(defvar-local org-not-done-heading-regexp nil + "Matches a TODO headline that is not done. +Since TODO keywords are case-sensitive, `case-fold-search' is +expected to be bound to nil when matching against this regexp.") + +(defvar-local org-todo-line-regexp nil + "Matches a headline and puts TODO state into group 2 if present. +Since TODO keywords are case-sensitive, `case-fold-search' is +expected to be bound to nil when matching against this regexp.") + +(defvar-local org-complex-heading-regexp nil + "Matches a headline and puts everything into groups: + +group 1: Stars +group 2: The TODO keyword, maybe +group 3: Priority cookie +group 4: True headline +group 5: Tags + +Since TODO keywords are case-sensitive, `case-fold-search' is +expected to be bound to nil when matching against this regexp.") + +(defvar-local org-complex-heading-regexp-format nil + "Printf format to make regexp to match an exact headline. +This regexp will match the headline of any node which has the +exact headline text that is put into the format, but may have any +TODO state, priority and tags.") + +(defvar-local org-todo-line-tags-regexp nil + "Matches a headline and puts TODO state into group 2 if present. +Also put tags into group 4 if tags are present.") + +(defconst org-plain-time-of-day-regexp + (concat + "\\(\\<[012]?[0-9]" + "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)" + "\\(--?" + "\\(\\<[012]?[0-9]" + "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)" + "\\)?") + "Regular expression to match a plain time or time range. +Examples: 11:45 or 8am-13:15 or 2:45-2:45pm. After a match, the following +groups carry important information: +0 the full match +1 the first time, range or not +8 the second time, if it is a range.") + +(defconst org-plain-time-extension-regexp + (concat + "\\(\\<[012]?[0-9]" + "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)" + "\\+\\([0-9]+\\)\\(:\\([0-5][0-9]\\)\\)?") + "Regular expression to match a time range like 13:30+2:10 = 13:30-15:40. +Examples: 11:45 or 8am-13:15 or 2:45-2:45pm. After a match, the following +groups carry important information: +0 the full match +7 hours of duration +9 minutes of duration") + +(defconst org-stamp-time-of-day-regexp + (concat + "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)" + "\\([012][0-9]:[0-5][0-9]\\)\\(-\\([012][0-9]:[0-5][0-9]\\)\\)?[^\n\r>]*?>" + "\\(--?" + "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?") + "Regular expression to match a timestamp time or time range. +After a match, the following groups carry important information: +0 the full match +1 date plus weekday, for back referencing to make sure + both times are on the same day +2 the first time, range or not +4 the second time, if it is a range.") + +(defconst org-startup-options + '(("fold" org-startup-folded t) + ("overview" org-startup-folded t) + ("nofold" org-startup-folded nil) + ("showall" org-startup-folded nil) + ("show2levels" org-startup-folded show2levels) + ("show3levels" org-startup-folded show3levels) + ("show4levels" org-startup-folded show4levels) + ("show5levels" org-startup-folded show5levels) + ("showeverything" org-startup-folded showeverything) + ("content" org-startup-folded content) + ("indent" org-startup-indented t) + ("noindent" org-startup-indented nil) + ("num" org-startup-numerated t) + ("nonum" org-startup-numerated nil) + ("hidestars" org-hide-leading-stars t) + ("showstars" org-hide-leading-stars nil) + ("odd" org-odd-levels-only t) + ("oddeven" org-odd-levels-only nil) + ("align" org-startup-align-all-tables t) + ("noalign" org-startup-align-all-tables nil) + ("shrink" org-startup-shrink-all-tables t) + ("inlineimages" org-startup-with-inline-images t) + ("noinlineimages" org-startup-with-inline-images nil) + ("latexpreview" org-startup-with-latex-preview t) + ("nolatexpreview" org-startup-with-latex-preview nil) + ("customtime" org-display-custom-times t) + ("logdone" org-log-done time) + ("lognotedone" org-log-done note) + ("nologdone" org-log-done nil) + ("lognoteclock-out" org-log-note-clock-out t) + ("nolognoteclock-out" org-log-note-clock-out nil) + ("logrepeat" org-log-repeat state) + ("lognoterepeat" org-log-repeat note) + ("logdrawer" org-log-into-drawer t) + ("nologdrawer" org-log-into-drawer nil) + ("logstatesreversed" org-log-states-order-reversed t) + ("nologstatesreversed" org-log-states-order-reversed nil) + ("nologrepeat" org-log-repeat nil) + ("logreschedule" org-log-reschedule time) + ("lognotereschedule" org-log-reschedule note) + ("nologreschedule" org-log-reschedule nil) + ("logredeadline" org-log-redeadline time) + ("lognoteredeadline" org-log-redeadline note) + ("nologredeadline" org-log-redeadline nil) + ("logrefile" org-log-refile time) + ("lognoterefile" org-log-refile note) + ("nologrefile" org-log-refile nil) + ("fninline" org-footnote-define-inline t) + ("nofninline" org-footnote-define-inline nil) + ("fnlocal" org-footnote-section nil) + ("fnauto" org-footnote-auto-label t) + ("fnprompt" org-footnote-auto-label nil) + ("fnconfirm" org-footnote-auto-label confirm) + ("fnplain" org-footnote-auto-label plain) + ("fnadjust" org-footnote-auto-adjust t) + ("nofnadjust" org-footnote-auto-adjust nil) + ("constcgs" constants-unit-system cgs) + ("constSI" constants-unit-system SI) + ("noptag" org-tag-persistent-alist nil) + ("hideblocks" org-hide-block-startup t) + ("nohideblocks" org-hide-block-startup nil) + ("beamer" org-startup-with-beamer-mode t) + ("entitiespretty" org-pretty-entities t) + ("entitiesplain" org-pretty-entities nil)) + "Variable associated with STARTUP options for Org. +Each element is a list of three items: the startup options (as written +in the #+STARTUP line), the corresponding variable, and the value to set +this variable to if the option is found. An optional fourth element PUSH +means to push this value onto the list in the variable.") + +(defcustom org-group-tags t + "When non-nil (the default), use group tags. +This can be turned on/off through `org-toggle-tags-groups'." + :group 'org-tags + :group 'org-startup + :type 'boolean) + +(defvar org-inhibit-startup nil) ; Dynamically-scoped param. + +(defun org-toggle-tags-groups () + "Toggle support for group tags. +Support for group tags is controlled by the option +`org-group-tags', which is non-nil by default." + (interactive) + (setq org-group-tags (not org-group-tags)) + (cond ((and (derived-mode-p 'org-agenda-mode) + org-group-tags) + (org-agenda-redo)) + ((derived-mode-p 'org-mode) + (let ((org-inhibit-startup t)) (org-mode)))) + (message "Groups tags support has been turned %s" + (if org-group-tags "on" "off"))) + +(defun org--tag-add-to-alist (alist1 alist2) + "Merge tags from ALIST1 into ALIST2. + +Duplicates tags outside a group are removed. Keywords and order +are preserved. + +The function assumes ALIST1 and ALIST2 are proper tag alists. +See `org-tag-alist' for their structure." + (cond + ((null alist2) alist1) + ((null alist1) alist2) + (t + (let ((to-add nil) + (group-flag nil)) + (dolist (tag-pair alist1) + (pcase tag-pair + (`(,(or :startgrouptag :startgroup)) + (setq group-flag t) + (push tag-pair to-add)) + (`(,(or :endgrouptag :endgroup)) + (setq group-flag nil) + (push tag-pair to-add)) + (`(,(or :grouptags :newline)) + (push tag-pair to-add)) + (`(,tag . ,_) + ;; Remove duplicates from ALIST1, unless they are in + ;; a group. Indeed, it makes sense to have a tag appear in + ;; multiple groups. + (when (or group-flag (not (assoc tag alist2))) + (push tag-pair to-add))) + (_ (error "Invalid association in tag alist: %S" tag-pair)))) + ;; Preserve order of ALIST1. + (append (nreverse to-add) alist2))))) + +(defun org-priority-to-value (s) + "Convert priority string S to its numeric value." + (or (save-match-data + (and (string-match "\\([0-9]+\\)" s) + (string-to-number (match-string 1 s)))) + (string-to-char s))) + +(defun org-set-regexps-and-options (&optional tags-only) + "Precompute regular expressions used in the current buffer. +When optional argument TAGS-ONLY is non-nil, only compute tags +related expressions." + (when (derived-mode-p 'org-mode) + (let ((alist (org-collect-keywords + (append '("FILETAGS" "TAGS") + (and (not tags-only) + '("ARCHIVE" "CATEGORY" "COLUMNS" "CONSTANTS" + "LINK" "OPTIONS" "PRIORITIES" "PROPERTY" + "SEQ_TODO" "STARTUP" "TODO" "TYP_TODO"))) + '("ARCHIVE" "CATEGORY" "COLUMNS" "PRIORITIES")))) + ;; Startup options. Get this early since it does change + ;; behavior for other options (e.g., tags). + (let ((startup (cl-mapcan (lambda (value) (split-string value)) + (cdr (assoc "STARTUP" alist))))) + (dolist (option startup) + (pcase (assoc-string option org-startup-options t) + (`(,_ ,variable ,value t) + (unless (listp (symbol-value variable)) + (set (make-local-variable variable) nil)) + (add-to-list variable value)) + (`(,_ ,variable ,value . ,_) + (set (make-local-variable variable) value)) + (_ nil)))) + (setq-local org-file-tags + (mapcar #'org-add-prop-inherited + (cl-mapcan (lambda (value) + (cl-mapcan + (lambda (k) (org-split-string k ":")) + (split-string value))) + (cdr (assoc "FILETAGS" alist))))) + (setq org-current-tag-alist + (org--tag-add-to-alist + org-tag-persistent-alist + (let ((tags (cdr (assoc "TAGS" alist)))) + (if tags + (org-tag-string-to-alist + (mapconcat #'identity tags "\n")) + org-tag-alist)))) + (setq org-tag-groups-alist + (org-tag-alist-to-groups org-current-tag-alist)) + (unless tags-only + ;; Properties. + (let ((properties nil)) + (dolist (value (cdr (assoc "PROPERTY" alist))) + (when (string-match "\\(\\S-+\\)[ \t]+\\(.*\\)" value) + (setq properties (org--update-property-plist + (match-string-no-properties 1 value) + (match-string-no-properties 2 value) + properties)))) + (setq-local org-keyword-properties properties)) + ;; Archive location. + (let ((archive (cdr (assoc "ARCHIVE" alist)))) + (when archive (setq-local org-archive-location archive))) + ;; Category. + (let ((category (cdr (assoc "CATEGORY" alist)))) + (when category + (setq-local org-category (intern category)) + (setq-local org-keyword-properties + (org--update-property-plist + "CATEGORY" category org-keyword-properties)))) + ;; Columns. + (let ((column (cdr (assoc "COLUMNS" alist)))) + (when column (setq-local org-columns-default-format column))) + ;; Constants. + (let ((store nil)) + (dolist (pair (cl-mapcan #'split-string + (cdr (assoc "CONSTANTS" alist)))) + (when (string-match "^\\([a-zA-Z0][_a-zA-Z0-9]*\\)=\\(.*\\)" pair) + (let* ((name (match-string 1 pair)) + (value (match-string 2 pair)) + (old (assoc name store))) + (if old (setcdr old value) + (push (cons name value) store))))) + (setq org-table-formula-constants-local store)) + ;; Link abbreviations. + (let ((links + (delq nil + (mapcar + (lambda (value) + (and (string-match "\\`\\(\\S-+\\)[ \t]+\\(.+\\)" value) + (cons (match-string-no-properties 1 value) + (match-string-no-properties 2 value)))) + (cdr (assoc "LINK" alist)))))) + (when links (setq org-link-abbrev-alist-local (nreverse links)))) + ;; Priorities. + (let ((value (cdr (assoc "PRIORITIES" alist)))) + (pcase (and value (split-string value)) + (`(,high ,low ,default . ,_) + (setq-local org-priority-highest (org-priority-to-value high)) + (setq-local org-priority-lowest (org-priority-to-value low)) + (setq-local org-priority-default (org-priority-to-value default))))) + ;; Scripts. + (let ((value (cdr (assoc "OPTIONS" alist)))) + (dolist (option value) + (when (string-match "\\^:\\(t\\|nil\\|{}\\)" option) + (setq-local org-use-sub-superscripts + (read (match-string 1 option)))))) + ;; TODO keywords. + (setq-local org-todo-kwd-alist nil) + (setq-local org-todo-key-alist nil) + (setq-local org-todo-key-trigger nil) + (setq-local org-todo-keywords-1 nil) + (setq-local org-done-keywords nil) + (setq-local org-todo-heads nil) + (setq-local org-todo-sets nil) + (setq-local org-todo-log-states nil) + (let ((todo-sequences + (or (append (mapcar (lambda (value) + (cons 'type (split-string value))) + (cdr (assoc "TYP_TODO" alist))) + (mapcar (lambda (value) + (cons 'sequence (split-string value))) + (append (cdr (assoc "TODO" alist)) + (cdr (assoc "SEQ_TODO" alist))))) + (let ((d (default-value 'org-todo-keywords))) + (if (not (stringp (car d))) d + ;; XXX: Backward compatibility code. + (list (cons org-todo-interpretation d))))))) + (dolist (sequence todo-sequences) + (let* ((sequence (or (run-hook-with-args-until-success + 'org-todo-setup-filter-hook sequence) + sequence)) + (sequence-type (car sequence)) + (keywords (cdr sequence)) + (sep (member "|" keywords)) + names alist) + (dolist (k (remove "|" keywords)) + (unless (string-match "^\\(.*?\\)\\(?:(\\([^!@/]\\)?.*?)\\)?$" + k) + (error "Invalid TODO keyword %s" k)) + (let ((name (match-string 1 k)) + (key (match-string 2 k)) + (log (org-extract-log-state-settings k))) + (push name names) + (push (cons name (and key (string-to-char key))) alist) + (when log (push log org-todo-log-states)))) + (let* ((names (nreverse names)) + (done (if sep (org-remove-keyword-keys (cdr sep)) + (last names))) + (head (car names)) + (tail (list sequence-type head (car done) (org-last done)))) + (add-to-list 'org-todo-heads head 'append) + (push names org-todo-sets) + (setq org-done-keywords (append org-done-keywords done nil)) + (setq org-todo-keywords-1 (append org-todo-keywords-1 names nil)) + (setq org-todo-key-alist + (append org-todo-key-alist + (and alist + (append '((:startgroup)) + (nreverse alist) + '((:endgroup)))))) + (dolist (k names) (push (cons k tail) org-todo-kwd-alist)))))) + (setq org-todo-sets (nreverse org-todo-sets) + org-todo-kwd-alist (nreverse org-todo-kwd-alist) + org-todo-key-trigger (delq nil (mapcar #'cdr org-todo-key-alist)) + org-todo-key-alist (org-assign-fast-keys org-todo-key-alist)) + ;; Compute the regular expressions and other local variables. + ;; Using `org-outline-regexp-bol' would complicate them much, + ;; because of the fixed white space at the end of that string. + (unless org-done-keywords + (setq org-done-keywords + (and org-todo-keywords-1 (last org-todo-keywords-1)))) + (setq org-not-done-keywords + (org-delete-all org-done-keywords + (copy-sequence org-todo-keywords-1)) + org-todo-regexp (regexp-opt org-todo-keywords-1 t) + org-not-done-regexp (regexp-opt org-not-done-keywords t) + org-not-done-heading-regexp + (format org-heading-keyword-regexp-format org-not-done-regexp) + org-todo-line-regexp + (format org-heading-keyword-maybe-regexp-format org-todo-regexp) + org-complex-heading-regexp + (concat "^\\(\\*+\\)" + "\\(?: +" org-todo-regexp "\\)?" + "\\(?: +\\(\\[#.\\]\\)\\)?" + "\\(?: +\\(.*?\\)\\)??" + "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?" + "[ \t]*$") + org-complex-heading-regexp-format + (concat "^\\(\\*+\\)" + "\\(?: +" org-todo-regexp "\\)?" + "\\(?: +\\(\\[#.\\]\\)\\)?" + "\\(?: +" + ;; Stats cookies can be stuck to body. + "\\(?:\\[[0-9%%/]+\\] *\\)*" + "\\(%s\\)" + "\\(?: *\\[[0-9%%/]+\\]\\)*" + "\\)" + "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?" + "[ \t]*$") + org-todo-line-tags-regexp + (concat "^\\(\\*+\\)" + "\\(?: +" org-todo-regexp "\\)?" + "\\(?: +\\(.*?\\)\\)??" + "\\(?:[ \t]+\\(:[[:alnum:]:_@#%]+:\\)\\)?" + "[ \t]*$")) + (org-compute-latex-and-related-regexp))))) + +(defun org-collect-keywords (keywords &optional unique directory) + "Return values for KEYWORDS in current buffer, as an alist. + +KEYWORDS is a list of strings. Return value is a list of +elements with the pattern: + + (NAME . LIST-OF-VALUES) + +where NAME is the upcase name of the keyword, and LIST-OF-VALUES +is a list of non-empty values, as strings, in order of appearance +in the buffer. + +When KEYWORD appears in UNIQUE list, LIST-OF-VALUE is its first +value, empty or not, appearing in the buffer, as a string. + +When KEYWORD appears in DIRECTORIES, each value is a cons cell: + + (VALUE . DIRECTORY) + +where VALUE is the regular value, and DIRECTORY is the variable +`default-directory' for the buffer containing the keyword. This +is important for values containing relative file names, since the +function follows SETUPFILE keywords, and may change its working +directory." + (let* ((keywords (cons "SETUPFILE" (mapcar #'upcase keywords))) + (unique (mapcar #'upcase unique)) + (alist (org--collect-keywords-1 + keywords unique directory + (and buffer-file-name (list buffer-file-name)) + nil))) + ;; Re-order results. + (dolist (entry alist) + (pcase entry + (`(,_ . ,(and value (pred consp))) + (setcdr entry (nreverse value))))) + (nreverse alist))) + +(defun org--collect-keywords-1 (keywords unique directory files alist) + (org-with-point-at 1 + (let ((case-fold-search t) + (regexp (org-make-options-regexp keywords))) + (while (and keywords (re-search-forward regexp nil t)) + (let ((element (org-element-at-point))) + (when (eq 'keyword (org-element-type element)) + (let ((value (org-element-property :value element))) + (pcase (org-element-property :key element) + ("SETUPFILE" + (when (and (org-string-nw-p value) + (not buffer-read-only)) ;FIXME: bug in Gnus? + (let* ((uri (org-strip-quotes value)) + (uri-is-url (org-url-p uri)) + (uri (if uri-is-url + uri + (expand-file-name uri)))) + (unless (member uri files) + (with-temp-buffer + (unless uri-is-url + (setq default-directory (file-name-directory uri))) + (let ((contents (org-file-contents uri :noerror))) + (when contents + (insert contents) + ;; Fake Org mode: `org-element-at-point' + ;; doesn't need full set-up. + (let ((major-mode 'org-mode)) + (setq alist + (org--collect-keywords-1 + keywords unique directory + (cons uri files) + alist)))))))))) + (keyword + (let ((entry (assoc keyword alist)) + (final + (cond ((not (member keyword directory)) value) + (buffer-file-name + (cons value + (file-name-directory buffer-file-name))) + (t (cons value default-directory))))) + (cond ((member keyword unique) + (push (cons keyword final) alist) + (setq keywords (remove keyword keywords)) + (setq regexp (org-make-options-regexp keywords))) + ((null entry) (push (list keyword final) alist)) + (t (push final (cdr entry))))))))))) + alist))) + +(defun org-tag-string-to-alist (s) + "Return tag alist associated to string S. +S is a value for TAGS keyword or produced with +`org-tag-alist-to-string'. Return value is an alist suitable for +`org-tag-alist' or `org-tag-persistent-alist'." + (let ((lines (mapcar #'split-string (split-string s "\n" t))) + (tag-re (concat "\\`\\(" org-tag-re "\\|{.+?}\\)" ; regular expression + "\\(?:(\\(.\\))\\)?\\'")) + alist group-flag) + (dolist (tokens lines (cdr (nreverse alist))) + (push '(:newline) alist) + (while tokens + (let ((token (pop tokens))) + (pcase token + ("{" + (push '(:startgroup) alist) + (when (equal (nth 1 tokens) ":") (setq group-flag t))) + ("}" + (push '(:endgroup) alist) + (setq group-flag nil)) + ("[" + (push '(:startgrouptag) alist) + (when (equal (nth 1 tokens) ":") (setq group-flag t))) + ("]" + (push '(:endgrouptag) alist) + (setq group-flag nil)) + (":" + (push '(:grouptags) alist)) + ((guard (string-match tag-re token)) + (let ((tag (match-string 1 token)) + (key (and (match-beginning 2) + (string-to-char (match-string 2 token))))) + ;; Push all tags in groups, no matter if they already + ;; appear somewhere else in the list. + (when (or group-flag (not (assoc tag alist))) + (push (cons tag key) alist)))))))))) + +(defun org-tag-alist-to-string (alist &optional skip-key) + "Return tag string associated to ALIST. + +ALIST is an alist, as defined in `org-tag-alist' or +`org-tag-persistent-alist', or produced with +`org-tag-string-to-alist'. + +Return value is a string suitable as a value for \"TAGS\" +keyword. + +When optional argument SKIP-KEY is non-nil, skip selection keys +next to tags." + (mapconcat (lambda (token) + (pcase token + (`(:startgroup) "{") + (`(:endgroup) "}") + (`(:startgrouptag) "[") + (`(:endgrouptag) "]") + (`(:grouptags) ":") + (`(:newline) "\\n") + ((and + (guard (not skip-key)) + `(,(and tag (pred stringp)) . ,(and key (pred characterp)))) + (format "%s(%c)" tag key)) + (`(,(and tag (pred stringp)) . ,_) tag) + (_ (user-error "Invalid tag token: %S" token)))) + alist + " ")) + +(defun org-tag-alist-to-groups (alist) + "Return group alist from tag ALIST. +ALIST is an alist, as defined in `org-tag-alist' or +`org-tag-persistent-alist', or produced with +`org-tag-string-to-alist'. Return value is an alist following +the pattern (GROUP-TAG TAGS) where GROUP-TAG is the tag, as +a string, summarizing TAGS, as a list of strings." + (let (groups group-status current-group) + (dolist (token alist (nreverse groups)) + (pcase token + (`(,(or :startgroup :startgrouptag)) (setq group-status t)) + (`(,(or :endgroup :endgrouptag)) + (when (eq group-status 'append) + (push (nreverse current-group) groups)) + (setq group-status nil current-group nil)) + (`(:grouptags) (setq group-status 'append)) + ((and `(,tag . ,_) (guard group-status)) + (if (eq group-status 'append) (push tag current-group) + (setq current-group (list tag)))) + (_ nil))))) + +(defvar org--file-cache (make-hash-table :test #'equal) + "Hash table to store contents of files referenced via a URL. +This is the cache of file URLs read using `org-file-contents'.") + +(defun org-reset-file-cache () + "Reset the cache of files downloaded by `org-file-contents'." + (clrhash org--file-cache)) + +(defun org-file-contents (file &optional noerror nocache) + "Return the contents of FILE, as a string. + +FILE can be a file name or URL. + +If FILE is a URL, download the contents. If the URL contents are +already cached in the `org--file-cache' hash table, the download step +is skipped. + +If NOERROR is non-nil, ignore the error when unable to read the FILE +from file or URL, and return nil. + +If NOCACHE is non-nil, do a fresh fetch of FILE even if cached version +is available. This option applies only if FILE is a URL." + (let* ((is-url (org-url-p file)) + (cache (and is-url + (not nocache) + (gethash file org--file-cache)))) + (cond + (cache) + (is-url + (with-current-buffer (url-retrieve-synchronously file) + (goto-char (point-min)) + ;; Move point to after the url-retrieve header. + (search-forward "\n\n" nil :move) + ;; Search for the success code only in the url-retrieve header. + (if (save-excursion + (re-search-backward "HTTP.*\\s-+200\\s-OK" nil :noerror)) + ;; Update the cache `org--file-cache' and return contents. + (puthash file + (buffer-substring-no-properties (point) (point-max)) + org--file-cache) + (funcall (if noerror #'message #'user-error) + "Unable to fetch file from %S" + file) + nil))) + (t + (with-temp-buffer + (condition-case nil + (progn + (insert-file-contents file) + (buffer-string)) + (file-error + (funcall (if noerror #'message #'user-error) + "Unable to read file %S" + file) + nil))))))) + +(defun org-extract-log-state-settings (x) + "Extract the log state setting from a TODO keyword string. +This will extract info from a string like \"WAIT(w@/!)\"." + (when (string-match "^\\(.*?\\)\\(?:(\\([^!@/]\\)?\\([!@]\\)?\\(?:/\\([!@]\\)\\)?)\\)?$" x) + (let ((kw (match-string 1 x)) + (log1 (and (match-end 3) (match-string 3 x))) + (log2 (and (match-end 4) (match-string 4 x)))) + (and (or log1 log2) + (list kw + (and log1 (if (equal log1 "!") 'time 'note)) + (and log2 (if (equal log2 "!") 'time 'note))))))) + +(defun org-remove-keyword-keys (list) + "Remove a pair of parenthesis at the end of each string in LIST." + (mapcar (lambda (x) + (if (string-match "(.*)$" x) + (substring x 0 (match-beginning 0)) + x)) + list)) + +(defun org-assign-fast-keys (alist) + "Assign fast keys to a keyword-key alist. +Respect keys that are already there." + (let (new e (alt ?0)) + (while (setq e (pop alist)) + (if (or (memq (car e) '(:newline :grouptags :endgroup :startgroup)) + (cdr e)) ;; Key already assigned. + (push e new) + (let ((clist (string-to-list (downcase (car e)))) + (used (append new alist))) + (when (= (car clist) ?@) + (pop clist)) + (while (and clist (rassoc (car clist) used)) + (pop clist)) + (unless clist + (while (rassoc alt used) + (cl-incf alt))) + (push (cons (car e) (or (car clist) alt)) new)))) + (nreverse new))) + +;;; Some variables used in various places + +(defvar org-window-configuration nil + "Used in various places to store a window configuration.") +(defvar org-selected-window nil + "Used in various places to store a window configuration.") +(defvar org-finish-function nil + "Function to be called when `C-c C-c' is used. +This is for getting out of special buffers like capture.") +(defvar org-last-state) + +;; Defined somewhere in this file, but used before definition. +(defvar org-entities) ;; defined in org-entities.el +(defvar org-struct-menu) +(defvar org-org-menu) +(defvar org-tbl-menu) + +;;;; Define the Org mode + +(defun org-before-change-function (_beg _end) + "Every change indicates that a table might need an update." + (setq org-table-may-need-update t)) +(defvar org-mode-map) +(defvar org-inhibit-startup-visibility-stuff nil) ; Dynamically-scoped param. +(defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. +(defvar org-inhibit-logging nil) ; Dynamically-scoped param. +(defvar org-inhibit-blocking nil) ; Dynamically-scoped param. + +(defvar bidi-paragraph-direction) +(defvar buffer-face-mode-face) + +(require 'outline) + +;; Other stuff we need. +(require 'time-date) +(unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time)) +(when (< emacs-major-version 28) ; preloaded in Emacs 28 + (require 'easymenu)) + +(require 'org-entities) +(require 'org-faces) +(require 'org-list) +(require 'org-pcomplete) +(require 'org-src) +(require 'org-footnote) +(require 'org-macro) + +;; babel +(require 'ob) + +;;;###autoload +(define-derived-mode org-mode outline-mode "Org" + "Outline-based notes management and organizer, alias +\"Carsten's outline-mode for keeping track of everything.\" + +Org mode develops organizational tasks around a NOTES file which +contains information about projects as plain text. Org mode is +implemented on top of Outline mode, which is ideal to keep the content +of large files well structured. It supports ToDo items, deadlines and +time stamps, which magically appear in the diary listing of the Emacs +calendar. Tables are easily created with a built-in table editor. +Plain text URL-like links connect to websites, emails (VM), Usenet +messages (Gnus), BBDB entries, and any files related to the project. +For printing and sharing of notes, an Org file (or a part of it) +can be exported as a structured ASCII or HTML file. + +The following commands are available: + +\\{org-mode-map}" + (org-load-modules-maybe) + (org-install-agenda-files-menu) + (when org-link-descriptive (add-to-invisibility-spec '(org-link))) + (make-local-variable 'org-link-descriptive) + (add-to-invisibility-spec '(org-hide-block . t)) + (setq-local outline-regexp org-outline-regexp) + (setq-local outline-level 'org-outline-level) + (setq bidi-paragraph-direction 'left-to-right) + (when (and (stringp org-ellipsis) (not (equal "" org-ellipsis))) + (unless org-display-table + (setq org-display-table (make-display-table))) + (set-display-table-slot + org-display-table 4 + (vconcat (mapcar (lambda (c) (make-glyph-code c 'org-ellipsis)) + org-ellipsis))) + (setq buffer-display-table org-display-table)) + (org-set-regexps-and-options) + (org-set-font-lock-defaults) + (when (and org-tag-faces (not org-tags-special-faces-re)) + ;; tag faces set outside customize.... force initialization. + (org-set-tag-faces 'org-tag-faces org-tag-faces)) + ;; Calc embedded + (setq-local calc-embedded-open-mode "# ") + ;; Modify a few syntax entries + (modify-syntax-entry ?\" "\"") + (modify-syntax-entry ?\\ "_") + (modify-syntax-entry ?~ "_") + (modify-syntax-entry ?< "(>") + (modify-syntax-entry ?> ")<") + (setq-local font-lock-unfontify-region-function 'org-unfontify-region) + ;; Activate before-change-function + (setq-local org-table-may-need-update t) + (add-hook 'before-change-functions 'org-before-change-function nil 'local) + ;; Check for running clock before killing a buffer + (add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local) + ;; Initialize macros templates. + (org-macro-initialize-templates) + ;; Initialize radio targets. + (org-update-radio-target-regexp) + ;; Indentation. + (setq-local indent-line-function 'org-indent-line) + (setq-local indent-region-function 'org-indent-region) + ;; Filling and auto-filling. + (org-setup-filling) + ;; Comments. + (org-setup-comments-handling) + ;; Initialize cache. + (org-element-cache-reset) + ;; Beginning/end of defun + (setq-local beginning-of-defun-function 'org-backward-element) + (setq-local end-of-defun-function + (lambda () + (if (not (org-at-heading-p)) + (org-forward-element) + (org-forward-element) + (forward-char -1)))) + ;; Next error for sparse trees + (setq-local next-error-function 'org-occur-next-match) + ;; Make commit log messages from Org documents easier. + (setq-local add-log-current-defun-function #'org-add-log-current-headline) + ;; Make sure dependence stuff works reliably, even for users who set it + ;; too late :-( + (if org-enforce-todo-dependencies + (add-hook 'org-blocker-hook + 'org-block-todo-from-children-or-siblings-or-parent) + (remove-hook 'org-blocker-hook + 'org-block-todo-from-children-or-siblings-or-parent)) + (if org-enforce-todo-checkbox-dependencies + (add-hook 'org-blocker-hook + 'org-block-todo-from-checkboxes) + (remove-hook 'org-blocker-hook + 'org-block-todo-from-checkboxes)) + + ;; Align options lines + (setq-local + align-mode-rules-list + '((org-in-buffer-settings + (regexp . "^[ \t]*#\\+[A-Z_]+:\\(\\s-*\\)\\S-+") + (modes . '(org-mode))))) + + ;; Setup the pcomplete hooks + (setq-local pcomplete-command-completion-function #'org-pcomplete-initial) + (setq-local pcomplete-command-name-function #'org-command-at-point) + (setq-local pcomplete-default-completion-function #'ignore) + (setq-local pcomplete-parse-arguments-function #'org-parse-arguments) + (setq-local pcomplete-termination-string "") + (add-hook 'completion-at-point-functions + #'pcomplete-completions-at-point nil t) + (setq-local buffer-face-mode-face 'org-default) + + ;; If empty file that did not turn on Org mode automatically, make + ;; it to. + (when (and org-insert-mode-line-in-empty-file + (called-interactively-p 'any) + (= (point-min) (point-max))) + (insert "# -*- mode: org -*-\n\n")) + (unless org-inhibit-startup + (org-unmodified + (when org-startup-with-beamer-mode (org-beamer-mode)) + (when (or org-startup-align-all-tables org-startup-shrink-all-tables) + (org-table-map-tables + (cond ((and org-startup-align-all-tables + org-startup-shrink-all-tables) + (lambda () (org-table-align) (org-table-shrink))) + (org-startup-align-all-tables #'org-table-align) + (t #'org-table-shrink)) + t)) + (when org-startup-with-inline-images (org-display-inline-images)) + (when org-startup-with-latex-preview (org-latex-preview '(16))) + (unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility)) + (when org-startup-truncated (setq truncate-lines t)) + (when org-startup-numerated (require 'org-num) (org-num-mode 1)) + (when org-startup-indented (require 'org-indent) (org-indent-mode 1)))) + + ;; Add a custom keymap for `visual-line-mode' so that activating + ;; this minor mode does not override Org's keybindings. + ;; FIXME: Probably `visual-line-mode' should take care of this. + (let ((oldmap (cdr (assoc 'visual-line-mode minor-mode-map-alist))) + (newmap (make-sparse-keymap))) + (set-keymap-parent newmap oldmap) + (define-key newmap [remap move-beginning-of-line] nil) + (define-key newmap [remap move-end-of-line] nil) + (define-key newmap [remap kill-line] nil) + (make-local-variable 'minor-mode-overriding-map-alist) + (push `(visual-line-mode . ,newmap) minor-mode-overriding-map-alist)) + + ;; Activate `org-table-header-line-mode' + (when org-table-header-line-p + (org-table-header-line-mode 1)) + ;; Try to set `org-hide' face correctly. + (let ((foreground (org-find-invisible-foreground))) + (when foreground + (set-face-foreground 'org-hide foreground))) + ;; Set face extension as requested. + (org--set-faces-extend '(org-block-begin-line org-block-end-line) + org-fontify-whole-block-delimiter-line) + (org--set-faces-extend org-level-faces org-fontify-whole-heading-line)) + +;; Update `customize-package-emacs-version-alist' +(add-to-list 'customize-package-emacs-version-alist + '(Org ("8.0" . "24.4") + ("8.1" . "24.4") + ("8.2" . "24.4") + ("8.2.7" . "24.4") + ("8.3" . "26.1") + ("9.0" . "26.1") + ("9.1" . "26.1") + ("9.2" . "27.1") + ("9.3" . "27.1") + ("9.4" . "27.2") + ("9.5" . "28.1"))) + +(defvar org-mode-transpose-word-syntax-table + (let ((st (make-syntax-table text-mode-syntax-table))) + (dolist (c org-emphasis-alist st) + (modify-syntax-entry (string-to-char (car c)) "w p" st)))) + +(when (fboundp 'abbrev-table-put) + (abbrev-table-put org-mode-abbrev-table + :parents (list text-mode-abbrev-table))) + +(defun org-find-invisible-foreground () + (let ((candidates (remove + "unspecified-bg" + (nconc + (list (face-background 'default) + (face-background 'org-default)) + (mapcar + (lambda (alist) + (when (boundp alist) + (cdr (assq 'background-color (symbol-value alist))))) + '(default-frame-alist initial-frame-alist window-system-default-frame-alist)) + (list (face-foreground 'org-hide)))))) + (car (remove nil candidates)))) + +(defun org-current-time (&optional rounding-minutes past) + "Current time, possibly rounded to ROUNDING-MINUTES. +When ROUNDING-MINUTES is not an integer, fall back on the car of +`org-time-stamp-rounding-minutes'. When PAST is non-nil, ensure +the rounding returns a past time." + (let ((r (or (and (integerp rounding-minutes) rounding-minutes) + (car org-time-stamp-rounding-minutes))) + (now (current-time))) + (if (< r 1) + now + (let* ((time (decode-time now)) + (res (apply #'encode-time 0 (* r (round (nth 1 time) r)) + (nthcdr 2 time)))) + (if (or (not past) (org-time-less-p res now)) + res + (org-time-subtract res (* r 60))))))) + +(defun org-today () + "Return today date, considering `org-extend-today-until'." + (time-to-days + (org-time-since (* 3600 org-extend-today-until)))) + +;;;; Font-Lock stuff, including the activators + +(defconst org-match-sexp-depth 3 + "Number of stacked braces for sub/superscript matching.") + +(defun org-create-multibrace-regexp (left right n) + "Create a regular expression which will match a balanced sexp. +Opening delimiter is LEFT, and closing delimiter is RIGHT, both given +as single character strings. +The regexp returned will match the entire expression including the +delimiters. It will also define a single group which contains the +match except for the outermost delimiters. The maximum depth of +stacked delimiters is N. Escaping delimiters is not possible." + (let* ((nothing (concat "[^" left right "]*?")) + (or "\\|") + (re nothing) + (next (concat "\\(?:" nothing left nothing right "\\)+" nothing))) + (while (> n 1) + (setq n (1- n) + re (concat re or next) + next (concat "\\(?:" nothing left next right "\\)+" nothing))) + (concat left "\\(" re "\\)" right))) + +(defconst org-match-substring-regexp + (concat + "\\(\\S-\\)\\([_^]\\)\\(" + "\\(?:" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)" + "\\|" + "\\(?:" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)" + "\\|" + "\\(?:\\*\\|[+-]?[[:alnum:].,\\]*[[:alnum:]]\\)\\)") + "The regular expression matching a sub- or superscript.") + +(defconst org-match-substring-with-braces-regexp + (concat + "\\(\\S-\\)\\([_^]\\)" + "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)") + "The regular expression matching a sub- or superscript, forcing braces.") + +(defvar org-emph-face nil) + +(defun org-do-emphasis-faces (limit) + "Run through the buffer and emphasize strings." + (let ((quick-re (format "\\([%s]\\|^\\)\\([~=*/_+]\\)" + (car org-emphasis-regexp-components)))) + (catch :exit + (while (re-search-forward quick-re limit t) + (let* ((marker (match-string 2)) + (verbatim? (member marker '("~" "=")))) + (when (save-excursion + (goto-char (match-beginning 0)) + (and + ;; Do not match table hlines. + (not (and (equal marker "+") + (org-match-line + "[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[ \t]*$"))) + ;; Do not match headline stars. Do not consider + ;; stars of a headline as closing marker for bold + ;; markup either. + (not (and (equal marker "*") + (save-excursion + (forward-char) + (skip-chars-backward "*") + (looking-at-p org-outline-regexp-bol)))) + ;; Match full emphasis markup regexp. + (looking-at (if verbatim? org-verbatim-re org-emph-re)) + ;; Do not span over paragraph boundaries. + (not (string-match-p org-element-paragraph-separate + (match-string 2))) + ;; Do not span over cells in table rows. + (not (and (save-match-data (org-match-line "[ \t]*|")) + (string-match-p "|" (match-string 4)))))) + (pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist)) + (m (if org-hide-emphasis-markers 4 2))) + (font-lock-prepend-text-property + (match-beginning m) (match-end m) 'face face) + (when verbatim? + (org-remove-flyspell-overlays-in + (match-beginning 0) (match-end 0)) + (remove-text-properties (match-beginning 2) (match-end 2) + '(display t invisible t intangible t))) + (add-text-properties (match-beginning 2) (match-end 2) + '(font-lock-multiline t org-emphasis t)) + (when (and org-hide-emphasis-markers + (not (org-at-comment-p))) + (add-text-properties (match-end 4) (match-beginning 5) + '(invisible t)) + (add-text-properties (match-beginning 3) (match-end 3) + '(invisible t))) + (throw :exit t)))))))) + +(defun org-emphasize (&optional char) + "Insert or change an emphasis, i.e. a font like bold or italic. +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. +CHAR should be the marker character. If it is a space, it means to +remove the emphasis of the selected region. +If CHAR is not given (for example in an interactive call) it will be +prompted for." + (interactive) + (let ((erc org-emphasis-regexp-components) + (string "") beg end move s) + (if (org-region-active-p) + (setq beg (region-beginning) + end (region-end) + string (buffer-substring beg end)) + (setq move t)) + + (unless char + (message "Emphasis marker or tag: [%s]" + (mapconcat #'car org-emphasis-alist "")) + (setq char (read-char-exclusive))) + (if (equal char ?\s) + (setq s "" + move nil) + (unless (assoc (char-to-string char) org-emphasis-alist) + (user-error "No such emphasis marker: \"%c\"" char)) + (setq s (char-to-string char))) + (while (and (> (length string) 1) + (equal (substring string 0 1) (substring string -1)) + (assoc (substring string 0 1) org-emphasis-alist)) + (setq string (substring string 1 -1))) + (setq string (concat s string s)) + (when beg (delete-region beg end)) + (unless (or (bolp) + (string-match (concat "[" (nth 0 erc) "\n]") + (char-to-string (char-before (point))))) + (insert " ")) + (unless (or (eobp) + (string-match (concat "[" (nth 1 erc) "\n]") + (char-to-string (char-after (point))))) + (insert " ") (backward-char 1)) + (insert string) + (and move (backward-char 1)))) + +(defconst org-nonsticky-props + '(mouse-face highlight keymap invisible intangible help-echo org-linked-text htmlize-link)) + +(defsubst org-rear-nonsticky-at (pos) + (add-text-properties (1- pos) pos (list 'rear-nonsticky org-nonsticky-props))) + +(defun org-activate-links (limit) + "Add link properties to links. +This includes angle, plain, and bracket links." + (catch :exit + (while (re-search-forward org-link-any-re limit t) + (let* ((start (match-beginning 0)) + (end (match-end 0)) + (visible-start (or (match-beginning 3) (match-beginning 2))) + (visible-end (or (match-end 3) (match-end 2))) + (style (cond ((eq ?< (char-after start)) 'angle) + ((eq ?\[ (char-after (1+ start))) 'bracket) + (t 'plain)))) + (when (and (memq style org-highlight-links) + ;; Do not span over paragraph boundaries. + (not (string-match-p org-element-paragraph-separate + (match-string 0))) + ;; Do not confuse plain links with tags. + (not (and (eq style 'plain) + (let ((face (get-text-property + (max (1- start) (point-min)) 'face))) + (if (consp face) (memq 'org-tag face) + (eq 'org-tag face)))))) + (let* ((link-object (save-excursion + (goto-char start) + (save-match-data (org-element-link-parser)))) + (link (org-element-property :raw-link link-object)) + (type (org-element-property :type link-object)) + (path (org-element-property :path link-object)) + (face-property (pcase (org-link-get-parameter type :face) + ((and (pred functionp) face) (funcall face path)) + ((and (pred facep) face) face) + ((and (pred consp) face) face) ;anonymous + (_ 'org-link))) + (properties ;for link's visible part + (list 'mouse-face (or (org-link-get-parameter type :mouse-face) + 'highlight) + 'keymap (or (org-link-get-parameter type :keymap) + org-mouse-map) + 'help-echo (pcase (org-link-get-parameter type :help-echo) + ((and (pred stringp) echo) echo) + ((and (pred functionp) echo) echo) + (_ (concat "LINK: " link))) + 'htmlize-link (pcase (org-link-get-parameter type + :htmlize-link) + ((and (pred functionp) f) (funcall f)) + (_ `(:uri ,link))) + 'font-lock-multiline t))) + (org-remove-flyspell-overlays-in start end) + (org-rear-nonsticky-at end) + (if (not (eq 'bracket style)) + (progn + (add-face-text-property start end face-property) + (add-text-properties start end properties)) + ;; Handle invisible parts in bracket links. + (remove-text-properties start end '(invisible nil)) + (let ((hidden + (append `(invisible + ,(or (org-link-get-parameter type :display) + 'org-link)) + properties))) + (add-text-properties start visible-start hidden) + (add-face-text-property start end face-property) + (add-text-properties visible-start visible-end properties) + (add-text-properties visible-end end hidden) + (org-rear-nonsticky-at visible-start) + (org-rear-nonsticky-at visible-end))) + (let ((f (org-link-get-parameter type :activate-func))) + (when (functionp f) + (funcall f start end path (eq style 'bracket)))) + (throw :exit t))))) ;signal success + nil)) + +(defun org-activate-code (limit) + (when (re-search-forward "^[ \t]*\\(:\\(?: .*\\|$\\)\n?\\)" limit t) + (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) + (remove-text-properties (match-beginning 0) (match-end 0) + '(display t invisible t intangible t)) + t)) + +(defcustom org-src-fontify-natively t + "When non-nil, fontify code in code blocks. +See also the `org-block' face." + :type 'boolean + :version "26.1" + :package-version '(Org . "8.3") + :group 'org-appearance + :group 'org-babel) + +(defcustom org-allow-promoting-top-level-subtree nil + "When non-nil, allow promoting a top level subtree. +The leading star of the top level headline will be replaced +by a #." + :type 'boolean + :version "24.1" + :group 'org-appearance) + +(defun org-fontify-meta-lines-and-blocks (limit) + (condition-case nil + (org-fontify-meta-lines-and-blocks-1 limit) + (error (message "Org mode fontification error in %S at %d" + (current-buffer) + (line-number-at-pos))))) + +(defun org-fontify-meta-lines-and-blocks-1 (limit) + "Fontify #+ lines and blocks." + (let ((case-fold-search t)) + (when (re-search-forward + (rx bol (group (zero-or-more (any " \t")) "#" + (group (group (or (seq "+" (one-or-more (any "a-zA-Z")) (optional ":")) + (any " \t") + eol)) + (optional (group "_" (group (one-or-more (any "a-zA-Z")))))) + (zero-or-more (any " \t")) + (group (group (zero-or-more (not (any " \t\n")))) + (zero-or-more (any " \t")) + (group (zero-or-more any))))) + limit t) + (let ((beg (match-beginning 0)) + (end-of-beginline (match-end 0)) + ;; Including \n at end of #+begin line will include \n + ;; after the end of block content. + (block-start (match-end 0)) + (block-end nil) + (lang (match-string 7)) ; The language, if it is a source block. + (bol-after-beginline (line-beginning-position 2)) + (dc1 (downcase (match-string 2))) + (dc3 (downcase (match-string 3))) + (whole-blockline org-fontify-whole-block-delimiter-line) + beg-of-endline end-of-endline nl-before-endline quoting block-type) + (cond + ((and (match-end 4) (equal dc3 "+begin")) + ;; Truly a block + (setq block-type (downcase (match-string 5)) + ;; Src, example, export, maybe more. + quoting (member block-type org-protecting-blocks)) + (when (re-search-forward + (rx-to-string `(group bol (or (seq (one-or-more "*") space) + (seq (zero-or-more (any " \t")) + "#+end" + ,(match-string 4) + word-end + (zero-or-more any))))) + ;; We look further than LIMIT on purpose. + nil t) + ;; We do have a matching #+end line. + (setq beg-of-endline (match-beginning 0) + end-of-endline (match-end 0) + nl-before-endline (1- (match-beginning 0))) + (setq block-end (match-beginning 0)) ; Include the final newline. + (when quoting + (org-remove-flyspell-overlays-in bol-after-beginline nl-before-endline) + (remove-text-properties beg end-of-endline + '(display t invisible t intangible t))) + (add-text-properties + beg end-of-endline '(font-lock-fontified t font-lock-multiline t)) + (org-remove-flyspell-overlays-in beg bol-after-beginline) + (org-remove-flyspell-overlays-in nl-before-endline end-of-endline) + (cond + ((and lang (not (string= lang "")) org-src-fontify-natively) + (save-match-data + (org-src-font-lock-fontify-block lang block-start block-end)) + (add-text-properties bol-after-beginline block-end '(src-block t))) + (quoting + (add-text-properties + bol-after-beginline beg-of-endline + (list 'face + (list :inherit + (let ((face-name + (intern (format "org-block-%s" lang)))) + (append (and (facep face-name) (list face-name)) + '(org-block))))))) + ((not org-fontify-quote-and-verse-blocks)) + ((string= block-type "quote") + (add-face-text-property + bol-after-beginline beg-of-endline 'org-quote t)) + ((string= block-type "verse") + (add-face-text-property + bol-after-beginline beg-of-endline 'org-verse t))) + ;; Fontify the #+begin and #+end lines of the blocks + (add-text-properties + beg (if whole-blockline bol-after-beginline end-of-beginline) + '(face org-block-begin-line)) + (unless (eq (char-after beg-of-endline) ?*) + (add-text-properties + beg-of-endline + (if whole-blockline + (let ((beg-of-next-line (1+ end-of-endline))) + (min (point-max) beg-of-next-line)) + (min (point-max) end-of-endline)) + '(face org-block-end-line))) + t)) + ((member dc1 '("+title:" "+subtitle:" "+author:" "+email:" "+date:")) + (org-remove-flyspell-overlays-in + (match-beginning 0) + (if (equal "+title:" dc1) (match-end 2) (match-end 0))) + (add-text-properties + beg (match-end 3) + (if (member (intern (substring dc1 1 -1)) org-hidden-keywords) + '(font-lock-fontified t invisible t) + '(font-lock-fontified t face org-document-info-keyword))) + (add-text-properties + (match-beginning 6) (min (point-max) (1+ (match-end 6))) + (if (string-equal dc1 "+title:") + '(font-lock-fontified t face org-document-title) + '(font-lock-fontified t face org-document-info)))) + ((string-prefix-p "+caption" dc1) + (org-remove-flyspell-overlays-in (match-end 2) (match-end 0)) + (remove-text-properties (match-beginning 0) (match-end 0) + '(display t invisible t intangible t)) + ;; Handle short captions + (save-excursion + (beginning-of-line) + (looking-at (rx (group (zero-or-more (any " \t")) + "#+caption" + (optional "[" (zero-or-more any) "]") + ":") + (zero-or-more (any " \t"))))) + (add-text-properties (line-beginning-position) (match-end 1) + '(font-lock-fontified t face org-meta-line)) + (add-text-properties (match-end 0) (line-end-position) + '(font-lock-fontified t face org-block)) + t) + ((member dc3 '(" " "")) + ;; Just a comment, the plus was not there + (org-remove-flyspell-overlays-in beg (match-end 0)) + (add-text-properties + beg (match-end 0) + '(font-lock-fontified t face font-lock-comment-face))) + (t ;; Just any other in-buffer setting, but not indented + (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) + (remove-text-properties (match-beginning 0) (match-end 0) + '(display t invisible t intangible t)) + (add-text-properties beg (match-end 0) + '(font-lock-fontified t face org-meta-line)) + t)))))) + +(defun org-fontify-drawers (limit) + "Fontify drawers." + (when (re-search-forward org-drawer-regexp limit t) + (add-text-properties (1- (match-beginning 1)) (1+ (match-end 1)) + '(font-lock-fontified t face org-drawer)) + (org-remove-flyspell-overlays-in + (line-beginning-position) (line-beginning-position 2)) + t)) + +(defun org-fontify-macros (limit) + "Fontify macros." + (when (re-search-forward "{{{\\([a-zA-Z][-a-zA-Z0-9_]*\\)" limit t) + (let ((begin (match-beginning 0)) + (opening-end (match-beginning 1))) + (when (and (re-search-forward "\n[ \t]*\n\\|\\(}}}\\)" limit t) + (match-string 1)) + (let ((end (match-end 1)) + (closing-start (match-beginning 1))) + (add-text-properties + begin end + '(font-lock-multiline t font-lock-fontified t face org-macro)) + (org-remove-flyspell-overlays-in begin end) + (when org-hide-macro-markers + (add-text-properties begin opening-end '(invisible t)) + (add-text-properties closing-start end '(invisible t))) + t))))) + +(defun org-fontify-extend-region (beg end _old-len) + (let ((end (if (progn (goto-char end) (looking-at-p "^[*#]")) + (1+ end) end)) + (begin-re "\\(\\\\\\[\\|\\(#\\+begin_\\|\\\\begin{\\)\\S-+\\)") + (end-re "\\(\\\\\\]\\|\\(#\\+end_\\|\\\\end{\\)\\S-+\\)") + (extend + (lambda (r1 r2 dir) + (let ((re (replace-regexp-in-string + "\\(begin\\|end\\)" r1 + (replace-regexp-in-string + "[][]" r2 + (match-string-no-properties 0))))) + (re-search-forward (regexp-quote re) nil t dir))))) + (goto-char beg) + (back-to-indentation) + (save-match-data + (cond ((looking-at end-re) + (cons (or (funcall extend "begin" "[" -1) beg) end)) + ((looking-at begin-re) + (cons beg (or (funcall extend "end" "]" 1) end))) + (t (cons beg end)))))) + +(defun org-activate-footnote-links (limit) + "Add text properties for footnotes." + (let ((fn (org-footnote-next-reference-or-definition limit))) + (when fn + (let* ((beg (nth 1 fn)) + (end (nth 2 fn)) + (label (car fn)) + (referencep (/= (line-beginning-position) beg))) + (when (and referencep (nth 3 fn)) + (save-excursion + (goto-char beg) + (search-forward (or label "fn:")) + (org-remove-flyspell-overlays-in beg (match-end 0)))) + (add-text-properties beg end + (list 'mouse-face 'highlight + 'keymap org-mouse-map + 'help-echo + (if referencep "Footnote reference" + "Footnote definition") + 'font-lock-fontified t + 'font-lock-multiline t + 'face 'org-footnote)))))) + +(defun org-activate-dates (limit) + "Add text properties for dates." + (when (and (re-search-forward org-tsr-regexp-both limit t) + (not (equal (char-before (match-beginning 0)) 91))) + (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) + (add-text-properties (match-beginning 0) (match-end 0) + (list 'mouse-face 'highlight + 'keymap org-mouse-map)) + (org-rear-nonsticky-at (match-end 0)) + (when org-display-custom-times + ;; If it's a date range, activate custom time for second date. + (when (match-end 3) + (org-display-custom-time (match-beginning 3) (match-end 3))) + (org-display-custom-time (match-beginning 1) (match-end 1))) + t)) + +(defun org-activate-target-links (limit) + "Add text properties for target matches." + (when org-target-link-regexp + (let ((case-fold-search t)) + ;; `org-target-link-regexp' matches one character before the + ;; actual target. + (unless (bolp) (forward-char -1)) + (when (re-search-forward org-target-link-regexp limit t) + (org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1)) + (add-text-properties (match-beginning 1) (match-end 1) + (list 'mouse-face 'highlight + 'keymap org-mouse-map + 'help-echo "Radio target link" + 'org-linked-text t)) + (org-rear-nonsticky-at (match-end 1)) + t)))) + +(defvar org-latex-and-related-regexp nil + "Regular expression for highlighting LaTeX, entities and sub/superscript.") + +(defun org-compute-latex-and-related-regexp () + "Compute regular expression for LaTeX, entities and sub/superscript. +Result depends on variable `org-highlight-latex-and-related'." + (let ((re-sub + (cond ((not (memq 'script org-highlight-latex-and-related)) nil) + ((eq org-use-sub-superscripts '{}) + (list org-match-substring-with-braces-regexp)) + (org-use-sub-superscripts (list org-match-substring-regexp)))) + (re-latex + (when (or (memq 'latex org-highlight-latex-and-related) + (memq 'native org-highlight-latex-and-related)) + (let ((matchers (plist-get org-format-latex-options :matchers))) + (delq nil + (mapcar (lambda (x) + (and (member (car x) matchers) (nth 1 x))) + org-latex-regexps))))) + (re-entities + (when (memq 'entities org-highlight-latex-and-related) + (list "\\\\\\(there4\\|sup[123]\\|frac[13][24]\\|[a-zA-Z]+\\)\ +\\($\\|{}\\|[^[:alpha:]]\\)")))) + (setq-local org-latex-and-related-regexp + (mapconcat #'identity + (append re-latex re-entities re-sub) + "\\|")))) + +(defun org-do-latex-and-related (limit) + "Highlight LaTeX snippets and environments, entities and sub/superscript. +Stop at first highlighted object, if any. Return t if some +highlighting was done, nil otherwise." + (when (org-string-nw-p org-latex-and-related-regexp) + (let ((latex-prefix-re (rx (or "$" "\\(" "\\["))) + (blank-line-re (rx (and "\n" (zero-or-more (or " " "\t")) "\n")))) + (catch 'found + (while (and (< (point) limit) + (re-search-forward org-latex-and-related-regexp nil t)) + (cond + ((>= (match-beginning 0) limit) + (throw 'found nil)) + ((cl-some (lambda (f) + (memq f '(org-code org-verbatim underline + org-special-keyword))) + (save-excursion + (goto-char (1+ (match-beginning 0))) + (face-at-point nil t)))) + ;; Try to limit false positives. In this case, ignore + ;; $$...$$, \(...\), and \[...\] LaTeX constructs if they + ;; contain an empty line. + ((save-excursion + (goto-char (match-beginning 0)) + (and (looking-at-p latex-prefix-re) + (save-match-data + (re-search-forward blank-line-re (1- (match-end 0)) t))))) + (t + (let* ((offset (if (memq (char-after (1+ (match-beginning 0))) + '(?_ ?^)) + 1 + 0)) + (start (+ offset (match-beginning 0))) + (end (match-end 0))) + (if (memq 'native org-highlight-latex-and-related) + (org-src-font-lock-fontify-block "latex" start end) + (font-lock-prepend-text-property start end + 'face 'org-latex-and-related)) + (add-text-properties (+ offset (match-beginning 0)) (match-end 0) + '(font-lock-multiline t)) + (throw 'found t))))) + nil)))) + +(defun org-restart-font-lock () + "Restart `font-lock-mode', to force refontification." + (when font-lock-mode + (font-lock-mode -1) + (font-lock-mode 1))) + +(defun org-activate-tags (limit) + (when (re-search-forward org-tag-line-re limit t) + (org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1)) + (add-text-properties (match-beginning 1) (match-end 1) + (list 'mouse-face 'highlight + 'keymap org-mouse-map)) + (org-rear-nonsticky-at (match-end 1)) + t)) + +(defun org-outline-level () + "Compute the outline level of the heading at point. + +If this is called at a normal headline, the level is the number +of stars. Use `org-reduced-level' to remove the effect of +`org-odd-levels'. Unlike to `org-current-level', this function +takes into consideration inlinetasks." + (org-with-wide-buffer + (end-of-line) + (if (re-search-backward org-outline-regexp-bol nil t) + (1- (- (match-end 0) (match-beginning 0))) + 0))) + +(defvar org-font-lock-keywords nil) + +(defsubst org-re-property (property &optional literal allow-null value) + "Return a regexp matching a PROPERTY line. + +When optional argument LITERAL is non-nil, do not quote PROPERTY. +This is useful when PROPERTY is a regexp. When ALLOW-NULL is +non-nil, match properties even without a value. + +Match group 3 is set to the value when it exists. If there is no +value and ALLOW-NULL is non-nil, it is set to the empty string. + +With optional argument VALUE, match only property lines with +that value; in this case, ALLOW-NULL is ignored. VALUE is quoted +unless LITERAL is non-nil." + (concat + "^\\(?4:[ \t]*\\)" + (format "\\(?1::\\(?2:%s\\):\\)" + (if literal property (regexp-quote property))) + (cond (value + (format "[ \t]+\\(?3:%s\\)\\(?5:[ \t]*\\)$" + (if literal value (regexp-quote value)))) + (allow-null + "\\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$") + (t + "[ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$")))) + +(defconst org-property-re + (org-re-property "\\S-+" 'literal t) + "Regular expression matching a property line. +There are four matching groups: +1: :PROPKEY: including the leading and trailing colon, +2: PROPKEY without the leading and trailing colon, +3: PROPVAL without leading or trailing spaces, +4: the indentation of the current line, +5: trailing whitespace.") + +(defvar org-font-lock-hook nil + "Functions to be called for special font lock stuff.") + +(defvar org-font-lock-extra-keywords nil) ;Dynamically scoped. + +(defvar org-font-lock-set-keywords-hook nil + "Functions that can manipulate `org-font-lock-extra-keywords'. +This is called after `org-font-lock-extra-keywords' is defined, but before +it is installed to be used by font lock. This can be useful if something +needs to be inserted at a specific position in the font-lock sequence.") + +(defun org-font-lock-hook (limit) + "Run `org-font-lock-hook' within LIMIT." + (run-hook-with-args 'org-font-lock-hook limit)) + +(defun org-set-font-lock-defaults () + "Set font lock defaults for the current buffer." + (let ((org-font-lock-extra-keywords + (list + ;; Call the hook + '(org-font-lock-hook) + ;; Headlines + `(,(if org-fontify-whole-heading-line + "^\\(\\**\\)\\(\\* \\)\\(.*\n?\\)" + "^\\(\\**\\)\\(\\* \\)\\(.*\\)") + (1 (org-get-level-face 1)) + (2 (org-get-level-face 2)) + (3 (org-get-level-face 3))) + ;; Table lines + '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" + (1 'org-table t)) + ;; Table internals + '("^[ \t]*|\\(?:.*?|\\)? *\\(:?=[^|\n]*\\)" (1 'org-formula t)) + '("^[ \t]*| *\\([#*]\\) *|" (1 'org-formula t)) + '("^[ \t]*|\\( *\\([$!_^/]\\) *|.*\\)|" (1 'org-formula t)) + '("| *\\(<[lrc]?[0-9]*>\\)" (1 'org-formula t)) + ;; Properties + (list org-property-re + '(1 'org-special-keyword t) + '(3 'org-property-value t)) + ;; Drawers + '(org-fontify-drawers) + ;; Link related fontification. + '(org-activate-links) + (when (memq 'tag org-highlight-links) '(org-activate-tags (1 'org-tag prepend))) + (when (memq 'radio org-highlight-links) '(org-activate-target-links (1 'org-link t))) + (when (memq 'date org-highlight-links) '(org-activate-dates (0 'org-date t))) + (when (memq 'footnote org-highlight-links) '(org-activate-footnote-links)) + ;; Targets. + (list org-radio-target-regexp '(0 'org-target t)) + (list org-target-regexp '(0 'org-target t)) + ;; Diary sexps. + '("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t)) + ;; Macro + '(org-fontify-macros) + ;; TODO keyword + (list (format org-heading-keyword-regexp-format + org-todo-regexp) + '(2 (org-get-todo-face 2) prepend)) + ;; TODO + (when org-fontify-todo-headline + (list (format org-heading-keyword-regexp-format + (concat + "\\(?:" + (mapconcat 'regexp-quote org-not-done-keywords "\\|") + "\\)")) + '(2 'org-headline-todo prepend))) + ;; DONE + (when org-fontify-done-headline + (list (format org-heading-keyword-regexp-format + (concat + "\\(?:" + (mapconcat 'regexp-quote org-done-keywords "\\|") + "\\)")) + '(2 'org-headline-done prepend))) + ;; Priorities + '(org-font-lock-add-priority-faces) + ;; Tags + '(org-font-lock-add-tag-faces) + ;; Tags groups + (when (and org-group-tags org-tag-groups-alist) + (list (concat org-outline-regexp-bol ".+\\(:" + (regexp-opt (mapcar 'car org-tag-groups-alist)) + ":\\).*$") + '(1 'org-tag-group prepend))) + ;; Special keywords + (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) + (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) + (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) + (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t)) + ;; Emphasis + (when org-fontify-emphasized-text '(org-do-emphasis-faces)) + ;; Checkboxes + '("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)" + 1 'org-checkbox prepend) + (when (cdr (assq 'checkbox org-list-automatic-rules)) + '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" + (0 (org-get-checkbox-statistics-face) prepend))) + ;; Description list items + '("\\(?:^[ \t]*[-+]\\|^[ \t]+[*]\\)[ \t]+\\(.*?[ \t]+::\\)\\([ \t]+\\|$\\)" + 1 'org-list-dt prepend) + ;; Inline export snippets + '("\\(@@\\)\\([a-z-]+:\\).*?\\(@@\\)" + (1 'font-lock-comment-face t) + (2 'org-tag t) + (3 'font-lock-comment-face t)) + ;; ARCHIVEd headings + (list (concat + org-outline-regexp-bol + "\\(.*:" org-archive-tag ":.*\\)") + '(1 'org-archived prepend)) + ;; Specials + '(org-do-latex-and-related) + '(org-fontify-entities) + '(org-raise-scripts) + ;; Code + '(org-activate-code (1 'org-code t)) + ;; COMMENT + (list (format + "^\\*+\\(?: +%s\\)?\\(?: +\\[#[A-Z0-9]\\]\\)? +\\(?9:%s\\)\\(?: \\|$\\)" + org-todo-regexp + org-comment-string) + '(9 'org-special-keyword t)) + ;; Blocks and meta lines + '(org-fontify-meta-lines-and-blocks) + ;; Citations + '(org-cite-activate)))) + (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) + (run-hooks 'org-font-lock-set-keywords-hook) + ;; Now set the full font-lock-keywords + (setq-local org-font-lock-keywords org-font-lock-extra-keywords) + (setq-local font-lock-defaults + '(org-font-lock-keywords t nil nil backward-paragraph)) + (setq-local font-lock-extend-after-change-region-function + #'org-fontify-extend-region) + (kill-local-variable 'font-lock-keywords) + nil)) + +(defun org-toggle-pretty-entities () + "Toggle the composition display of entities as UTF8 characters." + (interactive) + (setq-local org-pretty-entities (not org-pretty-entities)) + (org-restart-font-lock) + (if org-pretty-entities + (message "Entities are now displayed as UTF8 characters") + (save-restriction + (widen) + (decompose-region (point-min) (point-max)) + (message "Entities are now displayed as plain text")))) + +(defvar-local org-custom-properties-overlays nil + "List of overlays used for custom properties.") + +(defun org-toggle-custom-properties-visibility () + "Display or hide properties in `org-custom-properties'." + (interactive) + (if org-custom-properties-overlays + (progn (mapc #'delete-overlay org-custom-properties-overlays) + (setq org-custom-properties-overlays nil)) + (when org-custom-properties + (org-with-wide-buffer + (goto-char (point-min)) + (let ((regexp (org-re-property (regexp-opt org-custom-properties) t t))) + (while (re-search-forward regexp nil t) + (let ((end (cdr (save-match-data (org-get-property-block))))) + (when (and end (< (point) end)) + ;; Hide first custom property in current drawer. + (let ((o (make-overlay (match-beginning 0) (1+ (match-end 0))))) + (overlay-put o 'invisible t) + (overlay-put o 'org-custom-property t) + (push o org-custom-properties-overlays)) + ;; Hide additional custom properties in the same drawer. + (while (re-search-forward regexp end t) + (let ((o (make-overlay (match-beginning 0) (1+ (match-end 0))))) + (overlay-put o 'invisible t) + (overlay-put o 'org-custom-property t) + (push o org-custom-properties-overlays))))) + ;; Each entry is limited to a single property drawer. + (outline-next-heading))))))) + +(defun org-fontify-entities (limit) + "Find an entity to fontify." + (let (ee) + (when org-pretty-entities + (catch 'match + ;; "\_ "-family is left out on purpose. Only the first one, + ;; i.e., "\_ ", could be fontified anyway, and it would be + ;; confusing when adding a second white space character. + (while (re-search-forward + "\\\\\\(there4\\|sup[123]\\|frac[13][24]\\|[a-zA-Z]+\\)\\($\\|{}\\|[^[:alpha:]\n]\\)" + limit t) + (when (and (not (org-at-comment-p)) + (setq ee (org-entity-get (match-string 1))) + (= (length (nth 6 ee)) 1)) + (let* ((end (if (equal (match-string 2) "{}") + (match-end 2) + (match-end 1)))) + (add-text-properties + (match-beginning 0) end + (list 'font-lock-fontified t)) + (compose-region (match-beginning 0) end + (nth 6 ee) nil) + (backward-char 1) + (throw 'match t)))) + nil)))) + +(defun org-fontify-like-in-org-mode (s &optional odd-levels) + "Fontify string S like in Org mode." + (with-temp-buffer + (insert s) + (let ((org-odd-levels-only odd-levels)) + (org-mode) + (org-font-lock-ensure) + (buffer-string)))) + +(defun org-get-level-face (n) + "Get the right face for match N in font-lock matching of headlines." + (let* ((org-l0 (- (match-end 2) (match-beginning 1) 1)) + (org-l (if org-odd-levels-only (1+ (/ org-l0 2)) org-l0)) + (org-f (if org-cycle-level-faces + (nth (% (1- org-l) org-n-level-faces) org-level-faces) + (nth (1- (min org-l org-n-level-faces)) org-level-faces)))) + (cond + ((eq n 1) (if org-hide-leading-stars 'org-hide org-f)) + ((eq n 2) org-f) + (t (unless org-level-color-stars-only org-f))))) + +(defun org-face-from-face-or-color (context inherit face-or-color) + "Create a face list that inherits INHERIT, but sets the foreground color. +When FACE-OR-COLOR is not a string, just return it." + (if (stringp face-or-color) + (list :inherit inherit + (cdr (assoc context org-faces-easy-properties)) + face-or-color) + face-or-color)) + +(defun org-get-todo-face (kwd) + "Get the right face for a TODO keyword KWD. +If KWD is a number, get the corresponding match group." + (when (numberp kwd) (setq kwd (match-string kwd))) + (or (org-face-from-face-or-color + 'todo 'org-todo (cdr (assoc kwd org-todo-keyword-faces))) + (and (member kwd org-done-keywords) 'org-done) + 'org-todo)) + +(defun org-get-priority-face (priority) + "Get the right face for PRIORITY. +PRIORITY is a character." + (or (org-face-from-face-or-color + 'priority 'org-priority (cdr (assq priority org-priority-faces))) + 'org-priority)) + +(defun org-get-tag-face (tag) + "Get the right face for TAG. +If TAG is a number, get the corresponding match group." + (let ((tag (if (wholenump tag) (match-string tag) tag))) + (or (org-face-from-face-or-color + 'tag 'org-tag (cdr (assoc tag org-tag-faces))) + 'org-tag))) + +(defvar org-priority-regexp) ; defined later in the file + +(defun org-font-lock-add-priority-faces (limit) + "Add the special priority faces." + (while (re-search-forward (concat "^\\*+" org-priority-regexp) limit t) + (let ((beg (match-beginning 1)) + (end (1+ (match-end 2)))) + (add-face-text-property + beg end + (org-get-priority-face (string-to-char (match-string 2)))) + (add-text-properties + beg end + (list 'font-lock-fontified t))))) + +(defun org-font-lock-add-tag-faces (limit) + "Add the special tag faces." + (when (and org-tag-faces org-tags-special-faces-re) + (while (re-search-forward org-tags-special-faces-re limit t) + (add-face-text-property + (match-beginning 1) + (match-end 1) + (org-get-tag-face 1)) + (add-text-properties (match-beginning 1) (match-end 1) + (list 'font-lock-fontified t)) + (backward-char 1)))) + +(defun org-unfontify-region (beg end &optional _maybe_loudly) + "Remove fontification and activation overlays from links." + (font-lock-default-unfontify-region beg end) + (let* ((buffer-undo-list t) + (inhibit-read-only t) (inhibit-point-motion-hooks t) + (inhibit-modification-hooks t) + deactivate-mark buffer-file-name buffer-file-truename) + (decompose-region beg end) + (remove-text-properties beg end + '(mouse-face t keymap t org-linked-text t + invisible t intangible t + org-emphasis t)) + (org-remove-font-lock-display-properties beg end))) + +(defconst org-script-display '(((raise -0.3) (height 0.7)) + ((raise 0.3) (height 0.7)) + ((raise -0.5)) + ((raise 0.5))) + "Display properties for showing superscripts and subscripts.") + +(defun org-remove-font-lock-display-properties (beg end) + "Remove specific display properties that have been added by font lock. +The will remove the raise properties that are used to show superscripts +and subscripts." + (let (next prop) + (while (< beg end) + (setq next (next-single-property-change beg 'display nil end) + prop (get-text-property beg 'display)) + (when (member prop org-script-display) + (put-text-property beg next 'display nil)) + (setq beg next)))) + +(defun org-raise-scripts (limit) + "Add raise properties to sub/superscripts." + (when (and org-pretty-entities org-pretty-entities-include-sub-superscripts + (re-search-forward + (if (eq org-use-sub-superscripts t) + org-match-substring-regexp + org-match-substring-with-braces-regexp) + limit t)) + (let* ((pos (point)) table-p comment-p + (mpos (match-beginning 3)) + (emph-p (get-text-property mpos 'org-emphasis)) + (link-p (get-text-property mpos 'mouse-face)) + (keyw-p (eq 'org-special-keyword (get-text-property mpos 'face)))) + (goto-char (point-at-bol)) + (setq table-p (looking-at-p org-table-dataline-regexp) + comment-p (looking-at-p "^[ \t]*#[ +]")) + (goto-char pos) + ;; Handle a_b^c + (when (member (char-after) '(?_ ?^)) (goto-char (1- pos))) + (unless (or comment-p emph-p link-p keyw-p) + (put-text-property (match-beginning 3) (match-end 0) + 'display + (if (equal (char-after (match-beginning 2)) ?^) + (nth (if table-p 3 1) org-script-display) + (nth (if table-p 2 0) org-script-display))) + (add-text-properties (match-beginning 2) (match-end 2) + (list 'invisible t)) + (when (and (eq (char-after (match-beginning 3)) ?{) + (eq (char-before (match-end 3)) ?})) + (add-text-properties (match-beginning 3) (1+ (match-beginning 3)) + (list 'invisible t)) + (add-text-properties (1- (match-end 3)) (match-end 3) + (list 'invisible t)))) + t))) + +(defun org-remove-empty-overlays-at (pos) + "Remove outline overlays that do not contain non-white stuff." + (dolist (o (overlays-at pos)) + (and (eq 'outline (overlay-get o 'invisible)) + (not (string-match-p + "\\S-" (buffer-substring (overlay-start o) + (overlay-end o)))) + (delete-overlay o)))) + +(defun org-show-empty-lines-in-parent () + "Move to the parent and re-show empty lines before visible headlines." + (save-excursion + (let ((context (if (org-up-heading-safe) 'children 'overview))) + (org-cycle-show-empty-lines context)))) + +(defun org-files-list () + "Return `org-agenda-files' list, plus all open Org files. +This is useful for operations that need to scan all of a user's +open and agenda-wise Org files." + (let ((files (mapcar #'expand-file-name (org-agenda-files)))) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (when (and (derived-mode-p 'org-mode) (buffer-file-name)) + (cl-pushnew (expand-file-name (buffer-file-name)) files + :test #'equal)))) + files)) + +(defsubst org-entry-beginning-position () + "Return the beginning position of the current entry." + (save-excursion (org-back-to-heading t) (point))) + +(defsubst org-entry-end-position () + "Return the end position of the current entry." + (save-excursion (outline-next-heading) (point))) + +(defun org-subtree-end-visible-p () + "Is the end of the current subtree visible?" + (pos-visible-in-window-p + (save-excursion (org-end-of-subtree t) (point)))) + +(defun org-first-headline-recenter () + "Move cursor to the first headline and recenter the headline." + (let ((window (get-buffer-window))) + (when window + (goto-char (point-min)) + (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t) + (set-window-start window (line-beginning-position)))))) + + +;;; Visibility (headlines, blocks, drawers) + +;;;; Headlines visibility + +(defun org-show-entry () + "Show the body directly following its heading. +Show the heading too, if it is currently invisible." + (interactive) + (save-excursion + (org-back-to-heading-or-point-min t) + (org-flag-region + (line-end-position 0) + (save-excursion + (if (re-search-forward + (concat "[\r\n]\\(" org-outline-regexp "\\)") nil t) + (match-beginning 1) + (point-max))) + nil + 'outline) + (org-cycle-hide-drawers 'children))) + +(defun org-hide-entry () + "Hide the body directly following its heading." + (interactive) + (save-excursion + (org-back-to-heading-or-point-min t) + (when (org-at-heading-p) (forward-line)) + (org-flag-region + (line-end-position 0) + (save-excursion + (if (re-search-forward + (concat "[\r\n]" org-outline-regexp) nil t) + (line-end-position 0) + (point-max))) + t + 'outline))) + +(defun org-show-children (&optional level) + "Show all direct subheadings of this heading. +Prefix arg LEVEL is how many levels below the current level +should be shown. Default is enough to cause the following +heading to appear." + (interactive "p") + (unless (org-before-first-heading-p) + (save-excursion + (org-with-limited-levels (org-back-to-heading t)) + (let* ((current-level (funcall outline-level)) + (max-level (org-get-valid-level + current-level + (if level (prefix-numeric-value level) 1))) + (end (save-excursion (org-end-of-subtree t t))) + (regexp-fmt "^\\*\\{%d,%s\\}\\(?: \\|$\\)") + (past-first-child nil) + ;; Make sure to skip inlinetasks. + (re (format regexp-fmt + current-level + (cond + ((not (featurep 'org-inlinetask)) "") + (org-odd-levels-only (- (* 2 org-inlinetask-min-level) + 3)) + (t (1- org-inlinetask-min-level)))))) + ;; Display parent heading. + (org-flag-heading nil) + (forward-line) + ;; Display children. First child may be deeper than expected + ;; MAX-LEVEL. Since we want to display it anyway, adjust + ;; MAX-LEVEL accordingly. + (while (re-search-forward re end t) + (unless past-first-child + (setq re (format regexp-fmt + current-level + (max (funcall outline-level) max-level))) + (setq past-first-child t)) + (org-flag-heading nil)))))) + +(defun org-show-subtree () + "Show everything after this heading at deeper levels." + (interactive) + (org-flag-region + (point) (save-excursion (org-end-of-subtree t t)) nil 'outline)) + +;;;; Blocks and drawers visibility + +(defun org--hide-wrapper-toggle (element category force no-error) + "Toggle visibility for ELEMENT. + +ELEMENT is a block or drawer type parsed element. CATEGORY is +either `block' or `drawer'. When FORCE is `off', show the block +or drawer. If it is non-nil, hide it unconditionally. Throw an +error when not at a block or drawer, unless NO-ERROR is non-nil. + +Return a non-nil value when toggling is successful." + (let ((type (org-element-type element))) + (cond + ((memq type + (pcase category + (`drawer '(drawer property-drawer)) + (`block '(center-block + comment-block dynamic-block example-block export-block + quote-block special-block src-block verse-block)) + (_ (error "Unknown category: %S" category)))) + (let* ((post (org-element-property :post-affiliated element)) + (start (save-excursion + (goto-char post) + (line-end-position))) + (end (save-excursion + (goto-char (org-element-property :end element)) + (skip-chars-backward " \t\n") + (line-end-position)))) + ;; Do nothing when not before or at the block opening line or + ;; at the block closing line. + (unless (let ((eol (line-end-position))) + (and (> eol start) (/= eol end))) + (let* ((spec (if (eq category 'block) 'org-hide-block 'outline)) + (flag + (cond ((eq force 'off) nil) + (force t) + ((eq spec (get-char-property start 'invisible)) nil) + (t t)))) + (org-flag-region start end flag spec)) + ;; When the block is hidden away, make sure point is left in + ;; a visible part of the buffer. + (when (invisible-p (max (1- (point)) (point-min))) + (goto-char post)) + ;; Signal success. + t))) + (no-error nil) + (t + (user-error (if (eq category 'drawer) + "Not at a drawer" + "Not at a block")))))) + +(defun org-hide-block-toggle (&optional force no-error element) + "Toggle the visibility of the current block. + +When optional argument FORCE is `off', make block visible. If it +is non-nil, hide it unconditionally. Throw an error when not at +a block, unless NO-ERROR is non-nil. When optional argument +ELEMENT is provided, consider it instead of the current block. + +Return a non-nil value when toggling is successful." + (interactive) + (org--hide-wrapper-toggle + (or element (org-element-at-point)) 'block force no-error)) + +(defun org-hide-drawer-toggle (&optional force no-error element) + "Toggle the visibility of the current drawer. + +When optional argument FORCE is `off', make drawer visible. If +it is non-nil, hide it unconditionally. Throw an error when not +at a drawer, unless NO-ERROR is non-nil. When optional argument +ELEMENT is provided, consider it instead of the current drawer. + +Return a non-nil value when toggling is successful." + (interactive) + (org--hide-wrapper-toggle + (or element (org-element-at-point)) 'drawer force no-error)) + +(defun org-hide-block-all () + "Fold all blocks in the current buffer." + (interactive) + (org-show-all '(blocks)) + (org-block-map 'org-hide-block-toggle)) + +(defun org-hide-drawer-all () + "Fold all drawers in the current buffer." + (let ((begin (point-min)) + (end (point-max))) + (org--hide-drawers begin end))) + +(defun org-cycle-hide-drawers (state) + "Re-hide all drawers after a visibility state change. +STATE should be one of the symbols listed in the docstring of +`org-cycle-hook'." + (when (derived-mode-p 'org-mode) + (cond ((not (memq state '(overview folded contents))) + (let* ((global? (eq state 'all)) + (beg (if global? (point-min) (line-beginning-position))) + (end (cond (global? (point-max)) + ((eq state 'children) (org-entry-end-position)) + (t (save-excursion (org-end-of-subtree t t)))))) + (org--hide-drawers beg end))) + ((memq state '(overview contents)) + ;; Hide drawers before first heading. + (let ((beg (point-min)) + (end (save-excursion + (goto-char (point-min)) + (if (org-before-first-heading-p) + (org-entry-end-position) + (point-min))))) + (when (< beg end) + (org--hide-drawers beg end))))))) + +(defun org--hide-drawers (begin end) + "Hide all drawers between BEGIN and END." + (save-excursion + (goto-char begin) + (while (re-search-forward org-drawer-regexp end t) + (let* ((pair (get-char-property-and-overlay (line-beginning-position) + 'invisible)) + (o (cdr-safe pair))) + (if (overlayp o) (goto-char (overlay-end o)) ;invisible drawer + (pcase (get-char-property-and-overlay (point) 'invisible) + (`(outline . ,o) (goto-char (overlay-end o))) ;already folded + (_ + (let* ((drawer (org-element-at-point)) + (type (org-element-type drawer))) + (when (memq type '(drawer property-drawer)) + (org-hide-drawer-toggle t nil drawer) + ;; Make sure to skip drawer entirely or we might flag it + ;; another time when matching its ending line with + ;; `org-drawer-regexp'. + (goto-char (org-element-property :end drawer))))))))))) + +;;;; Visibility cycling + +(defvar-local org-cycle-global-status nil) +(put 'org-cycle-global-status 'org-state t) +(defvar-local org-cycle-subtree-status nil) +(put 'org-cycle-subtree-status 'org-state t) + +(defun org-show-all (&optional types) + "Show all contents in the visible part of the buffer. +By default, the function expands headings, blocks and drawers. +When optional argument TYPE is a list of symbols among `blocks', +`drawers' and `headings', to only expand one specific type." + (interactive) + (let ((types (or types '(blocks drawers headings)))) + (when (memq 'blocks types) + (org-flag-region (point-min) (point-max) nil 'org-hide-block)) + (cond + ;; Fast path. Since headings and drawers share the same + ;; invisible spec, clear everything in one go. + ((and (memq 'headings types) + (memq 'drawers types)) + (org-flag-region (point-min) (point-max) nil 'outline)) + ((memq 'headings types) + (org-flag-region (point-min) (point-max) nil 'outline) + (org-cycle-hide-drawers 'all)) + ((memq 'drawers types) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward org-drawer-regexp nil t) + (let* ((pair (get-char-property-and-overlay (line-beginning-position) + 'invisible)) + (o (cdr-safe pair))) + (if (overlayp o) (goto-char (overlay-end o)) + (pcase (get-char-property-and-overlay (point) 'invisible) + (`(outline . ,o) + (goto-char (overlay-end o)) + (delete-overlay o)) + (_ nil)))))))))) + +;;;###autoload +(defun org-cycle (&optional arg) + "TAB-action and visibility cycling for Org mode. + +This is the command invoked in Org mode by the `TAB' key. Its main +purpose is outline visibility cycling, but it also invokes other actions +in special contexts. + +When this function is called with a `\\[universal-argument]' prefix, rotate \ +the entire +buffer through 3 states (global cycling) + 1. OVERVIEW: Show only top-level headlines. + 2. CONTENTS: Show all headlines of all levels, but no body text. + 3. SHOW ALL: Show everything. + +With a `\\[universal-argument] \\[universal-argument]' prefix argument, \ +switch to the startup visibility, +determined by the variable `org-startup-folded', and by any VISIBILITY +properties in the buffer. + +With a `\\[universal-argument] \\[universal-argument] \ +\\[universal-argument]' prefix argument, show the entire buffer, including +any drawers. + +When inside a table, re-align the table and move to the next field. + +When point is at the beginning of a headline, rotate the subtree started +by this line through 3 different states (local cycling) + 1. FOLDED: Only the main headline is shown. + 2. CHILDREN: The main headline and the direct children are shown. + From this state, you can move to one of the children + and zoom in further. + 3. SUBTREE: Show the entire subtree, including body text. +If there is no subtree, switch directly from CHILDREN to FOLDED. + +When point is at the beginning of an empty headline and the variable +`org-cycle-level-after-item/entry-creation' is set, cycle the level +of the headline by demoting and promoting it to likely levels. This +speeds up creation document structure by pressing `TAB' once or several +times right after creating a new headline. + +When there is a numeric prefix, go up to a heading with level ARG, do +a `show-subtree' and return to the previous cursor position. If ARG +is negative, go up that many levels. + +When point is not at the beginning of a headline, execute the global +binding for `TAB', which is re-indenting the line. See the option +`org-cycle-emulate-tab' for details. + +As a special case, if point is at the very beginning of the buffer, if +there is no headline there, and if the variable `org-cycle-global-at-bob' +is non-nil, this function acts as if called with prefix argument \ +\(`\\[universal-argument] TAB', +same as `S-TAB') also when called without prefix argument." + (interactive "P") + (org-load-modules-maybe) + (unless (or (run-hook-with-args-until-success 'org-tab-first-hook) + (and org-cycle-level-after-item/entry-creation + (or (org-cycle-level) + (org-cycle-item-indentation)))) + (let* ((limit-level + (or org-cycle-max-level + (and (boundp 'org-inlinetask-min-level) + org-inlinetask-min-level + (1- org-inlinetask-min-level)))) + (nstars + (and limit-level + (if org-odd-levels-only + (1- (* 2 limit-level)) + limit-level))) + (org-outline-regexp + (format "\\*%s " (if nstars (format "\\{1,%d\\}" nstars) "+")))) + (cond + ((equal arg '(16)) + (setq last-command 'dummy) + (org-set-startup-visibility) + (org-unlogged-message "Startup visibility, plus VISIBILITY properties")) + ((equal arg '(64)) + (org-show-all) + (org-unlogged-message "Entire buffer visible, including drawers")) + ((equal arg '(4)) (org-cycle-internal-global)) + ;; Show-subtree, ARG levels up from here. + ((integerp arg) + (save-excursion + (org-back-to-heading) + (outline-up-heading (if (< arg 0) (- arg) + (- (funcall outline-level) arg))) + (org-show-subtree))) + ;; Global cycling at BOB: delegate to `org-cycle-internal-global'. + ((and org-cycle-global-at-bob + (bobp) + (not (looking-at org-outline-regexp))) + (let ((org-cycle-hook + (remq 'org-optimize-window-after-visibility-change + org-cycle-hook))) + (org-cycle-internal-global))) + ;; Try CDLaTeX TAB completion. + ((org-try-cdlatex-tab)) + ;; Inline task: delegate to `org-inlinetask-toggle-visibility'. + ((and (featurep 'org-inlinetask) + (org-inlinetask-at-task-p) + (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol)))) + (org-inlinetask-toggle-visibility)) + (t + (let ((pos (point)) + (element (org-element-at-point))) + (cond + ;; Try toggling visibility for block at point. + ((org-hide-block-toggle nil t element)) + ;; Try toggling visibility for drawer at point. + ((org-hide-drawer-toggle nil t element)) + ;; Table: enter it or move to the next field. + ((and (org-match-line "[ \t]*[|+]") + (org-element-lineage element '(table) t)) + (if (and (eq 'table (org-element-type element)) + (eq 'table.el (org-element-property :type element))) + (message (substitute-command-keys "\\<org-mode-map>\ +Use `\\[org-edit-special]' to edit table.el tables")) + (org-table-justify-field-maybe) + (call-interactively #'org-table-next-field))) + ((run-hook-with-args-until-success + 'org-tab-after-check-for-table-hook)) + ;; At an item/headline: delegate to `org-cycle-internal-local'. + ((and (or (and org-cycle-include-plain-lists + (let ((item (org-element-lineage element + '(item plain-list) + t))) + (and item + (= (line-beginning-position) + (org-element-property :post-affiliated + item))))) + (org-match-line org-outline-regexp)) + (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol)))) + (org-cycle-internal-local)) + ;; From there: TAB emulation and template completion. + (buffer-read-only (org-back-to-heading)) + ((run-hook-with-args-until-success + 'org-tab-after-check-for-cycling-hook)) + ((run-hook-with-args-until-success + 'org-tab-before-tab-emulation-hook)) + ((and (eq org-cycle-emulate-tab 'exc-hl-bol) + (or (not (bolp)) + (not (looking-at org-outline-regexp)))) + (call-interactively (global-key-binding (kbd "TAB")))) + ((or (eq org-cycle-emulate-tab t) + (and (memq org-cycle-emulate-tab '(white whitestart)) + (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")) + (or (and (eq org-cycle-emulate-tab 'white) + (= (match-end 0) (point-at-eol))) + (and (eq org-cycle-emulate-tab 'whitestart) + (>= (match-end 0) pos))))) + (call-interactively (global-key-binding (kbd "TAB")))) + (t + (save-excursion + (org-back-to-heading) + (org-cycle)))))))))) + +(defun org-cycle-internal-global () + "Do the global cycling action." + ;; Hack to avoid display of messages for .org attachments in Gnus + (let ((ga (string-match-p "\\*fontification" (buffer-name)))) + (cond + ((and (eq last-command this-command) + (eq org-cycle-global-status 'overview)) + ;; We just created the overview - now do table of contents + ;; This can be slow in very large buffers, so indicate action + (run-hook-with-args 'org-pre-cycle-hook 'contents) + (unless ga (org-unlogged-message "CONTENTS...")) + (org-content) + (unless ga (org-unlogged-message "CONTENTS...done")) + (setq org-cycle-global-status 'contents) + (run-hook-with-args 'org-cycle-hook 'contents)) + + ((and (eq last-command this-command) + (eq org-cycle-global-status 'contents)) + ;; We just showed the table of contents - now show everything + (run-hook-with-args 'org-pre-cycle-hook 'all) + (org-show-all '(headings blocks)) + (unless ga (org-unlogged-message "SHOW ALL")) + (setq org-cycle-global-status 'all) + (run-hook-with-args 'org-cycle-hook 'all)) + + (t + ;; Default action: go to overview + (run-hook-with-args 'org-pre-cycle-hook 'overview) + (org-overview) + (unless ga (org-unlogged-message "OVERVIEW")) + (setq org-cycle-global-status 'overview) + (run-hook-with-args 'org-cycle-hook 'overview))))) + +(defvar org-called-with-limited-levels nil + "Non-nil when `org-with-limited-levels' is currently active.") + +(defun org-cycle-internal-local () + "Do the local cycling action." + (let ((goal-column 0) eoh eol eos has-children children-skipped struct) + ;; First, determine end of headline (EOH), end of subtree or item + ;; (EOS), and if item or heading has children (HAS-CHILDREN). + (save-excursion + (if (org-at-item-p) + (progn + (beginning-of-line) + (setq struct (org-list-struct)) + (setq eoh (point-at-eol)) + (setq eos (org-list-get-item-end-before-blank (point) struct)) + (setq has-children (org-list-has-child-p (point) struct))) + (org-back-to-heading) + (setq eoh (save-excursion (outline-end-of-heading) (point))) + (setq eos (save-excursion + (org-end-of-subtree t t) + (unless (eobp) (forward-char -1)) + (point))) + (setq has-children + (or + (save-excursion + (let ((level (funcall outline-level))) + (outline-next-heading) + (and (org-at-heading-p t) + (> (funcall outline-level) level)))) + (and (eq org-cycle-include-plain-lists 'integrate) + (save-excursion + (org-list-search-forward (org-item-beginning-re) eos t)))))) + ;; Determine end invisible part of buffer (EOL) + (beginning-of-line 2) + (while (and (not (eobp)) ;this is like `next-line' + (get-char-property (1- (point)) 'invisible)) + (goto-char (next-single-char-property-change (point) 'invisible)) + (and (eolp) (beginning-of-line 2))) + (setq eol (point))) + ;; Find out what to do next and set `this-command' + (cond + ((= eos eoh) + ;; Nothing is hidden behind this heading + (unless (org-before-first-heading-p) + (run-hook-with-args 'org-pre-cycle-hook 'empty)) + (org-unlogged-message "EMPTY ENTRY") + (setq org-cycle-subtree-status nil) + (save-excursion + (goto-char eos) + (outline-next-heading) + (when (org-invisible-p) (org-flag-heading nil)))) + ((and (or (>= eol eos) + (not (string-match "\\S-" (buffer-substring eol eos)))) + (or has-children + (not (setq children-skipped + org-cycle-skip-children-state-if-no-children)))) + ;; Entire subtree is hidden in one line: children view + (unless (org-before-first-heading-p) + (run-hook-with-args 'org-pre-cycle-hook 'children)) + (if (org-at-item-p) + (org-list-set-item-visibility (point-at-bol) struct 'children) + (org-show-entry) + (org-with-limited-levels (org-show-children)) + (org-show-set-visibility 'tree) + ;; Fold every list in subtree to top-level items. + (when (eq org-cycle-include-plain-lists 'integrate) + (save-excursion + (org-back-to-heading) + (while (org-list-search-forward (org-item-beginning-re) eos t) + (beginning-of-line 1) + (let* ((struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (end (org-list-get-bottom-point struct))) + (dolist (e (org-list-get-all-items (point) struct prevs)) + (org-list-set-item-visibility e struct 'folded)) + (goto-char (if (< end eos) end eos))))))) + (org-unlogged-message "CHILDREN") + (save-excursion + (goto-char eos) + (outline-next-heading) + (when (org-invisible-p) (org-flag-heading nil))) + (setq org-cycle-subtree-status 'children) + (unless (org-before-first-heading-p) + (run-hook-with-args 'org-cycle-hook 'children))) + ((or children-skipped + (and (eq last-command this-command) + (eq org-cycle-subtree-status 'children))) + ;; We just showed the children, or no children are there, + ;; now show everything. + (unless (org-before-first-heading-p) + (run-hook-with-args 'org-pre-cycle-hook 'subtree)) + (org-flag-region eoh eos nil 'outline) + (org-unlogged-message + (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE")) + (setq org-cycle-subtree-status 'subtree) + (unless (org-before-first-heading-p) + (run-hook-with-args 'org-cycle-hook 'subtree))) + (t + ;; Default action: hide the subtree. + (run-hook-with-args 'org-pre-cycle-hook 'folded) + (org-flag-region eoh eos t 'outline) + (org-unlogged-message "FOLDED") + (setq org-cycle-subtree-status 'folded) + (unless (org-before-first-heading-p) + (run-hook-with-args 'org-cycle-hook 'folded)))))) + +;;;###autoload +(defun org-global-cycle (&optional arg) + "Cycle the global visibility. For details see `org-cycle'. +With `\\[universal-argument]' prefix ARG, switch to startup visibility. +With a numeric prefix, show all headlines up to that level." + (interactive "P") + (cond + ((integerp arg) + (org-content arg) + (setq org-cycle-global-status 'contents)) + ((equal arg '(4)) + (org-set-startup-visibility) + (org-unlogged-message "Startup visibility, plus VISIBILITY properties.")) + (t + (org-cycle '(4))))) + +(defun org-set-startup-visibility () + "Set the visibility required by startup options and properties." + (cond + ((eq org-startup-folded t) + (org-overview)) + ((eq org-startup-folded 'content) + (org-content)) + ((eq org-startup-folded 'show2levels) + (org-content 2)) + ((eq org-startup-folded 'show3levels) + (org-content 3)) + ((eq org-startup-folded 'show4levels) + (org-content 4)) + ((eq org-startup-folded 'show5levels) + (org-content 5)) + ((or (eq org-startup-folded 'showeverything) + (eq org-startup-folded nil)) + (org-show-all))) + (unless (eq org-startup-folded 'showeverything) + (when org-hide-block-startup (org-hide-block-all)) + (org-set-visibility-according-to-property) + (org-cycle-hide-archived-subtrees 'all) + (org-cycle-hide-drawers 'all) + (org-cycle-show-empty-lines t))) + +(defun org-set-visibility-according-to-property () + "Switch subtree visibility according to VISIBILITY property." + (interactive) + (let ((regexp (org-re-property "VISIBILITY"))) + (org-with-point-at 1 + (while (re-search-forward regexp nil t) + (let ((state (match-string 3))) + (if (not (org-at-property-p)) (outline-next-heading) + (save-excursion + (org-back-to-heading t) + (org-flag-subtree t) + (org-reveal) + (pcase state + ("folded" + (org-flag-subtree t)) + ("children" + (org-show-hidden-entry) + (org-show-children)) + ("content" + (save-excursion + (save-restriction + (org-narrow-to-subtree) + (org-content)))) + ((or "all" "showall") + (outline-show-subtree)) + (_ nil))) + (org-end-of-subtree))))))) + +(defun org-overview () + "Switch to overview mode, showing only top-level headlines." + (interactive) + (org-show-all '(headings drawers)) + (save-excursion + (goto-char (point-min)) + (when (re-search-forward org-outline-regexp-bol nil t) + (let* ((last (line-end-position)) + (level (- (match-end 0) (match-beginning 0) 1)) + (regexp (format "^\\*\\{1,%d\\} " level))) + (while (re-search-forward regexp nil :move) + (org-flag-region last (line-end-position 0) t 'outline) + (setq last (line-end-position)) + (setq level (- (match-end 0) (match-beginning 0) 1)) + (setq regexp (format "^\\*\\{1,%d\\} " level))) + (org-flag-region last (point) t 'outline))))) + +(defun org-content (&optional arg) + "Show all headlines in the buffer, like a table of contents. +With numerical argument N, show content up to level N." + (interactive "p") + (org-show-all '(headings drawers)) + (save-excursion + (goto-char (point-max)) + (let ((regexp (if (and (wholenump arg) (> arg 0)) + (format "^\\*\\{1,%d\\} " arg) + "^\\*+ ")) + (last (point))) + (while (re-search-backward regexp nil t) + (org-flag-region (line-end-position) last t 'outline) + (setq last (line-end-position 0)))))) + +(defvar org-scroll-position-to-restore nil + "Temporarily store scroll position to restore.") +(defun org-optimize-window-after-visibility-change (state) + "Adjust the window after a change in outline visibility. +This function is the default value of the hook `org-cycle-hook'." + (when (get-buffer-window (current-buffer)) + (let ((repeat (eq last-command this-command))) + (unless repeat + (setq org-scroll-position-to-restore nil)) + (cond + ((eq state 'content) nil) + ((eq state 'all) nil) + ((and org-scroll-position-to-restore repeat + (eq state 'folded)) + (set-window-start nil org-scroll-position-to-restore)) + ((eq state 'folded) nil) + ((eq state 'children) + (setq org-scroll-position-to-restore (window-start)) + (or (org-subtree-end-visible-p) (recenter 1))) + ((eq state 'subtree) + (unless repeat + (setq org-scroll-position-to-restore (window-start))) + (or (org-subtree-end-visible-p) (recenter 1))))))) + +(defun org-clean-visibility-after-subtree-move () + "Fix visibility issues after moving a subtree." + ;; First, find a reasonable region to look at: + ;; Start two siblings above, end three below + (let* ((beg (save-excursion + (and (org-get-previous-sibling) + (org-get-previous-sibling)) + (point))) + (end (save-excursion + (and (org-get-next-sibling) + (org-get-next-sibling) + (org-get-next-sibling)) + (if (org-at-heading-p) + (point-at-eol) + (point)))) + (level (looking-at "\\*+")) + (re (when level (concat "^" (regexp-quote (match-string 0)) " ")))) + (save-excursion + (save-restriction + (narrow-to-region beg end) + (when re + ;; Properly fold already folded siblings + (goto-char (point-min)) + (while (re-search-forward re nil t) + (when (and (not (org-invisible-p)) + (org-invisible-p (line-end-position))) + (outline-hide-entry)))) + (org-cycle-hide-drawers 'all) + (org-cycle-show-empty-lines 'overview))))) + +(defun org-cycle-show-empty-lines (state) + "Show empty lines above all visible headlines. +The region to be covered depends on STATE when called through +`org-cycle-hook'. Lisp program can use t for STATE to get the +entire buffer covered. Note that an empty line is only shown if there +are at least `org-cycle-separator-lines' empty lines before the headline." + (when (/= org-cycle-separator-lines 0) + (save-excursion + (let* ((n (abs org-cycle-separator-lines)) + (re (cond + ((= n 1) "\\(\n[ \t]*\n\\*+\\) ") + ((= n 2) "^[ \t]*\\(\n[ \t]*\n\\*+\\) ") + (t (let ((ns (number-to-string (- n 2)))) + (concat "^\\(?:[ \t]*\n\\)\\{" ns "," ns "\\}" + "[ \t]*\\(\n[ \t]*\n\\*+\\) "))))) + beg end) + (cond + ((memq state '(overview contents t)) + (setq beg (point-min) end (point-max))) + ((memq state '(children folded)) + (setq beg (point) + end (progn (org-end-of-subtree t t) + (line-beginning-position 2))))) + (when beg + (goto-char beg) + (while (re-search-forward re end t) + (unless (get-char-property (match-end 1) 'invisible) + (let ((e (match-end 1)) + (b (if (>= org-cycle-separator-lines 0) + (match-beginning 1) + (save-excursion + (goto-char (match-beginning 0)) + (skip-chars-backward " \t\n") + (line-end-position))))) + (org-flag-region b e nil 'outline)))))))) + ;; Never hide empty lines at the end of the file. + (save-excursion + (goto-char (point-max)) + (outline-previous-heading) + (outline-end-of-heading) + (when (and (looking-at "[ \t\n]+") + (= (match-end 0) (point-max))) + (org-flag-region (point) (match-end 0) nil 'outline)))) + +;;;; Reveal point location + +(defun org-show-context (&optional key) + "Make sure point and context are visible. +Optional argument KEY, when non-nil, is a symbol. See +`org-show-context-detail' for allowed values and how much is to +be shown." + (org-show-set-visibility + (cond ((symbolp org-show-context-detail) org-show-context-detail) + ((cdr (assq key org-show-context-detail))) + (t (cdr (assq 'default org-show-context-detail)))))) + +(defun org-show-set-visibility (detail) + "Set visibility around point according to DETAIL. +DETAIL is either nil, `minimal', `local', `ancestors', +`ancestors-full', `lineage', `tree', `canonical' or t. See +`org-show-context-detail' for more information." + ;; Show current heading and possibly its entry, following headline + ;; or all children. + (if (and (org-at-heading-p) (not (eq detail 'local))) + (org-flag-heading nil) + (org-show-entry) + ;; If point is hidden within a drawer or a block, make sure to + ;; expose it. + (dolist (o (overlays-at (point))) + (when (memq (overlay-get o 'invisible) '(org-hide-block outline)) + (delete-overlay o))) + (unless (org-before-first-heading-p) + (org-with-limited-levels + (cl-case detail + ((tree canonical t) (org-show-children)) + ((nil minimal ancestors ancestors-full)) + (t (save-excursion + (outline-next-heading) + (org-flag-heading nil))))))) + ;; Show whole subtree. + (when (eq detail 'ancestors-full) (org-show-subtree)) + ;; Show all siblings. + (when (eq detail 'lineage) (org-show-siblings)) + ;; Show ancestors, possibly with their children. + (when (memq detail '(ancestors ancestors-full lineage tree canonical t)) + (save-excursion + (while (org-up-heading-safe) + (org-flag-heading nil) + (when (memq detail '(canonical t)) (org-show-entry)) + (when (memq detail '(tree canonical t)) (org-show-children)))))) + +(defvar org-reveal-start-hook nil + "Hook run before revealing a location.") + +(defun org-reveal (&optional siblings) + "Show current entry, hierarchy above it, and the following headline. + +This can be used to show a consistent set of context around +locations exposed with `org-show-context'. + +With optional argument SIBLINGS, on each level of the hierarchy all +siblings are shown. This repairs the tree structure to what it would +look like when opened with hierarchical calls to `org-cycle'. + +With a \\[universal-argument] \\[universal-argument] prefix, \ +go to the parent and show the entire tree." + (interactive "P") + (run-hooks 'org-reveal-start-hook) + (cond ((equal siblings '(4)) (org-show-set-visibility 'canonical)) + ((equal siblings '(16)) + (save-excursion + (when (org-up-heading-safe) + (org-show-subtree) + (run-hook-with-args 'org-cycle-hook 'subtree)))) + (t (org-show-set-visibility 'lineage)))) + + +;;; Indirect buffer display of subtrees + +(defvar org-indirect-dedicated-frame nil + "This is the frame being used for indirect tree display.") +(defvar org-last-indirect-buffer nil) + +(defun org-tree-to-indirect-buffer (&optional arg) + "Create indirect buffer and narrow it to current subtree. + +With a numerical prefix ARG, go up to this level and then take that tree. +If ARG is negative, go up that many levels. + +If `org-indirect-buffer-display' is not `new-frame', the command removes the +indirect buffer previously made with this command, to avoid proliferation of +indirect buffers. However, when you call the command with a \ +`\\[universal-argument]' prefix, or +when `org-indirect-buffer-display' is `new-frame', the last buffer is kept +so that you can work with several indirect buffers at the same time. If +`org-indirect-buffer-display' is `dedicated-frame', the \ +`\\[universal-argument]' prefix also +requests that a new frame be made for the new buffer, so that the dedicated +frame is not changed." + (interactive "P") + (let ((cbuf (current-buffer)) + (cwin (selected-window)) + (pos (point)) + beg end level heading ibuf) + (save-excursion + (org-back-to-heading t) + (when (numberp arg) + (setq level (org-outline-level)) + (when (< arg 0) (setq arg (+ level arg))) + (while (> (setq level (org-outline-level)) arg) + (org-up-heading-safe))) + (setq beg (point) + heading (org-get-heading 'no-tags)) + (org-end-of-subtree t t) + (when (and (not (eobp)) (org-at-heading-p)) (backward-char 1)) + (setq end (point))) + (when (and (buffer-live-p org-last-indirect-buffer) + (not (eq org-indirect-buffer-display 'new-frame)) + (not arg)) + (kill-buffer org-last-indirect-buffer)) + (setq ibuf (org-get-indirect-buffer cbuf heading) + org-last-indirect-buffer ibuf) + (cond + ((or (eq org-indirect-buffer-display 'new-frame) + (and arg (eq org-indirect-buffer-display 'dedicated-frame))) + (select-frame (make-frame)) + (delete-other-windows) + (pop-to-buffer-same-window ibuf) + (org-set-frame-title heading)) + ((eq org-indirect-buffer-display 'dedicated-frame) + (raise-frame + (select-frame (or (and org-indirect-dedicated-frame + (frame-live-p org-indirect-dedicated-frame) + org-indirect-dedicated-frame) + (setq org-indirect-dedicated-frame (make-frame))))) + (delete-other-windows) + (pop-to-buffer-same-window ibuf) + (org-set-frame-title (concat "Indirect: " heading))) + ((eq org-indirect-buffer-display 'current-window) + (pop-to-buffer-same-window ibuf)) + ((eq org-indirect-buffer-display 'other-window) + (pop-to-buffer ibuf)) + (t (error "Invalid value"))) + (narrow-to-region beg end) + (org-show-all '(headings drawers blocks)) + (goto-char pos) + (run-hook-with-args 'org-cycle-hook 'all) + (and (window-live-p cwin) (select-window cwin)))) + +(defun org-get-indirect-buffer (&optional buffer heading) + (setq buffer (or buffer (current-buffer))) + (let ((n 1) (base (buffer-name buffer)) bname) + (while (buffer-live-p + (get-buffer + (setq bname + (concat base "-" + (if heading (concat heading "-" (number-to-string n)) + (number-to-string n)))))) + (setq n (1+ n))) + (condition-case nil + (make-indirect-buffer buffer bname 'clone) + (error (make-indirect-buffer buffer bname))))) + +(defun org-set-frame-title (title) + "Set the title of the current frame to the string TITLE." + (modify-frame-parameters (selected-frame) (list (cons 'name title)))) + +;;;; Structure editing + +;;; Inserting headlines + +(defun org--blank-before-heading-p (&optional parent) + "Non-nil when an empty line should precede a new heading here. +When optional argument PARENT is non-nil, consider parent +headline instead of current one." + (pcase (assq 'heading org-blank-before-new-entry) + (`(heading . auto) + (save-excursion + (org-with-limited-levels + (unless (and (org-before-first-heading-p) + (not (outline-next-heading))) + (org-back-to-heading t) + (when parent (org-up-heading-safe)) + (cond ((not (bobp)) + (org-previous-line-empty-p)) + ((outline-next-heading) + (org-previous-line-empty-p)) + ;; Ignore trailing spaces on last buffer line. + ((progn (skip-chars-backward " \t") (bolp)) + (org-previous-line-empty-p)) + (t nil)))))) + (`(heading . ,value) value) + (_ nil))) + +(defun org-insert-heading (&optional arg invisible-ok top) + "Insert a new heading or an item with the same depth at point. + +If point is at the beginning of a heading, insert a new heading +or a new headline above the current one. When at the beginning +of a regular line of text, turn it into a heading. + +If point is in the middle of a line, split it and create a new +headline with the text in the current line after point (see +`org-M-RET-may-split-line' on how to modify this behavior). As +a special case, on a headline, splitting can only happen on the +title itself. E.g., this excludes breaking stars or tags. + +With a `\\[universal-argument]' prefix, set \ +`org-insert-heading-respect-content' to +a non-nil value for the duration of the command. This forces the +insertion of a heading after the current subtree, independently +on the location of point. + +With a `\\[universal-argument] \\[universal-argument]' prefix, \ +insert the heading at the end of the tree +above the current heading. For example, if point is within a +2nd-level heading, then it will insert a 2nd-level heading at +the end of the 1st-level parent subtree. + +When INVISIBLE-OK is set, stop at invisible headlines when going +back. This is important for non-interactive uses of the +command. + +When optional argument TOP is non-nil, insert a level 1 heading, +unconditionally." + (interactive "P") + (let* ((blank? (org--blank-before-heading-p (equal arg '(16)))) + (level (org-current-level)) + (stars (make-string (if (and level (not top)) level 1) ?*))) + (cond + ((or org-insert-heading-respect-content + (member arg '((4) (16))) + (and (not invisible-ok) + (invisible-p (max (1- (point)) (point-min))))) + ;; Position point at the location of insertion. Make sure we + ;; end up on a visible headline if INVISIBLE-OK is nil. + (org-with-limited-levels + (if (not level) (outline-next-heading) ;before first headline + (org-back-to-heading invisible-ok) + (when (equal arg '(16)) (org-up-heading-safe)) + (org-end-of-subtree))) + (unless (bolp) (insert "\n")) + (when (and blank? (save-excursion + (backward-char) + (org-before-first-heading-p))) + (insert "\n") + (backward-char)) + (when (and (not level) (not (eobp)) (not (bobp))) + (when (org-at-heading-p) (insert "\n")) + (backward-char)) + (unless (and blank? (org-previous-line-empty-p)) + (org-N-empty-lines-before-current (if blank? 1 0))) + (insert stars " ") + ;; When INVISIBLE-OK is non-nil, ensure newly created headline + ;; is visible. + (unless invisible-ok + (pcase (get-char-property-and-overlay (point) 'invisible) + (`(outline . ,o) + (move-overlay o (overlay-start o) (line-end-position 0))) + (_ nil)))) + ;; At a headline... + ((org-at-heading-p) + (cond ((bolp) + (when blank? (save-excursion (insert "\n"))) + (save-excursion (insert stars " \n")) + (unless (and blank? (org-previous-line-empty-p)) + (org-N-empty-lines-before-current (if blank? 1 0))) + (end-of-line)) + ((and (org-get-alist-option org-M-RET-may-split-line 'headline) + (org-match-line org-complex-heading-regexp) + (org-pos-in-match-range (point) 4)) + ;; Grab the text that should moved to the new headline. + ;; Preserve tags. + (let ((split (delete-and-extract-region (point) (match-end 4)))) + (if (looking-at "[ \t]*$") (replace-match "") + (org-align-tags)) + (end-of-line) + (when blank? (insert "\n")) + (insert "\n" stars " ") + (when (org-string-nw-p split) (insert split)))) + (t + (end-of-line) + (when blank? (insert "\n")) + (insert "\n" stars " ")))) + ;; On regular text, turn line into a headline or split, if + ;; appropriate. + ((bolp) + (insert stars " ") + (unless (and blank? (org-previous-line-empty-p)) + (org-N-empty-lines-before-current (if blank? 1 0)))) + (t + (unless (org-get-alist-option org-M-RET-may-split-line 'headline) + (end-of-line)) + (insert "\n" stars " ") + (unless (and blank? (org-previous-line-empty-p)) + (org-N-empty-lines-before-current (if blank? 1 0)))))) + (run-hooks 'org-insert-heading-hook)) + +(defun org-N-empty-lines-before-current (n) + "Make the number of empty lines before current exactly N. +So this will delete or add empty lines." + (let ((column (current-column))) + (beginning-of-line) + (unless (bobp) + (let ((start (save-excursion + (skip-chars-backward " \r\t\n") + (line-end-position)))) + (delete-region start (line-end-position 0)))) + (insert (make-string n ?\n)) + (move-to-column column))) + +(defun org-get-heading (&optional no-tags no-todo no-priority no-comment) + "Return the heading of the current entry, without the stars. +When NO-TAGS is non-nil, don't include tags. +When NO-TODO is non-nil, don't include TODO keywords. +When NO-PRIORITY is non-nil, don't include priority cookie. +When NO-COMMENT is non-nil, don't include COMMENT string. +Return nil before first heading." + (unless (org-before-first-heading-p) + (save-excursion + (org-back-to-heading t) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp) + (let ((todo (and (not no-todo) (match-string 2))) + (priority (and (not no-priority) (match-string 3))) + (headline (pcase (match-string 4) + (`nil "") + ((and (guard no-comment) h) + (replace-regexp-in-string + (eval-when-compile + (format "\\`%s[ \t]+" org-comment-string)) + "" h)) + (h h))) + (tags (and (not no-tags) (match-string 5)))) + (mapconcat #'identity + (delq nil (list todo priority headline tags)) + " ")))))) + +(defun org-heading-components () + "Return the components of the current heading. +This is a list with the following elements: +- the level as an integer +- the reduced level, different if `org-odd-levels-only' is set. +- the TODO keyword, or nil +- the priority character, like ?A, or nil if no priority is given +- the headline text itself, or the tags string if no headline text +- the tags string, or nil." + (save-excursion + (org-back-to-heading t) + (when (let (case-fold-search) (looking-at org-complex-heading-regexp)) + (list (length (match-string 1)) + (org-reduced-level (length (match-string 1))) + (match-string-no-properties 2) + (and (match-end 3) (aref (match-string 3) 2)) + (match-string-no-properties 4) + (match-string-no-properties 5))))) + +(defun org-get-entry () + "Get the entry text, after heading, entire subtree." + (save-excursion + (org-back-to-heading t) + (buffer-substring (point-at-bol 2) (org-end-of-subtree t)))) + +(defun org-edit-headline (&optional heading) + "Edit the current headline. +Set it to HEADING when provided." + (interactive) + (org-with-wide-buffer + (org-back-to-heading t) + (let ((case-fold-search nil)) + (when (looking-at org-complex-heading-regexp) + (let* ((old (match-string-no-properties 4)) + (new (save-match-data + (org-trim (or heading (read-string "Edit: " old)))))) + (unless (equal old new) + (if old (replace-match new t t nil 4) + (goto-char (or (match-end 3) (match-end 2) (match-end 1))) + (insert " " new)) + (org-align-tags) + (when (looking-at "[ \t]*$") (replace-match "")))))))) + +(defun org-insert-heading-after-current () + "Insert a new heading with same level as current, after current subtree." + (interactive) + (org-back-to-heading) + (org-insert-heading) + (org-move-subtree-down) + (end-of-line 1)) + +(defun org-insert-heading-respect-content (&optional invisible-ok) + "Insert heading with `org-insert-heading-respect-content' set to t." + (interactive) + (org-insert-heading '(4) invisible-ok)) + +(defun org-insert-todo-heading-respect-content (&optional force-state) + "Insert TODO heading with `org-insert-heading-respect-content' set to t." + (interactive) + (org-insert-todo-heading force-state '(4))) + +(defun org-insert-todo-heading (arg &optional force-heading) + "Insert a new heading with the same level and TODO state as current heading. + +If the heading has no TODO state, or if the state is DONE, use +the first state (TODO by default). Also with one prefix arg, +force first state. With two prefix args, force inserting at the +end of the parent subtree. + +When called at a plain list item, insert a new item with an +unchecked check box." + (interactive "P") + (when (or force-heading (not (org-insert-item 'checkbox))) + (org-insert-heading (or (and (equal arg '(16)) '(16)) + force-heading)) + (save-excursion + (org-forward-heading-same-level -1) + (let ((case-fold-search nil)) (looking-at org-todo-line-regexp))) + (let* ((new-mark-x + (if (or (equal arg '(4)) + (not (match-beginning 2)) + (member (match-string 2) org-done-keywords)) + (car org-todo-keywords-1) + (match-string 2))) + (new-mark + (or + (run-hook-with-args-until-success + 'org-todo-get-default-hook new-mark-x nil) + new-mark-x))) + (beginning-of-line 1) + (and (looking-at org-outline-regexp) (goto-char (match-end 0)) + (if org-treat-insert-todo-heading-as-state-change + (org-todo new-mark) + (insert new-mark " ")))) + (when org-provide-todo-statistics + (org-update-parent-todo-statistics)))) + +(defun org-insert-subheading (arg) + "Insert a new subheading and demote it. +Works for outline headings and for plain lists alike." + (interactive "P") + (org-insert-heading arg) + (cond + ((org-at-heading-p) (org-do-demote)) + ((org-at-item-p) (org-indent-item)))) + +(defun org-insert-todo-subheading (arg) + "Insert a new subheading with TODO keyword or checkbox and demote it. +Works for outline headings and for plain lists alike." + (interactive "P") + (org-insert-todo-heading arg) + (cond + ((org-at-heading-p) (org-do-demote)) + ((org-at-item-p) (org-indent-item)))) + +;;; Promotion and Demotion + +(defvar org-after-demote-entry-hook nil + "Hook run after an entry has been demoted. +The cursor will be at the beginning of the entry. +When a subtree is being demoted, the hook will be called for each node.") + +(defvar org-after-promote-entry-hook nil + "Hook run after an entry has been promoted. +The cursor will be at the beginning of the entry. +When a subtree is being promoted, the hook will be called for each node.") + +(defun org-promote-subtree () + "Promote the entire subtree. +See also `org-promote'." + (interactive) + (save-excursion + (org-with-limited-levels (org-map-tree 'org-promote))) + (org-fix-position-after-promote)) + +(defun org-demote-subtree () + "Demote the entire subtree. +See `org-demote' and `org-promote'." + (interactive) + (save-excursion + (org-with-limited-levels (org-map-tree 'org-demote))) + (org-fix-position-after-promote)) + +(defun org-do-promote () + "Promote the current heading higher up the tree. +If the region is active in `transient-mark-mode', promote all +headings in the region." + (interactive) + (save-excursion + (if (org-region-active-p) + (org-map-region 'org-promote (region-beginning) (region-end)) + (org-promote))) + (org-fix-position-after-promote)) + +(defun org-do-demote () + "Demote the current heading lower down the tree. +If the region is active in `transient-mark-mode', demote all +headings in the region." + (interactive) + (save-excursion + (if (org-region-active-p) + (org-map-region 'org-demote (region-beginning) (region-end)) + (org-demote))) + (org-fix-position-after-promote)) + +(defun org-fix-position-after-promote () + "Fix cursor position and indentation after demoting/promoting." + (let ((pos (point))) + (when (save-excursion + (beginning-of-line) + (let ((case-fold-search nil)) (looking-at org-todo-line-regexp)) + (or (eq pos (match-end 1)) (eq pos (match-end 2)))) + (cond ((eobp) (insert " ")) + ((eolp) (insert " ")) + ((equal (char-after) ?\s) (forward-char 1)))))) + +(defun org-current-level () + "Return the level of the current entry, or nil if before the first headline. +The level is the number of stars at the beginning of the +headline. Use `org-reduced-level' to remove the effect of +`org-odd-levels'. Unlike to `org-outline-level', this function +ignores inlinetasks." + (let ((level (org-with-limited-levels (org-outline-level)))) + (and (> level 0) level))) + +(defun org-get-previous-line-level () + "Return the outline depth of the last headline before the current line. +Returns 0 for the first headline in the buffer, and nil if before the +first headline." + (and (org-current-level) + (or (and (/= (line-beginning-position) (point-min)) + (save-excursion (beginning-of-line 0) (org-current-level))) + 0))) + +(defun org-reduced-level (l) + "Compute the effective level of a heading. +This takes into account the setting of `org-odd-levels-only'." + (cond + ((zerop l) 0) + (org-odd-levels-only (1+ (floor (/ l 2)))) + (t l))) + +(defun org-level-increment () + "Return the number of stars that will be added or removed at a +time to headlines when structure editing, based on the value of +`org-odd-levels-only'." + (if org-odd-levels-only 2 1)) + +(defun org-get-valid-level (level &optional change) + "Rectify a level change under the influence of `org-odd-levels-only'. +LEVEL is a current level, CHANGE is by how much the level should +be modified. Even if CHANGE is nil, LEVEL may be returned +modified because even level numbers will become the next higher +odd number. Returns values greater than 0." + (if org-odd-levels-only + (cond ((or (not change) (= 0 change)) (1+ (* 2 (/ level 2)))) + ((> change 0) (1+ (* 2 (/ (+ (1- level) (* 2 change)) 2)))) + ((< change 0) (max 1 (1+ (* 2 (/ (+ level (* 2 change)) 2)))))) + (max 1 (+ level (or change 0))))) + +(defun org-promote () + "Promote the current heading higher up the tree." + (org-with-wide-buffer + (org-back-to-heading t) + (let* ((after-change-functions (remq 'flyspell-after-change-function + after-change-functions)) + (level (save-match-data (funcall outline-level))) + (up-head (concat (make-string (org-get-valid-level level -1) ?*) " ")) + (diff (abs (- level (length up-head) -1)))) + (cond + ((and (= level 1) org-allow-promoting-top-level-subtree) + (replace-match "# " nil t)) + ((= level 1) + (user-error "Cannot promote to level 0. UNDO to recover if necessary")) + (t (replace-match up-head nil t))) + (unless (= level 1) + (when org-auto-align-tags (org-align-tags)) + (when org-adapt-indentation (org-fixup-indentation (- diff)))) + (run-hooks 'org-after-promote-entry-hook)))) + +(defun org-demote () + "Demote the current heading lower down the tree." + (org-with-wide-buffer + (org-back-to-heading t) + (let* ((after-change-functions (remq 'flyspell-after-change-function + after-change-functions)) + (level (save-match-data (funcall outline-level))) + (down-head (concat (make-string (org-get-valid-level level 1) ?*) " ")) + (diff (abs (- level (length down-head) -1)))) + (replace-match down-head nil t) + (when org-auto-align-tags (org-align-tags)) + (when org-adapt-indentation (org-fixup-indentation diff)) + (run-hooks 'org-after-demote-entry-hook)))) + +(defun org-cycle-level () + "Cycle the level of an empty headline through possible states. +This goes first to child, then to parent, level, then up the hierarchy. +After top level, it switches back to sibling level." + (interactive) + (let ((org-adapt-indentation nil)) + (when (org-point-at-end-of-empty-headline) + (setq this-command 'org-cycle-level) ; Only needed for caching + (let ((cur-level (org-current-level)) + (prev-level (org-get-previous-line-level))) + (cond + ;; If first headline in file, promote to top-level. + ((= prev-level 0) + (cl-loop repeat (/ (- cur-level 1) (org-level-increment)) + do (org-do-promote))) + ;; If same level as prev, demote one. + ((= prev-level cur-level) + (org-do-demote)) + ;; If parent is top-level, promote to top level if not already. + ((= prev-level 1) + (cl-loop repeat (/ (- cur-level 1) (org-level-increment)) + do (org-do-promote))) + ;; If top-level, return to prev-level. + ((= cur-level 1) + (cl-loop repeat (/ (- prev-level 1) (org-level-increment)) + do (org-do-demote))) + ;; If less than prev-level, promote one. + ((< cur-level prev-level) + (org-do-promote)) + ;; If deeper than prev-level, promote until higher than + ;; prev-level. + ((> cur-level prev-level) + (cl-loop repeat (+ 1 (/ (- cur-level prev-level) (org-level-increment))) + do (org-do-promote)))) + t)))) + +(defun org-map-tree (fun) + "Call FUN for every heading underneath the current one." + (org-back-to-heading t) + (let ((level (funcall outline-level))) + (save-excursion + (funcall fun) + (while (and (progn + (outline-next-heading) + (> (funcall outline-level) level)) + (not (eobp))) + (funcall fun))))) + +(defun org-map-region (fun beg end) + "Call FUN for every heading between BEG and END." + (let ((org-ignore-region t)) + (save-excursion + (setq end (copy-marker end)) + (goto-char beg) + (when (and (re-search-forward org-outline-regexp-bol nil t) + (< (point) end)) + (funcall fun)) + (while (and (progn + (outline-next-heading) + (< (point) end)) + (not (eobp))) + (funcall fun))))) + +(defun org-fixup-indentation (diff) + "Change the indentation in the current entry by DIFF. + +DIFF is an integer. Indentation is done according to the +following rules: + + - Planning information and property drawers are always indented + according to the new level of the headline; + + - Footnote definitions and their contents are ignored; + + - Inlinetasks' boundaries are not shifted; + + - Empty lines are ignored; + + - Other lines' indentation are shifted by DIFF columns, unless + it would introduce a structural change in the document, in + which case no shifting is done at all. + +Assume point is at a heading or an inlinetask beginning." + (org-with-wide-buffer + (narrow-to-region (line-beginning-position) + (save-excursion + (if (org-with-limited-levels (org-at-heading-p)) + (org-with-limited-levels (outline-next-heading)) + (org-inlinetask-goto-end)) + (point))) + (forward-line) + ;; Indent properly planning info and property drawer. + (when (looking-at-p org-planning-line-re) + (org-indent-line) + (forward-line)) + (when (looking-at org-property-drawer-re) + (goto-char (match-end 0)) + (forward-line) + (org-indent-region (match-beginning 0) (match-end 0))) + (when (looking-at org-logbook-drawer-re) + (let ((end-marker (move-marker (make-marker) (match-end 0))) + (col (+ (current-indentation) diff))) + (when (wholenump col) + (while (< (point) end-marker) + (if (natnump diff) + (insert (make-string diff 32)) + (delete-char (abs diff))) + (forward-line))))) + (catch 'no-shift + (when (or (zerop diff) (not (eq org-adapt-indentation t))) + (throw 'no-shift nil)) + ;; If DIFF is negative, first check if a shift is possible at all + ;; (e.g., it doesn't break structure). This can only happen if + ;; some contents are not properly indented. + (let ((case-fold-search t)) + (when (< diff 0) + (let ((diff (- diff)) + (forbidden-re (concat org-outline-regexp + "\\|" + (substring org-footnote-definition-re 1)))) + (save-excursion + (while (not (eobp)) + (cond + ((looking-at-p "[ \t]*$") (forward-line)) + ((and (looking-at-p org-footnote-definition-re) + (let ((e (org-element-at-point))) + (and (eq (org-element-type e) 'footnote-definition) + (goto-char (org-element-property :end e)))))) + ((looking-at-p org-outline-regexp) (forward-line)) + ;; Give up if shifting would move before column 0 or + ;; if it would introduce a headline or a footnote + ;; definition. + (t + (skip-chars-forward " \t") + (let ((ind (current-column))) + (when (or (< ind diff) + (and (= ind diff) (looking-at-p forbidden-re))) + (throw 'no-shift nil))) + ;; Ignore contents of example blocks and source + ;; blocks if their indentation is meant to be + ;; preserved. Jump to block's closing line. + (beginning-of-line) + (or (and (looking-at-p "[ \t]*#\\+BEGIN_\\(EXAMPLE\\|SRC\\)") + (let ((e (org-element-at-point))) + (and (memq (org-element-type e) + '(example-block src-block)) + (or org-src-preserve-indentation + (org-element-property :preserve-indent e)) + (goto-char (org-element-property :end e)) + (progn (skip-chars-backward " \r\t\n") + (beginning-of-line) + t)))) + (forward-line)))))))) + ;; Shift lines but footnote definitions, inlinetasks boundaries + ;; by DIFF. Also skip contents of source or example blocks + ;; when indentation is meant to be preserved. + (while (not (eobp)) + (cond + ((and (looking-at-p org-footnote-definition-re) + (let ((e (org-element-at-point))) + (and (eq (org-element-type e) 'footnote-definition) + (goto-char (org-element-property :end e)))))) + ((looking-at-p org-outline-regexp) (forward-line)) + ((looking-at-p "[ \t]*$") (forward-line)) + (t + (indent-line-to (+ (current-indentation) diff)) + (beginning-of-line) + (or (and (looking-at-p "[ \t]*#\\+BEGIN_\\(EXAMPLE\\|SRC\\)") + (let ((e (org-element-at-point))) + (and (memq (org-element-type e) + '(example-block src-block)) + (or org-src-preserve-indentation + (org-element-property :preserve-indent e)) + (goto-char (org-element-property :end e)) + (progn (skip-chars-backward " \r\t\n") + (beginning-of-line) + t)))) + (forward-line))))))))) + +(defun org-convert-to-odd-levels () + "Convert an Org file with all levels allowed to one with odd levels. +This will leave level 1 alone, convert level 2 to level 3, level 3 to +level 5 etc." + (interactive) + (when (yes-or-no-p "Are you sure you want to globally change levels to odd? ") + (let ((outline-level 'org-outline-level) + (org-odd-levels-only nil) n) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "^\\*\\*+ " nil t) + (setq n (- (length (match-string 0)) 2)) + (while (>= (setq n (1- n)) 0) + (org-demote)) + (end-of-line 1)))))) + +(defun org-convert-to-oddeven-levels () + "Convert an Org file with only odd levels to one with odd/even levels. +This promotes level 3 to level 2, level 5 to level 3 etc. If the +file contains a section with an even level, conversion would +destroy the structure of the file. An error is signaled in this +case." + (interactive) + (goto-char (point-min)) + ;; First check if there are no even levels + (when (re-search-forward "^\\(\\*\\*\\)+ " nil t) + (org-show-set-visibility 'canonical) + (error "Not all levels are odd in this file. Conversion not possible")) + (when (yes-or-no-p "Are you sure you want to globally change levels to odd-even? ") + (let ((outline-regexp org-outline-regexp) + (outline-level 'org-outline-level) + (org-odd-levels-only nil) n) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "^\\*\\*+ " nil t) + (setq n (/ (1- (length (match-string 0))) 2)) + (while (>= (setq n (1- n)) 0) + (org-promote)) + (end-of-line 1)))))) + +(defun org-tr-level (n) + "Make N odd if required." + (if org-odd-levels-only (1+ (/ n 2)) n)) + +;;; Vertical tree motion, cutting and pasting of subtrees + +(defun org-move-subtree-up (&optional arg) + "Move the current subtree up past ARG headlines of the same level." + (interactive "p") + (org-move-subtree-down (- (prefix-numeric-value arg)))) + +(defun org-move-subtree-down (&optional arg) + "Move the current subtree down past ARG headlines of the same level." + (interactive "p") + (setq arg (prefix-numeric-value arg)) + (org-preserve-local-variables + (let ((movfunc (if (> arg 0) 'org-get-next-sibling + 'org-get-previous-sibling)) + (ins-point (make-marker)) + (cnt (abs arg)) + (col (current-column)) + beg end txt folded) + ;; Select the tree + (org-back-to-heading) + (setq beg (point)) + (save-match-data + (save-excursion (outline-end-of-heading) + (setq folded (org-invisible-p))) + (progn (org-end-of-subtree nil t) + (unless (eobp) (backward-char)))) + (outline-next-heading) + (setq end (point)) + (goto-char beg) + ;; Find insertion point, with error handling + (while (> cnt 0) + (unless (and (funcall movfunc) (looking-at org-outline-regexp)) + (goto-char beg) + (user-error "Cannot move past superior level or buffer limit")) + (setq cnt (1- cnt))) + (when (> arg 0) + ;; Moving forward - still need to move over subtree + (org-end-of-subtree t t) + (save-excursion + (org-back-over-empty-lines) + (or (bolp) (newline)))) + (move-marker ins-point (point)) + (setq txt (buffer-substring beg end)) + (org-save-markers-in-region beg end) + (delete-region beg end) + (org-remove-empty-overlays-at beg) + (unless (= beg (point-min)) (org-flag-region (1- beg) beg nil 'outline)) + (unless (bobp) (org-flag-region (1- (point)) (point) nil 'outline)) + (and (not (bolp)) (looking-at "\n") (forward-char 1)) + (let ((bbb (point))) + (insert-before-markers txt) + (org-reinstall-markers-in-region bbb) + (move-marker ins-point bbb)) + (or (bolp) (insert "\n")) + (goto-char ins-point) + (org-skip-whitespace) + (move-marker ins-point nil) + (if folded + (org-flag-subtree t) + (org-show-entry) + (org-show-children)) + (org-clean-visibility-after-subtree-move) + ;; move back to the initial column we were at + (move-to-column col)))) + +(defvar org-subtree-clip "" + "Clipboard for cut and paste of subtrees. +This is actually only a copy of the kill, because we use the normal kill +ring. We need it to check if the kill was created by `org-copy-subtree'.") + +(defvar org-subtree-clip-folded nil + "Was the last copied subtree folded? +This is used to fold the tree back after pasting.") + +(defun org-cut-subtree (&optional n) + "Cut the current subtree into the clipboard. +With prefix arg N, cut this many sequential subtrees. +This is a short-hand for marking the subtree and then cutting it." + (interactive "p") + (org-copy-subtree n 'cut)) + +(defun org-copy-subtree (&optional n cut force-store-markers nosubtrees) + "Copy the current subtree into the clipboard. +With prefix arg N, copy this many sequential subtrees. +This is a short-hand for marking the subtree and then copying it. +If CUT is non-nil, actually cut the subtree. +If FORCE-STORE-MARKERS is non-nil, store the relative locations +of some markers in the region, even if CUT is non-nil. This is +useful if the caller implements cut-and-paste as copy-then-paste-then-cut." + (interactive "p") + (org-preserve-local-variables + (let (beg end folded (beg0 (point))) + (if (called-interactively-p 'any) + (org-back-to-heading nil) ; take what looks like a subtree + (org-back-to-heading t)) ; take what is really there + (setq beg (point)) + (skip-chars-forward " \t\r\n") + (save-match-data + (if nosubtrees + (outline-next-heading) + (save-excursion (outline-end-of-heading) + (setq folded (org-invisible-p))) + (ignore-errors (org-forward-heading-same-level (1- n) t)) + (org-end-of-subtree t t))) + ;; Include the end of an inlinetask + (when (and (featurep 'org-inlinetask) + (looking-at-p (concat (org-inlinetask-outline-regexp) + "END[ \t]*$"))) + (end-of-line)) + (setq end (point)) + (goto-char beg0) + (when (> end beg) + (setq org-subtree-clip-folded folded) + (when (or cut force-store-markers) + (org-save-markers-in-region beg end)) + (if cut (kill-region beg end) (copy-region-as-kill beg end)) + (setq org-subtree-clip (current-kill 0)) + (message "%s: Subtree(s) with %d characters" + (if cut "Cut" "Copied") + (length org-subtree-clip)))))) + +(defun org-paste-subtree (&optional level tree for-yank remove) + "Paste the clipboard as a subtree, with modification of headline level. + +The entire subtree is promoted or demoted in order to match a new headline +level. + +If the cursor is at the beginning of a headline, the same level as +that headline is used to paste the tree. + +If not, the new level is derived from the *visible* headings +before and after the insertion point, and taken to be the inferior headline +level of the two. So if the previous visible heading is level 3 and the +next is level 4 (or vice versa), level 4 will be used for insertion. +This makes sure that the subtree remains an independent subtree and does +not swallow low level entries. + +You can also force a different level, either by using a numeric prefix +argument, or by inserting the heading marker by hand. For example, if the +cursor is after \"*****\", then the tree will be shifted to level 5. + +If optional TREE is given, use this text instead of the kill ring. + +When FOR-YANK is set, this is called by `org-yank'. In this case, do not +move back over whitespace before inserting, and move point to the end of +the inserted text when done. + +When REMOVE is non-nil, remove the subtree from the clipboard." + (interactive "P") + (setq tree (or tree (and kill-ring (current-kill 0)))) + (unless (org-kill-is-subtree-p tree) + (user-error + (substitute-command-keys + "The kill is not a (set of) tree(s). Use `\\[yank]' to yank anyway"))) + (org-with-limited-levels + (let* ((visp (not (org-invisible-p))) + (txt tree) + (old-level (if (string-match org-outline-regexp-bol txt) + (- (match-end 0) (match-beginning 0) 1) + -1)) + (force-level + (cond + (level (prefix-numeric-value level)) + ;; When point is after the stars in an otherwise empty + ;; headline, use the number of stars as the forced level. + ((and (org-match-line "^\\*+[ \t]*$") + (not (eq ?* (char-after)))) + (org-outline-level)) + ((looking-at-p org-outline-regexp-bol) (org-outline-level)))) + (previous-level + (save-excursion + (org-previous-visible-heading 1) + (if (org-at-heading-p) (org-outline-level) 1))) + (next-level + (save-excursion + (if (org-at-heading-p) (org-outline-level) + (org-next-visible-heading 1) + (if (org-at-heading-p) (org-outline-level) 1)))) + (new-level (or force-level (max previous-level next-level))) + (shift (if (or (= old-level -1) + (= new-level -1) + (= old-level new-level)) + 0 + (- new-level old-level))) + (delta (if (> shift 0) -1 1)) + (func (if (> shift 0) #'org-demote #'org-promote)) + (org-odd-levels-only nil) + beg end newend) + ;; Remove the forced level indicator. + (when (and force-level (not level)) + (delete-region (line-beginning-position) (point))) + ;; Paste before the next visible heading or at end of buffer, + ;; unless point is at the beginning of a headline. + (unless (and (bolp) (org-at-heading-p)) + (org-next-visible-heading 1) + (unless (bolp) (insert "\n"))) + (setq beg (point)) + (when (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt)) + (insert-before-markers txt) + (unless (string-suffix-p "\n" txt) (insert "\n")) + (setq newend (point)) + (org-reinstall-markers-in-region beg) + (setq end (point)) + (goto-char beg) + (skip-chars-forward " \t\n\r") + (setq beg (point)) + (when (and (org-invisible-p) visp) + (save-excursion (outline-show-heading))) + ;; Shift if necessary. + (unless (= shift 0) + (save-restriction + (narrow-to-region beg end) + (while (not (= shift 0)) + (org-map-region func (point-min) (point-max)) + (setq shift (+ delta shift))) + (goto-char (point-min)) + (setq newend (point-max)))) + (when (or for-yank (called-interactively-p 'interactive)) + (message "Clipboard pasted as level %d subtree" new-level)) + (when (and (not for-yank) ; in this case, org-yank will decide about folding + kill-ring + (equal org-subtree-clip (current-kill 0)) + org-subtree-clip-folded) + ;; The tree was folded before it was killed/copied + (org-flag-subtree t)) + (when for-yank (goto-char newend)) + (when remove (pop kill-ring))))) + +(defun org-kill-is-subtree-p (&optional txt) + "Check if the current kill is an outline subtree, or a set of trees. +Returns nil if kill does not start with a headline, or if the first +headline level is not the largest headline level in the tree. +So this will actually accept several entries of equal levels as well, +which is OK for `org-paste-subtree'. +If optional TXT is given, check this string instead of the current kill." + (let* ((kill (or txt (and kill-ring (current-kill 0)) "")) + (re (org-get-limited-outline-regexp)) + (^re (concat "^" re)) + (start-level (and kill + (string-match + (concat "\\`\\([ \t\n\r]*?\n\\)?\\(" re "\\)") + kill) + (- (match-end 2) (match-beginning 2) 1))) + (start (1+ (or (match-beginning 2) -1)))) + (if (not start-level) + (progn + nil) ;; does not even start with a heading + (catch 'exit + (while (setq start (string-match ^re kill (1+ start))) + (when (< (- (match-end 0) (match-beginning 0) 1) start-level) + (throw 'exit nil))) + t)))) + +(defvar org-markers-to-move nil + "Markers that should be moved with a cut-and-paste operation. +Those markers are stored together with their positions relative to +the start of the region.") + +(defun org-save-markers-in-region (beg end) + "Check markers in region. +If these markers are between BEG and END, record their position relative +to BEG, so that after moving the block of text, we can put the markers back +into place. +This function gets called just before an entry or tree gets cut from the +buffer. After re-insertion, `org-reinstall-markers-in-region' must be +called immediately, to move the markers with the entries." + (setq org-markers-to-move nil) + (when (featurep 'org-clock) + (org-clock-save-markers-for-cut-and-paste beg end)) + (when (featurep 'org-agenda) + (org-agenda-save-markers-for-cut-and-paste beg end))) + +(defun org-check-and-save-marker (marker beg end) + "Check if MARKER is between BEG and END. +If yes, remember the marker and the distance to BEG." + (when (and (marker-buffer marker) + (or (equal (marker-buffer marker) (current-buffer)) + (equal (marker-buffer marker) (buffer-base-buffer (current-buffer)))) + (>= marker beg) (< marker end)) + (push (cons marker (- marker beg)) org-markers-to-move))) + +(defun org-reinstall-markers-in-region (beg) + "Move all remembered markers to their position relative to BEG." + (dolist (x org-markers-to-move) + (move-marker (car x) (+ beg (cdr x)))) + (setq org-markers-to-move nil)) + +(defun org-narrow-to-subtree () + "Narrow buffer to the current subtree." + (interactive) + (save-excursion + (save-match-data + (org-with-limited-levels + (narrow-to-region + (progn (org-back-to-heading t) (point)) + (progn (org-end-of-subtree t t) + (when (and (org-at-heading-p) (not (eobp))) (backward-char 1)) + (point))))))) + +(defun org-toggle-narrow-to-subtree () + "Narrow to the subtree at point or widen a narrowed buffer." + (interactive) + (if (buffer-narrowed-p) + (progn (widen) (message "Buffer widen")) + (org-narrow-to-subtree) + (message "Buffer narrowed to current subtree"))) + +(defun org-narrow-to-block () + "Narrow buffer to the current block." + (interactive) + (let* ((case-fold-search t) + (blockp (org-between-regexps-p "^[ \t]*#\\+begin_.*" + "^[ \t]*#\\+end_.*"))) + (if blockp + (narrow-to-region (car blockp) (cdr blockp)) + (user-error "Not in a block")))) + +(defun org-clone-subtree-with-time-shift (n &optional shift) + "Clone the task (subtree) at point N times. +The clones will be inserted as siblings. + +In interactive use, the user will be prompted for the number of +clones to be produced. If the entry has a timestamp, the user +will also be prompted for a time shift, which may be a repeater +as used in time stamps, for example `+3d'. To disable this, +you can call the function with a universal prefix argument. + +When a valid repeater is given and the entry contains any time +stamps, the clones will become a sequence in time, with time +stamps in the subtree shifted for each clone produced. If SHIFT +is nil or the empty string, time stamps will be left alone. The +ID property of the original subtree is removed. + +In each clone, all the CLOCK entries will be removed. This +prevents Org from considering that the clocked times overlap. + +If the original subtree did contain time stamps with a repeater, +the following will happen: +- the repeater will be removed in each clone +- an additional clone will be produced, with the current, unshifted + date(s) in the entry. +- the original entry will be placed *after* all the clones, with + repeater intact. +- the start days in the repeater in the original entry will be shifted + to past the last clone. +In this way you can spell out a number of instances of a repeating task, +and still retain the repeater to cover future instances of the task. + +As described above, N+1 clones are produced when the original +subtree has a repeater. Setting N to 0, then, can be used to +remove the repeater from a subtree and create a shifted clone +with the original repeater." + (interactive "nNumber of clones to produce: ") + (unless (wholenump n) (user-error "Invalid number of replications %s" n)) + (when (org-before-first-heading-p) (user-error "No subtree to clone")) + (let* ((beg (save-excursion (org-back-to-heading t) (point))) + (end-of-tree (save-excursion (org-end-of-subtree t t) (point))) + (shift + (or shift + (if (and (not (equal current-prefix-arg '(4))) + (save-excursion + (goto-char beg) + (re-search-forward org-ts-regexp-both end-of-tree t))) + (read-from-minibuffer + "Date shift per clone (e.g. +1w, empty to copy unchanged): ") + ""))) ;No time shift + (doshift + (and (org-string-nw-p shift) + (or (string-match "\\`[ \t]*\\([+-]?[0-9]+\\)\\([hdwmy]\\)[ \t]*\\'" + shift) + (user-error "Invalid shift specification %s" shift))))) + (goto-char end-of-tree) + (unless (bolp) (insert "\n")) + (let* ((end (point)) + (template (buffer-substring beg end)) + (shift-n (and doshift (string-to-number (match-string 1 shift)))) + (shift-what (pcase (and doshift (match-string 2 shift)) + (`nil nil) + ("h" 'hour) + ("d" 'day) + ("w" (setq shift-n (* 7 shift-n)) 'day) + ("m" 'month) + ("y" 'year) + (_ (error "Unsupported time unit")))) + (nmin 1) + (nmax n) + (n-no-remove -1) + (org-id-overriding-file-name (buffer-file-name (buffer-base-buffer))) + (idprop (org-entry-get beg "ID"))) + (when (and doshift + (string-match-p "<[^<>\n]+ [.+]?\\+[0-9]+[hdwmy][^<>\n]*>" + template)) + (delete-region beg end) + (setq end beg) + (setq nmin 0) + (setq nmax (1+ nmax)) + (setq n-no-remove nmax)) + (goto-char end) + (cl-loop for n from nmin to nmax do + (insert + ;; Prepare clone. + (with-temp-buffer + (insert template) + (org-mode) + (goto-char (point-min)) + (org-show-subtree) + (and idprop (if org-clone-delete-id + (org-entry-delete nil "ID") + (org-id-get-create t))) + (unless (= n 0) + (while (re-search-forward org-clock-line-re nil t) + (delete-region (line-beginning-position) + (line-beginning-position 2))) + (goto-char (point-min)) + (while (re-search-forward org-drawer-regexp nil t) + (org-remove-empty-drawer-at (point)))) + (goto-char (point-min)) + (when doshift + (while (re-search-forward org-ts-regexp-both nil t) + (org-timestamp-change (* n shift-n) shift-what)) + (unless (= n n-no-remove) + (goto-char (point-min)) + (while (re-search-forward org-ts-regexp nil t) + (save-excursion + (goto-char (match-beginning 0)) + (when (looking-at "<[^<>\n]+\\( +[.+]?\\+[0-9]+[hdwmy]\\)") + (delete-region (match-beginning 1) (match-end 1))))))) + (buffer-string))))) + (goto-char beg))) + +;;; Outline path + +(defvar org-outline-path-cache nil + "Alist between buffer positions and outline paths. +It value is an alist (POSITION . PATH) where POSITION is the +buffer position at the beginning of an entry and PATH is a list +of strings describing the outline path for that entry, in reverse +order.") + +(defun org--get-outline-path-1 (&optional use-cache) + "Return outline path to current headline. + +Outline path is a list of strings, in reverse order. When +optional argument USE-CACHE is non-nil, make use of a cache. See +`org-get-outline-path' for details. + +Assume buffer is widened and point is on a headline." + (or (and use-cache (cdr (assq (point) org-outline-path-cache))) + (let ((p (point)) + (heading (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp) + (if (not (match-end 4)) "" + ;; Remove statistics cookies. + (org-trim + (org-link-display-format + (replace-regexp-in-string + "\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" "" + (match-string-no-properties 4)))))))) + (if (org-up-heading-safe) + (let ((path (cons heading (org--get-outline-path-1 use-cache)))) + (when use-cache + (push (cons p path) org-outline-path-cache)) + path) + ;; This is a new root node. Since we assume we are moving + ;; forward, we can drop previous cache so as to limit number + ;; of associations there. + (let ((path (list heading))) + (when use-cache (setq org-outline-path-cache (list (cons p path)))) + path))))) + +(defun org-get-outline-path (&optional with-self use-cache) + "Return the outline path to the current entry. + +An outline path is a list of ancestors for current headline, as +a list of strings. Statistics cookies are removed and links are +replaced with their description, if any, or their path otherwise. + +When optional argument WITH-SELF is non-nil, the path also +includes the current headline. + +When optional argument USE-CACHE is non-nil, cache outline paths +between calls to this function so as to avoid backtracking. This +argument is useful when planning to find more than one outline +path in the same document. In that case, there are two +conditions to satisfy: + - `org-outline-path-cache' is set to nil before starting the + process; + - outline paths are computed by increasing buffer positions." + (org-with-wide-buffer + (and (or (and with-self (org-back-to-heading t)) + (org-up-heading-safe)) + (reverse (org--get-outline-path-1 use-cache))))) + +(defun org-format-outline-path (path &optional width prefix separator) + "Format the outline path PATH for display. +WIDTH is the maximum number of characters that is available. +PREFIX is a prefix to be included in the returned string, +such as the file name. +SEPARATOR is inserted between the different parts of the path, +the default is \"/\"." + (setq width (or width 79)) + (setq path (delq nil path)) + (unless (> width 0) + (user-error "Argument `width' must be positive")) + (setq separator (or separator "/")) + (let* ((org-odd-levels-only nil) + (fpath (concat + prefix (and prefix path separator) + (mapconcat + (lambda (s) (replace-regexp-in-string "[ \t]+\\'" "" s)) + (cl-loop for head in path + for n from 0 + collect (org-add-props + head nil 'face + (nth (% n org-n-level-faces) org-level-faces))) + separator)))) + (when (> (length fpath) width) + (if (< width 7) + ;; It's unlikely that `width' will be this small, but don't + ;; waste characters by adding ".." if it is. + (setq fpath (substring fpath 0 width)) + (setf (substring fpath (- width 2)) ".."))) + fpath)) + +(defun org-display-outline-path (&optional file current separator just-return-string) + "Display the current outline path in the echo area. + +If FILE is non-nil, prepend the output with the file name. +If CURRENT is non-nil, append the current heading to the output. +SEPARATOR is passed through to `org-format-outline-path'. It separates +the different parts of the path and defaults to \"/\". +If JUST-RETURN-STRING is non-nil, return a string, don't display a message." + (interactive "P") + (let* (case-fold-search + (bfn (buffer-file-name (buffer-base-buffer))) + (path (and (derived-mode-p 'org-mode) (org-get-outline-path))) + res) + (when current (setq path (append path + (save-excursion + (org-back-to-heading t) + (when (looking-at org-complex-heading-regexp) + (list (match-string 4))))))) + (setq res + (org-format-outline-path + path + (1- (frame-width)) + (and file bfn (concat (file-name-nondirectory bfn) separator)) + separator)) + (add-face-text-property 0 (length res) + `(:height ,(face-attribute 'default :height)) + nil res) + (if just-return-string + res + (org-unlogged-message "%s" res)))) + +;;; Outline Sorting + +(defun org-sort (&optional with-case) + "Call `org-sort-entries', `org-table-sort-lines' or `org-sort-list'. +Optional argument WITH-CASE means sort case-sensitively." + (interactive "P") + (org-call-with-arg + (cond ((org-at-table-p) #'org-table-sort-lines) + ((org-at-item-p) #'org-sort-list) + (t #'org-sort-entries)) + with-case)) + +(defun org-sort-remove-invisible (s) + "Remove emphasis markers and any invisible property from string S. +Assume S may contain only objects." + ;; org-element-interpret-data clears any text property, including + ;; invisible part. + (org-element-interpret-data + (let ((tree (org-element-parse-secondary-string + s (org-element-restriction 'paragraph)))) + (org-element-map tree '(bold code italic link strike-through underline verbatim) + (lambda (o) + (pcase (org-element-type o) + ;; Terminal object. Replace it with its value. + ((or `code `verbatim) + (let ((new (org-element-property :value o))) + (org-element-insert-before new o) + (org-element-put-property + new :post-blank (org-element-property :post-blank o)))) + ;; Non-terminal objects. Splice contents. + (type + (let ((contents + (or (org-element-contents o) + (and (eq type 'link) + (list (org-element-property :raw-link o))))) + (c nil)) + (while contents + (setq c (pop contents)) + (org-element-insert-before c o)) + (org-element-put-property + c :post-blank (org-element-property :post-blank o))))) + (org-element-extract-element o))) + ;; Return modified tree. + tree))) + +(defvar org-after-sorting-entries-or-items-hook nil + "Hook that is run after a bunch of entries or items have been sorted. +When children are sorted, the cursor is in the parent line when this +hook gets called. When a region or a plain list is sorted, the cursor +will be in the first entry of the sorted region/list.") + +(defun org-sort-entries + (&optional with-case sorting-type getkey-func compare-func property + interactive?) + "Sort entries on a certain level of an outline tree. +If there is an active region, the entries in the region are sorted. +Else, if the cursor is before the first entry, sort the top-level items. +Else, the children of the entry at point are sorted. + +Sorting can be alphabetically, numerically, by date/time as given by +a time stamp, by a property, by priority order, or by a custom function. + +The command prompts for the sorting type unless it has been given to the +function through the SORTING-TYPE argument, which needs to be a character, +\(?n ?N ?a ?A ?t ?T ?s ?S ?d ?D ?p ?P ?o ?O ?r ?R ?f ?F ?k ?K). Here is +the precise meaning of each character: + +a Alphabetically, ignoring the TODO keyword and the priority, if any. +c By creation time, which is assumed to be the first inactive time stamp + at the beginning of a line. +d By deadline date/time. +k By clocking time. +n Numerically, by converting the beginning of the entry/item to a number. +o By order of TODO keywords. +p By priority according to the cookie. +r By the value of a property. +s By scheduled date/time. +t By date/time, either the first active time stamp in the entry, or, if + none exist, by the first inactive one. + +Capital letters will reverse the sort order. + +If the SORTING-TYPE is ?f or ?F, then GETKEY-FUNC specifies a function to be +called with point at the beginning of the record. It must return a +value that is compatible with COMPARE-FUNC, the function used to +compare entries. + +Comparing entries ignores case by default. However, with an optional argument +WITH-CASE, the sorting considers case as well. + +Sorting is done against the visible part of the headlines, it ignores hidden +links. + +When sorting is done, call `org-after-sorting-entries-or-items-hook'. + +A non-nil value for INTERACTIVE? is used to signal that this +function is being called interactively." + (interactive (list current-prefix-arg nil nil nil nil t)) + (let ((case-func (if with-case 'identity 'downcase)) + start beg end stars re re2 + txt what tmp) + ;; Find beginning and end of region to sort + (cond + ((org-region-active-p) + ;; we will sort the region + (setq end (region-end) + what "region") + (goto-char (region-beginning)) + (unless (org-at-heading-p) (outline-next-heading)) + (setq start (point))) + ((or (org-at-heading-p) + (ignore-errors (progn (org-back-to-heading) t))) + ;; we will sort the children of the current headline + (org-back-to-heading) + (setq start (point) + end (progn (org-end-of-subtree t t) + (or (bolp) (insert "\n")) + (when (>= (org-back-over-empty-lines) 1) + (forward-line 1)) + (point)) + what "children") + (goto-char start) + (outline-show-subtree) + (outline-next-heading)) + (t + ;; we will sort the top-level entries in this file + (goto-char (point-min)) + (or (org-at-heading-p) (outline-next-heading)) + (setq start (point)) + (goto-char (point-max)) + (beginning-of-line 1) + (when (looking-at ".*?\\S-") + ;; File ends in a non-white line + (end-of-line 1) + (insert "\n")) + (setq end (point-max)) + (setq what "top-level") + (goto-char start) + (org-show-all '(headings drawers blocks)))) + + (setq beg (point)) + (when (>= beg end) (goto-char start) (user-error "Nothing to sort")) + + (looking-at "\\(\\*+\\)") + (setq stars (match-string 1) + re (concat "^" (regexp-quote stars) " +") + re2 (concat "^" (regexp-quote (substring stars 0 -1)) "[ \t\n]") + txt (buffer-substring beg end)) + (unless (equal (substring txt -1) "\n") (setq txt (concat txt "\n"))) + (when (and (not (equal stars "*")) (string-match re2 txt)) + (user-error "Region to sort contains a level above the first entry")) + + (unless sorting-type + (message + "Sort %s: [a]lpha [n]umeric [p]riority p[r]operty todo[o]rder [f]unc + [t]ime [s]cheduled [d]eadline [c]reated cloc[k]ing + A/N/P/R/O/F/T/S/D/C/K means reversed:" + what) + (setq sorting-type (read-char-exclusive))) + + (unless getkey-func + (and (= (downcase sorting-type) ?f) + (setq getkey-func + (or (and interactive? + (org-read-function + "Function for extracting keys: ")) + (error "Missing key extractor"))))) + + (and (= (downcase sorting-type) ?r) + (not property) + (setq property + (completing-read "Property: " + (mapcar #'list (org-buffer-property-keys t)) + nil t))) + + (when (member sorting-type '(?k ?K)) (org-clock-sum)) + (message "Sorting entries...") + + (save-restriction + (narrow-to-region start end) + (let ((restore-clock? + ;; The clock marker is lost when using `sort-subr'; mark + ;; the clock with temporary `:org-clock-marker-backup' + ;; text property. + (when (and (eq (org-clocking-buffer) (current-buffer)) + (<= start (marker-position org-clock-marker)) + (>= end (marker-position org-clock-marker))) + (with-silent-modifications + (put-text-property (1- org-clock-marker) org-clock-marker + :org-clock-marker-backup t)) + t)) + (dcst (downcase sorting-type)) + (case-fold-search nil) + (now (current-time))) + (org-preserve-local-variables + (sort-subr + (/= dcst sorting-type) + ;; This function moves to the beginning character of the + ;; "record" to be sorted. + (lambda nil + (if (re-search-forward re nil t) + (goto-char (match-beginning 0)) + (goto-char (point-max)))) + ;; This function moves to the last character of the "record" being + ;; sorted. + (lambda nil + (save-match-data + (condition-case nil + (outline-forward-same-level 1) + (error + (goto-char (point-max)))))) + ;; This function returns the value that gets sorted against. + (lambda () + (cond + ((= dcst ?n) + (string-to-number + (org-sort-remove-invisible (org-get-heading t t t t)))) + ((= dcst ?a) + (funcall case-func + (org-sort-remove-invisible (org-get-heading t t t t)))) + ((= dcst ?k) + (or (get-text-property (point) :org-clock-minutes) 0)) + ((= dcst ?t) + (let ((end (save-excursion (outline-next-heading) (point)))) + (if (or (re-search-forward org-ts-regexp end t) + (re-search-forward org-ts-regexp-both end t)) + (org-time-string-to-seconds (match-string 0)) + (float-time now)))) + ((= dcst ?c) + (let ((end (save-excursion (outline-next-heading) (point)))) + (if (re-search-forward + (concat "^[ \t]*\\[" org-ts-regexp1 "\\]") + end t) + (org-time-string-to-seconds (match-string 0)) + (float-time now)))) + ((= dcst ?s) + (let ((end (save-excursion (outline-next-heading) (point)))) + (if (re-search-forward org-scheduled-time-regexp end t) + (org-time-string-to-seconds (match-string 1)) + (float-time now)))) + ((= dcst ?d) + (let ((end (save-excursion (outline-next-heading) (point)))) + (if (re-search-forward org-deadline-time-regexp end t) + (org-time-string-to-seconds (match-string 1)) + (float-time now)))) + ((= dcst ?p) + (if (re-search-forward org-priority-regexp (point-at-eol) t) + (string-to-char (match-string 2)) + org-priority-default)) + ((= dcst ?r) + (or (org-entry-get nil property) "")) + ((= dcst ?o) + (when (looking-at org-complex-heading-regexp) + (let* ((m (match-string 2)) + (s (if (member m org-done-keywords) '- '+))) + (- 99 (funcall s (length (member m org-todo-keywords-1))))))) + ((= dcst ?f) + (if getkey-func + (progn + (setq tmp (funcall getkey-func)) + (when (stringp tmp) (setq tmp (funcall case-func tmp))) + tmp) + (error "Invalid key function `%s'" getkey-func))) + (t (error "Invalid sorting type `%c'" sorting-type)))) + nil + (cond + ((= dcst ?a) 'org-string-collate-lessp) + ((= dcst ?f) + (or compare-func + (and interactive? + (org-read-function + (concat "Function for comparing keys " + "(empty for default `sort-subr' predicate): ") + 'allow-empty)))) + ((member dcst '(?p ?t ?s ?d ?c ?k)) '<)))) + (org-cycle-hide-drawers 'all) + (when restore-clock? + (move-marker org-clock-marker + (1+ (next-single-property-change + start :org-clock-marker-backup))) + (remove-text-properties (1- org-clock-marker) org-clock-marker + '(:org-clock-marker-backup t))))) + (run-hooks 'org-after-sorting-entries-or-items-hook) + (message "Sorting entries...done"))) + +(defun org-contextualize-keys (alist contexts) + "Return valid elements in ALIST depending on CONTEXTS. + +`org-agenda-custom-commands' or `org-capture-templates' are the +values used for ALIST, and `org-agenda-custom-commands-contexts' +or `org-capture-templates-contexts' are the associated contexts +definitions." + (let ((contexts + ;; normalize contexts + (mapcar + (lambda(c) (cond ((listp (cadr c)) + (list (car c) (car c) (nth 1 c))) + ((string= "" (cadr c)) + (list (car c) (car c) (nth 2 c))) + (t c))) + contexts)) + (a alist) r s) + ;; loop over all commands or templates + (dolist (c a) + (let (vrules repl) + (cond + ((not (assoc (car c) contexts)) + (push c r)) + ((and (assoc (car c) contexts) + (setq vrules (org-contextualize-validate-key + (car c) contexts))) + (mapc (lambda (vr) + (unless (equal (car vr) (cadr vr)) + (setq repl vr))) + vrules) + (if (not repl) (push c r) + (push (cadr repl) s) + (push + (cons (car c) + (cdr (or (assoc (cadr repl) alist) + (error "Undefined key `%s' as contextual replacement for `%s'" + (cadr repl) (car c))))) + r)))))) + ;; Return limited ALIST, possibly with keys modified, and deduplicated + (delq + nil + (delete-dups + (mapcar (lambda (x) + (let ((tpl (car x))) + (unless (delq + nil + (mapcar (lambda (y) + (equal y tpl)) + s)) + x))) + (reverse r)))))) + +(defun org-contextualize-validate-key (key contexts) + "Check CONTEXTS for agenda or capture KEY." + (let (res) + (dolist (r contexts) + (dolist (rr (car (last r))) + (when + (and (equal key (car r)) + (if (functionp rr) (funcall rr) + (or (and (eq (car rr) 'in-file) + (buffer-file-name) + (string-match (cdr rr) (buffer-file-name))) + (and (eq (car rr) 'in-mode) + (string-match (cdr rr) (symbol-name major-mode))) + (and (eq (car rr) 'in-buffer) + (string-match (cdr rr) (buffer-name))) + (when (and (eq (car rr) 'not-in-file) + (buffer-file-name)) + (not (string-match (cdr rr) (buffer-file-name)))) + (when (eq (car rr) 'not-in-mode) + (not (string-match (cdr rr) (symbol-name major-mode)))) + (when (eq (car rr) 'not-in-buffer) + (not (string-match (cdr rr) (buffer-name))))))) + (push r res)))) + (delete-dups (delq nil res)))) + +;; Defined to provide a value for defcustom, since there is no +;; string-collate-greaterp in Emacs. +(defun org-string-collate-greaterp (s1 s2) + "Return non-nil if S1 is greater than S2 in collation order." + (not (org-string-collate-lessp s1 s2))) + +;;;###autoload +(defun org-run-like-in-org-mode (cmd) + "Run a command, pretending that the current buffer is in Org mode. +This will temporarily bind local variables that are typically bound in +Org mode to the values they have in Org mode, and then interactively +call CMD." + (org-load-modules-maybe) + (let (binds) + (dolist (var (org-get-local-variables)) + (when (or (not (boundp (car var))) + (eq (symbol-value (car var)) + (default-value (car var)))) + (push (list (car var) `(quote ,(cadr var))) binds))) + (eval `(let ,binds + (call-interactively (quote ,cmd)))))) + +(defun org-get-category (&optional pos force-refresh) + "Get the category applying to position POS." + (save-match-data + (when force-refresh (org-refresh-category-properties)) + (let ((pos (or pos (point)))) + (or (get-text-property pos 'org-category) + (progn (org-refresh-category-properties) + (get-text-property pos 'org-category)))))) + +;;; Refresh properties + +(defun org-refresh-properties (dprop tprop) + "Refresh buffer text properties. +DPROP is the drawer property and TPROP is either the +corresponding text property to set, or an alist with each element +being a text property (as a symbol) and a function to apply to +the value of the drawer property." + (let* ((case-fold-search t) + (inhibit-read-only t) + (inherit? (org-property-inherit-p dprop)) + (property-re (org-re-property (concat (regexp-quote dprop) "\\+?") t)) + (global-or-keyword (and inherit? + (org--property-global-or-keyword-value dprop nil)))) + (with-silent-modifications + (org-with-point-at 1 + ;; Set global and keyword based values to the whole buffer. + (when global-or-keyword + (put-text-property (point-min) (point-max) tprop global-or-keyword)) + ;; Set values based on property-drawers throughout the document. + (while (re-search-forward property-re nil t) + (when (org-at-property-p) + (org-refresh-property tprop (org-entry-get (point) dprop) inherit?)) + (outline-next-heading)))))) + +(defun org-refresh-property (tprop p &optional inherit) + "Refresh the buffer text property TPROP from the drawer property P. + +The refresh happens only for the current entry, or the whole +sub-tree if optional argument INHERIT is non-nil. + +If point is before first headline, the function applies to the +part before the first headline. In that particular case, when +optional argument INHERIT is non-nil, it refreshes properties for +the whole buffer." + (save-excursion + (org-back-to-heading-or-point-min t) + (let ((start (point)) + (end (save-excursion + (cond ((and inherit (org-before-first-heading-p)) + (point-max)) + (inherit + (org-end-of-subtree t t)) + ((outline-next-heading)) + ((point-max)))))) + (if (symbolp tprop) + ;; TPROP is a text property symbol. + (put-text-property start end tprop p) + ;; TPROP is an alist with (property . function) elements. + (pcase-dolist (`(,prop . ,f) tprop) + (put-text-property start end prop (funcall f p))))))) + +(defun org-refresh-category-properties () + "Refresh category text properties in the buffer." + (let ((case-fold-search t) + (inhibit-read-only t) + (default-category + (cond ((null org-category) + (if buffer-file-name + (file-name-sans-extension + (file-name-nondirectory buffer-file-name)) + "???")) + ((symbolp org-category) (symbol-name org-category)) + (t org-category)))) + (with-silent-modifications + (org-with-wide-buffer + ;; Set buffer-wide property from keyword. Search last #+CATEGORY + ;; keyword. If none is found, fall-back to `org-category' or + ;; buffer file name, or set it by the document property drawer. + (put-text-property + (point-min) (point-max) + 'org-category + (catch 'buffer-category + (goto-char (point-max)) + (while (re-search-backward "^[ \t]*#\\+CATEGORY:" (point-min) t) + (let ((element (org-element-at-point))) + (when (eq (org-element-type element) 'keyword) + (throw 'buffer-category + (org-element-property :value element))))) + default-category)) + ;; Set categories from the document property drawer or + ;; property drawers in the outline. If category is found in + ;; the property drawer for the whole buffer that value + ;; overrides the keyword-based value set above. + (goto-char (point-min)) + (let ((regexp (org-re-property "CATEGORY"))) + (while (re-search-forward regexp nil t) + (let ((value (match-string-no-properties 3))) + (when (org-at-property-p) + (put-text-property + (save-excursion (org-back-to-heading-or-point-min t)) + (save-excursion (if (org-before-first-heading-p) + (point-max) + (org-end-of-subtree t t))) + 'org-category + value))))))))) + +(defun org-refresh-stats-properties () + "Refresh stats text properties in the buffer." + (with-silent-modifications + (org-with-point-at 1 + (let ((regexp (concat org-outline-regexp-bol + ".*\\[\\([0-9]*\\)\\(?:%\\|/\\([0-9]*\\)\\)\\]"))) + (while (re-search-forward regexp nil t) + (let* ((numerator (string-to-number (match-string 1))) + (denominator (and (match-end 2) + (string-to-number (match-string 2)))) + (stats (cond ((not denominator) numerator) ;percent + ((= denominator 0) 0) + (t (/ (* numerator 100) denominator))))) + (put-text-property (point) (progn (org-end-of-subtree t t) (point)) + 'org-stats stats))))))) + +(defun org-refresh-effort-properties () + "Refresh effort properties." + (org-refresh-properties + org-effort-property + '((effort . identity) + (effort-minutes . org-duration-to-minutes)))) + +(defun org-find-file-at-mouse (ev) + "Open file link or URL at mouse." + (interactive "e") + (mouse-set-point ev) + (org-open-at-point 'in-emacs)) + +(defun org-open-at-mouse (ev) + "Open file link or URL at mouse. +See the docstring of `org-open-file' for details." + (interactive "e") + (mouse-set-point ev) + (when (eq major-mode 'org-agenda-mode) + (org-agenda-copy-local-variable 'org-link-abbrev-alist-local)) + (org-open-at-point)) + +(defvar org-window-config-before-follow-link nil + "The window configuration before following a link. +This is saved in case the need arises to restore it.") + +(defun org--file-default-apps () + "Return the default applications for this operating system." + (pcase system-type + (`darwin org-file-apps-macos) + (`windows-nt org-file-apps-windowsnt) + (_ org-file-apps-gnu))) + +(defun org--file-apps-entry-dlink-p (entry) + "Non-nil if ENTRY should be matched against the link by `org-open-file'. + +It assumes that is the case when the entry uses a regular +expression which has at least one grouping construct and the +action is either a Lisp form or a command string containing +\"%1\", i.e., using at least one subexpression match as +a parameter." + (pcase entry + (`(,selector . ,action) + (and (stringp selector) + (> (regexp-opt-depth selector) 0) + (or (and (stringp action) + (string-match "%[0-9]" action)) + (consp action)))) + (_ nil))) + +(defun org--file-apps-regexp-alist (list &optional add-auto-mode) + "Convert extensions to regular expressions in the cars of LIST. + +Also, weed out any non-string entries, because the return value +is used only for regexp matching. + +When ADD-AUTO-MODE is non-nil, make all matches in `auto-mode-alist' +point to the symbol `emacs', indicating that the file should be +opened in Emacs." + (append + (delq nil + (mapcar (lambda (x) + (unless (not (stringp (car x))) + (if (string-match "\\W" (car x)) + x + (cons (concat "\\." (car x) "\\'") (cdr x))))) + list)) + (when add-auto-mode + (mapcar (lambda (x) (cons (car x) 'emacs)) auto-mode-alist)))) + +;;;###autoload +(defun org-open-file (path &optional in-emacs line search) + "Open the file at PATH. +First, this expands any special file name abbreviations. Then the +configuration variable `org-file-apps' is checked if it contains an +entry for this file type, and if yes, the corresponding command is launched. + +If no application is found, Emacs simply visits the file. + +With optional prefix argument IN-EMACS, Emacs will visit the file. +With a double \\[universal-argument] \\[universal-argument] \ +prefix arg, Org tries to avoid opening in Emacs +and to use an external application to visit the file. + +Optional LINE specifies a line to go to, optional SEARCH a string +to search for. If LINE or SEARCH is given, the file will be +opened in Emacs, unless an entry from `org-file-apps' that makes +use of groups in a regexp matches. + +If you want to change the way frames are used when following a +link, please customize `org-link-frame-setup'. + +If the file does not exist, throw an error." + (let* ((file (if (equal path "") buffer-file-name + (substitute-in-file-name (expand-file-name path)))) + (file-apps (append org-file-apps (org--file-default-apps))) + (apps (cl-remove-if #'org--file-apps-entry-dlink-p file-apps)) + (apps-dlink (cl-remove-if-not #'org--file-apps-entry-dlink-p + file-apps)) + (remp (and (assq 'remote apps) (file-remote-p file))) + (dirp (unless remp (file-directory-p file))) + (file (if (and dirp org-open-directory-means-index-dot-org) + (concat (file-name-as-directory file) "index.org") + file)) + (a-m-a-p (assq 'auto-mode apps)) + (dfile (downcase file)) + ;; Reconstruct the original link from the PATH, LINE and + ;; SEARCH args. + (link (cond (line (concat file "::" (number-to-string line))) + (search (concat file "::" search)) + (t file))) + (dlink (downcase link)) + (ext + (and (string-match "\\`.*?\\.\\([a-zA-Z0-9]+\\(\\.gz\\)?\\)\\'" dfile) + (match-string 1 dfile))) + (save-position-maybe + (let ((old-buffer (current-buffer)) + (old-pos (point)) + (old-mode major-mode)) + (lambda () + (and (derived-mode-p 'org-mode) + (eq old-mode 'org-mode) + (or (not (eq old-buffer (current-buffer))) + (not (eq old-pos (point)))) + (org-mark-ring-push old-pos old-buffer))))) + cmd link-match-data) + (cond + ((member in-emacs '((16) system)) + (setq cmd (cdr (assq 'system apps)))) + (in-emacs (setq cmd 'emacs)) + (t + (setq cmd (or (and remp (cdr (assq 'remote apps))) + (and dirp (cdr (assq 'directory apps))) + ;; First, try matching against apps-dlink if we + ;; get a match here, store the match data for + ;; later. + (let ((match (assoc-default dlink apps-dlink + 'string-match))) + (if match + (progn (setq link-match-data (match-data)) + match) + (progn (setq in-emacs (or in-emacs line search)) + nil))) ; if we have no match in apps-dlink, + ; always open the file in emacs if line or search + ; is given (for backwards compatibility) + (assoc-default dfile + (org--file-apps-regexp-alist apps a-m-a-p) + 'string-match) + (cdr (assoc ext apps)) + (cdr (assq t apps)))))) + (when (eq cmd 'system) + (setq cmd (cdr (assq 'system apps)))) + (when (eq cmd 'default) + (setq cmd (cdr (assoc t apps)))) + (when (eq cmd 'mailcap) + (require 'mailcap) + (mailcap-parse-mailcaps) + (let* ((mime-type (mailcap-extension-to-mime (or ext ""))) + (command (mailcap-mime-info mime-type))) + (if (stringp command) + (setq cmd command) + (setq cmd 'emacs)))) + (when (and (not (eq cmd 'emacs)) ; Emacs has no problems with non-ex files + (not (file-exists-p file)) + (not org-open-non-existing-files)) + (user-error "No such file: %s" file)) + (cond + ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) + ;; Remove quotes around the file name - we'll use shell-quote-argument. + (while (string-match "['\"]%s['\"]" cmd) + (setq cmd (replace-match "%s" t t cmd))) + (setq cmd (replace-regexp-in-string + "%s" + (shell-quote-argument (convert-standard-filename file)) + cmd + nil t)) + + ;; Replace "%1", "%2" etc. in command with group matches from regex + (save-match-data + (let ((match-index 1) + (number-of-groups (- (/ (length link-match-data) 2) 1))) + (set-match-data link-match-data) + (while (<= match-index number-of-groups) + (let ((regex (concat "%" (number-to-string match-index))) + (replace-with (match-string match-index dlink))) + (while (string-match regex cmd) + (setq cmd (replace-match replace-with t t cmd)))) + (setq match-index (+ match-index 1))))) + + (save-window-excursion + (message "Running %s...done" cmd) + ;; Handlers such as "gio open" and kde-open5 start viewer in background + ;; and exit immediately. Use pipe connection type instead of pty to + ;; avoid killing children processes with SIGHUP when temporary terminal + ;; session is finished. + ;; + ;; TODO: Once minimum Emacs version is 25.1 or above, consider using + ;; the `make-process' invocation from 5db61eb0f929 to get more helpful + ;; error messages. + (let ((process-connection-type nil)) + (start-process-shell-command cmd nil cmd)) + (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait)))) + ((or (stringp cmd) + (eq cmd 'emacs)) + (funcall (cdr (assq 'file org-link-frame-setup)) file) + (widen) + (cond (line (org-goto-line line) + (when (derived-mode-p 'org-mode) (org-reveal))) + (search (condition-case err + (org-link-search search) + ;; Save position before error-ing out so user + ;; can easily move back to the original buffer. + (error (funcall save-position-maybe) + (error (nth 1 err))))))) + ((functionp cmd) + (save-match-data + (set-match-data link-match-data) + (condition-case nil + (funcall cmd file link) + ;; FIXME: Remove this check when most default installations + ;; of Emacs have at least Org 9.0. + ((debug wrong-number-of-arguments wrong-type-argument + invalid-function) + (user-error "Please see Org News for version 9.0 about \ +`org-file-apps'--Lisp error: %S" cmd))))) + ((consp cmd) + ;; FIXME: Remove this check when most default installations of + ;; Emacs have at least Org 9.0. Heads-up instead of silently + ;; fall back to `org-link-frame-setup' for an old usage of + ;; `org-file-apps' with sexp instead of a function for `cmd'. + (user-error "Please see Org News for version 9.0 about \ +`org-file-apps'--Error: Deprecated usage of %S" cmd)) + (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) + (funcall save-position-maybe))) + +;;;###autoload +(defun org-open-at-point-global () + "Follow a link or a time-stamp like Org mode does. +Also follow links and emails as seen by `thing-at-point'. +This command can be called in any mode to follow an external +link or a time-stamp that has Org mode syntax. Its behavior +is undefined when called on internal links like fuzzy links. +Raise a user error when there is nothing to follow." + (interactive) + (let ((tap-url (thing-at-point 'url)) + (tap-email (thing-at-point 'email))) + (cond ((org-in-regexp org-link-any-re) + (org-link-open-from-string (match-string-no-properties 0))) + ((or (org-in-regexp org-ts-regexp-both nil t) + (org-in-regexp org-tsr-regexp-both nil t)) + (org-follow-timestamp-link)) + (tap-url (org-link-open-from-string tap-url)) + (tap-email (org-link-open-from-string + (concat "mailto:" tap-email))) + (t (user-error "No link found"))))) + +(defvar org-open-at-point-functions nil + "Hook that is run when following a link at point. + +Functions in this hook must return t if they identify and follow +a link at point. If they don't find anything interesting at point, +they must return nil.") + +(defun org-open-at-point (&optional arg) + "Open link, timestamp, footnote or tags at point. + +When point is on a link, follow it. Normally, files will be +opened by an appropriate application. If the optional prefix +argument ARG is non-nil, Emacs will visit the file. With +a double prefix argument, try to open outside of Emacs, in the +application the system uses for this file type. + +When point is on a timestamp, open the agenda at the day +specified. + +When point is a footnote definition, move to the first reference +found. If it is on a reference, move to the associated +definition. + +When point is on a headline, display a list of every link in the +entry, so it is possible to pick one, or all, of them. If point +is on a tag, call `org-tags-view' instead. + +On top of syntactically correct links, this function also tries +to open links and time-stamps in comments, node properties, and +keywords if point is on something looking like a timestamp or +a link." + (interactive "P") + (org-load-modules-maybe) + (setq org-window-config-before-follow-link (current-window-configuration)) + (org-remove-occur-highlights nil nil t) + (unless (run-hook-with-args-until-success 'org-open-at-point-functions) + (let* ((context + ;; Only consider supported types, even if they are not the + ;; closest one. + (org-element-lineage + (org-element-context) + '(citation citation-reference clock comment comment-block + footnote-definition footnote-reference headline + inline-src-block inlinetask keyword link node-property + planning src-block timestamp) + t)) + (type (org-element-type context)) + (value (org-element-property :value context))) + (cond + ((not type) (user-error "No link found")) + ;; No valid link at point. For convenience, look if something + ;; looks like a link under point in some specific places. + ((memq type '(comment comment-block node-property keyword)) + (call-interactively #'org-open-at-point-global)) + ;; On a headline or an inlinetask, but not on a timestamp, + ;; a link, a footnote reference or a citation. + ((memq type '(headline inlinetask)) + (org-match-line org-complex-heading-regexp) + (let ((tags-beg (match-beginning 5)) + (tags-end (match-end 5))) + (if (and tags-beg (>= (point) tags-beg) (< (point) tags-end)) + ;; On tags. + (org-tags-view + arg + (save-excursion + (let* ((beg-tag (or (search-backward ":" tags-beg 'at-limit) (point))) + (end-tag (search-forward ":" tags-end nil 2))) + (buffer-substring (1+ beg-tag) (1- end-tag))))) + ;; Not on tags. + (pcase (org-offer-links-in-entry (current-buffer) (point) arg) + (`(nil . ,_) + (require 'org-attach) + (when (org-attach-dir) + (message "Opening attachment") + (if (equal arg '(4)) + (org-attach-reveal-in-emacs) + (org-attach-reveal)))) + (`(,links . ,links-end) + (dolist (link (if (stringp links) (list links) links)) + (search-forward link nil links-end) + (goto-char (match-beginning 0)) + (org-open-at-point arg))))))) + ;; On a footnote reference or at definition's label. + ((or (eq type 'footnote-reference) + (and (eq type 'footnote-definition) + (save-excursion + ;; Do not validate action when point is on the + ;; spaces right after the footnote label, in order + ;; to be on par with behavior on links. + (skip-chars-forward " \t") + (let ((begin + (org-element-property :contents-begin context))) + (if begin (< (point) begin) + (= (org-element-property :post-affiliated context) + (line-beginning-position))))))) + (org-footnote-action)) + ;; On a planning line. Check if we are really on a timestamp. + ((and (eq type 'planning) + (org-in-regexp org-ts-regexp-both nil t)) + (org-follow-timestamp-link)) + ;; On a clock line, make sure point is on the timestamp + ;; before opening it. + ((and (eq type 'clock) + value + (>= (point) (org-element-property :begin value)) + (<= (point) (org-element-property :end value))) + (org-follow-timestamp-link)) + ((eq type 'src-block) (org-babel-open-src-block-result)) + ;; Do nothing on white spaces after an object. + ((>= (point) + (save-excursion + (goto-char (org-element-property :end context)) + (skip-chars-backward " \t") + (point))) + (user-error "No link found")) + ((eq type 'inline-src-block) (org-babel-open-src-block-result)) + ((eq type 'timestamp) (org-follow-timestamp-link)) + ((eq type 'link) (org-link-open context arg)) + ((memq type '(citation citation-reference)) (org-cite-follow context arg)) + (t (user-error "No link found"))))) + (run-hook-with-args 'org-follow-link-hook)) + +;;;###autoload +(defun org-offer-links-in-entry (buffer marker &optional nth zero) + "Offer links in the current entry and return the selected link. +If there is only one link, return it. +If NTH is an integer, return the NTH link found. +If ZERO is a string, check also this string for a link, and if +there is one, return it." + (with-current-buffer buffer + (org-with-wide-buffer + (goto-char marker) + (let ((cnt ?0) + have-zero end links link c) + (when (and (stringp zero) (string-match org-link-bracket-re zero)) + (push (match-string 0 zero) links) + (setq cnt (1- cnt) have-zero t)) + (save-excursion + (org-back-to-heading t) + (setq end (save-excursion (outline-next-heading) (point))) + (while (re-search-forward org-link-any-re end t) + (push (match-string 0) links)) + (setq links (org-uniquify (reverse links)))) + (cond + ((null links) + (message "No links")) + ((equal (length links) 1) + (setq link (car links))) + ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) + (setq link (nth (if have-zero nth (1- nth)) links))) + (t ; we have to select a link + (save-excursion + (save-window-excursion + (delete-other-windows) + (with-output-to-temp-buffer "*Select Link*" + (dolist (l links) + (cond + ((not (string-match org-link-bracket-re l)) + (princ (format "[%c] %s\n" (cl-incf cnt) + (org-unbracket-string "<" ">" l)))) + ((match-end 2) + (princ (format "[%c] %s (%s)\n" (cl-incf cnt) + (match-string 2 l) (match-string 1 l)))) + (t (princ (format "[%c] %s\n" (cl-incf cnt) + (match-string 1 l))))))) + (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) + (message "Select link to open, RET to open all:") + (setq c (read-char-exclusive)) + (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) + (when (equal c ?q) (user-error "Abort")) + (if (equal c ?\C-m) + (setq link links) + (setq nth (- c ?0)) + (when have-zero (setq nth (1+ nth))) + (unless (and (integerp nth) (>= (length links) nth)) + (user-error "Invalid link selection")) + (setq link (nth (1- nth) links))))) + (cons link end))))) + +;;; File search + +(defun org-do-occur (regexp &optional cleanup) + "Call the Emacs command `occur'. +If CLEANUP is non-nil, remove the printout of the regular expression +in the *Occur* buffer. This is useful if the regex is long and not useful +to read." + (occur regexp) + (when cleanup + (let ((cwin (selected-window)) win beg end) + (when (setq win (get-buffer-window "*Occur*")) + (select-window win)) + (goto-char (point-min)) + (when (re-search-forward "match[a-z]+" nil t) + (setq beg (match-end 0)) + (when (re-search-forward "^[ \t]*[0-9]+" nil t) + (setq end (1- (match-beginning 0))))) + (and beg end (let ((inhibit-read-only t)) (delete-region beg end))) + (goto-char (point-min)) + (select-window cwin)))) + + +;;; The Mark Ring + +(defvar org-mark-ring nil + "Mark ring for positions before jumps in Org mode.") + +(defvar org-mark-ring-last-goto nil + "Last position in the mark ring used to go back.") + +;; Fill and close the ring +(setq org-mark-ring nil) +(setq org-mark-ring-last-goto nil) ;in case file is reloaded + +(dotimes (_ org-mark-ring-length) (push (make-marker) org-mark-ring)) +(setcdr (nthcdr (1- org-mark-ring-length) org-mark-ring) + org-mark-ring) + +(defun org-mark-ring-push (&optional pos buffer) + "Put the current position into the mark ring and rotate it. +Also push position into the Emacs mark ring. If optional +argument POS and BUFFER are not nil, mark this location instead." + (interactive) + (let ((pos (or pos (point))) + (buffer (or buffer (current-buffer)))) + (with-current-buffer buffer + (org-with-point-at pos (push-mark nil t))) + (setq org-mark-ring (nthcdr (1- org-mark-ring-length) org-mark-ring)) + (move-marker (car org-mark-ring) pos buffer)) + (message + (substitute-command-keys + "Position saved to mark ring, go back with `\\[org-mark-ring-goto]'."))) + +(defun org-mark-ring-goto (&optional n) + "Jump to the previous position in the mark ring. +With prefix arg N, jump back that many stored positions. When +called several times in succession, walk through the entire ring. +Org mode commands jumping to a different position in the current file, +or to another Org file, automatically push the old position onto the ring." + (interactive "p") + (let (p m) + (if (eq last-command this-command) + (setq p (nthcdr n (or org-mark-ring-last-goto org-mark-ring))) + (setq p org-mark-ring)) + (setq org-mark-ring-last-goto p) + (setq m (car p)) + (pop-to-buffer-same-window (marker-buffer m)) + (goto-char m) + (when (or (org-invisible-p) (org-invisible-p2)) (org-show-context 'mark-goto)))) + +;;; Following specific links + +(defvar org-agenda-buffer-tmp-name) +(defvar org-agenda-start-on-weekday) +(defvar org-agenda-buffer-name) +(defun org-follow-timestamp-link () + "Open an agenda view for the time-stamp date/range at point." + ;; Avoid changing the global value. + (let ((org-agenda-buffer-name org-agenda-buffer-name)) + (cond + ((org-at-date-range-p t) + (let ((org-agenda-start-on-weekday) + (t1 (match-string 1)) + (t2 (match-string 2)) tt1 tt2) + (setq tt1 (time-to-days (org-time-string-to-time t1)) + tt2 (time-to-days (org-time-string-to-time t2))) + (let ((org-agenda-buffer-tmp-name + (format "*Org Agenda(a:%s)" + (concat (substring t1 0 10) "--" (substring t2 0 10))))) + (org-agenda-list nil tt1 (1+ (- tt2 tt1)))))) + ((org-at-timestamp-p 'lax) + (let ((org-agenda-buffer-tmp-name + (format "*Org Agenda(a:%s)" (substring (match-string 1) 0 10)))) + (org-agenda-list nil (time-to-days (org-time-string-to-time + (substring (match-string 1) 0 10))) + 1))) + (t (error "This should not happen"))))) + + +;;; Following file links +(declare-function mailcap-parse-mailcaps "mailcap" (&optional path force)) +(declare-function mailcap-extension-to-mime "mailcap" (extn)) +(declare-function mailcap-mime-info + "mailcap" (string &optional request no-decode)) +(defvar org-wait nil) + +;;;; Refiling + +(defun org-get-org-file () + "Read a filename, with default directory `org-directory'." + (let ((default (or org-default-notes-file remember-data-file))) + (read-file-name (format "File name [%s]: " default) + (file-name-as-directory org-directory) + default))) + +(defun org-notes-order-reversed-p () + "Check if the current file should receive notes in reversed order." + (cond + ((not org-reverse-note-order) nil) + ((eq t org-reverse-note-order) t) + ((not (listp org-reverse-note-order)) nil) + (t (catch 'exit + (dolist (entry org-reverse-note-order) + (when (string-match (car entry) buffer-file-name) + (throw 'exit (cdr entry)))))))) + +(defvar org-agenda-new-buffers nil + "Buffers created to visit agenda files.") + +(declare-function org-string-nw-p "org-macs" (s)) +;;;; Dynamic blocks + +(defun org-find-dblock (name) + "Find the first dynamic block with name NAME in the buffer. +If not found, stay at current position and return nil." + (let ((case-fold-search t) pos) + (save-excursion + (goto-char (point-min)) + (setq pos (and (re-search-forward + (concat "^[ \t]*#\\+\\(?:BEGIN\\|begin\\):[ \t]+" name "\\>") nil t) + (match-beginning 0)))) + (when pos (goto-char pos)) + pos)) + +(defun org-create-dblock (plist) + "Create a dynamic block section, with parameters taken from PLIST. +PLIST must contain a :name entry which is used as the name of the block." + (when (string-match "\\S-" (buffer-substring (point-at-bol) (point-at-eol))) + (end-of-line 1) + (newline)) + (let ((col (current-column)) + (name (plist-get plist :name))) + (insert "#+BEGIN: " name) + (while plist + (if (eq (car plist) :name) + (setq plist (cddr plist)) + (insert " " (prin1-to-string (pop plist))))) + (insert "\n\n" (make-string col ?\ ) "#+END:\n") + (beginning-of-line -2))) + +(defun org-prepare-dblock () + "Prepare dynamic block for refresh. +This empties the block, puts the cursor at the insert position and returns +the property list including an extra property :name with the block name." + (unless (looking-at org-dblock-start-re) + (user-error "Not at a dynamic block")) + (let* ((begdel (1+ (match-end 0))) + (name (org-no-properties (match-string 1))) + (params (append (list :name name) + (read (concat "(" (match-string 3) ")"))))) + (save-excursion + (beginning-of-line 1) + (skip-chars-forward " \t") + (setq params (plist-put params :indentation-column (current-column)))) + (unless (re-search-forward org-dblock-end-re nil t) + (error "Dynamic block not terminated")) + (setq params + (append params + (list :content (buffer-substring + begdel (match-beginning 0))))) + (delete-region begdel (match-beginning 0)) + (goto-char begdel) + (open-line 1) + params)) + +(defun org-map-dblocks (&optional command) + "Apply COMMAND to all dynamic blocks in the current buffer. +If COMMAND is not given, use `org-update-dblock'." + (let ((cmd (or command 'org-update-dblock))) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward org-dblock-start-re nil t) + (goto-char (match-beginning 0)) + (save-excursion + (condition-case nil + (funcall cmd) + (error (message "Error during update of dynamic block")))) + (unless (re-search-forward org-dblock-end-re nil t) + (error "Dynamic block not terminated")))))) + +(defvar org-dynamic-block-alist nil + "Alist defining all the Org dynamic blocks. + +The key is the dynamic block type name, as a string. The value +is the function used to insert the dynamic block. + +Use `org-dynamic-block-define' to populate it.") + +(defun org-dynamic-block-function (type) + "Return function associated to a given dynamic block type. +TYPE is the dynamic block type, as a string." + (cdr (assoc type org-dynamic-block-alist))) + +(defun org-dynamic-block-types () + "List all defined dynamic block types." + (mapcar #'car org-dynamic-block-alist)) + +(defun org-dynamic-block-define (type func) + "Define dynamic block TYPE with FUNC. +TYPE is a string. FUNC is the function creating the dynamic +block of such type." + (pcase (assoc type org-dynamic-block-alist) + (`nil (push (cons type func) org-dynamic-block-alist)) + (def (setcdr def func)))) + +(defun org-dynamic-block-insert-dblock (type &optional interactive-p) + "Insert a dynamic block of type TYPE. +When used interactively, select the dynamic block types among +defined types, per `org-dynamic-block-define'. If INTERACTIVE-P +is non-nil, call the dynamic block function interactively." + (interactive (list (completing-read "Dynamic block: " + (org-dynamic-block-types)) + t)) + (pcase (org-dynamic-block-function type) + (`nil (error "No such dynamic block: %S" type)) + ((and f (pred functionp)) + (if interactive-p (call-interactively f) (funcall f))) + (_ (error "Invalid function for dynamic block %S" type)))) + +(defun org-dblock-update (&optional arg) + "User command for updating dynamic blocks. +Update the dynamic block at point. With prefix ARG, update all dynamic +blocks in the buffer." + (interactive "P") + (if arg + (org-update-all-dblocks) + (or (looking-at org-dblock-start-re) + (org-beginning-of-dblock)) + (org-update-dblock))) + +(defun org-update-dblock () + "Update the dynamic block at point. +This means to empty the block, parse for parameters and then call +the correct writing function." + (interactive) + (save-excursion + (let* ((win (selected-window)) + (pos (point)) + (line (org-current-line)) + (params (org-prepare-dblock)) + (name (plist-get params :name)) + (indent (plist-get params :indentation-column)) + (cmd (intern (concat "org-dblock-write:" name)))) + (message "Updating dynamic block `%s' at line %d..." name line) + (funcall cmd params) + (message "Updating dynamic block `%s' at line %d...done" name line) + (goto-char pos) + (when (and indent (> indent 0)) + (setq indent (make-string indent ?\ )) + (save-excursion + (select-window win) + (org-beginning-of-dblock) + (forward-line 1) + (while (not (looking-at org-dblock-end-re)) + (insert indent) + (beginning-of-line 2)) + (when (looking-at org-dblock-end-re) + (and (looking-at "[ \t]+") + (replace-match "")) + (insert indent))))))) + +(defun org-beginning-of-dblock () + "Find the beginning of the dynamic block at point. +Error if there is no such block at point." + (let ((pos (point)) + beg) + (end-of-line 1) + (if (and (re-search-backward org-dblock-start-re nil t) + (setq beg (match-beginning 0)) + (re-search-forward org-dblock-end-re nil t) + (> (match-end 0) pos)) + (goto-char beg) + (goto-char pos) + (error "Not in a dynamic block")))) + +(defun org-update-all-dblocks () + "Update all dynamic blocks in the buffer. +This function can be used in a hook." + (interactive) + (when (derived-mode-p 'org-mode) + (org-map-dblocks 'org-update-dblock))) + + +;;;; Completion + +(declare-function org-export-backend-options "ox" (cl-x) t) +(defun org-get-export-keywords () + "Return a list of all currently understood export keywords. +Export keywords include options, block names, attributes and +keywords relative to each registered export back-end." + (let (keywords) + (dolist (backend + (bound-and-true-p org-export-registered-backends) + (delq nil keywords)) + ;; Back-end name (for keywords, like #+LATEX:) + (push (upcase (symbol-name (org-export-backend-name backend))) keywords) + (dolist (option-entry (org-export-backend-options backend)) + ;; Back-end options. + (push (nth 1 option-entry) keywords))))) + +(defconst org-options-keywords + '("ARCHIVE:" "AUTHOR:" "BIND:" "CATEGORY:" "COLUMNS:" "CREATOR:" "DATE:" + "DESCRIPTION:" "DRAWERS:" "EMAIL:" "EXCLUDE_TAGS:" "FILETAGS:" "INCLUDE:" + "INDEX:" "KEYWORDS:" "LANGUAGE:" "MACRO:" "OPTIONS:" "PROPERTY:" + "PRIORITIES:" "SELECT_TAGS:" "SEQ_TODO:" "SETUPFILE:" "STARTUP:" "TAGS:" + "TITLE:" "TODO:" "TYP_TODO:" "SELECT_TAGS:" "EXCLUDE_TAGS:")) + +(defcustom org-structure-template-alist + '(("a" . "export ascii") + ("c" . "center") + ("C" . "comment") + ("e" . "example") + ("E" . "export") + ("h" . "export html") + ("l" . "export latex") + ("q" . "quote") + ("s" . "src") + ("v" . "verse")) + "An alist of keys and block types. +`org-insert-structure-template' will display a menu with this +list of templates to choose from. The block type is inserted, +with \"#+BEGIN_\" and \"#+END_\" added automatically. + +The menu keys are defined by the car of each entry in this alist. +If two entries have the keys \"a\" and \"aa\" respectively, the +former will be inserted by typing \"a TAB/RET/SPC\" and the +latter will be inserted by typing \"aa\". If an entry with the +key \"aab\" is later added, it can be inserted by typing \"ab\". + +If loaded, Org Tempo also uses `org-structure-template-alist'. A +block can be inserted by pressing TAB after the string \"<KEY\"." + :group 'org-edit-structure + :type '(repeat + (cons (string :tag "Key") + (string :tag "Template"))) + :package-version '(Org . "9.2")) + +(defun org--check-org-structure-template-alist (&optional checklist) + "Check whether `org-structure-template-alist' is set up correctly. +In particular, check if the Org 9.2 format is used as opposed to +previous format." + (let ((elm (cl-remove-if-not (lambda (x) (listp (cdr x))) + (or (eval checklist) + org-structure-template-alist)))) + (when elm + (org-display-warning + (format " +Please update the entries of `%s'. + +In Org 9.2 the format was changed from something like + + (\"s\" \"#+BEGIN_SRC ?\\n#+END_SRC\") + +to something like + + (\"s\" . \"src\") + +Please refer to the documentation of `org-structure-template-alist'. + +The following entries must be updated: + +%s" + (or checklist 'org-structure-template-alist) + (pp-to-string elm)))))) + +(defun org--insert-structure-template-mks () + "Present `org-structure-template-alist' with `org-mks'. + +Menus are added if keys require more than one keystroke. Tabs +are added to single key entries when more than one stroke is +needed. Keys longer than two characters are reduced to two +characters." + (org--check-org-structure-template-alist) + (let* (case-fold-search + (templates (append org-structure-template-alist + '(("\t" . "Press TAB, RET or SPC to write block name")))) + (keys (mapcar #'car templates)) + (start-letters + (delete-dups (mapcar (lambda (key) (substring key 0 1)) keys))) + ;; Sort each element of `org-structure-template-alist' into + ;; sublists according to the first letter. + (superlist + (mapcar (lambda (letter) + (list letter + (cl-remove-if-not + (apply-partially #'string-match-p (concat "^" letter)) + templates :key #'car))) + start-letters))) + (org-mks + (apply #'append + ;; Make an `org-mks' table. If only one element is + ;; present in a sublist, make it part of the top-menu, + ;; otherwise make a submenu according to the starting + ;; letter and populate it. + (mapcar (lambda (sublist) + (if (eq 1 (length (cadr sublist))) + (mapcar (lambda (elm) + (list (substring (car elm) 0 1) + (cdr elm) "")) + (cadr sublist)) + ;; Create submenu. + (let* ((topkey (car sublist)) + (elms (cadr sublist)) + (keys (mapcar #'car elms)) + (long (> (length elms) 3))) + (append + (list + ;; Make a description of the submenu. + (list topkey + (concat + (mapconcat #'cdr + (cl-subseq elms 0 (if long 3 (length elms))) + ", ") + (when long ", ...")))) + ;; List of entries in submenu. + (cl-mapcar #'list + (org--insert-structure-template-unique-keys keys) + (mapcar #'cdr elms) + (make-list (length elms) "")))))) + superlist)) + "Select a key\n============" + "Key: "))) + +(defun org--insert-structure-template-unique-keys (keys) + "Make a list of unique, two characters long elements from KEYS. + +Elements of length one have a tab appended. Elements of length +two are kept as is. Longer elements are truncated to length two. + +If an element cannot be made unique, an error is raised." + (let ((ordered-keys (cl-sort (copy-sequence keys) #'< :key #'length)) + menu-keys) + (dolist (key ordered-keys) + (let ((potential-key + (cl-case (length key) + (1 (concat key "\t")) + (2 key) + (otherwise + (cl-find-if-not (lambda (k) (assoc k menu-keys)) + (mapcar (apply-partially #'concat (substring key 0 1)) + (split-string (substring key 1) "" t))))))) + (if (or (not potential-key) (assoc potential-key menu-keys)) + (user-error "Could not make unique key for `%s'" key) + (push (cons potential-key key) menu-keys)))) + (mapcar #'car + (cl-sort menu-keys #'< + :key (lambda (elm) (cl-position (cdr elm) keys)))))) + +(defun org-insert-structure-template (type) + "Insert a block structure of the type #+begin_foo/#+end_foo. +Select a block from `org-structure-template-alist' then type +either RET, TAB or SPC to write the block type. With an active +region, wrap the region in the block. Otherwise, insert an empty +block." + (interactive + (list (pcase (org--insert-structure-template-mks) + (`("\t" . ,_) (read-string "Structure type: ")) + (`(,_ ,choice . ,_) choice)))) + (let* ((region? (use-region-p)) + (region-start (and region? (region-beginning))) + (region-end (and region? (copy-marker (region-end)))) + (extended? (string-match-p "\\`\\(src\\|export\\)\\'" type)) + (verbatim? (string-match-p + (concat "\\`" (regexp-opt '("example" "export" "src"))) + type))) + (when region? (goto-char region-start)) + (let ((column (current-indentation))) + (if (save-excursion (skip-chars-backward " \t") (bolp)) + (beginning-of-line) + (insert "\n")) + (save-excursion + (indent-to column) + (insert (format "#+begin_%s%s\n" type (if extended? " " ""))) + (when region? + (when verbatim? (org-escape-code-in-region (point) region-end)) + (goto-char region-end) + ;; Ignore empty lines at the end of the region. + (skip-chars-backward " \r\t\n") + (end-of-line)) + (unless (bolp) (insert "\n")) + (indent-to column) + (insert (format "#+end_%s" (car (split-string type)))) + (if (looking-at "[ \t]*$") (replace-match "") + (insert "\n")) + (when (and (eobp) (not (bolp))) (insert "\n"))) + (if extended? (end-of-line) + (forward-line) + (skip-chars-forward " \t"))))) + + +;;;; TODO, DEADLINE, Comments + +(defun org-toggle-comment () + "Change the COMMENT state of an entry." + (interactive) + (save-excursion + (org-back-to-heading) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp)) + (goto-char (or (match-end 3) (match-end 2) (match-end 1))) + (skip-chars-forward " \t") + (unless (memq (char-before) '(?\s ?\t)) (insert " ")) + (if (org-in-commented-heading-p t) + (delete-region (point) + (progn (search-forward " " (line-end-position) 'move) + (skip-chars-forward " \t") + (point))) + (insert org-comment-string) + (unless (eolp) (insert " "))))) + +(defvar org-last-todo-state-is-todo nil + "This is non-nil when the last TODO state change led to a TODO state. +If the last change removed the TODO tag or switched to DONE, then +this is nil.") + +(defvar org-todo-setup-filter-hook nil + "Hook for functions that pre-filter todo specs. +Each function takes a todo spec and returns either nil or the spec +transformed into canonical form." ) + +(defvar org-todo-get-default-hook nil + "Hook for functions that get a default item for todo. +Each function takes arguments (NEW-MARK OLD-MARK) and returns either +nil or a string to be used for the todo mark." ) + +(defvar org-agenda-headline-snapshot-before-repeat) + +(defun org-current-effective-time () + "Return current time adjusted for `org-extend-today-until' variable." + (let* ((ct (org-current-time)) + (dct (decode-time ct)) + (ct1 + (cond + (org-use-last-clock-out-time-as-effective-time + (or (org-clock-get-last-clock-out-time) ct)) + ((and org-use-effective-time (< (nth 2 dct) org-extend-today-until)) + (encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct))) + (t ct)))) + ct1)) + +(defun org-todo-yesterday (&optional arg) + "Like `org-todo' but the time of change will be 23:59 of yesterday." + (interactive "P") + (if (eq major-mode 'org-agenda-mode) + (apply 'org-agenda-todo-yesterday arg) + (let* ((org-use-effective-time t) + (hour (nth 2 (decode-time (org-current-time)))) + (org-extend-today-until (1+ hour))) + (org-todo arg)))) + +(defvar org-block-entry-blocking "" + "First entry preventing the TODO state change.") + +(defun org-cancel-repeater () + "Cancel a repeater by setting its numeric value to zero." + (interactive) + (save-excursion + (org-back-to-heading t) + (let ((bound1 (point)) + (bound0 (save-excursion (outline-next-heading) (point)))) + (when (and (re-search-forward + (concat "\\(" org-scheduled-time-regexp "\\)\\|\\(" + org-deadline-time-regexp "\\)\\|\\(" + org-ts-regexp "\\)") + bound0 t) + (re-search-backward "[ \t]+\\(?:[.+]\\)?\\+\\([0-9]+\\)[hdwmy]" + bound1 t)) + (replace-match "0" t nil nil 1))))) + +(defvar org-state) +(defvar org-blocked-by-checkboxes) +(defun org-todo (&optional arg) + "Change the TODO state of an item. + +The state of an item is given by a keyword at the start of the heading, +like + *** TODO Write paper + *** DONE Call mom + +The different keywords are specified in the variable `org-todo-keywords'. +By default the available states are \"TODO\" and \"DONE\". So, for this +example: when the item starts with TODO, it is changed to DONE. +When it starts with DONE, the DONE is removed. And when neither TODO nor +DONE are present, add TODO at the beginning of the heading. +You can set up single-character keys to fast-select the new state. See the +`org-todo-keywords' and `org-use-fast-todo-selection' for details. + +With `\\[universal-argument]' prefix ARG, force logging the state change \ +and take a +logging note. +With a `\\[universal-argument] \\[universal-argument]' prefix, switch to the \ +next set of TODO \ +keywords (nextset). +Another way to achieve this is `S-C-<right>'. +With a `\\[universal-argument] \\[universal-argument] \\[universal-argument]' \ +prefix, circumvent any state blocking. +With numeric prefix arg, switch to the Nth state. + +With a numeric prefix arg of 0, inhibit note taking for the change. +With a numeric prefix arg of -1, cancel repeater to allow marking as DONE. + +When called through ELisp, arg is also interpreted in the following way: +`none' -> empty state +\"\" -> switch to empty state +`done' -> switch to DONE +`nextset' -> switch to the next set of keywords +`previousset' -> switch to the previous set of keywords +\"WAITING\" -> switch to the specified keyword, but only if it + really is a member of `org-todo-keywords'." + (interactive "P") + (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level 'region)) + org-loop-over-headlines-in-active-region) + (org-map-entries + (lambda () (org-todo arg)) + nil cl + (when (org-invisible-p) (org-end-of-subtree nil t)))) + (when (equal arg '(16)) (setq arg 'nextset)) + (when (equal arg -1) (org-cancel-repeater) (setq arg nil)) + (let ((org-blocker-hook org-blocker-hook) + commentp + case-fold-search) + (when (equal arg '(64)) + (setq arg nil org-blocker-hook nil)) + (when (and org-blocker-hook + (or org-inhibit-blocking + (org-entry-get nil "NOBLOCKING"))) + (setq org-blocker-hook nil)) + (save-excursion + (catch 'exit + (org-back-to-heading t) + (when (org-in-commented-heading-p t) + (org-toggle-comment) + (setq commentp t)) + (when (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) + (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) + (looking-at "\\(?: *\\|[ \t]*$\\)")) + (let* ((match-data (match-data)) + (startpos (copy-marker (line-beginning-position))) + (force-log (and (equal arg '(4)) (prog1 t (setq arg nil)))) + (logging (save-match-data (org-entry-get nil "LOGGING" t t))) + (org-log-done org-log-done) + (org-log-repeat org-log-repeat) + (org-todo-log-states org-todo-log-states) + (org-inhibit-logging + (if (equal arg 0) + (progn (setq arg nil) 'note) org-inhibit-logging)) + (this (match-string 1)) + (hl-pos (match-beginning 0)) + (head (org-get-todo-sequence-head this)) + (ass (assoc head org-todo-kwd-alist)) + (interpret (nth 1 ass)) + (done-word (nth 3 ass)) + (final-done-word (nth 4 ass)) + (org-last-state (or this "")) + (completion-ignore-case t) + (member (member this org-todo-keywords-1)) + (tail (cdr member)) + (org-state (cond + ((eq arg 'right) + ;; Next state + (if this + (if tail (car tail) nil) + (car org-todo-keywords-1))) + ((eq arg 'left) + ;; Previous state + (unless (equal member org-todo-keywords-1) + (if this + (nth (- (length org-todo-keywords-1) + (length tail) 2) + org-todo-keywords-1) + (org-last org-todo-keywords-1)))) + (arg + ;; User or caller requests a specific state. + (cond + ((equal arg "") nil) + ((eq arg 'none) nil) + ((eq arg 'done) (or done-word (car org-done-keywords))) + ((eq arg 'nextset) + (or (car (cdr (member head org-todo-heads))) + (car org-todo-heads))) + ((eq arg 'previousset) + (let ((org-todo-heads (reverse org-todo-heads))) + (or (car (cdr (member head org-todo-heads))) + (car org-todo-heads)))) + ((car (member arg org-todo-keywords-1))) + ((stringp arg) + (user-error "State `%s' not valid in this file" arg)) + ((nth (1- (prefix-numeric-value arg)) + org-todo-keywords-1)))) + ((and org-todo-key-trigger org-use-fast-todo-selection) + ;; Use fast selection. + (org-fast-todo-selection this)) + ((null member) (or head (car org-todo-keywords-1))) + ((equal this final-done-word) nil) ;-> make empty + ((null tail) nil) ;-> first entry + ((memq interpret '(type priority)) + (if (eq this-command last-command) + (car tail) + (if (> (length tail) 0) + (or done-word (car org-done-keywords)) + nil))) + (t + (car tail)))) + (org-state (or + (run-hook-with-args-until-success + 'org-todo-get-default-hook org-state org-last-state) + org-state)) + (next (if (org-string-nw-p org-state) (concat " " org-state " ") " ")) + (change-plist (list :type 'todo-state-change :from this :to org-state + :position startpos)) + dolog now-done-p) + (when org-blocker-hook + (let (org-blocked-by-checkboxes block-reason) + (setq org-last-todo-state-is-todo + (not (member this org-done-keywords))) + (unless (save-excursion + (save-match-data + (org-with-wide-buffer + (run-hook-with-args-until-failure + 'org-blocker-hook change-plist)))) + (setq block-reason (if org-blocked-by-checkboxes + "contained checkboxes" + (format "\"%s\"" org-block-entry-blocking))) + (if (called-interactively-p 'interactive) + (user-error "TODO state change from %s to %s blocked (by %s)" + this org-state block-reason) + ;; Fail silently. + (message "TODO state change from %s to %s blocked (by %s)" + this org-state block-reason) + (throw 'exit nil))))) + (store-match-data match-data) + (replace-match next t t) + (cond ((and org-state (equal this org-state)) + (message "TODO state was already %s" (org-trim next))) + ((not (pos-visible-in-window-p hl-pos)) + (message "TODO state changed to %s" (org-trim next)))) + (unless head + (setq head (org-get-todo-sequence-head org-state) + ass (assoc head org-todo-kwd-alist) + interpret (nth 1 ass) + done-word (nth 3 ass) + final-done-word (nth 4 ass))) + (when (memq arg '(nextset previousset)) + (message "Keyword-Set %d/%d: %s" + (- (length org-todo-sets) -1 + (length (memq (assoc org-state org-todo-sets) org-todo-sets))) + (length org-todo-sets) + (mapconcat 'identity (assoc org-state org-todo-sets) " "))) + (setq org-last-todo-state-is-todo + (not (member org-state org-done-keywords))) + (setq now-done-p (and (member org-state org-done-keywords) + (not (member this org-done-keywords)))) + (and logging (org-local-logging logging)) + (when (or (and (or org-todo-log-states org-log-done) + (not (eq org-inhibit-logging t)) + (not (memq arg '(nextset previousset)))) + force-log) + ;; We need to look at recording a time and note. + (setq dolog (or (if force-log 'note) + (nth 1 (assoc org-state org-todo-log-states)) + (nth 2 (assoc this org-todo-log-states)))) + (when (and (eq dolog 'note) (eq org-inhibit-logging 'note)) + (setq dolog 'time)) + (when (or (and (not org-state) (not org-closed-keep-when-no-todo)) + (and org-state + (member org-state org-not-done-keywords) + (not (member this org-not-done-keywords)))) + ;; This is now a todo state and was not one before + ;; If there was a CLOSED time stamp, get rid of it. + (org-add-planning-info nil nil 'closed)) + (when (and now-done-p org-log-done) + ;; It is now done, and it was not done before. + (org-add-planning-info 'closed (org-current-effective-time)) + (when (and (not dolog) (eq 'note org-log-done)) + (org-add-log-setup 'done org-state this 'note))) + (when (and org-state dolog) + ;; This is a non-nil state, and we need to log it. + (org-add-log-setup 'state org-state this dolog))) + ;; Fixup tag positioning. + (org-todo-trigger-tag-changes org-state) + (when org-auto-align-tags (org-align-tags)) + (when org-provide-todo-statistics + (org-update-parent-todo-statistics)) + (when (bound-and-true-p org-clock-out-when-done) + (org-clock-out-if-current)) + (run-hooks 'org-after-todo-state-change-hook) + (when (and arg (not (member org-state org-done-keywords))) + (setq head (org-get-todo-sequence-head org-state))) + (put-text-property (point-at-bol) (point-at-eol) 'org-todo-head head) + ;; Do we need to trigger a repeat? + (when now-done-p + (when (boundp 'org-agenda-headline-snapshot-before-repeat) + ;; This is for the agenda, take a snapshot of the headline. + (save-match-data + (setq org-agenda-headline-snapshot-before-repeat + (org-get-heading)))) + (org-auto-repeat-maybe org-state)) + ;; Fixup cursor location if close to the keyword. + (when (and (outline-on-heading-p) + (not (bolp)) + (save-excursion (beginning-of-line 1) + (looking-at org-todo-line-regexp)) + (< (point) (+ 2 (or (match-end 2) (match-end 1))))) + (goto-char (or (match-end 2) (match-end 1))) + (and (looking-at " ") + (not (looking-at " *:")) + (just-one-space))) + (when org-trigger-hook + (save-excursion + (run-hook-with-args 'org-trigger-hook change-plist))) + (when commentp (org-toggle-comment)))))))) + +(defun org-block-todo-from-children-or-siblings-or-parent (change-plist) + "Block turning an entry into a TODO, using the hierarchy. +This checks whether the current task should be blocked from state +changes. Such blocking occurs when: + + 1. The task has children which are not all in a completed state. + + 2. A task has a parent with the property :ORDERED:, and there + are siblings prior to the current task with incomplete + status. + + 3. The parent of the task is blocked because it has siblings that should + be done first, or is child of a block grandparent TODO entry." + + (if (not org-enforce-todo-dependencies) + t ; if locally turned off don't block + (catch 'dont-block + ;; If this is not a todo state change, or if this entry is already DONE, + ;; do not block + (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) + (member (plist-get change-plist :from) + (cons 'done org-done-keywords)) + (member (plist-get change-plist :to) + (cons 'todo org-not-done-keywords)) + (not (plist-get change-plist :to))) + (throw 'dont-block t)) + ;; If this task has children, and any are undone, it's blocked + (save-excursion + (org-back-to-heading t) + (let ((this-level (funcall outline-level))) + (outline-next-heading) + (let ((child-level (funcall outline-level))) + (while (and (not (eobp)) + (> child-level this-level)) + ;; this todo has children, check whether they are all + ;; completed + (when (and (not (org-entry-is-done-p)) + (org-entry-is-todo-p)) + (setq org-block-entry-blocking (org-get-heading)) + (throw 'dont-block nil)) + (outline-next-heading) + (setq child-level (funcall outline-level)))))) + ;; Otherwise, if the task's parent has the :ORDERED: property, and + ;; any previous siblings are undone, it's blocked + (save-excursion + (org-back-to-heading t) + (let* ((pos (point)) + (parent-pos (and (org-up-heading-safe) (point))) + (case-fold-search nil)) + (unless parent-pos (throw 'dont-block t)) ; no parent + (when (and (org-not-nil (org-entry-get (point) "ORDERED")) + (forward-line 1) + (re-search-forward org-not-done-heading-regexp pos t)) + (setq org-block-entry-blocking (match-string 0)) + (throw 'dont-block nil)) ; block, there is an older sibling not done. + ;; Search further up the hierarchy, to see if an ancestor is blocked + (while t + (goto-char parent-pos) + (unless (looking-at org-not-done-heading-regexp) + (throw 'dont-block t)) ; do not block, parent is not a TODO + (setq pos (point)) + (setq parent-pos (and (org-up-heading-safe) (point))) + (unless parent-pos (throw 'dont-block t)) ; no parent + (when (and (org-not-nil (org-entry-get (point) "ORDERED")) + (forward-line 1) + (re-search-forward org-not-done-heading-regexp pos t) + (setq org-block-entry-blocking (org-get-heading))) + (throw 'dont-block nil)))))))) ; block, older sibling not done. + +(defcustom org-track-ordered-property-with-tag nil + "Should the ORDERED property also be shown as a tag? +The ORDERED property decides if an entry should require subtasks to be +completed in sequence. Since a property is not very visible, setting +this option means that toggling the ORDERED property with the command +`org-toggle-ordered-property' will also toggle a tag ORDERED. That tag is +not relevant for the behavior, but it makes things more visible. + +Note that toggling the tag with tags commands will not change the property +and therefore not influence behavior! + +This can be t, meaning the tag ORDERED should be used. It can also be a +string to select a different tag for this task." + :group 'org-todo + :type '(choice + (const :tag "No tracking" nil) + (const :tag "Track with ORDERED tag" t) + (string :tag "Use other tag"))) + +(defun org-toggle-ordered-property () + "Toggle the ORDERED property of the current entry. +For better visibility, you can track the value of this property with a tag. +See variable `org-track-ordered-property-with-tag'." + (interactive) + (let* ((t1 org-track-ordered-property-with-tag) + (tag (and t1 (if (stringp t1) t1 "ORDERED")))) + (save-excursion + (org-back-to-heading) + (if (org-entry-get nil "ORDERED") + (progn + (org-delete-property "ORDERED") + (and tag (org-toggle-tag tag 'off)) + (message "Subtasks can be completed in arbitrary order")) + (org-entry-put nil "ORDERED" "t") + (and tag (org-toggle-tag tag 'on)) + (message "Subtasks must be completed in sequence"))))) + +(defun org-block-todo-from-checkboxes (change-plist) + "Block turning an entry into a TODO, using checkboxes. +This checks whether the current task should be blocked from state +changes because there are unchecked boxes in this entry." + (if (not org-enforce-todo-checkbox-dependencies) + t ; if locally turned off don't block + (catch 'dont-block + ;; If this is not a todo state change, or if this entry is already DONE, + ;; do not block + (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) + (member (plist-get change-plist :from) + (cons 'done org-done-keywords)) + (member (plist-get change-plist :to) + (cons 'todo org-not-done-keywords)) + (not (plist-get change-plist :to))) + (throw 'dont-block t)) + ;; If this task has checkboxes that are not checked, it's blocked + (save-excursion + (org-back-to-heading t) + (let ((beg (point)) end) + (outline-next-heading) + (setq end (point)) + (goto-char beg) + (when (org-list-search-forward + (concat (org-item-beginning-re) + "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?" + "\\[[- ]\\]") + end t) + (when (boundp 'org-blocked-by-checkboxes) + (setq org-blocked-by-checkboxes t)) + (throw 'dont-block nil)))) + t))) ; do not block + +(defun org-entry-blocked-p () + "Non-nil if entry at point is blocked." + (and (not (org-entry-get nil "NOBLOCKING")) + (member (org-entry-get nil "TODO") org-not-done-keywords) + (not (run-hook-with-args-until-failure + 'org-blocker-hook + (list :type 'todo-state-change + :position (point) + :from 'todo + :to 'done))))) + +(defun org-update-statistics-cookies (all) + "Update the statistics cookie, either from TODO or from checkboxes. +This should be called with the cursor in a line with a statistics +cookie. When called with a \\[universal-argument] prefix, update +all statistics cookies in the buffer." + (interactive "P") + (if all + (progn + (org-update-checkbox-count 'all) + (org-map-region 'org-update-parent-todo-statistics + (point-min) (point-max))) + (if (not (org-at-heading-p)) + (org-update-checkbox-count) + (let ((pos (point-marker)) + end l1 l2) + (ignore-errors (org-back-to-heading t)) + (if (not (org-at-heading-p)) + (org-update-checkbox-count) + (setq l1 (org-outline-level)) + (setq end + (save-excursion + (outline-next-heading) + (when (org-at-heading-p) (setq l2 (org-outline-level))) + (point))) + (if (and (save-excursion + (re-search-forward + "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) \\[[- X]\\]" end t)) + (not (save-excursion + (re-search-forward + ":COOKIE_DATA:.*\\<todo\\>" end t)))) + (org-update-checkbox-count) + (if (and l2 (> l2 l1)) + (progn + (goto-char end) + (org-update-parent-todo-statistics)) + (goto-char pos) + (beginning-of-line 1) + (while (re-search-forward + "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" + (point-at-eol) t) + (replace-match (if (match-end 2) "[100%]" "[0/0]") t t))))) + (goto-char pos) + (move-marker pos nil))))) + +(defvar org-entry-property-inherited-from) ;; defined below +(defun org-update-parent-todo-statistics () + "Update any statistics cookie in the parent of the current headline. +When `org-hierarchical-todo-statistics' is nil, statistics will cover +the entire subtree and this will travel up the hierarchy and update +statistics everywhere." + (let* ((prop (save-excursion + (org-up-heading-safe) + (org-entry-get nil "COOKIE_DATA" 'inherit))) + (recursive (or (not org-hierarchical-todo-statistics) + (and prop (string-match "\\<recursive\\>" prop)))) + (lim (or (and prop (marker-position org-entry-property-inherited-from)) + 0)) + (first t) + (box-re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") + level ltoggle l1 new ndel + (cnt-all 0) (cnt-done 0) is-percent kwd + checkbox-beg cookie-present) + (catch 'exit + (save-excursion + (beginning-of-line 1) + (setq ltoggle (funcall outline-level)) + ;; Three situations are to consider: + + ;; 1. if `org-hierarchical-todo-statistics' is nil, repeat up + ;; to the top-level ancestor on the headline; + + ;; 2. If parent has "recursive" property, repeat up to the + ;; headline setting that property, taking inheritance into + ;; account; + + ;; 3. Else, move up to direct parent and proceed only once. + (while (and (setq level (org-up-heading-safe)) + (or recursive first) + (>= (point) lim)) + (setq first nil cookie-present nil) + (unless (and level + (not (string-match + "\\<checkbox\\>" + (downcase (or (org-entry-get nil "COOKIE_DATA") + ""))))) + (throw 'exit nil)) + (while (re-search-forward box-re (point-at-eol) t) + (setq cnt-all 0 cnt-done 0 cookie-present t) + (setq is-percent (match-end 2) checkbox-beg (match-beginning 0)) + (save-match-data + (unless (outline-next-heading) (throw 'exit nil)) + (while (and (looking-at org-complex-heading-regexp) + (> (setq l1 (length (match-string 1))) level)) + (setq kwd (and (or recursive (= l1 ltoggle)) + (match-string 2))) + (if (or (eq org-provide-todo-statistics 'all-headlines) + (and (eq org-provide-todo-statistics t) + (or (member kwd org-done-keywords))) + (and (listp org-provide-todo-statistics) + (stringp (car org-provide-todo-statistics)) + (or (member kwd org-provide-todo-statistics) + (member kwd org-done-keywords))) + (and (listp org-provide-todo-statistics) + (listp (car org-provide-todo-statistics)) + (or (member kwd (car org-provide-todo-statistics)) + (and (member kwd org-done-keywords) + (member kwd (cadr org-provide-todo-statistics)))))) + (setq cnt-all (1+ cnt-all)) + (and (eq org-provide-todo-statistics t) + kwd + (setq cnt-all (1+ cnt-all)))) + (when (or (and (member org-provide-todo-statistics '(t all-headlines)) + (member kwd org-done-keywords)) + (and (listp org-provide-todo-statistics) + (listp (car org-provide-todo-statistics)) + (member kwd org-done-keywords) + (member kwd (cadr org-provide-todo-statistics))) + (and (listp org-provide-todo-statistics) + (stringp (car org-provide-todo-statistics)) + (member kwd org-done-keywords))) + (setq cnt-done (1+ cnt-done))) + (outline-next-heading))) + (setq new + (if is-percent + (format "[%d%%]" (floor (* 100.0 cnt-done) + (max 1 cnt-all))) + (format "[%d/%d]" cnt-done cnt-all)) + ndel (- (match-end 0) checkbox-beg)) + (goto-char checkbox-beg) + (insert new) + (delete-region (point) (+ (point) ndel)) + (when org-auto-align-tags (org-fix-tags-on-the-fly))) + (when cookie-present + (run-hook-with-args 'org-after-todo-statistics-hook + cnt-done (- cnt-all cnt-done)))))) + (run-hooks 'org-todo-statistics-hook))) + +(defvar org-after-todo-statistics-hook nil + "Hook that is called after a TODO statistics cookie has been updated. +Each function is called with two arguments: the number of not-done entries +and the number of done entries. + +For example, the following function, when added to this hook, will switch +an entry to DONE when all children are done, and back to TODO when new +entries are set to a TODO status. Note that this hook is only called +when there is a statistics cookie in the headline! + + (defun org-summary-todo (n-done n-not-done) + \"Switch entry to DONE when all subentries are done, to TODO otherwise.\" + (let (org-log-done org-log-states) ; turn off logging + (org-todo (if (= n-not-done 0) \"DONE\" \"TODO\"))))") + +(defvar org-todo-statistics-hook nil + "Hook that is run whenever Org thinks TODO statistics should be updated. +This hook runs even if there is no statistics cookie present, in which case +`org-after-todo-statistics-hook' would not run.") + +(defun org-todo-trigger-tag-changes (state) + "Apply the changes defined in `org-todo-state-tags-triggers'." + (let ((l org-todo-state-tags-triggers) + changes) + (when (or (not state) (equal state "")) + (setq changes (append changes (cdr (assoc "" l))))) + (when (and (stringp state) (> (length state) 0)) + (setq changes (append changes (cdr (assoc state l))))) + (when (member state org-not-done-keywords) + (setq changes (append changes (cdr (assq 'todo l))))) + (when (member state org-done-keywords) + (setq changes (append changes (cdr (assq 'done l))))) + (dolist (c changes) + (org-toggle-tag (car c) (if (cdr c) 'on 'off))))) + +(defun org-local-logging (value) + "Get logging settings from a property VALUE." + ;; Directly set the variables, they are already local. + (setq org-log-done nil + org-log-repeat nil + org-todo-log-states nil) + (dolist (w (split-string value)) + (let (a) + (cond + ((setq a (assoc w org-startup-options)) + (and (member (nth 1 a) '(org-log-done org-log-repeat)) + (set (nth 1 a) (nth 2 a)))) + ((setq a (org-extract-log-state-settings w)) + (and (member (car a) org-todo-keywords-1) + (push a org-todo-log-states))))))) + +(defun org-get-todo-sequence-head (kwd) + "Return the head of the TODO sequence to which KWD belongs. +If KWD is not set, check if there is a text property remembering the +right sequence." + (let (p) + (cond + ((not kwd) + (or (get-text-property (point-at-bol) 'org-todo-head) + (progn + (setq p (next-single-property-change (point-at-bol) 'org-todo-head + nil (point-at-eol))) + (get-text-property p 'org-todo-head)))) + ((not (member kwd org-todo-keywords-1)) + (car org-todo-keywords-1)) + (t (nth 2 (assoc kwd org-todo-kwd-alist)))))) + +(defun org-fast-todo-selection (&optional current-state) + "Fast TODO keyword selection with single keys. +Returns the new TODO keyword, or nil if no state change should occur. +When CURRENT-STATE is given and selection letters are not unique globally, +prefer a state in the current sequence over on in another sequence." + (let* ((fulltable org-todo-key-alist) + (head (org-get-todo-sequence-head current-state)) + (done-keywords org-done-keywords) ;; needed for the faces. + (maxlen (apply 'max (mapcar + (lambda (x) + (if (stringp (car x)) (string-width (car x)) 0)) + fulltable))) + (expert (equal org-use-fast-todo-selection 'expert)) + (prompt "") + (fwidth (+ maxlen 3 1 3)) + (ncol (/ (- (window-width) 4) fwidth)) + tg cnt e c tbl subtable + groups ingroup in-current-sequence) + (save-excursion + (save-window-excursion + (if expert + (set-buffer (get-buffer-create " *Org todo*")) + (delete-other-windows) + (set-window-buffer (split-window-vertically) (get-buffer-create " *Org todo*")) + (org-switch-to-buffer-other-window " *Org todo*")) + (erase-buffer) + (setq-local org-done-keywords done-keywords) + (setq tbl fulltable cnt 0) + (while (setq e (pop tbl)) + (cond + ((equal e '(:startgroup)) + (push '() groups) (setq ingroup t) + (unless (= cnt 0) + (setq cnt 0) + (insert "\n")) + (setq prompt (concat prompt "{")) + (insert "{ ")) + ((equal e '(:endgroup)) + (setq ingroup nil cnt 0 in-current-sequence nil) + (setq prompt (concat prompt "}")) + (insert "}\n")) + ((equal e '(:newline)) + (unless (= cnt 0) + (setq cnt 0) + (insert "\n") + (setq e (car tbl)) + (while (equal (car tbl) '(:newline)) + (insert "\n") + (setq tbl (cdr tbl))))) + (t + (setq tg (car e) c (cdr e)) + (if (equal tg head) (setq in-current-sequence t)) + (when ingroup (push tg (car groups))) + (when in-current-sequence (push e subtable)) + (setq tg (org-add-props tg nil 'face + (org-get-todo-face tg))) + (when (and (= cnt 0) (not ingroup)) (insert " ")) + (setq prompt (concat prompt "[" (char-to-string c) "] " tg " ")) + (insert "[" c "] " tg (make-string + (- fwidth 4 (length tg)) ?\ )) + (when (and (= (setq cnt (1+ cnt)) ncol) + ;; Avoid lines with just a closing delimiter. + (not (equal (car tbl) '(:endgroup)))) + (insert "\n") + (when ingroup (insert " ")) + (setq cnt 0))))) + (insert "\n") + (goto-char (point-min)) + (unless expert (org-fit-window-to-buffer)) + (message (concat "[a-z..]:Set [SPC]:clear" + (if expert (concat "\n" prompt) ""))) + (setq c (let ((inhibit-quit t)) (read-char-exclusive))) + (setq subtable (nreverse subtable)) + (cond + ((or (= c ?\C-g) + (and (= c ?q) (not (rassoc c fulltable)))) + (setq quit-flag t)) + ((= c ?\ ) nil) + ((setq e (or (rassoc c subtable) (rassoc c fulltable)) + tg (car e)) + tg) + (t (setq quit-flag t))))))) + +(defun org-entry-is-todo-p () + (member (org-get-todo-state) org-not-done-keywords)) + +(defun org-entry-is-done-p () + (member (org-get-todo-state) org-done-keywords)) + +(defun org-get-todo-state () + "Return the TODO keyword of the current subtree." + (save-excursion + (org-back-to-heading t) + (and (let ((case-fold-search nil)) + (looking-at org-todo-line-regexp)) + (match-end 2) + (match-string 2)))) + +(defun org-at-date-range-p (&optional inactive-ok) + "Non-nil if point is inside a date range. + +When optional argument INACTIVE-OK is non-nil, also consider +inactive time ranges. + +When this function returns a non-nil value, match data is set +according to `org-tr-regexp-both' or `org-tr-regexp', depending +on INACTIVE-OK." + (interactive) + (save-excursion + (catch 'exit + (let ((pos (point))) + (skip-chars-backward "^[<\r\n") + (skip-chars-backward "<[") + (and (looking-at (if inactive-ok org-tr-regexp-both org-tr-regexp)) + (>= (match-end 0) pos) + (throw 'exit t)) + (skip-chars-backward "^<[\r\n") + (skip-chars-backward "<[") + (and (looking-at (if inactive-ok org-tr-regexp-both org-tr-regexp)) + (>= (match-end 0) pos) + (throw 'exit t))) + nil))) + +(defun org-get-repeat (&optional timestamp) + "Check if there is a time-stamp with repeater in this entry. + +Return the repeater, as a string, or nil. Also return nil when +this function is called before first heading. + +When optional argument TIMESTAMP is a string, extract the +repeater from there instead." + (save-match-data + (cond + (timestamp + (and (string-match org-repeat-re timestamp) + (match-string-no-properties 1 timestamp))) + ((org-before-first-heading-p) nil) + (t + (save-excursion + (org-back-to-heading t) + (let ((end (org-entry-end-position))) + (catch :repeat + (while (re-search-forward org-repeat-re end t) + (when (save-match-data (org-at-timestamp-p 'agenda)) + (throw :repeat (match-string-no-properties 1))))))))))) + +(defvar org-last-changed-timestamp) +(defvar org-last-inserted-timestamp) +(defvar org-log-post-message) +(defvar org-log-note-purpose) +(defvar org-log-note-how nil) +(defvar org-log-note-extra) +(defvar org-log-setup nil) +(defun org-auto-repeat-maybe (done-word) + "Check if the current headline contains a repeated time-stamp. + +If yes, set TODO state back to what it was and change the base date +of repeating deadline/scheduled time stamps to new date. + +This function is run automatically after each state change to a DONE state." + (let* ((repeat (org-get-repeat)) + (aa (assoc org-last-state org-todo-kwd-alist)) + (interpret (nth 1 aa)) + (head (nth 2 aa)) + (whata '(("h" . hour) ("d" . day) ("m" . month) ("y" . year))) + (msg "Entry repeats: ") + (org-log-done nil) + (org-todo-log-states nil) + (end (copy-marker (org-entry-end-position)))) + (when (and repeat (not (= 0 (string-to-number (substring repeat 1))))) + (when (eq org-log-repeat t) (setq org-log-repeat 'state)) + (let ((to-state + (or (org-entry-get nil "REPEAT_TO_STATE" 'selective) + (and (stringp org-todo-repeat-to-state) + org-todo-repeat-to-state) + (and org-todo-repeat-to-state org-last-state)))) + (org-todo (cond ((and to-state (member to-state org-todo-keywords-1)) + to-state) + ((eq interpret 'type) org-last-state) + (head) + (t 'none)))) + (org-back-to-heading t) + (org-add-planning-info nil nil 'closed) + ;; When `org-log-repeat' is non-nil or entry contains + ;; a clock, set LAST_REPEAT property. + (when (or org-log-repeat + (catch :clock + (save-excursion + (while (re-search-forward org-clock-line-re end t) + (when (org-at-clock-log-p) (throw :clock t)))))) + (org-entry-put nil "LAST_REPEAT" (format-time-string + (org-time-stamp-format t t)))) + (when org-log-repeat + (if org-log-setup + ;; We are already setup for some record. + (when (eq org-log-repeat 'note) + ;; Make sure we take a note, not only a time stamp. + (setq org-log-note-how 'note)) + ;; Set up for taking a record. + (org-add-log-setup 'state + (or done-word (car org-done-keywords)) + org-last-state + org-log-repeat))) + ;; Time-stamps without a repeater are usually skipped. However, + ;; a SCHEDULED time-stamp without one is removed, as they are no + ;; longer relevant. + (save-excursion + (let ((scheduled (org-entry-get (point) "SCHEDULED"))) + (when (and scheduled (not (string-match-p org-repeat-re scheduled))) + (org-remove-timestamp-with-keyword org-scheduled-string)))) + ;; Update every time-stamp with a repeater in the entry. + (let ((planning-re (regexp-opt + (list org-scheduled-string org-deadline-string)))) + (while (re-search-forward org-repeat-re end t) + (let* ((ts (match-string 0)) + (type (if (not (org-at-planning-p)) "Plain:" + (save-excursion + (re-search-backward + planning-re (line-beginning-position) t) + (match-string 0))))) + (when (and (org-at-timestamp-p 'agenda) + (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts)) + (let ((n (string-to-number (match-string 2 ts))) + (what (match-string 3 ts))) + (when (equal what "w") (setq n (* n 7) what "d")) + (when (and (equal what "h") + (not (string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" + ts))) + (user-error + "Cannot repeat in %d hour(s) because no hour has been set" + n)) + ;; Preparation, see if we need to modify the start + ;; date for the change. + (when (match-end 1) + (let ((time (save-match-data (org-time-string-to-time ts))) + (repeater-type (match-string 1 ts))) + (cond + ((equal "." repeater-type) + ;; Shift starting date to today, or now if + ;; repeater is by hours. + (if (equal what "h") + (org-timestamp-change + (floor (- (org-time-stamp-to-now ts t)) 60) 'minute) + (org-timestamp-change + (- (org-today) (time-to-days time)) 'day))) + ((equal "+" repeater-type) + (let ((nshiftmax 10) + (nshift 0)) + (while (or (= nshift 0) + (not (org-time-less-p nil time))) + (when (= nshiftmax (cl-incf nshift)) + (or (y-or-n-p + (format "%d repeater intervals were not \ +enough to shift date past today. Continue? " + nshift)) + (user-error "Abort"))) + (org-timestamp-change n (cdr (assoc what whata))) + (org-in-regexp org-ts-regexp3) + (setq ts (match-string 1)) + (setq time + (save-match-data + (org-time-string-to-time ts))))) + (org-timestamp-change (- n) (cdr (assoc what whata))) + ;; Rematch, so that we have everything in place + ;; for the real shift. + (org-in-regexp org-ts-regexp3) + (setq ts (match-string 1)) + (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" + ts))))) + (save-excursion + (org-timestamp-change n (cdr (assoc what whata)) nil t)) + (setq msg + (concat msg type " " org-last-changed-timestamp " "))))))) + (run-hooks 'org-todo-repeat-hook) + (setq org-log-post-message msg) + (message msg)))) + +(defun org-show-todo-tree (arg) + "Make a compact tree which shows all headlines marked with TODO. +The tree will show the lines where the regexp matches, and all higher +headlines above the match. +With a `\\[universal-argument]' prefix, prompt for a regexp to match. +With a numeric prefix N, construct a sparse tree for the Nth element +of `org-todo-keywords-1'." + (interactive "P") + (let ((case-fold-search nil) + (kwd-re + (cond ((null arg) (concat org-not-done-regexp "\\s-")) + ((equal arg '(4)) + (let ((kwd + (completing-read "Keyword (or KWD1|KWD2|...): " + (mapcar #'list org-todo-keywords-1)))) + (concat "\\(" + (mapconcat 'identity (org-split-string kwd "|") "\\|") + "\\)\\>"))) + ((<= (prefix-numeric-value arg) (length org-todo-keywords-1)) + (regexp-quote (nth (1- (prefix-numeric-value arg)) + org-todo-keywords-1))) + (t (user-error "Invalid prefix argument: %s" arg))))) + (message "%d TODO entries found" + (org-occur (concat "^" org-outline-regexp " *" kwd-re ))))) + +(defun org--deadline-or-schedule (arg type time) + "Insert DEADLINE or SCHEDULE information in current entry. +TYPE is either `deadline' or `scheduled'. See `org-deadline' or +`org-schedule' for information about ARG and TIME arguments." + (let* ((deadline? (eq type 'deadline)) + (keyword (if deadline? org-deadline-string org-scheduled-string)) + (log (if deadline? org-log-redeadline org-log-reschedule)) + (old-date (org-entry-get nil (if deadline? "DEADLINE" "SCHEDULED"))) + (old-date-time (and old-date (org-time-string-to-time old-date))) + ;; Save repeater cookie from either TIME or current scheduled + ;; time stamp. We are going to insert it back at the end of + ;; the process. + (repeater (or (and (org-string-nw-p time) + ;; We use `org-repeat-re' because we need + ;; to tell the difference between a real + ;; repeater and a time delta, e.g. "+2d". + (string-match org-repeat-re time) + (match-string 1 time)) + (and (org-string-nw-p old-date) + (string-match "\\([.+-]+[0-9]+[hdwmy]\ +\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\)" + old-date) + (match-string 1 old-date))))) + (pcase arg + (`(4) + (if (not old-date) + (message (if deadline? "Entry had no deadline to remove" + "Entry was not scheduled")) + (when (and old-date log) + (org-add-log-setup (if deadline? 'deldeadline 'delschedule) + nil old-date log)) + (org-remove-timestamp-with-keyword keyword) + (message (if deadline? "Entry no longer has a deadline." + "Entry is no longer scheduled.")))) + (`(16) + (save-excursion + (org-back-to-heading t) + (let ((regexp (if deadline? org-deadline-time-regexp + org-scheduled-time-regexp))) + (if (not (re-search-forward regexp (line-end-position 2) t)) + (user-error (if deadline? "No deadline information to update" + "No scheduled information to update")) + (let* ((rpl0 (match-string 1)) + (rpl (replace-regexp-in-string " -[0-9]+[hdwmy]" "" rpl0)) + (msg (if deadline? "Warn starting from" "Delay until"))) + (replace-match + (concat keyword + " <" rpl + (format " -%dd" + (abs (- (time-to-days + (save-match-data + (org-read-date + nil t nil msg old-date-time))) + (time-to-days old-date-time)))) + ">") t t)))))) + (_ + (org-add-planning-info type time 'closed) + (when (and old-date + log + (not (equal old-date org-last-inserted-timestamp))) + (org-add-log-setup (if deadline? 'redeadline 'reschedule) + org-last-inserted-timestamp + old-date + log)) + (when repeater + (save-excursion + (org-back-to-heading t) + (when (re-search-forward + (concat keyword " " org-last-inserted-timestamp) + (line-end-position 2) + t) + (goto-char (1- (match-end 0))) + (insert " " repeater) + (setq org-last-inserted-timestamp + (concat (substring org-last-inserted-timestamp 0 -1) + " " repeater + (substring org-last-inserted-timestamp -1)))))) + (message (if deadline? "Deadline on %s" "Scheduled to %s") + org-last-inserted-timestamp))))) + +(defun org-deadline (arg &optional time) + "Insert a \"DEADLINE:\" string with a timestamp to make a deadline. + +When called interactively, this command pops up the Emacs calendar to let +the user select a date. + +With one universal prefix argument, remove any deadline from the item. +With two universal prefix arguments, prompt for a warning delay. +With argument TIME, set the deadline at the corresponding date. TIME +can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." + (interactive "P") + (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (org-map-entries + (lambda () (org--deadline-or-schedule arg 'deadline time)) + nil + (if (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level + 'region) + (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))) + (org--deadline-or-schedule arg 'deadline time))) + +(defun org-schedule (arg &optional time) + "Insert a \"SCHEDULED:\" string with a timestamp to schedule an item. + +When called interactively, this command pops up the Emacs calendar to let +the user select a date. + +With one universal prefix argument, remove any scheduling date from the item. +With two universal prefix arguments, prompt for a delay cookie. +With argument TIME, scheduled at the corresponding date. TIME can +either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." + (interactive "P") + (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (org-map-entries + (lambda () (org--deadline-or-schedule arg 'scheduled time)) + nil + (if (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level + 'region) + (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))) + (org--deadline-or-schedule arg 'scheduled time))) + +(defun org-get-scheduled-time (pom &optional inherit) + "Get the scheduled time as a time tuple, of a format suitable +for calling org-schedule with, or if there is no scheduling, +returns nil." + (let ((time (org-entry-get pom "SCHEDULED" inherit))) + (when time + (org-time-string-to-time time)))) + +(defun org-get-deadline-time (pom &optional inherit) + "Get the deadline as a time tuple, of a format suitable for +calling org-deadline with, or if there is no scheduling, returns +nil." + (let ((time (org-entry-get pom "DEADLINE" inherit))) + (when time + (org-time-string-to-time time)))) + +(defun org-remove-timestamp-with-keyword (keyword) + "Remove all time stamps with KEYWORD in the current entry." + (let ((re (concat "\\<" (regexp-quote keyword) " +<[^>\n]+>[ \t]*")) + beg) + (save-excursion + (org-back-to-heading t) + (setq beg (point)) + (outline-next-heading) + (while (re-search-backward re beg t) + (replace-match "") + (if (and (string-match "\\S-" (buffer-substring (point-at-bol) (point))) + (equal (char-before) ?\ )) + (backward-delete-char 1) + (when (string-match "^[ \t]*$" (buffer-substring + (point-at-bol) (point-at-eol))) + (delete-region (point-at-bol) + (min (point-max) (1+ (point-at-eol)))))))))) + +(defvar org-time-was-given) ; dynamically scoped parameter +(defvar org-end-time-was-given) ; dynamically scoped parameter + +(defun org-at-planning-p () + "Non-nil when point is on a planning info line." + ;; This is as accurate and faster than `org-element-at-point' since + ;; planning info location is fixed in the section. + (org-with-wide-buffer + (beginning-of-line) + (and (looking-at-p org-planning-line-re) + (eq (point) + (ignore-errors + (if (and (featurep 'org-inlinetask) (org-inlinetask-in-task-p)) + (org-back-to-heading t) + (org-with-limited-levels (org-back-to-heading t))) + (line-beginning-position 2)))))) + +(defun org-add-planning-info (what &optional time &rest remove) + "Insert new timestamp with keyword in the planning line. +WHAT indicates what kind of time stamp to add. It is a symbol +among `closed', `deadline', `scheduled' and nil. TIME indicates +the time to use. If none is given, the user is prompted for +a date. REMOVE indicates what kind of entries to remove. An old +WHAT entry will also be removed." + (let (org-time-was-given org-end-time-was-given default-time default-input) + (when (and (memq what '(scheduled deadline)) + (or (not time) + (and (stringp time) + (string-match "^[-+]+[0-9]" time)))) + ;; Try to get a default date/time from existing timestamp + (save-excursion + (org-back-to-heading t) + (let ((end (save-excursion (outline-next-heading) (point))) ts) + (when (re-search-forward (if (eq what 'scheduled) + org-scheduled-time-regexp + org-deadline-time-regexp) + end t) + (setq ts (match-string 1) + default-time (org-time-string-to-time ts) + default-input (and ts (org-get-compact-tod ts))))))) + (when what + (setq time + (if (stringp time) + ;; This is a string (relative or absolute), set + ;; proper date. + (apply #'encode-time + (org-read-date-analyze + time default-time (decode-time default-time))) + ;; If necessary, get the time from the user + (or time (org-read-date nil 'to-time nil + (cl-case what + (deadline "DEADLINE") + (scheduled "SCHEDULED") + (otherwise nil)) + default-time default-input))))) + (org-with-wide-buffer + (org-back-to-heading t) + (let ((planning? (save-excursion + (forward-line) + (looking-at-p org-planning-line-re)))) + (cond + (planning? + (forward-line) + ;; Move to current indentation. + (skip-chars-forward " \t") + ;; Check if we have to remove something. + (dolist (type (if what (cons what remove) remove)) + (save-excursion + (when (re-search-forward + (cl-case type + (closed org-closed-time-regexp) + (deadline org-deadline-time-regexp) + (scheduled org-scheduled-time-regexp) + (otherwise (error "Invalid planning type: %s" type))) + (line-end-position) + t) + ;; Delete until next keyword or end of line. + (delete-region + (match-beginning 0) + (if (re-search-forward org-keyword-time-not-clock-regexp + (line-end-position) + t) + (match-beginning 0) + (line-end-position)))))) + ;; If there is nothing more to add and no more keyword is + ;; left, remove the line completely. + (if (and (looking-at-p "[ \t]*$") (not what)) + (delete-region (line-end-position 0) + (line-end-position)) + ;; If we removed last keyword, do not leave trailing white + ;; space at the end of line. + (let ((p (point))) + (save-excursion + (end-of-line) + (unless (= (skip-chars-backward " \t" p) 0) + (delete-region (point) (line-end-position))))))) + (what + (end-of-line) + (insert "\n") + (when org-adapt-indentation + (indent-to-column (1+ (org-outline-level))))) + (t nil))) + (when what + ;; Insert planning keyword. + (insert (cl-case what + (closed org-closed-string) + (deadline org-deadline-string) + (scheduled org-scheduled-string) + (otherwise (error "Invalid planning type: %s" what))) + " ") + ;; Insert associated timestamp. + (let ((ts (org-insert-time-stamp + time + (or org-time-was-given + (and (eq what 'closed) org-log-done-with-time)) + (eq what 'closed) + nil nil (list org-end-time-was-given)))) + (unless (eolp) (insert " ")) + ts))))) + +(defvar org-log-note-marker (make-marker) + "Marker pointing at the entry where the note is to be inserted.") +(defvar org-log-note-purpose nil) +(defvar org-log-note-state nil) +(defvar org-log-note-previous-state nil) +(defvar org-log-note-extra nil) +(defvar org-log-note-window-configuration nil) +(defvar org-log-note-return-to (make-marker)) +(defvar org-log-note-effective-time nil + "Remembered current time. +So that dynamically scoped `org-extend-today-until' affects +timestamps in state change log.") + +(defvar org-log-post-message nil + "Message to be displayed after a log note has been stored. +The auto-repeater uses this.") + +(defun org-add-note () + "Add a note to the current entry. +This is done in the same way as adding a state change note." + (interactive) + (org-add-log-setup 'note)) + +(defun org-log-beginning (&optional create) + "Return expected start of log notes in current entry. +When optional argument CREATE is non-nil, the function creates +a drawer to store notes, if necessary. Returned position ignores +narrowing." + (org-with-wide-buffer + (let ((drawer (org-log-into-drawer))) + (cond + (drawer + (org-end-of-meta-data) + (let ((regexp (concat "^[ \t]*:" (regexp-quote drawer) ":[ \t]*$")) + (end (if (org-at-heading-p) (point) + (save-excursion (outline-next-heading) (point)))) + (case-fold-search t)) + (catch 'exit + ;; Try to find existing drawer. + (while (re-search-forward regexp end t) + (let ((element (org-element-at-point))) + (when (eq (org-element-type element) 'drawer) + (let ((cend (org-element-property :contents-end element))) + (when (and (not org-log-states-order-reversed) cend) + (goto-char cend))) + (throw 'exit nil)))) + ;; No drawer found. Create one, if permitted. + (when create + (unless (bolp) (insert "\n")) + (let ((beg (point))) + (insert ":" drawer ":\n:END:\n") + (org-indent-region beg (point)) + (org-flag-region (line-end-position -1) + (1- (point)) t 'outline)) + (end-of-line -1))))) + (t + (org-end-of-meta-data org-log-state-notes-insert-after-drawers) + (skip-chars-forward " \t\n") + (beginning-of-line) + (unless org-log-states-order-reversed + (org-skip-over-state-notes) + (skip-chars-backward " \t\n") + (forward-line))))) + (if (bolp) (point) (line-beginning-position 2)))) + +(defun org-add-log-setup (&optional purpose state prev-state how extra) + "Set up the post command hook to take a note. +If this is about to TODO state change, the new state is expected in STATE. +HOW is an indicator what kind of note should be created. +EXTRA is additional text that will be inserted into the notes buffer." + (move-marker org-log-note-marker (point)) + (setq org-log-note-purpose purpose + org-log-note-state state + org-log-note-previous-state prev-state + org-log-note-how how + org-log-note-extra extra + org-log-note-effective-time (org-current-effective-time) + org-log-setup t) + (add-hook 'post-command-hook 'org-add-log-note 'append)) + +(defun org-skip-over-state-notes () + "Skip past the list of State notes in an entry." + (when (ignore-errors (goto-char (org-in-item-p))) + (let* ((struct (org-list-struct)) + (prevs (org-list-prevs-alist struct)) + (regexp + (concat "[ \t]*- +" + (replace-regexp-in-string + " +" " +" + (org-replace-escapes + (regexp-quote (cdr (assq 'state org-log-note-headings))) + `(("%d" . ,org-ts-regexp-inactive) + ("%D" . ,org-ts-regexp) + ("%s" . "\\(?:\"\\S-+\"\\)?") + ("%S" . "\\(?:\"\\S-+\"\\)?") + ("%t" . ,org-ts-regexp-inactive) + ("%T" . ,org-ts-regexp) + ("%u" . ".*?") + ("%U" . ".*?"))))))) + (while (looking-at-p regexp) + (goto-char (or (org-list-get-next-item (point) struct prevs) + (org-list-get-item-end (point) struct))))))) + +(defun org-add-log-note (&optional _purpose) + "Pop up a window for taking a note, and add this note later." + (remove-hook 'post-command-hook 'org-add-log-note) + (setq org-log-setup nil) + (setq org-log-note-window-configuration (current-window-configuration)) + (delete-other-windows) + (move-marker org-log-note-return-to (point)) + (pop-to-buffer-same-window (marker-buffer org-log-note-marker)) + (goto-char org-log-note-marker) + (org-switch-to-buffer-other-window "*Org Note*") + (erase-buffer) + (if (memq org-log-note-how '(time state)) + (org-store-log-note) + (let ((org-inhibit-startup t)) (org-mode)) + (insert (format "# Insert note for %s. +# Finish with C-c C-c, or cancel with C-c C-k.\n\n" + (cl-case org-log-note-purpose + (clock-out "stopped clock") + (done "closed todo item") + (reschedule "rescheduling") + (delschedule "no longer scheduled") + (redeadline "changing deadline") + (deldeadline "removing deadline") + (refile "refiling") + (note "this entry") + (state + (format "state change from \"%s\" to \"%s\"" + (or org-log-note-previous-state "") + (or org-log-note-state ""))) + (t (error "This should not happen"))))) + (when org-log-note-extra (insert org-log-note-extra)) + (setq-local org-finish-function 'org-store-log-note) + (run-hooks 'org-log-buffer-setup-hook))) + +(defvar org-note-abort nil) ; dynamically scoped +(defun org-store-log-note () + "Finish taking a log note, and insert it to where it belongs." + (let ((txt (prog1 (buffer-string) + (kill-buffer))) + (note (cdr (assq org-log-note-purpose org-log-note-headings))) + lines) + (while (string-match "\\`# .*\n[ \t\n]*" txt) + (setq txt (replace-match "" t t txt))) + (when (string-match "\\s-+\\'" txt) + (setq txt (replace-match "" t t txt))) + (setq lines (and (not (equal "" txt)) (org-split-string txt "\n"))) + (when (org-string-nw-p note) + (setq note + (org-replace-escapes + note + (list (cons "%u" (user-login-name)) + (cons "%U" user-full-name) + (cons "%t" (format-time-string + (org-time-stamp-format 'long 'inactive) + org-log-note-effective-time)) + (cons "%T" (format-time-string + (org-time-stamp-format 'long nil) + org-log-note-effective-time)) + (cons "%d" (format-time-string + (org-time-stamp-format nil 'inactive) + org-log-note-effective-time)) + (cons "%D" (format-time-string + (org-time-stamp-format nil nil) + org-log-note-effective-time)) + (cons "%s" (cond + ((not org-log-note-state) "") + ((string-match-p org-ts-regexp + org-log-note-state) + (format "\"[%s]\"" + (substring org-log-note-state 1 -1))) + (t (format "\"%s\"" org-log-note-state)))) + (cons "%S" + (cond + ((not org-log-note-previous-state) "") + ((string-match-p org-ts-regexp + org-log-note-previous-state) + (format "\"[%s]\"" + (substring + org-log-note-previous-state 1 -1))) + (t (format "\"%s\"" + org-log-note-previous-state))))))) + (when lines (setq note (concat note " \\\\"))) + (push note lines)) + (when (and lines (not org-note-abort)) + (with-current-buffer (marker-buffer org-log-note-marker) + (org-with-wide-buffer + ;; Find location for the new note. + (goto-char org-log-note-marker) + (set-marker org-log-note-marker nil) + ;; Note associated to a clock is to be located right after + ;; the clock. Do not move point. + (unless (eq org-log-note-purpose 'clock-out) + (goto-char (org-log-beginning t))) + ;; Make sure point is at the beginning of an empty line. + (cond ((not (bolp)) (let ((inhibit-read-only t)) (insert "\n"))) + ((looking-at "[ \t]*\\S-") (save-excursion (insert "\n")))) + ;; In an existing list, add a new item at the top level. + ;; Otherwise, indent line like a regular one. + (let ((itemp (org-in-item-p))) + (if itemp + (indent-line-to + (let ((struct (save-excursion + (goto-char itemp) (org-list-struct)))) + (org-list-get-ind (org-list-get-top-point struct) struct))) + (org-indent-line))) + (insert (org-list-bullet-string "-") (pop lines)) + (let ((ind (org-list-item-body-column (line-beginning-position)))) + (dolist (line lines) + (insert "\n") + (indent-line-to ind) + (insert line))) + (message "Note stored") + (org-back-to-heading t))))) + ;; Don't add undo information when called from `org-agenda-todo'. + (set-window-configuration org-log-note-window-configuration) + (with-current-buffer (marker-buffer org-log-note-return-to) + (goto-char org-log-note-return-to)) + (move-marker org-log-note-return-to nil) + (when org-log-post-message (message "%s" org-log-post-message))) + +(defun org-remove-empty-drawer-at (pos) + "Remove an empty drawer at position POS. +POS may also be a marker." + (with-current-buffer (if (markerp pos) (marker-buffer pos) (current-buffer)) + (org-with-wide-buffer + (goto-char pos) + (let ((drawer (org-element-at-point))) + (when (and (memq (org-element-type drawer) '(drawer property-drawer)) + (not (org-element-property :contents-begin drawer))) + (delete-region (org-element-property :begin drawer) + (progn (goto-char (org-element-property :end drawer)) + (skip-chars-backward " \r\t\n") + (forward-line) + (point)))))))) + +(defvar org-ts-type nil) +(defun org-sparse-tree (&optional arg type) + "Create a sparse tree, prompt for the details. +This command can create sparse trees. You first need to select the type +of match used to create the tree: + +t Show all TODO entries. +T Show entries with a specific TODO keyword. +m Show entries selected by a tags/property match. +p Enter a property name and its value (both with completion on existing + names/values) and show entries with that property. +r Show entries matching a regular expression (`/' can be used as well). +b Show deadlines and scheduled items before a date. +a Show deadlines and scheduled items after a date. +d Show deadlines due within `org-deadline-warning-days'. +D Show deadlines and scheduled items between a date range." + (interactive "P") + (setq type (or type org-sparse-tree-default-date-type)) + (setq org-ts-type type) + (message "Sparse tree: [r]egexp [t]odo [T]odo-kwd [m]atch [p]roperty + [d]eadlines [b]efore-date [a]fter-date [D]ates range + [c]ycle through date types: %s" + (cl-case type + (all "all timestamps") + (scheduled "only scheduled") + (deadline "only deadline") + (active "only active timestamps") + (inactive "only inactive timestamps") + (closed "with a closed time-stamp") + (otherwise "scheduled/deadline"))) + (let ((answer (read-char-exclusive))) + (cl-case answer + (?c + (org-sparse-tree + arg + (cadr + (memq type '(nil all scheduled deadline active inactive closed))))) + (?d (call-interactively 'org-check-deadlines)) + (?b (call-interactively 'org-check-before-date)) + (?a (call-interactively 'org-check-after-date)) + (?D (call-interactively 'org-check-dates-range)) + (?t (call-interactively 'org-show-todo-tree)) + (?T (org-show-todo-tree '(4))) + (?m (call-interactively 'org-match-sparse-tree)) + ((?p ?P) + (let* ((kwd (completing-read + "Property: " (mapcar #'list (org-buffer-property-keys)))) + (value (completing-read + "Value: " (mapcar #'list (org-property-values kwd))))) + (unless (string-match "\\`{.*}\\'" value) + (setq value (concat "\"" value "\""))) + (org-match-sparse-tree arg (concat kwd "=" value)))) + ((?r ?R ?/) (call-interactively 'org-occur)) + (otherwise (user-error "No such sparse tree command \"%c\"" answer))))) + +(defvar-local org-occur-highlights nil + "List of overlays used for occur matches.") +(defvar-local org-occur-parameters nil + "Parameters of the active org-occur calls. +This is a list, each call to org-occur pushes as cons cell, +containing the regular expression and the callback, onto the list. +The list can contain several entries if `org-occur' has been called +several time with the KEEP-PREVIOUS argument. Otherwise, this list +will only contain one set of parameters. When the highlights are +removed (for example with `C-c C-c', or with the next edit (depending +on `org-remove-highlights-with-change'), this variable is emptied +as well.") + +(defun org-occur (regexp &optional keep-previous callback) + "Make a compact tree showing all matches of REGEXP. + +The tree will show the lines where the regexp matches, and any other context +defined in `org-show-context-detail', which see. + +When optional argument KEEP-PREVIOUS is non-nil, highlighting and exposing +done by a previous call to `org-occur' will be kept, to allow stacking of +calls to this command. + +Optional argument CALLBACK can be a function of no argument. In this case, +it is called with point at the end of the match, match data being set +accordingly. Current match is shown only if the return value is non-nil. +The function must neither move point nor alter narrowing." + (interactive "sRegexp: \nP") + (when (equal regexp "") + (user-error "Regexp cannot be empty")) + (unless keep-previous + (org-remove-occur-highlights nil nil t)) + (push (cons regexp callback) org-occur-parameters) + (let ((cnt 0)) + (save-excursion + (goto-char (point-min)) + (when (or (not keep-previous) ; do not want to keep + (not org-occur-highlights)) ; no previous matches + ;; hide everything + (org-overview)) + (let ((case-fold-search (if (eq org-occur-case-fold-search 'smart) + (isearch-no-upper-case-p regexp t) + org-occur-case-fold-search))) + (while (re-search-forward regexp nil t) + (when (or (not callback) + (save-match-data (funcall callback))) + (setq cnt (1+ cnt)) + (when org-highlight-sparse-tree-matches + (org-highlight-new-match (match-beginning 0) (match-end 0))) + (org-show-context 'occur-tree))))) + (when org-remove-highlights-with-change + (add-hook 'before-change-functions 'org-remove-occur-highlights + nil 'local)) + (unless org-sparse-tree-open-archived-trees + (org-hide-archived-subtrees (point-min) (point-max))) + (run-hooks 'org-occur-hook) + (when (called-interactively-p 'interactive) + (message "%d match(es) for regexp %s" cnt regexp)) + cnt)) + +(defun org-occur-next-match (&optional n _reset) + "Function for `next-error-function' to find sparse tree matches. +N is the number of matches to move, when negative move backwards. +This function always goes back to the starting point when no +match is found." + (let* ((limit (if (< n 0) (point-min) (point-max))) + (search-func (if (< n 0) + 'previous-single-char-property-change + 'next-single-char-property-change)) + (n (abs n)) + (pos (point)) + p1) + (catch 'exit + (while (setq p1 (funcall search-func (point) 'org-type)) + (when (equal p1 limit) + (goto-char pos) + (user-error "No more matches")) + (when (equal (get-char-property p1 'org-type) 'org-occur) + (setq n (1- n)) + (when (= n 0) + (goto-char p1) + (throw 'exit (point)))) + (goto-char p1)) + (goto-char p1) + (user-error "No more matches")))) + +(defun org-highlight-new-match (beg end) + "Highlight from BEG to END and mark the highlight is an occur headline." + (let ((ov (make-overlay beg end))) + (overlay-put ov 'face 'secondary-selection) + (overlay-put ov 'org-type 'org-occur) + (push ov org-occur-highlights))) + +(defun org-remove-occur-highlights (&optional _beg _end noremove) + "Remove the occur highlights from the buffer. +BEG and END are ignored. If NOREMOVE is nil, remove this function +from the `before-change-functions' in the current buffer." + (interactive) + (unless org-inhibit-highlight-removal + (mapc #'delete-overlay org-occur-highlights) + (setq org-occur-highlights nil) + (setq org-occur-parameters nil) + (unless noremove + (remove-hook 'before-change-functions + 'org-remove-occur-highlights 'local)))) + +;;;; Priorities + +(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]+\\)\\] ?\\)" + "Regular expression matching the priority indicator. +A priority indicator can be e.g. [#A] or [#1]. +This regular expression matches these groups: +0 : the whole match, e.g. \"TODO [#A] Hack\" +1 : the priority cookie, e.g. \"[#A]\" +2 : the value of the priority cookie, e.g. \"A\".") + +(defun org-priority-up () + "Increase the priority of the current item." + (interactive) + (org-priority 'up)) + +(defun org-priority-down () + "Decrease the priority of the current item." + (interactive) + (org-priority 'down)) + +(defun org-priority (&optional action show) + "Change the priority of an item. + +When called interactively with a `\\[universal-argument]' prefix, +show the priority in the minibuffer instead of changing it. + +When called programmatically, ACTION can be `set', `up', `down', +or a character." + (interactive "P") + (when show + ;; Deprecation warning inserted for Org 9.2; once enough time has + ;; passed the SHOW argument should be removed. + (warn "`org-priority' called with deprecated SHOW argument")) + (if (equal action '(4)) + (org-priority-show) + (unless org-priority-enable-commands + (user-error "Priority commands are disabled")) + (setq action (or action 'set)) + (let ((nump (< org-priority-lowest 65)) + current new news have remove) + (save-excursion + (org-back-to-heading t) + (when (looking-at org-priority-regexp) + (let ((ms (match-string 2))) + (setq current (org-priority-to-value ms) + have t))) + (cond + ((eq action 'remove) + (setq remove t new ?\ )) + ((or (eq action 'set) + (integerp action)) + (if (not (eq action 'set)) + (setq new action) + (setq + new + (if nump + (let* ((msg (format "Priority %s-%s, SPC to remove: " + (number-to-string org-priority-highest) + (number-to-string org-priority-lowest))) + (s (if (< 9 org-priority-lowest) + (read-string msg) + (message msg) + (char-to-string (read-char-exclusive))))) + (if (equal s " ") ?\s (string-to-number s))) + (progn (message "Priority %c-%c, SPC to remove: " + org-priority-highest org-priority-lowest) + (save-match-data + (setq new (read-char-exclusive))))))) + (when (and (= (upcase org-priority-highest) org-priority-highest) + (= (upcase org-priority-lowest) org-priority-lowest)) + (setq new (upcase new))) + (cond ((equal new ?\s) (setq remove t)) + ((or (< (upcase new) org-priority-highest) (> (upcase new) org-priority-lowest)) + (user-error + (if nump + "Priority must be between `%s' and `%s'" + "Priority must be between `%c' and `%c'") + org-priority-highest org-priority-lowest)))) + ((eq action 'up) + (setq new (if have + (1- current) ; normal cycling + ;; last priority was empty + (if (eq last-command this-command) + org-priority-lowest ; wrap around empty to lowest + ;; default + (if org-priority-start-cycle-with-default + org-priority-default + (1- org-priority-default)))))) + ((eq action 'down) + (setq new (if have + (1+ current) ; normal cycling + ;; last priority was empty + (if (eq last-command this-command) + org-priority-highest ; wrap around empty to highest + ;; default + (if org-priority-start-cycle-with-default + org-priority-default + (1+ org-priority-default)))))) + (t (user-error "Invalid action"))) + (when (or (< (upcase new) org-priority-highest) + (> (upcase new) org-priority-lowest)) + (if (and (memq action '(up down)) + (not have) (not (eq last-command this-command))) + ;; `new' is from default priority + (error + "The default can not be set, see `org-priority-default' why") + ;; normal cycling: `new' is beyond highest/lowest priority + ;; and is wrapped around to the empty priority + (setq remove t))) + ;; Numerical priorities are limited to 64, beyond that number, + ;; assume the priority cookie is a character. + (setq news (if (> new 64) (format "%c" new) (format "%s" new))) + (if have + (if remove + (replace-match "" t t nil 1) + (replace-match news t t nil 2)) + (if remove + (user-error "No priority cookie found in line") + (let ((case-fold-search nil)) (looking-at org-todo-line-regexp)) + (if (match-end 2) + (progn + (goto-char (match-end 2)) + (insert " [#" news "]")) + (goto-char (match-beginning 3)) + (insert "[#" news "] ")))) + (org-align-tags)) + (if remove + (message "Priority removed") + (message "Priority of current item set to %s" news))))) + +(defalias 'org-show-priority 'org-priority-show) +(defun org-priority-show () + "Show the priority of the current item. +This priority is composed of the main priority given with the [#A] cookies, +and by additional input from the age of a schedules or deadline entry." + (interactive) + (let ((pri (if (eq major-mode 'org-agenda-mode) + (org-get-at-bol 'priority) + (save-excursion + (save-match-data + (beginning-of-line) + (and (looking-at org-heading-regexp) + (org-get-priority (match-string 0)))))))) + (message "Priority is %d" (if pri pri -1000)))) + +(defun org-get-priority (s) + "Find priority cookie and return priority. +S is a string against which you can match `org-priority-regexp'. +If `org-priority-get-priority-function' is set to a custom +function, use it. Otherwise process S and output the priority +value, an integer." + (save-match-data + (if (functionp org-priority-get-priority-function) + (funcall org-priority-get-priority-function s) + (if (not (string-match org-priority-regexp s)) + (* 1000 (- org-priority-lowest org-priority-default)) + (* 1000 (- org-priority-lowest + (org-priority-to-value (match-string 2 s)))))))) + +;;;; Tags + +(defvar org-agenda-archives-mode) +(defvar org-map-continue-from nil + "Position from where mapping should continue. +Can be set by the action argument to `org-scan-tags' and `org-map-entries'.") + +(defvar org-scanner-tags nil + "The current tag list while the tags scanner is running.") + +(defvar org-trust-scanner-tags nil + "Should `org-get-tags' use the tags for the scanner. +This is for internal dynamical scoping only. +When this is non-nil, the function `org-get-tags' will return the value +of `org-scanner-tags' instead of building the list by itself. This +can lead to large speed-ups when the tags scanner is used in a file with +many entries, and when the list of tags is retrieved, for example to +obtain a list of properties. Building the tags list for each entry in such +a file becomes an N^2 operation - but with this variable set, it scales +as N.") + +(defvar org--matcher-tags-todo-only nil) + +(defun org-scan-tags (action matcher todo-only &optional start-level) + "Scan headline tags with inheritance and produce output ACTION. + +ACTION can be `sparse-tree' to produce a sparse tree in the current buffer, +or `agenda' to produce an entry list for an agenda view. It can also be +a Lisp form or a function that should be called at each matched headline, in +this case the return value is a list of all return values from these calls. + +MATCHER is a function accepting three arguments, returning +a non-nil value whenever a given set of tags qualifies a headline +for inclusion. See `org-make-tags-matcher' for more information. +As a special case, it can also be set to t (respectively nil) in +order to match all (respectively none) headline. + +When TODO-ONLY is non-nil, only lines with a TODO keyword are +included in the output. + +START-LEVEL can be a string with asterisks, reducing the scope to +headlines matching this string." + (require 'org-agenda) + (let* ((re (concat "^" + (if start-level + ;; Get the correct level to match + (concat "\\*\\{" (number-to-string start-level) "\\} ") + org-outline-regexp) + " *\\(" (regexp-opt org-todo-keywords-1 'words) "\\)?" + " *\\(.*?\\)\\([ \t]:\\(?:" org-tag-re ":\\)+\\)?[ \t]*$")) + (props (list 'face 'default + 'done-face 'org-agenda-done + 'undone-face 'default + 'mouse-face 'highlight + 'org-not-done-regexp org-not-done-regexp + 'org-todo-regexp org-todo-regexp + 'org-complex-heading-regexp org-complex-heading-regexp + 'help-echo + (format "mouse-2 or RET jump to Org file %S" + (abbreviate-file-name + (or (buffer-file-name (buffer-base-buffer)) + (buffer-name (buffer-base-buffer))))))) + (org-map-continue-from nil) + lspos tags tags-list + (tags-alist (list (cons 0 org-file-tags))) + (llast 0) rtn rtn1 level category i txt + todo marker entry priority + ts-date ts-date-type ts-date-pair) + (unless (or (member action '(agenda sparse-tree)) (functionp action)) + (setq action (list 'lambda nil action))) + (save-excursion + (goto-char (point-min)) + (when (eq action 'sparse-tree) + (org-overview) + (org-remove-occur-highlights)) + (while (let (case-fold-search) + (re-search-forward re nil t)) + (setq org-map-continue-from nil) + (catch :skip + ;; Ignore closing parts of inline tasks. + (when (and (fboundp 'org-inlinetask-end-p) (org-inlinetask-end-p)) + (throw :skip t)) + (setq todo (and (match-end 1) (match-string-no-properties 1))) + (setq tags (and (match-end 4) (org-trim (match-string-no-properties 4)))) + (goto-char (setq lspos (match-beginning 0))) + (setq level (org-reduced-level (org-outline-level)) + category (org-get-category)) + (when (eq action 'agenda) + (setq ts-date-pair (org-agenda-entry-get-agenda-timestamp (point)) + ts-date (car ts-date-pair) + ts-date-type (cdr ts-date-pair))) + (setq i llast llast level) + ;; remove tag lists from same and sublevels + (while (>= i level) + (when (setq entry (assoc i tags-alist)) + (setq tags-alist (delete entry tags-alist))) + (setq i (1- i))) + ;; add the next tags + (when tags + (setq tags (org-split-string tags ":") + tags-alist + (cons (cons level tags) tags-alist))) + ;; compile tags for current headline + (setq tags-list + (if org-use-tag-inheritance + (apply 'append (mapcar 'cdr (reverse tags-alist))) + tags) + org-scanner-tags tags-list) + (when org-use-tag-inheritance + (setcdr (car tags-alist) + (mapcar (lambda (x) + (setq x (copy-sequence x)) + (org-add-prop-inherited x)) + (cdar tags-alist)))) + (when (and tags org-use-tag-inheritance + (or (not (eq t org-use-tag-inheritance)) + org-tags-exclude-from-inheritance)) + ;; Selective inheritance, remove uninherited ones. + (setcdr (car tags-alist) + (org-remove-uninherited-tags (cdar tags-alist)))) + (when (and + + ;; eval matcher only when the todo condition is OK + (and (or (not todo-only) (member todo org-todo-keywords-1)) + (if (functionp matcher) + (let ((case-fold-search t) (org-trust-scanner-tags t)) + (funcall matcher todo tags-list level)) + matcher)) + + ;; Call the skipper, but return t if it does not + ;; skip, so that the `and' form continues evaluating. + (progn + (unless (eq action 'sparse-tree) (org-agenda-skip)) + t) + + ;; Check if timestamps are deselecting this entry + (or (not todo-only) + (and (member todo org-todo-keywords-1) + (or (not org-agenda-tags-todo-honor-ignore-options) + (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))) + + ;; select this headline + (cond + ((eq action 'sparse-tree) + (and org-highlight-sparse-tree-matches + (org-get-heading) (match-end 0) + (org-highlight-new-match + (match-beginning 1) (match-end 1))) + (org-show-context 'tags-tree)) + ((eq action 'agenda) + (setq txt (org-agenda-format-item + "" + (concat + (if (eq org-tags-match-list-sublevels 'indented) + (make-string (1- level) ?.) "") + (org-get-heading)) + (make-string level ?\s) + category + tags-list) + priority (org-get-priority txt)) + (goto-char lspos) + (setq marker (org-agenda-new-marker)) + (org-add-props txt props + 'org-marker marker 'org-hd-marker marker 'org-category category + 'todo-state todo + 'ts-date ts-date + 'priority priority + 'type (concat "tagsmatch" ts-date-type)) + (push txt rtn)) + ((functionp action) + (setq org-map-continue-from nil) + (save-excursion + (setq rtn1 (funcall action)) + (push rtn1 rtn))) + (t (user-error "Invalid action"))) + + ;; if we are to skip sublevels, jump to end of subtree + (unless org-tags-match-list-sublevels + (org-end-of-subtree t) + (backward-char 1)))) + ;; Get the correct position from where to continue + (if org-map-continue-from + (goto-char org-map-continue-from) + (and (= (point) lspos) (end-of-line 1))))) + (when (and (eq action 'sparse-tree) + (not org-sparse-tree-open-archived-trees)) + (org-hide-archived-subtrees (point-min) (point-max))) + (nreverse rtn))) + +(defun org-remove-uninherited-tags (tags) + "Remove all tags that are not inherited from the list TAGS." + (cond + ((eq org-use-tag-inheritance t) + (if org-tags-exclude-from-inheritance + (org-delete-all org-tags-exclude-from-inheritance tags) + tags)) + ((not org-use-tag-inheritance) nil) + ((stringp org-use-tag-inheritance) + (delq nil (mapcar + (lambda (x) + (if (and (string-match org-use-tag-inheritance x) + (not (member x org-tags-exclude-from-inheritance))) + x nil)) + tags))) + ((listp org-use-tag-inheritance) + (delq nil (mapcar + (lambda (x) + (if (member x org-use-tag-inheritance) x nil)) + tags))))) + +(defun org-match-sparse-tree (&optional todo-only match) + "Create a sparse tree according to tags string MATCH. + +MATCH is a string with match syntax. It can contain a selection +of tags (\"+work+urgent-boss\"), properties (\"LEVEL>3\"), and +TODO keywords (\"TODO=\\\"WAITING\\\"\") or a combination of +those. See the manual for details. + +If optional argument TODO-ONLY is non-nil, only select lines that +are also TODO tasks." + (interactive "P") + (org-agenda-prepare-buffers (list (current-buffer))) + (let ((org--matcher-tags-todo-only todo-only)) + (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match t)) + org--matcher-tags-todo-only))) + +(defalias 'org-tags-sparse-tree 'org-match-sparse-tree) + +(defvar org-cached-props nil) +(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)))) + +(defun org-global-tags-completion-table (&optional files) + "Return the list of all tags in all agenda buffer/files. +Optional FILES argument is a list of files which can be used +instead of the agenda files." + (save-excursion + (org-uniquify + (delq nil + (apply #'append + (mapcar + (lambda (file) + (set-buffer (find-file-noselect file)) + (org--tag-add-to-alist + (org-get-buffer-tags) + (mapcar (lambda (x) + (and (stringp (car-safe x)) + (list (car-safe x)))) + org-current-tag-alist))) + (if (car-safe files) files + (org-agenda-files)))))))) + +(defun org-make-tags-matcher (match &optional only-local-tags) + "Create the TAGS/TODO matcher form for the selection string MATCH. + +Returns a cons of the selection string MATCH and a function +implementing the matcher. + +The matcher is to be called at an Org entry, with point on the +headline, and returns non-nil if the entry matches the selection +string MATCH. It must be called with three arguments: the TODO +keyword at the entry (or nil if none), the list of all tags at +the entry including inherited ones and the reduced level of the +headline. Additionally, the category of the entry, if any, must +be specified as the text property `org-category' on the headline. + +This function sets the variable `org--matcher-tags-todo-only' to +a non-nil value if the matcher restricts matching to TODO +entries, otherwise it is not touched. + +When ONLY-LOCAL-TAGS is non-nil, ignore the global tag completion +table, only get buffer tags. + +See also `org-scan-tags'." + (unless match + ;; Get a new match request, with completion against the global + ;; tags table and the local tags in current buffer. + (let ((org-last-tags-completion-table + (org--tag-add-to-alist + (org-get-buffer-tags) + (unless only-local-tags + (org-global-tags-completion-table))))) + (setq match + (completing-read + "Match: " + 'org-tags-completion-function nil nil nil 'org-tags-history)))) + + (let ((match0 match) + (re (concat + "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)" + "\\([0-9]+\\)\\|\\(\\(?:[[:alnum:]_]+\\(?:\\\\-\\)*\\)+\\)" + "\\([<>=]\\{1,2\\}\\)" + "\\({[^}]+}\\|\"[^\"]*\"\\|-?[.0-9]+\\(?:[eE][-+]?[0-9]+\\)?\\)" + "\\|" org-tag-re "\\)")) + (start 0) + tagsmatch todomatch tagsmatcher todomatcher) + + ;; Expand group tags. + (setq match (org-tags-expand match)) + + ;; Check if there is a TODO part of this match, which would be the + ;; part after a "/". To make sure that this slash is not part of + ;; a property value to be matched against, we also check that + ;; there is no / after that slash. First, find the last slash. + (let ((s 0)) + (while (string-match "/+" match s) + (setq start (match-beginning 0)) + (setq s (match-end 0)))) + (if (and (string-match "/+" match start) + (not (string-match-p "\"" match start))) + ;; Match contains also a TODO-matching request. + (progn + (setq tagsmatch (substring match 0 (match-beginning 0))) + (setq todomatch (substring match (match-end 0))) + (when (string-prefix-p "!" todomatch) + (setq org--matcher-tags-todo-only t) + (setq todomatch (substring todomatch 1))) + (when (string-match "\\`\\s-*\\'" todomatch) + (setq todomatch nil))) + ;; Only matching tags. + (setq tagsmatch match) + (setq todomatch nil)) + + ;; Make the tags matcher. + (when (org-string-nw-p tagsmatch) + (let ((orlist nil) + (orterms (org-split-string tagsmatch "|")) + term) + (while (setq term (pop orterms)) + (while (and (equal (substring term -1) "\\") orterms) + (setq term (concat term "|" (pop orterms)))) ;repair bad split. + (while (string-match re term) + (let* ((rest (substring term (match-end 0))) + (minus (and (match-end 1) + (equal (match-string 1 term) "-"))) + (tag (save-match-data + (replace-regexp-in-string + "\\\\-" "-" (match-string 2 term)))) + (regexp (eq (string-to-char tag) ?{)) + (levelp (match-end 4)) + (propp (match-end 5)) + (mm + (cond + (regexp `(org-match-any-p ,(substring tag 1 -1) tags-list)) + (levelp + `(,(org-op-to-function (match-string 3 term)) + level + ,(string-to-number (match-string 4 term)))) + (propp + (let* ((gv (pcase (upcase (match-string 5 term)) + ("CATEGORY" + '(get-text-property (point) 'org-category)) + ("TODO" 'todo) + (p `(org-cached-entry-get nil ,p)))) + (pv (match-string 7 term)) + (regexp (eq (string-to-char pv) ?{)) + (strp (eq (string-to-char pv) ?\")) + (timep (string-match-p "^\"[[<].*[]>]\"$" pv)) + (po (org-op-to-function (match-string 6 term) + (if timep 'time strp)))) + (setq pv (if (or regexp strp) (substring pv 1 -1) pv)) + (when timep (setq pv (org-matcher-time pv))) + (cond ((and regexp (eq po '/=)) + `(not (string-match ,pv (or ,gv "")))) + (regexp `(string-match ,pv (or ,gv ""))) + (strp `(,po (or ,gv "") ,pv)) + (t + `(,po + (string-to-number (or ,gv "")) + ,(string-to-number pv)))))) + (t `(member ,tag tags-list))))) + (push (if minus `(not ,mm) mm) tagsmatcher) + (setq term rest))) + (push `(and ,@tagsmatcher) orlist) + (setq tagsmatcher nil)) + (setq tagsmatcher `(progn (setq org-cached-props nil) (or ,@orlist))))) + + ;; Make the TODO matcher. + (when (org-string-nw-p todomatch) + (let ((orlist nil)) + (dolist (term (org-split-string todomatch "|")) + (while (string-match re term) + (let* ((minus (and (match-end 1) + (equal (match-string 1 term) "-"))) + (kwd (match-string 2 term)) + (regexp (eq (string-to-char kwd) ?{)) + (mm (if regexp `(string-match ,(substring kwd 1 -1) todo) + `(equal todo ,kwd)))) + (push (if minus `(not ,mm) mm) todomatcher)) + (setq term (substring term (match-end 0)))) + (push (if (> (length todomatcher) 1) + (cons 'and todomatcher) + (car todomatcher)) + orlist) + (setq todomatcher nil)) + (setq todomatcher (cons 'or orlist)))) + + ;; Return the string and function of the matcher. If no + ;; tags-specific or todo-specific matcher exists, match + ;; everything. + (let ((matcher (if (and tagsmatcher todomatcher) + `(and ,tagsmatcher ,todomatcher) + (or tagsmatcher todomatcher t)))) + (when org--matcher-tags-todo-only + (setq matcher `(and (member todo org-not-done-keywords) ,matcher))) + (cons match0 `(lambda (todo tags-list level) ,matcher))))) + +(defun org--tags-expand-group (group tag-groups expanded) + "Recursively expand all tags in GROUP, according to TAG-GROUPS. +TAG-GROUPS is the list of groups used for expansion. EXPANDED is +an accumulator used in recursive calls." + (dolist (tag group) + (unless (member tag expanded) + (let ((group (assoc tag tag-groups))) + (push tag expanded) + (when group + (setq expanded + (org--tags-expand-group (cdr group) tag-groups expanded)))))) + expanded) + +(defun org-tags-expand (match &optional single-as-list) + "Expand group tags in MATCH. + +This replaces every group tag in MATCH with a regexp tag search. +For example, a group tag \"Work\" defined as { Work : Lab Conf } +will be replaced like this: + + Work => {\\<\\(?:Work\\|Lab\\|Conf\\)\\>} + +Work => +{\\<\\(?:Work\\|Lab\\|Conf\\)\\>} + -Work => -{\\<\\(?:Work\\|Lab\\|Conf\\)\\>} + +Replacing by a regexp preserves the structure of the match. +E.g., this expansion + + Work|Home => {\\(?:Work\\|Lab\\|Conf\\}|Home + +will match anything tagged with \"Lab\" and \"Home\", or tagged +with \"Conf\" and \"Home\" or tagged with \"Work\" and \"Home\". + +A group tag in MATCH can contain regular expressions of its own. +For example, a group tag \"Proj\" defined as { Proj : {P@.+} } +will be replaced like this: + + Proj => {\\<\\(?:Proj\\)\\>\\|P@.+} + +When the optional argument SINGLE-AS-LIST is non-nil, MATCH is +assumed to be a single group tag, and the function will return +the list of tags in this group." + (unless (org-string-nw-p match) (error "Invalid match tag: %S" match)) + (let ((tag-groups + (or org-tag-groups-alist-for-agenda org-tag-groups-alist))) + (cond + (single-as-list (org--tags-expand-group (list match) tag-groups nil)) + (org-group-tags + (let* ((case-fold-search t) + (tag-syntax org-mode-syntax-table) + (group-keys (mapcar #'car tag-groups)) + (key-regexp (concat "\\([+-]?\\)" (regexp-opt group-keys 'words))) + (return-match match)) + ;; Mark regexp-expressions in the match-expression so that we + ;; do not replace them later on. + (let ((s 0)) + (while (string-match "{.+?}" return-match s) + (setq s (match-end 0)) + (add-text-properties + (match-beginning 0) (match-end 0) '(regexp t) return-match))) + ;; @ and _ are allowed as word-components in tags. + (modify-syntax-entry ?@ "w" tag-syntax) + (modify-syntax-entry ?_ "w" tag-syntax) + ;; For each tag token found in MATCH, compute a regexp and it + (with-syntax-table tag-syntax + (replace-regexp-in-string + key-regexp + (lambda (m) + (if (get-text-property (match-beginning 2) 'regexp m) + m ;regexp tag: ignore + (let* ((operator (match-string 1 m)) + (tag-token (let ((tag (match-string 2 m))) + (list tag))) + regexp-tags regular-tags) + ;; Partition tags between regexp and regular tags. + ;; Remove curly bracket syntax from regexp tags. + (dolist (tag (org--tags-expand-group tag-token tag-groups nil)) + (save-match-data + (if (string-match "{\\(.+?\\)}" tag) + (push (match-string 1 tag) regexp-tags) + (push tag regular-tags)))) + ;; Replace tag token by the appropriate regexp. + ;; Regular tags need to be regexp-quoted, whereas + ;; regexp-tags are inserted as-is. + (let ((regular (regexp-opt regular-tags)) + (regexp (mapconcat #'identity regexp-tags "\\|"))) + (concat operator + (cond + ((null regular-tags) (format "{%s}" regexp)) + ((null regexp-tags) (format "{\\<%s\\>}" regular)) + (t (format "{\\<%s\\>\\|%s}" regular regexp)))))))) + return-match + t t)))) + (t match)))) + +(defun org-op-to-function (op &optional stringp) + "Turn an operator into the appropriate function." + (setq op + (cond + ((equal op "<" ) '(< org-string< org-time<)) + ((equal op ">" ) '(> org-string> org-time>)) + ((member op '("<=" "=<")) '(<= org-string<= org-time<=)) + ((member op '(">=" "=>")) '(>= org-string>= org-time>=)) + ((member op '("=" "==")) '(= string= org-time=)) + ((member op '("<>" "!=")) '(/= org-string<> org-time<>)))) + (nth (if (eq stringp 'time) 2 (if stringp 1 0)) op)) + +(defvar org-add-colon-after-tag-completion nil) ;; dynamically scoped param +(defvar org-tags-overlay (make-overlay 1 1)) +(delete-overlay org-tags-overlay) + +(defun org-add-prop-inherited (s) + (add-text-properties 0 (length s) '(inherited t) s) + s) + +(defun org-toggle-tag (tag &optional onoff) + "Toggle the tag TAG for the current line. +If ONOFF is `on' or `off', don't toggle but set to this state." + (save-excursion + (org-back-to-heading t) + (let ((current + ;; Reverse the tags list so any new tag is appended to the + ;; current list of tags. + (nreverse (org-get-tags nil t))) + res) + (pcase onoff + (`off (setq current (delete tag current))) + ((or `on (guard (not (member tag current)))) + (setq res t) + (cl-pushnew tag current :test #'equal)) + (_ (setq current (delete tag current)))) + (org-set-tags (nreverse current)) + res))) + +(defun org--align-tags-here (to-col) + "Align tags on the current headline to TO-COL. +Assume point is on a headline. Preserve point when aligning +tags." + (when (org-match-line org-tag-line-re) + (let* ((tags-start (match-beginning 1)) + (blank-start (save-excursion + (goto-char tags-start) + (skip-chars-backward " \t") + (point))) + (new (max (if (>= to-col 0) to-col + (- (abs to-col) (string-width (match-string 1)))) + ;; Introduce at least one space after the heading + ;; or the stars. + (save-excursion + (goto-char blank-start) + (1+ (current-column))))) + (current + (save-excursion (goto-char tags-start) (current-column))) + (origin (point-marker)) + (column (current-column)) + (in-blank? (and (> origin blank-start) (<= origin tags-start)))) + (when (/= new current) + (delete-region blank-start tags-start) + (goto-char blank-start) + (let ((indent-tabs-mode nil)) (indent-to new)) + ;; Try to move back to original position. If point was in the + ;; blanks before the tags, ORIGIN marker is of no use because + ;; it now points to BLANK-START. Use COLUMN instead. + (if in-blank? (org-move-to-column column) (goto-char origin)))))) + +(defun org-set-tags-command (&optional arg) + "Set the tags for the current visible entry. + +When called with `\\[universal-argument]' prefix argument ARG, \ +realign all tags +in the current buffer. + +When called with `\\[universal-argument] \\[universal-argument]' prefix argument, \ +unconditionally do not +offer the fast tag selection interface. + +If a region is active, set tags in the region according to the +setting of `org-loop-over-headlines-in-active-region'. + +This function is for interactive use only; +in Lisp code use `org-set-tags' instead." + (interactive "P") + (let ((org-use-fast-tag-selection + (unless (equal '(16) arg) org-use-fast-tag-selection))) + (cond + ((equal '(4) arg) (org-align-tags t)) + ((and (org-region-active-p) org-loop-over-headlines-in-active-region) + (let (org-loop-over-headlines-in-active-region) ; hint: infinite recursion. + (org-map-entries + #'org-set-tags-command + nil + (if (eq org-loop-over-headlines-in-active-region 'start-level) + 'region-start-level + 'region) + (lambda () (when (org-invisible-p) (org-end-of-subtree nil t)))))) + (t + (save-excursion + (org-back-to-heading) + (let* ((all-tags (org-get-tags)) + (table (setq org-last-tags-completion-table + (org--tag-add-to-alist + (and org-complete-tags-always-offer-all-agenda-tags + (org-global-tags-completion-table + (org-agenda-files))) + (or org-current-tag-alist (org-get-buffer-tags))))) + (current-tags + (cl-remove-if (lambda (tag) (get-text-property 0 'inherited tag)) + all-tags)) + (inherited-tags + (cl-remove-if-not (lambda (tag) (get-text-property 0 'inherited tag)) + all-tags)) + (tags + (replace-regexp-in-string + ;; Ignore all forbidden characters in tags. + "[^[:alnum:]_@#%]+" ":" + (if (or (eq t org-use-fast-tag-selection) + (and org-use-fast-tag-selection + (delq nil (mapcar #'cdr table)))) + (org-fast-tag-selection + current-tags + inherited-tags + table + (and org-fast-tag-selection-include-todo org-todo-key-alist)) + (let ((org-add-colon-after-tag-completion (< 1 (length table))) + (crm-separator "[ \t]*:[ \t]*")) + (mapconcat #'identity + (completing-read-multiple + "Tags: " + org-last-tags-completion-table + nil nil (org-make-tag-string current-tags) + 'org-tags-history) + ":")))))) + (org-set-tags tags))))) + ;; `save-excursion' may not replace the point at the right + ;; position. + (when (and (save-excursion (skip-chars-backward "*") (bolp)) + (looking-at-p " ")) + (forward-char)))) + +(defun org-align-tags (&optional all) + "Align tags in current entry. +When optional argument ALL is non-nil, align all tags in the +visible part of the buffer." + (let ((get-indent-column + (lambda () + (let ((offset (if (bound-and-true-p org-indent-mode) + (* (1- org-indent-indentation-per-level) + (1- (org-current-level))) + 0))) + (+ org-tags-column + (if (> org-tags-column 0) (- offset) offset)))))) + (if (and (not all) (org-at-heading-p)) + (org--align-tags-here (funcall get-indent-column)) + (save-excursion + (if all + (progn + (goto-char (point-min)) + (while (re-search-forward org-tag-line-re nil t) + (org--align-tags-here (funcall get-indent-column)))) + (org-back-to-heading t) + (org--align-tags-here (funcall get-indent-column))))))) + +(defun org-set-tags (tags) + "Set the tags of the current entry to TAGS, replacing current tags. + +TAGS may be a tags string like \":aa:bb:cc:\", or a list of tags. +If TAGS is nil or the empty string, all tags are removed. + +This function assumes point is on a headline." + (org-with-wide-buffer + (let ((tags (pcase tags + ((pred listp) tags) + ((pred stringp) (split-string (org-trim tags) ":" t)) + (_ (error "Invalid tag specification: %S" tags)))) + (old-tags (org-get-tags nil t)) + (tags-change? nil)) + (when (functionp org-tags-sort-function) + (setq tags (sort tags org-tags-sort-function))) + (setq tags-change? (not (equal tags old-tags))) + (when tags-change? + ;; Delete previous tags and any trailing white space. + (goto-char (if (org-match-line org-tag-line-re) (match-beginning 1) + (line-end-position))) + (skip-chars-backward " \t") + (delete-region (point) (line-end-position)) + ;; Deleting white spaces may break an otherwise empty headline. + ;; Re-introduce one space in this case. + (unless (org-at-heading-p) (insert " ")) + (when tags + (save-excursion (insert " " (org-make-tag-string tags))) + ;; When text is being inserted on an invisible region + ;; boundary, it can be inadvertently sucked into + ;; invisibility. + (unless (org-invisible-p (line-beginning-position)) + (org-flag-region (point) (line-end-position) nil 'outline)))) + ;; Align tags, if any. + (when tags (org-align-tags)) + (when tags-change? (run-hooks 'org-after-tags-change-hook))))) + +(defun org-change-tag-in-region (beg end tag off) + "Add or remove TAG for each entry in the region. +This works in the agenda, and also in an Org buffer." + (interactive + (list (region-beginning) (region-end) + (let ((org-last-tags-completion-table + (if (derived-mode-p 'org-mode) + (org--tag-add-to-alist + (org-get-buffer-tags) + (org-global-tags-completion-table)) + (org-global-tags-completion-table)))) + (completing-read + "Tag: " org-last-tags-completion-table nil nil nil + 'org-tags-history)) + (progn + (message "[s]et or [r]emove? ") + (equal (read-char-exclusive) ?r)))) + (when (fboundp 'deactivate-mark) (deactivate-mark)) + (let ((agendap (equal major-mode 'org-agenda-mode)) + l1 l2 m buf pos newhead (cnt 0)) + (goto-char end) + (setq l2 (1- (org-current-line))) + (goto-char beg) + (setq l1 (org-current-line)) + (cl-loop for l from l1 to l2 do + (org-goto-line l) + (setq m (get-text-property (point) 'org-hd-marker)) + (when (or (and (derived-mode-p 'org-mode) (org-at-heading-p)) + (and agendap m)) + (setq buf (if agendap (marker-buffer m) (current-buffer)) + pos (if agendap m (point))) + (with-current-buffer buf + (save-excursion + (save-restriction + (goto-char pos) + (setq cnt (1+ cnt)) + (org-toggle-tag tag (if off 'off 'on)) + (setq newhead (org-get-heading))))) + (and agendap (org-agenda-change-all-lines newhead m)))) + (message "Tag :%s: %s in %d headings" tag (if off "removed" "set") cnt))) + +(defun org-tags-completion-function (string _predicate &optional flag) + "Complete tag STRING. +FLAG specifies the type of completion operation to perform. This +function is passed as a collection function to `completing-read', +which see." + (let ((completion-ignore-case nil) ;tags are case-sensitive + (confirm (lambda (x) (stringp (car x)))) + (prefix "")) + (when (string-match "^\\(.*[-+:&,|]\\)\\([^-+:&,|]*\\)$" string) + (setq prefix (match-string 1 string)) + (setq string (match-string 2 string))) + (pcase flag + (`t (all-completions string org-last-tags-completion-table confirm)) + (`lambda (assoc string org-last-tags-completion-table)) ;exact match? + (`nil + (pcase (try-completion string org-last-tags-completion-table confirm) + ((and completion (pred stringp)) + (concat prefix + completion + (if (and org-add-colon-after-tag-completion + (assoc completion org-last-tags-completion-table)) + ":" + ""))) + (completion completion))) + (_ nil)))) + +(defun org-fast-tag-insert (kwd tags face &optional end) + "Insert KWD, and the TAGS, the latter with face FACE. +Also insert END." + (insert (format "%-12s" (concat kwd ":")) + (org-add-props (mapconcat 'identity tags " ") nil 'face face) + (or end ""))) + +(defun org-fast-tag-show-exit (flag) + (save-excursion + (org-goto-line 3) + (when (re-search-forward "[ \t]+Next change exits" (point-at-eol) t) + (replace-match "")) + (when flag + (end-of-line 1) + (org-move-to-column (- (window-width) 19) t) + (insert (org-add-props " Next change exits" nil 'face 'org-warning))))) + +(defun org-set-current-tags-overlay (current prefix) + "Add an overlay to CURRENT tag with PREFIX." + (let ((s (org-make-tag-string current))) + (put-text-property 0 (length s) 'face '(secondary-selection org-tag) s) + (org-overlay-display org-tags-overlay (concat prefix s)))) + +(defvar org-last-tag-selection-key nil) +(defun org-fast-tag-selection (current inherited table &optional todo-table) + "Fast tag selection with single keys. +CURRENT is the current list of tags in the headline, INHERITED is the +list of inherited tags, and TABLE is an alist of tags and corresponding keys, +possibly with grouping information. TODO-TABLE is a similar table with +TODO keywords, should these have keys assigned to them. +If the keys are nil, a-z are automatically assigned. +Returns the new tags string, or nil to not change the current settings." + (let* ((fulltable (append table todo-table)) + (maxlen (if (null fulltable) 0 + (apply #'max + (mapcar (lambda (x) + (if (stringp (car x)) (string-width (car x)) + 0)) + fulltable)))) + (buf (current-buffer)) + (expert (eq org-fast-tag-selection-single-key 'expert)) + (tab-tags nil) + (fwidth (+ maxlen 3 1 3)) + (ncol (/ (- (window-width) 4) fwidth)) + (i-face 'org-done) + (c-face 'org-todo) + tg cnt e c char c1 c2 ntable tbl rtn + ov-start ov-end ov-prefix + (exit-after-next org-fast-tag-selection-single-key) + (done-keywords org-done-keywords) + groups ingroup intaggroup) + (save-excursion + (beginning-of-line) + (if (looking-at org-tag-line-re) + (setq ov-start (match-beginning 1) + ov-end (match-end 1) + ov-prefix "") + (setq ov-start (1- (point-at-eol)) + ov-end (1+ ov-start)) + (skip-chars-forward "^\n\r") + (setq ov-prefix + (concat + (buffer-substring (1- (point)) (point)) + (if (> (current-column) org-tags-column) + " " + (make-string (- org-tags-column (current-column)) ?\ )))))) + (move-overlay org-tags-overlay ov-start ov-end) + (save-excursion + (save-window-excursion + (if expert + (set-buffer (get-buffer-create " *Org tags*")) + (delete-other-windows) + (set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*")) + (org-switch-to-buffer-other-window " *Org tags*")) + (erase-buffer) + (setq-local org-done-keywords done-keywords) + (org-fast-tag-insert "Inherited" inherited i-face "\n") + (org-fast-tag-insert "Current" current c-face "\n\n") + (org-fast-tag-show-exit exit-after-next) + (org-set-current-tags-overlay current ov-prefix) + (setq tbl fulltable char ?a cnt 0) + (while (setq e (pop tbl)) + (cond + ((eq (car e) :startgroup) + (push '() groups) (setq ingroup t) + (unless (zerop cnt) + (setq cnt 0) + (insert "\n")) + (insert (if (cdr e) (format "%s: " (cdr e)) "") "{ ")) + ((eq (car e) :endgroup) + (setq ingroup nil cnt 0) + (insert "}" (if (cdr e) (format " (%s) " (cdr e)) "") "\n")) + ((eq (car e) :startgrouptag) + (setq intaggroup t) + (unless (zerop cnt) + (setq cnt 0) + (insert "\n")) + (insert "[ ")) + ((eq (car e) :endgrouptag) + (setq intaggroup nil cnt 0) + (insert "]\n")) + ((equal e '(:newline)) + (unless (zerop cnt) + (setq cnt 0) + (insert "\n") + (setq e (car tbl)) + (while (equal (car tbl) '(:newline)) + (insert "\n") + (setq tbl (cdr tbl))))) + ((equal e '(:grouptags)) (insert " : ")) + (t + (setq tg (copy-sequence (car e)) c2 nil) + (if (cdr e) + (setq c (cdr e)) + ;; automatically assign a character. + (setq c1 (string-to-char + (downcase (substring + tg (if (= (string-to-char tg) ?@) 1 0))))) + (if (or (rassoc c1 ntable) (rassoc c1 table)) + (while (or (rassoc char ntable) (rassoc char table)) + (setq char (1+ char))) + (setq c2 c1)) + (setq c (or c2 char))) + (when ingroup (push tg (car groups))) + (setq tg (org-add-props tg nil 'face + (cond + ((not (assoc tg table)) + (org-get-todo-face tg)) + ((member tg current) c-face) + ((member tg inherited) i-face)))) + (when (equal (caar tbl) :grouptags) + (org-add-props tg nil 'face 'org-tag-group)) + (when (and (zerop cnt) (not ingroup) (not intaggroup)) (insert " ")) + (insert "[" c "] " tg (make-string + (- fwidth 4 (length tg)) ?\ )) + (push (cons tg c) ntable) + (when (= (cl-incf cnt) ncol) + (unless (memq (caar tbl) '(:endgroup :endgrouptag)) + (insert "\n") + (when (or ingroup intaggroup) (insert " "))) + (setq cnt 0))))) + (setq ntable (nreverse ntable)) + (insert "\n") + (goto-char (point-min)) + (unless expert (org-fit-window-to-buffer)) + (setq rtn + (catch 'exit + (while t + (message "[a-z..]:toggle [SPC]:clear [RET]:accept [TAB]:edit [!] %sgroups%s" + (if (not groups) "no " "") + (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi"))) + (setq c (let ((inhibit-quit t)) (read-char-exclusive))) + (setq org-last-tag-selection-key c) + (cond + ((= c ?\r) (throw 'exit t)) + ((= c ?!) + (setq groups (not groups)) + (goto-char (point-min)) + (while (re-search-forward "[{}]" nil t) (replace-match " "))) + ((= c ?\C-c) + (if (not expert) + (org-fast-tag-show-exit + (setq exit-after-next (not exit-after-next))) + (setq expert nil) + (delete-other-windows) + (set-window-buffer (split-window-vertically) " *Org tags*") + (org-switch-to-buffer-other-window " *Org tags*") + (org-fit-window-to-buffer))) + ((or (= c ?\C-g) + (and (= c ?q) (not (rassoc c ntable)))) + (delete-overlay org-tags-overlay) + (setq quit-flag t)) + ((= c ?\ ) + (setq current nil) + (when exit-after-next (setq exit-after-next 'now))) + ((= c ?\t) + (condition-case nil + (unless tab-tags + (setq tab-tags + (delq nil + (mapcar (lambda (x) + (let ((item (car-safe x))) + (and (stringp item) + (list item)))) + (org--tag-add-to-alist + (with-current-buffer buf + (org-get-buffer-tags)) + table)))))) + (setq tg (completing-read "Tag: " tab-tags)) + (when (string-match "\\S-" tg) + (cl-pushnew (list tg) tab-tags :test #'equal) + (if (member tg current) + (setq current (delete tg current)) + (push tg current))) + (when exit-after-next (setq exit-after-next 'now))) + ((setq e (rassoc c todo-table) tg (car e)) + (with-current-buffer buf + (save-excursion (org-todo tg))) + (when exit-after-next (setq exit-after-next 'now))) + ((setq e (rassoc c ntable) tg (car e)) + (if (member tg current) + (setq current (delete tg current)) + (cl-loop for g in groups do + (when (member tg g) + (dolist (x g) (setq current (delete x current))))) + (push tg current)) + (when exit-after-next (setq exit-after-next 'now)))) + + ;; Create a sorted list + (setq current + (sort current + (lambda (a b) + (assoc b (cdr (memq (assoc a ntable) ntable)))))) + (when (eq exit-after-next 'now) (throw 'exit t)) + (goto-char (point-min)) + (beginning-of-line 2) + (delete-region (point) (point-at-eol)) + (org-fast-tag-insert "Current" current c-face) + (org-set-current-tags-overlay current ov-prefix) + (let ((tag-re (concat "\\[.\\] \\(" org-tag-re "\\)"))) + (while (re-search-forward tag-re nil t) + (let ((tag (match-string 1))) + (add-text-properties + (match-beginning 1) (match-end 1) + (list 'face + (cond + ((member tag current) c-face) + ((member tag inherited) i-face) + (t (get-text-property (match-beginning 1) ' + face)))))))) + (goto-char (point-min))))) + (delete-overlay org-tags-overlay) + (if rtn + (mapconcat 'identity current ":") + nil))))) + +(defun org-make-tag-string (tags) + "Return string associated to TAGS. +TAGS is a list of strings." + (if (null tags) "" + (format ":%s:" (mapconcat #'identity tags ":")))) + +(defun org--get-local-tags () + "Return list of tags for the current headline. +Assume point is at the beginning of the headline." + (and (looking-at org-tag-line-re) + (split-string (match-string-no-properties 2) ":" t))) + +(defun org-get-tags (&optional pos local) + "Get the list of tags specified in the current headline. + +When argument POS is non-nil, retrieve tags for headline at POS. + +According to `org-use-tag-inheritance', tags may be inherited +from parent headlines, and from the whole document, through +`org-file-tags'. In this case, the returned list of tags +contains tags in this order: file tags, tags inherited from +parent headlines, local tags. If a tag appears multiple times, +only the most local tag is returned. + +However, when optional argument LOCAL is non-nil, only return +tags specified at the headline. + +Inherited tags have the `inherited' text property." + (if (and org-trust-scanner-tags + (or (not pos) (eq pos (point))) + (not local)) + org-scanner-tags + (org-with-point-at (or pos (point)) + (unless (org-before-first-heading-p) + (org-back-to-heading t) + (let ((ltags (org--get-local-tags)) itags) + (if (or local (not org-use-tag-inheritance)) ltags + (while (org-up-heading-safe) + (setq itags (nconc (mapcar #'org-add-prop-inherited + (org--get-local-tags)) + itags))) + (setq itags (append org-file-tags itags)) + (nreverse + (delete-dups + (nreverse (nconc (org-remove-uninherited-tags itags) ltags)))))))))) + +(defun org-get-buffer-tags () + "Get a table of all tags used in the buffer, for completion." + (org-with-point-at 1 + (let (tags) + (while (re-search-forward org-tag-line-re nil t) + (setq tags (nconc (split-string (match-string-no-properties 2) ":") + tags))) + (mapcar #'list (delete-dups (append org-file-tags tags)))))) + +;;;; The mapping API + +(defvar org-agenda-skip-comment-trees) +(defvar org-agenda-skip-function) +(defun org-map-entries (func &optional match scope &rest skip) + "Call FUNC at each headline selected by MATCH in SCOPE. + +FUNC is a function or a Lisp form. The function will be called without +arguments, with the cursor positioned at the beginning of the headline. +The return values of all calls to the function will be collected and +returned as a list. + +The call to FUNC will be wrapped into a `save-excursion' form, so FUNC +does not need to preserve point. After evaluation, the cursor will be +moved to the end of the line (presumably of the headline of the +processed entry) and search continues from there. Under some +circumstances, this may not produce the wanted results. For example, +if you have removed (e.g. archived) the current (sub)tree it could +mean that the next entry will be skipped entirely. In such cases, you +can specify the position from where search should continue by making +FUNC set the variable `org-map-continue-from' to the desired buffer +position. + +MATCH is a tags/property/todo match as it is used in the agenda tags view. +Only headlines that are matched by this query will be considered during +the iteration. When MATCH is nil or t, all headlines will be +visited by the iteration. + +SCOPE determines the scope of this command. It can be any of: + +nil The current buffer, respecting the restriction if any +tree The subtree started with the entry at point +region The entries within the active region, if any +region-start-level + The entries within the active region, but only those at + the same level than the first one. +file The current buffer, without restriction +file-with-archives + The current buffer, and any archives associated with it +agenda All agenda files +agenda-with-archives + All agenda files with any archive files associated with them +\(file1 file2 ...) + If this is a list, all files in the list will be scanned + +The remaining args are treated as settings for the skipping facilities of +the scanner. The following items can be given here: + + archive skip trees with the archive tag + comment skip trees with the COMMENT keyword + function or Emacs Lisp form: + will be used as value for `org-agenda-skip-function', so + whenever the function returns a position, FUNC will not be + called for that entry and search will continue from the + position returned + +If your function needs to retrieve the tags including inherited tags +at the *current* entry, you can use the value of the variable +`org-scanner-tags' which will be much faster than getting the value +with `org-get-tags'. If your function gets properties with +`org-entry-properties' at the *current* entry, bind `org-trust-scanner-tags' +to t around the call to `org-entry-properties' to get the same speedup. +Note that if your function moves around to retrieve tags and properties at +a *different* entry, you cannot use these techniques." + (unless (and (or (eq scope 'region) (eq scope 'region-start-level)) + (not (org-region-active-p))) + (let* ((org-agenda-archives-mode nil) ; just to make sure + (org-agenda-skip-archived-trees (memq 'archive skip)) + (org-agenda-skip-comment-trees (memq 'comment skip)) + (org-agenda-skip-function + (car (org-delete-all '(comment archive) skip))) + (org-tags-match-list-sublevels t) + (start-level (eq scope 'region-start-level)) + matcher res + org-todo-keywords-for-agenda + org-done-keywords-for-agenda + org-todo-keyword-alist-for-agenda + org-tag-alist-for-agenda + org--matcher-tags-todo-only) + + (cond + ((eq match t) (setq matcher t)) + ((eq match nil) (setq matcher t)) + (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t)))) + + (save-excursion + (save-restriction + (cond ((eq scope 'tree) + (org-back-to-heading t) + (org-narrow-to-subtree) + (setq scope nil)) + ((and (or (eq scope 'region) (eq scope 'region-start-level)) + (org-region-active-p)) + ;; If needed, set start-level to a string like "2" + (when start-level + (save-excursion + (goto-char (region-beginning)) + (unless (org-at-heading-p) (outline-next-heading)) + (setq start-level (org-current-level)))) + (narrow-to-region (region-beginning) + (save-excursion + (goto-char (region-end)) + (unless (and (bolp) (org-at-heading-p)) + (outline-next-heading)) + (point))) + (setq scope nil))) + + (if (not scope) + (progn + (org-agenda-prepare-buffers + (and buffer-file-name (list buffer-file-name))) + (setq res + (org-scan-tags + func matcher org--matcher-tags-todo-only start-level))) + ;; Get the right scope + (cond + ((and scope (listp scope) (symbolp (car scope))) + (setq scope (eval scope))) + ((eq scope 'agenda) + (setq scope (org-agenda-files t))) + ((eq scope 'agenda-with-archives) + (setq scope (org-agenda-files t)) + (setq scope (org-add-archive-files scope))) + ((eq scope 'file) + (setq scope (and buffer-file-name (list buffer-file-name)))) + ((eq scope 'file-with-archives) + (setq scope (org-add-archive-files (list (buffer-file-name)))))) + (org-agenda-prepare-buffers scope) + (dolist (file scope) + (with-current-buffer (org-find-base-buffer-visiting file) + (org-with-wide-buffer + (goto-char (point-min)) + (setq res + (append + res + (org-scan-tags + func matcher org--matcher-tags-todo-only))))))))) + res))) + +;;; Properties API + +(defconst org-special-properties + '("ALLTAGS" "BLOCKED" "CLOCKSUM" "CLOCKSUM_T" "CLOSED" "DEADLINE" "FILE" + "ITEM" "PRIORITY" "SCHEDULED" "TAGS" "TIMESTAMP" "TIMESTAMP_IA" "TODO") + "The special properties valid in Org mode. +These are properties that are not defined in the property drawer, +but in some other way.") + +(defconst org-default-properties + '("ARCHIVE" "CATEGORY" "SUMMARY" "DESCRIPTION" "CUSTOM_ID" + "LOCATION" "LOGGING" "COLUMNS" "VISIBILITY" + "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" + "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" + "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" + "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") + "Some properties that are used by Org mode for various purposes. +Being in this list makes sure that they are offered for completion.") + +(defun org--valid-property-p (property) + "Non-nil when string PROPERTY is a valid property name." + (not + (or (equal property "") + (string-match-p "\\s-" property)))) + +(defun org--update-property-plist (key val props) + "Associate KEY to VAL in alist PROPS. +Modifications are made by side-effect. Return new alist." + (let* ((appending (string= (substring key -1) "+")) + (key (if appending (substring key 0 -1) key)) + (old (assoc-string key props t))) + (if (not old) (cons (cons key val) props) + (setcdr old (if appending (concat (cdr old) " " val) val)) + props))) + +(defun org-get-property-block (&optional beg force) + "Return the (beg . end) range of the body of the property drawer. +BEG is the beginning of the current subtree or the beginning of +the document if before the first headline. If it is not given, +it will be found. If the drawer does not exist, create it if +FORCE is non-nil, or return nil." + (org-with-wide-buffer + (let ((beg (cond (beg (goto-char beg)) + ((or (not (featurep 'org-inlinetask)) + (org-inlinetask-in-task-p)) + (org-back-to-heading-or-point-min t) (point)) + (t (org-with-limited-levels + (org-back-to-heading-or-point-min t)) + (point))))) + ;; Move point to its position according to its positional rules. + (cond ((org-before-first-heading-p) + (while (and (org-at-comment-p) (bolp)) (forward-line))) + (t (forward-line) + (when (looking-at-p org-planning-line-re) (forward-line)))) + (cond ((looking-at org-property-drawer-re) + (forward-line) + (cons (point) (progn (goto-char (match-end 0)) + (line-beginning-position)))) + (force + (goto-char beg) + (org-insert-property-drawer) + (let ((pos (save-excursion (re-search-forward org-property-drawer-re) + (line-beginning-position)))) + (cons pos pos))))))) + +(defun org-at-property-drawer-p () + "Non-nil when point is at the first line of a property drawer." + (org-with-wide-buffer + (beginning-of-line) + (and (looking-at org-property-drawer-re) + (or (bobp) + (progn + (forward-line -1) + (cond ((org-at-heading-p)) + ((looking-at org-planning-line-re) + (forward-line -1) + (org-at-heading-p)) + ((looking-at org-comment-regexp) + (forward-line -1) + (while (and (not (bobp)) (looking-at org-comment-regexp)) + (forward-line -1)) + (looking-at org-comment-regexp)) + (t nil))))))) + +(defun org-at-property-p () + "Non-nil when point is inside a property drawer. +See `org-property-re' for match data, if applicable." + (save-excursion + (beginning-of-line) + (and (looking-at org-property-re) + (let ((property-drawer (save-match-data (org-get-property-block)))) + (and property-drawer + (>= (point) (car property-drawer)) + (< (point) (cdr property-drawer))))))) + +(defun org-property-action () + "Do an action on properties." + (interactive) + (message "Property Action: [s]et [d]elete [D]elete globally [c]ompute") + (let ((c (read-char-exclusive))) + (cl-case c + (?s (call-interactively #'org-set-property)) + (?d (call-interactively #'org-delete-property)) + (?D (call-interactively #'org-delete-property-globally)) + (?c (call-interactively #'org-compute-property-at-point)) + (otherwise (user-error "No such property action %c" c))))) + +(defun org-inc-effort () + "Increment the value of the effort property in the current entry." + (interactive) + (org-set-effort t)) + +(defvar org-clock-effort) ; Defined in org-clock.el. +(defvar org-clock-current-task) ; Defined in org-clock.el. +(defun org-set-effort (&optional increment value) + "Set the effort property of the current entry. +If INCREMENT is non-nil, set the property to the next allowed +value. Otherwise, if optional argument VALUE is provided, use +it. Eventually, prompt for the new value if none of the previous +variables is set." + (interactive "P") + (let* ((allowed (org-property-get-allowed-values nil org-effort-property t)) + (current (org-entry-get nil org-effort-property)) + (value + (cond + (increment + (unless allowed (user-error "Allowed effort values are not set")) + (or (cl-caadr (member (list current) allowed)) + (user-error "Unknown value %S among allowed values" current))) + (value + (if (stringp value) value + (error "Invalid effort value: %S" value))) + (t + (let ((must-match + (and allowed + (not (get-text-property 0 'org-unrestricted + (caar allowed)))))) + (completing-read "Effort: " allowed nil must-match)))))) + ;; Test whether the value can be interpreted as a duration before + ;; inserting it in the buffer: + (org-duration-to-minutes value) + ;; Maybe update the effort value: + (unless (equal current value) + (org-entry-put nil org-effort-property value)) + (org-refresh-property '((effort . identity) + (effort-minutes . org-duration-to-minutes)) + value) + (when (equal (org-get-heading t t t t) + (bound-and-true-p org-clock-current-task)) + (setq org-clock-effort value) + (org-clock-update-mode-line)) + (message "%s is now %s" org-effort-property value))) + +(defun org-entry-properties (&optional pom which) + "Get all properties of the current entry. + +When POM is a buffer position, get all properties from the entry +there instead. + +This includes the TODO keyword, the tags, time strings for +deadline, scheduled, and clocking, and any additional properties +defined in the entry. + +If WHICH is nil or `all', get all properties. If WHICH is +`special' or `standard', only get that subclass. If WHICH is +a string, only get that property. + +Return value is an alist. Keys are properties, as upcased +strings." + (org-with-point-at pom + (when (and (derived-mode-p 'org-mode) + (org-back-to-heading-or-point-min t)) + (catch 'exit + (let* ((beg (point)) + (specific (and (stringp which) (upcase which))) + (which (cond ((not specific) which) + ((member specific org-special-properties) 'special) + (t 'standard))) + props) + ;; Get the special properties, like TODO and TAGS. + (when (memq which '(nil all special)) + (when (or (not specific) (string= specific "CLOCKSUM")) + (let ((clocksum (get-text-property (point) :org-clock-minutes))) + (when clocksum + (push (cons "CLOCKSUM" (org-duration-from-minutes clocksum)) + props))) + (when specific (throw 'exit props))) + (when (or (not specific) (string= specific "CLOCKSUM_T")) + (let ((clocksumt (get-text-property (point) + :org-clock-minutes-today))) + (when clocksumt + (push (cons "CLOCKSUM_T" + (org-duration-from-minutes clocksumt)) + props))) + (when specific (throw 'exit props))) + (when (or (not specific) (string= specific "ITEM")) + (let ((case-fold-search nil)) + (when (looking-at org-complex-heading-regexp) + (push (cons "ITEM" + (let ((title (match-string-no-properties 4))) + (if (org-string-nw-p title) + (org-remove-tabs title) + ""))) + props))) + (when specific (throw 'exit props))) + (when (or (not specific) (string= specific "TODO")) + (let ((case-fold-search nil)) + (when (and (looking-at org-todo-line-regexp) (match-end 2)) + (push (cons "TODO" (match-string-no-properties 2)) props))) + (when specific (throw 'exit props))) + (when (or (not specific) (string= specific "PRIORITY")) + (push (cons "PRIORITY" + (if (looking-at org-priority-regexp) + (match-string-no-properties 2) + (char-to-string org-priority-default))) + props) + (when specific (throw 'exit props))) + (when (or (not specific) (string= specific "FILE")) + (push (cons "FILE" (buffer-file-name (buffer-base-buffer))) + props) + (when specific (throw 'exit props))) + (when (or (not specific) (string= specific "TAGS")) + (let ((tags (org-get-tags nil t))) + (when tags + (push (cons "TAGS" (org-make-tag-string tags)) + props))) + (when specific (throw 'exit props))) + (when (or (not specific) (string= specific "ALLTAGS")) + (let ((tags (org-get-tags))) + (when tags + (push (cons "ALLTAGS" (org-make-tag-string tags)) + props))) + (when specific (throw 'exit props))) + (when (or (not specific) (string= specific "BLOCKED")) + (push (cons "BLOCKED" (if (org-entry-blocked-p) "t" "")) props) + (when specific (throw 'exit props))) + (when (or (not specific) + (member specific '("CLOSED" "DEADLINE" "SCHEDULED"))) + (forward-line) + (when (looking-at-p org-planning-line-re) + (end-of-line) + (let ((bol (line-beginning-position)) + ;; Backward compatibility: time keywords used to + ;; be configurable (before 8.3). Make sure we + ;; get the correct keyword. + (key-assoc `(("CLOSED" . ,org-closed-string) + ("DEADLINE" . ,org-deadline-string) + ("SCHEDULED" . ,org-scheduled-string)))) + (dolist (pair (if specific (list (assoc specific key-assoc)) + key-assoc)) + (save-excursion + (when (search-backward (cdr pair) bol t) + (goto-char (match-end 0)) + (skip-chars-forward " \t") + (and (looking-at org-ts-regexp-both) + (push (cons (car pair) + (match-string-no-properties 0)) + props))))))) + (when specific (throw 'exit props))) + (when (or (not specific) + (member specific '("TIMESTAMP" "TIMESTAMP_IA"))) + (let ((find-ts + (lambda (end ts) + ;; Fix next time-stamp before END. TS is the + ;; list of time-stamps found so far. + (let ((ts ts) + (regexp (cond + ((string= specific "TIMESTAMP") + org-ts-regexp) + ((string= specific "TIMESTAMP_IA") + org-ts-regexp-inactive) + ((assoc "TIMESTAMP_IA" ts) + org-ts-regexp) + ((assoc "TIMESTAMP" ts) + org-ts-regexp-inactive) + (t org-ts-regexp-both)))) + (catch 'next + (while (re-search-forward regexp end t) + (backward-char) + (let ((object (org-element-context))) + ;; Accept to match timestamps in node + ;; properties, too. + (when (memq (org-element-type object) + '(node-property timestamp)) + (let ((type + (org-element-property :type object))) + (cond + ((and (memq type '(active active-range)) + (not (equal specific "TIMESTAMP_IA"))) + (unless (assoc "TIMESTAMP" ts) + (push (cons "TIMESTAMP" + (org-element-property + :raw-value object)) + ts) + (when specific (throw 'exit ts)))) + ((and (memq type '(inactive inactive-range)) + (not (string= specific "TIMESTAMP"))) + (unless (assoc "TIMESTAMP_IA" ts) + (push (cons "TIMESTAMP_IA" + (org-element-property + :raw-value object)) + ts) + (when specific (throw 'exit ts)))))) + ;; Both timestamp types are found, + ;; move to next part. + (when (= (length ts) 2) (throw 'next ts))))) + ts))))) + (goto-char beg) + ;; First look for timestamps within headline. + (let ((ts (funcall find-ts (line-end-position) nil))) + (if (= (length ts) 2) (setq props (nconc ts props)) + ;; Then find timestamps in the section, skipping + ;; planning line. + (let ((end (save-excursion (outline-next-heading)))) + (forward-line) + (when (looking-at-p org-planning-line-re) (forward-line)) + (setq props (nconc (funcall find-ts end ts) props)))))))) + ;; Get the standard properties, like :PROP:. + (when (memq which '(nil all standard)) + ;; If we are looking after a specific property, delegate + ;; to `org-entry-get', which is faster. However, make an + ;; exception for "CATEGORY", since it can be also set + ;; through keywords (i.e. #+CATEGORY). + (if (and specific (not (equal specific "CATEGORY"))) + (let ((value (org-entry-get beg specific nil t))) + (throw 'exit (and value (list (cons specific value))))) + (let ((range (org-get-property-block beg))) + (when range + (let ((end (cdr range)) seen-base) + (goto-char (car range)) + ;; Unlike to `org--update-property-plist', we + ;; handle the case where base values is found + ;; after its extension. We also forbid standard + ;; properties to be named as special properties. + (while (re-search-forward org-property-re end t) + (let* ((key (upcase (match-string-no-properties 2))) + (extendp (string-match-p "\\+\\'" key)) + (key-base (if extendp (substring key 0 -1) key)) + (value (match-string-no-properties 3))) + (cond + ((member-ignore-case key-base org-special-properties)) + (extendp + (setq props + (org--update-property-plist key value props))) + ((member key seen-base)) + (t (push key seen-base) + (let ((p (assoc-string key props t))) + (if p (setcdr p (concat value " " (cdr p))) + (push (cons key value) props)))))))))))) + (unless (assoc "CATEGORY" props) + (push (cons "CATEGORY" (org-get-category beg)) props) + (when (string= specific "CATEGORY") (throw 'exit props))) + ;; Return value. + props))))) + +(defun org--property-local-values (property literal-nil) + "Return value for PROPERTY in current entry. +Value is a list whose car is the base value for PROPERTY and cdr +a list of accumulated values. Return nil if neither is found in +the entry. Also return nil when PROPERTY is set to \"nil\", +unless LITERAL-NIL is non-nil." + (let ((range (org-get-property-block))) + (when range + (goto-char (car range)) + (let* ((case-fold-search t) + (end (cdr range)) + (value + ;; Base value. + (save-excursion + (let ((v (and (re-search-forward + (org-re-property property nil t) end t) + (match-string-no-properties 3)))) + (list (if literal-nil v (org-not-nil v))))))) + ;; Find additional values. + (let* ((property+ (org-re-property (concat property "+") nil t))) + (while (re-search-forward property+ end t) + (push (match-string-no-properties 3) value))) + ;; Return final values. + (and (not (equal value '(nil))) (nreverse value)))))) + +(defun org--property-global-or-keyword-value (property literal-nil) + "Return value for PROPERTY as defined by global properties or by keyword. +Return value is a string. Return nil if property is not set +globally or by keyword. Also return nil when PROPERTY is set to +\"nil\", unless LITERAL-NIL is non-nil." + (let ((global + (cdr (or (assoc-string property org-keyword-properties t) + (assoc-string property org-global-properties t) + (assoc-string property org-global-properties-fixed t))))) + (if literal-nil global (org-not-nil global)))) + +(defun org-entry-get (pom property &optional inherit literal-nil) + "Get value of PROPERTY for entry or content at point-or-marker POM. + +If INHERIT is non-nil and the entry does not have the property, +then also check higher levels of the hierarchy. If INHERIT is +the symbol `selective', use inheritance only if the setting in +`org-use-property-inheritance' selects PROPERTY for inheritance. + +If the property is present but empty, the return value is the +empty string. If the property is not present at all, nil is +returned. In any other case, return the value as a string. +Search is case-insensitive. + +If LITERAL-NIL is set, return the string value \"nil\" as +a string, do not interpret it as the list atom nil. This is used +for inheritance when a \"nil\" value can supersede a non-nil +value higher up the hierarchy." + (org-with-point-at pom + (cond + ((member-ignore-case property (cons "CATEGORY" org-special-properties)) + ;; We need a special property. Use `org-entry-properties' to + ;; retrieve it, but specify the wanted property. + (cdr (assoc-string property (org-entry-properties nil property)))) + ((and inherit + (or (not (eq inherit 'selective)) (org-property-inherit-p property))) + (org-entry-get-with-inheritance property literal-nil)) + (t + (let* ((local (org--property-local-values property literal-nil)) + (value (and local (mapconcat #'identity (delq nil local) " ")))) + (if literal-nil value (org-not-nil value))))))) + +(defun org-property-or-variable-value (var &optional inherit) + "Check if there is a property fixing the value of VAR. +If yes, return this value. If not, return the current value of the variable." + (let ((prop (org-entry-get nil (symbol-name var) inherit))) + (if (and prop (stringp prop) (string-match "\\S-" prop)) + (read prop) + (symbol-value var)))) + +(defun org-entry-delete (pom property) + "Delete PROPERTY from entry at point-or-marker POM. +Accumulated properties, i.e. PROPERTY+, are also removed. Return +non-nil when a property was removed." + (org-with-point-at pom + (pcase (org-get-property-block) + (`(,begin . ,origin) + (let* ((end (copy-marker origin)) + (re (org-re-property + (concat (regexp-quote property) "\\+?") t t))) + (goto-char begin) + (while (re-search-forward re end t) + (delete-region (match-beginning 0) (line-beginning-position 2))) + ;; If drawer is empty, remove it altogether. + (when (= begin end) + (delete-region (line-beginning-position 0) + (line-beginning-position 2))) + ;; Return non-nil if some property was removed. + (prog1 (/= end origin) (set-marker end nil)))) + (_ nil)))) + +;; Multi-values properties are properties that contain multiple values +;; These values are assumed to be single words, separated by whitespace. +(defun org-entry-add-to-multivalued-property (pom property value) + "Add VALUE to the words in the PROPERTY in entry at point-or-marker POM." + (let* ((old (org-entry-get pom property)) + (values (and old (split-string old)))) + (setq value (org-entry-protect-space value)) + (unless (member value values) + (setq values (append values (list value))) + (org-entry-put pom property (mapconcat #'identity values " "))))) + +(defun org-entry-remove-from-multivalued-property (pom property value) + "Remove VALUE from words in the PROPERTY in entry at point-or-marker POM." + (let* ((old (org-entry-get pom property)) + (values (and old (split-string old)))) + (setq value (org-entry-protect-space value)) + (when (member value values) + (setq values (delete value values)) + (org-entry-put pom property (mapconcat #'identity values " "))))) + +(defun org-entry-member-in-multivalued-property (pom property value) + "Is VALUE one of the words in the PROPERTY in entry at point-or-marker POM?" + (let* ((old (org-entry-get pom property)) + (values (and old (split-string old)))) + (setq value (org-entry-protect-space value)) + (member value values))) + +(defun org-entry-get-multivalued-property (pom property) + "Return a list of values in a multivalued property." + (let* ((value (org-entry-get pom property)) + (values (and value (split-string value)))) + (mapcar #'org-entry-restore-space values))) + +(defun org-entry-put-multivalued-property (pom property &rest values) + "Set multivalued PROPERTY at point-or-marker POM to VALUES. +VALUES should be a list of strings. Spaces will be protected." + (org-entry-put pom property (mapconcat #'org-entry-protect-space values " ")) + (let* ((value (org-entry-get pom property)) + (values (and value (split-string value)))) + (mapcar #'org-entry-restore-space values))) + +(defun org-entry-protect-space (s) + "Protect spaces and newline in string S." + (while (string-match " " s) + (setq s (replace-match "%20" t t s))) + (while (string-match "\n" s) + (setq s (replace-match "%0A" t t s))) + s) + +(defun org-entry-restore-space (s) + "Restore spaces and newline in string S." + (while (string-match "%20" s) + (setq s (replace-match " " t t s))) + (while (string-match "%0A" s) + (setq s (replace-match "\n" t t s))) + s) + +(defvar org-entry-property-inherited-from (make-marker) + "Marker pointing to the entry from where a property was inherited. +Each call to `org-entry-get-with-inheritance' will set this marker to the +location of the entry where the inheritance search matched. If there was +no match, the marker will point nowhere. +Note that also `org-entry-get' calls this function, if the INHERIT flag +is set.") + +(defun org-entry-get-with-inheritance (property &optional literal-nil) + "Get PROPERTY of entry or content at point, search higher levels if needed. +The search will stop at the first ancestor which has the property defined. +If the value found is \"nil\", return nil to show that the property +should be considered as undefined (this is the meaning of nil here). +However, if LITERAL-NIL is set, return the string value \"nil\" instead." + (move-marker org-entry-property-inherited-from nil) + (org-with-wide-buffer + (let (value) + (catch 'exit + (while t + (let ((v (org--property-local-values property literal-nil))) + (when v + (setq value + (concat (mapconcat #'identity (delq nil v) " ") + (and value " ") + value))) + (cond + ((car v) + (org-back-to-heading-or-point-min t) + (move-marker org-entry-property-inherited-from (point)) + (throw 'exit nil)) + ((org-up-heading-or-point-min)) + (t + (let ((global (org--property-global-or-keyword-value property literal-nil))) + (cond ((not global)) + (value (setq value (concat global " " value))) + (t (setq value global)))) + (throw 'exit nil)))))) + (if literal-nil value (org-not-nil value))))) + +(defvar org-property-changed-functions nil + "Hook called when the value of a property has changed. +Each hook function should accept two arguments, the name of the property +and the new value.") + +(defun org-entry-put (pom property value) + "Set PROPERTY to VALUE for entry at point-or-marker POM. + +If the value is nil, it is converted to the empty string. If it +is not a string, an error is raised. Also raise an error on +invalid property names. + +PROPERTY can be any regular property (see +`org-special-properties'). It can also be \"TODO\", +\"PRIORITY\", \"SCHEDULED\" and \"DEADLINE\". + +For the last two properties, VALUE may have any of the special +values \"earlier\" and \"later\". The function then increases or +decreases scheduled or deadline date by one day." + (cond ((null value) (setq value "")) + ((not (stringp value)) (error "Properties values should be strings")) + ((not (org--valid-property-p property)) + (user-error "Invalid property name: \"%s\"" property))) + (org-no-read-only + (org-with-point-at pom + (if (or (not (featurep 'org-inlinetask)) (org-inlinetask-in-task-p)) + (org-back-to-heading-or-point-min t) + (org-with-limited-levels (org-back-to-heading-or-point-min t))) + (let ((beg (point))) + (cond + ((equal property "TODO") + (cond ((not (org-string-nw-p value)) (setq value 'none)) + ((not (member value org-todo-keywords-1)) + (user-error "\"%s\" is not a valid TODO state" value))) + (org-todo value) + (org-align-tags)) + ((equal property "PRIORITY") + (org-priority (if (org-string-nw-p value) (string-to-char value) ?\s)) + (org-align-tags)) + ((equal property "SCHEDULED") + (forward-line) + (if (and (looking-at-p org-planning-line-re) + (re-search-forward + org-scheduled-time-regexp (line-end-position) t)) + (cond ((string= value "earlier") (org-timestamp-change -1 'day)) + ((string= value "later") (org-timestamp-change 1 'day)) + ((string= value "") (org-schedule '(4))) + (t (org-schedule nil value))) + (if (member value '("earlier" "later" "")) + (call-interactively #'org-schedule) + (org-schedule nil value)))) + ((equal property "DEADLINE") + (forward-line) + (if (and (looking-at-p org-planning-line-re) + (re-search-forward + org-deadline-time-regexp (line-end-position) t)) + (cond ((string= value "earlier") (org-timestamp-change -1 'day)) + ((string= value "later") (org-timestamp-change 1 'day)) + ((string= value "") (org-deadline '(4))) + (t (org-deadline nil value))) + (if (member value '("earlier" "later" "")) + (call-interactively #'org-deadline) + (org-deadline nil value)))) + ((member property org-special-properties) + (error "The %s property cannot be set with `org-entry-put'" property)) + (t + (let* ((range (org-get-property-block beg 'force)) + (end (cdr range)) + (case-fold-search t)) + (goto-char (car range)) + (if (re-search-forward (org-re-property property nil t) end t) + (progn (delete-region (match-beginning 0) (match-end 0)) + (goto-char (match-beginning 0))) + (goto-char end) + (insert "\n") + (backward-char)) + (insert ":" property ":") + (when value (insert " " value)) + (org-indent-line))))) + (run-hook-with-args 'org-property-changed-functions property value)))) + +(defun org-buffer-property-keys (&optional specials defaults columns) + "Get all property keys in the current buffer. + +When SPECIALS is non-nil, also list the special properties that +reflect things like tags and TODO state. + +When DEFAULTS is non-nil, also include properties that has +special meaning internally: ARCHIVE, CATEGORY, SUMMARY, +DESCRIPTION, LOCATION, and LOGGING and others. + +When COLUMNS in non-nil, also include property names given in +COLUMN formats in the current buffer." + (let ((case-fold-search t) + (props (append + (and specials org-special-properties) + (and defaults (cons org-effort-property org-default-properties)) + ;; Get property names from #+PROPERTY keywords as well + (mapcar (lambda (s) + (nth 0 (split-string s))) + (cdar (org-collect-keywords '("PROPERTY"))))))) + (org-with-wide-buffer + (goto-char (point-min)) + (while (re-search-forward org-property-start-re nil t) + (catch :skip + (let ((range (org-get-property-block))) + (unless range (throw :skip nil)) + (goto-char (car range)) + (let ((begin (car range)) + (end (cdr range))) + ;; Make sure that found property block is not located + ;; before current point, as it would generate an infloop. + ;; It can happen, for example, in the following + ;; situation: + ;; + ;; * Headline + ;; :PROPERTIES: + ;; ... + ;; :END: + ;; *************** Inlinetask + ;; #+BEGIN_EXAMPLE + ;; :PROPERTIES: + ;; #+END_EXAMPLE + ;; + (if (< begin (point)) (throw :skip nil) (goto-char begin)) + (while (< (point) end) + (let ((p (progn (looking-at org-property-re) + (match-string-no-properties 2)))) + ;; Only add true property name, not extension symbol. + (push (if (not (string-match-p "\\+\\'" p)) p + (substring p 0 -1)) + props)) + (forward-line)))) + (outline-next-heading))) + (when columns + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*\\(?:#\\+\\|:\\)COLUMNS:" nil t) + (let ((element (org-element-at-point))) + (when (memq (org-element-type element) '(keyword node-property)) + (let ((value (org-element-property :value element)) + (start 0)) + (while (string-match "%[0-9]*\\([[:alnum:]_-]+\\)\\(([^)]+)\\)?\ +\\(?:{[^}]+}\\)?" + value start) + (setq start (match-end 0)) + (let ((p (match-string-no-properties 1 value))) + (unless (member-ignore-case p org-special-properties) + (push p props)))))))))) + (sort (delete-dups + (append props + ;; for each xxx_ALL property, make sure the bare + ;; xxx property is also included + (delq nil (mapcar (lambda (p) + (and (string-match-p "._ALL\\'" p) + (substring p 0 -4))) + props)))) + (lambda (a b) (string< (upcase a) (upcase b)))))) + +(defun org-property-values (key) + "List all non-nil values of property KEY in current buffer." + (org-with-wide-buffer + (goto-char (point-min)) + (let ((case-fold-search t) + (re (org-re-property key)) + values) + (while (re-search-forward re nil t) + (push (org-entry-get (point) key) values)) + (delete-dups values)))) + +(defun org-insert-property-drawer () + "Insert a property drawer into the current entry. +Do nothing if the drawer already exists. The newly created +drawer is immediately hidden." + (org-with-wide-buffer + ;; Set point to the position where the drawer should be inserted. + (if (or (not (featurep 'org-inlinetask)) (org-inlinetask-in-task-p)) + (org-back-to-heading-or-point-min t) + (org-with-limited-levels (org-back-to-heading-or-point-min t))) + (if (org-before-first-heading-p) + (while (and (org-at-comment-p) (bolp)) (forward-line)) + (progn + (forward-line) + (when (looking-at-p org-planning-line-re) (forward-line)))) + (unless (looking-at-p org-property-drawer-re) + ;; Make sure we start editing a line from current entry, not from + ;; next one. It prevents extending text properties or overlays + ;; belonging to the latter. + (when (and (bolp) (> (point) (point-min))) (backward-char)) + (let ((begin (if (bobp) (point) (1+ (point)))) + (inhibit-read-only t)) + (unless (bobp) (insert "\n")) + (insert ":PROPERTIES:\n:END:") + (org-flag-region (line-end-position 0) (point) t 'outline) + (when (or (eobp) (= begin (point-min))) (insert "\n")) + (org-indent-region begin (point)))))) + +(defun org-insert-drawer (&optional arg drawer) + "Insert a drawer at point. + +When optional argument ARG is non-nil, insert a property drawer. + +Optional argument DRAWER, when non-nil, is a string representing +drawer's name. Otherwise, the user is prompted for a name. + +If a region is active, insert the drawer around that region +instead. + +Point is left between drawer's boundaries." + (interactive "P") + (let* ((drawer (if arg "PROPERTIES" + (or drawer (read-from-minibuffer "Drawer: "))))) + (cond + ;; With C-u, fall back on `org-insert-property-drawer' + (arg (org-insert-property-drawer)) + ;; Check validity of suggested drawer's name. + ((not (string-match-p org-drawer-regexp (format ":%s:" drawer))) + (user-error "Invalid drawer name")) + ;; With an active region, insert a drawer at point. + ((not (org-region-active-p)) + (progn + (unless (bolp) (insert "\n")) + (insert (format ":%s:\n\n:END:\n" drawer)) + (forward-line -2))) + ;; Otherwise, insert the drawer at point + (t + (let ((rbeg (region-beginning)) + (rend (copy-marker (region-end)))) + (unwind-protect + (progn + (goto-char rbeg) + (beginning-of-line) + (when (save-excursion + (re-search-forward org-outline-regexp-bol rend t)) + (user-error "Drawers cannot contain headlines")) + ;; Position point at the beginning of the first + ;; non-blank line in region. Insert drawer's opening + ;; there, then indent it. + (org-skip-whitespace) + (beginning-of-line) + (insert ":" drawer ":\n") + (forward-line -1) + (indent-for-tab-command) + ;; Move point to the beginning of the first blank line + ;; after the last non-blank line in region. Insert + ;; drawer's closing, then indent it. + (goto-char rend) + (skip-chars-backward " \r\t\n") + (insert "\n:END:") + (deactivate-mark t) + (indent-for-tab-command) + (unless (eolp) (insert "\n"))) + ;; Clear marker, whatever the outcome of insertion is. + (set-marker rend nil))))))) + +(defvar org-property-set-functions-alist nil + "Property set function alist. +Each entry should have the following format: + + (PROPERTY . READ-FUNCTION) + +The read function will be called with the same argument as +`org-completing-read'.") + +(defun org-set-property-function (property) + "Get the function that should be used to set PROPERTY. +This is computed according to `org-property-set-functions-alist'." + (or (cdr (assoc property org-property-set-functions-alist)) + 'org-completing-read)) + +(defun org-read-property-value (property &optional pom default) + "Read value for PROPERTY, as a string. +When optional argument POM is non-nil, completion uses additional +information, i.e., allowed or existing values at point or marker +POM. +Optional argument DEFAULT provides a default value for PROPERTY." + (let* ((completion-ignore-case t) + (allowed + (or (org-property-get-allowed-values nil property 'table) + (and pom (org-property-get-allowed-values pom property 'table)))) + (current (org-entry-get nil property)) + (prompt (format "%s value%s: " + property + (if (org-string-nw-p current) + (format " [%s]" current) + ""))) + (set-function (org-set-property-function property))) + (org-trim + (if allowed + (funcall set-function + prompt allowed nil + (not (get-text-property 0 'org-unrestricted (caar allowed))) + default nil default) + (let ((all (mapcar #'list + (append (org-property-values property) + (and pom + (org-with-point-at pom + (org-property-values property))))))) + (funcall set-function prompt all nil nil "" nil current)))))) + +(defvar org-last-set-property nil) +(defvar org-last-set-property-value nil) +(defun org-read-property-name () + "Read a property name." + (let ((completion-ignore-case t) + (default-prop (or (and (org-at-property-p) + (match-string-no-properties 2)) + org-last-set-property))) + (org-completing-read + (concat "Property" + (if default-prop (concat " [" default-prop "]") "") + ": ") + (mapcar #'list (org-buffer-property-keys nil t t)) + nil nil nil nil default-prop))) + +(defun org-set-property-and-value (use-last) + "Allow to set [PROPERTY]: [value] direction from prompt. +When use-default, don't even ask, just use the last +\"[PROPERTY]: [value]\" string from the history." + (interactive "P") + (let* ((completion-ignore-case t) + (pv (or (and use-last org-last-set-property-value) + (org-completing-read + "Enter a \"[Property]: [value]\" pair: " + nil nil nil nil nil + org-last-set-property-value))) + prop val) + (when (string-match "^[ \t]*\\([^:]+\\):[ \t]*\\(.*\\)[ \t]*$" pv) + (setq prop (match-string 1 pv) + val (match-string 2 pv)) + (org-set-property prop val)))) + +(defun org-set-property (property value) + "In the current entry, set PROPERTY to VALUE. + +When called interactively, this will prompt for a property name, offering +completion on existing and default properties. And then it will prompt +for a value, offering completion either on allowed values (via an inherited +xxx_ALL property) or on existing values in other instances of this property +in the current file. + +Throw an error when trying to set a property with an invalid name." + (interactive (list nil nil)) + (let ((property (or property (org-read-property-name)))) + ;; `org-entry-put' also makes the following check, but this one + ;; avoids polluting `org-last-set-property' and + ;; `org-last-set-property-value' needlessly. + (unless (org--valid-property-p property) + (user-error "Invalid property name: \"%s\"" property)) + (let ((value (or value (org-read-property-value property))) + (fn (cdr (assoc-string property org-properties-postprocess-alist t)))) + (setq org-last-set-property property) + (setq org-last-set-property-value (concat property ": " value)) + ;; Possibly postprocess the inserted value: + (when fn (setq value (funcall fn value))) + (unless (equal (org-entry-get nil property) value) + (org-entry-put nil property value))))) + +(defun org-find-property (property &optional value) + "Find first entry in buffer that sets PROPERTY. + +When optional argument VALUE is non-nil, only consider an entry +if it contains PROPERTY set to this value. If PROPERTY should be +explicitly set to nil, use string \"nil\" for VALUE. + +Return position where the entry begins, or nil if there is no +such entry. If narrowing is in effect, only search the visible +part of the buffer." + (save-excursion + (goto-char (point-min)) + (let ((case-fold-search t) + (re (org-re-property property nil (not value) value))) + (catch 'exit + (while (re-search-forward re nil t) + (when (if value (org-at-property-p) + (org-entry-get (point) property nil t)) + (throw 'exit (progn (org-back-to-heading-or-point-min t) + (point))))))))) + +(defun org-delete-property (property) + "In the current entry, delete PROPERTY." + (interactive + (let* ((completion-ignore-case t) + (cat (org-entry-get (point) "CATEGORY")) + (props0 (org-entry-properties nil 'standard)) + (props (if cat props0 + (delete `("CATEGORY" . ,(org-get-category)) props0))) + (prop (if (< 1 (length props)) + (completing-read "Property: " props nil t) + (caar props)))) + (list prop))) + (if (not property) + (message "No property to delete in this entry") + (org-entry-delete nil property) + (message "Property \"%s\" deleted" property))) + +(defun org-delete-property-globally (property) + "Remove PROPERTY globally, from all entries. +This function ignores narrowing, if any." + (interactive + (let* ((completion-ignore-case t) + (prop (completing-read + "Globally remove property: " + (mapcar #'list (org-buffer-property-keys))))) + (list prop))) + (org-with-wide-buffer + (goto-char (point-min)) + (let ((count 0) + (re (org-re-property (concat (regexp-quote property) "\\+?") t t))) + (while (re-search-forward re nil t) + (when (org-entry-delete (point) property) (cl-incf count))) + (message "Property \"%s\" removed from %d entries" property count)))) + +(defvar org-columns-current-fmt-compiled) ; defined in org-colview.el + +(defun org-compute-property-at-point () + "Compute the property at point. +This looks for an enclosing column format, extracts the operator and +then applies it to the property in the column format's scope." + (interactive) + (unless (org-at-property-p) + (user-error "Not at a property")) + (let ((prop (match-string-no-properties 2))) + (org-columns-get-format-and-top-level) + (unless (nth 3 (assoc-string prop org-columns-current-fmt-compiled t)) + (user-error "No operator defined for property %s" prop)) + (org-columns-compute prop))) + +(defvar org-property-allowed-value-functions nil + "Hook for functions supplying allowed values for a specific property. +The functions must take a single argument, the name of the property, and +return a flat list of allowed values. If \":ETC\" is one of +the values, this means that these values are intended as defaults for +completion, but that other values should be allowed too. +The functions must return nil if they are not responsible for this +property.") + +(defun org-property-get-allowed-values (pom property &optional table) + "Get allowed values for the property PROPERTY. +When TABLE is non-nil, return an alist that can directly be used for +completion." + (let (vals) + (cond + ((equal property "TODO") + (setq vals (org-with-point-at pom + (append org-todo-keywords-1 '(""))))) + ((equal property "PRIORITY") + (let ((n org-priority-lowest)) + (while (>= n org-priority-highest) + (push (char-to-string n) vals) + (setq n (1- n))))) + ((equal property "CATEGORY")) + ((member property org-special-properties)) + ((setq vals (run-hook-with-args-until-success + 'org-property-allowed-value-functions property))) + (t + (setq vals (org-entry-get pom (concat property "_ALL") 'inherit)) + (when (and vals (string-match "\\S-" vals)) + (setq vals (car (read-from-string (concat "(" vals ")")))) + (setq vals (mapcar (lambda (x) + (cond ((stringp x) x) + ((numberp x) (number-to-string x)) + ((symbolp x) (symbol-name x)) + (t "???"))) + vals))))) + (when (member ":ETC" vals) + (setq vals (remove ":ETC" vals)) + (org-add-props (car vals) '(org-unrestricted t))) + (if table (mapcar 'list vals) vals))) + +(defun org-property-previous-allowed-value (&optional _previous) + "Switch to the next allowed value for this property." + (interactive) + (org-property-next-allowed-value t)) + +(defun org-property-next-allowed-value (&optional previous) + "Switch to the next allowed value for this property." + (interactive) + (unless (org-at-property-p) + (user-error "Not at a property")) + (let* ((prop (car (save-match-data (org-split-string (match-string 1) ":")))) + (key (match-string 2)) + (value (match-string 3)) + (allowed (or (org-property-get-allowed-values (point) key) + (and (member value '("[ ]" "[-]" "[X]")) + '("[ ]" "[X]")))) + (heading (save-match-data (nth 4 (org-heading-components)))) + nval) + (unless allowed + (user-error "Allowed values for this property have not been defined")) + (when previous (setq allowed (reverse allowed))) + (when (member value allowed) + (setq nval (car (cdr (member value allowed))))) + (setq nval (or nval (car allowed))) + (when (equal nval value) + (user-error "Only one allowed value for this property")) + (org-at-property-p) + (replace-match (concat " :" key ": " nval) t t) + (org-indent-line) + (beginning-of-line 1) + (skip-chars-forward " \t") + (when (equal prop org-effort-property) + (org-refresh-property + '((effort . identity) + (effort-minutes . org-duration-to-minutes)) + nval) + (when (string= org-clock-current-task heading) + (setq org-clock-effort nval) + (org-clock-update-mode-line))) + (run-hook-with-args 'org-property-changed-functions key nval))) + +(defun org-find-olp (path &optional this-buffer) + "Return a marker pointing to the entry at outline path OLP. +If anything goes wrong, throw an error, and if you need to do +something based on this error, you can catch it with +`condition-case'. + +If THIS-BUFFER is set, the outline path does not contain a file, +only headings." + (let* ((file (if this-buffer buffer-file-name (pop path))) + (buffer (if this-buffer (current-buffer) (find-file-noselect file))) + (level 1) + (lmin 1) + (lmax 1) + end found flevel) + (unless buffer (error "File not found :%s" file)) + (with-current-buffer buffer + (unless (derived-mode-p 'org-mode) + (error "Buffer %s needs to be in Org mode" buffer)) + (org-with-wide-buffer + (goto-char (point-min)) + (dolist (heading path) + (let ((re (format org-complex-heading-regexp-format + (regexp-quote heading))) + (cnt 0)) + (while (re-search-forward re end t) + (setq level (- (match-end 1) (match-beginning 1))) + (when (and (>= level lmin) (<= level lmax)) + (setq found (match-beginning 0) flevel level cnt (1+ cnt)))) + (when (= cnt 0) + (error "Heading not found on level %d: %s" lmax heading)) + (when (> cnt 1) + (error "Heading not unique on level %d: %s" lmax heading)) + (goto-char found) + (setq lmin (1+ flevel) lmax (+ lmin (if org-odd-levels-only 1 0))) + (setq end (save-excursion (org-end-of-subtree t t))))) + (when (org-at-heading-p) + (point-marker)))))) + +(defun org-find-exact-headline-in-buffer (heading &optional buffer pos-only) + "Find node HEADING in BUFFER. +Return a marker to the heading if it was found, or nil if not. +If POS-ONLY is set, return just the position instead of a marker. + +The heading text must match exact, but it may have a TODO keyword, +a priority cookie and tags in the standard locations." + (with-current-buffer (or buffer (current-buffer)) + (org-with-wide-buffer + (goto-char (point-min)) + (let (case-fold-search) + (when (re-search-forward + (format org-complex-heading-regexp-format + (regexp-quote heading)) nil t) + (if pos-only + (match-beginning 0) + (move-marker (make-marker) (match-beginning 0)))))))) + +(defun org-find-exact-heading-in-directory (heading &optional dir) + "Find Org node headline HEADING in all \".org\" files in directory DIR. +When the target headline is found, return a marker to this location." + (let ((files (directory-files (or dir default-directory) + t "\\`[^.#].*\\.org\\'")) + visiting m buffer) + (catch 'found + (dolist (file files) + (message "trying %s" file) + (setq visiting (org-find-base-buffer-visiting file)) + (setq buffer (or visiting (find-file-noselect file))) + (setq m (org-find-exact-headline-in-buffer + heading buffer)) + (when (and (not m) (not visiting)) (kill-buffer buffer)) + (and m (throw 'found m)))))) + +(defun org-find-entry-with-id (ident) + "Locate the entry that contains the ID property with exact value IDENT. +IDENT can be a string, a symbol or a number, this function will search for +the string representation of it. +Return the position where this entry starts, or nil if there is no such entry." + (interactive "sID: ") + (let ((id (cond + ((stringp ident) ident) + ((symbolp ident) (symbol-name ident)) + ((numberp ident) (number-to-string ident)) + (t (error "IDENT %s must be a string, symbol or number" ident))))) + (org-with-wide-buffer (org-find-property "ID" id)))) + +;;;; Timestamps + +(defvar org-last-changed-timestamp nil) +(defvar org-last-inserted-timestamp nil + "The last time stamp inserted with `org-insert-time-stamp'.") + +(defun org-time-stamp (arg &optional inactive) + "Prompt for a date/time and insert a time stamp. + +If the user specifies a time like HH:MM or if this command is +called with at least one prefix argument, the time stamp contains +the date and the time. Otherwise, only the date is included. + +All parts of a date not specified by the user are filled in from +the timestamp at point, if any, or the current date/time +otherwise. + +If there is already a timestamp at the cursor, it is replaced. + +With two universal prefix arguments, insert an active timestamp +with the current time without prompting the user. + +When called from Lisp, the timestamp is inactive if INACTIVE is +non-nil." + (interactive "P") + (let* ((ts (cond + ((org-at-date-range-p t) + (match-string (if (< (point) (- (match-beginning 2) 2)) 1 2))) + ((org-at-timestamp-p 'lax) (match-string 0)))) + ;; Default time is either the timestamp at point or today. + ;; When entering a range, only the range start is considered. + (default-time (and ts (org-time-string-to-time ts))) + (default-input (and ts (org-get-compact-tod ts))) + (repeater (and ts + (string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts) + (match-string 0 ts))) + org-time-was-given + org-end-time-was-given + (time + (if (equal arg '(16)) (current-time) + ;; Preserve `this-command' and `last-command'. + (let ((this-command this-command) + (last-command last-command)) + (org-read-date + arg 'totime nil nil default-time default-input + inactive))))) + (cond + ((and ts + (memq last-command '(org-time-stamp org-time-stamp-inactive)) + (memq this-command '(org-time-stamp org-time-stamp-inactive))) + (insert "--") + (org-insert-time-stamp time (or org-time-was-given arg) inactive)) + (ts + ;; Make sure we're on a timestamp. When in the middle of a date + ;; range, move arbitrarily to range end. + (unless (org-at-timestamp-p 'lax) + (skip-chars-forward "-") + (org-at-timestamp-p 'lax)) + (replace-match "") + (setq org-last-changed-timestamp + (org-insert-time-stamp + time (or org-time-was-given arg) + inactive nil nil (list org-end-time-was-given))) + (when repeater + (backward-char) + (insert " " repeater) + (setq org-last-changed-timestamp + (concat (substring org-last-inserted-timestamp 0 -1) + " " repeater ">"))) + (message "Timestamp updated")) + ((equal arg '(16)) (org-insert-time-stamp time t inactive)) + (t (org-insert-time-stamp + time (or org-time-was-given arg) inactive nil nil + (list org-end-time-was-given)))))) + +;; FIXME: can we use this for something else, like computing time differences? +(defun org-get-compact-tod (s) + (when (string-match "\\(\\([012]?[0-9]\\):\\([0-5][0-9]\\)\\)\\(-\\(\\([012]?[0-9]\\):\\([0-5][0-9]\\)\\)\\)?" s) + (let* ((t1 (match-string 1 s)) + (h1 (string-to-number (match-string 2 s))) + (m1 (string-to-number (match-string 3 s))) + (t2 (and (match-end 4) (match-string 5 s))) + (h2 (and t2 (string-to-number (match-string 6 s)))) + (m2 (and t2 (string-to-number (match-string 7 s)))) + dh dm) + (if (not t2) + t1 + (setq dh (- h2 h1) dm (- m2 m1)) + (when (< dm 0) (setq dm (+ dm 60) dh (1- dh))) + (concat t1 "+" (number-to-string dh) + (and (/= 0 dm) (format ":%02d" dm))))))) + +(defun org-time-stamp-inactive (&optional arg) + "Insert an inactive time stamp. + +An inactive time stamp is enclosed in square brackets instead of +angle brackets. It is inactive in the sense that it does not +trigger agenda entries. So these are more for recording a +certain time/date. + +If the user specifies a time like HH:MM or if this command is called with +at least one prefix argument, the time stamp contains the date and the time. +Otherwise, only the date is included. + +When called with two universal prefix arguments, insert an inactive time stamp +with the current time without prompting the user." + (interactive "P") + (org-time-stamp arg 'inactive)) + +(defvar org-date-ovl (make-overlay 1 1)) +(overlay-put org-date-ovl 'face 'org-date-selected) +(delete-overlay org-date-ovl) + +(defvar org-ans1) ; dynamically scoped parameter +(defvar org-ans2) ; dynamically scoped parameter + +(defvar org-plain-time-of-day-regexp) ; defined below + +(defvar org-overriding-default-time nil) ; dynamically scoped +(defvar org-read-date-overlay nil) +(defvar org-read-date-history nil) +(defvar org-read-date-final-answer nil) +(defvar org-read-date-analyze-futurep nil) +(defvar org-read-date-analyze-forced-year nil) +(defvar org-read-date-inactive) +(defvar org-def) +(defvar org-defdecode) +(defvar org-with-time) + +(defvar calendar-setup) ; Dynamically scoped. +(defun org-read-date (&optional with-time to-time from-string prompt + default-time default-input inactive) + "Read a date, possibly a time, and make things smooth for the user. +The prompt will suggest to enter an ISO date, but you can also enter anything +which will at least partially be understood by `parse-time-string'. +Unrecognized parts of the date will default to the current day, month, year, +hour and minute. If this command is called to replace a timestamp at point, +or to enter the second timestamp of a range, the default time is taken +from the existing stamp. Furthermore, the command prefers the future, +so if you are giving a date where the year is not given, and the day-month +combination is already past in the current year, it will assume you +mean next year. For details, see the manual. A few examples: + + 3-2-5 --> 2003-02-05 + feb 15 --> currentyear-02-15 + 2/15 --> currentyear-02-15 + sep 12 9 --> 2009-09-12 + 12:45 --> today 12:45 + 22 sept 0:34 --> currentyear-09-22 0:34 + 12 --> currentyear-currentmonth-12 + Fri --> nearest Friday after today + -Tue --> last Tuesday + etc. + +Furthermore you can specify a relative date by giving, as the *first* thing +in the input: a plus/minus sign, a number and a letter [hdwmy] to indicate +change in days weeks, months, years. +With a single plus or minus, the date is relative to today. With a double +plus or minus, it is relative to the date in DEFAULT-TIME. E.g. + +4d --> four days from today + +4 --> same as above + +2w --> two weeks from today + ++5 --> five days from default date + +The function understands only English month and weekday abbreviations. + +While prompting, a calendar is popped up - you can also select the +date with the mouse (button 1). The calendar shows a period of three +months. To scroll it to other months, use the keys `>' and `<'. +If you don't like the calendar, turn it off with + (setq org-read-date-popup-calendar nil) + +With optional argument TO-TIME, the date will immediately be converted +to an internal time. +With an optional argument WITH-TIME, the prompt will suggest to +also insert a time. Note that when WITH-TIME is not set, you can +still enter a time, and this function will inform the calling routine +about this change. The calling routine may then choose to change the +format used to insert the time stamp into the buffer to include the time. +With optional argument FROM-STRING, read from this string instead from +the user. PROMPT can overwrite the default prompt. DEFAULT-TIME is +the time/date that is used for everything that is not specified by the +user." + (require 'parse-time) + (let* ((org-with-time with-time) + (org-time-stamp-rounding-minutes + (if (equal org-with-time '(16)) + '(0 0) + org-time-stamp-rounding-minutes)) + (ct (org-current-time)) + (org-def (or org-overriding-default-time default-time ct)) + (org-defdecode (decode-time org-def)) + (cur-frame (selected-frame)) + (mouse-autoselect-window nil) ; Don't let the mouse jump + (calendar-setup + (and (eq calendar-setup 'calendar-only) 'calendar-only)) + (calendar-move-hook nil) + (calendar-view-diary-initially-flag nil) + (calendar-view-holidays-initially-flag nil) + ans (org-ans0 "") org-ans1 org-ans2 final cal-frame) + ;; Rationalize `org-def' and `org-defdecode', if required. + (when (< (nth 2 org-defdecode) org-extend-today-until) + (setf (nth 2 org-defdecode) -1) + (setf (nth 1 org-defdecode) 59) + (setq org-def (apply #'encode-time org-defdecode)) + (setq org-defdecode (decode-time org-def))) + (let* ((timestr (format-time-string + (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") + org-def)) + (prompt (concat (if prompt (concat prompt " ") "") + (format "Date+time [%s]: " timestr)))) + (cond + (from-string (setq ans from-string)) + (org-read-date-popup-calendar + (save-excursion + (save-window-excursion + (calendar) + (when (eq calendar-setup 'calendar-only) + (setq cal-frame + (window-frame (get-buffer-window "*Calendar*" 'visible))) + (select-frame cal-frame)) + (org-eval-in-calendar '(setq cursor-type nil) t) + (unwind-protect + (progn + (calendar-forward-day (- (time-to-days org-def) + (calendar-absolute-from-gregorian + (calendar-current-date)))) + (org-eval-in-calendar nil t) + (let* ((old-map (current-local-map)) + (map (copy-keymap calendar-mode-map)) + (minibuffer-local-map + (copy-keymap org-read-date-minibuffer-local-map))) + (org-defkey map (kbd "RET") 'org-calendar-select) + (org-defkey map [mouse-1] 'org-calendar-select-mouse) + (org-defkey map [mouse-2] 'org-calendar-select-mouse) + (unwind-protect + (progn + (use-local-map map) + (setq org-read-date-inactive inactive) + (add-hook 'post-command-hook 'org-read-date-display) + (setq org-ans0 + (read-string prompt + default-input + 'org-read-date-history + nil)) + ;; org-ans0: from prompt + ;; org-ans1: from mouse click + ;; org-ans2: from calendar motion + (setq ans + (concat org-ans0 " " (or org-ans1 org-ans2)))) + (remove-hook 'post-command-hook 'org-read-date-display) + (use-local-map old-map) + (when org-read-date-overlay + (delete-overlay org-read-date-overlay) + (setq org-read-date-overlay nil))))) + (bury-buffer "*Calendar*") + (when cal-frame + (delete-frame cal-frame) + (select-frame-set-input-focus cur-frame)))))) + + (t ; Naked prompt only + (unwind-protect + (setq ans (read-string prompt default-input + 'org-read-date-history timestr)) + (when org-read-date-overlay + (delete-overlay org-read-date-overlay) + (setq org-read-date-overlay nil)))))) + + (setq final (org-read-date-analyze ans org-def org-defdecode)) + + (when org-read-date-analyze-forced-year + (message "Year was forced into %s" + (if org-read-date-force-compatible-dates + "compatible range (1970-2037)" + "range representable on this machine")) + (ding)) + + (setq final (apply #'encode-time final)) + + (setq org-read-date-final-answer ans) + + (if to-time + final + ;; This round-trip gets rid of 34th of August and stuff like that.... + (setq final (decode-time final)) + (if (and (boundp 'org-time-was-given) org-time-was-given) + (format "%04d-%02d-%02d %02d:%02d" + (nth 5 final) (nth 4 final) (nth 3 final) + (nth 2 final) (nth 1 final)) + (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final)))))) + +(defun org-read-date-display () + "Display the current date prompt interpretation in the minibuffer." + (when org-read-date-display-live + (when org-read-date-overlay + (delete-overlay org-read-date-overlay)) + (when (minibufferp (current-buffer)) + (save-excursion + (end-of-line 1) + (while (not (equal (buffer-substring + (max (point-min) (- (point) 4)) (point)) + " ")) + (insert " "))) + (let* ((ans (concat (buffer-substring (point-at-bol) (point-max)) + " " (or org-ans1 org-ans2))) + (org-end-time-was-given nil) + (f (org-read-date-analyze ans org-def org-defdecode)) + (fmts (if org-display-custom-times + org-time-stamp-custom-formats + org-time-stamp-formats)) + (fmt (if (or org-with-time + (and (boundp 'org-time-was-given) org-time-was-given)) + (cdr fmts) + (car fmts))) + (txt (format-time-string fmt (apply #'encode-time f))) + (txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) "]") txt)) + (txt (concat "=> " txt))) + (when (and org-end-time-was-given + (string-match org-plain-time-of-day-regexp txt)) + (setq txt (concat (substring txt 0 (match-end 0)) "-" + org-end-time-was-given + (substring txt (match-end 0))))) + (when org-read-date-analyze-futurep + (setq txt (concat txt " (=>F)"))) + (setq org-read-date-overlay + (make-overlay (1- (point-at-eol)) (point-at-eol))) + (org-overlay-display org-read-date-overlay txt 'secondary-selection))))) + +(defun org-read-date-analyze (ans def defdecode) + "Analyze the combined answer of the date prompt." + ;; FIXME: cleanup and comment + (let ((org-def def) + (org-defdecode defdecode) + (nowdecode (decode-time)) + delta deltan deltaw deltadef year month day + hour minute second wday pm h2 m2 tl wday1 + iso-year iso-weekday iso-week iso-date futurep kill-year) + (setq org-read-date-analyze-futurep nil + org-read-date-analyze-forced-year nil) + (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) + (setq ans "+0")) + + (when (setq delta (org-read-date-get-relative ans nil org-def)) + (setq ans (replace-match "" t t ans) + deltan (car delta) + deltaw (nth 1 delta) + deltadef (nth 2 delta))) + + ;; Check if there is an iso week date in there. If yes, store the + ;; info and postpone interpreting it until the rest of the parsing + ;; is done. + (when (string-match "\\<\\(?:\\([0-9]+\\)-\\)?[wW]\\([0-9]\\{1,2\\}\\)\\(?:-\\([0-6]\\)\\)?\\([ \t]\\|$\\)" ans) + (setq iso-year (when (match-end 1) + (org-small-year-to-year + (string-to-number (match-string 1 ans)))) + iso-weekday (when (match-end 3) + (string-to-number (match-string 3 ans))) + iso-week (string-to-number (match-string 2 ans))) + (setq ans (replace-match "" t t ans))) + + ;; Help matching ISO dates with single digit month or day, like 2006-8-11. + (when (string-match + "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans) + (setq year (if (match-end 2) + (string-to-number (match-string 2 ans)) + (progn (setq kill-year t) + (string-to-number (format-time-string "%Y")))) + month (string-to-number (match-string 3 ans)) + day (string-to-number (match-string 4 ans))) + (setq year (org-small-year-to-year year)) + (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) + t nil ans))) + + ;; Help matching dotted european dates + (when (string-match + "^ *\\(3[01]\\|0?[1-9]\\|[12][0-9]\\)\\. ?\\(0?[1-9]\\|1[012]\\)\\.\\( ?[1-9][0-9]\\{3\\}\\)?" ans) + (setq year (if (match-end 3) (string-to-number (match-string 3 ans)) + (setq kill-year t) + (string-to-number (format-time-string "%Y"))) + day (string-to-number (match-string 1 ans)) + month (string-to-number (match-string 2 ans)) + ans (replace-match (format "%04d-%02d-%02d" year month day) + t nil ans))) + + ;; Help matching american dates, like 5/30 or 5/30/7 + (when (string-match + "^ *\\(0?[1-9]\\|1[012]\\)/\\(0?[1-9]\\|[12][0-9]\\|3[01]\\)\\(/\\([0-9]+\\)\\)?\\([^/0-9]\\|$\\)" ans) + (setq year (if (match-end 4) + (string-to-number (match-string 4 ans)) + (progn (setq kill-year t) + (string-to-number (format-time-string "%Y")))) + month (string-to-number (match-string 1 ans)) + day (string-to-number (match-string 2 ans))) + (setq year (org-small-year-to-year year)) + (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) + t nil ans))) + ;; Help matching am/pm times, because `parse-time-string' does not do that. + ;; If there is a time with am/pm, and *no* time without it, we convert + ;; so that matching will be successful. + (cl-loop for i from 1 to 2 do ; twice, for end time as well + (when (and (not (string-match "\\(\\`\\|[^+]\\)[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) + (string-match "\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\(am\\|AM\\|pm\\|PM\\)\\>" ans)) + (setq hour (string-to-number (match-string 1 ans)) + minute (if (match-end 3) + (string-to-number (match-string 3 ans)) + 0) + pm (equal ?p + (string-to-char (downcase (match-string 4 ans))))) + (if (and (= hour 12) (not pm)) + (setq hour 0) + (when (and pm (< hour 12)) (setq hour (+ 12 hour)))) + (setq ans (replace-match (format "%02d:%02d" hour minute) + t t ans)))) + + ;; Help matching HHhMM times, similarly as for am/pm times. + (cl-loop for i from 1 to 2 do ; twice, for end time as well + (when (and (not (string-match "\\(\\`\\|[^+]\\)[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) + (string-match "\\(?:\\(?1:[012]?[0-9]\\)?h\\(?2:[0-5][0-9]\\)\\)\\|\\(?:\\(?1:[012]?[0-9]\\)h\\(?2:[0-5][0-9]\\)?\\)\\>" ans)) + (setq hour (if (match-end 1) + (string-to-number (match-string 1 ans)) + 0) + minute (if (match-end 2) + (string-to-number (match-string 2 ans)) + 0)) + (setq ans (replace-match (format "%02d:%02d" hour minute) + t t ans)))) + + ;; Check if a time range is given as a duration + (when (string-match "\\([012]?[0-9]\\):\\([0-6][0-9]\\)\\+\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?" ans) + (setq hour (string-to-number (match-string 1 ans)) + h2 (+ hour (string-to-number (match-string 3 ans))) + minute (string-to-number (match-string 2 ans)) + m2 (+ minute (if (match-end 5) (string-to-number + (match-string 5 ans))0))) + (when (>= m2 60) (setq h2 (1+ h2) m2 (- m2 60))) + (setq ans (replace-match (format "%02d:%02d-%02d:%02d" hour minute h2 m2) + t t ans))) + + ;; Check if there is a time range + (when (boundp 'org-end-time-was-given) + (setq org-time-was-given nil) + (when (and (string-match org-plain-time-of-day-regexp ans) + (match-end 8)) + (setq org-end-time-was-given (match-string 8 ans)) + (setq ans (concat (substring ans 0 (match-beginning 7)) + (substring ans (match-end 7)))))) + + (setq tl (parse-time-string ans) + day (or (nth 3 tl) (nth 3 org-defdecode)) + month + (cond ((nth 4 tl)) + ((not org-read-date-prefer-future) (nth 4 org-defdecode)) + ;; Day was specified. Make sure DAY+MONTH + ;; combination happens in the future. + ((nth 3 tl) + (setq futurep t) + (if (< day (nth 3 nowdecode)) (1+ (nth 4 nowdecode)) + (nth 4 nowdecode))) + (t (nth 4 org-defdecode))) + year + (cond ((and (not kill-year) (nth 5 tl))) + ((not org-read-date-prefer-future) (nth 5 org-defdecode)) + ;; Month was guessed in the future and is at least + ;; equal to NOWDECODE's. Fix year accordingly. + (futurep + (if (or (> month (nth 4 nowdecode)) + (>= day (nth 3 nowdecode))) + (nth 5 nowdecode) + (1+ (nth 5 nowdecode)))) + ;; Month was specified. Make sure MONTH+YEAR + ;; combination happens in the future. + ((nth 4 tl) + (setq futurep t) + (cond ((> month (nth 4 nowdecode)) (nth 5 nowdecode)) + ((< month (nth 4 nowdecode)) (1+ (nth 5 nowdecode))) + ((< day (nth 3 nowdecode)) (1+ (nth 5 nowdecode))) + (t (nth 5 nowdecode)))) + (t (nth 5 org-defdecode))) + hour (or (nth 2 tl) (nth 2 org-defdecode)) + minute (or (nth 1 tl) (nth 1 org-defdecode)) + second (or (nth 0 tl) 0) + wday (nth 6 tl)) + + (when (and (eq org-read-date-prefer-future 'time) + (not (nth 3 tl)) (not (nth 4 tl)) (not (nth 5 tl)) + (equal day (nth 3 nowdecode)) + (equal month (nth 4 nowdecode)) + (equal year (nth 5 nowdecode)) + (nth 2 tl) + (or (< (nth 2 tl) (nth 2 nowdecode)) + (and (= (nth 2 tl) (nth 2 nowdecode)) + (nth 1 tl) + (< (nth 1 tl) (nth 1 nowdecode))))) + (setq day (1+ day) + futurep t)) + + ;; Special date definitions below + (cond + (iso-week + ;; There was an iso week + (require 'cal-iso) + (setq futurep nil) + (setq year (or iso-year year) + day (or iso-weekday wday 1) + wday nil ; to make sure that the trigger below does not match + iso-date (calendar-gregorian-from-absolute + (calendar-iso-to-absolute + (list iso-week day year)))) + ; FIXME: Should we also push ISO weeks into the future? + ; (when (and org-read-date-prefer-future + ; (not iso-year) + ; (< (calendar-absolute-from-gregorian iso-date) + ; (time-to-days nil))) + ; (setq year (1+ year) + ; iso-date (calendar-gregorian-from-absolute + ; (calendar-iso-to-absolute + ; (list iso-week day year))))) + (setq month (car iso-date) + year (nth 2 iso-date) + day (nth 1 iso-date))) + (deltan + (setq futurep nil) + (unless deltadef + (let ((now (decode-time))) + (setq day (nth 3 now) month (nth 4 now) year (nth 5 now)))) + (cond ((member deltaw '("d" "")) (setq day (+ day deltan))) + ((equal deltaw "w") (setq day (+ day (* 7 deltan)))) + ((equal deltaw "m") (setq month (+ month deltan))) + ((equal deltaw "y") (setq year (+ year deltan))))) + ((and wday (not (nth 3 tl))) + ;; Weekday was given, but no day, so pick that day in the week + ;; on or after the derived date. + (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year)))) + (unless (equal wday wday1) + (setq day (+ day (% (- wday wday1 -7) 7)))))) + (when (and (boundp 'org-time-was-given) + (nth 2 tl)) + (setq org-time-was-given t)) + (when (< year 100) (setq year (+ 2000 year))) + ;; Check of the date is representable + (if org-read-date-force-compatible-dates + (progn + (when (< year 1970) + (setq year 1970 org-read-date-analyze-forced-year t)) + (when (> year 2037) + (setq year 2037 org-read-date-analyze-forced-year t))) + (condition-case nil + (ignore (encode-time second minute hour day month year)) + (error + (setq year (nth 5 org-defdecode)) + (setq org-read-date-analyze-forced-year t)))) + (setq org-read-date-analyze-futurep futurep) + (list second minute hour day month year))) + +(defvar parse-time-weekdays) +(defun org-read-date-get-relative (s today default) + "Check string S for special relative date string. +TODAY and DEFAULT are internal times, for today and for a default. +Return shift list (N what def-flag) +WHAT is \"d\", \"w\", \"m\", or \"y\" for day, week, month, year. +N is the number of WHATs to shift. +DEF-FLAG is t when a double ++ or -- indicates shift relative to + the DEFAULT date rather than TODAY." + (require 'parse-time) + (when (and + (string-match + (concat + "\\`[ \t]*\\([-+]\\{0,2\\}\\)" + "\\([0-9]+\\)?" + "\\([hdwmy]\\|\\(" (mapconcat 'car parse-time-weekdays "\\|") "\\)\\)?" + "\\([ \t]\\|$\\)") s) + (or (> (match-end 1) (match-beginning 1)) (match-end 4))) + (let* ((dir (if (> (match-end 1) (match-beginning 1)) + (string-to-char (substring (match-string 1 s) -1)) + ?+)) + (rel (and (match-end 1) (= 2 (- (match-end 1) (match-beginning 1))))) + (n (if (match-end 2) (string-to-number (match-string 2 s)) 1)) + (what (if (match-end 3) (match-string 3 s) "d")) + (wday1 (cdr (assoc (downcase what) parse-time-weekdays))) + (date (if rel default today)) + (wday (nth 6 (decode-time date))) + delta) + (if wday1 + (progn + (setq delta (mod (+ 7 (- wday1 wday)) 7)) + (when (= delta 0) (setq delta 7)) + (when (= dir ?-) + (setq delta (- delta 7)) + (when (= delta 0) (setq delta -7))) + (when (> n 1) (setq delta (+ delta (* (1- n) (if (= dir ?-) -7 7))))) + (list delta "d" rel)) + (list (* n (if (= dir ?-) -1 1)) what rel))))) + +(defun org-order-calendar-date-args (arg1 arg2 arg3) + "Turn a user-specified date into the internal representation. +The internal representation needed by the calendar is (month day year). +This is a wrapper to handle the brain-dead convention in calendar that +user function argument order change dependent on argument order." + (pcase calendar-date-style + (`american (list arg1 arg2 arg3)) + (`european (list arg2 arg1 arg3)) + (`iso (list arg2 arg3 arg1)))) + +(defun org-eval-in-calendar (form &optional keepdate) + "Eval FORM in the calendar window and return to current window. +Unless KEEPDATE is non-nil, update `org-ans2' to the cursor date." + (let ((sf (selected-frame)) + (sw (selected-window))) + (select-window (get-buffer-window "*Calendar*" t)) + (eval form) + (when (and (not keepdate) (calendar-cursor-to-date)) + (let* ((date (calendar-cursor-to-date)) + (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) + (setq org-ans2 (format-time-string "%Y-%m-%d" time)))) + (move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer)) + (select-window sw) + (select-frame-set-input-focus sf))) + +(defun org-calendar-select () + "Return to `org-read-date' with the date currently selected. +This is used by `org-read-date' in a temporary keymap for the calendar buffer." + (interactive) + (when (calendar-cursor-to-date) + (let* ((date (calendar-cursor-to-date)) + (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) + (setq org-ans1 (format-time-string "%Y-%m-%d" time))) + (when (active-minibuffer-window) (exit-minibuffer)))) + +(defun org-insert-time-stamp (time &optional with-hm inactive pre post extra) + "Insert a date stamp for the date given by the internal TIME. +See `format-time-string' for the format of TIME. +WITH-HM means use the stamp format that includes the time of the day. +INACTIVE means use square brackets instead of angular ones, so that the +stamp will not contribute to the agenda. +PRE and POST are optional strings to be inserted before and after the +stamp. +The command returns the inserted time stamp." + (let ((fmt (funcall (if with-hm 'cdr 'car) org-time-stamp-formats)) + stamp) + (when inactive (setq fmt (concat "[" (substring fmt 1 -1) "]"))) + (insert-before-markers (or pre "")) + (when (listp extra) + (setq extra (car extra)) + (if (and (stringp extra) + (string-match "\\([0-9]+\\):\\([0-9]+\\)" extra)) + (setq extra (format "-%02d:%02d" + (string-to-number (match-string 1 extra)) + (string-to-number (match-string 2 extra)))) + (setq extra nil))) + (when extra + (setq fmt (concat (substring fmt 0 -1) extra (substring fmt -1)))) + (insert-before-markers (setq stamp (format-time-string fmt time))) + (insert-before-markers (or post "")) + (setq org-last-inserted-timestamp stamp))) + +(defun org-toggle-time-stamp-overlays () + "Toggle the use of custom time stamp formats." + (interactive) + (setq org-display-custom-times (not org-display-custom-times)) + (unless org-display-custom-times + (let ((p (point-min)) (bmp (buffer-modified-p))) + (while (setq p (next-single-property-change p 'display)) + (when (and (get-text-property p 'display) + (eq (get-text-property p 'face) 'org-date)) + (remove-text-properties + p (setq p (next-single-property-change p 'display)) + '(display t)))) + (set-buffer-modified-p bmp))) + (org-restart-font-lock) + (setq org-table-may-need-update t) + (if org-display-custom-times + (message "Time stamps are overlaid with custom format") + (message "Time stamp overlays removed"))) + +(defun org-display-custom-time (beg end) + "Overlay modified time stamp format over timestamp between BEG and END." + (let* ((ts (buffer-substring beg end)) + t1 with-hm tf time str (off 0)) + (save-match-data + (setq t1 (org-parse-time-string ts t)) + (when (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)?\\'" ts) + (setq off (- (match-end 0) (match-beginning 0))))) + (setq end (- end off)) + (setq with-hm (and (nth 1 t1) (nth 2 t1)) + tf (funcall (if with-hm 'cdr 'car) org-time-stamp-custom-formats) + time (org-fix-decoded-time t1) + str (org-add-props + (format-time-string + (substring tf 1 -1) (apply 'encode-time time)) + nil 'mouse-face 'highlight)) + (put-text-property beg end 'display str))) + +(defun org-fix-decoded-time (time) + "Set 0 instead of nil for the first 6 elements of time. +Don't touch the rest." + (let ((n 0)) + (mapcar (lambda (x) (if (< (setq n (1+ n)) 7) (or x 0) x)) time))) + +(defun org-time-stamp-to-now (timestamp-string &optional seconds) + "Difference between TIMESTAMP-STRING and now in days. +If SECONDS is non-nil, return the difference in seconds." + (let ((fdiff (if seconds #'float-time #'time-to-days))) + (- (funcall fdiff (org-time-string-to-time timestamp-string)) + (funcall fdiff nil)))) + +(defun org-deadline-close-p (timestamp-string &optional ndays) + "Is the time in TIMESTAMP-STRING close to the current date?" + (setq ndays (or ndays (org-get-wdays timestamp-string))) + (and (<= (org-time-stamp-to-now timestamp-string) ndays) + (not (org-entry-is-done-p)))) + +(defun org-get-wdays (ts &optional delay zero-delay) + "Get the deadline lead time appropriate for timestring TS. +When DELAY is non-nil, get the delay time for scheduled items +instead of the deadline lead time. When ZERO-DELAY is non-nil +and `org-scheduled-delay-days' is 0, enforce 0 as the delay, +don't try to find the delay cookie in the scheduled timestamp." + (let ((tv (if delay org-scheduled-delay-days + org-deadline-warning-days))) + (cond + ((or (and delay (< tv 0)) + (and delay zero-delay (<= tv 0)) + (and (not delay) (<= tv 0))) + ;; Enforce this value no matter what + (- tv)) + ((string-match "-\\([0-9]+\\)\\([hdwmy]\\)\\(\\'\\|>\\| \\)" ts) + ;; lead time is specified. + (floor (* (string-to-number (match-string 1 ts)) + (cdr (assoc (match-string 2 ts) + '(("d" . 1) ("w" . 7) + ("m" . 30.4) ("y" . 365.25) + ("h" . 0.041667))))))) + ;; go for the default. + (t tv)))) + +(defun org-calendar-select-mouse (ev) + "Return to `org-read-date' with the date currently selected. +This is used by `org-read-date' in a temporary keymap for the calendar buffer." + (interactive "e") + (mouse-set-point ev) + (when (calendar-cursor-to-date) + (let* ((date (calendar-cursor-to-date)) + (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) + (setq org-ans1 (format-time-string "%Y-%m-%d" time))) + (when (active-minibuffer-window) (exit-minibuffer)))) + +(defun org-check-deadlines (ndays) + "Check if there are any deadlines due or past due. +A deadline is considered due if it happens within `org-deadline-warning-days' +days from today's date. If the deadline appears in an entry marked DONE, +it is not shown. A numeric prefix argument NDAYS can be used to test that +many days. If the prefix is a raw `\\[universal-argument]', all deadlines \ +are shown." + (interactive "P") + (let* ((org-warn-days + (cond + ((equal ndays '(4)) 100000) + (ndays (prefix-numeric-value ndays)) + (t (abs org-deadline-warning-days)))) + (case-fold-search nil) + (regexp (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")) + (callback + (lambda () (org-deadline-close-p (match-string 1) org-warn-days)))) + (message "%d deadlines past-due or due within %d days" + (org-occur regexp nil callback) + org-warn-days))) + +(defsubst org-re-timestamp (type) + "Return a regexp for timestamp TYPE. +Allowed values for TYPE are: + + all: all timestamps + active: only active timestamps (<...>) + inactive: only inactive timestamps ([...]) + scheduled: only scheduled timestamps + deadline: only deadline timestamps + closed: only closed time-stamps + +When TYPE is nil, fall back on returning a regexp that matches +both scheduled and deadline timestamps." + (cl-case type + (all org-ts-regexp-both) + (active org-ts-regexp) + (inactive org-ts-regexp-inactive) + (scheduled org-scheduled-time-regexp) + (deadline org-deadline-time-regexp) + (closed org-closed-time-regexp) + (otherwise + (concat "\\<" + (regexp-opt (list org-deadline-string org-scheduled-string)) + " *<\\([^>]+\\)>")))) + +(defun org-check-before-date (d) + "Check if there are deadlines or scheduled entries before date D." + (interactive (list (org-read-date))) + (let* ((case-fold-search nil) + (regexp (org-re-timestamp org-ts-type)) + (ts-type org-ts-type) + (callback + (lambda () + (let ((match (match-string 1))) + (and (if (memq ts-type '(active inactive all)) + (eq (org-element-type (save-excursion + (backward-char) + (org-element-context))) + 'timestamp) + (org-at-planning-p)) + (time-less-p + (org-time-string-to-time match) + (org-time-string-to-time d))))))) + (message "%d entries before %s" + (org-occur regexp nil callback) + d))) + +(defun org-check-after-date (d) + "Check if there are deadlines or scheduled entries after date D." + (interactive (list (org-read-date))) + (let* ((case-fold-search nil) + (regexp (org-re-timestamp org-ts-type)) + (ts-type org-ts-type) + (callback + (lambda () + (let ((match (match-string 1))) + (and (if (memq ts-type '(active inactive all)) + (eq (org-element-type (save-excursion + (backward-char) + (org-element-context))) + 'timestamp) + (org-at-planning-p)) + (not (time-less-p + (org-time-string-to-time match) + (org-time-string-to-time d)))))))) + (message "%d entries after %s" + (org-occur regexp nil callback) + d))) + +(defun org-check-dates-range (start-date end-date) + "Check for deadlines/scheduled entries between START-DATE and END-DATE." + (interactive (list (org-read-date nil nil nil "Range starts") + (org-read-date nil nil nil "Range end"))) + (let ((case-fold-search nil) + (regexp (org-re-timestamp org-ts-type)) + (callback + (let ((type org-ts-type)) + (lambda () + (let ((match (match-string 1))) + (and + (if (memq type '(active inactive all)) + (eq (org-element-type (save-excursion + (backward-char) + (org-element-context))) + 'timestamp) + (org-at-planning-p)) + (not (time-less-p + (org-time-string-to-time match) + (org-time-string-to-time start-date))) + (time-less-p + (org-time-string-to-time match) + (org-time-string-to-time end-date)))))))) + (message "%d entries between %s and %s" + (org-occur regexp nil callback) start-date end-date))) + +(defun org-evaluate-time-range (&optional to-buffer) + "Evaluate a time range by computing the difference between start and end. +Normally the result is just printed in the echo area, but with prefix arg +TO-BUFFER, the result is inserted just after the date stamp into the buffer. +If the time range is actually in a table, the result is inserted into the +next column. +For time difference computation, a year is assumed to be exactly 365 +days in order to avoid rounding problems." + (interactive "P") + (or + (org-clock-update-time-maybe) + (save-excursion + (unless (org-at-date-range-p t) + (goto-char (point-at-bol)) + (re-search-forward org-tr-regexp-both (point-at-eol) t)) + (unless (org-at-date-range-p t) + (user-error "Not at a time-stamp range, and none found in current line"))) + (let* ((ts1 (match-string 1)) + (ts2 (match-string 2)) + (havetime (or (> (length ts1) 15) (> (length ts2) 15))) + (match-end (match-end 0)) + (time1 (org-time-string-to-time ts1)) + (time2 (org-time-string-to-time ts2)) + (diff (abs (float-time (time-subtract time2 time1)))) + (negative (time-less-p time2 time1)) + ;; (ys (floor (* 365 24 60 60))) + (ds (* 24 60 60)) + (hs (* 60 60)) + (fy "%dy %dd %02d:%02d") + (fy1 "%dy %dd") + (fd "%dd %02d:%02d") + (fd1 "%dd") + (fh "%02d:%02d") + y d h m align) + (if havetime + (setq ; y (floor diff ys) diff (mod diff ys) + y 0 + d (floor diff ds) diff (mod diff ds) + h (floor diff hs) diff (mod diff hs) + m (floor diff 60)) + (setq ; y (floor diff ys) diff (mod diff ys) + y 0 + d (round diff ds) + h 0 m 0)) + (if (not to-buffer) + (message "%s" (org-make-tdiff-string y d h m)) + (if (org-at-table-p) + (progn + (goto-char match-end) + (setq align t) + (and (looking-at " *|") (goto-char (match-end 0)))) + (goto-char match-end)) + (when (looking-at + "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]") + (replace-match "")) + (when negative (insert " -")) + (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m)) + (if (> d 0) (insert " " (format (if havetime fd fd1) d h m)) + (insert " " (format fh h m)))) + (when align (org-table-align)) + (message "Time difference inserted"))))) + +(defun org-make-tdiff-string (y d h m) + (let ((fmt "") + (l nil)) + (when (> y 0) + (setq fmt (concat fmt "%d year" (if (> y 1) "s" "") " ")) + (push y l)) + (when (> d 0) + (setq fmt (concat fmt "%d day" (if (> d 1) "s" "") " ")) + (push d l)) + (when (> h 0) + (setq fmt (concat fmt "%d hour" (if (> h 1) "s" "") " ")) + (push h l)) + (when (> m 0) + (setq fmt (concat fmt "%d minute" (if (> m 1) "s" "") " ")) + (push m l)) + (apply 'format fmt (nreverse l)))) + +(defun org-time-string-to-time (s) + "Convert timestamp string S into internal time." + (apply #'encode-time (org-parse-time-string s))) + +(defun org-time-string-to-seconds (s) + "Convert a timestamp string S into a number of seconds." + (float-time (org-time-string-to-time s))) + +(org-define-error 'org-diary-sexp-no-match "Unable to match diary sexp") + +(defun org-time-string-to-absolute (s &optional daynr prefer buffer pos) + "Convert time stamp S to an absolute day number. + +If DAYNR in non-nil, and there is a specifier for a cyclic time +stamp, get the closest date to DAYNR. If PREFER is +`past' (respectively `future') return a date past (respectively +after) or equal to DAYNR. + +POS is the location of time stamp S, as a buffer position in +BUFFER. + +Diary sexp timestamps are matched against DAYNR, when non-nil. +If matching fails or DAYNR is nil, `org-diary-sexp-no-match' is +signaled." + (cond + ((string-match "\\`%%\\((.*)\\)" s) + ;; Sexp timestamp: try to match DAYNR, if available, since we're + ;; only able to match individual dates. If it fails, raise an + ;; error. + (if (and daynr + (org-diary-sexp-entry + (match-string 1 s) "" (calendar-gregorian-from-absolute daynr))) + daynr + (signal 'org-diary-sexp-no-match (list s)))) + (daynr (org-closest-date s daynr prefer)) + (t (time-to-days + (condition-case errdata + (org-time-string-to-time s) + (error (error "Bad timestamp `%s'%s\nError was: %s" + s + (if (not (and buffer pos)) "" + (format-message " at %d in buffer `%s'" pos buffer)) + (cdr errdata)))))))) + +(defun org-days-to-iso-week (days) + "Return the ISO week number." + (require 'cal-iso) + (car (calendar-iso-from-absolute days))) + +(defun org-small-year-to-year (year) + "Convert 2-digit years into 4-digit years. +YEAR is expanded into one of the 30 next years, if possible, or +into a past one. Any year larger than 99 is returned unchanged." + (if (>= year 100) year + (let* ((current (string-to-number (format-time-string "%Y"))) + (century (/ current 100)) + (offset (- year (% current 100)))) + (cond ((> offset 30) (+ (* (1- century) 100) year)) + ((> offset -70) (+ (* century 100) year)) + (t (+ (* (1+ century) 100) year)))))) + +(defun org-time-from-absolute (d) + "Return the time corresponding to date D. +D may be an absolute day number, or a calendar-type list (month day year)." + (when (numberp d) (setq d (calendar-gregorian-from-absolute d))) + (encode-time 0 0 0 (nth 1 d) (car d) (nth 2 d))) + +(defvar org-agenda-current-date) +(defun org-calendar-holiday () + "List of holidays, for Diary display in Org mode." + (require 'holidays) + (let ((hl (calendar-check-holidays org-agenda-current-date))) + (and hl (mapconcat #'identity hl "; ")))) + +(defun org-diary-sexp-entry (sexp entry d) + "Process a SEXP diary ENTRY for date D." + (require 'diary-lib) + ;; `org-anniversary' and alike expect ENTRY and DATE to be bound + ;; dynamically. + (let* ((sexp `(let ((entry ,entry) + (date ',d)) + ,(car (read-from-string sexp)))) + (result (if calendar-debug-sexp (eval sexp) + (condition-case nil + (eval sexp) + (error + (beep) + (message "Bad sexp at line %d in %s: %s" + (org-current-line) + (buffer-file-name) sexp) + (sleep-for 2)))))) + (cond ((stringp result) (split-string result "; ")) + ((and (consp result) + (not (consp (cdr result))) + (stringp (cdr result))) (cdr result)) + ((and (consp result) + (stringp (car result))) result) + (result entry)))) + +(defun org-diary-to-ical-string (frombuf) + "Get iCalendar entries from diary entries in buffer FROMBUF. +This uses the icalendar.el library." + (let* ((tmpdir temporary-file-directory) + (tmpfile (make-temp-name + (expand-file-name "orgics" tmpdir))) + buf rtn b e) + (with-current-buffer frombuf + (icalendar-export-region (point-min) (point-max) tmpfile) + (setq buf (find-buffer-visiting tmpfile)) + (set-buffer buf) + (goto-char (point-min)) + (when (re-search-forward "^BEGIN:VEVENT" nil t) + (setq b (match-beginning 0))) + (goto-char (point-max)) + (when (re-search-backward "^END:VEVENT" nil t) + (setq e (match-end 0))) + (setq rtn (if (and b e) (concat (buffer-substring b e) "\n") ""))) + (kill-buffer buf) + (delete-file tmpfile) + rtn)) + +(defun org-closest-date (start current prefer) + "Return closest date to CURRENT starting from START. + +CURRENT and START are both time stamps. + +When PREFER is `past', return a date that is either CURRENT or +past. When PREFER is `future', return a date that is either +CURRENT or future. + +Only time stamps with a repeater are modified. Any other time +stamp stay unchanged. In any case, return value is an absolute +day number." + (if (not (string-match "\\+\\([0-9]+\\)\\([hdwmy]\\)" start)) + ;; No repeater. Do not shift time stamp. + (time-to-days (org-time-string-to-time start)) + (let ((value (string-to-number (match-string 1 start))) + (type (match-string 2 start))) + (if (= 0 value) + ;; Repeater with a 0-value is considered as void. + (time-to-days (org-time-string-to-time start)) + (let* ((base (org-date-to-gregorian start)) + (target (org-date-to-gregorian current)) + (sday (calendar-absolute-from-gregorian base)) + (cday (calendar-absolute-from-gregorian target)) + n1 n2) + ;; If START is already past CURRENT, just return START. + (if (<= cday sday) sday + ;; Compute closest date before (N1) and closest date past + ;; (N2) CURRENT. + (pcase type + ("h" + (let ((missing-hours + (mod (+ (- (* 24 (- cday sday)) + (nth 2 (org-parse-time-string start))) + org-extend-today-until) + value))) + (setf n1 (if (= missing-hours 0) cday + (- cday (1+ (/ missing-hours 24))))) + (setf n2 (+ cday (/ (- value missing-hours) 24))))) + ((or "d" "w") + (let ((value (if (equal type "w") (* 7 value) value))) + (setf n1 (+ sday (* value (/ (- cday sday) value)))) + (setf n2 (+ n1 value)))) + ("m" + (let* ((add-months + (lambda (d n) + ;; Add N months to gregorian date D, i.e., + ;; a list (MONTH DAY YEAR). Return a valid + ;; gregorian date. + (let ((m (+ (nth 0 d) n))) + (list (mod m 12) + (nth 1 d) + (+ (/ m 12) (nth 2 d)))))) + (months ; Complete months to TARGET. + (* (/ (+ (* 12 (- (nth 2 target) (nth 2 base))) + (- (nth 0 target) (nth 0 base)) + ;; If START's day is greater than + ;; TARGET's, remove incomplete month. + (if (> (nth 1 target) (nth 1 base)) 0 -1)) + value) + value)) + (before (funcall add-months base months))) + (setf n1 (calendar-absolute-from-gregorian before)) + (setf n2 + (calendar-absolute-from-gregorian + (funcall add-months before value))))) + (_ + (let* ((d (nth 1 base)) + (m (nth 0 base)) + (y (nth 2 base)) + (years ; Complete years to TARGET. + (* (/ (- (nth 2 target) + y + ;; If START's month and day are + ;; greater than TARGET's, remove + ;; incomplete year. + (if (or (> (nth 0 target) m) + (and (= (nth 0 target) m) + (> (nth 1 target) d))) + 0 + 1)) + value) + value)) + (before (list m d (+ y years)))) + (setf n1 (calendar-absolute-from-gregorian before)) + (setf n2 (calendar-absolute-from-gregorian + (list m d (+ (nth 2 before) value))))))) + ;; Handle PREFER parameter, if any. + (cond + ((eq prefer 'past) (if (= cday n2) n2 n1)) + ((eq prefer 'future) (if (= cday n1) n1 n2)) + (t (if (> (abs (- cday n1)) (abs (- cday n2))) n2 n1))))))))) + +(defun org-date-to-gregorian (d) + "Turn any specification of date D into a Gregorian date for the calendar." + (cond ((integerp d) (calendar-gregorian-from-absolute d)) + ((and (listp d) (= (length d) 3)) d) + ((stringp d) + (let ((d (org-parse-time-string d))) + (list (nth 4 d) (nth 3 d) (nth 5 d)))) + ((listp d) (list (nth 4 d) (nth 3 d) (nth 5 d))))) + +(defun org-timestamp-up (&optional arg) + "Increase the date item at the cursor by one. +If the cursor is on the year, change the year. If it is on the month, +the day or the time, change that. If the cursor is on the enclosing +bracket, change the timestamp type. +With prefix ARG, change by that many units." + (interactive "p") + (org-timestamp-change (prefix-numeric-value arg) nil 'updown)) + +(defun org-timestamp-down (&optional arg) + "Decrease the date item at the cursor by one. +If the cursor is on the year, change the year. If it is on the month, +the day or the time, change that. If the cursor is on the enclosing +bracket, change the timestamp type. +With prefix ARG, change by that many units." + (interactive "p") + (org-timestamp-change (- (prefix-numeric-value arg)) nil 'updown)) + +(defun org-timestamp-up-day (&optional arg) + "Increase the date in the time stamp by one day. +With prefix ARG, change that many days." + (interactive "p") + (if (and (not (org-at-timestamp-p 'lax)) + (org-at-heading-p)) + (org-todo 'up) + (org-timestamp-change (prefix-numeric-value arg) 'day 'updown))) + +(defun org-timestamp-down-day (&optional arg) + "Decrease the date in the time stamp by one day. +With prefix ARG, change that many days." + (interactive "p") + (if (and (not (org-at-timestamp-p 'lax)) + (org-at-heading-p)) + (org-todo 'down) + (org-timestamp-change (- (prefix-numeric-value arg)) 'day) 'updown)) + +(defun org-at-timestamp-p (&optional extended) + "Non-nil if point is inside a timestamp. + +By default, the function only consider syntactically valid active +timestamps. However, the caller may have a broader definition +for timestamps. As a consequence, optional argument EXTENDED can +be set to the following values + + `inactive' + + Include also syntactically valid inactive timestamps. + + `agenda' + + Include timestamps allowed in Agenda, i.e., those in + properties drawers, planning lines and clock lines. + + `lax' + + Ignore context. The function matches any part of the + document looking like a timestamp. This includes comments, + example blocks... + +For backward-compatibility with Org 9.0, every other non-nil +value is equivalent to `inactive'. + +When at a timestamp, return the position of the point as a symbol +among `bracket', `after', `year', `month', `hour', `minute', +`day' or a number of character from the last know part of the +time stamp. + +When matching, the match groups are the following: + group 1: year + group 2: month + group 3: day number + group 4: day name + group 5: hours, if any + group 6: minutes, if any" + (let* ((regexp (if extended org-ts-regexp3 org-ts-regexp2)) + (pos (point)) + (match? + (let ((boundaries (org-in-regexp regexp))) + (save-match-data + (cond ((null boundaries) nil) + ((eq extended 'lax) t) + (t + (or (and (eq extended 'agenda) + (or (org-at-planning-p) + (org-at-property-p) + (and (bound-and-true-p + org-agenda-include-inactive-timestamps) + (org-at-clock-log-p)))) + (eq 'timestamp + (save-excursion + (when (= pos (cdr boundaries)) (forward-char -1)) + (org-element-type (org-element-context))))))))))) + (cond + ((not match?) nil) + ((= pos (match-beginning 0)) 'bracket) + ;; Distinguish location right before the closing bracket from + ;; right after it. + ((= pos (1- (match-end 0))) 'bracket) + ((= pos (match-end 0)) 'after) + ((org-pos-in-match-range pos 2) 'year) + ((org-pos-in-match-range pos 3) 'month) + ((org-pos-in-match-range pos 7) 'hour) + ((org-pos-in-match-range pos 8) 'minute) + ((or (org-pos-in-match-range pos 4) + (org-pos-in-match-range pos 5)) 'day) + ((and (> pos (or (match-end 8) (match-end 5))) + (< pos (match-end 0))) + (- pos (or (match-end 8) (match-end 5)))) + (t 'day)))) + +(defun org-toggle-timestamp-type () + "Toggle the type (<active> or [inactive]) of a time stamp." + (interactive) + (when (org-at-timestamp-p 'lax) + (let ((beg (match-beginning 0)) (end (match-end 0)) + (map '((?\[ . "<") (?\] . ">") (?< . "[") (?> . "]")))) + (save-excursion + (goto-char beg) + (while (re-search-forward "[][<>]" end t) + (replace-match (cdr (assoc (char-after (match-beginning 0)) map)) + t t))) + (message "Timestamp is now %sactive" + (if (equal (char-after beg) ?<) "" "in"))))) + +(defun org-at-clock-log-p () + "Non-nil if point is on a clock log line." + (and (org-match-line org-clock-line-re) + (eq (org-element-type (save-match-data (org-element-at-point))) 'clock))) + +(defvar org-clock-history) ; defined in org-clock.el +(defvar org-clock-adjust-closest nil) ; defined in org-clock.el +(defun org-timestamp-change (n &optional what updown suppress-tmp-delay) + "Change the date in the time stamp at point. + +The date is changed by N times WHAT. WHAT can be `day', `month', +`year', `hour', or `minute'. If WHAT is not given, the cursor +position in the timestamp determines what is changed. + +When optional argument UPDOWN is non-nil, minutes are rounded +according to `org-time-stamp-rounding-minutes'. + +When SUPPRESS-TMP-DELAY is non-nil, suppress delays like +\"--2d\"." + (let ((origin (point)) + (timestamp? (org-at-timestamp-p 'lax)) + origin-cat + with-hm inactive + (dm (max (nth 1 org-time-stamp-rounding-minutes) 1)) + extra rem + ts time time0 fixnext clrgx) + (unless timestamp? (user-error "Not at a timestamp")) + (if (and (not what) (eq timestamp? 'bracket)) + (org-toggle-timestamp-type) + ;; Point isn't on brackets. Remember the part of the time-stamp + ;; the point was in. Indeed, size of time-stamps may change, + ;; but point must be kept in the same category nonetheless. + (setq origin-cat timestamp?) + (when (and (not what) (not (eq timestamp? 'day)) + org-display-custom-times + (get-text-property (point) 'display) + (not (get-text-property (1- (point)) 'display))) + (setq timestamp? 'day)) + (setq timestamp? (or what timestamp?) + inactive (= (char-after (match-beginning 0)) ?\[) + ts (match-string 0)) + (replace-match "") + (when (string-match + "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?-?[-+][0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)*\\)[]>]" + ts) + (setq extra (match-string 1 ts)) + (when suppress-tmp-delay + (setq extra (replace-regexp-in-string " --[0-9]+[hdwmy]" "" extra)))) + (when (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) + (setq with-hm t)) + (setq time0 (org-parse-time-string ts)) + (when (and updown + (eq timestamp? 'minute) + (not current-prefix-arg)) + ;; This looks like s-up and s-down. Change by one rounding step. + (setq n (* dm (cond ((> n 0) 1) ((< n 0) -1) (t 0)))) + (unless (= 0 (setq rem (% (nth 1 time0) dm))) + (setcar (cdr time0) (+ (nth 1 time0) + (if (> n 0) (- rem) (- dm rem)))))) + (setq time + (apply #'encode-time + (or (car time0) 0) + (+ (if (eq timestamp? 'minute) n 0) (nth 1 time0)) + (+ (if (eq timestamp? 'hour) n 0) (nth 2 time0)) + (+ (if (eq timestamp? 'day) n 0) (nth 3 time0)) + (+ (if (eq timestamp? 'month) n 0) (nth 4 time0)) + (+ (if (eq timestamp? 'year) n 0) (nth 5 time0)) + (nthcdr 6 time0))) + (when (and (memq timestamp? '(hour minute)) + extra + (string-match "-\\([012][0-9]\\):\\([0-5][0-9]\\)" extra)) + (setq extra (org-modify-ts-extra + extra + (if (eq timestamp? 'hour) 2 5) + n dm))) + (when (integerp timestamp?) + (setq extra (org-modify-ts-extra extra timestamp? n dm))) + (when (eq what 'calendar) + (let ((cal-date (org-get-date-from-calendar))) + (setcar (nthcdr 4 time0) (nth 0 cal-date)) ; month + (setcar (nthcdr 3 time0) (nth 1 cal-date)) ; day + (setcar (nthcdr 5 time0) (nth 2 cal-date)) ; year + (setcar time0 (or (car time0) 0)) + (setcar (nthcdr 1 time0) (or (nth 1 time0) 0)) + (setcar (nthcdr 2 time0) (or (nth 2 time0) 0)) + (setq time (apply 'encode-time time0)))) + ;; Insert the new time-stamp, and ensure point stays in the same + ;; category as before (i.e. not after the last position in that + ;; category). + (let ((pos (point))) + ;; Stay before inserted string. `save-excursion' is of no use. + (setq org-last-changed-timestamp + (org-insert-time-stamp time with-hm inactive nil nil extra)) + (goto-char pos)) + (save-match-data + (looking-at org-ts-regexp3) + (goto-char + (pcase origin-cat + ;; `day' category ends before `hour' if any, or at the end + ;; of the day name. + (`day (min (or (match-beginning 7) (1- (match-end 5))) origin)) + (`hour (min (match-end 7) origin)) + (`minute (min (1- (match-end 8)) origin)) + ((pred integerp) (min (1- (match-end 0)) origin)) + ;; Point was right after the time-stamp. However, the + ;; time-stamp length might have changed, so refer to + ;; (match-end 0) instead. + (`after (match-end 0)) + ;; `year' and `month' have both fixed size: point couldn't + ;; have moved into another part. + (_ origin)))) + ;; Update clock if on a CLOCK line. + (org-clock-update-time-maybe) + ;; Maybe adjust the closest clock in `org-clock-history' + (when org-clock-adjust-closest + (if (not (and (org-at-clock-log-p) + (< 1 (length (delq nil (mapcar 'marker-position + org-clock-history)))))) + (message "No clock to adjust") + (cond ((save-excursion ; fix previous clock? + (re-search-backward org-ts-regexp0 nil t) + (looking-back (concat org-clock-string " \\[") + (line-beginning-position))) + (setq fixnext 1 clrgx (concat org-ts-regexp0 "\\] =>.*$"))) + ((save-excursion ; fix next clock? + (re-search-backward org-ts-regexp0 nil t) + (looking-at (concat org-ts-regexp0 "\\] =>"))) + (setq fixnext -1 clrgx (concat org-clock-string " \\[" org-ts-regexp0)))) + (save-window-excursion + ;; Find closest clock to point, adjust the previous/next one in history + (let* ((p (save-excursion (org-back-to-heading t))) + (cl (mapcar (lambda(c) (abs (- (marker-position c) p))) org-clock-history)) + (clfixnth + (+ fixnext (- (length cl) (or (length (member (apply 'min cl) cl)) 100)))) + (clfixpos (unless (> 0 clfixnth) (nth clfixnth org-clock-history)))) + (if (not clfixpos) + (message "No clock to adjust") + (save-excursion + (org-goto-marker-or-bmk clfixpos) + (org-show-subtree) + (when (re-search-forward clrgx nil t) + (goto-char (match-beginning 1)) + (let (org-clock-adjust-closest) + (org-timestamp-change n timestamp? updown)) + (message "Clock adjusted in %s for heading: %s" + (file-name-nondirectory (buffer-file-name)) + (org-get-heading t t))))))))) + ;; Try to recenter the calendar window, if any. + (when (and org-calendar-follow-timestamp-change + (get-buffer-window "*Calendar*" t) + (memq timestamp? '(day month year))) + (org-recenter-calendar (time-to-days time)))))) + +(defun org-modify-ts-extra (s pos n dm) + "Change the different parts of the lead-time and repeat fields in timestamp." + (let ((idx '(("d" . 0) ("w" . 1) ("m" . 2) ("y" . 3) ("d" . -1) ("y" . 4))) + ng h m new rem) + (when (string-match "\\(-\\([012][0-9]\\):\\([0-5][0-9]\\)\\)?\\( +\\+\\([0-9]+\\)\\([dmwy]\\)\\)?\\( +-\\([0-9]+\\)\\([dmwy]\\)\\)?" s) + (cond + ((or (org-pos-in-match-range pos 2) + (org-pos-in-match-range pos 3)) + (setq m (string-to-number (match-string 3 s)) + h (string-to-number (match-string 2 s))) + (if (org-pos-in-match-range pos 2) + (setq h (+ h n)) + (setq n (* dm (with-no-warnings (cl-signum n)))) + (unless (= 0 (setq rem (% m dm))) + (setq m (+ m (if (> n 0) (- rem) (- dm rem))))) + (setq m (+ m n))) + (when (< m 0) (setq m (+ m 60) h (1- h))) + (when (> m 59) (setq m (- m 60) h (1+ h))) + (setq h (mod h 24)) + (setq ng 1 new (format "-%02d:%02d" h m))) + ((org-pos-in-match-range pos 6) + (setq ng 6 new (car (rassoc (+ n (cdr (assoc (match-string 6 s) idx))) idx)))) + ((org-pos-in-match-range pos 5) + (setq ng 5 new (format "%d" (max 1 (+ n (string-to-number (match-string 5 s))))))) + + ((org-pos-in-match-range pos 9) + (setq ng 9 new (car (rassoc (+ n (cdr (assoc (match-string 9 s) idx))) idx)))) + ((org-pos-in-match-range pos 8) + (setq ng 8 new (format "%d" (max 0 (+ n (string-to-number (match-string 8 s)))))))) + + (when ng + (setq s (concat + (substring s 0 (match-beginning ng)) + new + (substring s (match-end ng)))))) + s)) + +(defun org-recenter-calendar (d) + "If the calendar is visible, recenter it to date D." + (let ((cwin (get-buffer-window "*Calendar*" t))) + (when cwin + (let ((calendar-move-hook nil)) + (with-selected-window cwin + (calendar-goto-date + (if (listp d) d (calendar-gregorian-from-absolute d)))))))) + +(defun org-goto-calendar (&optional arg) + "Go to the Emacs calendar at the current date. +If there is a time stamp in the current line, go to that date. +A prefix ARG can be used to force the current date." + (interactive "P") + (let ((calendar-move-hook nil) + (calendar-view-holidays-initially-flag nil) + (calendar-view-diary-initially-flag nil) + diff) + (when (or (org-at-timestamp-p 'lax) + (org-match-line (concat ".*" org-ts-regexp))) + (let ((d1 (time-to-days nil)) + (d2 (time-to-days (org-time-string-to-time (match-string 1))))) + (setq diff (- d2 d1)))) + (calendar) + (calendar-goto-today) + (when (and diff (not arg)) (calendar-forward-day diff)))) + +(defun org-get-date-from-calendar () + "Return a list (month day year) of date at point in calendar." + (with-current-buffer "*Calendar*" + (save-match-data + (calendar-cursor-to-date)))) + +(defun org-date-from-calendar () + "Insert time stamp corresponding to cursor date in *Calendar* buffer. +If there is already a time stamp at the cursor position, update it." + (interactive) + (if (org-at-timestamp-p 'lax) + (org-timestamp-change 0 'calendar) + (let ((cal-date (org-get-date-from-calendar))) + (org-insert-time-stamp + (encode-time 0 0 0 (nth 1 cal-date) (car cal-date) (nth 2 cal-date)))))) + +(defcustom org-image-actual-width t + "When non-nil, use the actual width of images when inlining them. + +When set to a number, use imagemagick (when available) to set the +image's width to this value. + +When set to a number in a list, try to get the width from any +#+ATTR.* keyword if it matches a width specification like + + #+ATTR_HTML: :width 300px + +and fall back on that number if none is found. + +When set to nil, try to get the width from an #+ATTR.* keyword +and fall back on the original width if none is found. + +When set to any other non-nil value, always use the image width. + +This requires Emacs >= 24.1, built with imagemagick support." + :group 'org-appearance + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Use the image width" t) + (integer :tag "Use a number of pixels") + (list :tag "Use #+ATTR* or a number of pixels" (integer)) + (const :tag "Use #+ATTR* or don't resize" nil))) + +(defcustom org-agenda-inhibit-startup nil + "Inhibit startup when preparing agenda buffers. +When this variable is t, the initialization of the Org agenda +buffers is inhibited: e.g. the visibility state is not set, the +tables are not re-aligned, etc." + :type 'boolean + :version "24.3" + :group 'org-agenda) + +(defcustom org-agenda-ignore-properties nil + "Avoid updating text properties when building the agenda. +Properties are used to prepare buffers for effort estimates, +appointments, statistics and subtree-local categories. +If you don't use these in the agenda, you can add them to this +list and agenda building will be a bit faster. +The value is a list, with zero or more of the symbols `effort', `appt', +`stats' or `category'." + :type '(set :greedy t + (const effort) + (const appt) + (const stats) + (const category)) + :version "26.1" + :package-version '(Org . "8.3") + :group 'org-agenda) + +;;;; Files + +(defun org-save-all-org-buffers () + "Save all Org buffers without user confirmation." + (interactive) + (message "Saving all Org buffers...") + (save-some-buffers t (lambda () (and (derived-mode-p 'org-mode) t))) + (when (featurep 'org-id) (org-id-locations-save)) + (message "Saving all Org buffers... done")) + +(defun org-revert-all-org-buffers () + "Revert all Org buffers. +Prompt for confirmation when there are unsaved changes. +Be sure you know what you are doing before letting this function +overwrite your changes. + +This function is useful in a setup where one tracks Org files +with a version control system, to revert on one machine after pulling +changes from another. I believe the procedure must be like this: + +1. \\[org-save-all-org-buffers] +2. Pull changes from the other machine, resolve conflicts +3. \\[org-revert-all-org-buffers]" + (interactive) + (unless (yes-or-no-p "Revert all Org buffers from their files? ") + (user-error "Abort")) + (save-excursion + (save-window-excursion + (dolist (b (buffer-list)) + (when (and (with-current-buffer b (derived-mode-p 'org-mode)) + (with-current-buffer b buffer-file-name)) + (pop-to-buffer-same-window b) + (revert-buffer t 'no-confirm))) + (when (and (featurep 'org-id) org-id-track-globally) + (org-id-locations-load))))) + +;;;; Agenda files + +;;;###autoload +(defun org-switchb (&optional arg) + "Switch between Org buffers. + +With `\\[universal-argument]' prefix, restrict available buffers to files. + +With `\\[universal-argument] \\[universal-argument]' \ +prefix, restrict available buffers to agenda files." + (interactive "P") + (let ((blist (org-buffer-list + (cond ((equal arg '(4)) 'files) + ((equal arg '(16)) 'agenda))))) + (pop-to-buffer-same-window + (completing-read "Org buffer: " + (mapcar #'list (mapcar #'buffer-name blist)) + nil t)))) + +(defun org-buffer-list (&optional predicate exclude-tmp) + "Return a list of Org buffers. +PREDICATE can be `export', `files' or `agenda'. + +export restrict the list to Export buffers. +files restrict the list to buffers visiting Org files. +agenda restrict the list to buffers visiting agenda files. + +If EXCLUDE-TMP is non-nil, ignore temporary buffers." + (let* ((bfn nil) + (agenda-files (and (eq predicate 'agenda) + (mapcar 'file-truename (org-agenda-files t)))) + (filter + (cond + ((eq predicate 'files) + (lambda (b) (with-current-buffer b (derived-mode-p 'org-mode)))) + ((eq predicate 'export) + (lambda (b) (string-match "\\*Org .*Export" (buffer-name b)))) + ((eq predicate 'agenda) + (lambda (b) + (with-current-buffer b + (and (derived-mode-p 'org-mode) + (setq bfn (buffer-file-name b)) + (member (file-truename bfn) agenda-files))))) + (t (lambda (b) (with-current-buffer b + (or (derived-mode-p 'org-mode) + (string-match "\\*Org .*Export" + (buffer-name b))))))))) + (delq nil + (mapcar + (lambda(b) + (if (and (funcall filter b) + (or (not exclude-tmp) + (not (string-match "tmp" (buffer-name b))))) + b + nil)) + (buffer-list))))) + +(defun org-agenda-files (&optional unrestricted archives) + "Get the list of agenda files. +Optional UNRESTRICTED means return the full list even if a restriction +is currently in place. +When ARCHIVES is t, include all archive files that are really being +used by the agenda files. If ARCHIVE is `ifmode', do this only if +`org-agenda-archives-mode' is t." + (let ((files + (cond + ((and (not unrestricted) (get 'org-agenda-files 'org-restrict))) + ((stringp org-agenda-files) (org-read-agenda-file-list)) + ((listp org-agenda-files) org-agenda-files) + (t (error "Invalid value of `org-agenda-files'"))))) + (setq files (apply 'append + (mapcar (lambda (f) + (if (file-directory-p f) + (directory-files + f t org-agenda-file-regexp) + (list (expand-file-name f org-directory)))) + files))) + (when org-agenda-skip-unavailable-files + (setq files (delq nil + (mapcar (lambda (file) + (and (file-readable-p file) file)) + files)))) + (when (or (eq archives t) + (and (eq archives 'ifmode) (eq org-agenda-archives-mode t))) + (setq files (org-add-archive-files files))) + files)) + +(defun org-agenda-file-p (&optional file) + "Return non-nil, if FILE is an agenda file. +If FILE is omitted, use the file associated with the current +buffer." + (let ((fname (or file (buffer-file-name)))) + (and fname + (member (file-truename fname) + (mapcar #'file-truename (org-agenda-files t)))))) + +(defun org-edit-agenda-file-list () + "Edit the list of agenda files. +Depending on setup, this either uses customize to edit the variable +`org-agenda-files', or it visits the file that is holding the list. In the +latter case, the buffer is set up in a way that saving it automatically kills +the buffer and restores the previous window configuration." + (interactive) + (if (stringp org-agenda-files) + (let ((cw (current-window-configuration))) + (find-file org-agenda-files) + (setq-local org-window-configuration cw) + (add-hook 'after-save-hook + (lambda () + (set-window-configuration + (prog1 org-window-configuration + (kill-buffer (current-buffer)))) + (org-install-agenda-files-menu) + (message "New agenda file list installed")) + nil 'local) + (message "%s" (substitute-command-keys + "Edit list and finish with \\[save-buffer]"))) + (customize-variable 'org-agenda-files))) + +(defun org-store-new-agenda-file-list (list) + "Set new value for the agenda file list and save it correctly." + (if (stringp org-agenda-files) + (let ((fe (org-read-agenda-file-list t)) b u) + (while (setq b (find-buffer-visiting org-agenda-files)) + (kill-buffer b)) + (with-temp-file org-agenda-files + (insert + (mapconcat + (lambda (f) ;; Keep un-expanded entries. + (if (setq u (assoc f fe)) + (cdr u) + f)) + list "\n") + "\n"))) + (let ((org-mode-hook nil) (org-inhibit-startup t) + (org-insert-mode-line-in-empty-file nil)) + (setq org-agenda-files list) + (customize-save-variable 'org-agenda-files org-agenda-files)))) + +(defun org-read-agenda-file-list (&optional pair-with-expansion) + "Read the list of agenda files from a file. +If PAIR-WITH-EXPANSION is t return pairs with un-expanded +filenames, used by `org-store-new-agenda-file-list' to write back +un-expanded file names." + (when (file-directory-p org-agenda-files) + (error "`org-agenda-files' cannot be a single directory")) + (when (stringp org-agenda-files) + (with-temp-buffer + (insert-file-contents org-agenda-files) + (mapcar + (lambda (f) + (let ((e (expand-file-name (substitute-in-file-name f) + org-directory))) + (if pair-with-expansion + (cons e f) + e))) + (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*"))))) + +;;;###autoload +(defun org-cycle-agenda-files () + "Cycle through the files in `org-agenda-files'. +If the current buffer visits an agenda file, find the next one in the list. +If the current buffer does not, find the first agenda file." + (interactive) + (let* ((fs (or (org-agenda-files t) + (user-error "No agenda files"))) + (files (copy-sequence fs)) + (tcf (and buffer-file-name (file-truename buffer-file-name))) + file) + (when tcf + (while (and (setq file (pop files)) + (not (equal (file-truename file) tcf))))) + (find-file (car (or files fs))) + (when (buffer-base-buffer) (pop-to-buffer-same-window (buffer-base-buffer))))) + +(defun org-agenda-file-to-front (&optional to-end) + "Move/add the current file to the top of the agenda file list. +If the file is not present in the list, it is added to the front. If it is +present, it is moved there. With optional argument TO-END, add/move to the +end of the list." + (interactive "P") + (let ((org-agenda-skip-unavailable-files nil) + (file-alist (mapcar (lambda (x) + (cons (file-truename x) x)) + (org-agenda-files t))) + (ctf (file-truename + (or buffer-file-name + (user-error "Please save the current buffer to a file")))) + x had) + (setq x (assoc ctf file-alist) had x) + + (unless x (setq x (cons ctf (abbreviate-file-name buffer-file-name)))) + (if to-end + (setq file-alist (append (delq x file-alist) (list x))) + (setq file-alist (cons x (delq x file-alist)))) + (org-store-new-agenda-file-list (mapcar 'cdr file-alist)) + (org-install-agenda-files-menu) + (message "File %s to %s of agenda file list" + (if had "moved" "added") (if to-end "end" "front")))) + +(defun org-remove-file (&optional file) + "Remove current file from the list of files in variable `org-agenda-files'. +These are the files which are being checked for agenda entries. +Optional argument FILE means use this file instead of the current." + (interactive) + (let* ((org-agenda-skip-unavailable-files nil) + (file (or file buffer-file-name + (user-error "Current buffer does not visit a file"))) + (true-file (file-truename file)) + (afile (abbreviate-file-name file)) + (files (delq nil (mapcar + (lambda (x) + (unless (equal true-file + (file-truename x)) + x)) + (org-agenda-files t))))) + (if (not (= (length files) (length (org-agenda-files t)))) + (progn + (org-store-new-agenda-file-list files) + (org-install-agenda-files-menu) + (message "Removed from Org Agenda list: %s" afile)) + (message "File was not in list: %s (not removed)" afile)))) + +(defun org-file-menu-entry (file) + (vector file (list 'find-file file) t)) + +(defun org-check-agenda-file (file) + "Make sure FILE exists. If not, ask user what to do." + (unless (file-exists-p file) + (message "Non-existent agenda file %s. [R]emove from list or [A]bort?" + (abbreviate-file-name file)) + (let ((r (downcase (read-char-exclusive)))) + (cond + ((equal r ?r) + (org-remove-file file) + (throw 'nextfile t)) + (t (user-error "Abort")))))) + +(defun org-get-agenda-file-buffer (file) + "Get an agenda buffer visiting FILE. +If the buffer needs to be created, add it to the list of buffers +which might be released later." + (let ((buf (org-find-base-buffer-visiting file))) + (if buf + buf ; just return it + ;; Make a new buffer and remember it + (setq buf (find-file-noselect file)) + (when buf (push buf org-agenda-new-buffers)) + buf))) + +(defun org-release-buffers (blist) + "Release all buffers in list, asking the user for confirmation when needed. +When a buffer is unmodified, it is just killed. When modified, it is saved +\(if the user agrees) and then killed." + (let (file) + (dolist (buf blist) + (setq file (buffer-file-name buf)) + (when (and (buffer-modified-p buf) + file + (y-or-n-p (format "Save file %s? " file))) + (with-current-buffer buf (save-buffer))) + (kill-buffer buf)))) + +(defun org-agenda-prepare-buffers (files) + "Create buffers for all agenda files, protect archived trees and comments." + (interactive) + (let ((pa '(:org-archived t)) + (pc '(:org-comment t)) + (pall '(:org-archived t :org-comment t)) + (inhibit-read-only t) + (org-inhibit-startup org-agenda-inhibit-startup) + (rea (org-make-tag-string (list org-archive-tag))) + re pos) + (setq org-tag-alist-for-agenda nil + org-tag-groups-alist-for-agenda nil) + (save-excursion + (save-restriction + (dolist (file files) + (catch 'nextfile + (if (bufferp file) + (set-buffer file) + (org-check-agenda-file file) + (set-buffer (org-get-agenda-file-buffer file))) + (widen) + (org-set-regexps-and-options 'tags-only) + (setq pos (point)) + (or (memq 'category org-agenda-ignore-properties) + (org-refresh-category-properties)) + (or (memq 'stats org-agenda-ignore-properties) + (org-refresh-stats-properties)) + (or (memq 'effort org-agenda-ignore-properties) + (org-refresh-effort-properties)) + (or (memq 'appt org-agenda-ignore-properties) + (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime)) + (setq org-todo-keywords-for-agenda + (append org-todo-keywords-for-agenda org-todo-keywords-1)) + (setq org-done-keywords-for-agenda + (append org-done-keywords-for-agenda org-done-keywords)) + (setq org-todo-keyword-alist-for-agenda + (append org-todo-keyword-alist-for-agenda org-todo-key-alist)) + (setq org-tag-alist-for-agenda + (org--tag-add-to-alist + org-tag-alist-for-agenda + org-current-tag-alist)) + ;; Merge current file's tag groups into global + ;; `org-tag-groups-alist-for-agenda'. + (when org-group-tags + (dolist (alist org-tag-groups-alist) + (let ((old (assoc (car alist) org-tag-groups-alist-for-agenda))) + (if old + (setcdr old (org-uniquify (append (cdr old) (cdr alist)))) + (push alist org-tag-groups-alist-for-agenda))))) + (with-silent-modifications + (save-excursion + (remove-text-properties (point-min) (point-max) pall) + (when org-agenda-skip-archived-trees + (goto-char (point-min)) + (while (re-search-forward rea nil t) + (when (org-at-heading-p t) + (add-text-properties (point-at-bol) (org-end-of-subtree t) pa)))) + (goto-char (point-min)) + (setq re (format "^\\*+ .*\\<%s\\>" org-comment-string)) + (while (re-search-forward re nil t) + (when (save-match-data (org-in-commented-heading-p t)) + (add-text-properties + (match-beginning 0) (org-end-of-subtree t) pc))))) + (goto-char pos))))) + (setq org-todo-keywords-for-agenda + (org-uniquify org-todo-keywords-for-agenda)) + (setq org-todo-keyword-alist-for-agenda + (org-uniquify org-todo-keyword-alist-for-agenda)))) + + +;;;; CDLaTeX minor mode + +(defvar org-cdlatex-mode-map (make-sparse-keymap) + "Keymap for the minor `org-cdlatex-mode'.") + +(org-defkey org-cdlatex-mode-map (kbd "_") #'org-cdlatex-underscore-caret) +(org-defkey org-cdlatex-mode-map (kbd "^") #'org-cdlatex-underscore-caret) +(org-defkey org-cdlatex-mode-map (kbd "`") #'cdlatex-math-symbol) +(org-defkey org-cdlatex-mode-map (kbd "'") #'org-cdlatex-math-modify) +(org-defkey org-cdlatex-mode-map (kbd "C-c {") #'org-cdlatex-environment-indent) + +(defvar org-cdlatex-texmathp-advice-is-done nil + "Flag remembering if we have applied the advice to texmathp already.") + +(define-minor-mode org-cdlatex-mode + "Toggle the minor `org-cdlatex-mode'. +This mode supports entering LaTeX environment and math in LaTeX fragments +in Org mode. +\\{org-cdlatex-mode-map}" + :lighter " OCDL" + (when org-cdlatex-mode + (require 'cdlatex) + (run-hooks 'cdlatex-mode-hook) + (cdlatex-compute-tables)) + (unless org-cdlatex-texmathp-advice-is-done + (setq org-cdlatex-texmathp-advice-is-done t) + (defadvice texmathp (around org-math-always-on activate) + "Always return t in Org buffers. +This is because we want to insert math symbols without dollars even outside +the LaTeX math segments. If Org mode thinks that point is actually inside +an embedded LaTeX fragment, let `texmathp' do its job. +`\\[org-cdlatex-mode-map]'" + (interactive) + (let (p) + (cond + ((not (derived-mode-p 'org-mode)) ad-do-it) + ((eq this-command 'cdlatex-math-symbol) + (setq ad-return-value t + texmathp-why '("cdlatex-math-symbol in org-mode" . 0))) + (t + (let ((p (org-inside-LaTeX-fragment-p))) + (if (and p (member (car p) (plist-get org-format-latex-options :matchers))) + (setq ad-return-value t + texmathp-why '("Org mode embedded math" . 0)) + (when p ad-do-it))))))))) + +(defun turn-on-org-cdlatex () + "Unconditionally turn on `org-cdlatex-mode'." + (org-cdlatex-mode 1)) + +(defun org-try-cdlatex-tab () + "Check if it makes sense to execute `cdlatex-tab', and do it if yes. +It makes sense to do so if `org-cdlatex-mode' is active and if the cursor is + - inside a LaTeX fragment, or + - after the first word in a line, where an abbreviation expansion could + insert a LaTeX environment." + (when org-cdlatex-mode + (cond + ;; Before any word on the line: No expansion possible. + ((save-excursion (skip-chars-backward " \t") (bolp)) nil) + ;; Just after first word on the line: Expand it. Make sure it + ;; cannot happen on headlines, though. + ((save-excursion + (skip-chars-backward "a-zA-Z0-9*") + (skip-chars-backward " \t") + (and (bolp) (not (org-at-heading-p)))) + (cdlatex-tab) t) + ((org-inside-LaTeX-fragment-p) (cdlatex-tab) t)))) + +(defun org-cdlatex-underscore-caret (&optional _arg) + "Execute `cdlatex-sub-superscript' in LaTeX fragments. +Revert to the normal definition outside of these fragments." + (interactive "P") + (if (org-inside-LaTeX-fragment-p) + (call-interactively 'cdlatex-sub-superscript) + (let (org-cdlatex-mode) + (call-interactively (key-binding (vector last-input-event)))))) + +(defun org-cdlatex-math-modify (&optional _arg) + "Execute `cdlatex-math-modify' in LaTeX fragments. +Revert to the normal definition outside of these fragments." + (interactive "P") + (if (org-inside-LaTeX-fragment-p) + (call-interactively 'cdlatex-math-modify) + (let (org-cdlatex-mode) + (call-interactively (key-binding (vector last-input-event)))))) + +(defun org-cdlatex-environment-indent (&optional environment item) + "Execute `cdlatex-environment' and indent the inserted environment. + +ENVIRONMENT and ITEM are passed to `cdlatex-environment'. + +The inserted environment is indented to current indentation +unless point is at the beginning of the line, in which the +environment remains unintended." + (interactive) + ;; cdlatex-environment always return nil. Therefore, capture output + ;; first and determine if an environment was selected. + (let* ((beg (point-marker)) + (end (copy-marker (point) t)) + (inserted (progn + (ignore-errors (cdlatex-environment environment item)) + (< beg end))) + ;; Figure out how many lines to move forward after the + ;; environment has been inserted. + (lines (when inserted + (save-excursion + (- (cl-loop while (< beg (point)) + with x = 0 + do (forward-line -1) + (cl-incf x) + finally return x) + (if (progn (goto-char beg) + (and (progn (skip-chars-forward " \t") (eolp)) + (progn (skip-chars-backward " \t") (bolp)))) + 1 0))))) + (env (org-trim (delete-and-extract-region beg end)))) + (when inserted + ;; Get indentation of next line unless at column 0. + (let ((ind (if (bolp) 0 + (save-excursion + (org-return t) + (prog1 (current-indentation) + (when (progn (skip-chars-forward " \t") (eolp)) + (delete-region beg (point))))))) + (bol (progn (skip-chars-backward " \t") (bolp)))) + ;; Insert a newline before environment unless at column zero + ;; to "escape" the current line. Insert a newline if + ;; something is one the same line as \end{ENVIRONMENT}. + (insert + (concat (unless bol "\n") env + (when (and (skip-chars-forward " \t") (not (eolp))) "\n"))) + (unless (zerop ind) + (save-excursion + (goto-char beg) + (while (< (point) end) + (unless (eolp) (indent-line-to ind)) + (forward-line)))) + (goto-char beg) + (forward-line lines) + (indent-line-to ind))) + (set-marker beg nil) + (set-marker end nil))) + + +;;;; LaTeX fragments + +(defun org-inside-LaTeX-fragment-p () + "Test if point is inside a LaTeX fragment. +I.e. after a \\begin, \\(, \\[, $, or $$, without the corresponding closing +sequence appearing also before point. +Even though the matchers for math are configurable, this function assumes +that \\begin, \\(, \\[, and $$ are always used. Only the single dollar +delimiters are skipped when they have been removed by customization. +The return value is nil, or a cons cell with the delimiter and the +position of this delimiter. + +This function does a reasonably good job, but can locally be fooled by +for example currency specifications. For example it will assume being in +inline math after \"$22.34\". The LaTeX fragment formatter will only format +fragments that are properly closed, but during editing, we have to live +with the uncertainty caused by missing closing delimiters. This function +looks only before point, not after." + (catch 'exit + (let ((pos (point)) + (dodollar (member "$" (plist-get org-format-latex-options :matchers))) + (lim (progn + (re-search-backward (concat "^\\(" paragraph-start "\\)") nil + 'move) + (point))) + dd-on str (start 0) m re) + (goto-char pos) + (when dodollar + (setq str (concat (buffer-substring lim (point)) "\000 X$.") + re (nth 1 (assoc "$" org-latex-regexps))) + (while (string-match re str start) + (cond + ((= (match-end 0) (length str)) + (throw 'exit (cons "$" (+ lim (match-beginning 0) 1)))) + ((= (match-end 0) (- (length str) 5)) + (throw 'exit nil)) + (t (setq start (match-end 0)))))) + (when (setq m (re-search-backward "\\(\\\\begin{[^}]*}\\|\\\\(\\|\\\\\\[\\)\\|\\(\\\\end{[^}]*}\\|\\\\)\\|\\\\\\]\\)\\|\\(\\$\\$\\)" lim t)) + (goto-char pos) + (and (match-beginning 1) (throw 'exit (cons (match-string 1) m))) + (and (match-beginning 2) (throw 'exit nil)) + ;; count $$ + (while (re-search-backward "\\$\\$" lim t) + (setq dd-on (not dd-on))) + (goto-char pos) + (when dd-on (cons "$$" m)))))) + +(defun org-inside-latex-macro-p () + "Is point inside a LaTeX macro or its arguments?" + (save-match-data + (org-in-regexp + "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*"))) + +(defun org--make-preview-overlay (beg end image &optional imagetype) + "Build an overlay between BEG and END using IMAGE file. +Argument IMAGETYPE is the extension of the displayed image, +as a string. It defaults to \"png\"." + (let ((ov (make-overlay beg end)) + (imagetype (or (intern imagetype) 'png))) + (overlay-put ov 'org-overlay-type 'org-latex-overlay) + (overlay-put ov 'evaporate t) + (overlay-put ov + 'modification-hooks + (list (lambda (o _flag _beg _end &optional _l) + (delete-overlay o)))) + (overlay-put ov + 'display + (list 'image :type imagetype :file image :ascent 'center)))) + +(defun org-clear-latex-preview (&optional beg end) + "Remove all overlays with LaTeX fragment images in current buffer. +When optional arguments BEG and END are non-nil, remove all +overlays between them instead. Return a non-nil value when some +overlays were removed, nil otherwise." + (let ((overlays + (cl-remove-if-not + (lambda (o) (eq (overlay-get o 'org-overlay-type) 'org-latex-overlay)) + (overlays-in (or beg (point-min)) (or end (point-max)))))) + (mapc #'delete-overlay overlays) + overlays)) + +(defun org--latex-preview-region (beg end) + "Preview LaTeX fragments between BEG and END. +BEG and END are buffer positions." + (let ((file (buffer-file-name (buffer-base-buffer)))) + (save-excursion + (org-format-latex + (concat org-preview-latex-image-directory "org-ltximg") + beg end + ;; Emacs cannot overlay images from remote hosts. Create it in + ;; `temporary-file-directory' instead. + (if (or (not file) (file-remote-p file)) + temporary-file-directory + default-directory) + 'overlays nil 'forbuffer org-preview-latex-default-process)))) + +(defun org-latex-preview (&optional arg) + "Toggle preview of the LaTeX fragment at point. + +If the cursor is on a LaTeX fragment, create the image and +overlay it over the source code, if there is none. Remove it +otherwise. If there is no fragment at point, display images for +all fragments in the current section. + +With a `\\[universal-argument]' prefix argument ARG, clear images \ +for all fragments +in the current section. + +With a `\\[universal-argument] \\[universal-argument]' prefix \ +argument ARG, display image for all +fragments in the buffer. + +With a `\\[universal-argument] \\[universal-argument] \ +\\[universal-argument]' prefix argument ARG, clear image for all +fragments in the buffer." + (interactive "P") + (cond + ((not (display-graphic-p)) nil) + ;; Clear whole buffer. + ((equal arg '(64)) + (org-clear-latex-preview (point-min) (point-max)) + (message "LaTeX previews removed from buffer")) + ;; Preview whole buffer. + ((equal arg '(16)) + (message "Creating LaTeX previews in buffer...") + (org--latex-preview-region (point-min) (point-max)) + (message "Creating LaTeX previews in buffer... done.")) + ;; Clear current section. + ((equal arg '(4)) + (org-clear-latex-preview + (if (org-before-first-heading-p) (point-min) + (save-excursion + (org-with-limited-levels (org-back-to-heading t) (point)))) + (org-with-limited-levels (org-entry-end-position)))) + ;; Toggle preview on LaTeX code at point. + ((let ((datum (org-element-context))) + (and (memq (org-element-type datum) '(latex-environment latex-fragment)) + (let ((beg (org-element-property :begin datum)) + (end (org-element-property :end datum))) + (if (org-clear-latex-preview beg end) + (message "LaTeX preview removed") + (message "Creating LaTeX preview...") + (org--latex-preview-region beg end) + (message "Creating LaTeX preview... done.")) + t)))) + ;; Preview current section. + (t + (let ((beg (if (org-before-first-heading-p) (point-min) + (save-excursion + (org-with-limited-levels (org-back-to-heading t) (point))))) + (end (org-with-limited-levels (org-entry-end-position)))) + (message "Creating LaTeX previews in section...") + (org--latex-preview-region beg end) + (message "Creating LaTeX previews in section... done."))))) + +(defun org-format-latex + (prefix &optional beg end dir overlays msg forbuffer processing-type) + "Replace LaTeX fragments with links to an image. + +The function takes care of creating the replacement image. + +Only consider fragments between BEG and END when those are +provided. + +When optional argument OVERLAYS is non-nil, display the image on +top of the fragment instead of replacing it. + +PROCESSING-TYPE is the conversion method to use, as a symbol. + +Some of the options can be changed using the variable +`org-format-latex-options', which see." + (when (and overlays (fboundp 'clear-image-cache)) (clear-image-cache)) + (unless (eq processing-type 'verbatim) + (let* ((math-regexp "\\$\\|\\\\[([]\\|^[ \t]*\\\\begin{[A-Za-z0-9*]+}") + (cnt 0) + checkdir-flag) + (goto-char (or beg (point-min))) + ;; Optimize overlay creation: (info "(elisp) Managing Overlays"). + (when (and overlays (memq processing-type '(dvipng imagemagick))) + (overlay-recenter (or end (point-max)))) + (while (re-search-forward math-regexp end t) + (unless (and overlays + (eq (get-char-property (point) 'org-overlay-type) + 'org-latex-overlay)) + (let* ((context (org-element-context)) + (type (org-element-type context))) + (when (memq type '(latex-environment latex-fragment)) + (let ((block-type (eq type 'latex-environment)) + (value (org-element-property :value context)) + (beg (org-element-property :begin context)) + (end (save-excursion + (goto-char (org-element-property :end context)) + (skip-chars-backward " \r\t\n") + (point)))) + (cond + ((eq processing-type 'mathjax) + ;; Prepare for MathJax processing. + (if (not (string-match "\\`\\$\\$?" value)) + (goto-char end) + (delete-region beg end) + (if (string= (match-string 0 value) "$$") + (insert "\\[" (substring value 2 -2) "\\]") + (insert "\\(" (substring value 1 -1) "\\)")))) + ((eq processing-type 'html) + (goto-char beg) + (delete-region beg end) + (insert (org-format-latex-as-html value))) + ((assq processing-type org-preview-latex-process-alist) + ;; Process to an image. + (cl-incf cnt) + (goto-char beg) + (let* ((processing-info + (cdr (assq processing-type org-preview-latex-process-alist))) + (face (face-at-point)) + ;; Get the colors from the face at point. + (fg + (let ((color (plist-get org-format-latex-options + :foreground))) + (if forbuffer + (cond + ((eq color 'auto) + (face-attribute face :foreground nil 'default)) + ((eq color 'default) + (face-attribute 'default :foreground nil)) + (t color)) + color))) + (bg + (let ((color (plist-get org-format-latex-options + :background))) + (if forbuffer + (cond + ((eq color 'auto) + (face-attribute face :background nil 'default)) + ((eq color 'default) + (face-attribute 'default :background nil)) + (t color)) + color))) + (hash (sha1 (prin1-to-string + (list org-format-latex-header + org-latex-default-packages-alist + org-latex-packages-alist + org-format-latex-options + forbuffer value fg bg)))) + (imagetype (or (plist-get processing-info :image-output-type) "png")) + (absprefix (expand-file-name prefix dir)) + (linkfile (format "%s_%s.%s" prefix hash imagetype)) + (movefile (format "%s_%s.%s" absprefix hash imagetype)) + (sep (and block-type "\n\n")) + (link (concat sep "[[file:" linkfile "]]" sep)) + (options + (org-combine-plists + org-format-latex-options + `(:foreground ,fg :background ,bg)))) + (when msg (message msg cnt)) + (unless checkdir-flag ; Ensure the directory exists. + (setq checkdir-flag t) + (let ((todir (file-name-directory absprefix))) + (unless (file-directory-p todir) + (make-directory todir t)))) + (unless (file-exists-p movefile) + (org-create-formula-image + value movefile options forbuffer processing-type)) + (if overlays + (progn + (dolist (o (overlays-in beg end)) + (when (eq (overlay-get o 'org-overlay-type) + 'org-latex-overlay) + (delete-overlay o))) + (org--make-preview-overlay beg end movefile imagetype) + (goto-char end)) + (delete-region beg end) + (insert + (org-add-props link + (list 'org-latex-src + (replace-regexp-in-string "\"" "" value) + 'org-latex-src-embed-type + (if block-type 'paragraph 'character))))))) + ((eq processing-type 'mathml) + ;; Process to MathML. + (unless (org-format-latex-mathml-available-p) + (user-error "LaTeX to MathML converter not configured")) + (cl-incf cnt) + (when msg (message msg cnt)) + (goto-char beg) + (delete-region beg end) + (insert (org-format-latex-as-mathml + value block-type prefix dir))) + (t + (error "Unknown conversion process %s for LaTeX fragments" + processing-type))))))))))) + +(defun org-create-math-formula (latex-frag &optional mathml-file) + "Convert LATEX-FRAG to MathML and store it in MATHML-FILE. +Use `org-latex-to-mathml-convert-command'. If the conversion is +successful, return the portion between \"<math...> </math>\" +elements otherwise return nil. When MATHML-FILE is specified, +write the results in to that file. When invoked as an +interactive command, prompt for LATEX-FRAG, with initial value +set to the current active region and echo the results for user +inspection." + (interactive (list (let ((frag (when (org-region-active-p) + (buffer-substring-no-properties + (region-beginning) (region-end))))) + (read-string "LaTeX Fragment: " frag nil frag)))) + (unless latex-frag (user-error "Invalid LaTeX fragment")) + (let* ((tmp-in-file + (let ((file (file-relative-name + (make-temp-name (expand-file-name "ltxmathml-in"))))) + (write-region latex-frag nil file) + file)) + (tmp-out-file (file-relative-name + (make-temp-name (expand-file-name "ltxmathml-out")))) + (cmd (format-spec + org-latex-to-mathml-convert-command + `((?j . ,(and org-latex-to-mathml-jar-file + (shell-quote-argument + (expand-file-name + org-latex-to-mathml-jar-file)))) + (?I . ,(shell-quote-argument tmp-in-file)) + (?i . ,latex-frag) + (?o . ,(shell-quote-argument tmp-out-file))))) + mathml shell-command-output) + (when (called-interactively-p 'any) + (unless (org-format-latex-mathml-available-p) + (user-error "LaTeX to MathML converter not configured"))) + (message "Running %s" cmd) + (setq shell-command-output (shell-command-to-string cmd)) + (setq mathml + (when (file-readable-p tmp-out-file) + (with-current-buffer (find-file-noselect tmp-out-file t) + (goto-char (point-min)) + (when (re-search-forward + (format "<math[^>]*?%s[^>]*?>\\(.\\|\n\\)*</math>" + (regexp-quote + "xmlns=\"http://www.w3.org/1998/Math/MathML\"")) + nil t) + (prog1 (match-string 0) (kill-buffer)))))) + (cond + (mathml + (setq mathml + (concat "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" mathml)) + (when mathml-file + (write-region mathml nil mathml-file)) + (when (called-interactively-p 'any) + (message mathml))) + ((warn "LaTeX to MathML conversion failed") + (message shell-command-output))) + (delete-file tmp-in-file) + (when (file-exists-p tmp-out-file) + (delete-file tmp-out-file)) + mathml)) + +(defun org-format-latex-as-mathml (latex-frag latex-frag-type + prefix &optional dir) + "Use `org-create-math-formula' but check local cache first." + (let* ((absprefix (expand-file-name prefix dir)) + (print-length nil) (print-level nil) + (formula-id (concat + "formula-" + (sha1 + (prin1-to-string + (list latex-frag + org-latex-to-mathml-convert-command))))) + (formula-cache (format "%s-%s.mathml" absprefix formula-id)) + (formula-cache-dir (file-name-directory formula-cache))) + + (unless (file-directory-p formula-cache-dir) + (make-directory formula-cache-dir t)) + + (unless (file-exists-p formula-cache) + (org-create-math-formula latex-frag formula-cache)) + + (if (file-exists-p formula-cache) + ;; Successful conversion. Return the link to MathML file. + (org-add-props + (format "[[file:%s]]" (file-relative-name formula-cache dir)) + (list 'org-latex-src (replace-regexp-in-string "\"" "" latex-frag) + 'org-latex-src-embed-type (if latex-frag-type + 'paragraph 'character))) + ;; Failed conversion. Return the LaTeX fragment verbatim + latex-frag))) + +(defun org-format-latex-as-html (latex-fragment) + "Convert LATEX-FRAGMENT to HTML. +This uses `org-latex-to-html-convert-command', which see." + (let ((cmd (format-spec org-latex-to-html-convert-command + `((?i . ,latex-fragment))))) + (message "Running %s" cmd) + (shell-command-to-string cmd))) + +(defun org--get-display-dpi () + "Get the DPI of the display. +The function assumes that the display has the same pixel width in +the horizontal and vertical directions." + (if (display-graphic-p) + (round (/ (display-pixel-height) + (/ (display-mm-height) 25.4))) + (error "Attempt to calculate the dpi of a non-graphic display"))) + +(defun org-create-formula-image + (string tofile options buffer &optional processing-type) + "Create an image from LaTeX source using external processes. + +The LaTeX STRING is saved to a temporary LaTeX file, then +converted to an image file by process PROCESSING-TYPE defined in +`org-preview-latex-process-alist'. A nil value defaults to +`org-preview-latex-default-process'. + +The generated image file is eventually moved to TOFILE. + +The OPTIONS argument controls the size, foreground color and +background color of the generated image. + +When BUFFER non-nil, this function is used for LaTeX previewing. +Otherwise, it is used to deal with LaTeX snippets showed in +a HTML file." + (let* ((processing-type (or processing-type + org-preview-latex-default-process)) + (processing-info + (cdr (assq processing-type org-preview-latex-process-alist))) + (programs (plist-get processing-info :programs)) + (error-message (or (plist-get processing-info :message) "")) + (image-input-type (plist-get processing-info :image-input-type)) + (image-output-type (plist-get processing-info :image-output-type)) + (post-clean (or (plist-get processing-info :post-clean) + '(".dvi" ".xdv" ".pdf" ".tex" ".aux" ".log" + ".svg" ".png" ".jpg" ".jpeg" ".out"))) + (latex-header + (or (plist-get processing-info :latex-header) + (org-latex-make-preamble + (org-export-get-environment (org-export-get-backend 'latex)) + org-format-latex-header + 'snippet))) + (latex-compiler (plist-get processing-info :latex-compiler)) + (image-converter (plist-get processing-info :image-converter)) + (tmpdir temporary-file-directory) + (texfilebase (make-temp-name + (expand-file-name "orgtex" tmpdir))) + (texfile (concat texfilebase ".tex")) + (image-size-adjust (or (plist-get processing-info :image-size-adjust) + '(1.0 . 1.0))) + (scale (* (if buffer (car image-size-adjust) (cdr image-size-adjust)) + (or (plist-get options (if buffer :scale :html-scale)) 1.0))) + (dpi (* scale (if buffer (org--get-display-dpi) 140.0))) + (fg (or (plist-get options (if buffer :foreground :html-foreground)) + "Black")) + (bg (or (plist-get options (if buffer :background :html-background)) + "Transparent")) + (log-buf (get-buffer-create "*Org Preview LaTeX Output*")) + (resize-mini-windows nil)) ;Fix Emacs flicker when creating image. + (dolist (program programs) + (org-check-external-command program error-message)) + (if (eq fg 'default) + (setq fg (org-latex-color :foreground)) + (setq fg (org-latex-color-format fg))) + (setq bg (cond + ((eq bg 'default) (org-latex-color :background)) + ((string= bg "Transparent") nil) + (t (org-latex-color-format bg)))) + ;; Remove TeX \par at end of snippet to avoid trailing space. + (if (string-suffix-p string "\n") + (aset string (1- (length string)) ?%) + (setq string (concat string "%"))) + (with-temp-file texfile + (insert latex-header) + (insert "\n\\begin{document}\n" + "\\definecolor{fg}{rgb}{" fg "}%\n" + (if bg + (concat "\\definecolor{bg}{rgb}{" bg "}%\n" + "\n\\pagecolor{bg}%\n") + "") + "\n{\\color{fg}\n" + string + "\n}\n" + "\n\\end{document}\n")) + (let* ((err-msg (format "Please adjust `%s' part of \ +`org-preview-latex-process-alist'." + processing-type)) + (image-input-file + (org-compile-file + texfile latex-compiler image-input-type err-msg log-buf)) + (image-output-file + (org-compile-file + image-input-file image-converter image-output-type err-msg log-buf + `((?D . ,(shell-quote-argument (format "%s" dpi))) + (?S . ,(shell-quote-argument (format "%s" (/ dpi 140.0)))))))) + (copy-file image-output-file tofile 'replace) + (dolist (e post-clean) + (when (file-exists-p (concat texfilebase e)) + (delete-file (concat texfilebase e)))) + image-output-file))) + +(defun org-splice-latex-header (tpl def-pkg pkg snippets-p &optional extra) + "Fill a LaTeX header template TPL. +In the template, the following place holders will be recognized: + + [DEFAULT-PACKAGES] \\usepackage statements for DEF-PKG + [NO-DEFAULT-PACKAGES] do not include DEF-PKG + [PACKAGES] \\usepackage statements for PKG + [NO-PACKAGES] do not include PKG + [EXTRA] the string EXTRA + [NO-EXTRA] do not include EXTRA + +For backward compatibility, if both the positive and the negative place +holder is missing, the positive one (without the \"NO-\") will be +assumed to be present at the end of the template. +DEF-PKG and PKG are assumed to be alists of options/packagename lists. +EXTRA is a string. +SNIPPETS-P indicates if this is run to create snippet images for HTML." + (let (rpl (end "")) + (if (string-match "^[ \t]*\\[\\(NO-\\)?DEFAULT-PACKAGES\\][ \t]*\n?" tpl) + (setq rpl (if (or (match-end 1) (not def-pkg)) + "" (org-latex-packages-to-string def-pkg snippets-p t)) + tpl (replace-match rpl t t tpl)) + (when def-pkg (setq end (org-latex-packages-to-string def-pkg snippets-p)))) + + (if (string-match "\\[\\(NO-\\)?PACKAGES\\][ \t]*\n?" tpl) + (setq rpl (if (or (match-end 1) (not pkg)) + "" (org-latex-packages-to-string pkg snippets-p t)) + tpl (replace-match rpl t t tpl)) + (when pkg (setq end + (concat end "\n" + (org-latex-packages-to-string pkg snippets-p))))) + + (if (string-match "\\[\\(NO-\\)?EXTRA\\][ \t]*\n?" tpl) + (setq rpl (if (or (match-end 1) (not extra)) + "" (concat extra "\n")) + tpl (replace-match rpl t t tpl)) + (when (and extra (string-match "\\S-" extra)) + (setq end (concat end "\n" extra)))) + + (if (string-match "\\S-" end) + (concat tpl "\n" end) + tpl))) + +(defun org-latex-packages-to-string (pkg &optional snippets-p newline) + "Turn an alist of packages into a string with the \\usepackage macros." + (setq pkg (mapconcat (lambda(p) + (cond + ((stringp p) p) + ((and snippets-p (>= (length p) 3) (not (nth 2 p))) + (format "%% Package %s omitted" (cadr p))) + ((equal "" (car p)) + (format "\\usepackage{%s}" (cadr p))) + (t + (format "\\usepackage[%s]{%s}" + (car p) (cadr p))))) + pkg + "\n")) + (if newline (concat pkg "\n") pkg)) + +(defun org-dvipng-color (attr) + "Return a RGB color specification for dvipng." + (org-dvipng-color-format (face-attribute 'default attr nil))) + +(defun org-dvipng-color-format (color-name) + "Convert COLOR-NAME to a RGB color value for dvipng." + (apply #'format "rgb %s %s %s" + (mapcar 'org-normalize-color + (color-values color-name)))) + +(defun org-latex-color (attr) + "Return a RGB color for the LaTeX color package." + (org-latex-color-format (face-attribute 'default attr nil))) + +(defun org-latex-color-format (color-name) + "Convert COLOR-NAME to a RGB color value." + (apply #'format "%s,%s,%s" + (mapcar 'org-normalize-color + (color-values color-name)))) + +(defun org-normalize-color (value) + "Return string to be used as color value for an RGB component." + (format "%g" (/ value 65535.0))) + + +;; Image display + +(defvar-local org-inline-image-overlays nil) + +(defun org-toggle-inline-images (&optional include-linked) + "Toggle the display of inline images. +INCLUDE-LINKED is passed to `org-display-inline-images'." + (interactive "P") + (if org-inline-image-overlays + (progn + (org-remove-inline-images) + (when (called-interactively-p 'interactive) + (message "Inline image display turned off"))) + (org-display-inline-images include-linked) + (when (called-interactively-p 'interactive) + (message (if org-inline-image-overlays + (format "%d images displayed inline" + (length org-inline-image-overlays)) + "No images to display inline"))))) + +(defun org-redisplay-inline-images () + "Assure display of inline images and refresh them." + (interactive) + (org-toggle-inline-images) + (unless org-inline-image-overlays + (org-toggle-inline-images))) + +;; For without-x builds. +(declare-function image-refresh "image" (spec &optional frame)) + +(defcustom org-display-remote-inline-images 'skip + "How to display remote inline images. +Possible values of this option are: + +skip Don't display remote images. +download Always download and display remote images. +cache Display remote images, and open them in separate buffers + for caching. Silently update the image buffer when a file + change is detected." + :group 'org-appearance + :package-version '(Org . "9.4") + :type '(choice + (const :tag "Ignore remote images" skip) + (const :tag "Always display remote images" download) + (const :tag "Display and silently update remote images" cache)) + :safe #'symbolp) + +(defun org--create-inline-image (file width) + "Create image located at FILE, or return nil. +WIDTH is the width of the image. The image may not be created +according to the value of `org-display-remote-inline-images'." + (let* ((remote? (file-remote-p file)) + (file-or-data + (pcase org-display-remote-inline-images + ((guard (not remote?)) file) + (`download (with-temp-buffer + (set-buffer-multibyte nil) + (insert-file-contents-literally file) + (buffer-string))) + (`cache (let ((revert-without-query '("."))) + (with-current-buffer (find-file-noselect file) + (buffer-string)))) + (`skip nil) + (other + (message "Invalid value of `org-display-remote-inline-images': %S" + other) + nil)))) + (when file-or-data + (create-image file-or-data + (and (image-type-available-p 'imagemagick) + width + 'imagemagick) + remote? + :width width)))) + +(defun org-display-inline-images (&optional include-linked refresh beg end) + "Display inline images. + +An inline image is a link which follows either of these +conventions: + + 1. Its path is a file with an extension matching return value + from `image-file-name-regexp' and it has no contents. + + 2. Its description consists in a single link of the previous + type. In this case, that link must be a well-formed plain + or angle link, i.e., it must have an explicit \"file\" type. + +Equip each image with the key-map `image-map'. + +When optional argument INCLUDE-LINKED is non-nil, also links with +a text description part will be inlined. This can be nice for +a quick look at those images, but it does not reflect what +exported files will look like. + +When optional argument REFRESH is non-nil, refresh existing +images between BEG and END. This will create new image displays +only if necessary. + +BEG and END define the considered part. They default to the +buffer boundaries with possible narrowing." + (interactive "P") + (when (display-graphic-p) + (unless refresh + (org-remove-inline-images) + (when (fboundp 'clear-image-cache) (clear-image-cache))) + (let ((end (or end (point-max)))) + (org-with-point-at (or beg (point-min)) + (let* ((case-fold-search t) + (file-extension-re (image-file-name-regexp)) + (link-abbrevs (mapcar #'car + (append org-link-abbrev-alist-local + org-link-abbrev-alist))) + ;; Check absolute, relative file names and explicit + ;; "file:" links. Also check link abbreviations since + ;; some might expand to "file" links. + (file-types-re + (format "\\[\\[\\(?:file%s:\\|attachment:\\|[./~]\\)\\|\\]\\[\\(<?file:\\)" + (if (not link-abbrevs) "" + (concat "\\|" (regexp-opt link-abbrevs)))))) + (while (re-search-forward file-types-re end t) + (let* ((link (org-element-lineage + (save-match-data (org-element-context)) + '(link) t)) + (linktype (org-element-property :type link)) + (inner-start (match-beginning 1)) + (path + (cond + ;; No link at point; no inline image. + ((not link) nil) + ;; File link without a description. Also handle + ;; INCLUDE-LINKED here since it should have + ;; precedence over the next case. I.e., if link + ;; contains filenames in both the path and the + ;; description, prioritize the path only when + ;; INCLUDE-LINKED is non-nil. + ((or (not (org-element-property :contents-begin link)) + include-linked) + (and (or (equal "file" linktype) + (equal "attachment" linktype)) + (org-element-property :path link))) + ;; Link with a description. Check if description + ;; is a filename. Even if Org doesn't have syntax + ;; for those -- clickable image -- constructs, fake + ;; them, as in `org-export-insert-image-links'. + ((not inner-start) nil) + (t + (org-with-point-at inner-start + (and (looking-at + (if (char-equal ?< (char-after inner-start)) + org-link-angle-re + org-link-plain-re)) + ;; File name must fill the whole + ;; description. + (= (org-element-property :contents-end link) + (match-end 0)) + (match-string 2))))))) + (when (and path (string-match-p file-extension-re path)) + (let ((file (if (equal "attachment" linktype) + (progn + (require 'org-attach) + (ignore-errors (org-attach-expand path))) + (expand-file-name path)))) + (when (and file (file-exists-p file)) + (let ((width (org-display-inline-image--width link)) + (old (get-char-property-and-overlay + (org-element-property :begin link) + 'org-image-overlay))) + (if (and (car-safe old) refresh) + (image-refresh (overlay-get (cdr old) 'display)) + (let ((image (org--create-inline-image file width))) + (when image + (let ((ov (make-overlay + (org-element-property :begin link) + (progn + (goto-char + (org-element-property :end link)) + (skip-chars-backward " \t") + (point))))) + (overlay-put ov 'display image) + (overlay-put ov 'face 'default) + (overlay-put ov 'org-image-overlay t) + (overlay-put + ov 'modification-hooks + (list 'org-display-inline-remove-overlay)) + (when (boundp 'image-map) + (overlay-put ov 'keymap image-map)) + (push ov org-inline-image-overlays)))))))))))))))) + +(defvar visual-fill-column-width) ; Silence compiler warning +(defun org-display-inline-image--width (link) + "Determine the display width of the image LINK, in pixels. +- When `org-image-actual-width' is t, the image's pixel width is used. +- When `org-image-actual-width' is a number, that value will is used. +- When `org-image-actual-width' is nil or a list, the first :width attribute + set (if it exists) is used to set the image width. A width of X% is + divided by 100. + If no :width attribute is given and `org-image-actual-width' is a list with + a number as the car, then that number is used as the default value. + If the value is a float between 0 and 2, it interpreted as that proportion + of the text width in the buffer." + ;; Apply `org-image-actual-width' specifications. + (cond + ((eq org-image-actual-width t) nil) + ((listp org-image-actual-width) + (let* ((case-fold-search t) + (par (org-element-lineage link '(paragraph))) + (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") + (par-end (org-element-property :post-affiliated par)) + ;; Try to find an attribute providing a :width. + (attr-width + (when (and par (org-with-point-at + (org-element-property :begin par) + (re-search-forward attr-re par-end t))) + (match-string 1))) + (attr-width-val + (cond + ((null attr-width) nil) + ((string-match-p "\\`[0-9.]+%" attr-width) + (/ (string-to-number attr-width) 100.0)) + (t (string-to-number attr-width)))) + ;; Fallback to `org-image-actual-width' if no explicit width is given. + (width (or attr-width-val (car org-image-actual-width)))) + (if (and (floatp width) (<= 0.0 width 2.0)) + ;; A float in [0,2] should be interpereted as this portion of + ;; the text width in the window. This works well with cases like + ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, + ;; as the "0.X" is pulled out as a float. We use 2 as the upper + ;; bound as cases such as 1.2\linewidth are feasible. + (round (* width + (window-pixel-width) + (/ (or (and (bound-and-true-p visual-fill-column-mode) + (or visual-fill-column-width auto-fill-function)) + (when auto-fill-function fill-column) + (window-text-width)) + (float (window-total-width))))) + width))) + ((numberp org-image-actual-width) + org-image-actual-width) + (t nil))) + +(defun org-display-inline-remove-overlay (ov after _beg _end &optional _len) + "Remove inline-display overlay if a corresponding region is modified." + (let ((inhibit-modification-hooks t)) + (when (and ov after) + (delete ov org-inline-image-overlays) + (delete-overlay ov)))) + +(defun org-remove-inline-images () + "Remove inline display of images." + (interactive) + (mapc #'delete-overlay org-inline-image-overlays) + (setq org-inline-image-overlays nil)) + +(defvar org-self-insert-command-undo-counter 0) +(defvar org-speed-command nil) + +(defun org-self-insert-command (N) + "Like `self-insert-command', use overwrite-mode for whitespace in tables. +If the cursor is in a table looking at whitespace, the whitespace is +overwritten, and the table is not marked as requiring realignment." + (interactive "p") + (org-check-before-invisible-edit 'insert) + (cond + ((and org-use-speed-commands + (let ((kv (this-command-keys-vector))) + (setq org-speed-command + (run-hook-with-args-until-success + 'org-speed-command-hook + (make-string 1 (aref kv (1- (length kv)))))))) + (cond + ((commandp org-speed-command) + (setq this-command org-speed-command) + (call-interactively org-speed-command)) + ((functionp org-speed-command) + (funcall org-speed-command)) + ((and org-speed-command (listp org-speed-command)) + (eval org-speed-command)) + (t (let (org-use-speed-commands) + (call-interactively 'org-self-insert-command))))) + ((and + (= N 1) + (not (org-region-active-p)) + (org-at-table-p) + (progn + ;; Check if we blank the field, and if that triggers align. + (and (featurep 'org-table) + org-table-auto-blank-field + (memq last-command + '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c)) + (if (or (eq (char-after) ?\s) (looking-at "[^|\n]* |")) + ;; Got extra space, this field does not determine + ;; column width. + (let (org-table-may-need-update) (org-table-blank-field)) + ;; No extra space, this field may determine column + ;; width. + (org-table-blank-field))) + t) + (looking-at "[^|\n]* |")) + ;; There is room for insertion without re-aligning the table. + (self-insert-command N) + (org-table-with-shrunk-field + (save-excursion + (skip-chars-forward "^|") + ;; Do not delete last space, which is + ;; `org-table-separator-space', but the regular space before + ;; it. + (delete-region (- (point) 2) (1- (point)))))) + (t + (setq org-table-may-need-update t) + (self-insert-command N) + (org-fix-tags-on-the-fly) + (when org-self-insert-cluster-for-undo + (if (not (eq last-command 'org-self-insert-command)) + (setq org-self-insert-command-undo-counter 1) + (if (>= org-self-insert-command-undo-counter 20) + (setq org-self-insert-command-undo-counter 1) + (and (> org-self-insert-command-undo-counter 0) + buffer-undo-list (listp buffer-undo-list) + (not (cadr buffer-undo-list)) ; remove nil entry + (setcdr buffer-undo-list (cddr buffer-undo-list))) + (setq org-self-insert-command-undo-counter + (1+ org-self-insert-command-undo-counter)))))))) + +(defun org-check-before-invisible-edit (kind) + "Check if editing kind KIND would be dangerous with invisible text around. +The detailed reaction depends on the user option `org-catch-invisible-edits'." + ;; First, try to get out of here as quickly as possible, to reduce overhead + (when (and org-catch-invisible-edits + (or (not (boundp 'visible-mode)) (not visible-mode)) + (or (get-char-property (point) 'invisible) + (get-char-property (max (point-min) (1- (point))) 'invisible))) + ;; OK, we need to take a closer look. Do not consider + ;; invisibility obtained through text properties (e.g., link + ;; fontification), as it cannot be toggled. + (let* ((invisible-at-point + (pcase (get-char-property-and-overlay (point) 'invisible) + (`(,_ . ,(and (pred overlayp) o)) o))) + ;; Assume that point cannot land in the middle of an + ;; overlay, or between two overlays. + (invisible-before-point + (and (not invisible-at-point) + (not (bobp)) + (pcase (get-char-property-and-overlay (1- (point)) 'invisible) + (`(,_ . ,(and (pred overlayp) o)) o)))) + (border-and-ok-direction + (or + ;; Check if we are acting predictably before invisible + ;; text. + (and invisible-at-point + (memq kind '(insert delete-backward))) + ;; Check if we are acting predictably after invisible text + ;; This works not well, and I have turned it off. It seems + ;; better to always show and stop after invisible text. + ;; (and (not invisible-at-point) invisible-before-point + ;; (memq kind '(insert delete))) + ))) + (when (or invisible-at-point invisible-before-point) + (when (eq org-catch-invisible-edits 'error) + (user-error "Editing in invisible areas is prohibited, make them visible first")) + (if (and org-custom-properties-overlays + (y-or-n-p "Display invisible properties in this buffer? ")) + (org-toggle-custom-properties-visibility) + ;; Make the area visible + (save-excursion + (when invisible-before-point + (goto-char + (previous-single-char-property-change (point) 'invisible))) + ;; Remove whatever overlay is currently making yet-to-be + ;; edited text invisible. Also remove nested invisibility + ;; related overlays. + (delete-overlay (or invisible-at-point invisible-before-point)) + (let ((origin (if invisible-at-point (point) (1- (point))))) + (while (pcase (get-char-property-and-overlay origin 'invisible) + (`(,_ . ,(and (pred overlayp) o)) + (delete-overlay o) + t))))) + (cond + ((eq org-catch-invisible-edits 'show) + ;; That's it, we do the edit after showing + (message + "Unfolding invisible region around point before editing") + (sit-for 1)) + ((and (eq org-catch-invisible-edits 'smart) + border-and-ok-direction) + (message "Unfolding invisible region around point before editing")) + (t + ;; Don't do the edit, make the user repeat it in full visibility + (user-error "Edit in invisible region aborted, repeat to confirm with text visible")))))))) + +(defun org-fix-tags-on-the-fly () + "Align tags in headline at point. +Unlike `org-align-tags', this function does nothing if point is +either not currently on a tagged headline or on a tag." + (when (and (org-match-line org-tag-line-re) + (< (point) (match-beginning 1))) + (org-align-tags))) + +(defun org-delete-backward-char (N) + "Like `delete-backward-char', insert whitespace at field end in tables. +When deleting backwards, in tables this function will insert whitespace in +front of the next \"|\" separator, to keep the table aligned. The table will +still be marked for re-alignment if the field did fill the entire column, +because, in this case the deletion might narrow the column." + (interactive "p") + (save-match-data + (org-check-before-invisible-edit 'delete-backward) + (if (and (= N 1) + (not overwrite-mode) + (not (org-region-active-p)) + (not (eq (char-before) ?|)) + (save-excursion (skip-chars-backward " \t") (not (bolp))) + (looking-at-p ".*?|") + (org-at-table-p)) + (progn (forward-char -1) (org-delete-char 1)) + (backward-delete-char N) + (org-fix-tags-on-the-fly)))) + +(defun org-delete-char (N) + "Like `delete-char', but insert whitespace at field end in tables. +When deleting characters, in tables this function will insert whitespace in +front of the next \"|\" separator, to keep the table aligned. The table will +still be marked for re-alignment if the field did fill the entire column, +because, in this case the deletion might narrow the column." + (interactive "p") + (save-match-data + (org-check-before-invisible-edit 'delete) + (cond + ((or (/= N 1) + (eq (char-after) ?|) + (save-excursion (skip-chars-backward " \t") (bolp)) + (not (org-at-table-p))) + (delete-char N) + (org-fix-tags-on-the-fly)) + ((looking-at ".\\(.*?\\)|") + (let* ((update? org-table-may-need-update) + (noalign (looking-at-p ".*? |"))) + (delete-char 1) + (org-table-with-shrunk-field + (save-excursion + ;; Last space is `org-table-separator-space', so insert + ;; a regular one before it instead. + (goto-char (- (match-end 0) 2)) + (insert " "))) + ;; If there were two spaces at the end, this field does not + ;; determine the width of the column. + (when noalign (setq org-table-may-need-update update?)))) + (t + (delete-char N))))) + +;; Make `delete-selection-mode' work with Org mode and Orgtbl mode +(put 'org-self-insert-command 'delete-selection + (lambda () + (not (run-hook-with-args-until-success + 'self-insert-uses-region-functions)))) +(put 'orgtbl-self-insert-command 'delete-selection + (lambda () + (not (run-hook-with-args-until-success + 'self-insert-uses-region-functions)))) +(put 'org-delete-char 'delete-selection 'supersede) +(put 'org-delete-backward-char 'delete-selection 'supersede) +(put 'org-yank 'delete-selection 'yank) +(put 'org-return 'delete-selection t) + +;; Make `flyspell-mode' delay after some commands +(put 'org-self-insert-command 'flyspell-delayed t) +(put 'orgtbl-self-insert-command 'flyspell-delayed t) +(put 'org-delete-char 'flyspell-delayed t) +(put 'org-delete-backward-char 'flyspell-delayed t) + +;; Make pabbrev-mode expand after Org mode commands +(put 'org-self-insert-command 'pabbrev-expand-after-command t) +(put 'orgtbl-self-insert-command 'pabbrev-expand-after-command t) + +(defun org-transpose-words () + "Transpose words for Org. +This uses the `org-mode-transpose-word-syntax-table' syntax +table, which interprets characters in `org-emphasis-alist' as +word constituents." + (interactive) + (with-syntax-table org-mode-transpose-word-syntax-table + (call-interactively 'transpose-words))) + +(defvar org-ctrl-c-ctrl-c-hook nil + "Hook for functions attaching themselves to `C-c C-c'. + +This can be used to add additional functionality to the `C-c C-c' +key which executes context-dependent commands. This hook is run +before any other test, while `org-ctrl-c-ctrl-c-final-hook' is +run after the last test. + +Each function will be called with no arguments. The function +must check if the context is appropriate for it to act. If yes, +it should do its thing and then return a non-nil value. If the +context is wrong, just do nothing and return nil.") + +(defvar org-ctrl-c-ctrl-c-final-hook nil + "Hook for functions attaching themselves to `C-c C-c'. + +This can be used to add additional functionality to the `C-c C-c' +key which executes context-dependent commands. This hook is run +after any other test, while `org-ctrl-c-ctrl-c-hook' is run +before the first test. + +Each function will be called with no arguments. The function +must check if the context is appropriate for it to act. If yes, +it should do its thing and then return a non-nil value. If the +context is wrong, just do nothing and return nil.") + +(defvar org-tab-first-hook nil + "Hook for functions to attach themselves to TAB. +See `org-ctrl-c-ctrl-c-hook' for more information. +This hook runs as the first action when TAB is pressed, even before +`org-cycle' messes around with the `outline-regexp' to cater for +inline tasks and plain list item folding. +If any function in this hook returns t, any other actions that +would have been caused by TAB (such as table field motion or visibility +cycling) will not occur.") + +(defvar org-tab-after-check-for-table-hook nil + "Hook for functions to attach themselves to TAB. +See `org-ctrl-c-ctrl-c-hook' for more information. +This hook runs after it has been established that the cursor is not in a +table, but before checking if the cursor is in a headline or if global cycling +should be done. +If any function in this hook returns t, not other actions like visibility +cycling will be done.") + +(defvar org-tab-after-check-for-cycling-hook nil + "Hook for functions to attach themselves to TAB. +See `org-ctrl-c-ctrl-c-hook' for more information. +This hook runs after it has been established that not table field motion and +not visibility should be done because of current context. This is probably +the place where a package like yasnippets can hook in.") + +(defvar org-tab-before-tab-emulation-hook nil + "Hook for functions to attach themselves to TAB. +See `org-ctrl-c-ctrl-c-hook' for more information. +This hook runs after every other options for TAB have been exhausted, but +before indentation and \t insertion takes place.") + +(defvar org-metaleft-hook nil + "Hook for functions attaching themselves to `M-left'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-metaright-hook nil + "Hook for functions attaching themselves to `M-right'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-metaup-hook nil + "Hook for functions attaching themselves to `M-up'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-metadown-hook nil + "Hook for functions attaching themselves to `M-down'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftmetaleft-hook nil + "Hook for functions attaching themselves to `M-S-left'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftmetaright-hook nil + "Hook for functions attaching themselves to `M-S-right'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftmetaup-hook nil + "Hook for functions attaching themselves to `M-S-up'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftmetadown-hook nil + "Hook for functions attaching themselves to `M-S-down'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-metareturn-hook nil + "Hook for functions attaching themselves to `M-RET'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftup-hook nil + "Hook for functions attaching themselves to `S-up'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftup-final-hook nil + "Hook for functions attaching themselves to `S-up'. +This one runs after all other options except shift-select have been excluded. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftdown-hook nil + "Hook for functions attaching themselves to `S-down'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftdown-final-hook nil + "Hook for functions attaching themselves to `S-down'. +This one runs after all other options except shift-select have been excluded. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftleft-hook nil + "Hook for functions attaching themselves to `S-left'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftleft-final-hook nil + "Hook for functions attaching themselves to `S-left'. +This one runs after all other options except shift-select have been excluded. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftright-hook nil + "Hook for functions attaching themselves to `S-right'. +See `org-ctrl-c-ctrl-c-hook' for more information.") +(defvar org-shiftright-final-hook nil + "Hook for functions attaching themselves to `S-right'. +This one runs after all other options except shift-select have been excluded. +See `org-ctrl-c-ctrl-c-hook' for more information.") + +(defun org-modifier-cursor-error () + "Throw an error, a modified cursor command was applied in wrong context." + (user-error "This command is active in special context like tables, headlines or items")) + +(defun org-shiftselect-error () + "Throw an error because Shift-Cursor command was applied in wrong context." + (if (and (boundp 'shift-select-mode) shift-select-mode) + (user-error "To use shift-selection with Org mode, customize `org-support-shift-select'") + (user-error "This command works only in special context like headlines or timestamps"))) + +(defun org-call-for-shift-select (cmd) + (let ((this-command-keys-shift-translated t)) + (call-interactively cmd))) + +(defun org-shifttab (&optional arg) + "Global visibility cycling or move to previous table field. +Call `org-table-previous-field' within a table. +When ARG is nil, cycle globally through visibility states. +When ARG is a numeric prefix, show contents of this level." + (interactive "P") + (cond + ((org-at-table-p) (call-interactively 'org-table-previous-field)) + ((integerp arg) + (let ((arg2 (if org-odd-levels-only (1- (* 2 arg)) arg))) + (message "Content view to level: %d" arg) + (org-content (prefix-numeric-value arg2)) + (org-cycle-show-empty-lines t) + (setq org-cycle-global-status 'overview) + (run-hook-with-args 'org-cycle-hook 'overview))) + (t (call-interactively 'org-global-cycle)))) + +(defun org-shiftmetaleft () + "Promote subtree or delete table column. +Calls `org-promote-subtree', `org-outdent-item-tree', or +`org-table-delete-column', depending on context. See the +individual commands for more information." + (interactive) + (cond + ((run-hook-with-args-until-success 'org-shiftmetaleft-hook)) + ((org-at-table-p) (call-interactively 'org-table-delete-column)) + ((org-at-heading-p) (call-interactively 'org-promote-subtree)) + ((if (not (org-region-active-p)) (org-at-item-p) + (save-excursion (goto-char (region-beginning)) + (org-at-item-p))) + (call-interactively 'org-outdent-item-tree)) + (t (org-modifier-cursor-error)))) + +(defun org-shiftmetaright () + "Demote subtree or insert table column. +Calls `org-demote-subtree', `org-indent-item-tree', or +`org-table-insert-column', depending on context. See the +individual commands for more information." + (interactive) + (cond + ((run-hook-with-args-until-success 'org-shiftmetaright-hook)) + ((org-at-table-p) (call-interactively 'org-table-insert-column)) + ((org-at-heading-p) (call-interactively 'org-demote-subtree)) + ((if (not (org-region-active-p)) (org-at-item-p) + (save-excursion (goto-char (region-beginning)) + (org-at-item-p))) + (call-interactively 'org-indent-item-tree)) + (t (org-modifier-cursor-error)))) + +(defun org-shiftmetaup (&optional _arg) + "Drag the line at point up. +In a table, kill the current row. +On a clock timestamp, update the value of the timestamp like `S-<up>' +but also adjust the previous clocked item in the clock history. +Everywhere else, drag the line at point up." + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-shiftmetaup-hook)) + ((org-at-table-p) (call-interactively 'org-table-kill-row)) + ((org-at-clock-log-p) (let ((org-clock-adjust-closest t)) + (call-interactively 'org-timestamp-up))) + (t (call-interactively 'org-drag-line-backward)))) + +(defun org-shiftmetadown (&optional _arg) + "Drag the line at point down. +In a table, insert an empty row at the current line. +On a clock timestamp, update the value of the timestamp like `S-<down>' +but also adjust the previous clocked item in the clock history. +Everywhere else, drag the line at point down." + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-shiftmetadown-hook)) + ((org-at-table-p) (call-interactively 'org-table-insert-row)) + ((org-at-clock-log-p) (let ((org-clock-adjust-closest t)) + (call-interactively 'org-timestamp-down))) + (t (call-interactively 'org-drag-line-forward)))) + +(defsubst org-hidden-tree-error () + (user-error + "Hidden subtree, open with TAB or use subtree command M-S-<left>/<right>")) + +(defun org-metaleft (&optional _arg) + "Promote heading, list item at point or move table column left. + +Calls `org-do-promote', `org-outdent-item' or `org-table-move-column', +depending on context. With no specific context, calls the Emacs +default `backward-word'. See the individual commands for more +information. + +This function runs the hook `org-metaleft-hook' as a first step, +and returns at first non-nil value." + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-metaleft-hook)) + ((org-at-table-p) (org-call-with-arg 'org-table-move-column 'left)) + ((org-with-limited-levels + (or (org-at-heading-p) + (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (org-at-heading-p))))) + (when (org-check-for-hidden 'headlines) (org-hidden-tree-error)) + (call-interactively 'org-do-promote)) + ;; At an inline task. + ((org-at-heading-p) + (call-interactively 'org-inlinetask-promote)) + ((or (org-at-item-p) + (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (org-at-item-p)))) + (when (org-check-for-hidden 'items) (org-hidden-tree-error)) + (call-interactively 'org-outdent-item)) + (t (call-interactively 'backward-word)))) + +(defun org-metaright (&optional _arg) + "Demote heading, list item at point or move table column right. + +In front of a drawer or a block keyword, indent it correctly. + +Calls `org-do-demote', `org-indent-item', `org-table-move-column', +`org-indent-drawer' or `org-indent-block' depending on context. +With no specific context, calls the Emacs default `forward-word'. +See the individual commands for more information. + +This function runs the hook `org-metaright-hook' as a first step, +and returns at first non-nil value." + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-metaright-hook)) + ((org-at-table-p) (call-interactively 'org-table-move-column)) + ((org-at-drawer-p) (call-interactively 'org-indent-drawer)) + ((org-at-block-p) (call-interactively 'org-indent-block)) + ((org-with-limited-levels + (or (org-at-heading-p) + (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (org-at-heading-p))))) + (when (org-check-for-hidden 'headlines) (org-hidden-tree-error)) + (call-interactively 'org-do-demote)) + ;; At an inline task. + ((org-at-heading-p) + (call-interactively 'org-inlinetask-demote)) + ((or (org-at-item-p) + (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (org-at-item-p)))) + (when (org-check-for-hidden 'items) (org-hidden-tree-error)) + (call-interactively 'org-indent-item)) + (t (call-interactively 'forward-word)))) + +(defun org-check-for-hidden (what) + "Check if there are hidden headlines/items in the current visual line. +WHAT can be either `headlines' or `items'. If the current line is +an outline or item heading and it has a folded subtree below it, +this function returns t, nil otherwise." + (let ((re (cond + ((eq what 'headlines) org-outline-regexp-bol) + ((eq what 'items) (org-item-beginning-re)) + (t (error "This should not happen")))) + beg end) + (save-excursion + (catch 'exit + (unless (org-region-active-p) + (setq beg (point-at-bol)) + (beginning-of-line 2) + (while (and (not (eobp)) ;; this is like `next-line' + (get-char-property (1- (point)) 'invisible)) + (beginning-of-line 2)) + (setq end (point)) + (goto-char beg) + (goto-char (point-at-eol)) + (setq end (max end (point))) + (while (re-search-forward re end t) + (when (get-char-property (match-beginning 0) 'invisible) + (throw 'exit t)))) + nil)))) + +(defun org-metaup (&optional _arg) + "Move subtree up or move table row up. +Calls `org-move-subtree-up' or `org-table-move-row' or +`org-move-item-up', depending on context. See the individual commands +for more information." + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-metaup-hook)) + ((org-region-active-p) + (let* ((a (save-excursion + (goto-char (min (region-beginning) (region-end))) + (line-beginning-position))) + (b (save-excursion + (goto-char (max (region-beginning) (region-end))) + (if (bolp) (1- (point)) (line-end-position)))) + (c (save-excursion + (goto-char a) + (move-beginning-of-line 0) + (point))) + (d (save-excursion + (goto-char a) + (move-end-of-line 0) + (point)))) + (transpose-regions a b c d) + (goto-char c))) + ((org-at-table-p) (org-call-with-arg 'org-table-move-row 'up)) + ((and (featurep 'org-inlinetask) + (org-inlinetask-in-task-p)) + (org-drag-element-backward)) + ((org-at-heading-p) (call-interactively 'org-move-subtree-up)) + ((org-at-item-p) (call-interactively 'org-move-item-up)) + (t (org-drag-element-backward)))) + +(defun org-metadown (&optional _arg) + "Move subtree down or move table row down. +Calls `org-move-subtree-down' or `org-table-move-row' or +`org-move-item-down', depending on context. See the individual +commands for more information." + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-metadown-hook)) + ((org-region-active-p) + (let* ((a (save-excursion + (goto-char (min (region-beginning) (region-end))) + (line-beginning-position))) + (b (save-excursion + (goto-char (max (region-beginning) (region-end))) + (if (bolp) (1- (point)) (line-end-position)))) + (c (save-excursion + (goto-char b) + (move-beginning-of-line (if (bolp) 1 2)) + (point))) + (d (save-excursion + (goto-char b) + (move-end-of-line (if (bolp) 1 2)) + (point)))) + (transpose-regions a b c d) + (goto-char d))) + ((org-at-table-p) (call-interactively 'org-table-move-row)) + ((and (featurep 'org-inlinetask) + (org-inlinetask-in-task-p)) + (org-drag-element-forward)) + ((org-at-heading-p) (call-interactively 'org-move-subtree-down)) + ((org-at-item-p) (call-interactively 'org-move-item-down)) + (t (org-drag-element-forward)))) + +(defun org-shiftup (&optional arg) + "Act on current element according to context. +Call `org-timestamp-up' or `org-priority-up', or +`org-previous-item', or `org-table-move-cell-up'. See the +individual commands for more information." + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-shiftup-hook)) + ((and org-support-shift-select (org-region-active-p)) + (org-call-for-shift-select 'previous-line)) + ((org-at-timestamp-p 'lax) + (call-interactively (if org-edit-timestamp-down-means-later + 'org-timestamp-down 'org-timestamp-up))) + ((and (not (eq org-support-shift-select 'always)) + org-priority-enable-commands + (org-at-heading-p)) + (call-interactively 'org-priority-up)) + ((and (not org-support-shift-select) (org-at-item-p)) + (call-interactively 'org-previous-item)) + ((org-clocktable-try-shift 'up arg)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-table-p)) + (org-table-move-cell-up)) + ((run-hook-with-args-until-success 'org-shiftup-final-hook)) + (org-support-shift-select + (org-call-for-shift-select 'previous-line)) + (t (org-shiftselect-error)))) + +(defun org-shiftdown (&optional arg) + "Act on current element according to context. +Call `org-timestamp-down' or `org-priority-down', or +`org-next-item', or `org-table-move-cell-down'. See the +individual commands for more information." + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-shiftdown-hook)) + ((and org-support-shift-select (org-region-active-p)) + (org-call-for-shift-select 'next-line)) + ((org-at-timestamp-p 'lax) + (call-interactively (if org-edit-timestamp-down-means-later + 'org-timestamp-up 'org-timestamp-down))) + ((and (not (eq org-support-shift-select 'always)) + org-priority-enable-commands + (org-at-heading-p)) + (call-interactively 'org-priority-down)) + ((and (not org-support-shift-select) (org-at-item-p)) + (call-interactively 'org-next-item)) + ((org-clocktable-try-shift 'down arg)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-table-p)) + (org-table-move-cell-down)) + ((run-hook-with-args-until-success 'org-shiftdown-final-hook)) + (org-support-shift-select + (org-call-for-shift-select 'next-line)) + (t (org-shiftselect-error)))) + +(defun org-shiftright (&optional arg) + "Act on the current element according to context. +This does one of the following: + +- switch a timestamp at point one day into the future +- on a headline, switch to the next TODO keyword +- on an item, switch entire list to the next bullet type +- on a property line, switch to the next allowed value +- on a clocktable definition line, move time block into the future +- in a table, move a single cell right" + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-shiftright-hook)) + ((and org-support-shift-select (org-region-active-p)) + (org-call-for-shift-select 'forward-char)) + ((org-at-timestamp-p 'lax) (call-interactively 'org-timestamp-up-day)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-heading-p)) + (let ((org-inhibit-logging + (not org-treat-S-cursor-todo-selection-as-state-change)) + (org-inhibit-blocking + (not org-treat-S-cursor-todo-selection-as-state-change))) + (org-call-with-arg 'org-todo 'right))) + ((or (and org-support-shift-select + (not (eq org-support-shift-select 'always)) + (org-at-item-bullet-p)) + (and (not org-support-shift-select) (org-at-item-p))) + (org-call-with-arg 'org-cycle-list-bullet nil)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-property-p)) + (call-interactively 'org-property-next-allowed-value)) + ((org-clocktable-try-shift 'right arg)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-table-p)) + (org-table-move-cell-right)) + ((run-hook-with-args-until-success 'org-shiftright-final-hook)) + (org-support-shift-select + (org-call-for-shift-select 'forward-char)) + (t (org-shiftselect-error)))) + +(defun org-shiftleft (&optional arg) + "Act on current element according to context. +This does one of the following: + +- switch a timestamp at point one day into the past +- on a headline, switch to the previous TODO keyword. +- on an item, switch entire list to the previous bullet type +- on a property line, switch to the previous allowed value +- on a clocktable definition line, move time block into the past +- in a table, move a single cell left" + (interactive "P") + (cond + ((run-hook-with-args-until-success 'org-shiftleft-hook)) + ((and org-support-shift-select (org-region-active-p)) + (org-call-for-shift-select 'backward-char)) + ((org-at-timestamp-p 'lax) (call-interactively 'org-timestamp-down-day)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-heading-p)) + (let ((org-inhibit-logging + (not org-treat-S-cursor-todo-selection-as-state-change)) + (org-inhibit-blocking + (not org-treat-S-cursor-todo-selection-as-state-change))) + (org-call-with-arg 'org-todo 'left))) + ((or (and org-support-shift-select + (not (eq org-support-shift-select 'always)) + (org-at-item-bullet-p)) + (and (not org-support-shift-select) (org-at-item-p))) + (org-call-with-arg 'org-cycle-list-bullet 'previous)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-property-p)) + (call-interactively 'org-property-previous-allowed-value)) + ((org-clocktable-try-shift 'left arg)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-table-p)) + (org-table-move-cell-left)) + ((run-hook-with-args-until-success 'org-shiftleft-final-hook)) + (org-support-shift-select + (org-call-for-shift-select 'backward-char)) + (t (org-shiftselect-error)))) + +(defun org-shiftcontrolright () + "Switch to next TODO set." + (interactive) + (cond + ((and org-support-shift-select (org-region-active-p)) + (org-call-for-shift-select 'forward-word)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-heading-p)) + (org-call-with-arg 'org-todo 'nextset)) + (org-support-shift-select + (org-call-for-shift-select 'forward-word)) + (t (org-shiftselect-error)))) + +(defun org-shiftcontrolleft () + "Switch to previous TODO set." + (interactive) + (cond + ((and org-support-shift-select (org-region-active-p)) + (org-call-for-shift-select 'backward-word)) + ((and (not (eq org-support-shift-select 'always)) + (org-at-heading-p)) + (org-call-with-arg 'org-todo 'previousset)) + (org-support-shift-select + (org-call-for-shift-select 'backward-word)) + (t (org-shiftselect-error)))) + +(defun org-shiftcontrolup (&optional n) + "Change timestamps synchronously up in CLOCK log lines. +Optional argument N tells to change by that many units." + (interactive "P") + (if (and (org-at-clock-log-p) (org-at-timestamp-p 'lax)) + (let (org-support-shift-select) + (org-clock-timestamps-up n)) + (user-error "Not at a clock log"))) + +(defun org-shiftcontroldown (&optional n) + "Change timestamps synchronously down in CLOCK log lines. +Optional argument N tells to change by that many units." + (interactive "P") + (if (and (org-at-clock-log-p) (org-at-timestamp-p 'lax)) + (let (org-support-shift-select) + (org-clock-timestamps-down n)) + (user-error "Not at a clock log"))) + +(defun org-increase-number-at-point (&optional inc) + "Increment the number at point. +With an optional prefix numeric argument INC, increment using +this numeric value." + (interactive "p") + (if (not (number-at-point)) + (user-error "Not on a number") + (unless inc (setq inc 1)) + (let ((pos (point)) + (beg (skip-chars-backward "-+^/*0-9eE.")) + (end (skip-chars-forward "-+^/*0-9eE.")) nap) + (setq nap (buffer-substring-no-properties + (+ pos beg) (+ pos beg end))) + (delete-region (+ pos beg) (+ pos beg end)) + (insert (calc-eval (concat (number-to-string inc) "+" nap)))) + (when (org-at-table-p) + (org-table-align) + (org-table-end-of-field 1)))) + +(defun org-decrease-number-at-point (&optional inc) + "Decrement the number at point. +With an optional prefix numeric argument INC, decrement using +this numeric value." + (interactive "p") + (org-increase-number-at-point (- (or inc 1)))) + +(defun org-ctrl-c-ret () + "Call `org-table-hline-and-move' or `org-insert-heading'." + (interactive) + (cond + ((org-at-table-p) (call-interactively 'org-table-hline-and-move)) + (t (call-interactively 'org-insert-heading)))) + +(defun org-copy-visible (beg end) + "Copy the visible parts of the region." + (interactive "r") + (let ((result "")) + (while (/= beg end) + (when (get-char-property beg 'invisible) + (setq beg (next-single-char-property-change beg 'invisible nil end))) + (let ((next (next-single-char-property-change beg 'invisible nil end))) + (setq result (concat result (buffer-substring beg next))) + (setq beg next))) + (setq deactivate-mark t) + (kill-new result) + (message "Visible strings have been copied to the kill ring."))) + +(defun org-copy-special () + "Copy region in table or copy current subtree. +Calls `org-table-copy-region' or `org-copy-subtree', depending on +context. See the individual commands for more information." + (interactive) + (call-interactively + (if (org-at-table-p) #'org-table-copy-region #'org-copy-subtree))) + +(defun org-cut-special () + "Cut region in table or cut current subtree. +Calls `org-table-cut-region' or `org-cut-subtree', depending on +context. See the individual commands for more information." + (interactive) + (call-interactively + (if (org-at-table-p) #'org-table-cut-region #'org-cut-subtree))) + +(defun org-paste-special (arg) + "Paste rectangular region into table, or past subtree relative to level. +Calls `org-table-paste-rectangle' or `org-paste-subtree', depending on context. +See the individual commands for more information." + (interactive "P") + (if (org-at-table-p) + (org-table-paste-rectangle) + (org-paste-subtree arg))) + +(defun org-edit-special (&optional arg) + "Call a special editor for the element at point. +When at a table, call the formula editor with `org-table-edit-formulas'. +When in a source code block, call `org-edit-src-code'. +When in a fixed-width region, call `org-edit-fixed-width-region'. +When in an export block, call `org-edit-export-block'. +When in a LaTeX environment, call `org-edit-latex-environment'. +When at an INCLUDE, SETUPFILE or BIBLIOGRAPHY keyword, visit the included file. +When at a footnote reference, call `org-edit-footnote-reference'. +When at a planning line call, `org-deadline' and/or `org-schedule'. +When at an active timestamp, call `org-time-stamp'. +When at an inactive timestamp, call `org-time-stamp-inactive'. +On a link, call `ffap' to visit the link at point. +Otherwise, return a user error." + (interactive "P") + (let ((element (org-element-at-point))) + (barf-if-buffer-read-only) + (pcase (org-element-type element) + (`src-block + (if (not arg) (org-edit-src-code) + (let* ((info (org-babel-get-src-block-info)) + (lang (nth 0 info)) + (params (nth 2 info)) + (session (cdr (assq :session params)))) + (if (not session) (org-edit-src-code) + ;; At a source block with a session and function called + ;; with an ARG: switch to the buffer related to the + ;; inferior process. + (switch-to-buffer + (funcall (intern (concat "org-babel-prep-session:" lang)) + session params)))))) + (`keyword + (unless (member (org-element-property :key element) + '("BIBLIOGRAPHY" "INCLUDE" "SETUPFILE")) + (user-error "No special environment to edit here")) + (let ((value (org-element-property :value element))) + (unless (org-string-nw-p value) (user-error "No file to edit")) + (let ((file (and (string-match "\\`\"\\(.*?\\)\"\\|\\S-+" value) + (or (match-string 1 value) + (match-string 0 value))))) + (when (org-url-p file) + (user-error "Files located with a URL cannot be edited")) + (org-link-open-from-string + (format "[[%s]]" (expand-file-name file)))))) + (`table + (if (eq (org-element-property :type element) 'table.el) + (org-edit-table.el) + (call-interactively 'org-table-edit-formulas))) + ;; Only Org tables contain `table-row' type elements. + (`table-row (call-interactively 'org-table-edit-formulas)) + (`example-block (org-edit-src-code)) + (`export-block (org-edit-export-block)) + (`fixed-width (org-edit-fixed-width-region)) + (`latex-environment (org-edit-latex-environment)) + (`planning + (let ((proplist (cadr element))) + (mapc #'call-interactively + (remq nil + (list + (when (plist-get proplist :deadline) #'org-deadline) + (when (plist-get proplist :scheduled) #'org-schedule)))))) + (_ + ;; No notable element at point. Though, we may be at a link or + ;; a footnote reference, which are objects. Thus, scan deeper. + (let ((context (org-element-context element))) + (pcase (org-element-type context) + (`footnote-reference (org-edit-footnote-reference)) + (`inline-src-block (org-edit-inline-src-code)) + (`latex-fragment (org-edit-latex-fragment)) + (`timestamp (if (eq 'inactive (org-element-property :type context)) + (call-interactively #'org-time-stamp-inactive) + (call-interactively #'org-time-stamp))) + (`link (call-interactively #'ffap)) + (_ (user-error "No special environment to edit here")))))))) + +(defun org-ctrl-c-ctrl-c (&optional arg) + "Set tags in headline, or update according to changed information at point. + +This command does many different things, depending on context: + +- If column view is active, in agenda or org buffers, quit it. + +- If there are highlights, remove them. + +- If a function in `org-ctrl-c-ctrl-c-hook' recognizes this location, + this is what we do. + +- If the cursor is on a statistics cookie, update it. + +- If the cursor is in a headline, in an agenda or an org buffer, + prompt for tags and insert them into the current line, aligned + to `org-tags-column'. When called with prefix arg, realign all + tags in the current buffer. + +- If the cursor is in one of the special #+KEYWORD lines, this + triggers scanning the buffer for these lines and updating the + information. + +- If the cursor is inside a table, realign the table. This command + works even if the automatic table editor has been turned off. + +- If the cursor is on a #+TBLFM line, re-apply the formulas to + the entire table. + +- If the cursor is at a footnote reference or definition, jump to + the corresponding definition or references, respectively. + +- If the cursor is a the beginning of a dynamic block, update it. + +- If the current buffer is a capture buffer, close note and file it. + +- If the cursor is on a <<<target>>>, update radio targets and + corresponding links in this buffer. + +- If the cursor is on a numbered item in a plain list, renumber the + ordered list. + +- If the cursor is on a checkbox, toggle it. + +- If the cursor is on a code block, evaluate it. The variable + `org-confirm-babel-evaluate' can be used to control prompting + before code block evaluation, by default every code block + evaluation requires confirmation. Code block evaluation can be + inhibited by setting `org-babel-no-eval-on-ctrl-c-ctrl-c'." + (interactive "P") + (cond + ((bound-and-true-p org-columns-overlays) (org-columns-quit)) + ((or (bound-and-true-p org-clock-overlays) org-occur-highlights) + (when (boundp 'org-clock-overlays) (org-clock-remove-overlays)) + (org-remove-occur-highlights) + (message "Temporary highlights/overlays removed from current buffer")) + ((and (local-variable-p 'org-finish-function) + (fboundp org-finish-function)) + (funcall org-finish-function)) + ((org-babel-hash-at-point)) + ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) + (t + (let* ((context + (org-element-lineage + (org-element-context) + ;; Limit to supported contexts. + '(babel-call clock dynamic-block footnote-definition + footnote-reference inline-babel-call inline-src-block + inlinetask item keyword node-property paragraph + plain-list planning property-drawer radio-target + src-block statistics-cookie table table-cell table-row + timestamp) + t)) + (radio-list-p (org-at-radio-list-p)) + (type (org-element-type context))) + ;; For convenience: at the first line of a paragraph on the same + ;; line as an item, apply function on that item instead. + (when (eq type 'paragraph) + (let ((parent (org-element-property :parent context))) + (when (and (eq (org-element-type parent) 'item) + (= (line-beginning-position) + (org-element-property :begin parent))) + (setq context parent) + (setq type 'item)))) + ;; Act according to type of element or object at point. + ;; + ;; Do nothing on a blank line, except if it is contained in + ;; a source block. Hence, we first check if point is in such + ;; a block and then if it is at a blank line. + (pcase type + ((or `inline-src-block `src-block) + (unless org-babel-no-eval-on-ctrl-c-ctrl-c + (org-babel-eval-wipe-error-buffer) + (org-babel-execute-src-block + current-prefix-arg (org-babel-get-src-block-info nil context)))) + ((guard (org-match-line "[ \t]*$")) + (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) + (user-error + (substitute-command-keys + "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) + ((or `babel-call `inline-babel-call) + (let ((info (org-babel-lob-get-info context))) + (when info (org-babel-execute-src-block nil info)))) + (`clock (org-clock-update-time-maybe)) + (`dynamic-block + (save-excursion + (goto-char (org-element-property :post-affiliated context)) + (org-update-dblock))) + (`footnote-definition + (goto-char (org-element-property :post-affiliated context)) + (call-interactively 'org-footnote-action)) + (`footnote-reference (call-interactively #'org-footnote-action)) + ((or `headline `inlinetask) + (save-excursion (goto-char (org-element-property :begin context)) + (call-interactively #'org-set-tags-command))) + (`item + ;; At an item: `C-u C-u' sets checkbox to "[-]" + ;; unconditionally, whereas `C-u' will toggle its presence. + ;; Without a universal argument, if the item has a checkbox, + ;; toggle it. Otherwise repair the list. + (if (or radio-list-p + (and (boundp org-list-checkbox-radio-mode) + org-list-checkbox-radio-mode)) + (org-toggle-radio-button arg) + (let* ((box (org-element-property :checkbox context)) + (struct (org-element-property :structure context)) + (old-struct (copy-tree struct)) + (parents (org-list-parents-alist struct)) + (prevs (org-list-prevs-alist struct)) + (orderedp (org-not-nil (org-entry-get nil "ORDERED")))) + (org-list-set-checkbox + (org-element-property :begin context) struct + (cond ((equal arg '(16)) "[-]") + ((and (not box) (equal arg '(4))) "[ ]") + ((or (not box) (equal arg '(4))) nil) + ((eq box 'on) "[ ]") + (t "[X]"))) + ;; Mimic `org-list-write-struct' but with grabbing a return + ;; value from `org-list-struct-fix-box'. + (org-list-struct-fix-ind struct parents 2) + (org-list-struct-fix-item-end struct) + (org-list-struct-fix-bul struct prevs) + (org-list-struct-fix-ind struct parents) + (let ((block-item + (org-list-struct-fix-box struct parents prevs orderedp))) + (if (and box (equal struct old-struct)) + (if (equal arg '(16)) + (message "Checkboxes already reset") + (user-error "Cannot toggle this checkbox: %s" + (if (eq box 'on) + "all subitems checked" + "unchecked subitems"))) + (org-list-struct-apply-struct struct old-struct) + (org-update-checkbox-count-maybe)) + (when block-item + (message "Checkboxes were removed due to empty box at line %d" + (org-current-line block-item))))))) + (`plain-list + ;; At a plain list, with a double C-u argument, set + ;; checkboxes of each item to "[-]", whereas a single one + ;; will toggle their presence according to the state of the + ;; first item in the list. Without an argument, repair the + ;; list. + (if (or radio-list-p + (and (boundp org-list-checkbox-radio-mode) + org-list-checkbox-radio-mode)) + (org-toggle-radio-button arg) + (let* ((begin (org-element-property :contents-begin context)) + (struct (org-element-property :structure context)) + (old-struct (copy-tree struct)) + (first-box (save-excursion + (goto-char begin) + (looking-at org-list-full-item-re) + (match-string-no-properties 3))) + (new-box (cond ((equal arg '(16)) "[-]") + ((equal arg '(4)) (unless first-box "[ ]")) + ((equal first-box "[X]") "[ ]") + (t "[X]")))) + (cond + (arg + (dolist (pos + (org-list-get-all-items + begin struct (org-list-prevs-alist struct))) + (org-list-set-checkbox pos struct new-box))) + ((and first-box (eq (point) begin)) + ;; For convenience, when point is at bol on the first + ;; item of the list and no argument is provided, simply + ;; toggle checkbox of that item, if any. + (org-list-set-checkbox begin struct new-box))) + (when (equal + (org-list-write-struct + struct (org-list-parents-alist struct) old-struct) + old-struct) + (message "Cannot update this checkbox")) + (org-update-checkbox-count-maybe)))) + (`keyword + (let ((org-inhibit-startup-visibility-stuff t) + (org-startup-align-all-tables nil)) + (when (boundp 'org-table-coordinate-overlays) + (mapc #'delete-overlay org-table-coordinate-overlays) + (setq org-table-coordinate-overlays nil)) + (org-save-outline-visibility 'use-markers (org-mode-restart))) + (message "Local setup has been refreshed")) + ((or `property-drawer `node-property) + (call-interactively #'org-property-action)) + (`radio-target + (call-interactively #'org-update-radio-target-regexp)) + (`statistics-cookie + (call-interactively #'org-update-statistics-cookies)) + ((or `table `table-cell `table-row) + ;; At a table, generate a plot if on the #+plot line, + ;; recalculate every field and align it otherwise. Also + ;; send the table if necessary. + (cond + ((and (org-match-line "[ \t]*#\\+plot:") + (< (point) (org-element-property :post-affiliated context))) + (org-plot/gnuplot)) + ;; If the table has a `table.el' type, just give up. + ((eq (org-element-property :type context) 'table.el) + (message "%s" (substitute-command-keys "\\<org-mode-map>\ +Use `\\[org-edit-special]' to edit table.el tables"))) + ;; At a table row or cell, maybe recalculate line but always + ;; align table. + ((or (eq type 'table) + ;; Check if point is at a TBLFM line. + (and (eq type 'table-row) + (= (point) (org-element-property :end context)))) + (save-excursion + (if (org-at-TBLFM-p) + (progn (require 'org-table) + (org-table-calc-current-TBLFM)) + (goto-char (org-element-property :contents-begin context)) + (org-call-with-arg 'org-table-recalculate (or arg t)) + (orgtbl-send-table 'maybe)))) + (t + (org-table-maybe-eval-formula) + (cond (arg (call-interactively #'org-table-recalculate)) + ((org-table-maybe-recalculate-line)) + (t (org-table-align)))))) + ((or `timestamp (and `planning (guard (org-at-timestamp-p 'lax)))) + (org-timestamp-change 0 'day)) + ((and `nil (guard (org-at-heading-p))) + ;; When point is on an unsupported object type, we can miss + ;; the fact that it also is at a heading. Handle it here. + (call-interactively #'org-set-tags-command)) + ((guard + (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook))) + (_ + (user-error + (substitute-command-keys + "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))))))) + +(defun org-mode-restart () + "Restart `org-mode'." + (interactive) + (let ((indent-status (bound-and-true-p org-indent-mode))) + (funcall major-mode) + (hack-local-variables) + (when (and indent-status (not (bound-and-true-p org-indent-mode))) + (org-indent-mode -1)) + (org-reset-file-cache)) + (message "%s restarted" major-mode)) + +(defun org-flag-above-first-heading (&optional arg) + "Hide from bob up to the first heading. +Move point to the beginning of first heading or end of buffer." + (goto-char (point-min)) + (unless (org-at-heading-p) + (outline-next-heading)) + (unless (bobp) + (org-flag-region 1 (1- (point)) (not arg) 'outline))) + +(defun org-show-branches-buffer () + "Show all branches in the buffer." + (org-flag-above-first-heading) + (outline-hide-sublevels 1) + (unless (eobp) + (outline-show-branches) + (while (outline-get-next-sibling) + (outline-show-branches))) + (goto-char (point-min))) + +(defun org-kill-note-or-show-branches () + "Abort storing current note, or show just branches." + (interactive) + (cond (org-finish-function + (let ((org-note-abort t)) (funcall org-finish-function))) + ((org-before-first-heading-p) + (org-show-branches-buffer) + (org-hide-archived-subtrees (point-min) (point-max))) + (t + (let ((beg (progn (org-back-to-heading) (point))) + (end (save-excursion (org-end-of-subtree t t) (point)))) + (outline-hide-subtree) + (outline-show-branches) + (org-hide-archived-subtrees beg end))))) + +(defun org-delete-indentation (&optional arg) + "Join current line to previous and fix whitespace at join. + +If previous line is a headline add to headline title. Otherwise +the function calls `delete-indentation'. + +I.e. with a non-nil optional argument, join the line with the +following one. If there is a region then join the lines in that +region." + (interactive "*P") + (if (save-excursion + (beginning-of-line (if arg 1 0)) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp))) + ;; At headline. + (let ((tags-column (when (match-beginning 5) + (save-excursion (goto-char (match-beginning 5)) + (current-column)))) + (string (concat " " (progn (when arg (forward-line 1)) + (org-trim (delete-and-extract-region + (line-beginning-position) + (line-end-position))))))) + (unless (bobp) (delete-region (point) (1- (point)))) + (goto-char (or (match-end 4) + (match-beginning 5) + (match-end 0))) + (skip-chars-backward " \t") + (save-excursion (insert string)) + ;; Adjust alignment of tags. + (cond + ((not tags-column)) ;no tags + (org-auto-align-tags (org-align-tags)) + (t (org--align-tags-here tags-column)))) ;preserve tags column + (let ((current-prefix-arg arg)) + (call-interactively #'delete-indentation)))) + +(defun org-open-line (n) + "Insert a new row in tables, call `open-line' elsewhere. +If `org-special-ctrl-o' is nil, just call `open-line' everywhere. +As a special case, when a document starts with a table, allow to +call `open-line' on the very first character." + (interactive "*p") + (if (and org-special-ctrl-o (/= (point) 1) (org-at-table-p)) + (org-table-insert-row) + (open-line n))) + +(defun org--newline (indent arg interactive) + "Call `newline-and-indent' or just `newline'. +If INDENT is non-nil, call `newline-and-indent' with ARG to +indent unconditionally; otherwise, call `newline' with ARG and +INTERACTIVE, which can trigger indentation if +`electric-indent-mode' is enabled." + (if indent + (org-newline-and-indent arg) + (newline arg interactive))) + +(defun org-return (&optional indent arg interactive) + "Goto next table row or insert a newline. + +Calls `org-table-next-row' or `newline', depending on context. + +When optional INDENT argument is non-nil, call +`newline-and-indent' with ARG, otherwise call `newline' with ARG +and INTERACTIVE. + +When `org-return-follows-link' is non-nil and point is on +a timestamp or a link, call `org-open-at-point'. However, it +will not happen if point is in a table or on a \"dead\" +object (e.g., within a comment). In these case, you need to use +`org-open-at-point' directly." + (interactive "i\nP\np") + (let* ((context (if org-return-follows-link (org-element-context) + (org-element-at-point))) + (element-type (org-element-type context))) + (cond + ;; In a table, call `org-table-next-row'. However, before first + ;; column or after last one, split the table. + ((or (and (eq 'table element-type) + (not (eq 'table.el (org-element-property :type context))) + (>= (point) (org-element-property :contents-begin context)) + (< (point) (org-element-property :contents-end context))) + (org-element-lineage context '(table-row table-cell) t)) + (if (or (looking-at-p "[ \t]*$") + (save-excursion (skip-chars-backward " \t") (bolp))) + (insert "\n") + (org-table-justify-field-maybe) + (call-interactively #'org-table-next-row))) + ;; On a link or a timestamp, call `org-open-at-point' if + ;; `org-return-follows-link' allows it. Tolerate fuzzy + ;; locations, e.g., in a comment, as `org-open-at-point'. + ((and org-return-follows-link + (or (and (eq 'link element-type) + ;; Ensure point is not on the white spaces after + ;; the link. + (let ((origin (point))) + (org-with-point-at (org-element-property :end context) + (skip-chars-backward " \t") + (> (point) origin)))) + (org-in-regexp org-ts-regexp-both nil t) + (org-in-regexp org-tsr-regexp-both nil t) + (org-in-regexp org-link-any-re nil t))) + (call-interactively #'org-open-at-point)) + ;; Insert newline in heading, but preserve tags. + ((and (not (bolp)) + (let ((case-fold-search nil)) + (org-match-line org-complex-heading-regexp))) + ;; At headline. Split line. However, if point is on keyword, + ;; priority cookie or tags, do not break any of them: add + ;; a newline after the headline instead. + (let ((tags-column (and (match-beginning 5) + (save-excursion (goto-char (match-beginning 5)) + (current-column)))) + (string + (when (and (match-end 4) (org-point-in-group (point) 4)) + (delete-and-extract-region (point) (match-end 4))))) + ;; Adjust tag alignment. + (cond + ((not (and tags-column string))) + (org-auto-align-tags (org-align-tags)) + (t (org--align-tags-here tags-column))) ;preserve tags column + (end-of-line) + (org-show-entry) + (org--newline indent arg interactive) + (when string (save-excursion (insert (org-trim string)))))) + ;; In a list, make sure indenting keeps trailing text within. + ((and (not (eolp)) + (org-element-lineage context '(item))) + (let ((trailing-data + (delete-and-extract-region (point) (line-end-position)))) + (org--newline indent arg interactive) + (save-excursion (insert trailing-data)))) + (t + ;; Do not auto-fill when point is in an Org property drawer. + (let ((auto-fill-function (and (not (org-at-property-p)) + auto-fill-function))) + (org--newline indent arg interactive)))))) + +(defun org-return-and-maybe-indent () + "Goto next table row, or insert a newline, maybe indented. +Call `org-table-next-row' or `org-return', depending on context. +See the individual commands for more information. + +When inserting a newline, if `org-adapt-indentation' is t: +indent the line if `electric-indent-mode' is disabled, don't +indent it if it is enabled." + (interactive) + (org-return (not electric-indent-mode))) + +(defun org-ctrl-c-tab (&optional arg) + "Toggle columns width in a table, or show children. +Call `org-table-toggle-column-width' if point is in a table. +Otherwise provide a compact view of the children. ARG is the +level to hide." + (interactive "p") + (cond + ((org-at-table-p) + (call-interactively #'org-table-toggle-column-width)) + ((org-before-first-heading-p) + (save-excursion + (org-flag-above-first-heading) + (outline-hide-sublevels (or arg 1)))) + (t + (outline-hide-subtree) + (org-show-children arg)))) + +(defun org-ctrl-c-star () + "Compute table, or change heading status of lines. +Calls `org-table-recalculate' or `org-toggle-heading', +depending on context." + (interactive) + (cond + ((org-at-table-p) + (call-interactively 'org-table-recalculate)) + (t + ;; Convert all lines in region to list items + (call-interactively 'org-toggle-heading)))) + +(defun org-ctrl-c-minus () + "Insert separator line in table or modify bullet status of line. +Also turns a plain line or a region of lines into list items. +Calls `org-table-insert-hline', `org-toggle-item', or +`org-cycle-list-bullet', depending on context." + (interactive) + (cond + ((org-at-table-p) + (call-interactively 'org-table-insert-hline)) + ((org-region-active-p) + (call-interactively 'org-toggle-item)) + ((org-in-item-p) + (call-interactively 'org-cycle-list-bullet)) + (t + (call-interactively 'org-toggle-item)))) + +(defun org-toggle-heading (&optional nstars) + "Convert headings to normal text, or items or text to headings. +If there is no active region, only convert the current line. + +With a `\\[universal-argument]' prefix, convert the whole list at +point into heading. + +In a region: + +- If the first non blank line is a headline, remove the stars + from all headlines in the region. + +- If it is a normal line, turn each and every normal line (i.e., + not an heading or an item) in the region into headings. If you + want to convert only the first line of this region, use one + universal prefix argument. + +- If it is a plain list item, turn all plain list items into headings. + +When converting a line into a heading, the number of stars is chosen +such that the lines become children of the current entry. However, +when a numeric prefix argument is given, its value determines the +number of stars to add." + (interactive "P") + (let ((skip-blanks + ;; Return beginning of first non-blank line, starting from + ;; line at POS. + (lambda (pos) + (save-excursion + (goto-char pos) + (while (org-at-comment-p) (forward-line)) + (skip-chars-forward " \r\t\n") + (point-at-bol)))) + beg end toggled) + ;; Determine boundaries of changes. If a universal prefix has + ;; been given, put the list in a region. If region ends at a bol, + ;; do not consider the last line to be in the region. + + (when (and current-prefix-arg (org-at-item-p)) + (when (listp current-prefix-arg) (setq current-prefix-arg 1)) + (org-mark-element)) + + (if (org-region-active-p) + (setq beg (funcall skip-blanks (region-beginning)) + end (copy-marker (save-excursion + (goto-char (region-end)) + (if (bolp) (point) (point-at-eol))))) + (setq beg (funcall skip-blanks (point-at-bol)) + end (copy-marker (point-at-eol)))) + ;; Ensure inline tasks don't count as headings. + (org-with-limited-levels + (save-excursion + (goto-char beg) + (cond + ;; Case 1. Started at an heading: de-star headings. + ((org-at-heading-p) + (while (< (point) end) + (when (org-at-heading-p t) + (looking-at org-outline-regexp) (replace-match "") + (setq toggled t)) + (forward-line))) + ;; Case 2. Started at an item: change items into headlines. + ;; One star will be added by `org-list-to-subtree'. + ((org-at-item-p) + (while (< (point) end) + (when (org-at-item-p) + ;; Pay attention to cases when region ends before list. + (let* ((struct (org-list-struct)) + (list-end + (min (org-list-get-bottom-point struct) (1+ end)))) + (save-restriction + (narrow-to-region (point) list-end) + (insert (org-list-to-subtree + (org-list-to-lisp t) + (pcase (org-current-level) + (`nil 1) + (l (1+ (org-reduced-level l))))) + "\n"))) + (setq toggled t)) + (forward-line))) + ;; Case 3. Started at normal text: make every line an heading, + ;; skipping headlines and items. + (t (let* ((stars + (make-string + (if (numberp nstars) nstars (or (org-current-level) 0)) ?*)) + (add-stars + (cond (nstars "") ; stars from prefix only + ((equal stars "") "*") ; before first heading + (org-odd-levels-only "**") ; inside heading, odd + (t "*"))) ; inside heading, oddeven + (rpl (concat stars add-stars " ")) + (lend (when (listp nstars) (save-excursion (end-of-line) (point))))) + (while (< (point) (if (equal nstars '(4)) lend end)) + (when (and (not (or (org-at-heading-p) (org-at-item-p) (org-at-comment-p))) + (looking-at "\\([ \t]*\\)\\(\\S-\\)")) + (replace-match (concat rpl (match-string 2))) (setq toggled t)) + (forward-line))))))) + (unless toggled (message "Cannot toggle heading from here")))) + +(defun org-meta-return (&optional arg) + "Insert a new heading or wrap a region in a table. +Calls `org-insert-heading', `org-insert-item' or +`org-table-wrap-region', depending on context. When called with +an argument, unconditionally call `org-insert-heading'." + (interactive "P") + (org-check-before-invisible-edit 'insert) + (or (run-hook-with-args-until-success 'org-metareturn-hook) + (call-interactively (cond (arg #'org-insert-heading) + ((org-at-table-p) #'org-table-wrap-region) + ((org-in-item-p) #'org-insert-item) + (t #'org-insert-heading))))) + +;;; Menu entries +(defsubst org-in-subtree-not-table-p () + "Are we in a subtree and not in a table?" + (and (not (org-before-first-heading-p)) + (not (org-at-table-p)))) + +;; Define the Org mode menus +(easy-menu-define org-org-menu org-mode-map "Org menu." + `("Org" + ("Show/Hide" + ["Cycle Visibility" org-cycle :active (or (bobp) (outline-on-heading-p))] + ["Cycle Global Visibility" org-shifttab :active (not (org-at-table-p))] + ["Sparse Tree..." org-sparse-tree t] + ["Reveal Context" org-reveal t] + ["Show All" org-show-all t] + "--" + ["Subtree to indirect buffer" org-tree-to-indirect-buffer t]) + "--" + ["New Heading" org-insert-heading t] + ("Navigate Headings" + ["Up" outline-up-heading t] + ["Next" outline-next-visible-heading t] + ["Previous" outline-previous-visible-heading t] + ["Next Same Level" outline-forward-same-level t] + ["Previous Same Level" outline-backward-same-level t] + "--" + ["Jump" org-goto t]) + ("Edit Structure" + ["Move Subtree Up" org-metaup (org-at-heading-p)] + ["Move Subtree Down" org-metadown (org-at-heading-p)] + "--" + ["Copy Subtree" org-copy-special (org-in-subtree-not-table-p)] + ["Cut Subtree" org-cut-special (org-in-subtree-not-table-p)] + ["Paste Subtree" org-paste-special (not (org-at-table-p))] + "--" + ["Clone subtree, shift time" org-clone-subtree-with-time-shift t] + "--" + ["Copy visible text" org-copy-visible t] + "--" + ["Promote Heading" org-metaleft (org-in-subtree-not-table-p)] + ["Promote Subtree" org-shiftmetaleft (org-in-subtree-not-table-p)] + ["Demote Heading" org-metaright (org-in-subtree-not-table-p)] + ["Demote Subtree" org-shiftmetaright (org-in-subtree-not-table-p)] + "--" + ["Sort Region/Children" org-sort t] + "--" + ["Convert to odd levels" org-convert-to-odd-levels t] + ["Convert to odd/even levels" org-convert-to-oddeven-levels t]) + ("Editing" + ["Emphasis..." org-emphasize t] + ["Add block structure" org-insert-structure-template t] + ["Edit Source Example" org-edit-special t] + "--" + ["Footnote new/jump" org-footnote-action t] + ["Footnote extra" (org-footnote-action t) :active t :keys "C-u C-c C-x f"]) + ("Archive" + ["Archive (default method)" org-archive-subtree-default (org-in-subtree-not-table-p)] + "--" + ["Move Subtree to Archive file" org-archive-subtree (org-in-subtree-not-table-p)] + ["Toggle ARCHIVE tag" org-toggle-archive-tag (org-in-subtree-not-table-p)] + ["Move subtree to Archive sibling" org-archive-to-archive-sibling (org-in-subtree-not-table-p)]) + "--" + ("Hyperlinks" + ["Store Link (Global)" org-store-link t] + ["Find existing link to here" org-occur-link-in-agenda-files t] + ["Insert Link" org-insert-link t] + ["Follow Link" org-open-at-point t] + "--" + ["Next link" org-next-link t] + ["Previous link" org-previous-link t] + "--" + ["Descriptive Links" + org-toggle-link-display + :style radio + :selected org-descriptive-links + ] + ["Literal Links" + org-toggle-link-display + :style radio + :selected (not org-descriptive-links)]) + "--" + ("TODO Lists" + ["TODO/DONE/-" org-todo t] + ("Select keyword" + ["Next keyword" org-shiftright (org-at-heading-p)] + ["Previous keyword" org-shiftleft (org-at-heading-p)] + ["Complete Keyword" pcomplete (assq :todo-keyword (org-context))] + ["Next keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-at-heading-p))] + ["Previous keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-at-heading-p))]) + ["Show TODO Tree" org-show-todo-tree :active t :keys "C-c / t"] + ["Global TODO list" org-todo-list :active t :keys "\\[org-agenda] t"] + "--" + ["Enforce dependencies" (customize-variable 'org-enforce-todo-dependencies) + :selected org-enforce-todo-dependencies :style toggle :active t] + "Settings for tree at point" + ["Do Children sequentially" org-toggle-ordered-property :style radio + :selected (org-entry-get nil "ORDERED") + :active org-enforce-todo-dependencies :keys "C-c C-x o"] + ["Do Children parallel" org-toggle-ordered-property :style radio + :selected (not (org-entry-get nil "ORDERED")) + :active org-enforce-todo-dependencies :keys "C-c C-x o"] + "--" + ["Set Priority" org-priority t] + ["Priority Up" org-shiftup t] + ["Priority Down" org-shiftdown t] + "--" + ["Get news from all feeds" org-feed-update-all t] + ["Go to the inbox of a feed..." org-feed-goto-inbox t] + ["Customize feeds" (customize-variable 'org-feed-alist) t]) + ("TAGS and Properties" + ["Set Tags" org-set-tags-command (not (org-before-first-heading-p))] + ["Change tag in region" org-change-tag-in-region (org-region-active-p)] + "--" + ["Set property" org-set-property (not (org-before-first-heading-p))] + ["Column view of properties" org-columns t] + ["Insert Column View DBlock" org-columns-insert-dblock t]) + ("Dates and Scheduling" + ["Timestamp" org-time-stamp (not (org-before-first-heading-p))] + ["Timestamp (inactive)" org-time-stamp-inactive (not (org-before-first-heading-p))] + ("Change Date" + ["1 Day Later" org-shiftright (org-at-timestamp-p 'lax)] + ["1 Day Earlier" org-shiftleft (org-at-timestamp-p 'lax)] + ["1 ... Later" org-shiftup (org-at-timestamp-p 'lax)] + ["1 ... Earlier" org-shiftdown (org-at-timestamp-p 'lax)]) + ["Compute Time Range" org-evaluate-time-range t] + ["Schedule Item" org-schedule (not (org-before-first-heading-p))] + ["Deadline" org-deadline (not (org-before-first-heading-p))] + "--" + ["Custom time format" org-toggle-time-stamp-overlays + :style radio :selected org-display-custom-times] + "--" + ["Goto Calendar" org-goto-calendar t] + ["Date from Calendar" org-date-from-calendar t] + "--" + ["Start/Restart Timer" org-timer-start t] + ["Pause/Continue Timer" org-timer-pause-or-continue t] + ["Stop Timer" org-timer-pause-or-continue :active t :keys "C-u C-c C-x ,"] + ["Insert Timer String" org-timer t] + ["Insert Timer Item" org-timer-item t]) + ("Logging work" + ["Clock in" org-clock-in :active t :keys "C-c C-x C-i"] + ["Switch task" (lambda () (interactive) (org-clock-in '(4))) :active t :keys "C-u C-c C-x C-i"] + ["Clock out" org-clock-out t] + ["Clock cancel" org-clock-cancel t] + "--" + ["Mark as default task" org-clock-mark-default-task t] + ["Clock in, mark as default" (lambda () (interactive) (org-clock-in '(16))) :active t :keys "C-u C-u C-c C-x C-i"] + ["Goto running clock" org-clock-goto t] + "--" + ["Display times" org-clock-display t] + ["Create clock table" org-clock-report t] + "--" + ["Record DONE time" + (progn (setq org-log-done (not org-log-done)) + (message "Switching to %s will %s record a timestamp" + (car org-done-keywords) + (if org-log-done "automatically" "not"))) + :style toggle :selected org-log-done]) + "--" + ["Agenda Command..." org-agenda t] + ["Set Restriction Lock" org-agenda-set-restriction-lock t] + ("File List for Agenda") + ("Special views current file" + ["TODO Tree" org-show-todo-tree t] + ["Check Deadlines" org-check-deadlines t] + ["Tags/Property tree" org-match-sparse-tree t]) + "--" + ["Export/Publish..." org-export-dispatch t] + ("LaTeX" + ["Org CDLaTeX mode" org-cdlatex-mode :active (require 'cdlatex nil t) + :style toggle :selected org-cdlatex-mode] + ["Insert Environment" cdlatex-environment (fboundp 'cdlatex-environment)] + ["Insert math symbol" cdlatex-math-symbol (fboundp 'cdlatex-math-symbol)] + ["Modify math symbol" org-cdlatex-math-modify + (org-inside-LaTeX-fragment-p)] + ["Insert citation" org-reftex-citation t]) + "--" + ("Documentation" + ["Show Version" org-version t] + ["Info Documentation" org-info t] + ["Browse Org News" org-browse-news t]) + ("Customize" + ["Browse Org Group" org-customize t] + "--" + ["Expand This Menu" org-create-customize-menu t]) + ["Send bug report" org-submit-bug-report t] + "--" + ("Refresh/Reload" + ["Refresh setup current buffer" org-mode-restart t] + ["Reload Org (after update)" org-reload t] + ["Reload Org uncompiled" (org-reload t) :active t :keys "C-u C-c C-x !"]))) + +(easy-menu-define org-tbl-menu org-mode-map "Org Table menu." + '("Table" + ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p)] + ["Next Field" org-cycle (org-at-table-p)] + ["Previous Field" org-shifttab (org-at-table-p)] + ["Next Row" org-return (org-at-table-p)] + "--" + ["Blank Field" org-table-blank-field (org-at-table-p)] + ["Edit Field" org-table-edit-field (org-at-table-p)] + ["Copy Field from Above" org-table-copy-down (org-at-table-p)] + "--" + ("Column" + ["Move Column Left" org-metaleft (org-at-table-p)] + ["Move Column Right" org-metaright (org-at-table-p)] + ["Delete Column" org-shiftmetaleft (org-at-table-p)] + ["Insert Column" org-shiftmetaright (org-at-table-p)] + ["Shrink Column" org-table-toggle-column-width (org-at-table-p)]) + ("Row" + ["Move Row Up" org-metaup (org-at-table-p)] + ["Move Row Down" org-metadown (org-at-table-p)] + ["Delete Row" org-shiftmetaup (org-at-table-p)] + ["Insert Row" org-shiftmetadown (org-at-table-p)] + ["Sort lines in region" org-table-sort-lines (org-at-table-p)] + "--" + ["Insert Hline" org-ctrl-c-minus (org-at-table-p)]) + ("Rectangle" + ["Copy Rectangle" org-copy-special (org-at-table-p)] + ["Cut Rectangle" org-cut-special (org-at-table-p)] + ["Paste Rectangle" org-paste-special (org-at-table-p)] + ["Fill Rectangle" org-table-wrap-region (org-at-table-p)]) + "--" + ("Calculate" + ["Set Column Formula" org-table-eval-formula (org-at-table-p)] + ["Set Field Formula" (org-table-eval-formula '(4)) :active (org-at-table-p) :keys "C-u C-c ="] + ["Edit Formulas" org-edit-special (org-at-table-p)] + "--" + ["Recalculate line" org-table-recalculate (org-at-table-p)] + ["Recalculate all" (lambda () (interactive) (org-table-recalculate '(4))) :active (org-at-table-p) :keys "C-u C-c *"] + ["Iterate all" (lambda () (interactive) (org-table-recalculate '(16))) :active (org-at-table-p) :keys "C-u C-u C-c *"] + "--" + ["Toggle Recalculate Mark" org-table-rotate-recalc-marks (org-at-table-p)] + "--" + ["Sum Column/Rectangle" org-table-sum + (or (org-at-table-p) (org-region-active-p))] + ["Which Column?" org-table-current-column (org-at-table-p)]) + ["Debug Formulas" + org-table-toggle-formula-debugger + :style toggle :selected (bound-and-true-p org-table-formula-debug)] + ["Show Col/Row Numbers" + org-table-toggle-coordinate-overlays + :style toggle + :selected (bound-and-true-p org-table-overlay-coordinates)] + "--" + ["Create" org-table-create (not (org-at-table-p))] + ["Convert Region" org-table-convert-region (not (org-at-table-p 'any))] + ["Import from File" org-table-import (not (org-at-table-p))] + ["Export to File" org-table-export (org-at-table-p)] + "--" + ["Create/Convert from/to table.el" org-table-create-with-table.el t] + "--" + ("Plot" + ["Ascii plot" orgtbl-ascii-plot :active (org-at-table-p) :keys "C-c \" a"] + ["Gnuplot" org-plot/gnuplot :active (org-at-table-p) :keys "C-c \" g"]))) + +(defun org-info (&optional node) + "Read documentation for Org in the info system. +With optional NODE, go directly to that node." + (interactive) + (info (format "(org)%s" (or node "")))) + +(defun org-browse-news () + "Browse the news for the latest major release." + (interactive) + (browse-url "https://orgmode.org/Changes.html")) + +;;;###autoload +(defun org-submit-bug-report () + "Submit a bug report on Org via mail. + +Don't hesitate to report any problems or inaccurate documentation. + +If you don't have setup sending mail from (X)Emacs, please copy the +output buffer into your mail program, as it gives us important +information about your Org version and configuration." + (interactive) + (require 'reporter) + (defvar reporter-prompt-for-summary-p) + (org-load-modules-maybe) + (org-require-autoloaded-modules) + (let ((reporter-prompt-for-summary-p "Bug report subject: ")) + (reporter-submit-bug-report + "emacs-orgmode@gnu.org" + (org-version nil 'full) + (let (list) + (save-window-excursion + (pop-to-buffer-same-window (get-buffer-create "*Warn about privacy*")) + (delete-other-windows) + (erase-buffer) + (insert "You are about to submit a bug report to the Org mailing list. + +If your report is about Org installation, please read this section: +https://orgmode.org/org.html#Installation + +Please read https://orgmode.org/org.html#Feedback on how to make +a good report, it will help Org contributors fixing your problem. + +Search https://lists.gnu.org/archive/html/emacs-orgmode/ to see +if the issue you are about to raise has already been dealt with. + +We also would like to add your full Org and Outline configuration +to the bug report. It will help us debugging the issue. + +*HOWEVER*, some variables you have customized may contain private +information. The names of customers, colleagues, or friends, might +appear in the form of file names, tags, todo states or search strings. +If you answer \"yes\" to the prompt, you might want to check and remove +such private information before sending the email.") + (add-text-properties (point-min) (point-max) '(face org-warning)) + (when (yes-or-no-p "Include your Org configuration ") + (mapatoms + (lambda (v) + (and (boundp v) + (string-match "\\`\\(org-\\|outline-\\)" (symbol-name v)) + (or (and (symbol-value v) + (string-match "\\(-hook\\|-function\\)\\'" (symbol-name v))) + (and + (get v 'custom-type) (get v 'standard-value) + (not (equal (symbol-value v) (eval (car (get v 'standard-value))))))) + (push v list))))) + (kill-buffer (get-buffer "*Warn about privacy*")) + list)) + nil nil + "Remember to cover the basics, that is, what you expected to happen and +what in fact did happen. You don't know how to make a good report? See + + https://orgmode.org/manual/Feedback.html#Feedback + +Your bug report will be posted to the Org mailing list. +------------------------------------------------------------------------") + (save-excursion + (when (re-search-backward "^\\(Subject: \\)Org mode version \\(.*?\\);[ \t]*\\(.*\\)" nil t) + (replace-match "\\1[BUG] \\3 [\\2]"))))) + + +(defun org-install-agenda-files-menu () + "Install agenda file menu." + (let ((bl (buffer-list))) + (save-excursion + (while bl + (set-buffer (pop bl)) + (when (derived-mode-p 'org-mode) (setq bl nil))) + (when (derived-mode-p 'org-mode) + (easy-menu-change + '("Org") "File List for Agenda" + (append + (list + ["Edit File List" (org-edit-agenda-file-list) t] + ["Add/Move Current File to Front of List" org-agenda-file-to-front t] + ["Remove Current File from List" org-remove-file t] + ["Cycle through agenda files" org-cycle-agenda-files t] + ["Occur in all agenda files" org-occur-in-agenda-files t] + "--") + (mapcar 'org-file-menu-entry + ;; Prevent initialization from failing. + (ignore-errors (org-agenda-files t))))))))) + +;;;; Documentation + +(defun org-require-autoloaded-modules () + (interactive) + (mapc #'require + '(org-agenda org-archive org-attach org-clock org-colview org-id + org-table org-timer))) + +;;;###autoload +(defun org-reload (&optional uncompiled) + "Reload all Org Lisp files. +With prefix arg UNCOMPILED, load the uncompiled versions." + (interactive "P") + (require 'loadhist) + (let* ((org-dir (org-find-library-dir "org")) + (contrib-dir (or (org-find-library-dir "org-contribdir") org-dir)) + (feature-re "^\\(org\\|ob\\|ox\\)\\(-.*\\)?") + (remove-re (format "\\`%s\\'" + (regexp-opt '("org" "org-loaddefs" "org-version")))) + (feats (delete-dups + (mapcar 'file-name-sans-extension + (mapcar 'file-name-nondirectory + (delq nil + (mapcar 'feature-file + features)))))) + (lfeat (append + (sort + (setq feats + (delq nil (mapcar + (lambda (f) + (if (and (string-match feature-re f) + (not (string-match remove-re f))) + f nil)) + feats))) + 'string-lessp) + (list "org-version" "org"))) + (load-suffixes (when (boundp 'load-suffixes) load-suffixes)) + (load-suffixes (if uncompiled (reverse load-suffixes) load-suffixes)) + load-uncore load-misses) + (setq load-misses + (delq 't + (mapcar (lambda (f) + (or (org-load-noerror-mustsuffix (concat org-dir f)) + (and (string= org-dir contrib-dir) + (org-load-noerror-mustsuffix (concat contrib-dir f))) + (and (org-load-noerror-mustsuffix (concat (org-find-library-dir f) f)) + (push f load-uncore) + 't) + f)) + lfeat))) + (when load-uncore + (message "The following feature%s found in load-path, please check if that's correct:\n%s" + (if (> (length load-uncore) 1) "s were" " was") + (reverse load-uncore))) + (if load-misses + (message "Some error occurred while reloading Org feature%s\n%s\nPlease check *Messages*!\n%s" + (if (> (length load-misses) 1) "s" "") load-misses (org-version nil 'full)) + (message "Successfully reloaded Org\n%s" (org-version nil 'full))))) + +;;;###autoload +(defun org-customize () + "Call the customize function with org as argument." + (interactive) + (org-load-modules-maybe) + (org-require-autoloaded-modules) + (customize-browse 'org)) + +(defun org-create-customize-menu () + "Create a full customization menu for Org mode, insert it into the menu." + (interactive) + (org-load-modules-maybe) + (org-require-autoloaded-modules) + (easy-menu-change + '("Org") "Customize" + `(["Browse Org group" org-customize t] + "--" + ,(customize-menu-create 'org) + ["Set" Custom-set t] + ["Save" Custom-save t] + ["Reset to Current" Custom-reset-current t] + ["Reset to Saved" Custom-reset-saved t] + ["Reset to Standard Settings" Custom-reset-standard t])) + (message "\"Org\"-menu now contains full customization menu")) + +;;;; Miscellaneous stuff + +;;; Generally useful functions + +(defun org-in-clocktable-p () + "Check if the cursor is in a clocktable." + (let ((pos (point)) start) + (save-excursion + (end-of-line 1) + (and (re-search-backward "^[ \t]*#\\+BEGIN:[ \t]+clocktable" nil t) + (setq start (match-beginning 0)) + (re-search-forward "^[ \t]*#\\+END:.*" nil t) + (>= (match-end 0) pos) + start)))) + +(defun org-in-verbatim-emphasis () + (save-match-data + (and (org-in-regexp org-verbatim-re 2) + (>= (point) (match-beginning 3)) + (<= (point) (match-end 4))))) + +(defun org-goto-marker-or-bmk (marker &optional bookmark) + "Go to MARKER, widen if necessary. When marker is not live, try BOOKMARK." + (if (and marker (marker-buffer marker) + (buffer-live-p (marker-buffer marker))) + (progn + (pop-to-buffer-same-window (marker-buffer marker)) + (when (or (> marker (point-max)) (< marker (point-min))) + (widen)) + (goto-char marker) + (org-show-context 'org-goto)) + (if bookmark + (bookmark-jump bookmark) + (error "Cannot find location")))) + +(defun org-quote-csv-field (s) + "Quote field for inclusion in CSV material." + (if (string-match "[\",]" s) + (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"") + s)) + +(defun org-force-self-insert (N) + "Needed to enforce self-insert under remapping." + (interactive "p") + (self-insert-command N)) + +(defun org-quote-vert (s) + "Replace \"|\" with \"\\vert\"." + (while (string-match "|" s) + (setq s (replace-match "\\vert" t t s))) + s) + +(defun org-uuidgen-p (s) + "Is S an ID created by UUIDGEN?" + (string-match "\\`[0-9a-f]\\{8\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{12\\}\\'" (downcase s))) + +(defun org-in-src-block-p (&optional inside) + "Whether point is in a code source block. +When INSIDE is non-nil, don't consider we are within a source +block when point is at #+BEGIN_SRC or #+END_SRC." + (let ((case-fold-search t)) + (or (and (eq (get-char-property (point) 'src-block) t)) + (and (not inside) + (save-match-data + (save-excursion + (beginning-of-line) + (looking-at ".*#\\+\\(begin\\|end\\)_src"))))))) + +(defun org-context () + "Return a list of contexts of the current cursor position. +If several contexts apply, all are returned. +Each context entry is a list with a symbol naming the context, and +two positions indicating start and end of the context. Possible +contexts are: + +:headline anywhere in a headline +:headline-stars on the leading stars in a headline +:todo-keyword on a TODO keyword (including DONE) in a headline +:tags on the TAGS in a headline +:priority on the priority cookie in a headline +:item on the first line of a plain list item +:item-bullet on the bullet/number of a plain list item +:checkbox on the checkbox in a plain list item +:table in an Org table +:table-special on a special filed in a table +:table-table in a table.el table +:clocktable in a clocktable +:src-block in a source block +:link on a hyperlink +:keyword on a keyword: SCHEDULED, DEADLINE, CLOSE, COMMENT. +:latex-fragment on a LaTeX fragment +:latex-preview on a LaTeX fragment with overlaid preview image + +This function expects the position to be visible because it uses font-lock +faces as a help to recognize the following contexts: :table-special, :link, +and :keyword." + (let* ((f (get-text-property (point) 'face)) + (faces (if (listp f) f (list f))) + (case-fold-search t) + (p (point)) clist o) + ;; First the large context + (cond + ((org-at-heading-p t) + (push (list :headline (point-at-bol) (point-at-eol)) clist) + (when (progn + (beginning-of-line 1) + (looking-at org-todo-line-tags-regexp)) + (push (org-point-in-group p 1 :headline-stars) clist) + (push (org-point-in-group p 2 :todo-keyword) clist) + (push (org-point-in-group p 4 :tags) clist)) + (goto-char p) + (skip-chars-backward "^[\n\r \t") (or (bobp) (backward-char 1)) + (when (looking-at "\\[#[A-Z0-9]\\]") + (push (org-point-in-group p 0 :priority) clist))) + + ((org-at-item-p) + (push (org-point-in-group p 2 :item-bullet) clist) + (push (list :item (point-at-bol) + (save-excursion (org-end-of-item) (point))) + clist) + (and (org-at-item-checkbox-p) + (push (org-point-in-group p 0 :checkbox) clist))) + + ((org-at-table-p) + (push (list :table (org-table-begin) (org-table-end)) clist) + (when (memq 'org-formula faces) + (push (list :table-special + (previous-single-property-change p 'face) + (next-single-property-change p 'face)) + clist))) + ((org-at-table-p 'any) + (push (list :table-table) clist))) + (goto-char p) + + (let ((case-fold-search t)) + ;; New the "medium" contexts: clocktables, source blocks + (cond ((org-in-clocktable-p) + (push (list :clocktable + (and (or (looking-at "[ \t]*\\(#\\+BEGIN: clocktable\\)") + (re-search-backward "[ \t]*\\(#+BEGIN: clocktable\\)" nil t)) + (match-beginning 1)) + (and (re-search-forward "[ \t]*#\\+END:?" nil t) + (match-end 0))) + clist)) + ((org-in-src-block-p) + (push (list :src-block + (and (or (looking-at "[ \t]*\\(#\\+BEGIN_SRC\\)") + (re-search-backward "[ \t]*\\(#+BEGIN_SRC\\)" nil t)) + (match-beginning 1)) + (and (search-forward "#+END_SRC" nil t) + (match-beginning 0))) + clist)))) + (goto-char p) + + ;; Now the small context + (cond + ((org-at-timestamp-p) + (push (org-point-in-group p 0 :timestamp) clist)) + ((memq 'org-link faces) + (push (list :link + (previous-single-property-change p 'face) + (next-single-property-change p 'face)) + clist)) + ((memq 'org-special-keyword faces) + (push (list :keyword + (previous-single-property-change p 'face) + (next-single-property-change p 'face)) + clist)) + ((setq o (cl-some + (lambda (o) + (and (eq (overlay-get o 'org-overlay-type) 'org-latex-overlay) + o)) + (overlays-at (point)))) + (push (list :latex-fragment + (overlay-start o) (overlay-end o)) + clist) + (push (list :latex-preview + (overlay-start o) (overlay-end o)) + clist)) + ((org-inside-LaTeX-fragment-p) + ;; FIXME: positions wrong. + (push (list :latex-fragment (point) (point)) clist))) + + (setq clist (nreverse (delq nil clist))) + clist)) + +(defun org-between-regexps-p (start-re end-re &optional lim-up lim-down) + "Non-nil when point is between matches of START-RE and END-RE. + +Also return a non-nil value when point is on one of the matches. + +Optional arguments LIM-UP and LIM-DOWN bound the search; they are +buffer positions. Default values are the positions of headlines +surrounding the point. + +The functions returns a cons cell whose car (resp. cdr) is the +position before START-RE (resp. after END-RE)." + (save-match-data + (let ((pos (point)) + (limit-up (or lim-up (save-excursion (outline-previous-heading)))) + (limit-down (or lim-down (save-excursion (outline-next-heading)))) + beg end) + (save-excursion + ;; Point is on a block when on START-RE or if START-RE can be + ;; found before it... + (and (or (org-in-regexp start-re) + (re-search-backward start-re limit-up t)) + (setq beg (match-beginning 0)) + ;; ... and END-RE after it... + (goto-char (match-end 0)) + (re-search-forward end-re limit-down t) + (> (setq end (match-end 0)) pos) + ;; ... without another START-RE in-between. + (goto-char (match-beginning 0)) + (not (re-search-backward start-re (1+ beg) t)) + ;; Return value. + (cons beg end)))))) + +(defun org-in-block-p (names) + "Non-nil when point belongs to a block whose name belongs to NAMES. + +NAMES is a list of strings containing names of blocks. + +Return first block name matched, or nil. Beware that in case of +nested blocks, the returned name may not belong to the closest +block from point." + (save-match-data + (catch 'exit + (let ((case-fold-search t) + (lim-up (save-excursion (outline-previous-heading))) + (lim-down (save-excursion (outline-next-heading)))) + (dolist (name names) + (let ((n (regexp-quote name))) + (when (org-between-regexps-p + (concat "^[ \t]*#\\+begin_" n) + (concat "^[ \t]*#\\+end_" n) + lim-up lim-down) + (throw 'exit n))))) + nil))) + +(defun org-occur-in-agenda-files (regexp &optional _nlines) + "Call `multi-occur' with buffers for all agenda files." + (interactive "sOrg-files matching: ") + (let* ((files (org-agenda-files)) + (tnames (mapcar #'file-truename files)) + (extra org-agenda-text-search-extra-files)) + (when (eq (car extra) 'agenda-archives) + (setq extra (cdr extra)) + (setq files (org-add-archive-files files))) + (dolist (f extra) + (unless (member (file-truename f) tnames) + (unless (member f files) (setq files (append files (list f)))) + (setq tnames (append tnames (list (file-truename f)))))) + (multi-occur + (mapcar (lambda (x) + (with-current-buffer + ;; FIXME: Why not just (find-file-noselect x)? + ;; Is it to avoid the "revert buffer" prompt? + (or (get-file-buffer x) (find-file-noselect x)) + (widen) + (current-buffer))) + files) + regexp))) + +(add-hook 'occur-mode-find-occurrence-hook + (lambda () (when (derived-mode-p 'org-mode) (org-reveal)))) + +(defun org-occur-link-in-agenda-files () + "Create a link and search for it in the agendas. +The link is not stored in `org-stored-links', it is just created +for the search purpose." + (interactive) + (let ((link (condition-case nil + (org-store-link nil) + (error "Unable to create a link to here")))) + (org-occur-in-agenda-files (regexp-quote link)))) + +(defun org-back-over-empty-lines () + "Move backwards over whitespace, to the beginning of the first empty line. +Returns the number of empty lines passed." + (let ((pos (point))) + (if (cdr (assq 'heading org-blank-before-new-entry)) + (skip-chars-backward " \t\n\r") + (unless (eobp) + (forward-line -1))) + (beginning-of-line 2) + (goto-char (min (point) pos)) + (count-lines (point) pos))) + +;;; TODO: Only called once, from ox-odt which should probably use +;;; org-export-inline-image-p or something. +(defun org-file-image-p (file) + "Return non-nil if FILE is an image." + (save-match-data + (string-match (image-file-name-regexp) file))) + +(defun org-get-cursor-date (&optional with-time) + "Return the date at cursor in as a time. +This works in the calendar and in the agenda, anywhere else it just +returns the current time. +If WITH-TIME is non-nil, returns the time of the event at point (in +the agenda) or the current time of the day; otherwise returns the +earliest time on the cursor date that Org treats as that date +(bearing in mind `org-extend-today-until')." + (let (date day defd tp hod mod) + (when with-time + (setq tp (get-text-property (point) 'time)) + (when (and tp (string-match "\\([0-2]?[0-9]\\):\\([0-5][0-9]\\)" tp)) + (setq hod (string-to-number (match-string 1 tp)) + mod (string-to-number (match-string 2 tp)))) + (or tp (let ((now (decode-time))) + (setq hod (nth 2 now) + mod (nth 1 now))))) + (cond + ((eq major-mode 'calendar-mode) + (setq date (calendar-cursor-to-date) + defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) + (nth 1 date) (nth 0 date) (nth 2 date)))) + ((eq major-mode 'org-agenda-mode) + (setq day (get-text-property (point) 'day)) + (when day + (setq date (calendar-gregorian-from-absolute day) + defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) + (nth 1 date) (nth 0 date) (nth 2 date)))))) + (or defd (current-time)))) + +(defun org-mark-subtree (&optional up) + "Mark the current subtree. +This puts point at the start of the current subtree, and mark at +the end. If a numeric prefix UP is given, move up into the +hierarchy of headlines by UP levels before marking the subtree." + (interactive "P") + (org-with-limited-levels + (cond ((org-at-heading-p) (beginning-of-line)) + ((org-before-first-heading-p) (user-error "Not in a subtree")) + (t (outline-previous-visible-heading 1)))) + (when up (while (and (> up 0) (org-up-heading-safe)) (cl-decf up))) + (if (called-interactively-p 'any) + (call-interactively 'org-mark-element) + (org-mark-element))) + +;;; Indentation + +(defvar org-element-greater-elements) +(defun org--get-expected-indentation (element contentsp) + "Expected indentation column for current line, according to ELEMENT. +ELEMENT is an element containing point. CONTENTSP is non-nil +when indentation is to be computed according to contents of +ELEMENT." + (let ((type (org-element-type element)) + (start (org-element-property :begin element)) + (post-affiliated (org-element-property :post-affiliated element))) + (org-with-wide-buffer + (cond + (contentsp + (cl-case type + ((diary-sexp footnote-definition) 0) + ((headline inlinetask nil) + (if (not org-adapt-indentation) 0 + (let ((level (org-current-level))) + (if level (1+ level) 0)))) + ((item plain-list) (org-list-item-body-column post-affiliated)) + (t + (goto-char start) + (current-indentation)))) + ((memq type '(headline inlinetask nil)) + (if (org-match-line "[ \t]*$") + (org--get-expected-indentation element t) + 0)) + ((memq type '(diary-sexp footnote-definition)) 0) + ;; First paragraph of a footnote definition or an item. + ;; Indent like parent. + ((< (line-beginning-position) start) + (org--get-expected-indentation + (org-element-property :parent element) t)) + ;; At first line: indent according to previous sibling, if any, + ;; ignoring footnote definitions and inline tasks, or parent's + ;; contents. + ((and ( = (line-beginning-position) start) + (eq org-adapt-indentation t)) + (catch 'exit + (while t + (if (= (point-min) start) (throw 'exit 0) + (goto-char (1- start)) + (let* ((previous (org-element-at-point)) + (parent previous)) + (while (and parent (<= (org-element-property :end parent) start)) + (setq previous parent + parent (org-element-property :parent parent))) + (cond + ((not previous) (throw 'exit 0)) + ((> (org-element-property :end previous) start) + (throw 'exit (org--get-expected-indentation previous t))) + ((memq (org-element-type previous) + '(footnote-definition inlinetask)) + (setq start (org-element-property :begin previous))) + (t (goto-char (org-element-property :begin previous)) + (throw 'exit + (if (bolp) (current-indentation) + ;; At first paragraph in an item or + ;; a footnote definition. + (org--get-expected-indentation + (org-element-property :parent previous) t)))))))))) + ;; Otherwise, move to the first non-blank line above. + (t + (beginning-of-line) + (let ((pos (point))) + (skip-chars-backward " \r\t\n") + (cond + ;; Two blank lines end a footnote definition or a plain + ;; list. When we indent an empty line after them, the + ;; containing list or footnote definition is over, so it + ;; qualifies as a previous sibling. Therefore, we indent + ;; like its first line. + ((and (memq type '(footnote-definition plain-list)) + (> (count-lines (point) pos) 2)) + (goto-char start) + (current-indentation)) + ;; Line above is the first one of a paragraph at the + ;; beginning of an item or a footnote definition. Indent + ;; like parent. + ((< (line-beginning-position) start) + (org--get-expected-indentation + (org-element-property :parent element) t)) + ;; Line above is the beginning of an element, i.e., point + ;; was originally on the blank lines between element's start + ;; and contents. + ((= (line-beginning-position) post-affiliated) + (org--get-expected-indentation element t)) + ;; POS is after contents in a greater element. Indent like + ;; the beginning of the element. + ((and (memq type org-element-greater-elements) + (let ((cend (org-element-property :contents-end element))) + (and cend (<= cend pos)))) + ;; As a special case, if point is at the end of a footnote + ;; definition or an item, indent like the very last element + ;; within. If that last element is an item, indent like + ;; its contents. + (if (memq type '(footnote-definition item plain-list)) + (let ((last (org-element-at-point))) + (goto-char pos) + (org--get-expected-indentation + last (eq (org-element-type last) 'item))) + (goto-char start) + (current-indentation))) + ;; In any other case, indent like the current line. + (t (current-indentation))))) + ;; Finally, no indentation is needed, fall back to 0. + (t (current-indentation)))))) + +(defun org--align-node-property () + "Align node property at point. +Alignment is done according to `org-property-format', which see." + (when (save-excursion + (beginning-of-line) + (looking-at org-property-re)) + (replace-match + (concat (match-string 4) + (org-trim + (format org-property-format (match-string 1) (match-string 3)))) + t t))) + +(defun org-indent-line () + "Indent line depending on context. + +Indentation is done according to the following rules: + + - Footnote definitions, diary sexps, headlines and inline tasks + have to start at column 0. + + - On the very first line of an element, consider, in order, the + next rules until one matches: + + 1. If there's a sibling element before, ignoring footnote + definitions and inline tasks, indent like its first line. + + 2. If element has a parent, indent like its contents. More + precisely, if parent is an item, indent after the bullet. + Else, indent like parent's first line. + + 3. Otherwise, indent relatively to current level, if + `org-adapt-indentation' is t, or to left margin. + + - On a blank line at the end of an element, indent according to + the type of the element. More precisely + + 1. If element is a plain list, an item, or a footnote + definition, indent like the very last element within. + + 2. If element is a paragraph, indent like its last non blank + line. + + 3. Otherwise, indent like its very first line. + + - In the code part of a source block, use language major mode + to indent current line if `org-src-tab-acts-natively' is + non-nil. If it is nil, do nothing. + + - Otherwise, indent like the first non-blank line above. + +The function doesn't indent an item as it could break the whole +list structure. Instead, use \\<org-mode-map>`\\[org-shiftmetaleft]' or \ +`\\[org-shiftmetaright]'. + +Also align node properties according to `org-property-format'." + (interactive) + (unless (or (org-at-heading-p) + (and (eq org-adapt-indentation 'headline-data) + (not (or (org-at-clock-log-p) + (org-at-planning-p))) + (save-excursion + (beginning-of-line 1) + (skip-chars-backward "\n") + (or (org-at-heading-p) + (looking-back ":END:.*" (point-at-bol)))))) + (let* ((element (save-excursion (beginning-of-line) (org-element-at-point))) + (type (org-element-type element))) + (cond ((and (memq type '(plain-list item)) + (= (line-beginning-position) + (org-element-property :post-affiliated element))) + nil) + ((and (eq type 'latex-environment) + (>= (point) (org-element-property :post-affiliated element)) + (< (point) + (org-with-point-at (org-element-property :end element) + (skip-chars-backward " \t\n") + (line-beginning-position 2)))) + nil) + ((and (eq type 'src-block) + org-src-tab-acts-natively + (> (line-beginning-position) + (org-element-property :post-affiliated element)) + (< (line-beginning-position) + (org-with-point-at (org-element-property :end element) + (skip-chars-backward " \t\n") + (line-beginning-position)))) + ;; At the beginning of a blank line, do some preindentation. This + ;; signals org-src--edit-element to preserve the indentation on exit + (when (and (looking-at-p "^[[:space:]]*$") + (not org-src-preserve-indentation)) + (let ((element (org-element-at-point)) + block-content-ind some-ind) + (org-with-point-at (org-element-property :begin element) + (setq block-content-ind (+ (current-indentation) + org-edit-src-content-indentation)) + (forward-line) + (save-match-data (re-search-forward "^[ \t]*\\S-" nil t)) + (backward-char) + (setq some-ind (if (looking-at-p "#\\+end_src") + block-content-ind (current-indentation)))) + (indent-line-to (min block-content-ind some-ind)))) + (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB"))) + (t + (let ((column (org--get-expected-indentation element nil))) + ;; Preserve current column. + (if (<= (current-column) (current-indentation)) + (indent-line-to column) + (save-excursion (indent-line-to column)))) + ;; Align node property. Also preserve current column. + (when (eq type 'node-property) + (let ((column (current-column))) + (org--align-node-property) + (org-move-to-column column)))))))) + +(defun org-indent-region (start end) + "Indent each non-blank line in the region. +Called from a program, START and END specify the region to +indent. The function will not indent contents of example blocks, +verse blocks and export blocks as leading white spaces are +assumed to be significant there." + (interactive "r") + (save-excursion + (goto-char start) + (skip-chars-forward " \r\t\n") + (unless (eobp) (beginning-of-line)) + (let ((indent-to + (lambda (ind pos) + ;; Set IND as indentation for all lines between point and + ;; POS. Blank lines are ignored. Leave point after POS + ;; once done. + (let ((limit (copy-marker pos))) + (while (< (point) limit) + (unless (looking-at-p "[ \t]*$") (indent-line-to ind)) + (forward-line)) + (set-marker limit nil)))) + (end (copy-marker end))) + (while (< (point) end) + (if (or (looking-at-p " \r\t\n") (org-at-heading-p)) (forward-line) + (let* ((element (org-element-at-point)) + (type (org-element-type element)) + (element-end (copy-marker (org-element-property :end element))) + (ind (org--get-expected-indentation element nil))) + (cond + ;; Element indented as a single block. Example blocks + ;; preserving indentation are a special case since the + ;; "contents" must not be indented whereas the block + ;; boundaries can. + ((or (memq type '(export-block latex-environment)) + (and (eq type 'example-block) + (not + (or org-src-preserve-indentation + (org-element-property :preserve-indent element))))) + (let ((offset (- ind (current-indentation)))) + (unless (zerop offset) + (indent-rigidly (org-element-property :begin element) + (org-element-property :end element) + offset))) + (goto-char element-end)) + ;; Elements indented line wise. Be sure to exclude + ;; example blocks (preserving indentation) and source + ;; blocks from this category as they are treated + ;; specially later. + ((or (memq type '(paragraph table table-row)) + (not (or (org-element-property :contents-begin element) + (memq type '(example-block src-block))))) + (when (eq type 'node-property) + (org--align-node-property) + (beginning-of-line)) + (funcall indent-to ind (min element-end end))) + ;; Elements consisting of three parts: before the + ;; contents, the contents, and after the contents. The + ;; contents are treated specially, according to the + ;; element type, or not indented at all. Other parts are + ;; indented as a single block. + (t + (let* ((post (copy-marker + (org-element-property :post-affiliated element))) + (cbeg + (copy-marker + (cond + ((not (org-element-property :contents-begin element)) + ;; Fake contents for source blocks. + (org-with-wide-buffer + (goto-char post) + (line-beginning-position 2))) + ((memq type '(footnote-definition item plain-list)) + ;; Contents in these elements could start on + ;; the same line as the beginning of the + ;; element. Make sure we start indenting + ;; from the second line. + (org-with-wide-buffer + (goto-char post) + (end-of-line) + (skip-chars-forward " \r\t\n") + (if (eobp) (point) (line-beginning-position)))) + (t (org-element-property :contents-begin element))))) + (cend (copy-marker + (or (org-element-property :contents-end element) + ;; Fake contents for source blocks. + (org-with-wide-buffer + (goto-char element-end) + (skip-chars-backward " \r\t\n") + (line-beginning-position))) + t))) + ;; Do not change items indentation individually as it + ;; might break the list as a whole. On the other + ;; hand, when at a plain list, indent it as a whole. + (cond ((eq type 'plain-list) + (let ((offset (- ind (current-indentation)))) + (unless (zerop offset) + (indent-rigidly (org-element-property :begin element) + (org-element-property :end element) + offset)) + (goto-char cbeg))) + ((eq type 'item) (goto-char cbeg)) + (t (funcall indent-to ind (min cbeg end)))) + (when (< (point) end) + (cl-case type + ((example-block verse-block)) + (src-block + ;; In a source block, indent source code + ;; according to language major mode, but only if + ;; `org-src-tab-acts-natively' is non-nil. + (when (and (< (point) end) org-src-tab-acts-natively) + (ignore-errors + (org-babel-do-in-edit-buffer + (indent-region (point-min) (point-max)))))) + (t (org-indent-region (point) (min cend end)))) + (goto-char (min cend end)) + (when (< (point) end) + (funcall indent-to ind (min element-end end)))) + (set-marker post nil) + (set-marker cbeg nil) + (set-marker cend nil)))) + (set-marker element-end nil)))) + (set-marker end nil)))) + +(defun org-indent-drawer () + "Indent the drawer at point." + (interactive) + (unless (save-excursion + (beginning-of-line) + (looking-at-p org-drawer-regexp)) + (user-error "Not at a drawer")) + (let ((element (org-element-at-point))) + (unless (memq (org-element-type element) '(drawer property-drawer)) + (user-error "Not at a drawer")) + (org-with-wide-buffer + (org-indent-region (org-element-property :begin element) + (org-element-property :end element)))) + (message "Drawer at point indented")) + +(defun org-indent-block () + "Indent the block at point." + (interactive) + (unless (save-excursion + (beginning-of-line) + (let ((case-fold-search t)) + (looking-at-p "[ \t]*#\\+\\(begin\\|end\\)_"))) + (user-error "Not at a block")) + (let ((element (org-element-at-point))) + (unless (memq (org-element-type element) + '(comment-block center-block dynamic-block example-block + export-block quote-block special-block + src-block verse-block)) + (user-error "Not at a block")) + (org-with-wide-buffer + (org-indent-region (org-element-property :begin element) + (org-element-property :end element)))) + (message "Block at point indented")) + + +;;; Filling + +;; We use our own fill-paragraph and auto-fill functions. + +;; `org-fill-paragraph' relies on adaptive filling and context +;; checking. Appropriate `fill-prefix' is computed with +;; `org-adaptive-fill-function'. + +;; `org-auto-fill-function' takes care of auto-filling. It calls +;; `do-auto-fill' only on valid areas with `fill-prefix' shadowed with +;; `org-adaptive-fill-function' value. Internally, +;; `org-comment-line-break-function' breaks the line. + +;; `org-setup-filling' installs filling and auto-filling related +;; variables during `org-mode' initialization. + +(defun org-setup-filling () + (require 'org-element) + ;; Prevent auto-fill from inserting unwanted new items. + (when (boundp 'fill-nobreak-predicate) + (setq-local + fill-nobreak-predicate + (org-uniquify + (append fill-nobreak-predicate + '(org-fill-line-break-nobreak-p + org-fill-n-macro-as-item-nobreak-p + org-fill-paragraph-with-timestamp-nobreak-p))))) + (let ((paragraph-ending (substring org-element-paragraph-separate 1))) + (setq-local paragraph-start paragraph-ending) + (setq-local paragraph-separate paragraph-ending)) + (setq-local fill-paragraph-function 'org-fill-paragraph) + (setq-local auto-fill-inhibit-regexp nil) + (setq-local adaptive-fill-function 'org-adaptive-fill-function) + (setq-local normal-auto-fill-function 'org-auto-fill-function) + (setq-local comment-line-break-function 'org-comment-line-break-function)) + +(defun org-fill-line-break-nobreak-p () + "Non-nil when a new line at point would create an Org line break." + (save-excursion + (skip-chars-backward " \t") + (skip-chars-backward "\\\\") + (looking-at "\\\\\\\\\\($\\|[^\\]\\)"))) + +(defun org-fill-paragraph-with-timestamp-nobreak-p () + "Non-nil when a new line at point would split a timestamp." + (and (org-at-timestamp-p 'lax) + (not (looking-at org-ts-regexp-both)))) + +(defun org-fill-n-macro-as-item-nobreak-p () + "Non-nil when a new line at point would create a new list." + ;; During export, a "n" macro followed by a dot or a closing + ;; parenthesis can end up being parsed as a new list item. + (looking-at-p "[ \t]*{{{n\\(?:([^\n)]*)\\)?}}}[.)]\\(?:$\\| \\)")) + +(defun org-adaptive-fill-function () + "Compute a fill prefix for the current line. +Return fill prefix, as a string, or nil if current line isn't +meant to be filled. For convenience, if `adaptive-fill-regexp' +matches in paragraphs or comments, use it." + (org-with-wide-buffer + (unless (org-at-heading-p) + (let* ((p (line-beginning-position)) + (element (save-excursion + (beginning-of-line) + (org-element-at-point))) + (type (org-element-type element)) + (post-affiliated (org-element-property :post-affiliated element))) + (unless (< p post-affiliated) + (cl-case type + (comment + (save-excursion + (beginning-of-line) + (looking-at "[ \t]*") + (concat (match-string 0) "# "))) + (footnote-definition "") + ((item plain-list) + (make-string (org-list-item-body-column post-affiliated) ?\s)) + (paragraph + ;; Fill prefix is usually the same as the current line, + ;; unless the paragraph is at the beginning of an item. + (let ((parent (org-element-property :parent element))) + (save-excursion + (beginning-of-line) + (cond ((eq (org-element-type parent) 'item) + (make-string (org-list-item-body-column + (org-element-property :begin parent)) + ?\s)) + ((and adaptive-fill-regexp + ;; Locally disable + ;; `adaptive-fill-function' to let + ;; `fill-context-prefix' handle + ;; `adaptive-fill-regexp' variable. + (let (adaptive-fill-function) + (fill-context-prefix + post-affiliated + (org-element-property :end element))))) + ((looking-at "[ \t]+") (match-string 0)) + (t ""))))) + (comment-block + ;; Only fill contents if P is within block boundaries. + (let* ((cbeg (save-excursion (goto-char post-affiliated) + (forward-line) + (point))) + (cend (save-excursion + (goto-char (org-element-property :end element)) + (skip-chars-backward " \r\t\n") + (line-beginning-position)))) + (when (and (>= p cbeg) (< p cend)) + (if (save-excursion (beginning-of-line) (looking-at "[ \t]+")) + (match-string 0) + "")))))))))) + +(defun org-fill-element (&optional justify) + "Fill element at point, when applicable. + +This function only applies to comment blocks, comments, example +blocks and paragraphs. Also, as a special case, re-align table +when point is at one. + +If JUSTIFY is non-nil (interactively, with prefix argument), +justify as well. If `sentence-end-double-space' is non-nil, then +period followed by one space does not end a sentence, so don't +break a line there. The variable `fill-column' controls the +width for filling. + +For convenience, when point is at a plain list, an item or +a footnote definition, try to fill the first paragraph within." + (with-syntax-table org-mode-transpose-word-syntax-table + ;; Move to end of line in order to get the first paragraph within + ;; a plain list or a footnote definition. + (let ((element (save-excursion (end-of-line) (org-element-at-point)))) + ;; First check if point is in a blank line at the beginning of + ;; the buffer. In that case, ignore filling. + (cl-case (org-element-type element) + ;; Use major mode filling function is source blocks. + (src-block (org-babel-do-in-edit-buffer + (push-mark (point-min)) + (goto-char (point-max)) + (setq mark-active t) + (funcall-interactively #'fill-paragraph justify 'region))) + ;; Align Org tables, leave table.el tables as-is. + (table-row (org-table-align) t) + (table + (when (eq (org-element-property :type element) 'org) + (save-excursion + (goto-char (org-element-property :post-affiliated element)) + (org-table-align))) + t) + (paragraph + ;; Paragraphs may contain `line-break' type objects. + (let ((beg (max (point-min) + (org-element-property :contents-begin element))) + (end (min (point-max) + (org-element-property :contents-end element)))) + ;; Do nothing if point is at an affiliated keyword. + (if (< (line-end-position) beg) t + ;; Fill paragraph, taking line breaks into account. + (save-excursion + (goto-char beg) + (let ((cuts (list beg))) + (while (re-search-forward "\\\\\\\\[ \t]*\n" end t) + (when (eq 'line-break + (org-element-type + (save-excursion (backward-char) + (org-element-context)))) + (push (point) cuts))) + (dolist (c (delq end cuts)) + (fill-region-as-paragraph c end justify) + (setq end c)))) + t))) + ;; Contents of `comment-block' type elements should be + ;; filled as plain text, but only if point is within block + ;; markers. + (comment-block + (let* ((case-fold-search t) + (beg (save-excursion + (goto-char (org-element-property :begin element)) + (re-search-forward "^[ \t]*#\\+begin_comment" nil t) + (forward-line) + (point))) + (end (save-excursion + (goto-char (org-element-property :end element)) + (re-search-backward "^[ \t]*#\\+end_comment" nil t) + (line-beginning-position)))) + (if (or (< (point) beg) (> (point) end)) t + (fill-region-as-paragraph + (save-excursion (end-of-line) + (re-search-backward "^[ \t]*$" beg 'move) + (line-beginning-position)) + (save-excursion (beginning-of-line) + (re-search-forward "^[ \t]*$" end 'move) + (line-beginning-position)) + justify)))) + ;; Fill comments. + (comment + (let ((begin (org-element-property :post-affiliated element)) + (end (org-element-property :end element))) + (when (and (>= (point) begin) (<= (point) end)) + (let ((begin (save-excursion + (end-of-line) + (if (re-search-backward "^[ \t]*#[ \t]*$" begin t) + (progn (forward-line) (point)) + begin))) + (end (save-excursion + (end-of-line) + (if (re-search-forward "^[ \t]*#[ \t]*$" end 'move) + (1- (line-beginning-position)) + (skip-chars-backward " \r\t\n") + (line-end-position))))) + ;; Do not fill comments when at a blank line. + (when (> end begin) + (let ((fill-prefix + (save-excursion + (beginning-of-line) + (looking-at "[ \t]*#") + (let ((comment-prefix (match-string 0))) + (goto-char (match-end 0)) + (if (looking-at adaptive-fill-regexp) + (concat comment-prefix (match-string 0)) + (concat comment-prefix " ")))))) + (save-excursion + (fill-region-as-paragraph begin end justify)))))) + t)) + ;; Ignore every other element. + (otherwise t))))) + +(defun org-fill-paragraph (&optional justify region) + "Fill element at point, when applicable. + +This function only applies to comment blocks, comments, example +blocks and paragraphs. Also, as a special case, re-align table +when point is at one. + +For convenience, when point is at a plain list, an item or +a footnote definition, try to fill the first paragraph within. + +If JUSTIFY is non-nil (interactively, with prefix argument), +justify as well. If `sentence-end-double-space' is non-nil, then +period followed by one space does not end a sentence, so don't +break a line there. The variable `fill-column' controls the +width for filling. + +The REGION argument is non-nil if called interactively; in that +case, if Transient Mark mode is enabled and the mark is active, +fill each of the elements in the active region, instead of just +filling the current element." + (interactive (progn + (barf-if-buffer-read-only) + (list (when current-prefix-arg 'full) t))) + (let ((hash (and (not (buffer-modified-p)) + (org-buffer-hash)))) + (cond + ((and region transient-mark-mode mark-active + (not (eq (region-beginning) (region-end)))) + (let ((origin (point-marker)) + (start (region-beginning))) + (unwind-protect + (progn + (goto-char (region-end)) + (skip-chars-backward " \t\n") + (while (> (point) start) + (org-fill-element justify) + (org-backward-paragraph))) + (goto-char origin) + (set-marker origin nil)))) + (t + (save-excursion + (when (org-match-line "[ \t]*$") + (skip-chars-forward " \t\n")) + (org-fill-element justify)))) + ;; If we didn't change anything in the buffer (and the buffer was + ;; previously unmodified), then flip the modification status back + ;; to "unchanged". + (when (and hash (equal hash (org-buffer-hash))) + (set-buffer-modified-p nil)) + ;; Return non-nil. + t)) + +(defun org-auto-fill-function () + "Auto-fill function." + ;; Check if auto-filling is meaningful. + (let ((fc (current-fill-column))) + (when (and fc (> (current-column) fc)) + (let* ((fill-prefix (org-adaptive-fill-function)) + ;; Enforce empty fill prefix, if required. Otherwise, it + ;; will be computed again. + (adaptive-fill-mode (not (equal fill-prefix "")))) + (when fill-prefix (do-auto-fill)))))) + +(defun org-comment-line-break-function (&optional soft) + "Break line at point and indent, continuing comment if within one. +The inserted newline is marked hard if variable +`use-hard-newlines' is true, unless optional argument SOFT is +non-nil." + (if soft (insert-and-inherit ?\n) (newline 1)) + (save-excursion (forward-char -1) (delete-horizontal-space)) + (delete-horizontal-space) + (indent-to-left-margin) + (insert-before-markers-and-inherit fill-prefix)) + + +;;; Fixed Width Areas + +(defun org-toggle-fixed-width () + "Toggle fixed-width markup. + +Add or remove fixed-width markup on current line, whenever it +makes sense. Return an error otherwise. + +If a region is active and if it contains only fixed-width areas +or blank lines, remove all fixed-width markup in it. If the +region contains anything else, convert all non-fixed-width lines +to fixed-width ones. + +Blank lines at the end of the region are ignored unless the +region only contains such lines." + (interactive) + (if (not (org-region-active-p)) + ;; No region: + ;; + ;; Remove fixed width marker only in a fixed-with element. + ;; + ;; Add fixed width maker in paragraphs, in blank lines after + ;; elements or at the beginning of a headline or an inlinetask, + ;; and before any one-line elements (e.g., a clock). + (progn + (beginning-of-line) + (let* ((element (org-element-at-point)) + (type (org-element-type element))) + (cond + ((and (eq type 'fixed-width) + (looking-at "[ \t]*\\(:\\(?: \\|$\\)\\)")) + (replace-match + "" nil nil nil (if (= (line-end-position) (match-end 0)) 0 1))) + ((and (memq type '(babel-call clock comment diary-sexp headline + horizontal-rule keyword paragraph + planning)) + (<= (org-element-property :post-affiliated element) (point))) + (skip-chars-forward " \t") + (insert ": ")) + ((and (looking-at-p "[ \t]*$") + (or (eq type 'inlinetask) + (save-excursion + (skip-chars-forward " \r\t\n") + (<= (org-element-property :end element) (point))))) + (delete-region (point) (line-end-position)) + (org-indent-line) + (insert ": ")) + (t (user-error "Cannot insert a fixed-width line here"))))) + ;; Region active. + (let* ((begin (save-excursion + (goto-char (region-beginning)) + (line-beginning-position))) + (end (copy-marker + (save-excursion + (goto-char (region-end)) + (unless (eolp) (beginning-of-line)) + (if (save-excursion (re-search-backward "\\S-" begin t)) + (progn (skip-chars-backward " \r\t\n") (point)) + (point))))) + (all-fixed-width-p + (catch 'not-all-p + (save-excursion + (goto-char begin) + (skip-chars-forward " \r\t\n") + (when (eobp) (throw 'not-all-p nil)) + (while (< (point) end) + (let ((element (org-element-at-point))) + (if (eq (org-element-type element) 'fixed-width) + (goto-char (org-element-property :end element)) + (throw 'not-all-p nil)))) + t)))) + (if all-fixed-width-p + (save-excursion + (goto-char begin) + (while (< (point) end) + (when (looking-at "[ \t]*\\(:\\(?: \\|$\\)\\)") + (replace-match + "" nil nil nil + (if (= (line-end-position) (match-end 0)) 0 1))) + (forward-line))) + (let ((min-ind (point-max))) + ;; Find minimum indentation across all lines. + (save-excursion + (goto-char begin) + (if (not (save-excursion (re-search-forward "\\S-" end t))) + (setq min-ind 0) + (catch 'zerop + (while (< (point) end) + (unless (looking-at-p "[ \t]*$") + (let ((ind (current-indentation))) + (setq min-ind (min min-ind ind)) + (when (zerop ind) (throw 'zerop t)))) + (forward-line))))) + ;; Loop over all lines and add fixed-width markup everywhere + ;; but in fixed-width lines. + (save-excursion + (goto-char begin) + (while (< (point) end) + (cond + ((org-at-heading-p) + (insert ": ") + (forward-line) + (while (and (< (point) end) (looking-at-p "[ \t]*$")) + (insert ":") + (forward-line))) + ((looking-at-p "[ \t]*:\\( \\|$\\)") + (let* ((element (org-element-at-point)) + (element-end (org-element-property :end element))) + (if (eq (org-element-type element) 'fixed-width) + (progn (goto-char element-end) + (skip-chars-backward " \r\t\n") + (forward-line)) + (let ((limit (min end element-end))) + (while (< (point) limit) + (org-move-to-column min-ind t) + (insert ": ") + (forward-line)))))) + (t + (org-move-to-column min-ind t) + (insert ": ") + (forward-line))))))) + (set-marker end nil)))) + + +;;; Blocks + +(defun org-block-map (function &optional start end) + "Call FUNCTION at the head of all source blocks in the current buffer. +Optional arguments START and END can be used to limit the range." + (let ((start (or start (point-min))) + (end (or end (point-max)))) + (save-excursion + (goto-char start) + (while (and (< (point) end) (re-search-forward org-block-regexp end t)) + (save-excursion + (save-match-data + (goto-char (match-beginning 0)) + (funcall function))))))) + +(defun org-next-block (arg &optional backward block-regexp) + "Jump to the next block. + +With a prefix argument ARG, jump forward ARG many blocks. + +When BACKWARD is non-nil, jump to the previous block. + +When BLOCK-REGEXP is non-nil, use this regexp to find blocks. +Match data is set according to this regexp when the function +returns. + +Return point at beginning of the opening line of found block. +Throw an error if no block is found." + (interactive "p") + (let ((re (or block-regexp "^[ \t]*#\\+BEGIN")) + (case-fold-search t) + (search-fn (if backward #'re-search-backward #'re-search-forward)) + (count (or arg 1)) + (origin (point)) + last-element) + (if backward (beginning-of-line) (end-of-line)) + (while (and (> count 0) (funcall search-fn re nil t)) + (let ((element (save-excursion + (goto-char (match-beginning 0)) + (save-match-data (org-element-at-point))))) + (when (and (memq (org-element-type element) + '(center-block comment-block dynamic-block + example-block export-block quote-block + special-block src-block verse-block)) + (<= (match-beginning 0) + (org-element-property :post-affiliated element))) + (setq last-element element) + (cl-decf count)))) + (if (= count 0) + (prog1 (goto-char (org-element-property :post-affiliated last-element)) + (save-match-data (org-show-context))) + (goto-char origin) + (user-error "No %s code blocks" (if backward "previous" "further"))))) + +(defun org-previous-block (arg &optional block-regexp) + "Jump to the previous block. +With a prefix argument ARG, jump backward ARG many source blocks. +When BLOCK-REGEXP is non-nil, use this regexp to find blocks." + (interactive "p") + (org-next-block arg t block-regexp)) + + +;;; Comments + +;; Org comments syntax is quite complex. It requires the entire line +;; to be just a comment. Also, even with the right syntax at the +;; beginning of line, some elements (e.g., verse-block or +;; example-block) don't accept comments. Usual Emacs comment commands +;; cannot cope with those requirements. Therefore, Org replaces them. + +;; Org still relies on 'comment-dwim', but cannot trust +;; 'comment-only-p'. So, 'comment-region-function' and +;; 'uncomment-region-function' both point +;; to 'org-comment-or-uncomment-region'. Eventually, +;; 'org-insert-comment' takes care of insertion of comments at the +;; beginning of line. + +;; 'org-setup-comments-handling' install comments related variables +;; during 'org-mode' initialization. + +(defun org-setup-comments-handling () + (interactive) + (setq-local comment-use-syntax nil) + (setq-local comment-start "# ") + (setq-local comment-start-skip "^\\s-*#\\(?: \\|$\\)") + (setq-local comment-insert-comment-function 'org-insert-comment) + (setq-local comment-region-function 'org-comment-or-uncomment-region) + (setq-local uncomment-region-function 'org-comment-or-uncomment-region)) + +(defun org-insert-comment () + "Insert an empty comment above current line. +If the line is empty, insert comment at its beginning. When +point is within a source block, comment according to the related +major mode." + (if (let ((element (org-element-at-point))) + (and (eq (org-element-type element) 'src-block) + (< (save-excursion + (goto-char (org-element-property :post-affiliated element)) + (line-end-position)) + (point)) + (> (save-excursion + (goto-char (org-element-property :end element)) + (skip-chars-backward " \r\t\n") + (line-beginning-position)) + (point)))) + (org-babel-do-in-edit-buffer (call-interactively 'comment-dwim)) + (beginning-of-line) + (if (looking-at "\\s-*$") (delete-region (point) (point-at-eol)) + (open-line 1)) + (org-indent-line) + (insert "# "))) + +(defvar comment-empty-lines) ; From newcomment.el. +(defun org-comment-or-uncomment-region (beg end &rest _) + "Comment or uncomment each non-blank line in the region. +Uncomment each non-blank line between BEG and END if it only +contains commented lines. Otherwise, comment them. If region is +strictly within a source block, use appropriate comment syntax." + (if (let ((element (org-element-at-point))) + (and (eq (org-element-type element) 'src-block) + (< (save-excursion + (goto-char (org-element-property :post-affiliated element)) + (line-end-position)) + beg) + (>= (save-excursion + (goto-char (org-element-property :end element)) + (skip-chars-backward " \r\t\n") + (line-beginning-position)) + end))) + ;; Translate region boundaries for the Org buffer to the source + ;; buffer. + (let ((offset (- end beg))) + (save-excursion + (goto-char beg) + (org-babel-do-in-edit-buffer + (comment-or-uncomment-region (point) (+ offset (point)))))) + (save-restriction + ;; Restrict region + (narrow-to-region (save-excursion (goto-char beg) + (skip-chars-forward " \r\t\n" end) + (line-beginning-position)) + (save-excursion (goto-char end) + (skip-chars-backward " \r\t\n" beg) + (line-end-position))) + (let ((uncommentp + ;; UNCOMMENTP is non-nil when every non blank line between + ;; BEG and END is a comment. + (save-excursion + (goto-char (point-min)) + (while (and (not (eobp)) + (let ((element (org-element-at-point))) + (and (eq (org-element-type element) 'comment) + (goto-char (min (point-max) + (org-element-property + :end element))))))) + (eobp)))) + (if uncommentp + ;; Only blank lines and comments in region: uncomment it. + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (when (looking-at "[ \t]*\\(#\\(?: \\|$\\)\\)") + (replace-match "" nil nil nil 1)) + (forward-line))) + ;; Comment each line in region. + (let ((min-indent (point-max))) + ;; First find the minimum indentation across all lines. + (save-excursion + (goto-char (point-min)) + (while (and (not (eobp)) (not (zerop min-indent))) + (unless (looking-at "[ \t]*$") + (setq min-indent (min min-indent (current-indentation)))) + (forward-line))) + ;; Then loop over all lines. + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (unless (and (not comment-empty-lines) (looking-at "[ \t]*$")) + ;; Don't get fooled by invisible text (e.g. link path) + ;; when moving to column MIN-INDENT. + (let ((buffer-invisibility-spec nil)) + (org-move-to-column min-indent t)) + (insert comment-start)) + (forward-line))))))))) + +(defun org-comment-dwim (_arg) + "Call the comment command you mean. +Call `org-toggle-comment' if on a heading, otherwise call +`comment-dwim', within a source edit buffer if needed." + (interactive "*P") + (cond ((org-at-heading-p) + (call-interactively #'org-toggle-comment)) + ((org-in-src-block-p) + (org-babel-do-in-edit-buffer (call-interactively #'comment-dwim))) + (t (call-interactively #'comment-dwim)))) + + +;;; Timestamps API + +;; This section contains tools to operate on, or create, timestamp +;; objects, as returned by, e.g. `org-element-context'. + +(defun org-timestamp-from-string (s) + "Convert Org timestamp S, as a string, into a timestamp object. +Return nil if S is not a valid timestamp string." + (when (org-string-nw-p s) + (with-temp-buffer + (save-excursion (insert s)) + (org-element-timestamp-parser)))) + +(defun org-timestamp-from-time (time &optional with-time inactive) + "Convert a time value into a timestamp object. + +TIME is an Emacs internal time representation, as returned, e.g., +by `current-time'. + +When optional argument WITH-TIME is non-nil, return a timestamp +object with a time part, i.e., with hours and minutes. + +Return an inactive timestamp if INACTIVE is non-nil. Otherwise, +return an active timestamp." + (pcase-let ((`(,_ ,minute ,hour ,day ,month ,year . ,_) (decode-time time))) + (org-element-create 'timestamp + (list :type (if inactive 'inactive 'active) + :year-start year + :month-start month + :day-start day + :hour-start (and with-time hour) + :minute-start (and with-time minute))))) + +(defun org-timestamp-to-time (timestamp &optional end) + "Convert TIMESTAMP object into an Emacs internal time value. +Use end of date range or time range when END is non-nil. +Otherwise, use its start." + (apply #'encode-time 0 + (mapcar + (lambda (prop) (or (org-element-property prop timestamp) 0)) + (if end '(:minute-end :hour-end :day-end :month-end :year-end) + '(:minute-start :hour-start :day-start :month-start + :year-start))))) + +(defun org-timestamp-has-time-p (timestamp) + "Non-nil when TIMESTAMP has a time specified." + (org-element-property :hour-start timestamp)) + +(defun org-timestamp-format (timestamp format &optional end utc) + "Format a TIMESTAMP object into a string. + +FORMAT is a format specifier to be passed to +`format-time-string'. + +When optional argument END is non-nil, use end of date-range or +time-range, if possible. + +When optional argument UTC is non-nil, time is be expressed as +Universal Time." + (format-time-string format (org-timestamp-to-time timestamp end) + (and utc t))) + +(defun org-timestamp-split-range (timestamp &optional end) + "Extract a TIMESTAMP object from a date or time range. + +END, when non-nil, means extract the end of the range. +Otherwise, extract its start. + +Return a new timestamp object." + (let ((type (org-element-property :type timestamp))) + (if (memq type '(active inactive diary)) timestamp + (let ((split-ts (org-element-copy timestamp))) + ;; Set new type. + (org-element-put-property + split-ts :type (if (eq type 'active-range) 'active 'inactive)) + ;; Copy start properties over end properties if END is + ;; non-nil. Otherwise, copy end properties over `start' ones. + (let ((p-alist '((:minute-start . :minute-end) + (:hour-start . :hour-end) + (:day-start . :day-end) + (:month-start . :month-end) + (:year-start . :year-end)))) + (dolist (p-cell p-alist) + (org-element-put-property + split-ts + (funcall (if end #'car #'cdr) p-cell) + (org-element-property + (funcall (if end #'cdr #'car) p-cell) split-ts))) + ;; Eventually refresh `:raw-value'. + (org-element-put-property split-ts :raw-value nil) + (org-element-put-property + split-ts :raw-value (org-element-interpret-data split-ts))))))) + +(defun org-timestamp-translate (timestamp &optional boundary) + "Translate TIMESTAMP object to custom format. + +Format string is defined in `org-time-stamp-custom-formats', +which see. + +When optional argument BOUNDARY is non-nil, it is either the +symbol `start' or `end'. In this case, only translate the +starting or ending part of TIMESTAMP if it is a date or time +range. Otherwise, translate both parts. + +Return timestamp as-is if `org-display-custom-times' is nil or if +it has a `diary' type." + (let ((type (org-element-property :type timestamp))) + (if (or (not org-display-custom-times) (eq type 'diary)) + (org-element-interpret-data timestamp) + (let ((fmt (funcall (if (org-timestamp-has-time-p timestamp) #'cdr #'car) + org-time-stamp-custom-formats))) + (if (and (not boundary) (memq type '(active-range inactive-range))) + (concat (org-timestamp-format timestamp fmt) + "--" + (org-timestamp-format timestamp fmt t)) + (org-timestamp-format timestamp fmt (eq boundary 'end))))))) + +;;; Other stuff + +(defvar reftex-docstruct-symbol) +(defvar org--rds) + +(defun org-reftex-citation () + "Use `reftex-citation' to insert a citation into the buffer. +This looks for a line like + +#+BIBLIOGRAPHY: foo plain option:-d + +and derives from it that foo.bib is the bibliography file relevant +for this document. It then installs the necessary environment for RefTeX +to work in this buffer and calls `reftex-citation' to insert a citation +into the buffer. + +Export of such citations to both LaTeX and HTML is handled by the contributed +package ox-bibtex by Taru Karttunen." + (interactive) + (let ((reftex-docstruct-symbol 'org--rds) + org--rds bib) + (org-with-wide-buffer + (let ((case-fold-search t) + (re "^[ \t]*#\\+BIBLIOGRAPHY:[ \t]+\\([^ \t\n]+\\)")) + (if (not (save-excursion + (or (re-search-forward re nil t) + (re-search-backward re nil t)))) + (user-error "No bibliography defined in file") + (setq bib (concat (match-string 1) ".bib") + org--rds (list (list 'bib bib)))))) + (call-interactively 'reftex-citation))) + +;;;; Functions extending outline functionality + +(defun org-beginning-of-line (&optional n) + "Go to the beginning of the current visible line. + +If this is a headline, and `org-special-ctrl-a/e' is not nil or +symbol `reversed', on the first attempt move to where the +headline text starts, and only move to beginning of line when the +cursor is already before the start of the text of the headline. + +If `org-special-ctrl-a/e' is symbol `reversed' then go to the +start of the text on the second attempt. + +With argument N not nil or 1, move forward N - 1 lines first." + (interactive "^p") + (let ((origin (point)) + (special (pcase org-special-ctrl-a/e + (`(,C-a . ,_) C-a) (_ org-special-ctrl-a/e))) + deactivate-mark) + ;; First move to a visible line. + (if (bound-and-true-p visual-line-mode) + (beginning-of-visual-line n) + (move-beginning-of-line n) + ;; `move-beginning-of-line' may leave point after invisible + ;; characters if line starts with such of these (e.g., with + ;; a link at column 0). Really move to the beginning of the + ;; current visible line. + (beginning-of-line)) + (cond + ;; No special behavior. Point is already at the beginning of + ;; a line, logical or visual. + ((not special)) + ;; `beginning-of-visual-line' left point before logical beginning + ;; of line: point is at the beginning of a visual line. Bail + ;; out. + ((and (bound-and-true-p visual-line-mode) (not (bolp)))) + ((let ((case-fold-search nil)) (looking-at org-complex-heading-regexp)) + ;; At a headline, special position is before the title, but + ;; after any TODO keyword or priority cookie. + (let ((refpos (min (1+ (or (match-end 3) (match-end 2) (match-end 1))) + (line-end-position))) + (bol (point))) + (if (eq special 'reversed) + (when (and (= origin bol) (eq last-command this-command)) + (goto-char refpos)) + (when (or (> origin refpos) (= origin bol)) + (goto-char refpos))))) + ((and (looking-at org-list-full-item-re) + (memq (org-element-type (save-match-data (org-element-at-point))) + '(item plain-list))) + ;; Set special position at first white space character after + ;; bullet, and check-box, if any. + (let ((after-bullet + (let ((box (match-end 3))) + (cond ((not box) (match-end 1)) + ((eq (char-after box) ?\s) (1+ box)) + (t box))))) + (if (eq special 'reversed) + (when (and (= (point) origin) (eq last-command this-command)) + (goto-char after-bullet)) + (when (or (> origin after-bullet) (= (point) origin)) + (goto-char after-bullet))))) + ;; No special context. Point is already at beginning of line. + (t nil)))) + +(defun org-end-of-line (&optional n) + "Go to the end of the line, but before ellipsis, if any. + +If this is a headline, and `org-special-ctrl-a/e' is not nil or +symbol `reversed', ignore tags on the first attempt, and only +move to after the tags when the cursor is already beyond the end +of the headline. + +If `org-special-ctrl-a/e' is symbol `reversed' then ignore tags +on the second attempt. + +With argument N not nil or 1, move forward N - 1 lines first." + (interactive "^p") + (let ((origin (point)) + (special (pcase org-special-ctrl-a/e + (`(,_ . ,C-e) C-e) (_ org-special-ctrl-a/e))) + deactivate-mark) + ;; First move to a visible line. + (if (bound-and-true-p visual-line-mode) + (beginning-of-visual-line n) + (move-beginning-of-line n)) + (cond + ;; At a headline, with tags. + ((and special + (save-excursion + (beginning-of-line) + (let ((case-fold-search nil)) + (looking-at org-complex-heading-regexp))) + (match-end 5)) + (let ((tags (save-excursion + (goto-char (match-beginning 5)) + (skip-chars-backward " \t") + (point))) + (visual-end (and (bound-and-true-p visual-line-mode) + (save-excursion + (end-of-visual-line) + (point))))) + ;; If `end-of-visual-line' brings us before end of line or + ;; even tags, i.e., the headline spans over multiple visual + ;; lines, move there. + (cond ((and visual-end + (< visual-end tags) + (<= origin visual-end)) + (goto-char visual-end)) + ((eq special 'reversed) + (if (and (= origin (line-end-position)) + (eq this-command last-command)) + (goto-char tags) + (end-of-line))) + (t + (if (or (< origin tags) (= origin (line-end-position))) + (goto-char tags) + (end-of-line)))))) + ((bound-and-true-p visual-line-mode) + (let ((bol (line-beginning-position))) + (end-of-visual-line) + ;; If `end-of-visual-line' gets us past the ellipsis at the + ;; end of a line, backtrack and use `end-of-line' instead. + (when (/= bol (line-beginning-position)) + (goto-char bol) + (end-of-line)))) + (t (end-of-line))))) + +(defun org-backward-sentence (&optional _arg) + "Go to beginning of sentence, or beginning of table field. +This will call `backward-sentence' or `org-table-beginning-of-field', +depending on context." + (interactive) + (let* ((element (org-element-at-point)) + (contents-begin (org-element-property :contents-begin element)) + (table (org-element-lineage element '(table) t))) + (if (and table + (> (point) contents-begin) + (<= (point) (org-element-property :contents-end table))) + (call-interactively #'org-table-beginning-of-field) + (save-restriction + (when (and contents-begin + (< (point-min) contents-begin) + (> (point) contents-begin)) + (narrow-to-region contents-begin + (org-element-property :contents-end element))) + (call-interactively #'backward-sentence))))) + +(defun org-forward-sentence (&optional _arg) + "Go to end of sentence, or end of table field. +This will call `forward-sentence' or `org-table-end-of-field', +depending on context." + (interactive) + (if (and (org-at-heading-p) + (save-restriction (skip-chars-forward " \t") (not (eolp)))) + (save-restriction + (narrow-to-region (line-beginning-position) (line-end-position)) + (call-interactively #'forward-sentence)) + (let* ((element (org-element-at-point)) + (contents-end (org-element-property :contents-end element)) + (table (org-element-lineage element '(table) t))) + (if (and table + (>= (point) (org-element-property :contents-begin table)) + (< (point) contents-end)) + (call-interactively #'org-table-end-of-field) + (save-restriction + (when (and contents-end + (> (point-max) contents-end) + ;; Skip blank lines between elements. + (< (org-element-property :end element) + (save-excursion (goto-char contents-end) + (skip-chars-forward " \r\t\n")))) + (narrow-to-region (org-element-property :contents-begin element) + contents-end)) + ;; End of heading is considered as the end of a sentence. + (let ((sentence-end (concat (sentence-end) "\\|^\\*+ .*$"))) + (call-interactively #'forward-sentence))))))) + +(defun org-kill-line (&optional _arg) + "Kill line, to tags or end of line." + (interactive) + (cond + ((or (not org-special-ctrl-k) + (bolp) + (not (org-at-heading-p))) + (when (and (get-char-property (line-end-position) 'invisible) + org-ctrl-k-protect-subtree + (or (eq org-ctrl-k-protect-subtree 'error) + (not (y-or-n-p "Kill hidden subtree along with headline? ")))) + (user-error + (substitute-command-keys + "`\\[org-kill-line]' aborted as it would kill a hidden subtree"))) + (call-interactively + (if (bound-and-true-p visual-line-mode) 'kill-visual-line 'kill-line))) + ((org-match-line org-tag-line-re) + (let ((end (save-excursion + (goto-char (match-beginning 1)) + (skip-chars-backward " \t") + (point)))) + (if (<= end (point)) ;on tags part + (kill-region (point) (line-end-position)) + (kill-region (point) end))) + ;; Only align tags when we are still on a heading: + (if (org-at-heading-p) (org-align-tags))) + (t (kill-region (point) (line-end-position))))) + +(defun org-yank (&optional arg) + "Yank. If the kill is a subtree, treat it specially. +This command will look at the current kill and check if is a single +subtree, or a series of subtrees[1]. If it passes the test, and if the +cursor is at the beginning of a line or after the stars of a currently +empty headline, then the yank is handled specially. How exactly depends +on the value of the following variables. + +`org-yank-folded-subtrees' + By default, this variable is non-nil, which results in + subtree(s) being folded after insertion, except if doing so + would swallow text after the yanked text. + +`org-yank-adjusted-subtrees' + When non-nil (the default value is nil), the subtree will be + promoted or demoted in order to fit into the local outline tree + structure, which means that the level will be adjusted so that it + becomes the smaller one of the two *visible* surrounding headings. + +Any prefix to this command will cause `yank' to be called directly with +no special treatment. In particular, a simple `\\[universal-argument]' prefix \ +will just +plainly yank the text as it is. + +\[1] The test checks if the first non-white line is a heading + and if there are no other headings with fewer stars." + (interactive "P") + (org-yank-generic 'yank arg)) + +(defun org-yank-generic (command arg) + "Perform some yank-like command. + +This function implements the behavior described in the `org-yank' +documentation. However, it has been generalized to work for any +interactive command with similar behavior." + + ;; pretend to be command COMMAND + (setq this-command command) + + (if arg + (call-interactively command) + + (let ((subtreep ; is kill a subtree, and the yank position appropriate? + (and (org-kill-is-subtree-p) + (or (bolp) + (and (looking-at "[ \t]*$") + (string-match + "\\`\\*+\\'" + (buffer-substring (point-at-bol) (point))))))) + swallowp) + (cond + ((and subtreep org-yank-folded-subtrees) + (let ((beg (point)) + end) + (if (and subtreep org-yank-adjusted-subtrees) + (org-paste-subtree nil nil 'for-yank) + (call-interactively command)) + + (setq end (point)) + (goto-char beg) + (when (and (bolp) subtreep + (not (setq swallowp + (org-yank-folding-would-swallow-text beg end)))) + (org-with-limited-levels + (or (looking-at org-outline-regexp) + (re-search-forward org-outline-regexp-bol end t)) + (while (and (< (point) end) (looking-at org-outline-regexp)) + (org-flag-subtree t) + (org-cycle-show-empty-lines 'folded) + (condition-case nil + (outline-forward-same-level 1) + (error (goto-char end)))))) + (when swallowp + (message + "Inserted text not folded because that would swallow text")) + + (goto-char end) + (skip-chars-forward " \t\n\r") + (beginning-of-line 1) + (push-mark beg 'nomsg))) + ((and subtreep org-yank-adjusted-subtrees) + (let ((beg (point-at-bol))) + (org-paste-subtree nil nil 'for-yank) + (push-mark beg 'nomsg))) + (t + (call-interactively command)))))) + +(defun org-yank-folding-would-swallow-text (beg end) + "Would `hide-subtree' at BEG swallow any text after END?" + (let (level) + (org-with-limited-levels + (save-excursion + (goto-char beg) + (when (or (looking-at org-outline-regexp) + (re-search-forward org-outline-regexp-bol end t)) + (setq level (org-outline-level))) + (goto-char end) + (skip-chars-forward " \t\r\n\v\f") + (not (or (eobp) + (and (bolp) (looking-at-p org-outline-regexp) + (<= (org-outline-level) level)))))))) + +(defun org-back-to-heading (&optional invisible-ok) + "Call `outline-back-to-heading', but provide a better error message." + (condition-case nil + (outline-back-to-heading invisible-ok) + (error + (user-error "Before first headline at position %d in buffer %s" + (point) (current-buffer))))) + +(defun org-back-to-heading-or-point-min (&optional invisible-ok) + "Go back to heading or first point in buffer. +If point is before first heading go to first point in buffer +instead of back to heading." + (condition-case nil + (outline-back-to-heading invisible-ok) + (error + (goto-char (point-min))))) + +(defun org-before-first-heading-p () + "Before first heading?" + (org-with-limited-levels + (save-excursion + (end-of-line) + (null (re-search-backward org-outline-regexp-bol nil t))))) + +(defun org-at-heading-p (&optional _) + "Non-nil when on a headline." + (outline-on-heading-p t)) + +(defun org-in-commented-heading-p (&optional no-inheritance) + "Non-nil if point is under a commented heading. +This function also checks ancestors of the current headline, +unless optional argument NO-INHERITANCE is non-nil." + (cond + ((org-before-first-heading-p) nil) + ((let ((headline (nth 4 (org-heading-components)))) + (and headline + (let ((case-fold-search nil)) + (string-match-p (concat "^" org-comment-string "\\(?: \\|$\\)") + headline))))) + (no-inheritance nil) + (t + (save-excursion (and (org-up-heading-safe) (org-in-commented-heading-p)))))) + +(defun org-in-archived-heading-p (&optional no-inheritance) + "Non-nil if point is under an archived heading. +This function also checks ancestors of the current headline, +unless optional argument NO-INHERITANCE is non-nil." + (cond + ((org-before-first-heading-p) nil) + ((let ((tags (org-get-tags nil 'local))) + (and tags + (cl-some (apply-partially #'string= org-archive-tag) tags)))) + (no-inheritance nil) + (t + (save-excursion (and (org-up-heading-safe) (org-in-archived-heading-p)))))) + +(defun org-at-comment-p nil + "Return t if cursor is in a commented line." + (save-excursion + (save-match-data + (beginning-of-line) + (looking-at org-comment-regexp)))) + +(defun org-at-keyword-p nil + "Return t if cursor is at a keyword-line." + (save-excursion + (move-beginning-of-line 1) + (looking-at org-keyword-regexp))) + +(defun org-at-drawer-p nil + "Return t if cursor is at a drawer keyword." + (save-excursion + (move-beginning-of-line 1) + (looking-at org-drawer-regexp))) + +(defun org-at-block-p nil + "Return t if cursor is at a block keyword." + (save-excursion + (move-beginning-of-line 1) + (looking-at org-block-regexp))) + +(defun org-point-at-end-of-empty-headline () + "If point is at the end of an empty headline, return t, else nil. +If the heading only contains a TODO keyword, it is still considered +empty." + (let ((case-fold-search nil)) + (and (looking-at "[ \t]*$") + org-todo-line-regexp + (save-excursion + (beginning-of-line) + (looking-at org-todo-line-regexp) + (string= (match-string 3) ""))))) + +(defun org-at-heading-or-item-p () + (or (org-at-heading-p) (org-at-item-p))) + +(defun org-up-heading-all (arg) + "Move to the heading line of which the present line is a subheading. +This function considers both visible and invisible heading lines. +With argument, move up ARG levels." + (outline-up-heading arg t)) + +(defvar-local org--up-heading-cache nil + "Buffer-local `org-up-heading-safe' cache.") +(defvar-local org--up-heading-cache-tick nil + "Buffer `buffer-chars-modified-tick' in `org--up-heading-cache'.") +(defun org-up-heading-safe () + "Move to the heading line of which the present line is a subheading. +This version will not throw an error. It will return the level of the +headline found, or nil if no higher level is found. + +Also, this function will be a lot faster than `outline-up-heading', +because it relies on stars being the outline starters. This can really +make a significant difference in outlines with very many siblings." + (when (ignore-errors (org-back-to-heading t)) + (let (level-cache) + (unless org--up-heading-cache + (setq org--up-heading-cache (make-hash-table))) + (if (and (eq (buffer-chars-modified-tick) org--up-heading-cache-tick) + (setq level-cache (gethash (point) org--up-heading-cache))) + (when (<= (point-min) (car level-cache) (point-max)) + ;; Parent is inside accessible part of the buffer. + (progn (goto-char (car level-cache)) + (cdr level-cache))) + ;; Buffer modified. Invalidate cache. + (unless (eq (buffer-chars-modified-tick) org--up-heading-cache-tick) + (setq-local org--up-heading-cache-tick + (buffer-chars-modified-tick)) + (clrhash org--up-heading-cache)) + (let* ((level-up (1- (funcall outline-level))) + (pos (point)) + (result (and (> level-up 0) + (re-search-backward + (format "^\\*\\{1,%d\\} " level-up) nil t) + (funcall outline-level)))) + (when result (puthash pos (cons (point) result) org--up-heading-cache)) + result))))) + +(defun org-up-heading-or-point-min () + "Move to the heading line of which the present is a subheading, or point-min. +This version is needed to make point-min behave like a virtual +heading of level 0 for property-inheritance. It will return the +level of the headline found (down to 0) or nil if already at a +point before the first headline or at point-min." + (when (ignore-errors (org-back-to-heading t)) + (if (< 1 (funcall outline-level)) + (org-up-heading-safe) + (unless (= (point) (point-min)) (goto-char (point-min)))))) + +(defun org-first-sibling-p () + "Is this heading the first child of its parents?" + (interactive) + (let ((re org-outline-regexp-bol) + level l) + (unless (org-at-heading-p t) + (user-error "Not at a heading")) + (setq level (funcall outline-level)) + (save-excursion + (if (not (re-search-backward re nil t)) + t + (setq l (funcall outline-level)) + (< l level))))) + +(defun org-goto-sibling (&optional previous) + "Goto the next sibling, even if it is invisible. +When PREVIOUS is set, go to the previous sibling instead. Returns t +when a sibling was found. When none is found, return nil and don't +move point." + (let ((fun (if previous 're-search-backward 're-search-forward)) + (pos (point)) + (re org-outline-regexp-bol) + level l) + (when (ignore-errors (org-back-to-heading t)) + (setq level (funcall outline-level)) + (catch 'exit + (or previous (forward-char 1)) + (while (funcall fun re nil t) + (setq l (funcall outline-level)) + (when (< l level) (goto-char pos) (throw 'exit nil)) + (when (= l level) (goto-char (match-beginning 0)) (throw 'exit t))) + (goto-char pos) + nil)))) + +(defun org-show-siblings () + "Show all siblings of the current headline." + (save-excursion + (while (org-goto-sibling) (org-flag-heading nil))) + (save-excursion + (while (org-goto-sibling 'previous) + (org-flag-heading nil)))) + +(defun org-goto-first-child () + "Goto the first child, even if it is invisible. +Return t when a child was found. Otherwise don't move point and +return nil." + (let (level (pos (point)) (re org-outline-regexp-bol)) + (when (org-back-to-heading-or-point-min t) + (setq level (org-outline-level)) + (forward-char 1) + (if (and (re-search-forward re nil t) (> (org-outline-level) level)) + (progn (goto-char (match-beginning 0)) t) + (goto-char pos) nil)))) + +(defun org-show-hidden-entry () + "Show an entry where even the heading is hidden." + (save-excursion + (org-show-entry))) + +(defun org-flag-heading (flag &optional entry) + "Flag the current heading. FLAG non-nil means make invisible. +When ENTRY is non-nil, show the entire entry." + (save-excursion + (org-back-to-heading t) + ;; Check if we should show the entire entry + (if (not entry) + (org-flag-region + (line-end-position 0) (line-end-position) flag 'outline) + (org-show-entry) + (save-excursion + (and (outline-next-heading) + (org-flag-heading nil)))))) + +(defun org-get-next-sibling () + "Move to next heading of the same level, and return point. +If there is no such heading, return nil. +This is like outline-next-sibling, but invisible headings are ok." + (let ((level (funcall outline-level))) + (outline-next-heading) + (while (and (not (eobp)) (> (funcall outline-level) level)) + (outline-next-heading)) + (unless (or (eobp) (< (funcall outline-level) level)) + (point)))) + +(defun org-get-previous-sibling () + "Move to previous heading of the same level, and return point. +If there is no such heading, return nil." + (let ((opoint (point)) + (level (funcall outline-level))) + (outline-previous-heading) + (when (and (/= (point) opoint) (outline-on-heading-p t)) + (while (and (> (funcall outline-level) level) + (not (bobp))) + (outline-previous-heading)) + (unless (< (funcall outline-level) level) + (point))))) + +(defun org-end-of-subtree (&optional invisible-ok to-heading) + "Goto to the end of a subtree." + ;; This contains an exact copy of the original function, but it uses + ;; `org-back-to-heading-or-point-min', to make it work also in invisible + ;; trees and before first headline. And is uses an invisible-ok argument. + ;; Under Emacs this is not needed, but the old outline.el needs this fix. + ;; Furthermore, when used inside Org, finding the end of a large subtree + ;; with many children and grandchildren etc, this can be much faster + ;; than the outline version. + (org-back-to-heading-or-point-min invisible-ok) + (let ((first t) + (level (funcall outline-level))) + (cond ((= level 0) + (goto-char (point-max))) + ((and (derived-mode-p 'org-mode) (< level 1000)) + ;; A true heading (not a plain list item), in Org + ;; This means we can easily find the end by looking + ;; only for the right number of stars. Using a regexp to do + ;; this is so much faster than using a Lisp loop. + (let ((re (concat "^\\*\\{1," (number-to-string level) "\\} "))) + (forward-char 1) + (and (re-search-forward re nil 'move) (beginning-of-line 1)))) + (t + ;; something else, do it the slow way + (while (and (not (eobp)) + (or first (> (funcall outline-level) level))) + (setq first nil) + (outline-next-heading)))) + (unless to-heading + (when (memq (preceding-char) '(?\n ?\^M)) + ;; Go to end of line before heading + (forward-char -1) + (when (memq (preceding-char) '(?\n ?\^M)) + ;; leave blank line before heading + (forward-char -1))))) + (point)) + +(defun org-end-of-meta-data (&optional full) + "Skip planning line and properties drawer in current entry. + +When optional argument FULL is t, also skip planning information, +clocking lines and any kind of drawer. + +When FULL is non-nil but not t, skip planning information, +properties, clocking lines and logbook drawers." + (org-back-to-heading t) + (forward-line) + ;; Skip planning information. + (when (looking-at-p org-planning-line-re) (forward-line)) + ;; Skip property drawer. + (when (looking-at org-property-drawer-re) + (goto-char (match-end 0)) + (forward-line)) + ;; When FULL is not nil, skip more. + (when (and full (not (org-at-heading-p))) + (catch 'exit + (let ((end (save-excursion (outline-next-heading) (point))) + (re (concat "[ \t]*$" "\\|" org-clock-line-re))) + (while (not (eobp)) + (cond ;; Skip clock lines. + ((looking-at-p re) (forward-line)) + ;; Skip logbook drawer. + ((looking-at-p org-logbook-drawer-re) + (if (re-search-forward "^[ \t]*:END:[ \t]*$" end t) + (forward-line) + (throw 'exit t))) + ;; When FULL is t, skip regular drawer too. + ((and (eq full t) (looking-at-p org-drawer-regexp)) + (if (re-search-forward "^[ \t]*:END:[ \t]*$" end t) + (forward-line) + (throw 'exit t))) + (t (throw 'exit t)))))))) + +(defun org--line-fully-invisible-p () + "Return non-nil if the current line is fully invisible." + (let ((line-beg (line-beginning-position)) + (line-pos (1- (line-end-position))) + (is-invisible t)) + (while (and (< line-beg line-pos) is-invisible) + (setq is-invisible (org-invisible-p line-pos)) + (setq line-pos (1- line-pos))) + is-invisible)) + +(defun org-forward-heading-same-level (arg &optional invisible-ok) + "Move forward to the ARG'th subheading at same level as this one. +Stop at the first and last subheadings of a superior heading. +Normally this only looks at visible headings, but when INVISIBLE-OK is +non-nil it will also look at invisible ones." + (interactive "p") + (let ((backward? (and arg (< arg 0)))) + (if (org-before-first-heading-p) + (if backward? (goto-char (point-min)) (outline-next-heading)) + (org-back-to-heading invisible-ok) + (unless backward? (end-of-line)) ;do not match current headline + (let ((level (- (match-end 0) (match-beginning 0) 1)) + (f (if backward? #'re-search-backward #'re-search-forward)) + (count (if arg (abs arg) 1)) + (result (point))) + (while (and (> count 0) + (funcall f org-outline-regexp-bol nil 'move)) + (let ((l (- (match-end 0) (match-beginning 0) 1))) + (cond ((< l level) (setq count 0)) + ((and (= l level) + (or invisible-ok + ;; FIXME: See commit a700fadd72 and the + ;; related discussion on why using + ;; `org--line-fully-invisible-p' is needed + ;; here, which is to serve the needs of an + ;; external package. If the change is + ;; wrong regarding Org itself, it should + ;; be removed. + (not (org--line-fully-invisible-p)))) + (cl-decf count) + (when (= l level) (setq result (point))))))) + (goto-char result)) + (beginning-of-line)))) + +(defun org-backward-heading-same-level (arg &optional invisible-ok) + "Move backward to the ARG'th subheading at same level as this one. +Stop at the first and last subheadings of a superior heading." + (interactive "p") + (org-forward-heading-same-level (if arg (- arg) -1) invisible-ok)) + +(defun org-next-visible-heading (arg) + "Move to the next visible heading line. +With ARG, repeats or can move backward if negative." + (interactive "p") + (let ((regexp (concat "^" (org-get-limited-outline-regexp)))) + (if (< arg 0) + (beginning-of-line) + (end-of-line)) + (while (and (< arg 0) (re-search-backward regexp nil :move)) + (unless (bobp) + (while (pcase (get-char-property-and-overlay (point) 'invisible) + (`(outline . ,o) + (goto-char (overlay-start o)) + (re-search-backward regexp nil :move)) + (_ nil)))) + (cl-incf arg)) + (while (and (> arg 0) (re-search-forward regexp nil t)) + (while (pcase (get-char-property-and-overlay (point) 'invisible) + (`(outline . ,o) + (goto-char (overlay-end o)) + (re-search-forward regexp nil :move)) + (_ + (end-of-line) + nil))) ;leave the loop + (cl-decf arg)) + (if (> arg 0) (goto-char (point-max)) (beginning-of-line)))) + +(defun org-previous-visible-heading (arg) + "Move to the previous visible heading. +With ARG, repeats or can move forward if negative." + (interactive "p") + (org-next-visible-heading (- arg))) + +(defun org-forward-paragraph (&optional arg) + "Move forward by a paragraph, or equivalent, unit. + +With argument ARG, do it ARG times; +a negative argument ARG = -N means move backward N paragraphs. + +The function moves point between two structural +elements (paragraphs, tables, lists, etc.). + +It also provides the following special moves for convenience: + + - on a table or a property drawer, move to its beginning; + - on comment, example, export, source and verse blocks, stop + at blank lines; + - skip consecutive clocks, diary S-exps, and keywords." + (interactive "^p") + (unless arg (setq arg 1)) + (if (< arg 0) (org-backward-paragraph (- arg)) + (while (and (> arg 0) (not (eobp))) + (org--forward-paragraph-once) + (cl-decf arg)) + ;; Return moves left. + arg)) + +(defun org-backward-paragraph (&optional arg) + "Move backward by a paragraph, or equivalent, unit. + +With argument ARG, do it ARG times; +a negative argument ARG = -N means move forward N paragraphs. + +The function moves point between two structural +elements (paragraphs, tables, lists, etc.). + +It also provides the following special moves for convenience: + + - on a table or a property drawer, move to its beginning; + - on comment, example, export, source and verse blocks, stop + at blank lines; + - skip consecutive clocks, diary S-exps, and keywords." + (interactive "^p") + (unless arg (setq arg 1)) + (if (< arg 0) (org-forward-paragraph (- arg)) + (while (and (> arg 0) (not (bobp))) + (org--backward-paragraph-once) + (cl-decf arg)) + ;; Return moves left. + arg)) + +(defun org--paragraph-at-point () + "Return paragraph, or equivalent, element at point. + +Paragraph element at point is the element at point, with the +following special cases: + +- treat table rows (resp. node properties) as the table + \(resp. property drawer) containing them. + +- treat plain lists with an item every line as a whole. + +- treat consecutive keywords, clocks, and diary-sexps as a single + block. + +Function may return a real element, or a pseudo-element with type +`pseudo-paragraph'." + (let* ((e (org-element-at-point)) + (type (org-element-type e)) + ;; If we need to fake a new pseudo-element, triplet is + ;; + ;; (BEG END PARENT) + ;; + ;; where BEG and END are element boundaries, and PARENT the + ;; element containing it, or nil. + (triplet + (cond + ((memq type '(table property-drawer)) + (list (org-element-property :begin e) + (org-element-property :end e) + (org-element-property :parent e))) + ((memq type '(node-property table-row)) + (let ((e (org-element-property :parent e))) + (list (org-element-property :begin e) + (org-element-property :end e) + (org-element-property :parent e)))) + ((memq type '(clock diary-sexp keyword)) + (let* ((regexp (pcase type + (`clock org-clock-line-re) + (`diary-sexp "%%(") + (_ org-keyword-regexp))) + (end (if (< 0 (org-element-property :post-blank e)) + (org-element-property :end e) + (org-with-wide-buffer + (forward-line) + (while (looking-at regexp) (forward-line)) + (skip-chars-forward " \t\n") + (line-beginning-position)))) + (begin (org-with-point-at (org-element-property :begin e) + (while (and (not (bobp)) (looking-at regexp)) + (forward-line -1)) + ;; We may have gotten one line too far. + (if (looking-at regexp) + (point) + (line-beginning-position 2))))) + (list begin end (org-element-property :parent e)))) + ;; Find the full plain list containing point, the check it + ;; contains exactly one line per item. + ((let ((l (org-element-lineage e '(plain-list) t))) + (while (memq (org-element-type (org-element-property :parent l)) + '(item plain-list)) + (setq l (org-element-property :parent l))) + (and l + (org-with-point-at (org-element-property :post-affiliated l) + (forward-line (length (org-element-property :structure l))) + (= (point) (org-element-property :contents-end l))) + ;; Return value. + (list (org-element-property :begin l) + (org-element-property :end l) + (org-element-property :parent l))))) + (t nil)))) ;no triplet: return element + (pcase triplet + (`(,b ,e ,p) + (org-element-create + 'pseudo-paragraph + (list :begin b :end e :parent p :post-blank 0 :post-affiliated b))) + (_ e)))) + +(defun org--forward-paragraph-once () + "Move forward to end of paragraph or equivalent, once. +See `org-forward-paragraph'." + (interactive) + (save-restriction + (widen) + (skip-chars-forward " \t\n") + (cond + ((eobp) nil) + ;; When inside a folded part, move out of it. + ((pcase (get-char-property-and-overlay (point) 'invisible) + (`(,(or `outline `org-hide-block) . ,o) + (goto-char (overlay-end o)) + (forward-line) + t) + (_ nil))) + (t + (let* ((element (org--paragraph-at-point)) + (type (org-element-type element)) + (contents-begin (org-element-property :contents-begin element)) + (end (org-element-property :end element)) + (post-affiliated (org-element-property :post-affiliated element))) + (cond + ((eq type 'plain-list) + (forward-char) + (org--forward-paragraph-once)) + ;; If the element is folded, skip it altogether. + ((pcase (org-with-point-at post-affiliated + (get-char-property-and-overlay (line-end-position) + 'invisible)) + (`(,(or `outline `org-hide-block) . ,o) + (goto-char (overlay-end o)) + (forward-line) + t) + (_ nil))) + ;; At a greater element, move inside. + ((and contents-begin + (> contents-begin (point)) + (not (eq type 'paragraph))) + (goto-char contents-begin) + ;; Items and footnote definitions contents may not start at + ;; the beginning of the line. In this case, skip until the + ;; next paragraph. + (cond + ((not (bolp)) (org--forward-paragraph-once)) + ((org-previous-line-empty-p) (forward-line -1)) + (t nil))) + ;; Move between empty lines in some blocks. + ((memq type '(comment-block example-block export-block src-block + verse-block)) + (let ((contents-start + (org-with-point-at post-affiliated + (line-beginning-position 2)))) + (if (< (point) contents-start) + (goto-char contents-start) + (let ((contents-end + (org-with-point-at end + (skip-chars-backward " \t\n") + (line-beginning-position)))) + (cond + ((>= (point) contents-end) + (goto-char end) + (skip-chars-backward " \t\n") + (forward-line)) + ((re-search-forward "^[ \t]*\n" contents-end :move) + (forward-line -1)) + (t nil)))))) + (t + ;; Move to element's end. + (goto-char end) + (skip-chars-backward " \t\n") + (forward-line)))))))) + +(defun org--backward-paragraph-once () + "Move backward to start of paragraph or equivalent, once. +See `org-backward-paragraph'." + (interactive) + (save-restriction + (widen) + (cond + ((bobp) nil) + ;; Blank lines at the beginning of the buffer. + ((and (org-match-line "^[ \t]*$") + (save-excursion (skip-chars-backward " \t\n") (bobp))) + (goto-char (point-min))) + ;; When inside a folded part, move out of it. + ((pcase (get-char-property-and-overlay (1- (point)) 'invisible) + (`(,(or `outline `org-hide-block) . ,o) + (goto-char (1- (overlay-start o))) + (org--backward-paragraph-once) + t) + (_ nil))) + (t + (let* ((element (org--paragraph-at-point)) + (type (org-element-type element)) + (begin (org-element-property :begin element)) + (post-affiliated (org-element-property :post-affiliated element)) + (contents-end (org-element-property :contents-end element)) + (end (org-element-property :end element)) + (parent (org-element-property :parent element)) + (reach + ;; Move to the visible empty line above position P, or + ;; to position P. Return t. + (lambda (p) + (goto-char p) + (when (and (org-previous-line-empty-p) + (let ((end (line-end-position 0))) + (or (= end (point-min)) + (not (org-invisible-p (1- end)))))) + (forward-line -1)) + t))) + (cond + ;; Already at the beginning of an element. + ((= begin (point)) + (cond + ;; There is a blank line above. Move there. + ((and (org-previous-line-empty-p) + (let ((lep (line-end-position 0))) + ;; When the first headline start at point 2, don't choke while + ;; checking with `org-invisible-p'. + (or (= lep 1) + (not (org-invisible-p (1- (line-end-position 0))))))) + (forward-line -1)) + ;; At the beginning of the first element within a greater + ;; element. Move to the beginning of the greater element. + ((and parent (= begin (org-element-property :contents-begin parent))) + (funcall reach (org-element-property :begin parent))) + ;; Since we have to move anyway, find the beginning + ;; position of the element above. + (t + (forward-char -1) + (org--backward-paragraph-once)))) + ;; Skip paragraphs at the very beginning of footnote + ;; definitions or items. + ((and (eq type 'paragraph) + (org-with-point-at begin (not (bolp)))) + (funcall reach (progn (goto-char begin) (line-beginning-position)))) + ;; If the element is folded, skip it altogether. + ((org-with-point-at post-affiliated + (org-invisible-p (line-end-position) t)) + (funcall reach begin)) + ;; At the end of a greater element, move inside. + ((and contents-end + (<= contents-end (point)) + (not (eq type 'paragraph))) + (cond + ((memq type '(footnote-definition plain-list)) + (skip-chars-backward " \t\n") + (org--backward-paragraph-once)) + ((= contents-end (point)) + (forward-char -1) + (org--backward-paragraph-once)) + (t + (goto-char contents-end)))) + ;; Move between empty lines in some blocks. + ((and (memq type '(comment-block example-block export-block src-block + verse-block)) + (let ((contents-start + (org-with-point-at post-affiliated + (line-beginning-position 2)))) + (when (> (point) contents-start) + (let ((contents-end + (org-with-point-at end + (skip-chars-backward " \t\n") + (line-beginning-position)))) + (if (> (point) contents-end) + (progn (goto-char contents-end) t) + (skip-chars-backward " \t\n" begin) + (re-search-backward "^[ \t]*\n" contents-start :move) + t)))))) + ;; Move to element's start. + (t + (funcall reach begin)))))))) + +(defun org-forward-element () + "Move forward by one element. +Move to the next element at the same level, when possible." + (interactive) + (cond ((eobp) (user-error "Cannot move further down")) + ((org-with-limited-levels (org-at-heading-p)) + (let ((origin (point))) + (goto-char (org-end-of-subtree nil t)) + (unless (org-with-limited-levels (org-at-heading-p)) + (goto-char origin) + (user-error "Cannot move further down")))) + (t + (let* ((elem (org-element-at-point)) + (end (org-element-property :end elem)) + (parent (org-element-property :parent elem))) + (cond ((and parent (= (org-element-property :contents-end parent) end)) + (goto-char (org-element-property :end parent))) + ((integer-or-marker-p end) (goto-char end)) + (t (message "No element at point"))))))) + +(defun org-backward-element () + "Move backward by one element. +Move to the previous element at the same level, when possible." + (interactive) + (cond ((bobp) (user-error "Cannot move further up")) + ((org-with-limited-levels (org-at-heading-p)) + ;; At a headline, move to the previous one, if any, or stay + ;; here. + (let ((origin (point))) + (org-with-limited-levels (org-backward-heading-same-level 1)) + ;; When current headline has no sibling above, move to its + ;; parent. + (when (= (point) origin) + (or (org-with-limited-levels (org-up-heading-safe)) + (progn (goto-char origin) + (user-error "Cannot move further up")))))) + (t + (let* ((elem (org-element-at-point)) + (beg (org-element-property :begin elem))) + (cond + ;; Move to beginning of current element if point isn't + ;; there already. + ((null beg) (message "No element at point")) + ((/= (point) beg) (goto-char beg)) + (t (goto-char beg) + (skip-chars-backward " \r\t\n") + (unless (bobp) + (let ((prev (org-element-at-point))) + (goto-char (org-element-property :begin prev)) + (while (and (setq prev (org-element-property :parent prev)) + (<= (org-element-property :end prev) beg)) + (goto-char (org-element-property :begin prev))))))))))) + +(defun org-up-element () + "Move to upper element." + (interactive) + (if (org-with-limited-levels (org-at-heading-p)) + (unless (org-up-heading-safe) (user-error "No surrounding element")) + (let* ((elem (org-element-at-point)) + (parent (org-element-property :parent elem))) + (if parent (goto-char (org-element-property :begin parent)) + (if (org-with-limited-levels (org-before-first-heading-p)) + (user-error "No surrounding element") + (org-with-limited-levels (org-back-to-heading))))))) + +(defun org-down-element () + "Move to inner element." + (interactive) + (let ((element (org-element-at-point))) + (cond + ((memq (org-element-type element) '(plain-list table)) + (goto-char (org-element-property :contents-begin element)) + (forward-char)) + ((memq (org-element-type element) org-element-greater-elements) + ;; If contents are hidden, first disclose them. + (when (org-invisible-p (line-end-position)) (org-cycle)) + (goto-char (or (org-element-property :contents-begin element) + (user-error "No content for this element")))) + (t (user-error "No inner element"))))) + +(defun org-drag-element-backward () + "Move backward element at point." + (interactive) + (let ((elem (or (org-element-at-point) + (user-error "No element at point")))) + (if (eq (org-element-type elem) 'headline) + ;; Preserve point when moving a whole tree, even if point was + ;; on blank lines below the headline. + (let ((offset (skip-chars-backward " \t\n"))) + (unwind-protect (org-move-subtree-up) + (forward-char (- offset)))) + (let ((prev-elem + (save-excursion + (goto-char (org-element-property :begin elem)) + (skip-chars-backward " \r\t\n") + (unless (bobp) + (let* ((beg (org-element-property :begin elem)) + (prev (org-element-at-point)) + (up prev)) + (while (and (setq up (org-element-property :parent up)) + (<= (org-element-property :end up) beg)) + (setq prev up)) + prev))))) + ;; Error out if no previous element or previous element is + ;; a parent of the current one. + (if (or (not prev-elem) (org-element-nested-p elem prev-elem)) + (user-error "Cannot drag element backward") + (let ((pos (point))) + (org-element-swap-A-B prev-elem elem) + (goto-char (+ (org-element-property :begin prev-elem) + (- pos (org-element-property :begin elem)))))))))) + +(defun org-drag-element-forward () + "Move forward element at point." + (interactive) + (let* ((pos (point)) + (elem (or (org-element-at-point) + (user-error "No element at point")))) + (when (= (point-max) (org-element-property :end elem)) + (user-error "Cannot drag element forward")) + (goto-char (org-element-property :end elem)) + (let ((next-elem (org-element-at-point))) + (when (or (org-element-nested-p elem next-elem) + (and (eq (org-element-type next-elem) 'headline) + (not (eq (org-element-type elem) 'headline)))) + (goto-char pos) + (user-error "Cannot drag element forward")) + ;; Compute new position of point: it's shifted by NEXT-ELEM + ;; body's length (without final blanks) and by the length of + ;; blanks between ELEM and NEXT-ELEM. + (let ((size-next (- (save-excursion + (goto-char (org-element-property :end next-elem)) + (skip-chars-backward " \r\t\n") + (forward-line) + ;; Small correction if buffer doesn't end + ;; with a newline character. + (if (and (eolp) (not (bolp))) (1+ (point)) (point))) + (org-element-property :begin next-elem))) + (size-blank (- (org-element-property :end elem) + (save-excursion + (goto-char (org-element-property :end elem)) + (skip-chars-backward " \r\t\n") + (forward-line) + (point))))) + (org-element-swap-A-B elem next-elem) + (goto-char (+ pos size-next size-blank)))))) + +(defun org-drag-line-forward (arg) + "Drag the line at point ARG lines forward." + (interactive "p") + (dotimes (_ (abs arg)) + (let ((c (current-column))) + (if (< 0 arg) + (progn + (beginning-of-line 2) + (transpose-lines 1) + (beginning-of-line 0)) + (transpose-lines 1) + (beginning-of-line -1)) + (org-move-to-column c)))) + +(defun org-drag-line-backward (arg) + "Drag the line at point ARG lines backward." + (interactive "p") + (org-drag-line-forward (- arg))) + +(defun org-mark-element () + "Put point at beginning of this element, mark at end. + +Interactively, if this command is repeated or (in Transient Mark +mode) if the mark is active, it marks the next element after the +ones already marked." + (interactive) + (let (deactivate-mark) + (if (and (called-interactively-p 'any) + (or (and (eq last-command this-command) (mark t)) + (and transient-mark-mode mark-active))) + (set-mark + (save-excursion + (goto-char (mark)) + (goto-char (org-element-property :end (org-element-at-point))) + (point))) + (let ((element (org-element-at-point))) + (end-of-line) + (push-mark (min (point-max) (org-element-property :end element)) t t) + (goto-char (org-element-property :begin element)))))) + +(defun org-narrow-to-element () + "Narrow buffer to current element." + (interactive) + (let ((elem (org-element-at-point))) + (cond + ((eq (car elem) 'headline) + (narrow-to-region + (org-element-property :begin elem) + (org-element-property :end elem))) + ((memq (car elem) org-element-greater-elements) + (narrow-to-region + (org-element-property :contents-begin elem) + (org-element-property :contents-end elem))) + (t + (narrow-to-region + (org-element-property :begin elem) + (org-element-property :end elem)))))) + +(defun org-transpose-element () + "Transpose current and previous elements, keeping blank lines between. +Point is moved after both elements." + (interactive) + (org-skip-whitespace) + (let ((end (org-element-property :end (org-element-at-point)))) + (org-drag-element-backward) + (goto-char end))) + +(defun org-unindent-buffer () + "Un-indent the visible part of the buffer. +Relative indentation (between items, inside blocks, etc.) isn't +modified." + (interactive) + (unless (eq major-mode 'org-mode) + (user-error "Cannot un-indent a buffer not in Org mode")) + (letrec ((parse-tree (org-element-parse-buffer 'greater-element)) + (unindent-tree + (lambda (contents) + (dolist (element (reverse contents)) + (if (memq (org-element-type element) '(headline section)) + (funcall unindent-tree (org-element-contents element)) + (save-excursion + (save-restriction + (narrow-to-region + (org-element-property :begin element) + (org-element-property :end element)) + (org-do-remove-indentation)))))))) + (funcall unindent-tree (org-element-contents parse-tree)))) + +(defun org-make-options-regexp (kwds &optional extra) + "Make a regular expression for keyword lines. +KWDS is a list of keywords, as strings. Optional argument EXTRA, +when non-nil, is a regexp matching keywords names." + (concat "^[ \t]*#\\+\\(" + (regexp-opt kwds) + (and extra (concat (and kwds "\\|") extra)) + "\\):[ \t]*\\(.*\\)")) + + +;;; Conveniently switch to Info nodes + +(defun org-info-find-node (&optional nodename) + "Find Info documentation NODENAME or Org documentation according context. +Started from `gnus-info-find-node'." + (interactive) + (Info-goto-node + (or nodename + (let ((default-org-info-node "(org) Top")) + (cond + ((eq 'org-agenda-mode major-mode) "(org) Agenda Views") + ((eq 'org-mode major-mode) + (let* ((context (org-element-at-point)) + (element-info-nodes ; compare to `org-element-all-elements'. + `((babel-call . "(org) Evaluating Code Blocks") + (center-block . "(org) Paragraphs") + (clock . ,default-org-info-node) + (comment . "(org) Comment Lines") + (comment-block . "(org) Comment Lines") + (diary-sexp . ,default-org-info-node) + (drawer . "(org) Drawers") + (dynamic-block . "(org) Dynamic Blocks") + (example-block . "(org) Literal Examples") + (export-block . "(org) ASCII/Latin-1/UTF-8 export") + (fixed-width . ,default-org-info-node) + (footnote-definition . "(org) Creating Footnotes") + (headline . "(org) Document Structure") + (horizontal-rule . "(org) Built-in Table Editor") + (inlinetask . ,default-org-info-node) + (item . "(org) Plain Lists") + (keyword . "(org) Per-file keywords") + (latex-environment . "(org) LaTeX Export") + (node-property . "(org) Properties and Columns") + (paragraph . "(org) Paragraphs") + (plain-list . "(org) Plain Lists") + (planning . "(org) Deadlines and Scheduling") + (property-drawer . "(org) Properties and Columns") + (quote-block . "(org) Paragraphs") + (section . ,default-org-info-node) + (special-block . ,default-org-info-node) + (src-block . "(org) Working with Source Code") + (table . "(org) Tables") + (table-row . "(org) Tables") + (verse-block . "(org) Paragraphs")))) + (or (cdr (assoc (car context) element-info-nodes)) + default-org-info-node))) + (t default-org-info-node)))))) + + +;;; Finish up + +(add-hook 'org-mode-hook ;remove overlays when changing major mode + (lambda () (add-hook 'change-major-mode-hook + 'org-show-all 'append 'local))) + +(provide 'org) + +(run-hooks 'org-load-hook) + +;;; org.el ends here diff --git a/elpa/org-9.5.2/org.elc b/elpa/org-9.5.2/org.elc new file mode 100644 index 0000000..75a47f5 Binary files /dev/null and b/elpa/org-9.5.2/org.elc differ diff --git a/elpa/org-9.5.2/org.info b/elpa/org-9.5.2/org.info new file mode 100644 index 0000000..e7074e7 --- /dev/null +++ b/elpa/org-9.5.2/org.info @@ -0,0 +1,23626 @@ +This is org.info, produced by makeinfo version 6.7 from org.texi. + +This manual is for Org version 9.5. + + Copyright © 2004–2021 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with the Front-Cover Texts + being “A GNU Manual,” and with the Back-Cover Texts as in (a) + below. A copy of the license is included in the section entitled + “GNU Free Documentation License.” + + (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and + modify this GNU manual.” + +INFO-DIR-SECTION Emacs editing modes +START-INFO-DIR-ENTRY +* Org Mode: (org). Outline-based notes management and organizer. +END-INFO-DIR-ENTRY + + +File: org.info, Node: Top, Next: Introduction, Up: (dir) + +The Org Manual +************** + +This manual is for Org version 9.5. + + Copyright © 2004–2021 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with the Front-Cover Texts + being “A GNU Manual,” and with the Back-Cover Texts as in (a) + below. A copy of the license is included in the section entitled + “GNU Free Documentation License.” + + (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and + modify this GNU manual.” + +* Menu: + +* Introduction:: Getting started. +* Document Structure:: A tree works like your brain. +* Tables:: Pure magic for quick formatting. +* Hyperlinks:: Notes in context. +* TODO Items:: Every tree branch can be a TODO item. +* Tags:: Tagging headlines and matching sets of tags. +* Properties and Columns:: Storing information about an entry. +* Dates and Times:: Making items useful for planning. +* Refiling and Archiving:: Moving and copying information with ease. +* Capture and Attachments:: Dealing with external data. +* Agenda Views:: Collecting information into views. +* Markup for Rich Contents:: Compose beautiful documents. +* Exporting:: Sharing and publishing notes. +* Publishing:: Create a web site of linked Org files. +* Citation handling:: create, follow and export citations. +* Working with Source Code:: Export, evaluate, and tangle code blocks. +* Miscellaneous:: All the rest which did not fit elsewhere. +* Hacking:: How to hack your way around. +* History and Acknowledgments:: How Org came into being. +* GNU Free Documentation License:: The license for this documentation. +* Main Index:: An index of Org’s concepts and features. +* Key Index:: Key bindings and where they are described. +* Command and Function Index:: Command names and some internal functions. +* Variable Index:: Variables mentioned in the manual. + +— The Detailed Node Listing — + +Introduction + +* Summary:: Brief summary of what Org does. +* Installation:: Installing Org. +* Activation:: How to activate Org for certain buffers. +* Feedback:: Bug reports, ideas, patches, etc. +* Conventions:: Typesetting conventions used in this manual. + +Document Structure + +* Headlines:: How to typeset Org tree headlines. +* Visibility Cycling:: Show and hide, much simplified. +* Motion:: Jumping to other headlines. +* Structure Editing:: Changing sequence and level of headlines. +* Sparse Trees:: Matches embedded in context. +* Plain Lists:: Additional structure within an entry. +* Drawers:: Tucking stuff away. +* Blocks:: Folding blocks. + +Visibility Cycling + +* Global and local cycling:: Cycling through various visibility states. +* Initial visibility:: Setting the initial visibility state. +* Catching invisible edits:: Preventing mistakes when editing invisible parts. + +Tables + +* Built-in Table Editor:: Simple tables. +* Column Width and Alignment:: Overrule the automatic settings. +* Column Groups:: Grouping to trigger vertical lines. +* Orgtbl Mode:: The table editor as minor mode. +* The Spreadsheet:: The table editor has spreadsheet capabilities. +* Org Plot:: Plotting from Org tables. + +The Spreadsheet + +* References:: How to refer to another field or range. +* Formula syntax for Calc:: Using Calc to compute stuff. +* Formula syntax for Lisp:: Writing formulas in Emacs Lisp. +* Durations and time values:: How to compute durations and time values. +* Field and range formulas:: Formula for specific (ranges of) fields. +* Column formulas:: Formulas valid for an entire column. +* Lookup functions:: Lookup functions for searching tables. +* Editing and debugging formulas:: Fixing formulas. +* Updating the table:: Recomputing all dependent fields. +* Advanced features:: Field and column names, automatic recalculation... + +Hyperlinks + +* Link Format:: How links in Org are formatted. +* Internal Links:: Links to other places in the current file. +* Radio Targets:: Make targets trigger links in plain text. +* External Links:: URL-like links to the world. +* Handling Links:: Creating, inserting and following. +* Using Links Outside Org:: Linking from my C source code? +* Link Abbreviations:: Shortcuts for writing complex links. +* Search Options:: Linking to a specific location. +* Custom Searches:: When the default search is not enough. + +TODO Items + +* TODO Basics:: Marking and displaying TODO entries. +* TODO Extensions:: Workflow and assignments. +* Progress Logging:: Dates and notes for progress. +* Priorities:: Some things are more important than others. +* Breaking Down Tasks:: Splitting a task into manageable pieces. +* Checkboxes:: Tick-off lists. + +TODO Extensions + +* Workflow states:: From TODO to DONE in steps. +* TODO types:: I do this, Fred does the rest. +* Multiple sets in one file:: Mixing it all, still finding your way. +* Fast access to TODO states:: Single letter selection of state. +* Per-file keywords:: Different files, different requirements. +* Faces for TODO keywords:: Highlighting states. +* TODO dependencies:: When one task needs to wait for others. + +Progress Logging + +* Closing items:: When was this entry marked as done? +* Tracking TODO state changes:: When did the status change? +* Tracking your habits:: How consistent have you been? + +Tags + +* Tag Inheritance:: Tags use the tree structure of an outline. +* Setting Tags:: How to assign tags to a headline. +* Tag Hierarchy:: Create a hierarchy of tags. +* Tag Searches:: Searching for combinations of tags. + +Properties and Columns + +* Property Syntax:: How properties are spelled out. +* Special Properties:: Access to other Org mode features. +* Property Searches:: Matching property values. +* Property Inheritance:: Passing values down a tree. +* Column View:: Tabular viewing and editing. + +Column View + +* Defining columns:: The COLUMNS format property. +* Using column view:: How to create and use column view. +* Capturing column view:: A dynamic block for column view. + +Defining columns + +* Scope of column definitions:: Where defined, where valid? +* Column attributes:: Appearance and content of a column. + +Dates and Times + +* Timestamps:: Assigning a time to a tree entry. +* Creating Timestamps:: Commands to insert timestamps. +* Deadlines and Scheduling:: Planning your work. +* Clocking Work Time:: Tracking how long you spend on a task. +* Effort Estimates:: Planning work effort in advance. +* Timers:: Notes with a running timer. + +Creating Timestamps + +* The date/time prompt:: How Org mode helps you enter dates and times. +* Custom time format:: Making dates look different. + +Deadlines and Scheduling + +* Inserting deadline/schedule:: Planning items. +* Repeated tasks:: Items that show up again and again. + +Clocking Work Time + +* Clocking commands:: Starting and stopping a clock. +* The clock table:: Detailed reports. +* Resolving idle time:: Resolving time when you’ve been idle. + +Refiling and Archiving + +* Refile and Copy:: Moving/copying a tree from one place to another. +* Archiving:: What to do with finished products. + +Archiving + +* Moving subtrees:: Moving a tree to an archive file. +* Internal archiving:: Switch off a tree but keep it in the file. + +Capture and Attachments + +* Capture:: Capturing new stuff. +* Attachments:: Attach files to outlines. +* RSS Feeds:: Getting input from RSS feeds. + +Capture + +* Setting up capture:: Where notes will be stored. +* Using capture:: Commands to invoke and terminate capture. +* Capture templates:: Define the outline of different note types. + +Capture templates + +* Template elements:: What is needed for a complete template entry. +* Template expansion:: Filling in information about time and context. +* Templates in contexts:: Only show a template in a specific context. + +Attachments + +* Attachment defaults and dispatcher:: How to access attachment commands +* Attachment options:: Configuring the attachment system +* Attachment links:: Hyperlink access to attachments +* Automatic version-control with Git:: Everything safely stored away +* Attach from Dired:: Using dired to select an attachment + +Agenda Views + +* Agenda Files:: Files being searched for agenda information. +* Agenda Dispatcher:: Keyboard access to agenda views. +* Built-in Agenda Views:: What is available out of the box? +* Presentation and Sorting:: How agenda items are prepared for display. +* Agenda Commands:: Remote editing of Org trees. +* Custom Agenda Views:: Defining special searches and views. +* Exporting Agenda Views:: Writing a view to a file. +* Agenda Column View:: Using column view for collected entries. + +Built-in Agenda Views + +* Weekly/daily agenda:: The calendar page with current tasks. +* Global TODO list:: All unfinished action items. +* Matching tags and properties:: Structured information with fine-tuned search. +* Search view:: Find entries by searching for text. +* Stuck projects:: Find projects you need to review. + +Presentation and Sorting + +* Categories:: Not all tasks are equal. +* Time-of-day specifications:: How the agenda knows the time. +* Sorting of agenda items:: The order of things. +* Filtering/limiting agenda items:: Dynamically narrow the agenda. + +Custom Agenda Views + +* Storing searches:: Type once, use often. +* Block agenda:: All the stuff you need in a single buffer. +* Setting options:: Changing the rules. + +Markup for Rich Contents + +* Paragraphs:: The basic unit of text. +* Emphasis and Monospace:: Bold, italic, etc. +* Subscripts and Superscripts:: Simple syntax for raising/lowering text. +* Special Symbols:: Greek letters and other symbols. +* Embedded LaTeX:: LaTeX can be freely used inside Org documents. +* Literal Examples:: Source code examples with special formatting. +* Images:: Display an image. +* Captions:: Describe tables, images... +* Horizontal Rules:: Make a line. +* Creating Footnotes:: Edit and read footnotes. + +Embedded LaTeX + +* LaTeX fragments:: Complex formulas made easy. +* Previewing LaTeX fragments:: What will this snippet look like? +* CDLaTeX mode:: Speed up entering of formulas. + +Exporting + +* The Export Dispatcher:: The main interface. +* Export Settings:: Common export settings. +* Table of Contents:: The if and where of the table of contents. +* Include Files:: Include additional files into a document. +* Macro Replacement:: Use macros to create templates. +* Comment Lines:: What will not be exported. +* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding. +* Beamer Export:: Producing presentations and slides. +* HTML Export:: Exporting to HTML. +* LaTeX Export:: Exporting to LaTeX and processing to PDF. +* Markdown Export:: Exporting to Markdown. +* OpenDocument Text Export:: Exporting to OpenDocument Text. +* Org Export:: Exporting to Org. +* Texinfo Export:: Exporting to Texinfo. +* iCalendar Export:: Exporting to iCalendar. +* Other Built-in Back-ends:: Exporting to a man page. +* Advanced Export Configuration:: Fine-tuning the export output. +* Export in Foreign Buffers:: Author tables and lists in Org syntax. + +Beamer Export + +* Beamer export commands:: For creating Beamer documents. +* Beamer specific export settings:: For customizing Beamer export. +* Frames and Blocks in Beamer:: For composing Beamer slides. +* Beamer specific syntax:: For using in Org documents. +* Editing support:: Editing support. +* A Beamer example:: A complete presentation. + +HTML Export + +* HTML export commands:: Invoking HTML export. +* HTML specific export settings:: Settings for HTML export. +* HTML doctypes:: Exporting various (X)HTML flavors. +* HTML preamble and postamble:: Inserting preamble and postamble. +* Quoting HTML tags:: Using direct HTML in Org files. +* Headlines in HTML export:: Formatting headlines. +* Links in HTML export:: Inserting and formatting links. +* Tables in HTML export:: How to modify the formatting of tables. +* Images in HTML export:: How to insert figures into HTML output. +* Math formatting in HTML export:: Beautiful math also on the web. +* Text areas in HTML export:: An alternate way to show an example. +* CSS support:: Changing the appearance of the output. +* JavaScript support:: Info and folding in a web browser. + +LaTeX Export + +* LaTeX/PDF export commands:: For producing LaTeX and PDF documents. +* LaTeX specific export settings:: Unique to this LaTeX back-end. +* LaTeX header and sectioning:: Setting up the export file structure. +* Quoting LaTeX code:: Incorporating literal LaTeX code. +* Tables in LaTeX export:: Options for exporting tables to LaTeX. +* Images in LaTeX export:: How to insert figures into LaTeX output. +* Plain lists in LaTeX export:: Attributes specific to lists. +* Source blocks in LaTeX export:: Attributes specific to source code blocks. +* Example blocks in LaTeX export:: Attributes specific to example blocks. +* Special blocks in LaTeX export:: Attributes specific to special blocks. +* Horizontal rules in LaTeX export:: Attributes specific to horizontal rules. +* Verse blocks in LaTeX export:: Attributes specific to special blocks. +* Quote blocks in LaTeX export:: Attributes specific to quote blocks. + +OpenDocument Text Export + +* Pre-requisites for ODT export:: Required packages. +* ODT export commands:: Invoking export. +* ODT specific export settings:: Configuration options. +* Extending ODT export:: Producing DOC, PDF files. +* Applying custom styles:: Styling the output. +* Links in ODT export:: Handling and formatting links. +* Tables in ODT export:: Org tables conversions. +* Images in ODT export:: Inserting images. +* Math formatting in ODT export:: Formatting LaTeX fragments. +* Labels and captions in ODT export:: Rendering objects. +* Literal examples in ODT export:: For source code and example blocks. +* Advanced topics in ODT export:: For power users. + +Math formatting in ODT export + +* LaTeX math snippets:: Embedding in LaTeX format. +* MathML and OpenDocument formula files:: Embedding in native format. + +Texinfo Export + +* Texinfo export commands:: Invoking commands. +* Texinfo specific export settings:: Setting the environment. +* Texinfo file header:: Generating the header. +* Texinfo title and copyright page:: Creating preamble pages. +* Info directory file:: Installing a manual in Info file hierarchy. +* Headings and sectioning structure:: Building document structure. +* Indices:: Creating indices. +* Quoting Texinfo code:: Incorporating literal Texinfo code. +* Plain lists in Texinfo export:: List attributes. +* Tables in Texinfo export:: Table attributes. +* Images in Texinfo export:: Image attributes. +* Quotations in Texinfo export:: Quote block attributes. +* Special blocks in Texinfo export:: Special block attributes. +* A Texinfo example:: Processing Org to Texinfo. + +Export in Foreign Buffers + +* Bare HTML:: Exporting HTML without CSS, Javascript, etc. + +Publishing + +* Configuration:: Defining projects. +* Uploading Files:: How to get files up on the server. +* Sample Configuration:: Example projects. +* Triggering Publication:: Publication commands. + +Configuration + +* Project alist:: The central configuration variable. +* Sources and destinations:: From here to there. +* Selecting files:: What files are part of the project? +* Publishing action:: Setting the function doing the publishing. +* Publishing options:: Tweaking HTML/LaTeX export. +* Publishing links:: Which links keep working after publishing? +* Site map:: Generating a list of all pages. +* Generating an index:: An index that reaches across pages. + +Sample Configuration + +* Simple example:: One-component publishing. +* Complex example:: A multi-component publishing example. + +Citation handling + +* Citations:: +* Citation export processors:: + +Working with Source Code + +* Features Overview:: Enjoy the versatility of source blocks. +* Structure of Code Blocks:: Code block syntax described. +* Using Header Arguments:: Different ways to set header arguments. +* Environment of a Code Block:: Arguments, sessions, working directory... +* Evaluating Code Blocks:: Place results of evaluation in the Org buffer. +* Results of Evaluation:: Choosing a results type, post-processing... +* Exporting Code Blocks:: Export contents and/or results. +* Extracting Source Code:: Create pure source code files. +* Languages:: List of supported code block languages. +* Editing Source Code:: Language major-mode editing. +* Noweb Reference Syntax:: Literate programming in Org mode. +* Library of Babel:: Use and contribute to a library of useful code blocks. +* Key bindings and Useful Functions:: Work quickly with code blocks. +* Batch Execution:: Call functions from the command line. + +Miscellaneous + +* Completion:: ‘M-<TAB>’ guesses completions. +* Structure Templates:: Quick insertion of structural elements. +* Speed Keys:: Electric commands at the beginning of a headline. +* Clean View:: Getting rid of leading stars in the outline. +* Execute commands in the active region:: Execute commands on multiple items in Org or agenda view. +* Dynamic Headline Numbering:: Display and update outline numbering. +* The Very Busy C-c C-c Key:: When in doubt, press ‘C-c C-c’. +* In-buffer Settings:: Overview of keywords. +* Regular Expressions:: Elisp regular expressions. +* Org Syntax:: Formal description of Org’s syntax. +* Documentation Access:: Read documentation about current syntax. +* Escape Character:: Prevent Org from interpreting your writing. +* Code Evaluation Security:: Org files evaluate in-line code. +* Interaction:: With other Emacs packages. +* TTY Keys:: Using Org on a tty. +* Protocols:: External access to Emacs and Org. +* Org Crypt:: Encrypting Org files. +* Org Mobile:: Viewing and capture on a mobile device. + +Clean View + +* Org Indent Mode:: +* Hard indentation:: + +Interaction + +* Cooperation:: Packages Org cooperates with. +* Conflicts:: Packages that lead to conflicts. + +Protocols + +* The store-link protocol:: Store a link, push URL to kill-ring. +* The capture protocol:: Fill a buffer with external information. +* The open-source protocol:: Edit published contents. + +Org Mobile + +* Setting up the staging area:: For the mobile device. +* Pushing to the mobile application:: Uploading Org files and agendas. +* Pulling from the mobile application:: Integrating captured and flagged items. + +Hacking + +* Hooks:: How to reach into Org’s internals. +* Add-on Packages:: Available extensions. +* Adding Hyperlink Types:: New custom link types. +* Adding Export Back-ends:: How to write new export back-ends. +* Tables in Arbitrary Syntax:: Orgtbl for LaTeX and other programs. +* Dynamic Blocks:: Automatically filled blocks. +* Special Agenda Views:: Customized views. +* Speeding Up Your Agendas:: Tips on how to speed up your agendas. +* Extracting Agenda Information:: Post-processing agenda information. +* Using the Property API:: Writing programs that use entry properties. +* Using the Mapping API:: Mapping over all or selected entries. + +Tables in Arbitrary Syntax + +* Radio tables:: Sending and receiving radio tables. +* A LaTeX example:: Step by step, almost a tutorial. +* Translator functions:: Copy and modify. + + + +File: org.info, Node: Introduction, Next: Document Structure, Prev: Top, Up: Top + +1 Introduction +************** + +* Menu: + +* Summary:: Brief summary of what Org does. +* Installation:: Installing Org. +* Activation:: How to activate Org for certain buffers. +* Feedback:: Bug reports, ideas, patches, etc. +* Conventions:: Typesetting conventions used in this manual. + + +File: org.info, Node: Summary, Next: Installation, Up: Introduction + +1.1 Summary +=========== + +Org is a mode for keeping notes, maintaining TODO lists, and project +planning with a fast and effective plain-text markup language. It also +is an authoring system with unique support for literate programming and +reproducible research. + + Org is implemented on top of Outline mode, which makes it possible to +keep the content of large files well structured. Visibility cycling and +structure editing help to work with the tree. Tables are easily created +with a built-in table editor. Plain text URL-like links connect to +websites, emails, Usenet messages, BBDB entries, and any files related +to the projects. + + Org develops organizational tasks around notes files that contain +lists or information about projects as plain text. Project planning and +task management make use of metadata which is part of an outline node. +Based on this data, specific entries can be extracted in queries and +create dynamic _agenda views_ that also integrate the Emacs calendar and +diary. Org can be used to implement many different project planning +schemes, such as David Allen’s GTD system. + + Org files can serve as a single source authoring system with export +to many different formats such as HTML, LaTeX, Open Document, and +Markdown. New export backends can be derived from existing ones, or +defined from scratch. + + Org files can include source code blocks, which makes Org uniquely +suited for authoring technical documents with code examples. Org source +code blocks are fully functional; they can be evaluated in place and +their results can be captured in the file. This makes it possible to +create a single file reproducible research compendium. + + Org keeps simple things simple. When first fired up, it should feel +like a straightforward, easy to use outliner. Complexity is not +imposed, but a large amount of functionality is available when needed. +Org is a toolbox. Many users actually run only a—very personal—fraction +of Org’s capabilities, and know that there is more whenever they need +it. + + All of this is achieved with strictly plain text files, the most +portable and future-proof file format. Org runs in Emacs. Emacs is one +of the most widely ported programs, so that Org mode is available on +every major platform. + + There is a website for Org which provides links to the newest version +of Org, as well as additional information, frequently asked questions +(FAQ), links to tutorials, etc. This page is located at +<https://orgmode.org>. + + An earlier version (7.3) of this manual is available as a paperback +book from Network Theory Ltd. +(http://www.network-theory.co.uk/org/manual/). + + +File: org.info, Node: Installation, Next: Activation, Prev: Summary, Up: Introduction + +1.2 Installation +================ + +Org is included in all recent distributions of GNU Emacs, so you +probably do not need to install it. Most users will simply activate Org +and begin exploring its many features. + + If, for one reason or another, you want to install Org on top of this +pre-packaged version, you can use the Emacs package system or clone +Org’s git repository. + + We *strongly recommend* sticking to a single installation method. + +Using Emacs packaging system +---------------------------- + +Recent Emacs distributions include a packaging system which lets you +install Elisp libraries. You can install Org from the “package menu”, +with ‘M-x list-packages’. See *note Package Menu: (emacs)Package Menu. + + Important: You need to do this in a session where no ‘.org’ file + has been visited, i.e., where no Org built-in function have been + loaded. Otherwise autoload Org functions will mess up the + installation. + +Using Org’s git repository +-------------------------- + +You can clone Org’s repository and install Org like this: + + $ cd ~/src/ + $ git clone https://git.savannah.gnu.org/git/emacs/org-mode.git + $ cd org-mode/ + $ make autoloads + + Note that in this case, ‘make autoloads’ is mandatory: it defines +Org’s version in ‘org-version.el’ and Org’s autoloads in +‘org-loaddefs.el’. + + Remember to add the correct load path as described in the method +above. + + You can also compile with ‘make’, generate the documentation with +‘make doc’, create a local configuration with ‘make config’ and install +Org with ‘make install’. Please run ‘make help’ to get the list of +compilation/installation options. + + For more detailed explanations on Org’s build system, please check +the Org Build System page on Worg +(https://orgmode.org/worg/dev/org-build-system.html). + +Installing Org’s contributed packages +------------------------------------- + +Org’s repository used to contain ‘contrib/’ directory for add-ons +contributed by others. As of Org 9.5, the directory has bee moved to +this new dedicated org-contrib (https://git.sr.ht/~bzg/org-contrib) +repository, which you can install separately. + + +File: org.info, Node: Activation, Next: Feedback, Prev: Installation, Up: Introduction + +1.3 Activation +============== + +Org mode buffers need Font Lock to be turned on: this is the default in +Emacs(1). + + There are compatibility issues between Org mode and some other Elisp +packages (see *note Conflicts::). Please take the time to check the +list. + + For a better experience, the three Org commands ‘org-store-link’, +‘org-capture’ and ‘org-agenda’ ought to be accessible anywhere in Emacs, +not just in Org buffers. To that effect, you need to bind them to +globally available keys, like the ones reserved for users (see *note +(elisp)Key Binding Conventions::). Here are suggested bindings, please +modify the keys to your own liking. + + (global-set-key (kbd "C-c l") #'org-store-link) + (global-set-key (kbd "C-c a") #'org-agenda) + (global-set-key (kbd "C-c c") #'org-capture) + + Files with the ‘.org’ extension use Org mode by default. To turn on +Org mode in a file that does not have the extension ‘.org’, make the +first line of a file look like this: + + MY PROJECTS -*- mode: org; -*- + +which selects Org mode for this buffer no matter what the file’s name +is. See also the variable ‘org-insert-mode-line-in-empty-file’. + + Many commands in Org work on the region if the region is _active_. +To make use of this, you need to have Transient Mark mode turned on, +which is the default. If you do not like it, you can create an active +region by using the mouse to select a region, or pressing ‘C-<SPC>’ +twice before moving point. + + ---------- Footnotes ---------- + + (1) If you do not use Font Lock globally turn it on in Org buffer +with ‘(add-hook 'org-mode-hook #'turn-on-font-lock)’. + + +File: org.info, Node: Feedback, Next: Conventions, Prev: Activation, Up: Introduction + +1.4 Feedback +============ + +If you find problems with Org, or if you have questions, remarks, or +ideas about it, please send an email to the Org mailing list +<emacs-orgmode@gnu.org>. You can subscribe to the list from this web +page (https://lists.gnu.org/mailman/listinfo/emacs-orgmode). If you are +not a member of the mailing list, your mail will be passed to the list +after a moderator has approved it(1). We ask you to read and respect +the GNU Kind Communications Guidelines +(https://www.gnu.org/philosophy/kind-communication.html) when sending +messages on this mailing list. + + For bug reports, please first try to reproduce the bug with the +latest version of Org available—if you are running an outdated version, +it is quite possible that the bug has been fixed already. If the bug +persists, prepare a report and provide as much information as possible, +including the version information of Emacs (‘M-x emacs-version’) and Org +(‘M-x org-version’), as well as the Org related setup in the Emacs init +file. The easiest way to do this is to use the command + + M-x org-submit-bug-report <RET> + +which puts all this information into an Emacs mail buffer so that you +only need to add your description. If you are not sending the Email +from within Emacs, please copy and paste the content into your Email +program. + + Sometimes you might face a problem due to an error in your Emacs or +Org mode setup. Before reporting a bug, it is very helpful to start +Emacs with minimal customizations and reproduce the problem. Doing so +often helps you determine if the problem is with your customization or +with Org mode itself. You can start a typical minimal session with a +command like the example below. + + $ emacs -Q -l /path/to/minimal-org.el + + However if you are using Org mode as distributed with Emacs, a +minimal setup is not necessary. In that case it is sufficient to start +Emacs as ‘emacs -Q’. The ‘minimal-org.el’ setup file can have contents +as shown below. + + ;;; Minimal setup to load latest `org-mode'. + + ;; Activate debugging. + (setq debug-on-error t + debug-on-signal nil + debug-on-quit nil) + + ;; Add latest Org mode to load path. + (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp")) + + If an error occurs, a “backtrace” can be very useful—see below on how +to create one. Often a small example file helps, along with clear +information about: + + 1. What exactly did you do? + 2. What did you expect to happen? + 3. What happened instead? + + Thank you for helping to improve this program. + +How to create a useful backtrace +-------------------------------- + +If working with Org produces an error with a message you do not +understand, you may have hit a bug. The best way to report this is by +providing, in addition to what was mentioned above, a backtrace. This +is information from the built-in debugger about where and how the error +occurred. Here is how to produce a useful backtrace: + + 1. Reload uncompiled versions of all Org mode Lisp files. The + backtrace contains much more information if it is produced with + uncompiled code. To do this, use + + C-u M-x org-reload <RET> + + or, from the menu: Org → Refresh/Reload → Reload Org uncompiled. + + 2. Then, activate the debugger: + + M-x toggle-debug-on-error <RET> + + or, from the menu: Options → Enter Debugger on Error. + + 3. Do whatever you have to do to hit the error. Do not forget to + document the steps you take. + + 4. When you hit the error, a ‘*Backtrace*’ buffer appears on the + screen. Save this buffer to a file—for example using ‘C-x C-w’—and + attach it to your bug report. + + ---------- Footnotes ---------- + + (1) Please consider subscribing to the mailing list in order to +minimize the work the mailing list moderators have to do. + + +File: org.info, Node: Conventions, Prev: Feedback, Up: Introduction + +1.5 Typesetting Conventions Used in this Manual +=============================================== + +TODO keywords, tags, properties, etc. +------------------------------------- + +Org uses various syntactical elements: TODO keywords, tags, property +names, keywords, blocks, etc. In this manual we use the following +conventions: + +‘TODO’ +‘WAITING’ + TODO keywords are written with all capitals, even if they are + user-defined. + +‘boss’ +‘ARCHIVE’ + Tags are case-sensitive. User-defined tags are usually written in + lowercase; built-in tags with special meaning are written as they + should appear in the document, usually with all capitals. + +‘Release’ +‘PRIORITY’ + User-defined properties are capitalized; built-in properties with + special meaning are written with all capitals. + +‘TITLE’ +‘BEGIN’ ... ‘END’ + Keywords and blocks are written in uppercase to enhance their + readability, but you can use lowercase in your Org files. + +Key bindings and commands +------------------------- + +The manual lists both the keys and the corresponding commands for +accessing a functionality. Org mode often uses the same key for +different functions, depending on context. The command that is bound to +such keys has a generic name, like ‘org-metaright’. In the manual we +will, wherever possible, give the function that is internally called by +the generic command. For example, in the chapter on document structure, +‘M-<RIGHT>’ will be listed to call ‘org-do-demote’, while in the chapter +on tables, it will be listed to call ‘org-table-move-column-right’. + + +File: org.info, Node: Document Structure, Next: Tables, Prev: Introduction, Up: Top + +2 Document Structure +******************** + +Org is an outliner. Outlines allow a document to be organized in a +hierarchical structure, which, least for me, is the best representation +of notes and thoughts. An overview of this structure is achieved by +folding, i.e., hiding large parts of the document to show only the +general document structure and the parts currently being worked on. Org +greatly simplifies the use of outlines by compressing the entire show +and hide functionalities into a single command, ‘org-cycle’, which is +bound to the ‘<TAB>’ key. + +* Menu: + +* Headlines:: How to typeset Org tree headlines. +* Visibility Cycling:: Show and hide, much simplified. +* Motion:: Jumping to other headlines. +* Structure Editing:: Changing sequence and level of headlines. +* Sparse Trees:: Matches embedded in context. +* Plain Lists:: Additional structure within an entry. +* Drawers:: Tucking stuff away. +* Blocks:: Folding blocks. + + +File: org.info, Node: Headlines, Next: Visibility Cycling, Up: Document Structure + +2.1 Headlines +============= + +Headlines define the structure of an outline tree. Org headlines start +on the left margin(1) with one or more stars followed by a space. For +example: + + * Top level headline + ** Second level + *** Third level + some text + *** Third level + more text + * Another top level headline + + The name defined in ‘org-footnote-section’ is reserved. Do not use +it as a title for your own headings. + + Some people find the many stars too noisy and would prefer an outline +that has whitespace followed by a single star as headline starters. +This can be achieved using a Org Indent minor mode. See *note Clean +View:: for more information. + + Headlines are not numbered. However, you may want to dynamically +number some, or all, of them. See *note Dynamic Headline Numbering::. + + An empty line after the end of a subtree is considered part of it and +is hidden when the subtree is folded. However, if you leave at least +two empty lines, one empty line remains visible after folding the +subtree, in order to structure the collapsed view. See the variable +‘org-cycle-separator-lines’ to modify this behavior. + + ---------- Footnotes ---------- + + (1) See the variables ‘org-special-ctrl-a/e’, ‘org-special-ctrl-k’, +and ‘org-ctrl-k-protect-subtree’ to configure special behavior of ‘C-a’, +‘C-e’, and ‘C-k’ in headlines. Note also that clocking only works with +headings indented less than 30 stars. + + +File: org.info, Node: Visibility Cycling, Next: Motion, Prev: Headlines, Up: Document Structure + +2.2 Visibility Cycling +====================== + +* Menu: + +* Global and local cycling:: Cycling through various visibility states. +* Initial visibility:: Setting the initial visibility state. +* Catching invisible edits:: Preventing mistakes when editing invisible parts. + + +File: org.info, Node: Global and local cycling, Next: Initial visibility, Up: Visibility Cycling + +2.2.1 Global and local cycling +------------------------------ + +Outlines make it possible to hide parts of the text in the buffer. Org +uses just two commands, bound to ‘<TAB>’ and ‘S-<TAB>’ to change the +visibility in the buffer. + +‘<TAB>’ (‘org-cycle’) + _Subtree cycling_: Rotate current subtree among the states + + ,-> FOLDED -> CHILDREN -> SUBTREE --. + '-----------------------------------' + + Point must be on a headline for this to work(1). + +‘S-<TAB>’ (‘org-global-cycle’) +‘C-u <TAB>’ + _Global cycling_: Rotate the entire buffer among the states + + ,-> OVERVIEW -> CONTENTS -> SHOW ALL --. + '--------------------------------------' + + When ‘S-<TAB>’ is called with a numeric prefix argument N, view + contents only up to headlines of level N. + + Note that inside tables (see *note Tables::), ‘S-<TAB>’ jumps to + the previous field instead. + + You can run global cycling using ‘<TAB>’ only if point is at the + very beginning of the buffer, but not on a headline, and + ‘org-cycle-global-at-bob’ is set to a non-‘nil’ value. + +‘C-u C-u <TAB>’ (‘org-set-startup-visibility’) + Switch back to the startup visibility of the buffer (see *note + Initial visibility::). + +‘C-u C-u C-u <TAB>’ (‘outline-show-all’) + Show all, including drawers. + +‘C-c C-r’ (‘org-reveal’) + Reveal context around point, showing the current entry, the + following heading and the hierarchy above. It is useful for + working near a location that has been exposed by a sparse tree + command (see *note Sparse Trees::) or an agenda command (see *note + Agenda Commands::). With a prefix argument, show, on each level, + all sibling headings. With a double prefix argument, also show the + entire subtree of the parent. + +‘C-c C-k’ (‘outline-show-branches’) + Expose all the headings of the subtree, but not their bodies. + +‘C-c <TAB>’ (‘outline-show-children’) + Expose all direct children of the subtree. With a numeric prefix + argument N, expose all children down to level N. + +‘C-c C-x b’ (‘org-tree-to-indirect-buffer’) + Show the current subtree in an indirect buffer(2). With a numeric + prefix argument N, go up to level N and then take that tree. If N + is negative then go up that many levels. With a ‘C-u’ prefix, do + not remove the previously used indirect buffer. + +‘C-c C-x v’ (‘org-copy-visible’) + Copy the _visible_ text in the region into the kill ring. + + ---------- Footnotes ---------- + + (1) See, however, the option ‘org-cycle-emulate-tab’. + + (2) The indirect buffer contains the entire buffer, but is narrowed +to the current tree. Editing the indirect buffer also changes the +original buffer, but without affecting visibility in that buffer. For +more information about indirect buffers, see *note GNU Emacs Manual: +(emacs)Indirect Buffers. + + +File: org.info, Node: Initial visibility, Next: Catching invisible edits, Prev: Global and local cycling, Up: Visibility Cycling + +2.2.2 Initial visibility +------------------------ + +When Emacs first visits an Org file, the global state is set to +‘showeverything’, i.e., all file content is visible(1). This can be +configured through the variable ‘org-startup-folded’, or on a per-file +basis by adding one of the following lines anywhere in the buffer: + + #+STARTUP: overview + #+STARTUP: content + #+STARTUP: showall + #+STARTUP: show2levels + #+STARTUP: show3levels + #+STARTUP: show4levels + #+STARTUP: show5levels + #+STARTUP: showeverything + + Furthermore, any entries with a ‘VISIBILITY’ property (see *note +Properties and Columns::) get their visibility adapted accordingly. +Allowed values for this property are ‘folded’, ‘children’, ‘content’, +and ‘all’. + +‘C-u C-u <TAB>’ (‘org-set-startup-visibility’) + Switch back to the startup visibility of the buffer, i.e., whatever + is requested by startup options and ‘VISIBILITY’ properties in + individual entries. + + ---------- Footnotes ---------- + + (1) When ‘org-agenda-inhibit-startup’ is non-‘nil’, Org does not +honor the default visibility state when first opening a file for the +agenda (see *note Speeding Up Your Agendas::). + + +File: org.info, Node: Catching invisible edits, Prev: Initial visibility, Up: Visibility Cycling + +2.2.3 Catching invisible edits +------------------------------ + +Sometimes you may inadvertently edit an invisible part of the buffer and +be confused on what has been edited and how to undo the mistake. +Setting ‘org-catch-invisible-edits’ to non-‘nil’ helps preventing this. +See the docstring of this option on how Org should catch invisible edits +and process them. + + +File: org.info, Node: Motion, Next: Structure Editing, Prev: Visibility Cycling, Up: Document Structure + +2.3 Motion +========== + +The following commands jump to other headlines in the buffer. + +‘C-c C-n’ (‘org-next-visible-heading’) + Next heading. + +‘C-c C-p’ (‘org-previous-visible-heading’) + Previous heading. + +‘C-c C-f’ (‘org-forward-heading-same-level’) + Next heading same level. + +‘C-c C-b’ (‘org-backward-heading-same-level’) + Previous heading same level. + +‘C-c C-u’ (‘outline-up-heading’) + Backward to higher level heading. + +‘C-c C-j’ (‘org-goto’) + Jump to a different place without changing the current outline + visibility. Shows the document structure in a temporary buffer, + where you can use the following keys to find your destination: + + ‘<TAB>’ Cycle visibility. + ‘<DOWN>’ / ‘<UP>’ Next/previous visible headline. + ‘<RET>’ Select this location. + ‘/’ Do a Sparse-tree search + + The following keys work if you turn off ‘org-goto-auto-isearch’ + + ‘n’ / ‘p’ Next/previous visible headline. + ‘f’ / ‘b’ Next/previous headline same level. + ‘u’ One level up. + ‘0’ ... ‘9’ Digit argument. + ‘q’ Quit. + + See also the variable ‘org-goto-interface’. + + +File: org.info, Node: Structure Editing, Next: Sparse Trees, Prev: Motion, Up: Document Structure + +2.4 Structure Editing +===================== + +‘M-<RET>’ (‘org-meta-return’) + Insert a new heading, item or row. + + If the command is used at the _beginning_ of a line, and if there + is a heading or a plain list item (see *note Plain Lists::) at + point, the new heading/item is created _before_ the current line. + When used at the beginning of a regular line of text, turn that + line into a heading. + + When this command is used in the middle of a line, the line is + split and the rest of the line becomes the new item or headline. + If you do not want the line to be split, customize + ‘org-M-RET-may-split-line’. + + Calling the command with a ‘C-u’ prefix unconditionally inserts a + new heading at the end of the current subtree, thus preserving its + contents. With a double ‘C-u C-u’ prefix, the new heading is + created at the end of the parent subtree instead. + +‘C-<RET>’ (‘org-insert-heading-respect-content’) + Insert a new heading at the end of the current subtree. + +‘M-S-<RET>’ (‘org-insert-todo-heading’) + Insert new TODO entry with same level as current heading. See also + the variable ‘org-treat-insert-todo-heading-as-state-change’. + +‘C-S-<RET>’ (‘org-insert-todo-heading-respect-content’) + Insert new TODO entry with same level as current heading. Like + ‘C-<RET>’, the new headline is inserted after the current subtree. + +‘<TAB>’ (‘org-cycle’) + In a new entry with no text yet, the first ‘<TAB>’ demotes the + entry to become a child of the previous one. The next ‘<TAB>’ + makes it a parent, and so on, all the way to top level. Yet + another ‘<TAB>’, and you are back to the initial level. + +‘M-<LEFT>’ (‘org-do-promote’) +‘M-<RIGHT>’ (‘org-do-demote’) + Promote or demote current heading by one level. + + When there is an active region—i.e., when Transient Mark mode is + active—promotion and demotion work on all headlines in the region. + To select a region of headlines, it is best to place both point and + mark at the beginning of a line, mark at the beginning of the first + headline, and point at the line just after the last headline to + change. + +‘M-S-<LEFT>’ (‘org-promote-subtree’) + Promote the current subtree by one level. + +‘M-S-<RIGHT>’ (‘org-demote-subtree’) + Demote the current subtree by one level. + +‘M-<UP>’ (‘org-move-subtree-up’) + Move subtree up, i.e., swap with previous subtree of same level. + +‘M-<DOWN>’ (‘org-move-subtree-down’) + Move subtree down, i.e., swap with next subtree of same level. + +‘C-c @’ (‘org-mark-subtree’) + Mark the subtree at point. Hitting repeatedly marks subsequent + subtrees of the same level as the marked subtree. + +‘C-c C-x C-w’ (‘org-cut-subtree’) + Kill subtree, i.e., remove it from buffer but save in kill ring. + With a numeric prefix argument N, kill N sequential subtrees. + +‘C-c C-x M-w’ (‘org-copy-subtree’) + Copy subtree to kill ring. With a numeric prefix argument N, copy + the N sequential subtrees. + +‘C-c C-x C-y’ (‘org-paste-subtree’) + 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 ‘****’. + +‘C-y’ (‘org-yank’) + Depending on the variables ‘org-yank-adjusted-subtrees’ and + ‘org-yank-folded-subtrees’, Org’s internal ‘yank’ command pastes + subtrees folded and in a clever way, using the same command as ‘C-c + C-x C-y’. With the default settings, no level adjustment takes + place, but the yanked tree is folded unless doing so would swallow + text previously visible. Any prefix argument to this command + forces a normal ‘yank’ to be executed, with the prefix passed + along. A good way to force a normal yank is ‘C-u C-y’. If you use + ‘yank-pop’ after a yank, it yanks previous kill items plainly, + without adjustment and folding. + +‘C-c C-x c’ (‘org-clone-subtree-with-time-shift’) + Clone a subtree by making a number of sibling copies of it. You + are prompted for the number of copies to make, and you can also + specify if any timestamps in the entry should be shifted. This can + be useful, for example, to create a number of tasks related to a + series of lectures to prepare. For more details, see the docstring + of the command ‘org-clone-subtree-with-time-shift’. + +‘C-c C-w’ (‘org-refile’) + Refile entry or region to a different location. See *note Refile + and Copy::. + +‘C-c ^’ (‘org-sort’) + Sort same-level entries. When there is an active region, all + entries in the region are sorted. Otherwise the children of the + current headline are sorted. The command prompts for the sorting + method, which can be alphabetically, numerically, by time—first + timestamp with active preferred, creation time, scheduled time, + deadline time—by priority, by TODO keyword—in the sequence the + keywords have been defined in the setup—or by the value of a + property. Reverse sorting is possible as well. You can also + supply your own function to extract the sorting key. With a ‘C-u’ + prefix, sorting is case-sensitive. + +‘C-x n s’ (‘org-narrow-to-subtree’) + Narrow buffer to current subtree. + +‘C-x n b’ (‘org-narrow-to-block’) + Narrow buffer to current block. + +‘C-x n w’ (‘widen’) + Widen buffer to remove narrowing. + +‘C-c *’ (‘org-toggle-heading’) + Turn a normal line or plain list item into a headline—so that it + becomes a subheading at its location. Also turn a headline into a + normal line by removing the stars. If there is an active region, + turn all lines in the region into headlines. If the first line in + the region was an item, turn only the item lines into headlines. + Finally, if the first line is a headline, remove the stars from all + headlines in the region. + + Note that when point is inside a table (see *note Tables::), the +Meta-Cursor keys have different functionality. + + +File: org.info, Node: Sparse Trees, Next: Plain Lists, Prev: Structure Editing, Up: Document Structure + +2.5 Sparse Trees +================ + +An important feature of Org mode is the ability to construct _sparse +trees_ for selected information in an outline tree, so that the entire +document is folded as much as possible, but the selected information is +made visible along with the headline structure above it(1). Just try it +out and you will see immediately how it works. + + Org mode contains several commands creating such trees, all these +commands can be accessed through a dispatcher: + +‘C-c /’ (‘org-sparse-tree’) + This prompts for an extra key to select a sparse-tree creating + command. + +‘C-c / r’ or ‘C-c / /’ (‘org-occur’) + Prompts for a regexp (see *note Regular Expressions::) and shows a + sparse tree with all matches. If the match is in a headline, the + headline is made visible. If the match is in the body of an entry, + headline and body are made visible. In order to provide minimal + context, also the full hierarchy of headlines above the match is + shown, as well as the headline following the match. Each match is + also highlighted; the highlights disappear when the buffer is + changed by an editing command, or by pressing ‘C-c C-c’(2). When + called with a ‘C-u’ prefix argument, previous highlights are kept, + so several calls to this command can be stacked. + +‘M-g n’ or ‘M-g M-n’ (‘next-error’) + Jump to the next sparse tree match in this buffer. + +‘M-g p’ or ‘M-g M-p’ (‘previous-error’) + Jump to the previous sparse tree match in this buffer. + + For frequently used sparse trees of specific search strings, you can +use the variable ‘org-agenda-custom-commands’ to define fast keyboard +access to specific sparse trees. These commands will then be accessible +through the agenda dispatcher (see *note Agenda Dispatcher::). For +example: + + (setq org-agenda-custom-commands + '(("f" occur-tree "FIXME"))) + +defines the key ‘f’ as a shortcut for creating a sparse tree matching +the string ‘FIXME’. + + The other sparse tree commands select headings based on TODO +keywords, tags, or properties and are discussed later in this manual. + + To print a sparse tree, you can use the Emacs command +‘ps-print-buffer-with-faces’ which does not print invisible parts of the +document. Or you can use the command ‘C-c C-e C-v’ to export only the +visible part of the document and print the resulting file. + + ---------- Footnotes ---------- + + (1) See also the variable ‘org-show-context-detail’ to decide how +much context is shown around each match. + + (2) This depends on the option ‘org-remove-highlights-with-change’. + + +File: org.info, Node: Plain Lists, Next: Drawers, Prev: Sparse Trees, Up: Document Structure + +2.6 Plain Lists +=============== + +Within an entry of the outline tree, hand-formatted lists can provide +additional structure. They also provide a way to create lists of +checkboxes (see *note Checkboxes::). Org supports editing such lists, +and every exporter (see *note Exporting::) can parse and format them. + + Org knows ordered lists, unordered lists, and description lists. + + • _Unordered_ list items start with ‘-’, ‘+’, or ‘*’(1) as bullets. + + • _Ordered_ list items start with a numeral followed by either a + period or a right parenthesis(2), such as ‘1.’ or ‘1)’(3) If you + want a list to start with a different value—e.g., 20—start the text + of the item with ‘[@20]’(4). Those constructs can be used in any + item of the list in order to enforce a particular numbering. + + • _Description_ list items are unordered list items, and contain the + separator ‘::’ to distinguish the description _term_ from the + description. + + Items belonging to the same list must have the same indentation on +the first line. In particular, if an ordered list reaches number ‘10.’, +then the 2-digit numbers must be written left-aligned with the other +numbers in the list. An item ends before the next line that is less or +equally indented than its bullet/number. + + A list ends whenever every item has ended, which means before any +line less or equally indented than items at top level. It also ends +before two blank lines. In that case, all items are closed. Here is an +example: + + * Lord of the Rings + My favorite scenes are (in this order) + 1. The attack of the Rohirrim + 2. Eowyn's fight with the witch king + + this was already my favorite scene in the book + + I really like Miranda Otto. + 3. Peter Jackson being shot by Legolas + - on DVD only + He makes a really funny face when it happens. + But in the end, no individual scenes matter but the film as a whole. + Important actors in this film are: + - Elijah Wood :: He plays Frodo + - Sean Astin :: He plays Sam, Frodo's friend. I still remember him + very well from his role as Mikey Walsh in /The Goonies/. + + Org supports these lists by tuning filling and wrapping commands to +deal with them correctly, and by exporting them properly (see *note +Exporting::). Since indentation is what governs the structure of these +lists, many structural constructs like ‘#+BEGIN_’ blocks can be indented +to signal that they belong to a particular item. + + If you find that using a different bullet for a sub-list—than that +used for the current list-level—improves readability, customize the +variable ‘org-list-demote-modify-bullet’. To get a greater difference +of indentation between items and theirs sub-items, customize +‘org-list-indent-offset’. + + The following commands act on items when point is in the first line +of an item—the line with the bullet or number. Some of them imply the +application of automatic rules to keep list structure intact. If some +of these actions get in your way, configure ‘org-list-automatic-rules’ +to disable them individually. + +‘<TAB>’ (‘org-cycle’) + Items can be folded just like headline levels. Normally this works + only if point is on a plain list item. For more details, see the + variable ‘org-cycle-include-plain-lists’. If this variable is set + to ‘integrate’, plain list items are treated like low-level + headlines. The level of an item is then given by the indentation + of the bullet/number. Items are always subordinate to real + headlines, however; the hierarchies remain completely separated. + In a new item with no text yet, the first ‘<TAB>’ demotes the item + to become a child of the previous one. Subsequent ‘<TAB>’s move + the item to meaningful levels in the list and eventually get it + back to its initial position. + +‘M-<RET>’ (‘org-insert-heading’) + Insert new item at current level. With a prefix argument, force a + new heading (see *note Structure Editing::). If this command is + used in the middle of an item, that item is _split_ in two, and the + second part becomes the new item(5). If this command is executed + _before item’s body_, the new item is created _before_ the current + one. + +‘M-S-<RET>’ + Insert a new item with a checkbox (see *note Checkboxes::). + +‘S-<UP>’ +‘S-<DOWN>’ + Jump to the previous/next item in the current list, but only if + ‘org-support-shift-select’ is off(6). If not, you can still use + paragraph jumping commands like ‘C-<UP>’ and ‘C-<DOWN>’ to quite + similar effect. + +‘M-<UP>’ +‘M-<DOWN>’ + Move the item including subitems up/down(7), i.e., swap with + previous/next item of same indentation. If the list is ordered, + renumbering is automatic. + +‘M-<LEFT>’ +‘M-<RIGHT>’ + Decrease/increase the indentation of an item, leaving children + alone. + +‘M-S-<LEFT>’ +‘M-S-<RIGHT>’ + Decrease/increase the indentation of the item, including subitems. + Initially, the item tree is selected based on current indentation. + When these commands are executed several times in direct + succession, the initially selected region is used, even if the new + indentation would imply a different hierarchy. To use the new + hierarchy, break the command chain by moving point. + + As a special case, using this command on the very first item of a + list moves the whole list. This behavior can be disabled by + configuring ‘org-list-automatic-rules’. The global indentation of + a list has no influence on the text _after_ the list. + +‘C-c C-c’ + If there is a checkbox (see *note Checkboxes::) in the item line, + toggle the state of the checkbox. In any case, verify bullets and + indentation consistency in the whole list. + +‘C-c -’ + Cycle the entire list level through the different itemize/enumerate + bullets (‘-’, ‘+’, ‘*’, ‘1.’, ‘1)’) or a subset of them, depending + on ‘org-plain-list-ordered-item-terminator’, the type of list, and + its indentation. With a numeric prefix argument N, select the Nth + bullet from this list. If there is an active region when calling + this, all lines are converted to list items. With a prefix + argument, the selected text is changed into a single item. If the + first line already was a list item, any item marker is removed from + the list. Finally, even without an active region, a normal line is + converted into a list item. + +‘C-c *’ + Turn a plain list item into a headline—so that it becomes a + subheading at its location. See *note Structure Editing::, for a + detailed explanation. + +‘C-c C-*’ + Turn the whole plain list into a subtree of the current heading. + Checkboxes (see *note Checkboxes::) become ‘TODO’, respectively + ‘DONE’, keywords when unchecked, respectively checked. + +‘S-<LEFT>’ +‘S-<RIGHT>’ + This command also cycles bullet styles when point is in on the + bullet or anywhere in an item line, details depending on + ‘org-support-shift-select’. + +‘C-c ^’ + Sort the plain list. Prompt for the sorting method: numerically, + alphabetically, by time, or by custom function. + + ---------- Footnotes ---------- + + (1) When using ‘*’ as a bullet, lines must be indented so that they +are not interpreted as headlines. Also, when you are hiding leading +stars to get a clean outline view, plain list items starting with a star +may be hard to distinguish from true headlines. In short: even though +‘*’ is supported, it may be better to not use it for plain list items. + + (2) You can filter out any of them by configuring +‘org-plain-list-ordered-item-terminator’. + + (3) You can also get ‘a.’, ‘A.’, ‘a)’ and ‘A)’ by configuring +‘org-list-allow-alphabetical’. To minimize confusion with normal text, +those are limited to one character only. Beyond that limit, bullets +automatically become numbers. + + (4) If there’s a checkbox in the item, the cookie must be put +_before_ the checkbox. If you have activated alphabetical lists, you +can also use counters like ‘[@b]’. + + (5) If you do not want the item to be split, customize the variable +‘org-M-RET-may-split-line’. + + (6) If you want to cycle around items that way, you may customize +‘org-list-use-circular-motion’. + + (7) See ‘org-list-use-circular-motion’ for a cyclic behavior. + + +File: org.info, Node: Drawers, Next: Blocks, Prev: Plain Lists, Up: Document Structure + +2.7 Drawers +=========== + +Sometimes you want to keep information associated with an entry, but you +normally do not want to see it. For this, Org mode has _drawers_. They +can contain anything but a headline and another drawer. Drawers look +like this: + + ** This is a headline + Still outside the drawer + :DRAWERNAME: + This is inside the drawer. + :END: + After the drawer. + + You can interactively insert a drawer at point by calling +‘org-insert-drawer’, which is bound to ‘C-c C-x d’. With an active +region, this command puts the region inside the drawer. With a prefix +argument, this command calls ‘org-insert-property-drawer’, which creates +a ‘PROPERTIES’ drawer right below the current headline. Org mode uses +this special drawer for storing properties (see *note Properties and +Columns::). You cannot use it for anything else. + + Completion over drawer keywords is also possible using ‘M-<TAB>’(1). + + Visibility cycling (see *note Visibility Cycling::) on the headline +hides and shows the entry, but keep the drawer collapsed to a single +line. In order to look inside the drawer, you need to move point to the +drawer line and press ‘<TAB>’ there. + + You can also arrange for state change notes (see *note Tracking TODO +state changes::) and clock times (see *note Clocking Work Time::) to be +stored in a ‘LOGBOOK’ drawer. If you want to store a quick note there, +in a similar way to state changes, use + +‘C-c C-z’ + Add a time-stamped note to the ‘LOGBOOK’ drawer. + + ---------- Footnotes ---------- + + (1) Many desktops intercept ‘M-<TAB>’ to switch windows. Use ‘C-M-i’ +or ‘<ESC> <TAB>’ instead. + + +File: org.info, Node: Blocks, Prev: Drawers, Up: Document Structure + +2.8 Blocks +========== + +Org mode uses ‘#+BEGIN’ ... ‘#+END’ blocks for various purposes from +including source code examples (see *note Literal Examples::) to +capturing time logging information (see *note Clocking Work Time::). +These blocks can be folded and unfolded by pressing ‘<TAB>’ in the +‘#+BEGIN’ line. You can also get all blocks folded at startup by +configuring the variable ‘org-hide-block-startup’ or on a per-file basis +by using + + #+STARTUP: hideblocks + #+STARTUP: nohideblocks + + +File: org.info, Node: Tables, Next: Hyperlinks, Prev: Document Structure, Up: Top + +3 Tables +******** + +Org comes with a fast and intuitive table editor. Spreadsheet-like +calculations are supported using the Emacs Calc package (see *note GNU +Emacs Calculator Manual: (calc)Top.). + +* Menu: + +* Built-in Table Editor:: Simple tables. +* Column Width and Alignment:: Overrule the automatic settings. +* Column Groups:: Grouping to trigger vertical lines. +* Orgtbl Mode:: The table editor as minor mode. +* The Spreadsheet:: The table editor has spreadsheet capabilities. +* Org Plot:: Plotting from Org tables. + + +File: org.info, Node: Built-in Table Editor, Next: Column Width and Alignment, Up: Tables + +3.1 Built-in Table Editor +========================= + +Org makes it easy to format tables in plain ASCII. Any line with ‘|’ as +the first non-whitespace character is considered part of a table. ‘|’ +is also the column separator(1). Moreover, a line starting with ‘|-’ is +a horizontal rule. It separates rows explicitly. Rows before the first +horizontal rule are header lines. A table might look like this: + + | Name | Phone | Age | + |-------+-------+-----| + | Peter | 1234 | 17 | + | Anna | 4321 | 25 | + + A table is re-aligned automatically each time you press ‘<TAB>’, +‘<RET>’ or ‘C-c C-c’ inside the table. ‘<TAB>’ also moves to the next +field—‘<RET>’ to the next row—and creates new table rows at the end of +the table or before horizontal lines. The indentation of the table is +set by the first line. Horizontal rules are automatically expanded on +every re-align to span the whole table width. So, to create the above +table, you would only type + + |Name|Phone|Age| + |- + +and then press ‘<TAB>’ to align the table and start filling in fields. +Even faster would be to type ‘|Name|Phone|Age’ followed by ‘C-c <RET>’. + + When typing text into a field, Org treats ‘DEL’, ‘Backspace’, and all +character keys in a special way, so that inserting and deleting avoids +shifting other fields. Also, when typing _immediately_ after point was +moved into a new field with ‘<TAB>’, ‘S-<TAB>’ or ‘<RET>’, the field is +automatically made blank. If this behavior is too unpredictable for +you, configure the option ‘org-table-auto-blank-field’. + +Creation and conversion +----------------------- + +‘C-c |’ (‘org-table-create-or-convert-from-region’) + Convert the active region to table. If every line contains at + least one ‘<TAB>’ character, the function assumes that the material + is tab separated. If every line contains a comma, comma-separated + values (CSV) are assumed. If not, lines are split at whitespace + into fields. You can use a prefix argument to force a specific + separator: ‘C-u’ forces CSV, ‘C-u C-u’ forces ‘<TAB>’, ‘C-u C-u + C-u’ prompts for a regular expression to match the separator, and a + numeric argument N indicates that at least N consecutive spaces, or + alternatively a ‘<TAB>’ will be the separator. + + If there is no active region, this command creates an empty Org + table. But it is easier just to start typing, like ‘| N a m e | P + h o n e | A g e <RET> | - <TAB>’. + +Re-aligning and field motion +---------------------------- + +‘C-c C-c’ (‘org-table-align’) + Re-align the table without moving point. + +‘<TAB>’ (‘org-table-next-field’) + Re-align the table, move to the next field. Creates a new row if + necessary. + +‘M-x org-table-blank-field’ + Blank the field at point. + +‘S-<TAB>’ (‘org-table-previous-field’) + Re-align, move to previous field. + +‘<RET>’ (‘org-table-next-row’) + Re-align the table and move down to next row. Creates a new row if + necessary. At the beginning or end of a line, ‘<RET>’ still + inserts a new line, so it can be used to split a table. + +‘M-a’ (‘org-table-beginning-of-field’) + Move to beginning of the current table field, or on to the previous + field. + +‘M-e’ (‘org-table-end-of-field’) + Move to end of the current table field, or on to the next field. + +Column and row editing +---------------------- + +‘M-<LEFT>’ (‘org-table-move-column-left’) + Move the current column left. + +‘M-<RIGHT>’ (‘org-table-move-column-right’) + Move the current column right. + +‘M-S-<LEFT>’ (‘org-table-delete-column’) + Kill the current column. + +‘M-S-<RIGHT>’ (‘org-table-insert-column’) + Insert a new column at point position. Move the recent column and + all cells to the right of this column to the right. + +‘M-<UP>’ (‘org-table-move-row-up’) + Move the current row up. + +‘M-<DOWN>’ (‘org-table-move-row-down’) + Move the current row down. + +‘M-S-<UP>’ (‘org-table-kill-row’) + Kill the current row or horizontal line. + +‘S-<UP>’ (‘org-table-move-cell-up’) + Move cell up by swapping with adjacent cell. + +‘S-<DOWN>’ (‘org-table-move-cell-down’) + Move cell down by swapping with adjacent cell. + +‘S-<LEFT>’ (‘org-table-move-cell-left’) + Move cell left by swapping with adjacent cell. + +‘S-<RIGHT>’ (‘org-table-move-cell-right’) + Move cell right by swapping with adjacent cell. + +‘M-S-<DOWN>’ (‘org-table-insert-row’) + Insert a new row above the current row. With a prefix argument, + the line is created below the current one. + +‘C-c -’ (‘org-table-insert-hline’) + Insert a horizontal line below current row. With a prefix + argument, the line is created above the current line. + +‘C-c <RET>’ (‘org-table-hline-and-move’) + Insert a horizontal line below current row, and move point into the + row below that line. + +‘C-c ^’ (‘org-table-sort-lines’) + Sort the table lines in the region. The position of point + indicates the column to be used for sorting, and the range of lines + is the range between the nearest horizontal separator lines, or the + entire table. If point is before the first column, you are + prompted for the sorting column. If there is an active region, the + mark specifies the first line and the sorting column, while point + should be in the last line to be included into the sorting. The + command prompts for the sorting type, alphabetically, numerically, + or by time. You can sort in normal or reverse order. You can also + supply your own key extraction and comparison functions. When + called with a prefix argument, alphabetic sorting is + case-sensitive. + +Regions +------- + +‘C-c C-x M-w’ (‘org-table-copy-region’) + Copy a rectangular region from a table to a special clipboard. + Point and mark determine edge fields of the rectangle. If there is + no active region, copy just the current field. The process ignores + horizontal separator lines. + +‘C-c C-x C-w’ (‘org-table-cut-region’) + Copy a rectangular region from a table to a special clipboard, and + blank all fields in the rectangle. So this is the “cut” operation. + +‘C-c C-x C-y’ (‘org-table-paste-rectangle’) + Paste a rectangular region into a table. The upper left corner + ends up in the current field. All involved fields are overwritten. + If the rectangle does not fit into the present table, the table is + enlarged as needed. The process ignores horizontal separator + lines. + +‘M-<RET>’ (‘org-table-wrap-region’) + Split the current field at point position and move the rest to the + line below. If there is an active region, and both point and mark + are in the same column, the text in the column is wrapped to + minimum width for the given number of lines. A numeric prefix + argument may be used to change the number of desired lines. If + there is no region, but you specify a prefix argument, the current + field is made blank, and the content is appended to the field + above. + +Calculations +------------ + +‘C-c +’ (‘org-table-sum’) + Sum the numbers in the current column, or in the rectangle defined + by the active region. The result is shown in the echo area and can + be inserted with ‘C-y’. + +‘S-<RET>’ (‘org-table-copy-down’) + When current field is empty, copy from first non-empty field above. + When not empty, copy current field down to next row and move point + along with it. + + Depending on the variable ‘org-table-copy-increment’, integer and + time stamp field values, and fields prefixed or suffixed with a + whole number, can be incremented during copy. Also, a ‘0’ prefix + argument temporarily disables the increment. + + This key is also used by shift-selection and related modes (see + *note Conflicts::). + +Miscellaneous +------------- + +‘C-c `’ (‘org-table-edit-field’) + Edit the current field in a separate window. This is useful for + fields that are not fully visible (see *note Column Width and + Alignment::). When called with a ‘C-u’ prefix, just make the full + field visible, so that it can be edited in place. When called with + two ‘C-u’ prefixes, make the editor window follow point through the + table and always show the current field. The follow mode exits + automatically when point leaves the table, or when you repeat this + command with ‘C-u C-u C-c `’. + +‘M-x org-table-import’ + Import a file as a table. The table should be TAB or whitespace + separated. Use, for example, to import a spreadsheet table or data + from a database, because these programs generally can write + TAB-separated text files. This command works by inserting the file + into the buffer and then converting the region to a table. Any + prefix argument is passed on to the converter, which uses it to + determine the separator. + +‘C-c |’ (‘org-table-create-or-convert-from-region’) + Tables can also be imported by pasting tabular text into the Org + buffer, selecting the pasted text with ‘C-x C-x’ and then using the + ‘C-c |’ command (see *note Creation and conversion::). + +‘M-x org-table-export’ + Export the table, by default as a TAB-separated file. Use for data + exchange with, for example, spreadsheet or database programs. The + format used to export the file can be configured in the variable + ‘org-table-export-default-format’. You may also use properties + ‘TABLE_EXPORT_FILE’ and ‘TABLE_EXPORT_FORMAT’ to specify the file + name and the format for table export in a subtree. Org supports + quite general formats for exported tables. The exporter format is + the same as the format used by Orgtbl radio tables, see *note + Translator functions::, for a detailed description. + +‘M-x org-table-header-line-mode’ + Turn on the display of the first data row of the table at point in + the window header line when this first row is not visible anymore + in the buffer. You can activate this minor mode by default by + setting the option ‘org-table-header-line-p’ to ‘t’. + +‘M-x org-table-transpose-table-at-point’ + Transpose the table at point and eliminate hlines. + + ---------- Footnotes ---------- + + (1) To insert a vertical bar into a table field, use ‘\vert’ or, +inside a word ‘abc\vert{}def’. + + +File: org.info, Node: Column Width and Alignment, Next: Column Groups, Prev: Built-in Table Editor, Up: Tables + +3.2 Column Width and Alignment +============================== + +The width of columns is automatically determined by the table editor. +The alignment of a column is determined automatically from the fraction +of number-like versus non-number fields in the column. + + Editing a field may modify alignment of the table. Moving a +contiguous row or column—i.e., using ‘<TAB>’ or ‘<RET>’—automatically +re-aligns it. If you want to disable this behavior, set +‘org-table-automatic-realign’ to ‘nil’. In any case, you can always +align manually a table: + +‘C-c C-c’ (‘org-table-align’) + Align the current table. + + Setting the option ‘org-startup-align-all-tables’ re-aligns all +tables in a file upon visiting it. You can also set this option on a +per-file basis with: + + #+STARTUP: align + #+STARTUP: noalign + + Sometimes a single field or a few fields need to carry more text, +leading to inconveniently wide columns. Maybe you want to hide away +several columns or display them with a fixed width, regardless of +content, as shown in the following example. + + |---+---------------------+--------| |---+-------…+…| + | | <6> | | | | <6> …|…| + | 1 | one | some | ----\ | 1 | one …|…| + | 2 | two | boring | ----/ | 2 | two …|…| + | 3 | This is a long text | column | | 3 | This i…|…| + |---+---------------------+--------| |---+-------…+…| + + To set the width of a column, one field anywhere in the column may +contain just the string ‘<N>’ where N specifies the width as a number of +characters. You control displayed width of columns with the following +tools: + +‘C-c <TAB>’ (‘org-table-toggle-column-width’) + Shrink or expand current column. + + If a width cookie specifies a width W for the column, shrinking it + displays the first W visible characters only. Otherwise, the + column is shrunk to a single character. + + When called before the first column or after the last one, ask for + a list of column ranges to operate on. + +‘C-u C-c <TAB>’ (‘org-table-shrink’) + Shrink all columns with a column width. Expand the others. + +‘C-u C-u C-c <TAB>’ (‘org-table-expand’) + Expand all columns. + + To see the full text of a shrunk field, hold the mouse over it: a +tool-tip window then shows the full contents of the field. +Alternatively, ‘C-h .’ (‘display-local-help’) reveals them, too. For +convenience, any change near the shrunk part of a column expands it. + + Setting the option ‘org-startup-shrink-all-tables’ shrinks all +columns containing a width cookie in a file the moment it is visited. +You can also set this option on a per-file basis with: + + #+STARTUP: shrink + + If you would like to overrule the automatic alignment of number-rich +columns to the right and of string-rich columns to the left, you can use +‘<r>’, ‘<c>’ or ‘<l>’ in a similar fashion. You may also combine +alignment and field width like this: ‘<r10>’. + + Lines which only contain these formatting cookies are removed +automatically upon exporting the document. + + +File: org.info, Node: Column Groups, Next: Orgtbl Mode, Prev: Column Width and Alignment, Up: Tables + +3.3 Column Groups +================= + +When Org exports tables, it does so by default without vertical lines +because that is visually more satisfying in general. Occasionally +however, vertical lines can be useful to structure a table into groups +of columns, much like horizontal lines can do for groups of rows. In +order to specify column groups, you can use a special row where the +first field contains only ‘/’. The further fields can either contain +‘<’ to indicate that this column should start a group, ‘>’ to indicate +the end of a column, or ‘<>’ (no space between ‘<’ and ‘>’) to make a +column a group of its own. Upon export, boundaries between column +groups are marked with vertical lines. Here is an example: + + | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | + |---+-----+-----+-----+---------+------------| + | / | < | | > | < | > | + | 1 | 1 | 1 | 1 | 1 | 1 | + | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 | + | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 | + |---+-----+-----+-----+---------+------------| + #+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1))) + + It is also sufficient to just insert the column group starters after +every vertical line you would like to have: + + | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | + |---+-----+-----+-----+---------+------------| + | / | < | | | < | | + + +File: org.info, Node: Orgtbl Mode, Next: The Spreadsheet, Prev: Column Groups, Up: Tables + +3.4 The Orgtbl Minor Mode +========================= + +If you like the intuitive way the Org table editor works, you might also +want to use it in other modes like Text mode or Mail mode. The minor +mode Orgtbl mode makes this possible. You can always toggle the mode +with ‘M-x orgtbl-mode’. To turn it on by default, for example in +Message mode, use + + (add-hook 'message-mode-hook #'turn-on-orgtbl) + + Furthermore, with some special setup, it is possible to maintain +tables in arbitrary syntax with Orgtbl mode. For example, it is +possible to construct LaTeX tables with the underlying ease and power of +Orgtbl mode, including spreadsheet capabilities. For details, see *note +Tables in Arbitrary Syntax::. + + +File: org.info, Node: The Spreadsheet, Next: Org Plot, Prev: Orgtbl Mode, Up: Tables + +3.5 The Spreadsheet +=================== + +The table editor makes use of the Emacs Calc package to implement +spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to +derive fields from other fields. While fully featured, Org’s +implementation is not identical to other spreadsheets. For example, Org +knows the concept of a _column formula_ that will be applied to all +non-header fields in a column without having to copy the formula to each +relevant field. There is also a formula debugger, and a formula editor +with features for highlighting fields in the table corresponding to the +references at point in the formula, moving these references by arrow +keys. + +* Menu: + +* References:: How to refer to another field or range. +* Formula syntax for Calc:: Using Calc to compute stuff. +* Formula syntax for Lisp:: Writing formulas in Emacs Lisp. +* Durations and time values:: How to compute durations and time values. +* Field and range formulas:: Formula for specific (ranges of) fields. +* Column formulas:: Formulas valid for an entire column. +* Lookup functions:: Lookup functions for searching tables. +* Editing and debugging formulas:: Fixing formulas. +* Updating the table:: Recomputing all dependent fields. +* Advanced features:: Field and column names, automatic recalculation... + + +File: org.info, Node: References, Next: Formula syntax for Calc, Up: The Spreadsheet + +3.5.1 References +---------------- + +To compute fields in the table from other fields, formulas must +reference other fields or ranges. In Org, fields can be referenced by +name, by absolute coordinates, and by relative coordinates. To find out +what the coordinates of a field are, press ‘C-c ?’ in that field, or +press ‘C-c }’ to toggle the display of a grid. + +Field references +................ + +Formulas can reference the value of another field in two ways. Like in +any other spreadsheet, you may reference fields with a letter/number +combination like ‘B3’, meaning the second field in the third row. +However, Org prefers to use another, more general representation that +looks like this:(1) + + @ROW$COLUMN + + Column specifications can be absolute like ‘$1’, ‘$2’, ..., ‘$N’, or +relative to the current column, i.e., the column of the field which is +being computed, like ‘$+1’ or ‘$-2’. ‘$<’ and ‘$>’ are immutable +references to the first and last column, respectively, and you can use +‘$>>>’ to indicate the third column from the right. + + The row specification only counts data lines and ignores horizontal +separator lines, or “hlines”. Like with columns, you can use absolute +row numbers ‘@1’, ‘@2’, ..., ‘@N’, and row numbers relative to the +current row like ‘@+3’ or ‘@-1’. ‘@<’ and ‘@>’ are immutable references +the first and last row in the table, respectively. You may also specify +the row relative to one of the hlines: ‘@I’ refers to the first hline, +‘@II’ to the second, etc. ‘@-I’ refers to the first such line above the +current line, ‘@+I’ to the first such line below the current line. You +can also write ‘@III+2’ which is the second data line after the third +hline in the table. + + ‘@0’ and ‘$0’ refer to the current row and column, respectively, +i.e., to the row/column for the field being computed. Also, if you omit +either the column or the row part of the reference, the current +row/column is implied. + + Org’s references with _unsigned_ numbers are fixed references in the +sense that if you use the same reference in the formula for two +different fields, the same field is referenced each time. Org’s +references with _signed_ numbers are floating references because the +same reference operator can reference different fields depending on the +field being calculated by the formula. + + Here are a few examples: + +‘@2$3’ 2nd row, 3rd column (same as ‘C2’) +‘$5’ column 5 in the current row (same as ‘E&’) +‘@2’ current column, row 2 +‘@-1$-3’ field one row up, three columns to the left +‘@-I$2’ field just under hline above current row, column 2 +‘@>$5’ field in the last row, in column 5 + +Range references +................ + +You may reference a rectangular range of fields by specifying two field +references connected by two dots ‘..’. The ends are included in the +range. If both fields are in the current row, you may simply use +‘$2..$7’, but if at least one field is in a different row, you need to +use the general ‘@ROW$COLUMN’ format at least for the first field, i.e., +the reference must start with ‘@’ in order to be interpreted correctly. +Examples: + +‘$1..$3’ first three fields in the current row +‘$P..$Q’ range, using column names (see + *note Advanced features::) +‘$<<<..$>>’ start in third column, continue to the last but one +‘@2$1..@4$3’ nine fields between these two fields (same as ‘A2..C4’) +‘@-1$-2..@-1’ 3 fields in the row above, starting from 2 columns on + the left +‘@I..II’ between first and second hline, short for ‘@I..@II’ + +Range references return a vector of values that can be fed into Calc +vector functions. Empty fields in ranges are normally suppressed, so +that the vector contains only the non-empty fields. For other options +with the mode switches ‘E’, ‘N’ and examples, see *note Formula syntax +for Calc::. + +Field coordinates in formulas +............................. + +One of the very first actions during evaluation of Calc formulas and +Lisp formulas is to substitute ‘@#’ and ‘$#’ in the formula with the row +or column number of the field where the current result will go to. The +traditional Lisp formula equivalents are ‘org-table-current-dline’ and +‘org-table-current-column’. Examples: + +‘if(@# % 2, $#, string(""))’ + Insert column number on odd rows, set field to empty on even rows. + +‘$2 = '(identity remote(FOO, @@#$1))’ + Copy text or values of each row of column 1 of the table named FOO + into column 2 of the current table. + +‘@3 = 2 * remote(FOO, @1$$#)’ + Insert the doubled value of each column of row 1 of the table named + FOO into row 3 of the current table. + +For the second and third examples, table FOO must have at least as many +rows or columns as the current table. Note that this is inefficient(2) +for large number of rows. + +Named references +................ + +‘$name’ is interpreted as the name of a column, parameter or constant. +Constants are defined globally through the variable +‘org-table-formula-constants’, and locally—for the file—through a line +like this example: + + #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6 + + Also, properties (see *note Properties and Columns::) can be used as +constants in table formulas: for a property ‘Xyz’ use the name +‘$PROP_Xyz’, and the property will be searched in the current outline +entry and in the hierarchy above it. If you have the ‘constants.el’ +package, it will also be used to resolve constants, including natural +constants like ‘$h’ for Planck’s constant, and units like ‘$km’ for +kilometers(3). Column names and parameters can be specified in special +table lines. These are described below, see *note Advanced features::. +All names must start with a letter, and further consist of letters and +numbers. + +Remote references +................. + +You may also reference constants, fields and ranges from a different +table, either in the current file or even in a different file. The +syntax is + + remote(NAME,REF) + +where NAME can be the name of a table in the current file as set by a +‘#+NAME:’ line before the table. It can also be the ID of an entry, +even in a different file, and the reference then refers to the first +table in that entry. REF is an absolute field or range reference as +described above for example ‘@3$3’ or ‘$somename’, valid in the +referenced table. + + When NAME has the format ‘@ROW$COLUMN’, it is substituted with the +name or ID found in this field of the current table. For example +‘remote($1, @@>$2)’ ⇒ ‘remote(year_2013, @@>$1)’. The format ‘B3’ is +not supported because it can not be distinguished from a plain table +name or ID. + + ---------- Footnotes ---------- + + (1) Org understands references typed by the user as ‘B4’, but it does +not use this syntax when offering a formula for editing. You can +customize this behavior using the variable +‘org-table-use-standard-references’. + + (2) The computation time scales as O(N^2) because table FOO is parsed +for each field to be copied. + + (3) The file ‘constants.el’ can supply the values of constants in two +different unit systems, ‘SI’ and ‘cgs’. Which one is used depends on +the value of the variable ‘constants-unit-system’. You can use the +‘STARTUP’ options ‘constSI’ and ‘constcgs’ to set this value for the +current buffer. + + +File: org.info, Node: Formula syntax for Calc, Next: Formula syntax for Lisp, Prev: References, Up: The Spreadsheet + +3.5.2 Formula syntax for Calc +----------------------------- + +A formula can be any algebraic expression understood by the Emacs Calc +package. Note that Calc has the non-standard convention that ‘/’ has +lower precedence than ‘*’, so that ‘a/b*c’ is interpreted as +‘(a/(b*c))’. Before evaluation by ‘calc-eval’ (see *note Calling Calc +from Your Lisp Programs: (calc)Calling Calc from Your Programs.), +variable substitution takes place according to the rules described +above. + + The range vectors can be directly fed into the Calc vector functions +like ‘vmean’ and ‘vsum’. + + A formula can contain an optional mode string after a semicolon. +This string consists of flags to influence Calc and other modes during +execution. By default, Org uses the standard Calc modes (precision 12, +angular units degrees, fraction and symbolic modes off). The display +format, however, has been changed to ‘(float 8)’ to keep tables compact. +The default settings can be configured using the variable +‘org-calc-default-modes’. + +‘p20’ + Set the internal Calc calculation precision to 20 digits. + +‘n3’, ‘s3’, ‘e2’, ‘f4’ + Normal, scientific, engineering or fixed format of the result of + Calc passed back to Org. Calc formatting is unlimited in precision + as long as the Calc calculation precision is greater. + +‘D’, ‘R’ + Degree and radian angle modes of Calc. + +‘F’, ‘S’ + Fraction and symbolic modes of Calc. + +‘u’ + Units simplification mode of Calc. Calc is also a symbolic + calculator and is capable of working with values having a unit, + represented with numerals followed by a unit string in Org table + cells. This mode instructs Calc to simplify the units in the + computed expression before returning the result. + +‘T’, ‘t’, ‘U’ + Duration computations in Calc or Lisp, *note Durations and time + values::. + +‘E’ + If and how to consider empty fields. Without ‘E’ empty fields in + range references are suppressed so that the Calc vector or Lisp + list contains only the non-empty fields. With ‘E’ the empty fields + are kept. For empty fields in ranges or empty field references the + value ‘nan’ (not a number) is used in Calc formulas and the empty + string is used for Lisp formulas. Add ‘N’ to use 0 instead for + both formula types. For the value of a field the mode ‘N’ has + higher precedence than ‘E’. + +‘N’ + Interpret all fields as numbers, use 0 for non-numbers. See the + next section to see how this is essential for computations with + Lisp formulas. In Calc formulas it is used only occasionally + because there number strings are already interpreted as numbers + without ‘N’. + +‘L’ + Literal, for Lisp formulas only. See the next section. + + Unless you use large integer numbers or high-precision calculation +and display for floating point numbers you may alternatively provide a +‘printf’ format specifier to reformat the Calc result after it has been +passed back to Org instead of letting Calc already do the formatting(1). +A few examples: + +‘$1+$2’ Sum of first and second field +‘$1+$2;%.2f’ Same, format result to two decimals +‘exp($2)+exp($1)’ Math functions can be used +‘$0;%.1f’ Reformat current cell to 1 decimal +‘($3-32)*5/9’ Degrees F → C conversion +‘$c/$1/$cm’ Hz → cm conversion, using ‘constants.el’ +‘tan($1);Dp3s1’ Compute in degrees, precision 3, display SCI 1 +‘sin($1);Dp3%.1e’ Same, but use ‘printf’ specifier for display +‘vmean($2..$7)’ Compute column range mean, using vector function +‘vmean($2..$7);EN’ Same, but treat empty fields as 0 +‘taylor($3,x=7,2)’ Taylor series of $3, at x=7, second degree + + Calc also contains a complete set of logical operations (see *note +Logical Operations: (calc)Logical Operations.). For example + +‘if($1 < 20, teen, string(""))’ + ‘"teen"’ if age ‘$1’ is less than 20, else the Org table result + field is set to empty with the empty string. + +‘if("$1" =​= "nan" || "$2" =​= "nan", string(""), $1 + $2); E f-1’ + Sum of the first two columns. When at least one of the input + fields is empty the Org table result field is set to empty. ‘E’ is + required to not convert empty fields to 0. ‘f-1’ is an optional + Calc format string similar to ‘%.1f’ but leaves empty results + empty. + +‘if(typeof(vmean($1..$7)) =​= 12, string(""), vmean($1..$7); E’ + Mean value of a range unless there is any empty field. Every field + in the range that is empty is replaced by ‘nan’ which lets ‘vmean’ + result in ‘nan’. Then ‘typeof =’ 12= detects the ‘nan’ from + ‘vmean’ and the Org table result field is set to empty. Use this + when the sample set is expected to never have missing values. + +‘if("$1..$7" =​= "[]", string(""), vmean($1..$7))’ + Mean value of a range with empty fields skipped. Every field in + the range that is empty is skipped. When all fields in the range + are empty the mean value is not defined and the Org table result + field is set to empty. Use this when the sample set can have a + variable size. + +‘vmean($1..$7); EN’ + To complete the example before: Mean value of a range with empty + fields counting as samples with value 0. Use this only when + incomplete sample sets should be padded with 0 to the full size. + + You can add your own Calc functions defined in Emacs Lisp with +‘defmath’ and use them in formula syntax for Calc. + + ---------- Footnotes ---------- + + (1) The printf reformatting is limited in precision because the value +passed to it is converted into an “integer” or “double”. The “integer” +is limited in size by truncating the signed value to 32 bits. The +“double” is limited in precision to 64 bits overall which leaves +approximately 16 significant decimal digits. + + +File: org.info, Node: Formula syntax for Lisp, Next: Durations and time values, Prev: Formula syntax for Calc, Up: The Spreadsheet + +3.5.3 Emacs Lisp forms as formulas +---------------------------------- + +It is also possible to write a formula in Emacs Lisp. This can be +useful for string manipulation and control structures, if Calc’s +functionality is not enough. + + A formula is evaluated as a Lisp form when it starts with a +single-quote followed by an opening parenthesis. Cell table references +are interpolated into the Lisp form before execution. The evaluation +should return either a string or a number. Evaluation modes and a +‘printf’ format used to render the returned values can be specified +after a semicolon. + + By default, references are interpolated as literal Lisp strings: the +field content is replaced in the Lisp form stripped of leading and +trailing white space and surrounded in double-quotes. For example: + + '(concat $1 $2) + +concatenates the content of columns 1 and column 2. + + When the ‘N’ flag is used, all referenced elements are parsed as +numbers and interpolated as Lisp numbers, without quotes. Fields that +cannot be parsed as numbers are interpolated as zeros. For example: + + '(+ $1 $2);N + +adds columns 1 and 2, equivalent to Calc’s ‘$1+$2’. Ranges are inserted +as space-separated fields, so they can be embedded in list or vector +syntax. For example: + + '(apply '+ '($1..$4));N + +computes the sum of columns 1 to 4, like Calc’s ‘vsum($1..$4)’. + + When the ‘L’ flag is used, all fields are interpolated literally: the +cell content is replaced in the Lisp form stripped of leading and +trailing white space and without quotes. If a reference is intended to +be interpreted as a string by the Lisp form, the reference operator +itself should be enclosed in double-quotes, like ‘"$3"’. The ‘L’ flag +is useful when strings and numbers are used in the same Lisp form. For +example: + + '(substring "$1" $2 $3);L + +extracts the part of the string in column 1 between the character +positions specified in the integers in column 2 and 3 and it is easier +to read than the equivalent: + + '(substring $1 (string-to-number $2) (string-to-number $3)) + + +File: org.info, Node: Durations and time values, Next: Field and range formulas, Prev: Formula syntax for Lisp, Up: The Spreadsheet + +3.5.4 Durations and time values +------------------------------- + +If you want to compute time values use the ‘T’, ‘t’, or ‘U’ flag, either +in Calc formulas or Elisp formulas: + + | Task 1 | Task 2 | Total | + |---------+----------+----------| + | 2:12 | 1:47 | 03:59:00 | + | 2:12 | 1:47 | 03:59 | + | 3:02:20 | -2:07:00 | 0.92 | + #+TBLFM: @2$3=$1+$2;T::@3$3=$1+$2;U::@4$3=$1+$2;t + + Input duration values must be of the form ‘HH:MM[:SS]’, where seconds +are optional. With the ‘T’ flag, computed durations are displayed as +‘HH:MM:SS’ (see the first formula above). With the ‘U’ flag, seconds +are omitted so that the result is only ‘HH:MM’ (see second formula +above). Zero-padding of the hours field depends upon the value of the +variable ‘org-table-duration-hour-zero-padding’. + + With the ‘t’ flag, computed durations are displayed according to the +value of the option ‘org-table-duration-custom-format’, which defaults +to ‘hours’ and displays the result as a fraction of hours (see the third +formula in the example above). + + Negative duration values can be manipulated as well, and integers are +considered as seconds in addition and subtraction. + + +File: org.info, Node: Field and range formulas, Next: Column formulas, Prev: Durations and time values, Up: The Spreadsheet + +3.5.5 Field and range formulas +------------------------------ + +To assign a formula to a particular field, type it directly into the +field, preceded by ‘:=’, for example ‘vsum(@II..III)’. When you press +‘<TAB>’ or ‘<RET>’ or ‘C-c C-c’ with point still in the field, the +formula is stored as the formula for this field, evaluated, and the +current field is replaced with the result. + + Formulas are stored in a special ‘TBLFM’ keyword located directly +below the table. If you type the equation in the fourth field of the +third data line in the table, the formula looks like ‘@3$4=$1+$2’. When +inserting/deleting/swapping column and rows with the appropriate +commands, _absolute references_ (but not relative ones) in stored +formulas are modified in order to still reference the same field. To +avoid this from happening, in particular in range references, anchor +ranges at the table borders (using ‘@<’, ‘@>’, ‘$<’, ‘$>’), or at hlines +using the ‘@I’ notation. Automatic adaptation of field references does +not happen if you edit the table structure with normal editing +commands—you must fix the formulas yourself. + + Instead of typing an equation into the field, you may also use the +following command + +‘C-u C-c =’ (‘org-table-eval-formula’) + Install a new formula for the current field. The command prompts + for a formula with default taken from the ‘TBLFM’ keyword, applies + it to the current field, and stores it. + + The left-hand side of a formula can also be a special expression in +order to assign the formula to a number of different fields. There is +no keyboard shortcut to enter such range formulas. To add them, use the +formula editor (see *note Editing and debugging formulas::) or edit the +‘TBLFM’ keyword directly. + +‘$2=’ + Column formula, valid for the entire column. This is so common + that Org treats these formulas in a special way, see *note Column + formulas::. + +‘@3=’ + Row formula, applies to all fields in the specified row. ‘@>=’ + means the last row. + +‘@1$2..@4$3=’ + Range formula, applies to all fields in the given rectangular + range. This can also be used to assign a formula to some but not + all fields in a row. + +‘$NAME=’ + Named field, see *note Advanced features::. + + +File: org.info, Node: Column formulas, Next: Lookup functions, Prev: Field and range formulas, Up: The Spreadsheet + +3.5.6 Column formulas +--------------------- + +When you assign a formula to a simple column reference like ‘$3=’, the +same formula is used in all fields of that column, with the following +very convenient exceptions: (i) If the table contains horizontal +separator hlines with rows above and below, everything before the first +such hline is considered part of the table _header_ and is not modified +by column formulas. Therefore a header is mandatory when you use column +formulas and want to add hlines to group rows, like for example to +separate a total row at the bottom from the summand rows above. (ii) +Fields that already get a value from a field/range formula are left +alone by column formulas. These conditions make column formulas very +easy to use. + + To assign a formula to a column, type it directly into any field in +the column, preceded by an equal sign, like ‘=$1+$2’. When you press +‘<TAB>’ or ‘<RET>’ or ‘C-c C-c’ with point still in the field, the +formula is stored as the formula for the current column, evaluated and +the current field replaced with the result. If the field contains only +‘=’, the previously stored formula for this column is used. For each +column, Org only remembers the most recently used formula. In the +‘TBLFM’ keyword, column formulas look like ‘$4=$1+$2’. The left-hand +side of a column formula can not be the name of column, it must be the +numeric column reference or ‘$>’. + + Instead of typing an equation into the field, you may also use the +following command: + +‘C-c =’ (‘org-table-eval-formula’) + Install a new formula for the current column and replace current + field with the result of the formula. The command prompts for a + formula, with default taken from the ‘TBLFM’ keyword, applies it to + the current field and stores it. With a numeric prefix argument, + e.g., ‘C-5 C-c =’, the command applies it to that many consecutive + fields in the current column. + + +File: org.info, Node: Lookup functions, Next: Editing and debugging formulas, Prev: Column formulas, Up: The Spreadsheet + +3.5.7 Lookup functions +---------------------- + +Org has three predefined Emacs Lisp functions for lookups in tables. + +‘(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)’ + Searches for the first element S in list S-LIST for which + (PREDICATE VAL S) + is non-‘nil’; returns the value from the corresponding position in + list R-LIST. The default PREDICATE is ‘equal’. Note that the + parameters VAL and S are passed to PREDICATE in the same order as + the corresponding parameters are in the call to ‘org-lookup-first’, + where VAL precedes S-LIST. If R-LIST is ‘nil’, the matching + element S of S-LIST is returned. + +‘(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)’ + Similar to ‘org-lookup-first’ above, but searches for the _last_ + element for which PREDICATE is non-‘nil’. + +‘(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)’ + Similar to ‘org-lookup-first’, but searches for _all_ elements for + which PREDICATE is non-‘nil’, and returns _all_ corresponding + values. This function can not be used by itself in a formula, + because it returns a list of values. However, powerful lookups can + be built when this function is combined with other Emacs Lisp + functions. + + If the ranges used in these functions contain empty fields, the ‘E’ +mode for the formula should usually be specified: otherwise empty fields +are not included in S-LIST and/or R-LIST which can, for example, result +in an incorrect mapping from an element of S-LIST to the corresponding +element of R-LIST. + + These three functions can be used to implement associative arrays, +count matching cells, rank results, group data, etc. For practical +examples see this tutorial on Worg +(https://orgmode.org/worg/org-tutorials/org-lookups.html). + + +File: org.info, Node: Editing and debugging formulas, Next: Updating the table, Prev: Lookup functions, Up: The Spreadsheet + +3.5.8 Editing and debugging formulas +------------------------------------ + +You can edit individual formulas in the minibuffer or directly in the +field. Org can also prepare a special buffer with all active formulas +of a table. When offering a formula for editing, Org converts +references to the standard format (like ‘B3’ or ‘D&’) if possible. If +you prefer to only work with the internal format (like ‘@3$2’ or ‘$4’), +configure the variable ‘org-table-use-standard-references’. + +‘C-c =’ or ‘C-u C-c =’ (‘org-table-eval-formula’) + Edit the formula associated with the current column/field in the + minibuffer. See *note Column formulas::, and *note Field and range + formulas::. + +‘C-u C-u C-c =’ (‘org-table-eval-formula’) + Re-insert the active formula (either a field formula, or a column + formula) into the current field, so that you can edit it directly + in the field. The advantage over editing in the minibuffer is that + you can use the command ‘C-c ?’. + +‘C-c ?’ (‘org-table-field-info’) + While editing a formula in a table field, highlight the field(s) + referenced by the reference at point position in the formula. + +‘C-c }’ (‘org-table-toggle-coordinate-overlays’) + Toggle the display of row and column numbers for a table, using + overlays. These are updated each time the table is aligned; you + can force it with ‘C-c C-c’. + +‘C-c {’ (‘org-table-toggle-formula-debugger’) + Toggle the formula debugger on and off. See below. + +‘C-c '’ (‘org-table-edit-formulas’) + Edit all formulas for the current table in a special buffer, where + the formulas are displayed one per line. If the current field has + an active formula, point in the formula editor marks it. While + inside the special buffer, Org automatically highlights any field + or range reference at point position. You may edit, remove and add + formulas, and use the following commands: + + ‘C-c C-c’ or ‘C-x C-s’ (‘org-table-fedit-finish’) + Exit the formula editor and store the modified formulas. With + ‘C-u’ prefix, also apply the new formulas to the entire table. + + ‘C-c C-q’ (‘org-table-fedit-abort’) + Exit the formula editor without installing changes. + + ‘C-c C-r’ (‘org-table-fedit-toggle-ref-type’) + Toggle all references in the formula editor between standard + (like ‘B3’) and internal (like ‘@3$2’). + + ‘<TAB>’ (‘org-table-fedit-lisp-indent’) + Pretty-print or indent Lisp formula at point. When in a line + containing a Lisp formula, format the formula according to + Emacs Lisp rules. Another ‘<TAB>’ collapses the formula back + again. In the open formula, ‘<TAB>’ re-indents just like in + Emacs Lisp mode. + + ‘M-<TAB>’ (‘lisp-complete-symbol’) + Complete Lisp symbols, just like in Emacs Lisp mode. + + ‘S-<UP>’, ‘S-<DOWN>’, ‘S-<LEFT>’, ‘S-<RIGHT>’ + Shift the reference at point. For example, if the reference + is ‘B3’ and you press ‘S-<RIGHT>’, it becomes ‘C3’. This also + works for relative references and for hline references. + + ‘M-S-<UP>’ (‘org-table-fedit-line-up’) + Move the test line for column formulas up in the Org buffer. + + ‘M-S-<DOWN>’ (‘org-table-fedit-line-down’) + Move the test line for column formulas down in the Org buffer. + + ‘M-<UP>’ (‘org-table-fedit-scroll-up’) + Scroll up the window displaying the table. + + ‘M-<DOWN>’ (‘org-table-fedit-scroll-down’) + Scroll down the window displaying the table. + + ‘C-c }’ + Turn the coordinate grid in the table on and off. + + Making a table field blank does not remove the formula associated +with the field, because that is stored in a different line—the ‘TBLFM’ +keyword line. During the next recalculation, the field will be filled +again. To remove a formula from a field, you have to give an empty +reply when prompted for the formula, or to edit the ‘TBLFM’ keyword. + + You may edit the ‘TBLFM’ keyword directly and re-apply the changed +equations with ‘C-c C-c’ in that line or with the normal recalculation +commands in the table. + +Using multiple ‘TBLFM’ lines +............................ + +You may apply the formula temporarily. This is useful when you want to +switch the formula applied to the table. Place multiple ‘TBLFM’ +keywords right after the table, and then press ‘C-c C-c’ on the formula +to apply. Here is an example: + + | x | y | + |---+---| + | 1 | | + | 2 | | + #+TBLFM: $2=$1*1 + #+TBLFM: $2=$1*2 + +Pressing ‘C-c C-c’ in the line of ‘#+TBLFM: $2=$1*2’ yields: + + | x | y | + |---+---| + | 1 | 2 | + | 2 | 4 | + #+TBLFM: $2=$1*1 + #+TBLFM: $2=$1*2 + +If you recalculate this table, with ‘C-u C-c *’, for example, you get +the following result from applying only the first ‘TBLFM’ keyword. + + | x | y | + |---+---| + | 1 | 1 | + | 2 | 2 | + #+TBLFM: $2=$1*1 + #+TBLFM: $2=$1*2 + +Debugging formulas +.................. + +When the evaluation of a formula leads to an error, the field content +becomes the string ‘#ERROR’. If you would like to see what is going on +during variable substitution and calculation in order to find a bug, +turn on formula debugging in the Tbl menu and repeat the calculation, +for example by pressing ‘C-u C-u C-c = <RET>’ in a field. Detailed +information are displayed. + + +File: org.info, Node: Updating the table, Next: Advanced features, Prev: Editing and debugging formulas, Up: The Spreadsheet + +3.5.9 Updating the table +------------------------ + +Recalculation of a table is normally not automatic, but needs to be +triggered by a command. To make recalculation at least semi-automatic, +see *note Advanced features::. + + In order to recalculate a line of a table or the entire table, use +the following commands: + +‘C-c *’ (‘org-table-recalculate’) + Recalculate the current row by first applying the stored column + formulas from left to right, and all field/range formulas in the + current row. + +‘C-u C-c *’ or ‘C-u C-c C-c’ + Recompute the entire table, line by line. Any lines before the + first hline are left alone, assuming that these are part of the + table header. + +‘C-u C-u C-c *’ or ‘C-u C-u C-c C-c’ (‘org-table-iterate’) + Iterate the table by recomputing it until no further changes occur. + This may be necessary if some computed fields use the value of + other fields that are computed _later_ in the calculation sequence. + +‘M-x org-table-recalculate-buffer-tables’ + Recompute all tables in the current buffer. + +‘M-x org-table-iterate-buffer-tables’ + Iterate all tables in the current buffer, in order to converge + table-to-table dependencies. + + +File: org.info, Node: Advanced features, Prev: Updating the table, Up: The Spreadsheet + +3.5.10 Advanced features +------------------------ + +If you want the recalculation of fields to happen automatically, or if +you want to be able to assign _names_(1) to fields and columns, you need +to reserve the first column of the table for special marking characters. + +‘C-#’ (‘org-table-rotate-recalc-marks’) + Rotate the calculation mark in first column through the states ‘#’, + ‘*’, ‘!’, ‘$’. When there is an active region, change all marks in + the region. + + Here is an example of a table that collects exam results of students +and makes use of these features: + + |---+---------+--------+--------+--------+-------+------| + | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note | + |---+---------+--------+--------+--------+-------+------| + | ! | | P1 | P2 | P3 | Tot | | + | # | Maximum | 10 | 15 | 25 | 50 | 10.0 | + | ^ | | m1 | m2 | m3 | mt | | + |---+---------+--------+--------+--------+-------+------| + | # | Peter | 10 | 8 | 23 | 41 | 8.2 | + | # | Sam | 2 | 4 | 3 | 9 | 1.8 | + |---+---------+--------+--------+--------+-------+------| + | | Average | | | | 25.0 | | + | ^ | | | | | at | | + | $ | max=50 | | | | | | + |---+---------+--------+--------+--------+-------+------| + #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f + + Important: Please note that for these special tables, recalculating + the table with ‘C-u C-c *’ only affects rows that are marked ‘#’ or + ‘*’, and fields that have a formula assigned to the field itself. + The column formulas are not applied in rows with empty first field. + + The marking characters have the following meaning: + +‘!’ + The fields in this line define names for the columns, so that you + may refer to a column as ‘$Tot’ instead of ‘$6’. + +‘^’ + This row defines names for the fields _above_ the row. With such a + definition, any formula in the table may use ‘$m1’ to refer to the + value ‘10’. Also, if you assign a formula to a names field, it is + stored as ‘$name = ...’. + +‘_’ + Similar to ‘^’, but defines names for the fields in the row + _below_. + +‘$’ + Fields in this row can define _parameters_ for formulas. For + example, if a field in a ‘$’ row contains ‘max=50’, then formulas + in this table can refer to the value 50 using ‘$max’. Parameters + work exactly like constants, only that they can be defined on a + per-table basis. + +‘#’ + Fields in this row are automatically recalculated when pressing + ‘<TAB>’ or ‘<RET>’ or ‘S-<TAB>’ in this row. Also, this row is + selected for a global recalculation with ‘C-u C-c *’. Unmarked + lines are left alone by this command. + +‘*’ + Selects this line for global recalculation with ‘C-u C-c *’, but + not for automatic recalculation. Use this when automatic + recalculation slows down editing too much. + +‘/’ + Do not export this line. Useful for lines that contain the + narrowing ‘<N>’ markers or column group markers. + + Finally, just to whet your appetite for what can be done with the +fantastic Calc package, here is a table that computes the Taylor series +of degree n at location x for a couple of functions. + + |---+-------------+---+-----+--------------------------------------| + | | Func | n | x | Result | + |---+-------------+---+-----+--------------------------------------| + | # | exp(x) | 1 | x | 1 + x | + | # | exp(x) | 2 | x | 1 + x + x^2 / 2 | + | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 | + | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 | + | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 | + | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 | + |---+-------------+---+-----+--------------------------------------| + #+TBLFM: $5=taylor($2,$4,$3);n3 + + ---------- Footnotes ---------- + + (1) Such names must start with an alphabetic character and use only +alphanumeric/underscore characters. + + +File: org.info, Node: Org Plot, Prev: The Spreadsheet, Up: Tables + +3.6 Org Plot +============ + +Org Plot can produce graphs of information stored in Org tables, either +graphically or in ASCII art. + +Graphical plots using Gnuplot +----------------------------- + +Org Plot can produce 2D and 3D graphs of information stored in Org +tables using Gnuplot (https://www.gnuplot.info/) and Gnuplot mode +(http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html). To see +this in action, ensure that you have both Gnuplot and Gnuplot mode +installed on your system, then call ‘C-c " g’ or ‘M-x org-plot/gnuplot’ +on the following table. + + #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]" + | Sede | Max cites | H-index | + |-----------+-----------+---------| + | Chile | 257.72 | 21.39 | + | Leeds | 165.77 | 19.68 | + | Sao Paolo | 71.00 | 11.50 | + | Stockholm | 134.19 | 14.33 | + | Morelia | 257.56 | 17.67 | + + Org Plot supports a range of plot types, and provides the ability to +add more. For example, a radar plot can be generated like so: + #+PLOT: title:"An evaluation of plaintext document formats" transpose:yes type:radar min:0 max:4 + | Format | Fine-grained-control | Initial Effort | Syntax simplicity | Editor Support | Integrations | Ease-of-referencing | Versatility | + |-------------------+----------------------+----------------+-------------------+----------------+--------------+---------------------+-------------| + | Word | 2 | 4 | 4 | 2 | 3 | 2 | 2 | + | LaTeX | 4 | 1 | 1 | 3 | 2 | 4 | 3 | + | Org Mode | 4 | 2 | 3.5 | 1 | 4 | 4 | 4 | + | Markdown | 1 | 3 | 3 | 4 | 3 | 3 | 1 | + | Markdown + Pandoc | 2.5 | 2.5 | 2.5 | 3 | 3 | 3 | 2 | + + Notice that Org Plot is smart enough to apply the table’s headers as +labels. Further control over the labels, type, content, and appearance +of plots can be exercised through the ‘PLOT’ keyword preceding a table. +See below for a complete list of Org Plot options. For more information +and examples see the Org Plot tutorial +(https://orgmode.org/worg/org-tutorials/org-plot.html). + +Plot options +............ + +‘set’ + Specify any Gnuplot option to be set when graphing. + +‘title’ + Specify the title of the plot. + +‘ind’ + Specify which column of the table to use as the ‘x’ axis. + +‘deps’ + Specify the columns to graph as a Lisp style list, surrounded by + parentheses and separated by spaces for example ‘dep:(3 4)’ to + graph the third and fourth columns. Defaults to graphing all other + columns aside from the ‘ind’ column. + +transpose + When ‘y’, ‘yes’, or ‘t’ attempt to transpose the table data before + plotting. Also recognises the shorthand option ‘trans’. + +‘type’ + Specify the type of the plot, by default one of ‘2d’, ‘3d’, + ‘radar’, or ‘grid’. Available types can be customised with + ‘org-plot/preset-plot-types’. + +‘with’ + Specify a ‘with’ option to be inserted for every column being + plotted, e.g., ‘lines’, ‘points’, ‘boxes’, ‘impulses’. Defaults to + ‘lines’. + +‘file’ + If you want to plot to a file, specify + ‘"path/to/desired/output-file"’. + +‘labels’ + List of labels to be used for the ‘deps’. Defaults to the column + headers if they exist. + +‘line’ + Specify an entire line to be inserted in the Gnuplot script. + +‘map’ + When plotting ‘3d’ or ‘grid’ types, set this to ‘t’ to graph a flat + mapping rather than a ‘3d’ slope. + +min + Provides a minimum axis value that may be used by a plot type. + Implicitly assumes the ‘y’ axis is being referred to. Can + explicitly provide a value for a either the ‘x’ or ‘y’ axis with + ‘xmin’ and ‘ymin’. + +max + Provides a maximum axis value that may be used by a plot type. + Implicitly assumes the ‘y’ axis is being referred to. Can + explicitly provide a value for a either the ‘x’ or ‘y’ axis with + ‘xmax’ and ‘ymax’. + +ticks + Provides a desired number of axis ticks to display, that may be + used by a plot type. If none is given a plot type that requires + ticks will use ‘org--plot/sensible-tick-num’ to try to determine a + good value. + +‘timefmt’ + Specify format of Org mode timestamps as they will be parsed by + Gnuplot. Defaults to ‘%Y-%m-%d-%H:%M:%S’. + +‘script’ + If you want total control, you can specify a script file—place the + file name between double-quotes—which will be used to plot. Before + plotting, every instance of ‘$datafile’ in the specified script + will be replaced with the path to the generated data file. Note: + even if you set this option, you may still want to specify the plot + type, as that can impact the content of the data file. + +ASCII bar plots +--------------- + +While point is on a column, typing ‘C-c `` a’ or ‘M-x orgtbl-ascii-plot’ +create a new column containing an ASCII-art bars plot. The plot is +implemented through a regular column formula. When the source column +changes, the bar plot may be updated by refreshing the table, for +example typing ‘C-u C-c *’. + + | Sede | Max cites | | + |---------------+-----------+--------------| + | Chile | 257.72 | WWWWWWWWWWWW | + | Leeds | 165.77 | WWWWWWWh | + | Sao Paolo | 71.00 | WWW; | + | Stockholm | 134.19 | WWWWWW: | + | Morelia | 257.56 | WWWWWWWWWWWH | + | Rochefourchat | 0.00 | | + #+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12) + + The formula is an Elisp call. + + -- Function: orgtbl-ascii-draw value min max &optional width + Draw an ASCII bar in a table. + + VALUE is the value to plot. + + MIN is the value displayed as an empty bar. MAX is the value + filling all the WIDTH. Sources values outside this range are + displayed as ‘too small’ or ‘too large’. + + WIDTH is the number of characters of the bar plot. It defaults to + ‘12’. + + +File: org.info, Node: Hyperlinks, Next: TODO Items, Prev: Tables, Up: Top + +4 Hyperlinks +************ + +Like HTML, Org provides support for links inside a file, external links +to other files, Usenet articles, emails, and much more. + +* Menu: + +* Link Format:: How links in Org are formatted. +* Internal Links:: Links to other places in the current file. +* Radio Targets:: Make targets trigger links in plain text. +* External Links:: URL-like links to the world. +* Handling Links:: Creating, inserting and following. +* Using Links Outside Org:: Linking from my C source code? +* Link Abbreviations:: Shortcuts for writing complex links. +* Search Options:: Linking to a specific location. +* Custom Searches:: When the default search is not enough. + + +File: org.info, Node: Link Format, Next: Internal Links, Up: Hyperlinks + +4.1 Link Format +=============== + +Org recognizes plain URIs, possibly wrapped within angle brackets(1), +and activate them as clickable links. + + The general link format, however, looks like this: + + [[LINK][DESCRIPTION]] + +or alternatively + + [[LINK]] + + Some ‘\’, ‘[’ and ‘]’ characters in the LINK part need to be +“escaped”, i.e., preceded by another ‘\’ character. More specifically, +the following characters, and only them, must be escaped: + + 1. all ‘[’ and ‘]’ characters, + 2. every ‘\’ character preceding either ‘]’ or ‘[’, + 3. every ‘\’ character at the end of the link. + + Functions inserting links (see *note Handling Links::) properly +escape ambiguous characters. You only need to bother about the rules +above when inserting directly, or yanking, a URI within square brackets. +When in doubt, you may use the function ‘org-link-escape’, which turns a +link string into its escaped form. + + Once a link in the buffer is complete, with all brackets present, Org +changes the display so that ‘DESCRIPTION’ is displayed instead of +‘[[LINK][DESCRIPTION]]’ and ‘LINK’ is displayed instead of ‘[[LINK]]’. +Links are highlighted in the ‘org-link’ face, which, by default, is an +underlined face. + + You can directly edit the visible part of a link. This can be either +the LINK part, if there is no description, or the DESCRIPTION part +otherwise. To also edit the invisible LINK part, use ‘C-c C-l’ with +point on the link (see *note Handling Links::). + + If you place point at the beginning or just behind the end of the +displayed text and press ‘<BS>’, you remove the—invisible—bracket at +that location(2). This makes the link incomplete and the internals are +again displayed as plain text. Inserting the missing bracket hides the +link internals again. To show the internal structure of all links, use +the menu: Org → Hyperlinks → Literal links. + + ---------- Footnotes ---------- + + (1) Plain URIs are recognized only for a well-defined set of schemes. +See *note External Links::. Unlike URI syntax, they cannot contain +parenthesis or white spaces, either. URIs within angle brackets have no +such limitation. + + (2) More accurately, the precise behavior depends on how point +arrived there—see *note Invisible Text: (elisp)Invisible Text. + + +File: org.info, Node: Internal Links, Next: Radio Targets, Prev: Link Format, Up: Hyperlinks + +4.2 Internal Links +================== + +A link that does not look like a URL—i.e., does not start with a known +scheme or a file name—refers to the current document. You can follow it +with ‘C-c C-o’ when point is on the link, or with a mouse click (see +*note Handling Links::). + + Org provides several refinements to internal navigation within a +document. Most notably, a construct like ‘[[#my-custom-id]]’ +specifically targets the entry with the ‘CUSTOM_ID’ property set to +‘my-custom-id’. Also, an internal link looking like ‘[[*Some section]]’ +points to a headline with the name ‘Some section’(1). + + When the link does not belong to any of the cases above, Org looks +for a _dedicated target_: the same string in double angular brackets, +like ‘<<My Target>>’. + + If no dedicated target exists, the link tries to match the exact name +of an element within the buffer. Naming is done, unsurprisingly, with +the ‘NAME’ keyword, which has to be put in the line before the element +it refers to, as in the following example + + #+NAME: My Target + | a | table | + |----+------------| + | of | four cells | + + Ultimately, if none of the above succeeds, Org searches for a +headline that is exactly the link text but may also include a TODO +keyword and tags, or initiates a plain text search, according to the +value of ‘org-link-search-must-match-exact-headline’. + + Note that you must make sure custom IDs, dedicated targets, and names +are unique throughout the document. Org provides a linter to assist you +in the process, if needed. See *note Org Syntax::. + + During export, internal links are used to mark objects and assign +them a number. Marked objects are then referenced by links pointing to +them. In particular, links without a description appear as the number +assigned to the marked object(2). In the following excerpt from an Org +buffer + + 1. one item + 2. <<target>>another item + Here we refer to item [[target]]. + +The last sentence will appear as ‘Here we refer to item 2’ when +exported. + + In non-Org files, the search looks for the words in the link text. +In the above example the search would be for ‘target’. + + Following a link pushes a mark onto Org’s own mark ring. You can +return to the previous position with ‘C-c &’. Using this command +several times in direct succession goes back to positions recorded +earlier. + + ---------- Footnotes ---------- + + (1) To insert a link targeting a headline, in-buffer completion can +be used. Just type a star followed by a few optional letters into the +buffer and press ‘M-<TAB>’. All headlines in the current buffer are +offered as completions. + + (2) When targeting a ‘NAME’ keyword, the ‘CAPTION’ keyword is +mandatory in order to get proper numbering (see *note Captions::). + + +File: org.info, Node: Radio Targets, Next: External Links, Prev: Internal Links, Up: Hyperlinks + +4.3 Radio Targets +================= + +Org can automatically turn any occurrences of certain target names in +normal text into a link. So without explicitly creating a link, the +text connects to the target radioing its position. Radio targets are +enclosed by triple angular brackets. For example, a target ‘<<<My +Target>>>’ causes each occurrence of ‘my target’ in normal text to +become activated as a link. The Org file is scanned automatically for +radio targets only when the file is first loaded into Emacs. To update +the target list during editing, press ‘C-c C-c’ with point on or at a +target. + + +File: org.info, Node: External Links, Next: Handling Links, Prev: Radio Targets, Up: Hyperlinks + +4.4 External Links +================== + +Org supports links to files, websites, Usenet and email messages, BBDB +database entries and links to both IRC conversations and their logs. +External links are URL-like locators. They start with a short +identifying string followed by a colon. There can be no space after the +colon. + + Here is the full set of built-in link types: + +‘file’ + File links. File name may be remote, absolute, or relative. + + Additionally, you can specify a line number, or a text search. In + Org files, you may link to a headline name, a custom ID, or a code + reference instead. + + As a special case, “file” prefix may be omitted if the file name is + complete, e.g., it starts with ‘./’, or ‘/’. + +‘attachment’ + Same as file links but for files and folders attached to the + current node (see *note Attachments::). Attachment links are + intended to behave exactly as file links but for files relative to + the attachment directory. + +‘bbdb’ + Link to a BBDB record, with possible regexp completion. + +‘docview’ + Link to a document opened with DocView mode. You may specify a + page number. + +‘doi’ + Link to an electronic resource, through its handle. + +‘elisp’ + Execute an Elisp command upon activation. + +‘gnus’, ‘rmail’, ‘mhe’ + Link to messages or folders from a given Emacs’ MUA. + +‘help’ + Display documentation of a symbol in ‘*Help*’ buffer. + +‘http’, ‘https’ + Web links. + +‘id’ + Link to a specific headline by its ID property, in an Org file. + +‘info’ + Link to an Info manual, or to a specific node. + +‘irc’ + Link to an IRC channel. + +‘mailto’ + Link to message composition. + +‘news’ + Usenet links. + +‘shell’ + Execute a shell command upon activation. + + The following table illustrates the link types above, along with +their options: + +Link Type Example +------------------------------------------------------------------------ +http ‘http://staff.science.uva.nl/c.dominik/’ +https ‘https://orgmode.org/’ +doi ‘doi:10.1000/182’ +file ‘file:/home/dominik/images/jupiter.jpg’ + ‘/home/dominik/images/jupiter.jpg’ (same as above) + ‘file:papers/last.pdf’ + ‘./papers/last.pdf’ (same as above) + ‘file:/ssh:me@some.where:papers/last.pdf’ (remote) + ‘/ssh:me@some.where:papers/last.pdf’ (same as above) + ‘file:sometextfile::NNN’ (jump to line number) + ‘file:projects.org’ + ‘file:projects.org::some words’ (text search)(1) + ‘file:projects.org::*task title’ (headline search) + ‘file:projects.org::#custom-id’ (headline search) +attachment ‘attachment:projects.org’ + ‘attachment:projects.org::some words’ (text search) +docview ‘docview:papers/last.pdf::NNN’ +id ‘id:B7423F4D-2E8A-471B-8810-C40F074717E9’ +news ‘news:comp.emacs’ +mailto ‘mailto:adent@galaxy.net’ +mhe ‘mhe:folder’ (folder link) + ‘mhe:folder#id’ (message link) +rmail ‘rmail:folder’ (folder link) + ‘rmail:folder#id’ (message link) +gnus ‘gnus:group’ (group link) + ‘gnus:group#id’ (article link) +bbdb ‘bbdb:R.*Stallman’ (record with regexp) +irc ‘irc:/irc.com/#emacs/bob’ +help ‘help:org-store-link’ +info ‘info:org#External links’ +shell ‘shell:ls *.org’ +elisp ‘elisp:(find-file "Elisp.org")’ (Elisp form to evaluate) + ‘elisp:org-agenda’ (interactive Elisp command) + + On top of these built-in link types, additional ones are available +through the ‘org-contrib’ repository (see *note Installation::). For +example, these links to VM or Wanderlust messages are available when you +load the corresponding libraries from the ‘org-contrib’ repository: + +‘vm:folder’ VM folder link +‘vm:folder#id’ VM message link +‘vm://myself@some.where.org/folder#id’ VM on remote machine +‘vm-imap:account:folder’ VM IMAP folder link +‘vm-imap:account:folder#id’ VM IMAP message link +‘wl:folder’ Wanderlust folder link +‘wl:folder#id’ Wanderlust message link + + For information on customizing Org to add new link types, see *note +Adding Hyperlink Types::. + + A link should be enclosed in double brackets and may contain +descriptive text to be displayed instead of the URL (see *note Link +Format::), for example: + + [[https://www.gnu.org/software/emacs/][GNU Emacs]] + + If the description is a file name or URL that points to an image, +HTML export (see *note HTML Export::) inlines the image as a clickable +button. If there is no description at all and the link points to an +image, that image is inlined into the exported HTML file. + + Org also recognizes external links amid normal text and activates +them as links. If spaces must be part of the link (for example in +‘bbdb:R.*Stallman’), or if you need to remove ambiguities about the end +of the link, enclose the link in square or angular brackets. + + ---------- Footnotes ---------- + + (1) The actual behavior of the search depends on the value of the +variable ‘org-link-search-must-match-exact-headline’. If its value is +‘nil’, then a fuzzy text search is done. If it is ‘t’, then only the +exact headline is matched, ignoring spaces and statistic cookies. If +the value is ‘query-to-create’, then an exact headline is searched; if +it is not found, then the user is queried to create it. + + +File: org.info, Node: Handling Links, Next: Using Links Outside Org, Prev: External Links, Up: Hyperlinks + +4.5 Handling Links +================== + +Org provides methods to create a link in the correct syntax, to insert +it into an Org file, and to follow the link. + + The main function is ‘org-store-link’, called with ‘M-x +org-store-link’. Because of its importance, we suggest to bind it to a +widely available key (see *note Activation::). It stores a link to the +current location. The link is stored for later insertion into an Org +buffer—see below. The kind of link that is created depends on the +current buffer: + +_Org mode buffers_ + For Org files, if there is a ‘<<target>>’ at point, the link points + to the target. Otherwise it points to the current headline, which + is also the description(1). + + If the headline has a ‘CUSTOM_ID’ property, store a link to this + custom ID. In addition or alternatively, depending on the value of + ‘org-id-link-to-org-use-id’, create and/or use a globally unique + ‘ID’ property for the link(2). So using this command in Org + buffers potentially creates two links: a human-readable link from + the custom ID, and one that is globally unique and works even if + the entry is moved from file to file. The ‘ID’ property can be + either a UUID (default) or a timestamp, depending on + ‘org-id-method’. Later, when inserting the link, you need to + decide which one to use. + +_Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus_ + Pretty much all Emacs mail clients are supported. The link points + to the current article, or, in some Gnus buffers, to the group. + The description is constructed according to the variable + ‘org-link-email-description-format’. By default, it refers to the + addressee and the subject. + +_Web browsers: W3, W3M and EWW_ + Here the link is the current URL, with the page title as the + description. + +_Contacts: BBDB_ + Links created in a BBDB buffer point to the current entry. + +_Chat: IRC_ + For IRC links, if the variable ‘org-irc-link-to-logs’ is non-‘nil’, + create a ‘file’ style link to the relevant point in the logs for + the current conversation. Otherwise store an ‘irc’ style link to + the user/channel/server under the point. + +_Other files_ + For any other file, the link points to the file, with a search + string (see *note Search Options::) pointing to the contents of the + current line. If there is an active region, the selected words + form the basis of the search string. You can write custom Lisp + functions to select the search string and perform the search for + particular file types (see *note Custom Searches::). + + You can also define dedicated links to other files. See *note + Adding Hyperlink Types::. + +_Agenda view_ + When point is in an agenda view, the created link points to the + entry referenced by the current line. + + From an Org buffer, the following commands create, navigate or, more +generally, act on links. + +‘C-c C-l’ (‘org-insert-link’) + Insert a link(3). This prompts for a link to be inserted into the + buffer. You can just type a link, using text for an internal link, + or one of the link type prefixes mentioned in the examples above. + The link is inserted into the buffer, along with a descriptive + text(4). If some text was selected at this time, it becomes the + default description. + + _Inserting stored links_ + All links stored during the current session are part of the + history for this prompt, so you can access them with ‘<UP>’ + and ‘<DOWN>’ (or ‘M-p’, ‘M-n’). + + _Completion support_ + Completion with ‘<TAB>’ helps you to insert valid link + prefixes like ‘http’ or ‘ftp’, including the prefixes defined + through link abbreviations (see *note Link Abbreviations::). + If you press ‘<RET>’ after inserting only the prefix, Org + offers specific completion support for some link types(5). + For example, if you type ‘f i l e <RET>’—alternative access: + ‘C-u C-c C-l’, see below—Org offers file name completion, and + after ‘b b d b <RET>’ you can complete contact names. + +‘C-u C-c C-l’ + When ‘C-c C-l’ is called with a ‘C-u’ prefix argument, insert a + link to a file. You may use file name completion to select the + name of the file. The path to the file is inserted relative to the + directory of the current Org file, if the linked file is in the + current directory or in a sub-directory of it, or if the path is + written relative to the current directory using ‘../’. Otherwise + an absolute path is used, if possible with ‘~/’ for your home + directory. You can force an absolute path with two ‘C-u’ prefixes. + +‘C-c C-l’ (with point on existing link) + When point is on an existing link, ‘C-c C-l’ allows you to edit the + link and description parts of the link. + +‘C-c C-o’ (‘org-open-at-point’) + Open link at point. This launches a web browser for URL (using + ‘browse-url-at-point’), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for + the corresponding links, and execute the command in a shell link. + When point is on an internal link, this command runs the + corresponding search. When point is on the tags part of a + headline, it creates the corresponding tags view (see *note + Matching tags and properties::). If point is on a timestamp, it + compiles the agenda for that date. Furthermore, it visits text and + remote files in ‘file’ links with Emacs and select a suitable + application for local non-text files. Classification of files is + based on file extension only. See option ‘org-file-apps’. If you + want to override the default application and visit the file with + Emacs, use a ‘C-u’ prefix. If you want to avoid opening in Emacs, + use a ‘C-u C-u’ prefix. + + If point is on a headline, but not on a link, offer all links in + the headline and entry text. If you want to setup the frame + configuration for following links, customize + ‘org-link-frame-setup’. + +‘<RET>’ + When ‘org-return-follows-link’ is set, ‘<RET>’ also follows the + link at point. + +‘mouse-2’ or ‘mouse-1’ + On links, ‘mouse-1’ and ‘mouse-2’ opens the link just as ‘C-c C-o’ + does. + +‘mouse-3’ + Like ‘mouse-2’, but force file links to be opened with Emacs, and + internal links to be displayed in another window(6). + +‘C-c %’ (‘org-mark-ring-push’) + Push the current position onto the Org mark ring, to be able to + return easily. Commands following an internal link do this + automatically. + +‘C-c &’ (‘org-mark-ring-goto’) + Jump back to a recorded position. A position is recorded by the + commands following internal links, and by ‘C-c %’. Using this + command several times in direct succession moves through a ring of + previously recorded positions. + +‘C-c C-x C-n’ (‘org-next-link’) +‘C-c C-x C-p’ (‘org-previous-link’) + Move forward/backward to the next link in the buffer. At the limit + of the buffer, the search fails once, and then wraps around. The + key bindings for this are really too long; you might want to bind + this also to ‘M-n’ and ‘M-p’. + + (with-eval-after-load 'org + (define-key org-mode-map (kbd "M-n") #'org-next-link) + (define-key org-mode-map (kbd "M-p") #'org-previous-link)) + + ---------- Footnotes ---------- + + (1) If the headline contains a timestamp, it is removed from the +link, which results in a wrong link—you should avoid putting a timestamp +in the headline. + + (2) The Org Id library must first be loaded, either through +‘org-customize’, by enabling ‘id’ in ‘org-modules’, or by adding +‘(require 'org-id)’ in your Emacs init file. + + (3) Note that you do not have to use this command to insert a link. +Links in Org are plain text, and you can type or paste them straight +into the buffer. By using this command, the links are automatically +enclosed in double brackets, and you will be asked for the optional +descriptive text. + + (4) After insertion of a stored link, the link will be removed from +the list of stored links. To keep it in the list for later use, use a +triple ‘C-u’ prefix argument to ‘C-c C-l’, or configure the option +‘org-link-keep-stored-after-insertion’. + + (5) This works if a function has been defined in the ‘:complete’ +property of a link in ‘org-link-parameters’. + + (6) See the variable ‘org-link-use-indirect-buffer-for-internals’. + + +File: org.info, Node: Using Links Outside Org, Next: Link Abbreviations, Prev: Handling Links, Up: Hyperlinks + +4.6 Using Links Outside Org +=========================== + +You can insert and follow links that have Org syntax not only in Org, +but in any Emacs buffer. For this, Org provides two functions: +‘org-insert-link-global’ and ‘org-open-at-point-global’. + + You might want to bind them to globally available keys. See *note +Activation:: for some advice. + + +File: org.info, Node: Link Abbreviations, Next: Search Options, Prev: Using Links Outside Org, Up: Hyperlinks + +4.7 Link Abbreviations +====================== + +Long URL can be cumbersome to type, and often many similar links are +needed in a document. For this you can use link abbreviations. An +abbreviated link looks like this + + [[linkword:tag][description]] + +where the tag is optional. The _linkword_ must be a word, starting with +a letter, followed by letters, numbers, ‘-’, and ‘_’. Abbreviations are +resolved according to the information in the variable +‘org-link-abbrev-alist’ that relates the linkwords to replacement text. +Here is an example: + + (setq org-link-abbrev-alist + '(("bugzilla" . "http://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" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1") + ("ads" . "https://ui.adsabs.harvard.edu/search/q=%20author%3A\"%s\""))) + + If the replacement text contains the string ‘%s’, it is replaced with +the tag. Using ‘%h’ instead of ‘%s’ percent-encodes the tag (see the +example above, where we need to encode the URL parameter). Using +‘%(my-function)’ passes the tag to a custom Lisp function, and replace +it by the resulting string. + + If the replacement text do not contain any specifier, it is simply +appended to the string in order to create the link. + + Instead of a string, you may also specify a Lisp function to create +the link. Such a function will be called with the tag as the only +argument. + + With the above setting, you could link to a specific bug with +‘[[bugzilla:129]]’, search the web for ‘OrgMode’ with +‘[[duckduckgo:OrgMode]]’, show the map location of the Free Software +Foundation ‘[[gmap:51 Franklin Street, Boston]]’ or of Carsten office +‘[[omap:Science Park 904, Amsterdam, The Netherlands]]’ and find out +what the Org author is doing besides Emacs hacking with +‘[[ads:Dominik,C]]’. + + If you need special abbreviations just for a single Org buffer, you +can define them in the file with + + #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id= + #+LINK: duckduckgo https://duckduckgo.com/?q=%s + + In-buffer completion (see *note Completion::) can be used after ‘[’ +to complete link abbreviations. You may also define a Lisp function +that implements special (e.g., completion) support for inserting such a +link with ‘C-c C-l’. Such a function should not accept any arguments, +and should return the full link with a prefix. You can set the link +completion function like this: + + (org-link-set-parameter "type" :complete #'some-completion-function) + + +File: org.info, Node: Search Options, Next: Custom Searches, Prev: Link Abbreviations, Up: Hyperlinks + +4.8 Search Options in File Links +================================ + +File links can contain additional information to make Emacs jump to a +particular location in the file when following a link. This can be a +line number or a search option after a double colon(1). For example, +when the command ‘org-store-link’ creates a link (see *note Handling +Links::) to a file, it encodes the words in the current line as a search +string that can be used to find this line back later when following the +link with ‘C-c C-o’. + + Note that all search options apply for Attachment links in the same +way that they apply for File links. + + Here is the syntax of the different ways to attach a search to a file +link, together with explanations for each: + + [[file:~/code/main.c::255]] + [[file:~/xx.org::My Target]] + [[file:~/xx.org::*My Target]] + [[file:~/xx.org::#my-custom-id]] + [[file:~/xx.org::/regexp/]] + [[attachment:main.c::255]] + +‘255’ + Jump to line 255. + +‘My Target’ + Search for a link target ‘<<My Target>>’, or do a text search for + ‘my target’, similar to the search in internal links, see *note + Internal Links::. In HTML export (see *note HTML Export::), such a + file link becomes a HTML reference to the corresponding named + anchor in the linked file. + +‘*My Target’ + In an Org file, restrict search to headlines. + +‘#my-custom-id’ + Link to a heading with a ‘CUSTOM_ID’ property + +‘/REGEXP/’ + Do a regular expression search for REGEXP (see *note Regular + Expressions::). This uses the Emacs command ‘occur’ to list all + matches in a separate window. If the target file is in Org mode, + ‘org-occur’ is used to create a sparse tree with the matches. + + As a degenerate case, a file link with an empty file name can be used +to search the current file. For example, ‘[[file:::find me]]’ does a +search for ‘find me’ in the current file, just as ‘[[find me]]’ would. + + ---------- Footnotes ---------- + + (1) For backward compatibility, line numbers can also follow a single +colon. + + +File: org.info, Node: Custom Searches, Prev: Search Options, Up: Hyperlinks + +4.9 Custom Searches +=================== + +The default mechanism for creating search strings and for doing the +actual search related to a file link may not work correctly in all +cases. For example, BibTeX database files have many entries like +‘year="1993"’ which would not result in good search strings, because the +only unique identification for a BibTeX entry is the citation key. + + If you come across such a problem, you can write custom functions to +set the right search string for a particular file type, and to do the +search for the string in the file. Using ‘add-hook’, these functions +need to be added to the hook variables +‘org-create-file-search-functions’ and +‘org-execute-file-search-functions’. See the docstring for these +variables for more information. Org actually uses this mechanism for +BibTeX database files, and you can use the corresponding code as an +implementation example. See the file ‘ol-bibtex.el’. + + +File: org.info, Node: TODO Items, Next: Tags, Prev: Hyperlinks, Up: Top + +5 TODO Items +************ + +Org mode does not maintain TODO lists as separate documents(1). +Instead, TODO items are an integral part of the notes file, because TODO +items usually come up while taking notes! With Org mode, simply mark +any entry in a tree as being a TODO item. In this way, information is +not duplicated, and the entire context from which the TODO item emerged +is always present. + + Of course, this technique for managing TODO items scatters them +throughout your notes file. Org mode compensates for this by providing +methods to give you an overview of all the things that you have to do. + +* Menu: + +* TODO Basics:: Marking and displaying TODO entries. +* TODO Extensions:: Workflow and assignments. +* Progress Logging:: Dates and notes for progress. +* Priorities:: Some things are more important than others. +* Breaking Down Tasks:: Splitting a task into manageable pieces. +* Checkboxes:: Tick-off lists. + + ---------- Footnotes ---------- + + (1) Of course, you can make a document that contains only long lists +of TODO items, but this is not required. + + +File: org.info, Node: TODO Basics, Next: TODO Extensions, Up: TODO Items + +5.1 Basic TODO Functionality +============================ + +Any headline becomes a TODO item when it starts with the word ‘TODO’, +for example: + + *** TODO Write letter to Sam Fortune + + The most important commands to work with TODO entries are: + +‘C-c C-t’ (‘org-todo’) + Rotate the TODO state of the current item among + + ,-> (unmarked) -> TODO -> DONE --. + '--------------------------------' + + If TODO keywords have fast access keys (see *note Fast access to + TODO states::), prompt for a TODO keyword through the fast + selection interface; this is the default behavior when + ‘org-use-fast-todo-selection’ is non-‘nil’. + + The same state changing can also be done “remotely” from the agenda + buffer with the ‘t’ command key (see *note Agenda Commands::). + +‘S-<RIGHT>’ ‘S-<LEFT>’ + Select the following/preceding TODO state, similar to cycling. + Useful mostly if more than two TODO states are possible (see *note + TODO Extensions::). See also *note Conflicts::, for a discussion + of the interaction with shift-selection. See also the variable + ‘org-treat-S-cursor-todo-selection-as-state-change’. + +‘C-c / t’ (‘org-show-todo-tree’) + View TODO items in a _sparse tree_ (see *note Sparse Trees::). + Folds the entire buffer, but shows all TODO items—with not-DONE + state—and the headings hierarchy above them. With a prefix + argument, or by using ‘C-c / T’, search for a specific TODO. You + are prompted for the keyword, and you can also give a list of + keywords like ‘KWD1|KWD2|...’ to list entries that match any one of + these keywords. With a numeric prefix argument N, show the tree + for the Nth keyword in the variable ‘org-todo-keywords’. With two + prefix arguments, find all TODO states, both un-done and done. + +‘M-x org-agenda t’ (‘org-todo-list’) + Show the global TODO list. Collects the TODO items (with not-DONE + states) from all agenda files (see *note Agenda Views::) into a + single buffer. The new buffer is in Org Agenda mode, which + provides commands to examine and manipulate the TODO entries from + the new buffer (see *note Agenda Commands::). See *note Global + TODO list::, for more information. + +‘S-M-<RET>’ (‘org-insert-todo-heading’) + Insert a new TODO entry below the current one. + + Changing a TODO state can also trigger tag changes. See the +docstring of the option ‘org-todo-state-tags-triggers’ for details. + + +File: org.info, Node: TODO Extensions, Next: Progress Logging, Prev: TODO Basics, Up: TODO Items + +5.2 Extended Use of TODO Keywords +================================= + +By default, marked TODO entries have one of only two states: TODO and +DONE. Org mode allows you to classify TODO items in more complex ways +with _TODO keywords_ (stored in ‘org-todo-keywords’). With special +setup, the TODO keyword system can work differently in different files. + + Note that _tags_ are another way to classify headlines in general and +TODO items in particular (see *note Tags::). + +* Menu: + +* Workflow states:: From TODO to DONE in steps. +* TODO types:: I do this, Fred does the rest. +* Multiple sets in one file:: Mixing it all, still finding your way. +* Fast access to TODO states:: Single letter selection of state. +* Per-file keywords:: Different files, different requirements. +* Faces for TODO keywords:: Highlighting states. +* TODO dependencies:: When one task needs to wait for others. + + +File: org.info, Node: Workflow states, Next: TODO types, Up: TODO Extensions + +5.2.1 TODO keywords as workflow states +-------------------------------------- + +You can use TODO keywords to indicate different, possibly _sequential_ +states in the process of working on an item, for example(1): + + (setq org-todo-keywords + '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED"))) + + The vertical bar separates the TODO keywords (states that _need +action_) from the DONE states (which need _no further action_). If you +do not provide the separator bar, the last state is used as the DONE +state. + + With this setup, the command ‘C-c C-t’ cycles an entry from ‘TODO’ to +‘FEEDBACK’, then to ‘VERIFY’, and finally to ‘DONE’ and ‘DELEGATED’. +You may also use a numeric prefix argument to quickly select a specific +state. For example ‘C-3 C-c C-t’ changes the state immediately to +‘VERIFY’. Or you can use ‘S-<RIGHT>’ and ‘S-<LEFT>’ to go forward and +backward through the states. If you define many keywords, you can use +in-buffer completion (see *note Completion::) or a special one-key +selection scheme (see *note Fast access to TODO states::) to insert +these words into the buffer. Changing a TODO state can be logged with a +timestamp, see *note Tracking TODO state changes::, for more +information. + + ---------- Footnotes ---------- + + (1) Changing the variable ‘org-todo-keywords’ only becomes effective +after restarting Org mode in a buffer. + + +File: org.info, Node: TODO types, Next: Multiple sets in one file, Prev: Workflow states, Up: TODO Extensions + +5.2.2 TODO keywords as types +---------------------------- + +The second possibility is to use TODO keywords to indicate different +_types_ of action items. For example, you might want to indicate that +items are for “work” or “home”. Or, when you work with several people +on a single project, you might want to assign action items directly to +persons, by using their names as TODO keywords. This type of +functionality is actually much better served by using tags (see *note +Tags::), so the TODO implementation is kept just for backward +compatibility. + + Using TODO types, it would be set up like this: + + (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE"))) + + In this case, different keywords do not indicate states, but rather +different types. So the normal work flow would be to assign a task to a +person, and later to mark it DONE. Org mode supports this style by +adapting the workings of the command ‘C-c C-t’(1). When used several +times in succession, it still cycles through all names, in order to +first select the right type for a task. But when you return to the item +after some time and execute ‘C-c C-t’ again, it will switch from any +name directly to ‘DONE’. Use prefix arguments or completion to quickly +select a specific name. You can also review the items of a specific +TODO type in a sparse tree by using a numeric prefix to ‘C-c / t’. For +example, to see all things Lucy has to do, you would use ‘C-3 C-c / t’. +To collect Lucy’s items from all agenda files into a single buffer, you +would use the numeric prefix argument as well when creating the global +TODO list: ‘C-3 M-x org-agenda t’. + + ---------- Footnotes ---------- + + (1) This is also true for the ‘t’ command in the agenda buffer. + + +File: org.info, Node: Multiple sets in one file, Next: Fast access to TODO states, Prev: TODO types, Up: TODO Extensions + +5.2.3 Multiple keyword sets in one file +--------------------------------------- + +Sometimes you may want to use different sets of TODO keywords in +parallel. For example, you may want to have the basic TODO/DONE, but +also a workflow for bug fixing, and a separate state indicating that an +item has been canceled—so it is not DONE, but also does not require +action. Your setup would then look like this: + + (setq org-todo-keywords + '((sequence "TODO" "|" "DONE") + (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED") + (sequence "|" "CANCELED"))) + + The keywords should all be different, this helps Org mode keep track +of which subsequence should be used for a given entry. In this setup, +‘C-c C-t’ only operates within a sub-sequence, so it switches from +‘DONE’ to (nothing) to ‘TODO’, and from ‘FIXED’ to (nothing) to +‘REPORT’. Therefore you need a mechanism to initially select the +correct sequence. In addition to typing a keyword or using completion +(see *note Completion::), you may also apply the following commands: + +‘C-u C-u C-c C-t’ +‘C-S-<RIGHT>’ +‘C-S-<LEFT>’ + These keys jump from one TODO sub-sequence to the next. In the + above example, ‘C-u C-u C-c C-t’ or ‘C-S-<RIGHT>’ would jump from + ‘TODO’ or ‘DONE’ to ‘REPORT’, and any of the words in the second + row to ‘CANCELED’. Note that the ‘C-S-’ key binding conflict with + shift-selection (see *note Conflicts::). + +‘S-<RIGHT>’ +‘S-<LEFT>’ + ‘S-<LEFT>’ and ‘S-<RIGHT>’ walk through _all_ keywords from all + sub-sequences, so for example ‘S-<RIGHT>’ would switch from ‘DONE’ + to ‘REPORT’ in the example above. For a discussion of the + interaction with shift-selection, see *note Conflicts::. + + +File: org.info, Node: Fast access to TODO states, Next: Per-file keywords, Prev: Multiple sets in one file, Up: TODO Extensions + +5.2.4 Fast access to TODO states +-------------------------------- + +If you would like to quickly change an entry to an arbitrary TODO state +instead of cycling through the states, you can set up keys for +single-letter access to the states. This is done by adding the +selection character after each keyword, in parentheses(1). For example: + + (setq org-todo-keywords + '((sequence "TODO(t)" "|" "DONE(d)") + (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)") + (sequence "|" "CANCELED(c)"))) + + If you then press ‘C-c C-t’ followed by the selection key, the entry +is switched to this state. ‘<SPC>’ can be used to remove any TODO +keyword from an entry(2). + + ---------- Footnotes ---------- + + (1) All characters are allowed except ‘@’, ‘^’ and ‘!’, which have a +special meaning here. + + (2) Check also the variable ‘org-fast-tag-selection-include-todo’, it +allows you to change the TODO state through the tags interface (see +*note Setting Tags::), in case you like to mingle the two concepts. +Note that this means you need to come up with unique keys across both +sets of keywords. + + +File: org.info, Node: Per-file keywords, Next: Faces for TODO keywords, Prev: Fast access to TODO states, Up: TODO Extensions + +5.2.5 Setting up keywords for individual files +---------------------------------------------- + +It can be very useful to use different aspects of the TODO mechanism in +different files. For file-local settings, you need to add special lines +to the file which set the keywords and interpretation for that file +only. For example, to set one of the two examples discussed above, you +need one of the following lines, starting in column zero anywhere in the +file: + + #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED + + You may also write ‘#+SEQ_TODO’ to be explicit about the +interpretation, but it means the same as ‘#+TODO’, or + + #+TYP_TODO: Fred Sara Lucy Mike | DONE + + A setup for using several sets in parallel would be: + + #+TODO: TODO(t) | DONE(d) + #+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f) + #+TODO: | CANCELED(c) + + To make sure you are using the correct keyword, type ‘#+’ into the +buffer and then use ‘M-<TAB>’ to complete it (see *note Completion::). + + Remember that the keywords after the vertical bar—or the last keyword +if no bar is there—must always mean that the item is DONE, although you +may use a different word. After changing one of these lines, use ‘C-c +C-c’ with point still in the line to make the changes known to Org +mode(1). + + ---------- Footnotes ---------- + + (1) Org mode parses these lines only when Org mode is activated after +visiting a file. ‘C-c C-c’ with point in a line starting with ‘#+’ is +simply restarting Org mode for the current buffer. + + +File: org.info, Node: Faces for TODO keywords, Next: TODO dependencies, Prev: Per-file keywords, Up: TODO Extensions + +5.2.6 Faces for TODO keywords +----------------------------- + +Org mode highlights TODO keywords with special faces: ‘org-todo’ for +keywords indicating that an item still has to be acted upon, and +‘org-done’ for keywords indicating that an item is finished. If you are +using more than two different states, you might want to use special +faces for some of them. This can be done using the variable +‘org-todo-keyword-faces’. For example: + + (setq org-todo-keyword-faces + '(("TODO" . org-warning) ("STARTED" . "yellow") + ("CANCELED" . (:foreground "blue" :weight bold)))) + + While using a list with face properties as shown for ‘CANCELED’ +_should_ work, this does not always seem to be the case. If necessary, +define a special face and use that. A string is interpreted as a color. +The variable ‘org-faces-easy-properties’ determines if that color is +interpreted as a foreground or a background color. + + +File: org.info, Node: TODO dependencies, Prev: Faces for TODO keywords, Up: TODO Extensions + +5.2.7 TODO dependencies +----------------------- + +The structure of Org files—hierarchy and lists—makes it easy to define +TODO dependencies. Usually, a parent TODO task should not be marked as +done until all TODO subtasks, or children tasks, are marked as done. +Sometimes there is a logical sequence to (sub)tasks, so that one subtask +cannot be acted upon before all siblings above it have been marked as +done. If you customize the variable ‘org-enforce-todo-dependencies’, +Org blocks entries from changing state to DONE while they have TODO +children that are not DONE. Furthermore, if an entry has a property +‘ORDERED’, each of its TODO children is blocked until all earlier +siblings are marked as done. Here is an example: + + * TODO Blocked until (two) is done + ** DONE one + ** TODO two + + * Parent + :PROPERTIES: + :ORDERED: t + :END: + ** TODO a + ** TODO b, needs to wait for (a) + ** TODO c, needs to wait for (a) and (b) + + You can ensure an entry is never blocked by using the ‘NOBLOCKING’ +property (see *note Properties and Columns::): + + * This entry is never blocked + :PROPERTIES: + :NOBLOCKING: t + :END: + +‘C-c C-x o’ (‘org-toggle-ordered-property’) + Toggle the ‘ORDERED’ property of the current entry. A property is + used for this behavior because this should be local to the current + entry, not inherited from entries above like a tag (see *note + Tags::). However, if you would like to _track_ the value of this + property with a tag for better visibility, customize the variable + ‘org-track-ordered-property-with-tag’. + +‘C-u C-u C-u C-c C-t’ + Change TODO state, regardless of any state blocking. + + If you set the variable ‘org-agenda-dim-blocked-tasks’, TODO entries +that cannot be marked as done because of unmarked children are shown in +a dimmed font or even made invisible in agenda views (see *note Agenda +Views::). + + You can also block changes of TODO states by using checkboxes (see +*note Checkboxes::). If you set the variable +‘org-enforce-todo-checkbox-dependencies’, an entry that has unchecked +checkboxes is blocked from switching to DONE. + + If you need more complex dependency structures, for example +dependencies between entries in different trees or files, check out the +module ‘org-depend.el’ in the ‘org-contrib’ repository. + + +File: org.info, Node: Progress Logging, Next: Priorities, Prev: TODO Extensions, Up: TODO Items + +5.3 Progress Logging +==================== + +To record a timestamp and a note when changing a TODO state, call the +command ‘org-todo’ with a prefix argument. + +‘C-u C-c C-t’ (‘org-todo’) + Prompt for a note and record a the time of the TODO state change. + The note is inserted as a list item below the headline, but can + also be placed into a drawer, see *note Tracking TODO state + changes::. + + If you want to be more systematic, Org mode can automatically record +a timestamp and optionally a note when you mark a TODO item as DONE, or +even each time you change the state of a TODO item. This system is +highly configurable, settings can be on a per-keyword basis and can be +localized to a file or even a subtree. For information on how to clock +working time for a task, see *note Clocking Work Time::. + +* Menu: + +* Closing items:: When was this entry marked as done? +* Tracking TODO state changes:: When did the status change? +* Tracking your habits:: How consistent have you been? + + +File: org.info, Node: Closing items, Next: Tracking TODO state changes, Up: Progress Logging + +5.3.1 Closing items +------------------- + +The most basic automatic logging is to keep track of _when_ a certain +TODO item was marked as done. This can be achieved with(1) + + (setq org-log-done 'time) + +Then each time you turn an entry from a TODO (not-done) state into any +of the DONE states, a line ‘CLOSED: [timestamp]’ is inserted just after +the headline. If you turn the entry back into a TODO item through +further state cycling, that line is removed again. If you turn the +entry back to a non-TODO state (by pressing ‘C-c C-t <SPC>’ for +example), that line is also removed, unless you set +‘org-closed-keep-when-no-todo’ to non-‘nil’. If you want to record a +note along with the timestamp, use(2) + + (setq org-log-done 'note) + +You are then prompted for a note, and that note is stored below the +entry with a ‘Closing Note’ heading. + + ---------- Footnotes ---------- + + (1) The corresponding in-buffer setting is: ‘#+STARTUP: logdone’. + + (2) The corresponding in-buffer setting is: ‘#+STARTUP: lognotedone’. + + +File: org.info, Node: Tracking TODO state changes, Next: Tracking your habits, Prev: Closing items, Up: Progress Logging + +5.3.2 Tracking TODO state changes +--------------------------------- + +You might want to automatically keep track of when a state change +occurred and maybe take a note about this change. You can either record +just a timestamp, or a time-stamped note. These records are inserted +after the headline as an itemized list, newest first(1). When taking a +lot of notes, you might want to get the notes out of the way into a +drawer (see *note Drawers::). Customize the variable +‘org-log-into-drawer’ to get this behavior—the recommended drawer for +this is called ‘LOGBOOK’(2). You can also overrule the setting of this +variable for a subtree by setting a ‘LOG_INTO_DRAWER’ property. + + Since it is normally too much to record a note for every state, Org +mode expects configuration on a per-keyword basis for this. This is +achieved by adding special markers ‘!’ (for a timestamp) or ‘@’ (for a +note with timestamp) in parentheses after each keyword. For example, +with the setting + + (setq org-todo-keywords + '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)"))) + + You not only define global TODO keywords and fast access keys, but +also request that a time is recorded when the entry is set to ‘DONE’, +and that a note is recorded when switching to ‘WAIT’ or ‘CANCELED’(3). +The setting for ‘WAIT’ is even more special: the ‘!’ after the slash +means that in addition to the note taken when entering the state, a +timestamp should be recorded when _leaving_ the ‘WAIT’ state, if and +only if the _target_ state does not configure logging for entering it. +So it has no effect when switching from ‘WAIT’ to ‘DONE’, because ‘DONE’ +is configured to record a timestamp only. But when switching from +‘WAIT’ back to ‘TODO’, the ‘/!’ in the ‘WAIT’ setting now triggers a +timestamp even though ‘TODO’ has no logging configured. + + You can use the exact same syntax for setting logging preferences +local to a buffer: + + #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@) + + To record a timestamp without a note for TODO keywords configured +with ‘@’, just type ‘C-c C-c’ to enter a blank note when prompted. + + In order to define logging settings that are local to a subtree or a +single item, define a ‘LOGGING’ property in this entry. Any non-empty +‘LOGGING’ property resets all logging settings to ‘nil’. You may then +turn on logging for this specific tree using ‘STARTUP’ keywords like +‘lognotedone’ or ‘logrepeat’, as well as adding state specific settings +like ‘TODO(!)’. For example: + + * TODO Log each state with only a time + :PROPERTIES: + :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!) + :END: + * TODO Only log when switching to WAIT, and when repeating + :PROPERTIES: + :LOGGING: WAIT(@) logrepeat + :END: + * TODO No logging at all + :PROPERTIES: + :LOGGING: nil + :END: + + ---------- Footnotes ---------- + + (1) See the variable ‘org-log-states-order-reversed’. + + (2) Note that the ‘LOGBOOK’ drawer is unfolded when pressing ‘<SPC>’ +in the agenda to show an entry—use ‘C-u <SPC>’ to keep it folded here. + + (3) It is possible that Org mode records two timestamps when you are +using both ‘org-log-done’ and state change logging. However, it never +prompts for two notes: if you have configured both, the state change +recording note takes precedence and cancel the closing note. + + +File: org.info, Node: Tracking your habits, Prev: Tracking TODO state changes, Up: Progress Logging + +5.3.3 Tracking your habits +-------------------------- + +Org has the ability to track the consistency of a special category of +TODO, called “habits.” To use habits, you have to enable the ‘habits’ +module by customizing the variable ‘org-modules’. + + A habit has the following properties: + + 1. The habit is a TODO item, with a TODO keyword representing an open + state. + + 2. The property ‘STYLE’ is set to the value ‘habit’ (see *note + Properties and Columns::). + + 3. The TODO has a scheduled date, usually with a ‘.+’ style repeat + interval. A ‘++’ style may be appropriate for habits with time + constraints, e.g., must be done on weekends, or a ‘+’ style for an + unusual habit that can have a backlog, e.g., weekly reports. + + 4. The TODO may also have minimum and maximum ranges specified by + using the syntax ‘.+2d/3d’, which says that you want to do the task + at least every three days, but at most every two days. + + 5. State logging for the DONE state is enabled (see *note Tracking + TODO state changes::), in order for historical data to be + represented in the consistency graph. If it is not enabled it is + not an error, but the consistency graphs are largely meaningless. + + To give you an idea of what the above rules look like in action, +here’s an actual habit with some history: + + ** TODO Shave + SCHEDULED: <2009-10-17 Sat .+2d/4d> + :PROPERTIES: + :STYLE: habit + :LAST_REPEAT: [2009-10-19 Mon 00:36] + :END: + - State "DONE" from "TODO" [2009-10-15 Thu] + - State "DONE" from "TODO" [2009-10-12 Mon] + - State "DONE" from "TODO" [2009-10-10 Sat] + - State "DONE" from "TODO" [2009-10-04 Sun] + - State "DONE" from "TODO" [2009-10-02 Fri] + - State "DONE" from "TODO" [2009-09-29 Tue] + - State "DONE" from "TODO" [2009-09-25 Fri] + - State "DONE" from "TODO" [2009-09-19 Sat] + - State "DONE" from "TODO" [2009-09-16 Wed] + - State "DONE" from "TODO" [2009-09-12 Sat] + + What this habit says is: I want to shave at most every 2 days—given +by the ‘SCHEDULED’ date and repeat interval—and at least every 4 days. +If today is the 15th, then the habit first appears in the agenda (see +*note Agenda Views::) on Oct 17, after the minimum of 2 days has +elapsed, and will appear overdue on Oct 19, after four days have +elapsed. + + What’s really useful about habits is that they are displayed along +with a consistency graph, to show how consistent you’ve been at getting +that task done in the past. This graph shows every day that the task +was done over the past three weeks, with colors for each day. The +colors used are: + +Blue + If the task was not to be done yet on that day. +Green + If the task could have been done on that day. +Yellow + If the task was going to be overdue the next day. +Red + If the task was overdue on that day. + + In addition to coloring each day, the day is also marked with an +asterisk if the task was actually done that day, and an exclamation mark +to show where the current day falls in the graph. + + There are several configuration variables that can be used to change +the way habits are displayed in the agenda. + +‘org-habit-graph-column’ + The buffer column at which the consistency graph should be drawn. + This overwrites any text in that column, so it is a good idea to + keep your habits’ titles brief and to the point. + +‘org-habit-preceding-days’ + The amount of history, in days before today, to appear in + consistency graphs. + +‘org-habit-following-days’ + The number of days after today that appear in consistency graphs. + +‘org-habit-show-habits-only-for-today’ + If non-‘nil’, only show habits in today’s agenda view. The default + value is ‘t’. Pressing ‘C-u K’ in the agenda toggles this + variable. + + Lastly, pressing ‘K’ in the agenda buffer causes habits to +temporarily be disabled and do not appear at all. Press ‘K’ again to +bring them back. They are also subject to tag filtering, if you have +habits which should only be done in certain contexts, for example. + + +File: org.info, Node: Priorities, Next: Breaking Down Tasks, Prev: Progress Logging, Up: TODO Items + +5.4 Priorities +============== + +If you use Org mode extensively, you may end up with enough TODO items +that it starts to make sense to prioritize them. Prioritizing can be +done by placing a _priority cookie_ into the headline of a TODO item +right after the TODO keyword, like this: + + *** TODO [#A] Write letter to Sam Fortune + + By default, Org mode supports three priorities: ‘A’, ‘B’, and ‘C’. +‘A’ is the highest priority. An entry without a cookie is treated as +equivalent if it had priority ‘B’. Priorities make a difference only +for sorting in the agenda (see *note Weekly/daily agenda::). Outside +the agenda, they have no inherent meaning to Org mode. The cookies are +displayed with the face defined by the variable ‘org-priority-faces’, +which can be customized. + + You can also use numeric values for priorities, such as + + *** TODO [#1] Write letter to Sam Fortune + + When using numeric priorities, you need to set +‘org-priority-highest’, ‘org-priority-lowest’ and ‘org-priority-default’ +to integers, which must all be strictly inferior to 65. + + Priorities can be attached to any outline node; they do not need to +be TODO items. + +‘C-c ,’ (‘org-priority’) + Set the priority of the current headline. The command prompts for + a priority character ‘A’, ‘B’ or ‘C’. When you press ‘<SPC>’ + instead, the priority cookie, if one is set, is removed from the + headline. The priorities can also be changed “remotely” from the + agenda buffer with the ‘,’ command (see *note Agenda Commands::). + +‘S-<UP>’ (‘org-priority-up’) +‘S-<DOWN>’ (‘org-priority-down’) + Increase/decrease the priority of the current headline(1). Note + that these keys are also used to modify timestamps (see *note + Creating Timestamps::). See also *note Conflicts::, for a + discussion of the interaction with shift-selection. + + You can change the range of allowed priorities by setting the +variables ‘org-priority-highest’, ‘org-priority-lowest’, and +‘org-priority-default’. For an individual buffer, you may set these +values (highest, lowest, default) like this (please make sure that the +highest priority is earlier in the alphabet than the lowest priority): + + #+PRIORITIES: A C B + + Or, using numeric values: + + #+PRIORITIES: 1 10 5 + + ---------- Footnotes ---------- + + (1) See also the option ‘org-priority-start-cycle-with-default’. + + +File: org.info, Node: Breaking Down Tasks, Next: Checkboxes, Prev: Priorities, Up: TODO Items + +5.5 Breaking Down Tasks into Subtasks +===================================== + +It is often advisable to break down large tasks into smaller, manageable +subtasks. You can do this by creating an outline tree below a TODO +item, with detailed subtasks on the tree(1). To keep an overview of the +fraction of subtasks that have already been marked as done, insert +either ‘[/]’ or ‘[%]’ anywhere in the headline. These cookies are +updated each time the TODO status of a child changes, or when pressing +‘C-c C-c’ on the cookie. For example: + + * Organize Party [33%] + ** TODO Call people [1/2] + *** TODO Peter + *** DONE Sarah + ** TODO Buy food + ** DONE Talk to neighbor + + If a heading has both checkboxes and TODO children below it, the +meaning of the statistics cookie become ambiguous. Set the property +‘COOKIE_DATA’ to either ‘checkbox’ or ‘todo’ to resolve this issue. + + If you would like to have the statistics cookie count any TODO +entries in the subtree (not just direct children), configure the +variable ‘org-hierarchical-todo-statistics’. To do this for a single +subtree, include the word ‘recursive’ into the value of the +‘COOKIE_DATA’ property. + + * Parent capturing statistics [2/20] + :PROPERTIES: + :COOKIE_DATA: todo recursive + :END: + + If you would like a TODO entry to automatically change to DONE when +all children are done, you can use the following setup: + + (defun org-summary-todo (n-done n-not-done) + "Switch entry to DONE when all subentries are done, to TODO otherwise." + (let (org-log-done org-log-states) ; turn off logging + (org-todo (if (= n-not-done 0) "DONE" "TODO")))) + + (add-hook 'org-after-todo-statistics-hook #'org-summary-todo) + + Another possibility is the use of checkboxes to identify (a hierarchy +of) a large number of subtasks (see *note Checkboxes::). + + ---------- Footnotes ---------- + + (1) To keep subtasks out of the global TODO list, see the option +‘org-agenda-todo-list-sublevels’. + + +File: org.info, Node: Checkboxes, Prev: Breaking Down Tasks, Up: TODO Items + +5.6 Checkboxes +============== + +Every item in a plain list(1) (see *note Plain Lists::) can be made into +a checkbox by starting it with the string ‘[ ]’. This feature is +similar to TODO items (see *note TODO Items::), but is more lightweight. +Checkboxes are not included into the global TODO list, so they are often +great to split a task into a number of simple steps. Or you can use +them in a shopping list. + + Here is an example of a checkbox list. + + * TODO Organize party [2/4] + - [-] call people [1/3] + - [ ] Peter + - [X] Sarah + - [ ] Sam + - [X] order food + - [ ] think about what music to play + - [X] talk to the neighbors + + Checkboxes work hierarchically, so if a checkbox item has children +that are checkboxes, toggling one of the children checkboxes makes the +parent checkbox reflect if none, some, or all of the children are +checked. + + The ‘[2/4]’ and ‘[1/3]’ in the first and second line are cookies +indicating how many checkboxes present in this entry have been checked +off, and the total number of checkboxes present. This can give you an +idea on how many checkboxes remain, even without opening a folded entry. +The cookies can be placed into a headline or into (the first line of) a +plain list item. Each cookie covers checkboxes of direct children +structurally below the headline/item on which the cookie appears(2). +You have to insert the cookie yourself by typing either ‘[/]’ or ‘[%]’. +With ‘[/]’ you get an ‘n out of m’ result, as in the examples above. +With ‘[%]’ you get information about the percentage of checkboxes +checked (in the above example, this would be ‘[50%]’ and ‘[33%]’, +respectively). In a headline, a cookie can count either checkboxes +below the heading or TODO states of children, and it displays whatever +was changed last. Set the property ‘COOKIE_DATA’ to either ‘checkbox’ +or ‘todo’ to resolve this issue. + + If the current outline node has an ‘ORDERED’ property, checkboxes +must be checked off in sequence, and an error is thrown if you try to +check off a box while there are unchecked boxes above it. + + The following commands work with checkboxes: + +‘C-c C-c’ (‘org-toggle-checkbox’) + Toggle checkbox status or—with prefix argument—checkbox presence at + point. With a single prefix argument, add an empty checkbox or + remove the current one(3). With a double prefix argument, set it + to ‘[-]’, which is considered to be an intermediate state. + +‘C-c C-x C-b’ (‘org-toggle-checkbox’) + Toggle checkbox status or—with prefix argument—checkbox presence at + point. With double prefix argument, set it to ‘[-]’, which is + considered to be an intermediate state. + + • If there is an active region, toggle the first checkbox in the + region and set all remaining boxes to the same status as the + first. With a prefix argument, add or remove the checkbox for + all items in the region. + + • If point is in a headline, toggle checkboxes in the region + between this headline and the next—so _not_ the entire + subtree. + + • If there is no active region, just toggle the checkbox at + point. + +‘C-c C-x C-r’ (‘org-toggle-radio-button’) + Toggle checkbox status by using the checkbox of the item at point + as a radio button: when the checkbox is turned on, all other + checkboxes on the same level will be turned off. With a universal + prefix argument, toggle the presence of the checkbox. With a + double prefix argument, set it to ‘[-]’. + + ‘C-c C-c’ can be told to consider checkboxes as radio buttons by + setting ‘#+ATTR_ORG: :radio t’ right before the list or by calling + ‘M-x org-list-checkbox-radio-mode’ to activate this minor mode. + +‘M-S-<RET>’ (‘org-insert-todo-heading’) + Insert a new item with a checkbox. This works only if point is + already in a plain list item (see *note Plain Lists::). + +‘C-c C-x o’ (‘org-toggle-ordered-property’) + Toggle the ‘ORDERED’ property of the entry, to toggle if checkboxes + must be checked off in sequence. A property is used for this + behavior because this should be local to the current entry, not + inherited like a tag. However, if you would like to _track_ the + value of this property with a tag for better visibility, customize + ‘org-track-ordered-property-with-tag’. + +‘C-c #’ (‘org-update-statistics-cookies’) + Update the statistics cookie in the current outline entry. When + called with a ‘C-u’ prefix, update the entire file. Checkbox + statistic cookies are updated automatically if you toggle + checkboxes with ‘C-c C-c’ and make new ones with ‘M-S-<RET>’. TODO + statistics cookies update when changing TODO states. If you delete + boxes/entries or add/change them by hand, use this command to get + things back into sync. + + ---------- Footnotes ---------- + + (1) With the exception of description lists. But you can allow it by +modifying ‘org-list-automatic-rules’ accordingly. + + (2) Set the variable ‘org-hierarchical-checkbox-statistics’ if you +want such cookies to count all checkboxes below the cookie, not just +those belonging to direct children. + + (3) ‘C-u C-c C-c’ on the _first_ item of a list with no checkbox adds +checkboxes to the rest of the list. + + +File: org.info, Node: Tags, Next: Properties and Columns, Prev: TODO Items, Up: Top + +6 Tags +****** + +An excellent way to implement labels and contexts for cross-correlating +information is to assign _tags_ to headlines. Org mode has extensive +support for tags. + + Every headline can contain a list of tags; they occur at the end of +the headline. Tags are normal words containing letters, numbers, ‘_’, +and ‘@’. Tags must be preceded and followed by a single colon, e.g., +‘:work:’. Several tags can be specified, as in ‘:work:urgent:’. Tags +by default are in bold face with the same color as the headline. You +may specify special faces for specific tags using the variable +‘org-tag-faces’, in much the same way as you can for TODO keywords (see +*note Faces for TODO keywords::). + +* Menu: + +* Tag Inheritance:: Tags use the tree structure of an outline. +* Setting Tags:: How to assign tags to a headline. +* Tag Hierarchy:: Create a hierarchy of tags. +* Tag Searches:: Searching for combinations of tags. + + +File: org.info, Node: Tag Inheritance, Next: Setting Tags, Up: Tags + +6.1 Tag Inheritance +=================== + +_Tags_ make use of the hierarchical structure of outline trees. If a +heading has a certain tag, all subheadings inherit the tag as well. For +example, in the list + + * Meeting with the French group :work: + ** Summary by Frank :boss:notes: + *** TODO Prepare slides for him :action: + +the final heading has the tags ‘work’, ‘boss’, ‘notes’, and ‘action’ +even though the final heading is not explicitly marked with those tags. +You can also set tags that all entries in a file should inherit just as +if these tags were defined in a hypothetical level zero that surrounds +the entire file. Use a line like this(1) + + #+FILETAGS: :Peter:Boss:Secret: + + To limit tag inheritance to specific tags, or to turn it off +entirely, use the variables ‘org-use-tag-inheritance’ and +‘org-tags-exclude-from-inheritance’. + + When a headline matches during a tags search while tag inheritance is +turned on, all the sublevels in the same tree—for a simple match +form—match as well(2). The list of matches may then become very long. +If you only want to see the first tags match in a subtree, configure the +variable ‘org-tags-match-list-sublevels’ (not recommended). + + Tag inheritance is relevant when the agenda search tries to match a +tag, either in the ‘tags’ or ‘tags-todo’ agenda types. In other agenda +types, ‘org-use-tag-inheritance’ has no effect. Still, you may want to +have your tags correctly set in the agenda, so that tag filtering works +fine, with inherited tags. Set ‘org-agenda-use-tag-inheritance’ to +control this: the default value includes all agenda types, but setting +this to ‘nil’ can really speed up agenda generation. + + ---------- Footnotes ---------- + + (1) As with all these in-buffer settings, pressing ‘C-c C-c’ +activates any changes in the line. + + (2) This is only true if the search does not involve more complex +tests including properties (see *note Property Searches::). + + +File: org.info, Node: Setting Tags, Next: Tag Hierarchy, Prev: Tag Inheritance, Up: Tags + +6.2 Setting Tags +================ + +Tags can simply be typed into the buffer at the end of a headline. +After a colon, ‘M-<TAB>’ offers completion on tags. There is also a +special command for inserting tags: + +‘C-c C-q’ (‘org-set-tags-command’) + Enter new tags for the current headline. Org mode either offers + completion or a special single-key interface for setting tags, see + below. After pressing ‘<RET>’, the tags are inserted and aligned + to ‘org-tags-column’. When called with a ‘C-u’ prefix, all tags in + the current buffer are aligned to that column, just to make things + look nice. Tags are automatically realigned after promotion, + demotion, and TODO state changes (see *note TODO Basics::). + +‘C-c C-c’ (‘org-set-tags-command’) + When point is in a headline, this does the same as ‘C-c C-q’. + + Org supports tag insertion based on a _list of tags_. By default +this list is constructed dynamically, containing all tags currently used +in the buffer(1). You may also globally specify a hard list of tags +with the variable ‘org-tag-alist’. Finally you can set the default tags +for a given file using the ‘TAGS’ keyword, like + + #+TAGS: @work @home @tennisclub + #+TAGS: laptop car pc sailboat + + If you have globally defined your preferred set of tags using the +variable ‘org-tag-alist’, but would like to use a dynamic tag list in a +specific file, add an empty ‘TAGS’ keyword to that file: + + #+TAGS: + + If you have a preferred set of tags that you would like to use in +every file, in addition to those defined on a per-file basis by ‘TAGS’ +keyword, then you may specify a list of tags with the variable +‘org-tag-persistent-alist’. You may turn this off on a per-file basis +by adding a ‘STARTUP’ keyword to that file: + + #+STARTUP: noptag + + By default Org mode uses the standard minibuffer completion +facilities for entering tags. However, it also implements another, +quicker, tag selection method called _fast tag selection_. This allows +you to select and deselect tags with just a single key press. For this +to work well you should assign unique letters to most of your commonly +used tags. You can do this globally by configuring the variable +‘org-tag-alist’ in your Emacs init file. For example, you may find the +need to tag many items in different files with ‘@home’. In this case +you can set something like: + + (setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l))) + + If the tag is only relevant to the file you are working on, then you +can instead set the ‘TAGS’ keyword as: + + #+TAGS: @work(w) @home(h) @tennisclub(t) laptop(l) pc(p) + + The tags interface shows the available tags in a splash window. If +you want to start a new line after a specific tag, insert ‘\n’ into the +tag list + + #+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p) + +or write them in two lines: + + #+TAGS: @work(w) @home(h) @tennisclub(t) + #+TAGS: laptop(l) pc(p) + + You can also group together tags that are mutually exclusive by using +braces, as in: + + #+TAGS: { @work(w) @home(h) @tennisclub(t) } laptop(l) pc(p) + +you indicate that at most one of ‘@work’, ‘@home’, and ‘@tennisclub’ +should be selected. Multiple such groups are allowed. + + Do not forget to press ‘C-c C-c’ with point in one of these lines to +activate any changes. + + To set these mutually exclusive groups in the variable +‘org-tags-alist’, you must use the dummy tags ‘:startgroup’ and +‘:endgroup’ instead of the braces. Similarly, you can use ‘:newline’ to +indicate a line break. The previous example would be set globally by +the following configuration: + + (setq org-tag-alist '((:startgroup . nil) + ("@work" . ?w) ("@home" . ?h) + ("@tennisclub" . ?t) + (:endgroup . nil) + ("laptop" . ?l) ("pc" . ?p))) + + If at least one tag has a selection key then pressing ‘C-c C-c’ +automatically presents you with a special interface, listing inherited +tags, the tags of the current headline, and a list of all valid tags +with corresponding keys(2). + + Pressing keys assigned to tags adds or removes them from the list of +tags in the current line. Selecting a tag in a group of mutually +exclusive tags turns off any other tag from that group. + + In this interface, you can also use the following special keys: + +‘<TAB>’ + Enter a tag in the minibuffer, even if the tag is not in the + predefined list. You can complete on all tags present in the + buffer and globally pre-defined tags from ‘org-tag-alist’ and + ‘org-tag-persistent-alist’. You can also add several tags: just + separate them with a comma. + +‘<SPC>’ + Clear all tags for this line. + +‘<RET>’ + Accept the modified set. + +‘C-g’ + Abort without installing changes. + +‘q’ + If ‘q’ is not assigned to a tag, it aborts like ‘C-g’. + +‘!’ + Turn off groups of mutually exclusive tags. Use this to (as an + exception) assign several tags from such a group. + +‘C-c’ + Toggle auto-exit after the next change (see below). If you are + using expert mode, the first ‘C-c’ displays the selection window. + + This method lets you assign tags to a headline with very few keys. +With the above setup, you could clear the current tags and set ‘@home’, +‘laptop’ and ‘pc’ tags with just the following keys: ‘C-c C-c <SPC> h l +p <RET>’. Switching from ‘@home’ to ‘@work’ would be done with ‘C-c C-c +w <RET>’ or alternatively with ‘C-c C-c C-c w’. Adding the +non-predefined tag ‘sarah’ could be done with ‘C-c C-c <TAB> s a r a h +<RET>’. + + If you find that most of the time you need only a single key press to +modify your list of tags, set the variable +‘org-fast-tag-selection-single-key’. Then you no longer have to press +‘<RET>’ to exit fast tag selection—it exits after the first change. If +you then occasionally need more keys, press ‘C-c’ to turn off auto-exit +for the current tag selection process (in effect: start selection with +‘C-c C-c C-c’ instead of ‘C-c C-c’). If you set the variable to the +value ‘expert’, the special window is not even shown for single-key tag +selection, it comes up only when you press an extra ‘C-c’. + + ---------- Footnotes ---------- + + (1) To extend this default list to all tags used in all agenda files +(see *note Agenda Views::), customize the variable +‘org-complete-tags-always-offer-all-agenda-tags’. + + (2) Keys are automatically assigned to tags that have no configured +keys. + + +File: org.info, Node: Tag Hierarchy, Next: Tag Searches, Prev: Setting Tags, Up: Tags + +6.3 Tag Hierarchy +================= + +Tags can be defined in hierarchies. A tag can be defined as a _group +tag_ for a set of other tags. The group tag can be seen as the “broader +term” for its set of tags. Defining multiple group tags and nesting +them creates a tag hierarchy. + + One use-case is to create a taxonomy of terms (tags) that can be used +to classify nodes in a document or set of documents. + + When you search for a group tag, it return matches for all members in +the group and its subgroups. In an agenda view, filtering by a group +tag displays or hide headlines tagged with at least one of the members +of the group or any of its subgroups. This makes tag searches and +filters even more flexible. + + You can set group tags by using brackets and inserting a colon +between the group tag and its related tags—beware that all whitespaces +are mandatory so that Org can parse this line correctly: + + #+TAGS: [ GTD : Control Persp ] + + In this example, ‘GTD’ is the group tag and it is related to two +other tags: ‘Control’, ‘Persp’. Defining ‘Control’ and ‘Persp’ as group +tags creates a hierarchy of tags: + + #+TAGS: [ Control : Context Task ] + #+TAGS: [ Persp : Vision Goal AOF Project ] + + That can conceptually be seen as a hierarchy of tags: + + • ‘GTD’ + • ‘Persp’ + • ‘Vision’ + • ‘Goal’ + • ‘AOF’ + • ‘Project’ + • ‘Control’ + • ‘Context’ + • ‘Task’ + + You can use the ‘:startgrouptag’, ‘:grouptags’ and ‘:endgrouptag’ +keyword directly when setting ‘org-tag-alist’ directly: + + (setq org-tag-alist '((:startgrouptag) + ("GTD") + (:grouptags) + ("Control") + ("Persp") + (:endgrouptag) + (:startgrouptag) + ("Control") + (:grouptags) + ("Context") + ("Task") + (:endgrouptag))) + + The tags in a group can be mutually exclusive if using the same group +syntax as is used for grouping mutually exclusive tags together; using +curly brackets. + + #+TAGS: { Context : @Home @Work @Call } + + When setting ‘org-tag-alist’ you can use ‘:startgroup’ and +‘:endgroup’ instead of ‘:startgrouptag’ and ‘:endgrouptag’ to make the +tags mutually exclusive. + + Furthermore, the members of a group tag can also be regular +expressions, creating the possibility of a more dynamic and rule-based +tag structure (see *note Regular Expressions::). The regular +expressions in the group must be specified within curly brackets. Here +is an expanded example: + + #+TAGS: [ Vision : {V@.+} ] + #+TAGS: [ Goal : {G@.+} ] + #+TAGS: [ AOF : {AOF@.+} ] + #+TAGS: [ Project : {P@.+} ] + + Searching for the tag ‘Project’ now lists all tags also including +regular expression matches for ‘P@.+’, and similarly for tag searches on +‘Vision’, ‘Goal’ and ‘AOF’. For example, this would work well for a +project tagged with a common project-identifier, e.g., ‘P@2014_OrgTags’. + + If you want to ignore group tags temporarily, toggle group tags +support with ‘org-toggle-tags-groups’, bound to ‘C-c C-x q’. If you +want to disable tag groups completely, set ‘org-group-tags’ to ‘nil’. + + +File: org.info, Node: Tag Searches, Prev: Tag Hierarchy, Up: Tags + +6.4 Tag Searches +================ + +Once a system of tags has been set up, it can be used to collect related +information into special lists. + +‘C-c / m’ or ‘C-c \’ (‘org-match-sparse-tree’) + Create a sparse tree with all headlines matching a tags search. + With a ‘C-u’ prefix argument, ignore headlines that are not a TODO + line. + +‘M-x org-agenda m’ (‘org-tags-view’) + Create a global list of tag matches from all agenda files. See + *note Matching tags and properties::. + +‘M-x org-agenda M’ (‘org-tags-view’) + Create a global list of tag matches from all agenda files, but + check only TODO items and force checking subitems (see the option + ‘org-tags-match-list-sublevels’). + + These commands all prompt for a match string which allows basic +Boolean logic like ‘+boss+urgent-project1’, to find entries with tags +‘boss’ and ‘urgent’, but not ‘project1’, or ‘Kathy|Sally’ to find +entries which are tagged, like ‘Kathy’ or ‘Sally’. The full syntax of +the search string is rich and allows also matching against TODO +keywords, entry levels and properties. For a complete description with +many examples, see *note Matching tags and properties::. + + +File: org.info, Node: Properties and Columns, Next: Dates and Times, Prev: Tags, Up: Top + +7 Properties and Columns +************************ + +A property is a key-value pair associated with an entry. Properties can +be set so they are associated with a single entry, with every entry in a +tree, or with the whole buffer. + + There are two main applications for properties in Org mode. First, +properties are like tags, but with a value. Imagine maintaining a file +where you document bugs and plan releases for a piece of software. +Instead of using tags like ‘release_1’, ‘release_2’, you can use a +property, say ‘Release’, that in different subtrees has different +values, such as ‘1.0’ or ‘2.0’. Second, you can use properties to +implement (very basic) database capabilities in an Org buffer. Imagine +keeping track of your music CDs, where properties could be things such +as the album, artist, date of release, number of tracks, and so on. + + Properties can be conveniently edited and viewed in column view (see +*note Column View::). + +* Menu: + +* Property Syntax:: How properties are spelled out. +* Special Properties:: Access to other Org mode features. +* Property Searches:: Matching property values. +* Property Inheritance:: Passing values down a tree. +* Column View:: Tabular viewing and editing. + + +File: org.info, Node: Property Syntax, Next: Special Properties, Up: Properties and Columns + +7.1 Property Syntax +=================== + +Properties are key–value pairs. When they are associated with a single +entry or with a tree they need to be inserted into a special drawer (see +*note Drawers::) with the name ‘PROPERTIES’, which has to be located +right below a headline, and its planning line (see *note Deadlines and +Scheduling::) when applicable. Each property is specified on a single +line, with the key—surrounded by colons—first, and the value after it. +Keys are case-insensitive. Here is an example: + + * CD collection + ** Classic + *** Goldberg Variations + :PROPERTIES: + :Title: Goldberg Variations + :Composer: J.S. Bach + :Artist: Glenn Gould + :Publisher: Deutsche Grammophon + :NDisks: 1 + :END: + + Depending on the value of ‘org-use-property-inheritance’, a property +set this way is associated either with a single entry, or with the +sub-tree defined by the entry, see *note Property Inheritance::. + + You may define the allowed values for a particular property ‘Xyz’ by +setting a property ‘Xyz_ALL’. This special property is _inherited_, so +if you set it in a level 1 entry, it applies to the entire tree. When +allowed values are defined, setting the corresponding property becomes +easier and is less prone to typing errors. For the example with the CD +collection, we can pre-define publishers and the number of disks in a +box like this: + + * CD collection + :PROPERTIES: + :NDisks_ALL: 1 2 3 4 + :Publisher_ALL: "Deutsche Grammophon" Philips EMI + :END: + + Properties can be inserted on buffer level. That means they apply +before the first headline and can be inherited by all entries in a file. +Property blocks defined before first headline needs to be located at the +top of the buffer, allowing only comments above. + + Properties can also be defined using lines like: + + #+PROPERTY: NDisks_ALL 1 2 3 4 + + If you want to add to the value of an existing property, append a ‘+’ +to the property name. The following results in the property ‘var’ +having the value ‘foo=1 bar=2’. + + #+PROPERTY: var foo=1 + #+PROPERTY: var+ bar=2 + + It is also possible to add to the values of inherited properties. +The following results in the ‘Genres’ property having the value ‘Classic +Baroque’ under the ‘Goldberg Variations’ subtree. + + * CD collection + ** Classic + :PROPERTIES: + :Genres: Classic + :END: + *** Goldberg Variations + :PROPERTIES: + :Title: Goldberg Variations + :Composer: J.S. Bach + :Artist: Glenn Gould + :Publisher: Deutsche Grammophon + :NDisks: 1 + :Genres+: Baroque + :END: + + Note that a property can only have one entry per drawer. + + Property values set with the global variable ‘org-global-properties’ +can be inherited by all entries in all Org files. + + The following commands help to work with properties: + +‘M-<TAB>’ (‘pcomplete’) + After an initial colon in a line, complete property keys. All keys + used in the current file are offered as possible completions. + +‘C-c C-x p’ (‘org-set-property’) + Set a property. This prompts for a property name and a value. If + necessary, the property drawer is created as well. + +‘C-u M-x org-insert-drawer’ + Insert a property drawer into the current entry. The drawer is + inserted early in the entry, but after the lines with planning + information like deadlines. If before first headline the drawer is + inserted at the top of the drawer after any potential comments. + +‘C-c C-c’ (‘org-property-action’) + With point in a property drawer, this executes property commands. + +‘C-c C-c s’ (‘org-set-property’) + Set a property in the current entry. Both the property and the + value can be inserted using completion. + +‘S-<RIGHT>’ (‘org-property-next-allowed-values’) +‘S-<LEFT>’ (‘org-property-previous-allowed-value’) + Switch property at point to the next/previous allowed value. + +‘C-c C-c d’ (‘org-delete-property’) + Remove a property from the current entry. + +‘C-c C-c D’ (‘org-delete-property-globally’) + Globally remove a property, from all entries in the current file. + +‘C-c C-c c’ (‘org-compute-property-at-point’) + Compute the property at point, using the operator and scope from + the nearest column format definition. + + +File: org.info, Node: Special Properties, Next: Property Searches, Prev: Property Syntax, Up: Properties and Columns + +7.2 Special Properties +====================== + +Special properties provide an alternative access method to Org mode +features, like the TODO state or the priority of an entry, discussed in +the previous chapters. This interface exists so that you can include +these states in a column view (see *note Column View::), or to use them +in queries. The following property names are special and should not be +used as keys in the properties drawer: + +‘ALLTAGS’ All tags, including inherited ones. +‘BLOCKED’ ‘t’ if task is currently blocked by children or siblings. +‘CATEGORY’ The category of an entry. +‘CLOCKSUM’ The sum of CLOCK intervals in the subtree. ‘org-clock-sum’ + must be run first to compute the values in the current buffer. +‘CLOCKSUM_T’ The sum of CLOCK intervals in the subtree for today. + ‘org-clock-sum-today’ must be run first to compute the + values in the current buffer. +‘CLOSED’ When was this entry closed? +‘DEADLINE’ The deadline timestamp. +‘FILE’ The filename the entry is located in. +‘ITEM’ The headline of the entry. +‘PRIORITY’ The priority of the entry, a string with a single letter. +‘SCHEDULED’ The scheduling timestamp. +‘TAGS’ The tags defined directly in the headline. +‘TIMESTAMP’ The first keyword-less timestamp in the entry. +‘TIMESTAMP_IA’ The first inactive timestamp in the entry. +‘TODO’ The TODO keyword of the entry. + + +File: org.info, Node: Property Searches, Next: Property Inheritance, Prev: Special Properties, Up: Properties and Columns + +7.3 Property Searches +===================== + +To create sparse trees and special lists with selection based on +properties, the same commands are used as for tag searches (see *note +Tag Searches::). + +‘C-c / m’ or ‘C-c \’ (‘org-match-sparse-tree’) + Create a sparse tree with all matching entries. With a ‘C-u’ + prefix argument, ignore headlines that are not a TODO line. + +‘M-x org-agenda m’ (‘org-tags-view’) + Create a global list of tag/property matches from all agenda files. + +‘M-x org-agenda M’ (‘org-tags-view’) + Create a global list of tag matches from all agenda files, but + check only TODO items and force checking of subitems (see the + option ‘org-tags-match-list-sublevels’). + + The syntax for the search string is described in *note Matching tags +and properties::. + + There is also a special command for creating sparse trees based on a +single property: + +‘C-c / p’ + Create a sparse tree based on the value of a property. This first + prompts for the name of a property, and then for a value. A sparse + tree is created with all entries that define this property with the + given value. If you enclose the value in curly braces, it is + interpreted as a regular expression and matched against the + property values (see *note Regular Expressions::). + + +File: org.info, Node: Property Inheritance, Next: Column View, Prev: Property Searches, Up: Properties and Columns + +7.4 Property Inheritance +======================== + +The outline structure of Org documents lends itself to an inheritance +model of properties: if the parent in a tree has a certain property, the +children can inherit this property. Org mode does not turn this on by +default, because it can slow down property searches significantly and is +often not needed. However, if you find inheritance useful, you can turn +it on by setting the variable ‘org-use-property-inheritance’. It may be +set to ‘t’ to make all properties inherited from the parent, to a list +of properties that should be inherited, or to a regular expression that +matches inherited properties. If a property has the value ‘nil’, this +is interpreted as an explicit un-define of the property, so that +inheritance search stops at this value and returns ‘nil’. + + Org mode has a few properties for which inheritance is hard-coded, at +least for the special applications for which they are used: + +‘COLUMNS’ + The ‘COLUMNS’ property defines the format of column view (see *note + Column View::). It is inherited in the sense that the level where + a ‘COLUMNS’ property is defined is used as the starting point for a + column view table, independently of the location in the subtree + from where columns view is turned on. + +‘CATEGORY’ + For agenda view, a category set through a ‘CATEGORY’ property + applies to the entire subtree. + +‘ARCHIVE’ + For archiving, the ‘ARCHIVE’ property may define the archive + location for the entire subtree (see *note Moving subtrees::). + +‘LOGGING’ + The ‘LOGGING’ property may define logging settings for an entry or + a subtree (see *note Tracking TODO state changes::). + + +File: org.info, Node: Column View, Prev: Property Inheritance, Up: Properties and Columns + +7.5 Column View +=============== + +A great way to view and edit properties in an outline tree is _column +view_. In column view, each outline node is turned into a table row. +Columns in this table provide access to properties of the entries. Org +mode implements columns by overlaying a tabular structure over the +headline of each item. While the headlines have been turned into a +table row, you can still change the visibility of the outline tree. For +example, you get a compact table by switching to “contents” +view—‘S-<TAB>’ ‘S-<TAB>’, or simply ‘c’ while column view is active—but +you can still open, read, and edit the entry below each headline. Or, +you can switch to column view after executing a sparse tree command and +in this way get a table only for the selected items. Column view also +works in agenda buffers (see *note Agenda Views::) where queries have +collected selected items, possibly from a number of files. + +* Menu: + +* Defining columns:: The COLUMNS format property. +* Using column view:: How to create and use column view. +* Capturing column view:: A dynamic block for column view. + + +File: org.info, Node: Defining columns, Next: Using column view, Up: Column View + +7.5.1 Defining columns +---------------------- + +Setting up a column view first requires defining the columns. This is +done by defining a column format line. + +* Menu: + +* Scope of column definitions:: Where defined, where valid? +* Column attributes:: Appearance and content of a column. + + +File: org.info, Node: Scope of column definitions, Next: Column attributes, Up: Defining columns + +7.5.1.1 Scope of column definitions +................................... + +To specify a format that only applies to a specific tree, add a +‘COLUMNS’ property to the top node of that tree, for example: + + ** Top node for columns view + :PROPERTIES: + :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO + :END: + + A ‘COLUMNS’ property within a property drawer before first headline +will apply to the entire file. As an addition to property drawers, +keywords can also be defined for an entire file using a line like: + + #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO + + If a ‘COLUMNS’ property is present in an entry, it defines columns +for the entry itself, and for the entire subtree below it. Since the +column definition is part of the hierarchical structure of the document, +you can define columns on level 1 that are general enough for all +sublevels, and more specific columns further down, when you edit a +deeper part of the tree. + + +File: org.info, Node: Column attributes, Prev: Scope of column definitions, Up: Defining columns + +7.5.1.2 Column attributes +......................... + +A column definition sets the attributes of a column. The general +definition looks like this: + + %[WIDTH]PROPERTY[(TITLE)][{SUMMARY-TYPE}] + +Except for the percent sign and the property name, all items are +optional. The individual parts have the following meaning: + +WIDTH + An integer specifying the width of the column in characters. If + omitted, the width is determined automatically. + +PROPERTY + The property that should be edited in this column. Special + properties representing meta data are allowed here as well (see + *note Special Properties::). + +TITLE + The header text for the column. If omitted, the property name is + used. + +SUMMARY-TYPE + The summary type. If specified, the column values for parent nodes + are computed from the children(1). + + Supported summary types are: + + ‘+’ Sum numbers in this column. + ‘+;%.1f’ Like ‘+’, but format result with ‘%.1f’. + ‘$’ Currency, short for ‘+;%.2f’. + ‘min’ Smallest number in column. + ‘max’ Largest number. + ‘mean’ Arithmetic mean of numbers. + ‘X’ Checkbox status, ‘[X]’ if all children are ‘[X]’. + ‘X/’ Checkbox status, ‘[n/m]’. + ‘X%’ Checkbox status, ‘[n%]’. + ‘:’ Sum times, HH:MM, plain numbers are minutes. + ‘:min’ Smallest time value in column. + ‘:max’ Largest time value. + ‘:mean’ Arithmetic mean of time values. + ‘@min’ Minimum age(2) (in days/hours/mins/seconds). + ‘@max’ Maximum age (in days/hours/mins/seconds). + ‘@mean’ Arithmetic mean of ages (in days/hours/mins/seconds). + ‘est+’ Add low-high estimates. + + You can also define custom summary types by setting + ‘org-columns-summary-types’. + + The ‘est+’ summary type requires further explanation. It is used for +combining estimates, expressed as low-high ranges. For example, instead +of estimating a particular task will take 5 days, you might estimate it +as 5–6 days if you’re fairly confident you know how much work is +required, or 1–10 days if you do not really know what needs to be done. +Both ranges average at 5.5 days, but the first represents a more +predictable delivery. + + When combining a set of such estimates, simply adding the lows and +highs produces an unrealistically wide result. Instead, ‘est+’ adds the +statistical mean and variance of the subtasks, generating a final +estimate from the sum. For example, suppose you had ten tasks, each of +which was estimated at 0.5 to 2 days of work. Straight addition +produces an estimate of 5 to 20 days, representing what to expect if +everything goes either extremely well or extremely poorly. In contrast, +‘est+’ estimates the full job more realistically, at 10–15 days. + + Here is an example for a complete columns definition, along with +allowed values(3). + + :COLUMNS: %25ITEM %9Approved(Approved?){X} %Owner %11Status \ + %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T + :Owner_ALL: Tammy Mark Karl Lisa Don + :Status_ALL: "In progress" "Not started yet" "Finished" "" + :Approved_ALL: "[ ]" "[X]" + +The first column, ‘%25ITEM’, means the first 25 characters of the item +itself, i.e., of the headline. You probably always should start the +column definition with the ‘ITEM’ specifier. The other specifiers +create columns ‘Owner’ with a list of names as allowed values, for +‘Status’ with four different possible values, and for a checkbox field +‘Approved’. When no width is given after the ‘%’ character, the column +is exactly as wide as it needs to be in order to fully display all +values. The ‘Approved’ column does have a modified title (‘Approved?’, +with a question mark). Summaries are created for the ‘Time_Estimate’ +column by adding time duration expressions like HH:MM, and for the +‘Approved’ column, by providing an ‘[X]’ status if all children have +been checked. The ‘CLOCKSUM’ and ‘CLOCKSUM_T’ columns are special, they +lists the sums of CLOCK intervals in the subtree, either for all clocks +or just for today. + + ---------- Footnotes ---------- + + (1) If more than one summary type applies to the same property, the +parent values are computed according to the first of them. + + (2) An age can be defined as a duration, using units defined in +‘org-duration-units’, e.g., ‘3d 1h’. If any value in the column is as +such, the summary is also expressed as a duration. + + (3) Please note that the ‘COLUMNS’ definition must be on a single +line; it is wrapped here only because of formatting constraints. + + +File: org.info, Node: Using column view, Next: Capturing column view, Prev: Defining columns, Up: Column View + +7.5.2 Using column view +----------------------- + +Turning column view on or off +............................. + +‘C-c C-x C-c’ (‘org-columns’) + Turn on column view. If point is before the first headline in the + file, column view is turned on for the entire file, using the + ‘#+COLUMNS’ definition. If point is somewhere inside the outline, + this command searches the hierarchy, up from point, for a ‘COLUMNS’ + property that defines a format. When one is found, the column view + table is established for the tree starting at the entry that + contains the ‘COLUMNS’ property. If no such property is found, the + format is taken from the ‘#+COLUMNS’ line or from the variable + ‘org-columns-default-format’, and column view is established for + the current entry and its subtree. + +‘r’ or ‘g’ on a columns view line (‘org-columns-redo’) + Recreate the column view, to include recent changes made in the + buffer. + +‘C-c C-c’ or ‘q’ on a columns view line (‘org-columns-quit’) + Exit column view. + +Editing values +.............. + +‘<LEFT>’, ‘<RIGHT>’, ‘<UP>’, ‘<DOWN>’ + Move through the column view from field to field. + +‘1..9,0’ + Directly select the Nth allowed value, ‘0’ selects the 10th value. + +‘n’ or ‘S-<RIGHT>’ (‘org-columns-next-allowed-value’) +‘p’ or ‘S-<LEFT>’ (‘org-columns-previous-allowed-value’) + Switch to the next/previous allowed value of the field. For this, + you have to have specified allowed values for a property. + +‘e’ (‘org-columns-edit-value’) + Edit the property at point. For the special properties, this + invokes the same interface that you normally use to change that + property. For example, the tag completion or fast selection + interface pops up when editing a ‘TAGS’ property. + +‘C-c C-c’ (‘org-columns-toggle-or-columns-quit’) + When there is a checkbox at point, toggle it. Else exit column + view. + +‘v’ (‘org-columns-show-value’) + View the full value of this property. This is useful if the width + of the column is smaller than that of the value. + +‘a’ (‘org-columns-edit-allowed’) + Edit the list of allowed values for this property. If the list is + found in the hierarchy, the modified values is stored there. If no + list is found, the new value is stored in the first entry that is + part of the current column view. + +Modifying column view on-the-fly +................................ + +‘<’ (‘org-columns-narrow’) +‘>’ (‘org-columns-widen’) + Make the column narrower/wider by one character. + +‘S-M-<RIGHT>’ (‘org-columns-new’) + Insert a new column, to the left of the current column. + +‘S-M-<LEFT>’ (‘org-columns-delete’) + Delete the current column. + + +File: org.info, Node: Capturing column view, Prev: Using column view, Up: Column View + +7.5.3 Capturing column view +--------------------------- + +Since column view is just an overlay over a buffer, it cannot be +exported or printed directly. If you want to capture a column view, use +a ‘columnview’ dynamic block (see *note Dynamic Blocks::). The frame of +this block looks like this: + + * The column view + #+BEGIN: columnview :hlines 1 :id "label" + + #+END: + + This dynamic block has the following parameters: + +‘:id’ + This is the most important parameter. Column view is a feature + that is often localized to a certain (sub)tree, and the capture + block might be at a different location in the file. To identify + the tree whose view to capture, you can use four values: + + ‘local’ + Use the tree in which the capture block is located. + + ‘global’ + Make a global view, including all headings in the file. + + ‘file:FILENAME’ + Run column view at the top of the FILENAME file. + + ‘LABEL’ + Call column view in the tree that has an ‘ID’ property with + the value LABEL. You can use ‘M-x org-id-copy’ to create a + globally unique ID for the current entry and copy it to the + kill-ring. + +‘:match’ + When set to a string, use this as a tags/property match filter to + select only a subset of the headlines in the scope set by the ‘:id’ + parameter. + +‘:hlines’ + When ‘t’, insert an hline after every line. When a number N, + insert an hline before each headline with level ‘<= N’. + +‘:vlines’ + When non-‘nil’, force column groups to get vertical lines. + +‘:maxlevel’ + When set to a number, do not capture entries below this level. + +‘:skip-empty-rows’ + When non-‘nil’, skip rows where the only non-empty specifier of the + column view is ‘ITEM’. + +‘:exclude-tags’ + List of tags to exclude from column view table: entries with these + tags will be excluded from the column view. + +‘:indent’ + When non-‘nil’, indent each ‘ITEM’ field according to its level. + +‘:format’ + Specify a column attribute (see *note Column attributes::) for the + dynamic block. + + The following commands insert or update the dynamic block: + +‘org-columns-insert-dblock’ + Insert a dynamic block capturing a column view. Prompt for the + scope or ID of the view. + + This command can be invoked by calling + ‘org-dynamic-block-insert-dblock’ (‘C-c C-x x’) and selecting + “columnview” (see *note Dynamic Blocks::). + +‘C-c C-c’ ‘C-c C-x C-u’ (‘org-dblock-update’) + Update dynamic block at point. point needs to be in the ‘#+BEGIN’ + line of the dynamic block. + +‘C-u C-c C-x C-u’ (‘org-update-all-dblocks’) + Update all dynamic blocks (see *note Dynamic Blocks::). This is + useful if you have several clock table blocks, column-capturing + blocks or other dynamic blocks in a buffer. + + You can add formulas to the column view table and you may add +plotting instructions in front of the table—these survive an update of +the block. If there is a ‘TBLFM’ keyword after the table, the table is +recalculated automatically after an update. + + An alternative way to capture and process property values into a +table is provided by Eric Schulte’s ‘org-collector.el’, which is a +package in ‘org-contrib’(1). It provides a general API to collect +properties from entries in a certain scope, and arbitrary Lisp +expressions to process these values before inserting them into a table +or a dynamic block. + + ---------- Footnotes ---------- + + (1) Contributed packages are not part of Emacs, but are distributed +with the main distribution of Org—visit <https://orgmode.org>. + + +File: org.info, Node: Dates and Times, Next: Refiling and Archiving, Prev: Properties and Columns, Up: Top + +8 Dates and Times +***************** + +To assist project planning, TODO items can be labeled with a date and/or +a time. The specially formatted string carrying the date and time +information is called a _timestamp_ in Org mode. This may be a little +confusing because timestamp is often used as indicating when something +was created or last changed. However, in Org mode this term is used in +a much wider sense. + +* Menu: + +* Timestamps:: Assigning a time to a tree entry. +* Creating Timestamps:: Commands to insert timestamps. +* Deadlines and Scheduling:: Planning your work. +* Clocking Work Time:: Tracking how long you spend on a task. +* Effort Estimates:: Planning work effort in advance. +* Timers:: Notes with a running timer. + + +File: org.info, Node: Timestamps, Next: Creating Timestamps, Up: Dates and Times + +8.1 Timestamps +============== + +A timestamp is a specification of a date (possibly with a time or a +range of times) in a special format, either ‘<2003-09-16 Tue>’ or +‘<2003-09-16 Tue 09:39>’ or ‘<2003-09-16 Tue 12:00-12:30>’(1). A +timestamp can appear anywhere in the headline or body of an Org tree +entry. Its presence causes entries to be shown on specific dates in the +agenda (see *note Weekly/daily agenda::). We distinguish: + +Plain timestamp; Event; Appointment + A simple timestamp just assigns a date/time to an item. This is + just like writing down an appointment or event in a paper agenda. + In the agenda display, the headline of an entry associated with a + plain timestamp is shown exactly on that date. + + * Meet Peter at the movies + <2006-11-01 Wed 19:15> + * Discussion on climate change + <2006-11-02 Thu 20:00-22:00> + +Timestamp with repeater interval + A timestamp may contain a _repeater interval_, indicating that it + applies not only on the given date, but again and again after a + certain interval of N days (d), weeks (w), months (m), or years + (y). The following shows up in the agenda every Wednesday: + + * Pick up Sam at school + <2007-05-16 Wed 12:30 +1w> + +Diary-style expression entries + For more complex date specifications, Org mode supports using the + special expression diary entries implemented in the Emacs Calendar + package(2). For example, with optional time: + + * 22:00-23:00 The nerd meeting on every 2nd Thursday of the month + <%%(diary-float t 4 2)> + +Time/Date range + Two timestamps connected by ‘--’ denote a range. The headline is + shown on the first and last day of the range, and on any dates that + are displayed and fall in the range. Here is an example: + + ** Meeting in Amsterdam + <2004-08-23 Mon>--<2004-08-26 Thu> + +Inactive timestamp + Just like a plain timestamp, but with square brackets instead of + angular ones. These timestamps are inactive in the sense that they + do _not_ trigger an entry to show up in the agenda. + + * Gillian comes late for the fifth time + [2006-11-01 Wed] + + ---------- Footnotes ---------- + + (1) The Org date format is inspired by the standard ISO 8601 +date/time format. To use an alternative format, see *note Custom time +format::. The day name is optional when you type the date yourself. +However, any date inserted or modified by Org adds that day name, for +reading convenience. + + (2) When working with the standard diary expression functions, you +need to be very careful with the order of the arguments. That order +depends evilly on the variable ‘calendar-date-style’. For example, to +specify a date December 12, 2005, the call might look like ‘(diary-date +12 1 2005)’ or ‘(diary-date 1 12 2005)’ or ‘(diary-date 2005 12 1)’, +depending on the settings. This has been the source of much confusion. +Org mode users can resort to special versions of these functions like +‘org-date’ or ‘org-anniversary’. These work just like the corresponding +‘diary-’ functions, but with stable ISO order of arguments (year, month, +day) wherever applicable, independent of the value of +‘calendar-date-style’. + + +File: org.info, Node: Creating Timestamps, Next: Deadlines and Scheduling, Prev: Timestamps, Up: Dates and Times + +8.2 Creating Timestamps +======================= + +For Org mode to recognize timestamps, they need to be in the specific +format. All commands listed below produce timestamps in the correct +format. + +‘C-c .’ (‘org-time-stamp’) + Prompt for a date and insert a corresponding timestamp. When point + is at an existing timestamp in the buffer, the command is used to + modify this timestamp instead of inserting a new one. When this + command is used twice in succession, a time range is inserted. + + When called with a prefix argument, use the alternative format + which contains date and time. The default time can be rounded to + multiples of 5 minutes. See the option + ‘org-time-stamp-rounding-minutes’. + + With two prefix arguments, insert an active timestamp with the + current time without prompting. + +‘C-c !’ (‘org-time-stamp-inactive’) + Like ‘C-c .’, but insert an inactive timestamp that does not cause + an agenda entry. + +‘C-c C-c’ + Normalize timestamp, insert or fix day name if missing or wrong. + +‘C-c <’ (‘org-date-from-calendar’) + Insert a timestamp corresponding to point date in the calendar. + +‘C-c >’ (‘org-goto-calendar’) + Access the Emacs calendar for the current date. If there is a + timestamp in the current line, go to the corresponding date + instead. + +‘C-c C-o’ (‘org-open-at-point’) + Access the agenda for the date given by the timestamp or -range at + point (see *note Weekly/daily agenda::). + +‘S-<LEFT>’ (‘org-timestamp-down-day’) +‘S-<RIGHT>’ (‘org-timestamp-up-day’) + Change date at point by one day. These key bindings conflict with + shift-selection and related modes (see *note Conflicts::). + +‘S-<UP>’ (‘org-timestamp-up’) +‘S-<DOWN>’ (‘org-timestamp-down’) + On the beginning or enclosing bracket of a timestamp, change its + type. Within a timestamp, change the item under point. Point can + be on a year, month, day, hour or minute. When the timestamp + contains a time range like ‘15:30-16:30’, modifying the first time + also shifts the second, shifting the time block with constant + length. To change the length, modify the second time. Note that + if point is in a headline and not at a timestamp, these same keys + modify the priority of an item (see *note Priorities::). The key + bindings also conflict with shift-selection and related modes (see + *note Conflicts::). + +‘C-c C-y’ (‘org-evaluate-time-range’) + Evaluate a time range by computing the difference between start and + end. With a prefix argument, insert result after the time range + (in a table: into the following column). + +* Menu: + +* The date/time prompt:: How Org mode helps you enter dates and times. +* Custom time format:: Making dates look different. + + +File: org.info, Node: The date/time prompt, Next: Custom time format, Up: Creating Timestamps + +8.2.1 The date/time prompt +-------------------------- + +When Org mode prompts for a date/time, the default is shown in default +date/time format, and the prompt therefore seems to ask for a specific +format. But it in fact accepts date/time information in a variety of +formats. Generally, the information should start at the beginning of +the string. Org mode finds whatever information is in there and derives +anything you have not specified from the _default date and time_. The +default is usually the current date and time, but when modifying an +existing timestamp, or when entering the second stamp of a range, it is +taken from the stamp in the buffer. When filling in information, Org +mode assumes that most of the time you want to enter a date in the +future: if you omit the month/year and the given day/month is _before_ +today, it assumes that you mean a future date(1). If the date has been +automatically shifted into the future, the time prompt shows this with +‘(=>F)’. + + For example, let’s assume that today is *June 13, 2006*. Here is how +various inputs are interpreted, the items filled in by Org mode are in +*bold*. + +‘3-2-5’ ⇒ 2003-02-05 +‘2/5/3’ ⇒ 2003-02-05 +‘14’ ⇒ *2006*-*06*-14 +‘12’ ⇒ *2006*-*07*-12 +‘2/5’ ⇒ *2007*-02-05 +‘Fri’ ⇒ nearest Friday (default date or later) +‘sep 15’ ⇒ *2006*-09-15 +‘feb 15’ ⇒ *2007*-02-15 +‘sep 12 9’ ⇒ 2009-09-12 +‘12:45’ ⇒ *2006*-*06*-*13* 12:45 +‘22 sept 0:34’ ⇒ *2006*-09-22 0:34 +‘w4’ ⇒ ISO week for of the current year *2006* +‘2012 w4 fri’ ⇒ Friday of ISO week 4 in 2012 +‘2012-w04-5’ ⇒ Same as above + + Furthermore you can specify a relative date by giving, as the _first_ +thing in the input: a plus/minus sign, a number and a letter—‘h’, ‘d’, +‘w’, ‘m’ or ‘y’—to indicate a change in hours, days, weeks, months, or +years. With ‘h’ the date is relative to the current time, with the +other letters and a single plus or minus, the date is relative to today +at 00:00. With a double plus or minus, it is relative to the default +date. If instead of a single letter, you use the abbreviation of day +name, the date is the Nth such day, e.g.: + +‘+0’ ⇒ today +‘.’ ⇒ today +‘+2h’ ⇒ two hours from now +‘+4d’ ⇒ four days from today +‘+4’ ⇒ same as +4d +‘+2w’ ⇒ two weeks from today +‘++5’ ⇒ five days from default date +‘+2tue’ ⇒ second Tuesday from now + + The function understands English month and weekday abbreviations. If +you want to use un-abbreviated names and/or other languages, configure +the variables ‘parse-time-months’ and ‘parse-time-weekdays’. + + Not all dates can be represented in a given Emacs implementation. By +default Org mode forces dates into the compatibility range 1970–2037 +which works on all Emacs implementations. If you want to use dates +outside of this range, read the docstring of the variable +‘org-read-date-force-compatible-dates’. + + You can specify a time range by giving start and end times or by +giving a start time and a duration (in HH:MM format). Use one or two +dash(es) as the separator in the former case and use ‘+’ as the +separator in the latter case, e.g.: + +‘11am-1:15pm’ ⇒ 11:00-13:15 +‘11h-13h15’ ⇒ same as above +‘11am--1:15pm’ ⇒ same as above +‘11am+2:15’ ⇒ same as above + + Parallel to the minibuffer prompt, a calendar is popped up(2). When +you exit the date prompt, either by clicking on a date in the calendar, +or by pressing ‘<RET>’, the date selected in the calendar is combined +with the information entered at the prompt. You can control the +calendar fully from the minibuffer: + +‘<RET>’ Choose date at point in calendar. +‘mouse-1’ Select date by clicking on it. +‘S-<RIGHT>’ One day forward. +‘S-<LEFT>’ One day backward. +‘S-<DOWN>’ One week forward. +‘S-<UP>’ One week backward. +‘M-S-<RIGHT>’ One month forward. +‘M-S-<LEFT>’ One month backward. +‘>’ Scroll calendar forward by one month. +‘<’ Scroll calendar backward by one month. +‘M-v’ Scroll calendar forward by 3 months. +‘C-v’ Scroll calendar backward by 3 months. +‘C-.’ Select today’s date(3) + + The actions of the date/time prompt may seem complex, but I assure +you they will grow on you, and you will start getting annoyed by pretty +much any other way of entering a date/time out there. To help you +understand what is going on, the current interpretation of your input is +displayed live in the minibuffer(4). + + ---------- Footnotes ---------- + + (1) See the variable ‘org-read-date-prefer-future’. You may set that +variable to the symbol ‘time’ to even make a time before now shift the +date to tomorrow. + + (2) If you do not need/want the calendar, configure the variable +‘org-popup-calendar-for-date-prompt’. + + (3) You can also use the calendar command ‘.’ to jump to today’s +date, but if you are inserting an hour specification for your timestamp, +‘.’ will then insert a dot after the hour. By contrast, ‘C-.’ will +always jump to today’s date. + + (4) If you find this distracting, turn off the display with +‘org-read-date-display-live’. + + +File: org.info, Node: Custom time format, Prev: The date/time prompt, Up: Creating Timestamps + +8.2.2 Custom time format +------------------------ + +Org mode uses the standard ISO notation for dates and times as it is +defined in ISO 8601. If you cannot get used to this and require another +representation of date and time to keep you happy, you can get it by +customizing the variables ‘org-display-custom-times’ and +‘org-time-stamp-custom-formats’. + +‘C-c C-x C-t’ (‘org-toggle-time-stamp-overlays’) + Toggle the display of custom formats for dates and times. + + Org mode needs the default format for scanning, so the custom +date/time format does not _replace_ the default format. Instead, it is +put _over_ the default format using text properties. This has the +following consequences: + + • You cannot place point onto a timestamp anymore, only before or + after. + + • The ‘S-<UP>’ and ‘S-<DOWN>’ keys can no longer be used to adjust + each component of a timestamp. If point is at the beginning of the + stamp, ‘S-<UP>’ and ‘S-<DOWN>’ change the stamp by one day, just + like ‘S-<LEFT>’ ‘S-<RIGHT>’. At the end of the stamp, change the + time by one minute. + + • If the timestamp contains a range of clock times or a repeater, + these are not overlaid, but remain in the buffer as they were. + + • When you delete a timestamp character-by-character, it only + disappears from the buffer after _all_ (invisible) characters + belonging to the ISO timestamp have been removed. + + • If the custom timestamp format is longer than the default and you + are using dates in tables, table alignment will be messed up. If + the custom format is shorter, things do work as expected. + + +File: org.info, Node: Deadlines and Scheduling, Next: Clocking Work Time, Prev: Creating Timestamps, Up: Dates and Times + +8.3 Deadlines and Scheduling +============================ + +A timestamp may be preceded by special keywords to facilitate planning. +Both the timestamp and the keyword have to be positioned immediately +after the task they refer to. + +‘DEADLINE’ + Meaning: the task—most likely a TODO item, though not + necessarily—is supposed to be finished on that date. + + On the deadline date, the task is listed in the agenda. In + addition, the agenda for _today_ carries a warning about the + approaching or missed deadline, starting + ‘org-deadline-warning-days’ before the due date, and continuing + until the entry is marked as done. An example: + + *** TODO write article about the Earth for the Guide + DEADLINE: <2004-02-29 Sun> + The editor in charge is [[bbdb:Ford Prefect]] + + You can specify a different lead time for warnings for a specific + deadlines using the following syntax. Here is an example with a + warning period of 5 days ‘DEADLINE: <2004-02-29 Sun -5d>’. This + warning is deactivated if the task gets scheduled and you set + ‘org-agenda-skip-deadline-prewarning-if-scheduled’ to ‘t’. + +‘SCHEDULED’ + Meaning: you are planning to start working on that task on the + given date. + + The headline is listed under the given date(1). In addition, a + reminder that the scheduled date has passed is present in the + compilation for _today_, until the entry is marked as done, i.e., + the task is automatically forwarded until completed. + + *** TODO Call Trillian for a date on New Years Eve. + SCHEDULED: <2004-12-25 Sat> + + If you want to _delay_ the display of this task in the agenda, use + ‘SCHEDULED: <2004-12-25 Sat -2d>’: the task is still scheduled on + the 25th but will appear two days later. In case the task contains + a repeater, the delay is considered to affect all occurrences; if + you want the delay to only affect the first scheduled occurrence of + the task, use ‘--2d’ instead. See ‘org-scheduled-delay-days’ and + ‘org-agenda-skip-scheduled-delay-if-deadline’ for details on how to + control this globally or per agenda. + + Important: Scheduling an item in Org mode should _not_ be + understood in the same way that we understand _scheduling a + meeting_. Setting a date for a meeting is just a simple + appointment, you should mark this entry with a simple plain + timestamp, to get this item shown on the date where it + applies. This is a frequent misunderstanding by Org users. + In Org mode, _scheduling_ means setting a date when you want + to start working on an action item. + + You may use timestamps with repeaters in scheduling and deadline +entries. Org mode issues early and late warnings based on the +assumption that the timestamp represents the _nearest instance_ of the +repeater. However, the use of diary expression entries like + + <%%(diary-float t 42)> + +in scheduling and deadline timestamps is limited. Org mode does not +know enough about the internals of each function to issue early and late +warnings. However, it shows the item on each day where the expression +entry matches. + +* Menu: + +* Inserting deadline/schedule:: Planning items. +* Repeated tasks:: Items that show up again and again. + + ---------- Footnotes ---------- + + (1) It will still be listed on that date after it has been marked as +done. If you do not like this, set the variable +‘org-agenda-skip-scheduled-if-done’. + + +File: org.info, Node: Inserting deadline/schedule, Next: Repeated tasks, Up: Deadlines and Scheduling + +8.3.1 Inserting deadlines or schedules +-------------------------------------- + +The following commands allow you to quickly insert a deadline or to +schedule an item:(1) + +‘C-c C-d’ (‘org-deadline’) + Insert ‘DEADLINE’ keyword along with a stamp. The insertion + happens in the line directly following the headline. Remove any + ‘CLOSED’ timestamp . When called with a prefix argument, also + remove any existing deadline from the entry. Depending on the + variable ‘org-log-redeadline’, take a note when changing an + existing deadline(2). + +‘C-c C-s’ (‘org-schedule’) + Insert ‘SCHEDULED’ keyword along with a stamp. The insertion + happens in the line directly following the headline. Remove any + ‘CLOSED’ timestamp. When called with a prefix argument, also + remove the scheduling date from the entry. Depending on the + variable ‘org-log-reschedule’, take a note when changing an + existing scheduling time(3). + +‘C-c / d’ (‘org-check-deadlines’) + Create a sparse tree with all deadlines that are either past-due, + or which will become due within ‘org-deadline-warning-days’. With + ‘C-u’ prefix, show all deadlines in the file. With a numeric + prefix, check that many days. For example, ‘C-1 C-c / d’ shows all + deadlines due tomorrow. + +‘C-c / b’ (‘org-check-before-date’) + Sparse tree for deadlines and scheduled items before a given date. + +‘C-c / a’ (‘org-check-after-date’) + Sparse tree for deadlines and scheduled items after a given date. + + Note that ‘org-schedule’ and ‘org-deadline’ supports setting the date +by indicating a relative time e.g., ‘+1d’ sets the date to the next day +after today, and ‘--1w’ sets the date to the previous week before any +current timestamp. + + ---------- Footnotes ---------- + + (1) The ‘SCHEDULED’ and ‘DEADLINE’ dates are inserted on the line +right below the headline. Do not put any text between this line and the +headline. + + (2) Note the corresponding ‘STARTUP’ options ‘logredeadline’, +‘lognoteredeadline’, and ‘nologredeadline’. + + (3) Note the corresponding ‘STARTUP’ options ‘logreschedule’, +‘lognotereschedule’, and ‘nologreschedule’. + + +File: org.info, Node: Repeated tasks, Prev: Inserting deadline/schedule, Up: Deadlines and Scheduling + +8.3.2 Repeated tasks +-------------------- + +Some tasks need to be repeated again and again. Org mode helps to +organize such tasks using a so-called repeater in a ‘DEADLINE’, +‘SCHEDULED’, or plain timestamps(1). In the following example: + + ** TODO Pay the rent + DEADLINE: <2005-10-01 Sat +1m> + +the ‘+1m’ is a repeater; the intended interpretation is that the task +has a deadline on ‘<2005-10-01>’ and repeats itself every (one) month +starting from that time. You can use yearly, monthly, weekly, daily and +hourly repeat cookies by using the ‘y’, ‘m’, ‘w’, ‘d’ and ‘h’ letters. +If you need both a repeater and a special warning period in a deadline +entry, the repeater should come first and the warning period last + + DEADLINE: <2005-10-01 Sat +1m -3d> + + Deadlines and scheduled items produce entries in the agenda when they +are over-due, so it is important to be able to mark such an entry as +done once you have done so. When you mark a ‘DEADLINE’ or a ‘SCHEDULED’ +with the TODO keyword ‘DONE’, it no longer produces entries in the +agenda. The problem with this is, however, is that then also the _next_ +instance of the repeated entry will not be active. Org mode deals with +this in the following way: when you try to mark such an entry as done, +using ‘C-c C-t’, it shifts the base date of the repeating timestamp by +the repeater interval, and immediately sets the entry state back to +TODO(2). In the example above, setting the state to ‘DONE’ would +actually switch the date like this: + + ** TODO Pay the rent + DEADLINE: <2005-11-01 Tue +1m> + + To mark a task with a repeater as DONE, use ‘C-- 1 C-c C-t’, i.e., +‘org-todo’ with a numeric prefix argument of ‘-1’. + + A timestamp(3) is added under the deadline, to keep a record that you +actually acted on the previous instance of this deadline. + + As a consequence of shifting the base date, this entry is no longer +visible in the agenda when checking past dates, but all future instances +will be visible. + + With the ‘+1m’ cookie, the date shift is always exactly one month. +So if you have not paid the rent for three months, marking this entry +DONE still keeps it as an overdue deadline. Depending on the task, this +may not be the best way to handle it. For example, if you forgot to +call your father for 3 weeks, it does not make sense to call him 3 times +in a single day to make up for it. Finally, there are tasks, like +changing batteries, which should always repeat a certain time _after_ +the last time you did it. For these tasks, Org mode has special +repeaters ‘++’ and ‘.+’. For example: + + ** TODO Call Father + DEADLINE: <2008-02-10 Sun ++1w> + Marking this DONE shifts the date by at least one week, but also + by as many weeks as it takes to get this date into the future. + However, it stays on a Sunday, even if you called and marked it + done on Saturday. + + ** TODO Empty kitchen trash + DEADLINE: <2008-02-08 Fri 20:00 ++1d> + Marking this DONE shifts the date by at least one day, and also + by as many days as it takes to get the timestamp into the future. + Since there is a time in the timestamp, the next deadline in the + future will be on today's date if you complete the task before + 20:00. + + ** TODO Check the batteries in the smoke detectors + DEADLINE: <2005-11-01 Tue .+1m> + Marking this DONE shifts the date to one month after today. + + ** TODO Wash my hands + DEADLINE: <2019-04-05 08:00 Sun .+1h> + Marking this DONE shifts the date to exactly one hour from now. + + You may have both scheduling and deadline information for a specific +task. If the repeater is set for the scheduling information only, you +probably want the repeater to be ignored after the deadline. If so, set +the variable ‘org-agenda-skip-scheduled-if-deadline-is-shown’ to +‘repeated-after-deadline’. However, any scheduling information without +a repeater is no longer relevant once the task is done, and thus, +removed upon repeating the task. If you want both scheduling and +deadline information to repeat after the same interval, set the same +repeater for both timestamps. + + An alternative to using a repeater is to create a number of copies of +a task subtree, with dates shifted in each copy. The command ‘C-c C-x +c’ was created for this purpose; it is described in *note Structure +Editing::. + + ---------- Footnotes ---------- + + (1) Org does not repeat inactive timestamps, however. See *note +Timestamps::. + + (2) In fact, the target state is taken from, in this sequence, the +‘REPEAT_TO_STATE’ property, the variable ‘org-todo-repeat-to-state’ if +it is a string, the previous TODO state if ‘org-todo-repeat-to-state’ is +‘t’, or the first state of the TODO state sequence. + + (3) You can change this using the option ‘org-log-repeat’, or the +‘STARTUP’ options ‘logrepeat’, ‘lognoterepeat’, and ‘nologrepeat’. With +‘lognoterepeat’, you will also be prompted for a note. + + +File: org.info, Node: Clocking Work Time, Next: Effort Estimates, Prev: Deadlines and Scheduling, Up: Dates and Times + +8.4 Clocking Work Time +====================== + +Org mode allows you to clock the time you spend on specific tasks in a +project. When you start working on an item, you can start the clock. +When you stop working on that task, or when you mark the task done, the +clock is stopped and the corresponding time interval is recorded. It +also computes the total time spent on each subtree(1) of a project. And +it remembers a history or tasks recently clocked, so that you can jump +quickly between a number of tasks absorbing your time. + + To save the clock history across Emacs sessions, use: + + (setq org-clock-persist 'history) + (org-clock-persistence-insinuate) + + When you clock into a new task after resuming Emacs, the incomplete +clock(2) is retrieved (see *note Resolving idle time (1)::) and you are +prompted about what to do with it. + +* Menu: + +* Clocking commands:: Starting and stopping a clock. +* The clock table:: Detailed reports. +* Resolving idle time:: Resolving time when you’ve been idle. + + ---------- Footnotes ---------- + + (1) Clocking only works if all headings are indented with less than +30 stars. This is a hard-coded limitation of ‘lmax’ in ‘org-clock-sum’. + + (2) To resume the clock under the assumption that you have worked on +this task while outside Emacs, use ‘(setq org-clock-persist t)’. + + +File: org.info, Node: Clocking commands, Next: The clock table, Up: Clocking Work Time + +8.4.1 Clocking commands +----------------------- + +‘C-c C-x C-i’ (‘org-clock-in’) + Start the clock on the current item (clock-in). This inserts the + ‘CLOCK’ keyword together with a timestamp. If this is not the + first clocking of this item, the multiple ‘CLOCK’ lines are wrapped + into a ‘LOGBOOK’ drawer (see also the variable + ‘org-clock-into-drawer’). You can also overrule the setting of + this variable for a subtree by setting a ‘CLOCK_INTO_DRAWER’ or + ‘LOG_INTO_DRAWER’ property. When called with a ‘C-u’ prefix + argument, select the task from a list of recently clocked tasks. + With two ‘C-u C-u’ prefixes, clock into the task at point and mark + it as the default task; the default task is always be available + with letter ‘d’ when selecting a clocking task. With three ‘C-u + C-u C-u’ prefixes, force continuous clocking by starting the clock + when the last clock stopped. + + While the clock is running, Org shows the current clocking time in + the mode line, along with the title of the task. The clock time + shown is all time ever clocked for this task and its children. If + the task has an effort estimate (see *note Effort Estimates::), the + mode line displays the current clocking time against it(1). If the + task is a repeating one (see *note Repeated tasks::), show only the + time since the last reset of the task(2). You can exercise more + control over show time with the ‘CLOCK_MODELINE_TOTAL’ property. + It may have the values ‘current’ to show only the current clocking + instance, ‘today’ to show all time clocked on this tasks today—see + also the variable ‘org-extend-today-until’, ‘all’ to include all + time, or ‘auto’ which is the default(3). Clicking with ‘mouse-1’ + onto the mode line entry pops up a menu with clocking options. + +‘C-c C-x C-o’ (‘org-clock-out’) + Stop the clock (clock-out). This inserts another timestamp at the + same location where the clock was last started. It also directly + computes the resulting time in inserts it after the time range as + ‘=>HH:MM’. See the variable ‘org-log-note-clock-out’ for the + possibility to record an additional note together with the + clock-out timestamp(4). + +‘C-c C-x C-x’ (‘org-clock-in-last’) + Re-clock the last clocked task. With one ‘C-u’ prefix argument, + select the task from the clock history. With two ‘C-u’ prefixes, + force continuous clocking by starting the clock when the last clock + stopped. + +‘C-c C-x C-e’ (‘org-clock-modify-effort-estimate’) + Update the effort estimate for the current clock task. + +‘C-c C-c’ or ‘C-c C-y’ (‘org-evaluate-time-range’) + Recompute the time interval after changing one of the timestamps. + This is only necessary if you edit the timestamps directly. If you + change them with ‘S-<cursor>’ keys, the update is automatic. + +‘C-S-<UP>’ (‘org-clock-timestamps-up’) +‘C-S-<DOWN>’ (‘org-clock-timestamps-down’) + On CLOCK log lines, increase/decrease both timestamps so that the + clock duration keeps the same value. + +‘S-M-<UP>’ (‘org-timestamp-up’) +‘S-M-<DOWN>’ (‘org-timestamp-down’) + On ‘CLOCK’ log lines, increase/decrease the timestamp at point and + the one of the previous, or the next, clock timestamp by the same + duration. For example, if you hit ‘S-M-<UP>’ to increase a + clocked-out timestamp by five minutes, then the clocked-in + timestamp of the next clock is increased by five minutes. + +‘C-c C-t’ (‘org-todo’) + Changing the TODO state of an item to DONE automatically stops the + clock if it is running in this same item. + +‘C-c C-x C-q’ (‘org-clock-cancel’) + Cancel the current clock. This is useful if a clock was started by + mistake, or if you ended up working on something else. + +‘C-c C-x C-j’ (‘org-clock-goto’) + Jump to the headline of the currently clocked in task. With a + ‘C-u’ prefix argument, select the target task from a list of + recently clocked tasks. + +‘C-c C-x C-d’ (‘org-clock-display’) + Display time summaries for each subtree in the current buffer. + This puts overlays at the end of each headline, showing the total + time recorded under that heading, including the time of any + subheadings. You can use visibility cycling to study the tree, but + the overlays disappear when you change the buffer (see variable + ‘org-remove-highlights-with-change’) or press ‘C-c C-c’. + + The ‘l’ key may be used in the agenda (see *note Weekly/daily +agenda::) to show which tasks have been worked on or closed during a +day. + + *Important:* note that both ‘org-clock-out’ and ‘org-clock-in-last’ +can have a global keybinding and do not modify the window disposition. + + ---------- Footnotes ---------- + + (1) To add an effort estimate “on the fly”, hook a function doing +this to ‘org-clock-in-prepare-hook’. + + (2) The last reset of the task is recorded by the ‘LAST_REPEAT’ +property. + + (3) See also the variable ‘org-clock-mode-line-total’. + + (4) The corresponding in-buffer setting is: ‘#+STARTUP: +lognoteclock-out’. + + +File: org.info, Node: The clock table, Next: Resolving idle time, Prev: Clocking commands, Up: Clocking Work Time + +8.4.2 The clock table +--------------------- + +Org mode can produce quite complex reports based on the time clocking +information. Such a report is called a _clock table_, because it is +formatted as one or several Org tables. + +‘org-clock-report’ + Insert or update a clock table. When called with a prefix + argument, jump to the first clock table in the current document and + update it. The clock table includes archived trees. + + This command can be invoked by calling + ‘org-dynamic-block-insert-dblock’ (‘C-c C-x x’) and selecting + “clocktable” (see *note Dynamic Blocks::). + +‘C-c C-c’ or ‘C-c C-x C-u’ (‘org-dblock-update’) + Update dynamic block at point. Point needs to be in the ‘BEGIN’ + line of the dynamic block. + +‘C-u C-c C-x C-u’ + Update all dynamic blocks (see *note Dynamic Blocks::). This is + useful if you have several clock table blocks in a buffer. + +‘S-<LEFT>’ +‘S-<RIGHT>’ (‘org-clocktable-try-shift’) + Shift the current ‘:block’ interval and update the table. Point + needs to be in the ‘#+BEGIN: clocktable’ line for this command. If + ‘:block’ is ‘today’, it is shifted to ‘today-1’, etc. + + Here is an example of the frame for a clock table as it is inserted +into the buffer by ‘org-clock-report’: + + #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file + #+END: clocktable + + The ‘#+BEGIN’ line contains options to define the scope, structure, +and formatting of the report. Defaults for all these options can be +configured in the variable ‘org-clocktable-defaults’. + + First there are options that determine which clock entries are to be +selected: + +‘:maxlevel’ + Maximum level depth to which times are listed in the table. Clocks + at deeper levels are summed into the upper level. + +‘:scope’ + The scope to consider. This can be any of the following: + + ‘nil’ the current buffer or narrowed region + ‘file’ the full current buffer + ‘subtree’ the subtree where the clocktable is located + ‘treeN’ the surrounding level N tree, for example ‘tree3’ + ‘tree’ the surrounding level 1 tree + ‘agenda’ all agenda files + ‘("file" ...)’ scan these files + ‘FUNCTION’ scan files returned by calling FUNCTION with no argument + ‘file-with-archives’ current file and its archives + ‘agenda-with-archives’ all agenda files, including archives + +‘:block’ + The time block to consider. This block is specified either + 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’(1) all clocked time ever + + When this option is not set, Org falls back to the value in + ‘org-clock-display-default-range’, which defaults to the current + year. + + Use ‘S-<LEFT>’ or ‘S-<RIGHT>’ to shift the time interval. + +‘:tstart’ + A time string specifying when to start considering times. Relative + times like ‘"<-2w>"’ can also be used. See *note Matching tags and + properties:: for relative time syntax. + +‘:tend’ + A time string specifying when to stop considering times. Relative + times like ‘"<now>"’ can also be used. See *note Matching tags and + properties:: for relative time syntax. + +‘:wstart’ + The starting day of the week. The default is 1 for Monday. + +‘:mstart’ + The starting day of the month. The default is 1 for the first. + +‘:step’ + Set to ‘day’, ‘week’, ‘semimonth’, ‘month’, or ‘year’ to split the + table into chunks. To use this, either ‘:block’, or ‘:tstart’ and + ‘:tend’ are required. + +‘:stepskip0’ + When non-‘nil’, do not show steps that have zero time. + +‘:fileskip0’ + When non-‘nil’, do not show table sections from files which did not + contribute. + +‘:match’ + A tags match to select entries that should contribute. See *note + Matching tags and properties:: for the match syntax. + + Then there are options that determine the formatting of the table. +There options are interpreted by the function +‘org-clocktable-write-default’, but you can specify your own function +using the ‘:formatter’ parameter. + +‘:emphasize’ + When non-‘nil’, emphasize level one and level two items. + +‘:lang’ + Language(2) to use for descriptive cells like “Task”. + +‘:link’ + Link the item headlines in the table to their origins. + +‘:narrow’ + An integer to limit the width of the headline column in the Org + table. If you write it like ‘50!’, then the headline is also + shortened in export. + +‘:indent’ + Indent each headline field according to its level. + +‘:hidefiles’ + Hide the file column when multiple files are used to produce the + table. + +‘:tcolumns’ + Number of columns to be used for times. If this is smaller than + ‘:maxlevel’, lower levels are lumped into one column. + +‘:level’ + Should a level number column be included? + +‘:sort’ + A cons cell containing the column to sort and a sorting type. + E.g., ‘:sort (1 . ?a)’ sorts the first column alphabetically. + +‘:compact’ + Abbreviation for ‘:level nil :indent t :narrow 40! :tcolumns 1’. + All are overwritten except if there is an explicit ‘:narrow’. + +‘:timestamp’ + A timestamp for the entry, when available. Look for ‘SCHEDULED’, + ‘DEADLINE’, ‘TIMESTAMP’ and ‘TIMESTAMP_IA’ special properties (see + *note Special Properties::), in this order. + +‘:tags’ + When this flag is non-‘nil’, show the headline’s tags. + +‘:properties’ + List of properties shown in the table. Each property gets its own + column. + +‘:inherit-props’ + When this flag is non-‘nil’, the values for ‘:properties’ are + inherited. + +‘:formula’ + Content of a ‘TBLFM’ keyword to be added and evaluated. As a + special case, ‘:formula %’ adds a column with % time. If you do + not specify a formula here, any existing formula below the clock + table survives updates and is evaluated. + +‘:formatter’ + A function to format clock data and insert it into the buffer. + + To get a clock summary of the current level 1 tree, for the current +day, you could write: + + #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t + #+END: clocktable + +To use a specific time range you could write(3) + + #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>" + :tend "<2006-08-10 Thu 12:00>" + #+END: clocktable + +A range starting a week ago and ending right now could be written as + + #+BEGIN: clocktable :tstart "<-1w>" :tend "<now>" + #+END: clocktable + +A summary of the current subtree with % times would be + + #+BEGIN: clocktable :scope subtree :link t :formula % + #+END: clocktable + +A horizontally compact representation of everything clocked during last +week would be + + #+BEGIN: clocktable :scope agenda :block lastweek :compact t + #+END: clocktable + + ---------- Footnotes ---------- + + (1) When using ‘:step’, ‘untilnow’ starts from the beginning of 2003, +not the beginning of time. + + (2) Language terms can be set through the variable +‘org-clock-clocktable-language-setup’. + + (3) Note that all parameters must be specified in a single line—the +line is broken here only to fit it into the manual. + + +File: org.info, Node: Resolving idle time, Prev: The clock table, Up: Clocking Work Time + +8.4.3 Resolving idle time and continuous clocking +------------------------------------------------- + +Resolving idle time +................... + +If you clock in on a work item, and then walk away from your +computer—perhaps to take a phone call—you often need to “resolve” the +time you were away by either subtracting it from the current clock, or +applying it to another one. + + 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(1), 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 choices to correct the +discrepancy: + +‘k’ + To keep some or all of the minutes and stay clocked in, press ‘k’. + Org asks how many of the minutes to keep. Press ‘<RET>’ to keep + them all, effectively changing nothing, or enter a number to keep + that many minutes. + +‘K’ + If you use the shift key and press ‘K’, it keeps however many + minutes you request and then immediately clock out of that task. + If you keep all of the minutes, this is the same as just clocking + out of the current task. + +‘s’ + To keep none of the minutes, use ‘s’ to subtract all the away time + from the clock, and then check back in from the moment you + returned. + +‘S’ + To keep none of the minutes and just clock out at the start of the + away time, use the shift key and press ‘S’. Remember that using + shift always leave you clocked out, no matter which option you + choose. + +‘C’ + To cancel the clock altogether, use ‘C’. Note that if instead of + canceling you subtract the away time, and the resulting clock + amount is less than a minute, the clock is still canceled rather + than cluttering up the log with an empty entry. + + What if you subtracted those away minutes from the current clock, and +now want to apply them to a new clock? Simply clock in to any task +immediately after the subtraction. Org will notice that you have +subtracted time “on the books”, so to speak, and will ask if you want to +apply those minutes to the next task you clock in on. + + There is one other instance when this clock resolution magic occurs. +Say you were clocked in and hacking away, and suddenly your cat chased a +mouse who scared a hamster that crashed into your UPS’s power button! +You suddenly lose all your buffers, but thanks to auto-save you still +have your recent Org mode changes, including your last clock in. + + If you restart Emacs and clock into any task, Org will notice that +you have a dangling clock which was never clocked out from your last +session. Using that clock’s starting time as the beginning of the +unaccounted-for period, Org will ask how you want to resolve that time. +The logic and behavior is identical to dealing with away time due to +idleness; it is just happening due to a recovery event rather than a set +amount of idle time. + + You can also check all the files visited by your Org agenda for +dangling clocks at any time using ‘M-x org-resolve-clocks <RET>’ (or +‘C-c C-x C-z’). + +Continuous clocking +................... + +You may want to start clocking from the time when you clocked out the +previous task. To enable this systematically, set +‘org-clock-continuously’ to non-‘nil’. Each time you clock in, Org +retrieves the clock-out time of the last clocked entry for this session, +and start the new clock from there. + + If you only want this from time to time, use three universal prefix +arguments with ‘org-clock-in’ and two ‘C-u C-u’ with +‘org-clock-in-last’. + +Clocking out automatically after some idle time +............................................... + +When you often forget to clock out before being idle and you don’t want +to manually set the clocking time to take into account, you can set +‘org-clock-auto-clockout-timer’ to a number of seconds and add +‘(org-clock-auto-clockout-insinuate)’ to your ‘.emacs’ file. + + When the clock is running and Emacs is idle for more than this number +of seconds, the clock will be clocked out automatically. + + Use ‘M-x org-clock-toggle-auto-clockout RET’ to temporarily turn this +on or off. + + ---------- Footnotes ---------- + + (1) 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 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. + + +File: org.info, Node: Effort Estimates, Next: Timers, Prev: Clocking Work Time, Up: Dates and Times + +8.5 Effort Estimates +==================== + +If you want to plan your work in a very detailed way, or if you need to +produce offers with quotations of the estimated work effort, you may +want to assign effort estimates to entries. If you are also clocking +your work, you may later want to compare the planned effort with the +actual working time, a great way to improve planning estimates. + + Effort estimates are stored in a special property ‘EFFORT’. Multiple +formats are supported, such as ‘3:12’, ‘1:23:45’, or ‘1d3h5min’; see the +file ‘org-duration.el’ for more detailed information about the format. + + You can set the effort for an entry with the following commands: + +‘C-c C-x e’ (‘org-set-effort’) + Set the effort estimate for the current entry. With a prefix + argument, set it to the next allowed value—see below. This command + is also accessible from the agenda with the ‘e’ key. + +‘C-c C-x C-e’ (‘org-clock-modify-effort-estimate’) + Modify the effort estimate of the item currently being clocked. + + Clearly the best way to work with effort estimates is through column +view (see *note Column View::). You should start by setting up discrete +values for effort estimates, and a ‘COLUMNS’ format that displays these +values together with clock sums—if you want to clock your time. For a +specific buffer you can use: + + #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 + #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM + +or, even better, you can set up these values globally by customizing the +variables ‘org-global-properties’ and ‘org-columns-default-format’. In +particular if you want to use this setup also in the agenda, a global +setup may be advised. + + The way to assign estimates to individual items is then to switch to +column mode, and to use ‘S-<RIGHT>’ and ‘S-<LEFT>’ to change the value. +The values you enter are immediately summed up in the hierarchy. In the +column next to it, any clocked time is displayed. + + If you switch to column view in the daily/weekly agenda, the effort +column summarizes the estimated work effort for each day(1), and you can +use this to find space in your schedule. To get an overview of the +entire part of the day that is committed, you can set the option +‘org-agenda-columns-add-appointments-to-effort-sum’. The appointments +on a day that take place over a specified time interval are then also +added to the load estimate of the day. + + Effort estimates can be used in secondary agenda filtering that is +triggered with the ‘/’ key in the agenda (see *note Agenda Commands::). +If you have these estimates defined consistently, two or three key +presses narrow down the list to stuff that fits into an available time +slot. + + ---------- Footnotes ---------- + + (1) Please note the pitfalls of summing hierarchical data in a flat +list (see *note Agenda Column View::). + + +File: org.info, Node: Timers, Prev: Effort Estimates, Up: Dates and Times + +8.6 Taking Notes with a Relative Timer +====================================== + +Org provides two types of timers. There is a relative timer that counts +up, which can be useful when taking notes during, for example, a meeting +or a video viewing. There is also a countdown timer. + + The relative and countdown are started with separate commands. + +‘C-c C-x 0’ (‘org-timer-start’) + Start or reset the relative timer. By default, the timer is set to + 0. When called with a ‘C-u’ prefix, prompt the user for a starting + offset. If there is a timer string at point, this is taken as the + default, providing a convenient way to restart taking notes after a + break in the process. When called with a double prefix argument + ‘C-u C-u’, change all timer strings in the active region by a + certain amount. This can be used to fix timer strings if the timer + was not started at exactly the right moment. + +‘C-c C-x ;’ (‘org-timer-set-timer’) + Start a countdown timer. The user is prompted for a duration. + ‘org-timer-default-timer’ sets the default countdown value. Giving + a numeric prefix argument overrides this default value. This + command is available as ‘;’ in agenda buffers. + + Once started, relative and countdown timers are controlled with the +same commands. + +‘C-c C-x .’ (‘org-timer’) + Insert a relative time into the buffer. The first time you use + this, the timer starts. Using a prefix argument restarts it. + +‘C-c C-x -’ (‘org-timer-item’) + Insert a description list item with the current relative time. + With a prefix argument, first reset the timer to 0. + +‘M-<RET>’ (‘org-insert-heading’) + Once the timer list is started, you can also use ‘M-<RET>’ to + insert new timer items. + +‘C-c C-x ,’ (‘org-timer-pause-or-continue’) + Pause the timer, or continue it if it is already paused. + +‘C-c C-x _’ (‘org-timer-stop’) + Stop the timer. After this, you can only start a new timer, not + continue the old one. This command also removes the timer from the + mode line. + + +File: org.info, Node: Refiling and Archiving, Next: Capture and Attachments, Prev: Dates and Times, Up: Top + +9 Refiling and Archiving +************************ + +Once information is in the system, it may need to be moved around. Org +provides Refile, Copy and Archive commands for this. Refile and Copy +helps with moving and copying outlines. Archiving helps to keep the +system compact and fast. + +* Menu: + +* Refile and Copy:: Moving/copying a tree from one place to another. +* Archiving:: What to do with finished products. + + +File: org.info, Node: Refile and Copy, Next: Archiving, Up: Refiling and Archiving + +9.1 Refile and Copy +=================== + +When reviewing the captured data, you may want to refile or to copy some +of the entries into a different list, for example into a project. +Cutting, finding the right location, and then pasting the note is +cumbersome. To simplify this process, you can use the following special +command: + +‘C-c C-w’ (‘org-refile’) + Refile the entry or region at point. This command offers possible + locations for refiling the entry and lets you select one with + completion. The item (or all items in the region) is filed below + the target heading as a subitem. Depending on + ‘org-reverse-note-order’, it is either the first or last subitem. + + By default, all level 1 headlines in the current buffer are + considered to be targets, but you can have more complex definitions + across a number of files. See the variable ‘org-refile-targets’ + for details. If you would like to select a location via a + file-path-like completion along the outline path, see the variables + ‘org-refile-use-outline-path’ and + ‘org-outline-path-complete-in-steps’. If you would like to be able + to create new nodes as new parents for refiling on the fly, check + the variable ‘org-refile-allow-creating-parent-nodes’. When the + variable ‘org-log-refile’(1) is set, a timestamp or a note is + recorded whenever an entry is refiled. + +‘C-u C-c C-w’ + Use the refile interface to jump to a heading. + +‘C-u C-u C-c C-w’ (‘org-refile-goto-last-stored’) + Jump to the location where ‘org-refile’ last moved a tree to. + +‘C-2 C-c C-w’ + Refile as the child of the item currently being clocked. + +‘C-3 C-c C-w’ + Refile and keep the entry in place. Also see ‘org-refile-keep’ to + make this the default behavior, and beware that this may result in + duplicated ‘ID’ properties. + +‘C-0 C-c C-w’ or ‘C-u C-u C-u C-c C-w’ (‘org-refile-cache-clear’) + Clear the target cache. Caching of refile targets can be turned on + by setting ‘org-refile-use-cache’. To make the command see new + possible targets, you have to clear the cache with this command. + +‘C-c M-w’ (‘org-refile-copy’) + Copying works like refiling, except that the original note is not + deleted. + +‘C-c C-M-w’ (‘org-refile-reverse’) + Works like refiling, except that it temporarily toggles how the + value of ‘org-reverse-note-order’ applies to the current buffer. + So if ‘org-refile’ would append the entry as the last entry under + the target header, ‘org-refile-reverse’ will prepend it as the + first entry, and vice-versa. + + ---------- Footnotes ---------- + + (1) Note the corresponding ‘STARTUP’ options ‘logrefile’, +‘lognoterefile’, and ‘nologrefile’. + + +File: org.info, Node: Archiving, Prev: Refile and Copy, Up: Refiling and Archiving + +9.2 Archiving +============= + +When a project represented by a (sub)tree is finished, you may want to +move the tree out of the way and to stop it from contributing to the +agenda. Archiving is important to keep your working files compact and +global searches like the construction of agenda views fast. + +‘C-c C-x C-a’ (‘org-archive-subtree-default’) + Archive the current entry using the command specified in the + variable ‘org-archive-default-command’. + +* Menu: + +* Moving subtrees:: Moving a tree to an archive file. +* Internal archiving:: Switch off a tree but keep it in the file. + + +File: org.info, Node: Moving subtrees, Next: Internal archiving, Up: Archiving + +9.2.1 Moving a tree to an archive file +-------------------------------------- + +The most common archiving action is to move a project tree to another +file, the archive file. + +‘C-c C-x C-s’ or short ‘C-c $’ (‘org-archive-subtree’) + Archive the subtree starting at point position to the location + given by ‘org-archive-location’. + +‘C-u C-c C-x C-s’ + Check if any direct children of the current headline could be moved + to the archive. To do this, check each subtree for open TODO + entries. If none is found, the command offers to move it to the + archive location. If point is _not_ on a headline when this + command is invoked, check level 1 trees. + +‘C-u C-u C-c C-x C-s’ + As above, but check subtree for timestamps instead of TODO entries. + The command offers to archive the subtree if it _does_ contain a + timestamp, and that timestamp is in the past. + + The default archive location is a file in the same directory as the +current file, with the name derived by appending ‘_archive’ to the +current file name. You can also choose what heading to file archived +items under, with the possibility to add them to a datetree in a file. +For information and examples on how to specify the file and the heading, +see the documentation string of the variable ‘org-archive-location’. + + There is also an in-buffer option for setting this variable, for +example: + + #+ARCHIVE: %s_done:: + + If you would like to have a special archive location for a single +entry or a (sub)tree, give the entry an ‘ARCHIVE’ property with the +location as the value (see *note Properties and Columns::). + + When a subtree is moved, it receives a number of special properties +that record context information like the file from where the entry came, +its outline path the archiving time etc. Configure the variable +‘org-archive-save-context-info’ to adjust the amount of information +added. + + When ‘org-archive-subtree-save-file-p’ is non-‘nil’, save the target +archive buffer. + + +File: org.info, Node: Internal archiving, Prev: Moving subtrees, Up: Archiving + +9.2.2 Internal archiving +------------------------ + +If you want to just switch off—for agenda views—certain subtrees without +moving them to a different file, you can use the ‘ARCHIVE’ tag. + + A headline that is marked with the ‘ARCHIVE’ tag (see *note Tags::) +stays at its location in the outline tree, but behaves in the following +way: + + • It does not open when you attempt to do so with a visibility + cycling command (see *note Visibility Cycling::). You can force + cycling archived subtrees with ‘C-<TAB>’, or by setting the option + ‘org-cycle-open-archived-trees’. Also normal outline commands, + like ‘outline-show-all’, open archived subtrees. + + • During sparse tree construction (see *note Sparse Trees::), matches + in archived subtrees are not exposed, unless you configure the + option ‘org-sparse-tree-open-archived-trees’. + + • During agenda view construction (see *note Agenda Views::), the + content of archived trees is ignored unless you configure the + option ‘org-agenda-skip-archived-trees’, in which case these trees + are always included. In the agenda you can press ‘v a’ to get + archives temporarily included. + + • Archived trees are not exported (see *note Exporting::), only the + headline is. Configure the details using the variable + ‘org-export-with-archived-trees’. + + • Archived trees are excluded from column view unless the variable + ‘org-columns-skip-archived-trees’ is configured to ‘nil’. + + The following commands help manage the ‘ARCHIVE’ tag: + +‘C-c C-x a’ (‘org-toggle-archive-tag’) + Toggle the archive tag for the current headline. When the tag is + set, the headline changes to a shadowed face, and the subtree below + it is hidden. + +‘C-u C-c C-x a’ + Check if any direct children of the current headline should be + archived. To do this, check each subtree for open TODO entries. + If none is found, the command offers to set the ‘ARCHIVE’ tag for + the child. If point is _not_ on a headline when this command is + invoked, check the level 1 trees. + +‘C-c C-<TAB>’ (‘org-force-cycle-archived’) + Cycle a tree even if it is tagged with ‘ARCHIVE’. + +‘C-c C-x A’ (‘org-archive-to-archive-sibling’) + Move the current entry to the _Archive Sibling_. This is a sibling + of the entry with the heading ‘Archive’ and the archive tag. The + entry becomes a child of that sibling and in this way retains a lot + of its original context, including inherited tags and approximate + position in the outline. + + +File: org.info, Node: Capture and Attachments, Next: Agenda Views, Prev: Refiling and Archiving, Up: Top + +10 Capture and Attachments +************************** + +An important part of any organization system is the ability to quickly +capture new ideas and tasks, and to associate reference material with +them. Org does this using a process called _capture_. It also can +store files related to a task (_attachments_) in a special directory. +Finally, it can parse RSS feeds for information. To learn how to let +external programs (for example a web browser) trigger Org to capture +material, see *note Protocols::. + +* Menu: + +* Capture:: Capturing new stuff. +* Attachments:: Attach files to outlines. +* RSS Feeds:: Getting input from RSS feeds. + + +File: org.info, Node: Capture, Next: Attachments, Up: Capture and Attachments + +10.1 Capture +============ + +Capture lets you quickly store notes with little interruption of your +work flow. Org’s method for capturing new items is heavily inspired by +John Wiegley’s excellent Remember package. + +* Menu: + +* Setting up capture:: Where notes will be stored. +* Using capture:: Commands to invoke and terminate capture. +* Capture templates:: Define the outline of different note types. + + +File: org.info, Node: Setting up capture, Next: Using capture, Up: Capture + +10.1.1 Setting up capture +------------------------- + +The following customization sets a default target file for notes. + + (setq org-default-notes-file (concat org-directory "/notes.org")) + + You may also define a global key for capturing new material (see +*note Activation::). + + +File: org.info, Node: Using capture, Next: Capture templates, Prev: Setting up capture, Up: Capture + +10.1.2 Using capture +-------------------- + +‘M-x org-capture’ (‘org-capture’) + Display the capture templates menu. If you have templates defined + (see *note Capture templates::), it offers these templates for + selection or use a new Org outline node as the default template. + It inserts the template into the target file and switch to an + indirect buffer narrowed to this new node. You may then insert the + information you want. + +‘C-c C-c’ (‘org-capture-finalize’) + Once you have finished entering information into the capture + buffer, ‘C-c C-c’ returns you to the window configuration before + the capture process, so that you can resume your work without + further distraction. When called with a prefix argument, finalize + and then jump to the captured item. + +‘C-c C-w’ (‘org-capture-refile’) + Finalize the capture process by refiling the note to a different + place (see *note Refile and Copy::). Please realize that this is a + normal refiling command that will be executed—so point position at + the moment you run this command is important. If you have inserted + a tree with a parent and children, first move point back to the + parent. Any prefix argument given to this command is passed on to + the ‘org-refile’ command. + +‘C-c C-k’ (‘org-capture-kill’) + Abort the capture process and return to the previous state. + + You can also call ‘org-capture’ in a special way from the agenda, +using the ‘k c’ key combination. With this access, any timestamps +inserted by the selected capture template defaults to the date at point +in the agenda, rather than to the current date. + + To find the locations of the last stored capture, use ‘org-capture’ +with prefix commands: + +‘C-u M-x org-capture’ + Visit the target location of a capture template. You get to select + the template in the usual way. + +‘C-u C-u M-x org-capture’ + Visit the last stored capture item in its buffer. + + You can also jump to the bookmark ‘org-capture-last-stored’, which is +automatically created unless you set ‘org-capture-bookmark’ to ‘nil’. + + To insert the capture at point in an Org buffer, call ‘org-capture’ +with a ‘C-0’ prefix argument. + + +File: org.info, Node: Capture templates, Prev: Using capture, Up: Capture + +10.1.3 Capture templates +------------------------ + +You can use templates for different types of capture items, and for +different target locations. The easiest way to create such templates is +through the customize interface. + +‘C’ + Customize the variable ‘org-capture-templates’. + + Before we give the formal description of template definitions, let’s +look at an example. Say you would like to use one template to create +general TODO entries, and you want to put these entries under the +heading ‘Tasks’ in your file ‘~/org/gtd.org’. Also, a date tree in the +file ‘journal.org’ should capture journal entries. A possible +configuration would look like: + + (setq org-capture-templates + '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks") + "* TODO %?\n %i\n %a") + ("j" "Journal" entry (file+datetree "~/org/journal.org") + "* %?\nEntered on %U\n %i\n %a"))) + + If you then press ‘t’ from the capture menu, Org will prepare the +template for you like this: + + * TODO + [[file:LINK TO WHERE YOU INITIATED CAPTURE]] + +During expansion of the template, ‘%a’ has been replaced by a link to +the location from where you called the capture command. This can be +extremely useful for deriving tasks from emails, for example. You fill +in the task definition, press ‘C-c C-c’ and Org returns you to the same +place where you started the capture process. + + To define special keys to capture to a particular template without +going through the interactive template selection, you can create your +key binding like this: + + (define-key global-map (kbd "C-c x") + (lambda () (interactive) (org-capture nil "x"))) + +* Menu: + +* Template elements:: What is needed for a complete template entry. +* Template expansion:: Filling in information about time and context. +* Templates in contexts:: Only show a template in a specific context. + + +File: org.info, Node: Template elements, Next: Template expansion, Up: Capture templates + +10.1.3.1 Template elements +.......................... + +Now lets look at the elements of a template definition. Each entry in +‘org-capture-templates’ is a list with the following items: + +keys + The keys that selects the template, as a string, characters only, + for example ‘"a"’, for a template to be selected with a single key, + or ‘"bt"’ for selection with two keys. When using several keys, + keys using the same prefix key must be sequential in the list and + preceded by a 2-element entry explaining the prefix key, for + example: + + ("b" "Templates for marking stuff to buy") + + If you do not define a template for the ‘C’ key, this key opens the + Customize buffer for this complex variable. + +description + A short string describing the template, shown during selection. + +type + The type of entry, a symbol. Valid values are: + + ‘entry’ + An Org mode node, with a headline. Will be filed as the child + of the target entry or as a top-level entry. The target file + should be an Org file. + + ‘item’ + A plain list item, placed in the first plain list at the + target location. Again the target file should be an Org file. + + ‘checkitem’ + A checkbox item. This only differs from the plain list item + by the default template. + + ‘table-line’ + A new line in the first table at the target location. Where + exactly the line will be inserted depends on the properties + ‘:prepend’ and ‘:table-line-pos’ (see below). + + ‘plain’ + Text to be inserted as it is. + +target + Specification of where the captured item should be placed. In Org + files, targets usually define a node. Entries will become children + of this node. Other types will be added to the table or list in + the body of this node. Most target specifications contain a file + name. If that file name is the empty string, it defaults to + ‘org-default-notes-file’. A file can also be given as a variable + or as a function called with no argument. When an absolute path is + not specified for a target, it is taken as relative to + ‘org-directory’. + + Valid values are: + + ‘(file "path/to/file")’ + Text will be placed at the beginning or end of that file. + + ‘(id "id of existing org entry")’ + Filing as child of this entry, or in the body of the entry. + + ‘(file+headline "filename" "node headline")’ + Fast configuration if the target heading is unique in the + file. + + ‘(file+olp "filename" "Level 1 heading" "Level 2" ...)’ + For non-unique headings, the full path is safer. + + ‘(file+regexp "filename" "regexp to find location")’ + Use a regular expression to position point. + + ‘(file+olp+datetree "filename" [ "Level 1 heading" ...])’ + This target(1) creates a heading in a date tree(2) 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 below for additional options. + + ‘(file+function "filename" function-finding-location)’ + A function to find the right location in the file. + + ‘(clock)’ + File to the entry that is currently being clocked. + + ‘(function function-finding-location)’ + Most general way: write your own function which both visits + the file and moves point to the right location. + +template + The template for creating the capture item. If you leave this + empty, an appropriate default template will be used. Otherwise + this is a string with escape codes, which will be replaced + depending on time and context of the capture call. You may also + get this template string from a file(3), or dynamically, from a + function using either syntax: + + (file "/path/to/template-file") + (function FUNCTION-RETURNING-THE-TEMPLATE) + +properties + The rest of the entry is a property list of additional options. + Recognized properties are: + + ‘:prepend’ + Normally new captured information will be appended at the + target location (last child, last table line, last list item, + ...). Setting this property changes that. + + ‘:immediate-finish’ + When set, do not offer to edit the information, just file it + away immediately. This makes sense if the template only needs + information that can be added automatically. + + ‘:jump-to-captured’ + When set, jump to the captured entry when finished. + + ‘:empty-lines’ + Set this to the number of lines to insert before and after the + new item. Default 0, and the only other common value is 1. + + ‘:empty-lines-after’ + Set this to the number of lines that should be inserted after + the new item. Overrides ‘:empty-lines’ for the number of + lines inserted after. + + ‘:empty-lines-before’ + Set this to the number of lines that should be inserted before + the new item. Overrides ‘:empty-lines’ for the number lines + inserted before. + + ‘:clock-in’ + Start the clock in this item. + + ‘:clock-keep’ + Keep the clock running when filing the captured entry. + + ‘:clock-resume’ + If starting the capture interrupted a clock, restart that + clock when finished with the capture. Note that ‘:clock-keep’ + has precedence over ‘:clock-resume’. When setting both to + non-‘nil’, the current clock will run and the previous one + will not be resumed. + + ‘:time-prompt’ + Prompt for a date/time to be used for date/week trees and when + filling the template. Without this property, capture uses the + current date and time. Even if this property has not been + set, you can force the same behavior by calling ‘org-capture’ + with a ‘C-1’ prefix argument. + + ‘:tree-type’ + Use ‘week’ to make a week tree instead of the month-day tree, + i.e., place the headings for each day under a heading with the + current ISO week. Use ‘month’ to group entries by month only. + Default is to group entries by day. + + ‘:unnarrowed’ + Do not narrow the target buffer, simply show the full buffer. + Default is to narrow it so that you only see the new material. + + ‘:table-line-pos’ + Specification of the location in the table where the new line + should be inserted. It should be a string like ‘II-3’ meaning + that the new line should become the third line before the + second horizontal separator line. + + ‘:kill-buffer’ + If the target file was not yet visited when capture was + invoked, kill the buffer again after capture is completed. + + ‘:no-save’ + Do not save the target file after finishing the capture. + + ~:refile-targets + Temporarily set ‘org-refile-targets’ to the value of this + property. + + ---------- Footnotes ---------- + + (1) 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. + + (2) 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. Tags are allowed in the tree structure. + + (3) When the file name is not absolute, Org assumes it is relative to +‘org-directory’. + + +File: org.info, Node: Template expansion, Next: Templates in contexts, Prev: Template elements, Up: Capture templates + +10.1.3.2 Template expansion +........................... + +In the template itself, special “%-escapes”(1) allow dynamic insertion +of content. The templates are expanded in the order given here: + +‘%[FILE]’ + Insert the contents of the file given by FILE. + +‘%(EXP)’ + Evaluate Elisp expression EXP and replace it with the result. The + EXP form must return a string. Only placeholders pre-existing + within the template, or introduced with ‘%[file]’, are expanded + this way. Since this happens after expanding non-interactive + “%-escapes”, those can be used to fill the expression. + +‘%<FORMAT>’ + The result of format-time-string on the FORMAT specification. + +‘%t’ + Timestamp, date only. + +‘%T’ + Timestamp, with date and time. + +‘%u’, ‘%U’ + Like ‘%t’, ‘%T’ above, but inactive timestamps. + +‘%i’ + Initial content, the region when capture is called while the region + is active. If there is text before ‘%i’ on the same line, such as + indentation, and ‘%i’ is not inside a ‘%(exp)’ form, that prefix is + added before every line in the inserted text. + +‘%a’ + Annotation, normally the link created with ‘org-store-link’. + +‘%A’ + Like ‘%a’, but prompt for the description part. + +‘%l’ + Like ‘%a’, but only insert the literal link. + +‘%L’ + Like ‘%l’, but without brackets (the link content itself). + +‘%c’ + Current kill ring head. + +‘%x’ + Content of the X clipboard. + +‘%k’ + Title of the currently clocked task. + +‘%K’ + Link to the currently clocked task. + +‘%n’ + User name (taken from ‘user-full-name’). + +‘%f’ + File visited by current buffer when org-capture was called. + +‘%F’ + Full path of the file or directory visited by current buffer. + +‘%:keyword’ + Specific information for certain link types, see below. + +‘%^g’ + Prompt for tags, with completion on tags in target file. + +‘%^G’ + Prompt for tags, with completion all tags in all agenda files. + +‘%^t’ + Like ‘%t’, but prompt for date. Similarly ‘%^T’, ‘%^u’, ‘%^U’. + You may define a prompt like ‘%^{Birthday}t’. + +‘%^C’ + Interactive selection of which kill or clip to use. + +‘%^L’ + Like ‘%^C’, but insert as link. + +‘%^{PROP}p’ + Prompt the user for a value for property PROP. You may specify a + default value with ‘%^{PROP|default}’. + +‘%^{PROMPT}’ + Prompt the user for a string and replace this sequence with it. + You may specify a default value and a completion table with + ‘%^{prompt|default|completion2|completion3...}’. The arrow keys + access a prompt-specific history. + +‘%\N’ + Insert the text entered at the Nth ‘%^{PROMPT}’, where N is a + number, starting from 1. + +‘%?’ + After completing the template, position point here. + + For specific link types, the following keywords are defined(2): + +Link type Available keywords +-------------------------------------------------------------------------- +bbdb ‘%:name’, ‘%:company’ +irc ‘%:server’, ‘%:port’, ‘%:nick’ +mh, rmail ‘%:type’, ‘%:subject’, ‘%:message-id’ + ‘%:from’, ‘%:fromname’, ‘%:fromaddress’ + ‘%:to’, ‘%:toname’, ‘%:toaddress’ + ‘%: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”)(3) +gnus ‘%:group’, for messages also all email fields +w3, w3m ‘%:url’ +info ‘%:file’, ‘%:node’ +calendar ‘%:date’ +org-protocol ‘%:link’, ‘%:description’, ‘%:annotation’ + + ---------- Footnotes ---------- + + (1) If you need one of these sequences literally, escape the ‘%’ with +a backslash. + + (2) If you define your own link types (see *note Adding Hyperlink +Types::), any property you store with ‘org-store-link-props’ can be +accessed in capture templates in a similar way. + + (3) This is always the other, not the user. See the variable +‘org-link-from-user-regexp’. + + +File: org.info, Node: Templates in contexts, Prev: Template expansion, Up: Capture templates + +10.1.3.3 Templates in contexts +.............................. + +To control whether a capture template should be accessible from a +specific context, you can customize ‘org-capture-templates-contexts’. +Let’s say, for example, that you have a capture template “p” for storing +Gnus emails containing patches. Then you would configure this option +like this: + + (setq org-capture-templates-contexts + '(("p" ((in-mode . "message-mode"))))) + + You can also tell that the command key ‘p’ should refer to another +template. In that case, add this command key like this: + + (setq org-capture-templates-contexts + '(("p" "q" ((in-mode . "message-mode"))))) + + See the docstring of the variable for more information. + + +File: org.info, Node: Attachments, Next: RSS Feeds, Prev: Capture, Up: Capture and Attachments + +10.2 Attachments +================ + +It is often useful to associate reference material with an outline node. +Small chunks of plain text can simply be stored in the subtree of a +project. Hyperlinks (see *note Hyperlinks::) can establish associations +with files that live elsewhere on a local, or even remote, computer, +like emails or source code files belonging to a project. + + Another method is _attachments_, which are files located in a +directory belonging to an outline node. Org uses directories either +named by a unique ID of each entry, or by a ‘DIR’ property. + +* Menu: + +* Attachment defaults and dispatcher:: How to access attachment commands +* Attachment options:: Configuring the attachment system +* Attachment links:: Hyperlink access to attachments +* Automatic version-control with Git:: Everything safely stored away +* Attach from Dired:: Using dired to select an attachment + + +File: org.info, Node: Attachment defaults and dispatcher, Next: Attachment options, Up: Attachments + +10.2.1 Attachment defaults and dispatcher +----------------------------------------- + +By default, Org attach uses ID properties when adding attachments to +outline nodes. This makes working with attachments fully automated. +There is no decision needed for folder-name or location. ID-based +directories are by default located in the ‘data/’ directory, which lives +in the same directory where your Org file lives(1). + + When attachments are made using ‘org-attach’ a default tag ‘ATTACH’ +is added to the node that gets the attachments. + + For more control over the setup, see *note Attachment options::. + + The following commands deal with attachments: + +‘C-c C-a’ (‘org-attach’) + The dispatcher for commands related to the attachment system. + After these keys, a list of commands is displayed and you must + press an additional key to select a command: + + ‘a’ (‘org-attach-attach’) + Select a file and move it into the task’s attachment + directory. The file is copied, moved, or linked, depending on + ‘org-attach-method’. Note that hard links are not supported + on all systems. + + ‘c’/‘m’/‘l’ + Attach a file using the copy/move/link method. Note that hard + links are not supported on all systems. + + ‘b’ (‘org-attach-buffer’) + Select a buffer and save it as a file in the task’s attachment + directory. + + ‘n’ (‘org-attach-new’) + Create a new attachment as an Emacs buffer. + + ‘z’ (‘org-attach-sync’) + Synchronize the current task with its attachment directory, in + case you added attachments yourself. + + ‘o’ (‘org-attach-open’) + Open current task’s attachment. If there is more than one, + prompt for a file name first. Opening follows the rules set + by ‘org-file-apps’. For more details, see the information on + following hyperlinks (see *note Handling Links::). + + ‘O’ (‘org-attach-open-in-emacs’) + Also open the attachment, but force opening the file in Emacs. + + ‘f’ (‘org-attach-reveal’) + Open the current task’s attachment directory. + + ‘F’ (‘org-attach-reveal-in-emacs’) + Also open the directory, but force using Dired in Emacs. + + ‘d’ (‘org-attach-delete-one’) + Select and delete a single attachment. + + ‘D’ (‘org-attach-delete-all’) + Delete all of a task’s attachments. A safer way is to open + the directory in Dired and delete from there. + + ‘s’ (‘org-attach-set-directory’) + Set a specific directory as the entry’s attachment directory. + This works by putting the directory path into the ‘DIR’ + property. + + ‘S’ (‘org-attach-unset-directory’) + Remove the attachment directory. This command removes the + ‘DIR’ property and asks the user to either move content inside + that folder, if an ‘ID’ property is set, delete the content, + or to leave the attachment directory as is but no longer + attached to the outline node. + + ---------- Footnotes ---------- + + (1) If you move entries or Org files from one directory to another, +you may want to configure ‘org-attach-id-dir’ to contain an absolute +path. + + +File: org.info, Node: Attachment options, Next: Attachment links, Prev: Attachment defaults and dispatcher, Up: Attachments + +10.2.2 Attachment options +------------------------- + +There are a couple of options for attachments that are worth mentioning. + +‘org-attach-id-dir’ + The directory where attachments are stored when ‘ID’ is used as + method. + +‘org-attach-dir-relative’ + When setting the ‘DIR’ property on a node using ‘C-c C-a s’ + (‘org-attach-set-directory’), absolute links are entered by + default. This option changes that to relative links. + +‘org-attach-use-inheritance’ + By default folders attached to an outline node are inherited from + parents according to ‘org-use-property-inheritance’. If one + instead want to set inheritance specifically for Org attach that + can be done using ‘org-attach-use-inheritance’. Inheriting + documents through the node hierarchy makes a lot of sense in most + cases. Especially when using attachment links (see *note + Attachment links::). The following example shows one use case for + attachment inheritance: + + * Chapter A ... + :PROPERTIES: + :DIR: Chapter A/ + :END: + ** Introduction + Some text + + #+NAME: Image 1 + [[attachment:image 1.jpg]] + + Without inheritance one would not be able to resolve the link to + ‘image 1.jpg’, since the link is inside a sub-heading to ‘Chapter + A’. + + Inheritance works the same way for both ‘ID’ and ‘DIR’ property. + If both properties are defined on the same headline then ‘DIR’ + takes precedence. This is also true if inheritance is enabled. If + ‘DIR’ is inherited from a parent node in the outline, that property + still takes precedence over an ‘ID’ property defined on the node + itself. + +‘org-attach-method’ + When attaching files using the dispatcher ‘C-c C-a’ it defaults to + copying files. The behavior can be changed by customizing + ‘org-attach-method’. Options are Copy, Move/Rename, Hard link or + Symbolic link. + +‘org-attach-preferred-new-method’ + This customization lets you choose the default way to attach to + nodes without existing ‘ID’ and ‘DIR’ property. It defaults to + ‘id’ but can also be set to ‘dir’, ‘ask’ or ‘nil’. + +‘org-attach-archive-delete’ + Configure this to determine if attachments should be deleted or not + when a subtree that has attachments is archived. + +‘org-attach-auto-tag’ + When attaching files to a heading it will be assigned a tag + according to what is set here. + +‘org-attach-id-to-path-function-list’ + When ‘ID’ is used for attachments, the ID is parsed into a part of + a directory-path. See ‘org-attach-id-uuid-folder-format’ for the + default function. Define a new one and add it as first element in + ‘org-attach-id-to-path-function-list’ if you want the folder + structure in any other way. All functions in this list will be + tried when resolving existing ID’s into paths, to maintain backward + compatibility with existing folders in your system. + +‘org-attach-store-link-p’ + Stores a link to the file that is being attached. The link is + stored in ‘org-stored-links’ for later insertion with ‘C-c C-l’ + (see *note Handling Links::). Depending on what option is set in + ‘org-attach-store-link-p’, the link is stored to either the + original location as a file link, the attachment location as an + attachment link or to the attachment location as a file link. + +‘org-attach-commands’ + List of all commands used in the attach dispatcher. + +‘org-attach-expert’ + Do not show the splash buffer with the attach dispatcher when + ‘org-attach-expert’ is set to non-‘nil’. + + See customization group ‘Org Attach’ if you want to change the +default settings. + + +File: org.info, Node: Attachment links, Next: Automatic version-control with Git, Prev: Attachment options, Up: Attachments + +10.2.3 Attachment links +----------------------- + +Attached files and folders can be referenced using attachment links. +This makes it easy to refer to the material added to an outline node. +Especially if it was attached using the unique ID of the entry! + + * TODO Some task + :PROPERTIES: + :ID: 95d50008-c12e-479f-a4f2-cc0238205319 + :END: + See attached document for more information: [[attachment:info.org]] + + See *note External Links:: for more information about these links. + + +File: org.info, Node: Automatic version-control with Git, Next: Attach from Dired, Prev: Attachment links, Up: Attachments + +10.2.4 Automatic version-control with Git +----------------------------------------- + +If the directory attached to an outline node is a Git repository, Org +can be configured to automatically commit changes to that repository +when it sees them. + + To make Org mode take care of versioning of attachments for you, add +the following to your Emacs config: + + (require 'org-attach-git) + + +File: org.info, Node: Attach from Dired, Prev: Automatic version-control with Git, Up: Attachments + +10.2.5 Attach from Dired +------------------------ + +It is possible to attach files to a subtree from a Dired buffer. To use +this feature, have one window in Dired mode containing the file(s) to be +attached and another window with point in the subtree that shall get the +attachments. In the Dired window, with point on a file, ‘M-x +org-attach-dired-to-subtree’ attaches the file to the subtree using the +attachment method set by variable ‘org-attach-method’. When files are +marked in the Dired window then all marked files get attached. + + Add the following lines to the Emacs init file to have ‘C-c C-x a’ +attach files in Dired buffers. + + (add-hook 'dired-mode-hook + (lambda () + (define-key dired-mode-map + (kbd "C-c C-x a") + #'org-attach-dired-to-subtree))) + + The following code shows how to bind the previous command with a +specific attachment method. + + (add-hook 'dired-mode-hook + (lambda () + (define-key dired-mode-map (kbd "C-c C-x c") + (lambda () + (interactive) + (let ((org-attach-method 'cp)) + (call-interactively #'org-attach-dired-to-subtree)))))) + + +File: org.info, Node: RSS Feeds, Prev: Attachments, Up: Capture and Attachments + +10.3 RSS Feeds +============== + +Org can add and change entries based on information found in RSS feeds +and Atom feeds. You could use this to make a task out of each new +podcast in a podcast feed. Or you could use a phone-based note-creating +service on the web to import tasks into Org. To access feeds, configure +the variable ‘org-feed-alist’. The docstring of this variable has +detailed information. With the following + + (setq org-feed-alist + '(("Slashdot" + "https://rss.slashdot.org/Slashdot/slashdot" + "~/txt/org/feeds.org" "Slashdot Entries"))) + +new items from the feed provided by ‘rss.slashdot.org’ result in new +entries in the file ‘~/org/feeds.org’ under the heading ‘Slashdot +Entries’, whenever the following command is used: + +‘C-c C-x g’ (‘org-feed-update-all’) + Collect items from the feeds configured in ‘org-feed-alist’ and act + upon them. + +‘C-c C-x G’ (‘org-feed-goto-inbox’) + Prompt for a feed name and go to the inbox configured for this + feed. + + Under the same headline, Org creates a drawer ‘FEEDSTATUS’ in which +it stores information about the status of items in the feed, to avoid +adding the same item several times. + + For more information, including how to read atom feeds, see +‘org-feed.el’ and the docstring of ‘org-feed-alist’. + + +File: org.info, Node: Agenda Views, Next: Markup for Rich Contents, Prev: Capture and Attachments, Up: Top + +11 Agenda Views +*************** + +Due to the way Org works, TODO items, time-stamped items, and tagged +headlines can be scattered throughout a file or even a number of files. +To get an overview of open action items, or of events that are important +for a particular date, this information must be collected, sorted and +displayed in an organized way. + + Org can select items based on various criteria and display them in a +separate buffer. Six different view types are provided: + + • an _agenda_ that is like a calendar and shows information for + specific dates, + + • a _TODO list_ that covers all unfinished action items, + + • a _match view_, showings headlines based on the tags, properties, + and TODO state associated with them, + + • a _text search view_ that shows all entries from multiple files + that contain specified keywords, + + • a _stuck projects view_ showing projects that currently do not move + along, and + + • _custom views_ that are special searches and combinations of + different views. + + The extracted information is displayed in a special _agenda buffer_. +This buffer is read-only, but provides commands to visit the +corresponding locations in the original Org files, and even to edit +these files remotely. + + By default, the report ignores commented (see *note Comment Lines::) +and archived (see *note Internal archiving::) entries. You can override +this by setting ‘org-agenda-skip-comment-trees’ and +‘org-agenda-skip-archived-trees’ to ‘nil’. + + Two variables control how the agenda buffer is displayed and whether +the window configuration is restored when the agenda exits: +‘org-agenda-window-setup’ and ‘org-agenda-restore-windows-after-quit’. + +* Menu: + +* Agenda Files:: Files being searched for agenda information. +* Agenda Dispatcher:: Keyboard access to agenda views. +* Built-in Agenda Views:: What is available out of the box? +* Presentation and Sorting:: How agenda items are prepared for display. +* Agenda Commands:: Remote editing of Org trees. +* Custom Agenda Views:: Defining special searches and views. +* Exporting Agenda Views:: Writing a view to a file. +* Agenda Column View:: Using column view for collected entries. + + +File: org.info, Node: Agenda Files, Next: Agenda Dispatcher, Up: Agenda Views + +11.1 Agenda Files +================= + +The information to be shown is normally collected from all _agenda +files_, the files listed in the variable ‘org-agenda-files’(1). If a +directory is part of this list, all files with the extension ‘.org’ in +this directory are part of the list. + + Thus, even if you only work with a single Org file, that file should +be put into the list(2). You can customize ‘org-agenda-files’, but the +easiest way to maintain it is through the following commands + +‘C-c [’ (‘org-agenda-file-to-front’) + Add current file to the list of agenda files. The file is added to + the front of the list. If it was already in the list, it is moved + to the front. With a prefix argument, file is added/moved to the + end. + +‘C-c ]’ (‘org-remove-file’) + Remove current file from the list of agenda files. + +‘C-'’ +‘C-,’ (‘org-cycle-agenda-files’) + Cycle through agenda file list, visiting one file after the other. + +‘M-x org-switchb’ + Command to use an Iswitchb-like interface to switch to and between + Org buffers. + +The Org menu contains the current list of files and can be used to visit +any of them. + + If you would like to focus the agenda temporarily on a file not in +this list, or on just one file in the list, or even on only a subtree in +a file, then this can be done in different ways. For a single agenda +command, you may press ‘<’ once or several times in the dispatcher (see +*note Agenda Dispatcher::). To restrict the agenda scope for an +extended period, use the following commands: + +‘C-c C-x <’ (‘org-agenda-set-restriction-lock’) + Restrict the agenda to the current subtree. If there already is a + restriction at point, remove it. When called with a universal + prefix argument or with point before the first headline in a file, + set the agenda scope to the entire file. This restriction remains + in effect until removed with ‘C-c C-x >’, or by typing either ‘<’ + or ‘>’ in the agenda dispatcher. If there is a window displaying + an agenda view, the new restriction takes effect immediately. + +‘C-c C-x >’ (‘org-agenda-remove-restriction-lock’) + Remove the restriction created by ‘C-c C-x <’. + + When working with Speedbar, you can use the following commands in the +Speedbar frame: + +‘<’ (‘org-speedbar-set-agenda-restriction’) + Restrict the agenda to the item—either an Org file or a subtree in + such a file—at point in the Speedbar frame. If agenda is already + restricted there, remove the restriction. If there is a window + displaying an agenda view, the new restriction takes effect + immediately. + +‘>’ (‘org-agenda-remove-restriction-lock’) + Remove the restriction. + + ---------- Footnotes ---------- + + (1) If the value of that variable is not a list, but a single file +name, then the list of agenda files in maintained in that external file. + + (2) When using the dispatcher, pressing ‘<’ before selecting a +command actually limits the command to the current file, and ignores +‘org-agenda-files’ until the next dispatcher command. + + +File: org.info, Node: Agenda Dispatcher, Next: Built-in Agenda Views, Prev: Agenda Files, Up: Agenda Views + +11.2 The Agenda Dispatcher +========================== + +The views are created through a dispatcher, accessible with ‘M-x +org-agenda’, or, better, bound to a global key (see *note Activation::). +It displays a menu from which an additional letter is required to +execute a command. The dispatcher offers the following default +commands: + +‘a’ + Create the calendar-like agenda (see *note Weekly/daily agenda::). + +‘t’ +‘T’ + Create a list of all TODO items (see *note Global TODO list::). + +‘m’ +‘M’ + Create a list of headlines matching a given expression (see *note + Matching tags and properties::). + +‘s’ + Create a list of entries selected by a boolean expression of + keywords and/or regular expressions that must or must not occur in + the entry. + +‘/’ + Search for a regular expression in all agenda files and + additionally in the files listed in + ‘org-agenda-text-search-extra-files’. This uses the Emacs command + ‘multi-occur’. A prefix argument can be used to specify the number + of context lines for each match, default is + 1. +‘#’ + Create a list of stuck projects (see *note Stuck projects::). + +‘!’ + Configure the list of stuck projects (see *note Stuck projects::). + +‘<’ + Restrict an agenda command to the current buffer(1). If narrowing + is in effect restrict to the narrowed part of the buffer. After + pressing ‘<’, you still need to press the character selecting the + command. + +‘< <’ + If there is an active region, restrict the following agenda command + to the region. Otherwise, restrict it to the current subtree(2). + After pressing ‘< <’, you still need to press the character + selecting the command. + +‘*’ + Toggle sticky agenda views. By default, Org maintains only a + single agenda buffer and rebuilds it each time you change the view, + to make sure everything is always up to date. If you switch + between views often and the build time bothers you, you can turn on + sticky agenda buffers (make this the default by customizing the + variable ‘org-agenda-sticky’). With sticky agendas, the dispatcher + only switches to the selected view, you need to update it by hand + with ‘r’ or ‘g’. You can toggle sticky agenda view any time with + ‘org-toggle-sticky-agenda’. + + You can also define custom commands that are accessible through the +dispatcher, just like the default commands. This includes the +possibility to create extended agenda buffers that contain several +blocks together, for example the weekly agenda, the global TODO list and +a number of special tags matches. See *note Custom Agenda Views::. + + ---------- Footnotes ---------- + + (1) For backward compatibility, you can also press ‘1’ to restrict to +the current buffer. + + (2) For backward compatibility, you can also press ‘0’ to restrict to +the current region/subtree. + + +File: org.info, Node: Built-in Agenda Views, Next: Presentation and Sorting, Prev: Agenda Dispatcher, Up: Agenda Views + +11.3 The Built-in Agenda Views +============================== + +In this section we describe the built-in views. + +* Menu: + +* Weekly/daily agenda:: The calendar page with current tasks. +* Global TODO list:: All unfinished action items. +* Matching tags and properties:: Structured information with fine-tuned search. +* Search view:: Find entries by searching for text. +* Stuck projects:: Find projects you need to review. + + +File: org.info, Node: Weekly/daily agenda, Next: Global TODO list, Up: Built-in Agenda Views + +11.3.1 Weekly/daily agenda +-------------------------- + +The purpose of the weekly/daily _agenda_ is to act like a page of a +paper agenda, showing all the tasks for the current week or day. + +‘M-x org-agenda a’ (‘org-agenda-list’) + 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(1)—like ‘C-u 2 1 M-x org-agenda a’—you may set the number + of days to be displayed. + + The default number of days displayed in the agenda is set by the +variable ‘org-agenda-span’. This variable can be set to any number of +days you want to see by default in the agenda, or to a span name, such a +‘day’, ‘week’, ‘month’ or ‘year’. For weekly agendas, the default is to +start on the previous Monday (see ‘org-agenda-start-on-weekday’). You +can also set the start date using a date shift: ‘(setq +org-agenda-start-day "+10d")’ starts the agenda ten days from today in +the future. + + Remote editing from the agenda buffer means, for example, that you +can change the dates of deadlines and appointments from the agenda +buffer. The commands available in the Agenda buffer are listed in *note +Agenda Commands::. + +Calendar/Diary integration +.......................... + +Emacs contains the calendar and diary by Edward M. Reingold. The +calendar displays a three-month calendar with holidays from different +countries and cultures. The diary allows you to keep track of +anniversaries, lunar phases, sunrise/set, recurrent appointments +(weekly, monthly) and more. In this way, it is quite complementary to +Org. It can be very useful to combine output from Org with the diary. + + In order to include entries from the Emacs diary into Org mode’s +agenda, you only need to customize the variable + + (setq org-agenda-include-diary t) + +After that, everything happens automatically. All diary entries +including holidays, anniversaries, etc., are included in the agenda +buffer created by Org mode. ‘<SPC>’, ‘<TAB>’, and ‘<RET>’ can be used +from the agenda buffer to jump to the diary file in order to edit +existing diary entries. The ‘i’ command to insert new entries for the +current date works in the agenda buffer, as well as the commands ‘S’, +‘M’, and ‘C’ to display Sunrise/Sunset times, show lunar phases and to +convert to other calendars, respectively. ‘c’ can be used to switch +back and forth between calendar and agenda. + + If you are using the diary only for expression entries and holidays, +it is faster to not use the above setting, but instead to copy or even +move the entries into an Org file. Org mode evaluates diary-style +expression entries, and does it faster because there is no overhead for +first creating the diary display. Note that the expression entries must +start at the left margin, no whitespace is allowed before them, as seen +in the following segment of an Org file:(2) + + * Holidays + :PROPERTIES: + :CATEGORY: Holiday + :END: + %%(org-calendar-holiday) ; special function for holiday names + + * Birthdays + :PROPERTIES: + :CATEGORY: Ann + :END: + %%(org-anniversary 1956 5 14) Arthur Dent is %d years old + %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old + +Anniversaries from BBDB +....................... + +If you are using the Insidious Big Brother Database to store your +contacts, you very likely prefer to store anniversaries in BBDB rather +than in a separate Org or diary file. Org supports this and can show +BBDB anniversaries as part of the agenda. All you need to do is to add +the following to one of your agenda files: + + * Anniversaries + :PROPERTIES: + :CATEGORY: Anniv + :END: + %%(org-bbdb-anniversaries) + + You can then go ahead and define anniversaries for a BBDB record. +Basically, you need a field named ‘anniversary’ for the BBDB record +which contains the date in the format ‘YYYY-MM-DD’ or ‘MM-DD’, followed +by a space and the class of the anniversary (‘birthday’, ‘wedding’, or a +format string). If you omit the class, it defaults to ‘birthday’. Here +are a few examples, the header for the file ‘ol-bbdb.el’ contains more +detailed information. + + 1973-06-22 + 06-22 + 1955-08-02 wedding + 2008-04-14 %s released version 6.01 of Org mode, %d years ago + + After a change to BBDB, or for the first agenda display during an +Emacs session, the agenda display suffers a short delay as Org updates +its hash with anniversaries. However, from then on things will be very +fast, much faster in fact than a long list of ‘%%(diary-anniversary)’ +entries in an Org or Diary file. + + If you would like to see upcoming anniversaries with a bit of +forewarning, you can use the following instead: + + * Anniversaries + :PROPERTIES: + :CATEGORY: Anniv + :END: + %%(org-bbdb-anniversaries-future 3) + + That will give you three days’ warning: on the anniversary date +itself and the two days prior. The argument is optional: if omitted, it +defaults to 7. + +Appointment reminders +..................... + +Org can interact with Emacs appointments notification facility. To add +the appointments of your agenda files, use the command +‘org-agenda-to-appt’. This command lets you filter through the list of +your appointments and add only those belonging to a specific category or +matching a regular expression. It also reads a ‘APPT_WARNTIME’ property +which overrides the value of ‘appt-message-warning-time’ for this +appointment. See the docstring for details. + + ---------- Footnotes ---------- + + (1) For backward compatibility, the universal prefix argument ‘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 +*note Block agenda::). + + (2) The variable ‘org-anniversary’ used in the example is just like +‘diary-anniversary’, but the argument order is always according to ISO +and therefore independent of the value of ‘calendar-date-style’. + + +File: org.info, Node: Global TODO list, Next: Matching tags and properties, Prev: Weekly/daily agenda, Up: Built-in Agenda Views + +11.3.2 The global TODO list +--------------------------- + +The global TODO list contains all unfinished TODO items formatted and +collected into a single place. + +‘M-x org-agenda t’ (‘org-todo-list’) + Show the global TODO list. This collects the TODO items from all + agenda files (see *note Agenda Views::) into a single buffer. By + default, this lists items with a state the is not a DONE state. + The buffer is in Agenda mode, so there are commands to examine and + manipulate the TODO entries directly from that buffer (see *note + Agenda Commands::). + +‘M-x org-agenda T’ (‘org-todo-list’) + Like the above, but allows selection of a specific TODO keyword. + You can also do this by specifying a prefix argument to ‘t’. You + are prompted for a keyword, and you may also specify several + keywords by separating them with ‘|’ as the boolean OR operator. + With a numeric prefix, the Nth keyword in ‘org-todo-keywords’ is + selected. + + The ‘r’ key in the agenda buffer regenerates it, and you can give a + prefix argument to this command to change the selected TODO + keyword, for example ‘3 r’. If you often need a search for a + specific keyword, define a custom command for it (see *note Agenda + Dispatcher::). + + Matching specific TODO keywords can also be done as part of a tags + search (see *note Tag Searches::). + + Remote editing of TODO items means that you can change the state of a +TODO entry with a single key press. The commands available in the TODO +list are described in *note Agenda Commands::. + + Normally the global TODO list simply shows all headlines with TODO +keywords. This list can become very long. There are two ways to keep +it more compact: + + • Some people view a TODO item that has been _scheduled_ for + execution or have a _deadline_ (see *note Timestamps::) as no + longer _open_. Configure the variables + ‘org-agenda-todo-ignore-scheduled’ to exclude some or all scheduled + items from the global TODO list, ‘org-agenda-todo-ignore-deadlines’ + to exclude some or all items with a deadline set, + ‘org-agenda-todo-ignore-timestamp’ to exclude some or all items + with an active timestamp other than a DEADLINE or a SCHEDULED + timestamp and/or ‘org-agenda-todo-ignore-with-date’ to exclude + items with at least one active timestamp. + + • TODO items may have sublevels to break up the task into subtasks. + In such cases it may be enough to list only the highest level TODO + headline and omit the sublevels from the global list. Configure + the variable ‘org-agenda-todo-list-sublevels’ to get this behavior. + + +File: org.info, Node: Matching tags and properties, Next: Search view, Prev: Global TODO list, Up: Built-in Agenda Views + +11.3.3 Matching tags and properties +----------------------------------- + +If headlines in the agenda files are marked with _tags_ (see *note +Tags::), or have properties (see *note Properties and Columns::), you +can select headlines based on this metadata and collect them into an +agenda buffer. The match syntax described here also applies when +creating sparse trees with ‘C-c / m’. + +‘M-x org-agenda m’ (‘org-tags-view’) + Produce a list of all headlines that match a given set of tags. + The command prompts for a selection criterion, which is a boolean + logic expression with tags, like ‘+work+urgent-withboss’ or + ‘work|home’ (see *note Tags::). If you often need a specific + search, define a custom command for it (see *note Agenda + Dispatcher::). + +‘M-x org-agenda M’ (‘org-tags-view’) + Like ‘m’, but only select headlines that are also TODO items and + force checking subitems (see the variable + ‘org-tags-match-list-sublevels’). To exclude scheduled/deadline + items, see the variable + ‘org-agenda-tags-todo-honor-ignore-options’. Matching specific + TODO keywords together with a tags match is also possible, see + *note Tag Searches::. + + The commands available in the tags list are described in *note Agenda +Commands::. + + A search string can use Boolean operators ‘&’ for AND and ‘|’ for OR. +‘&’ binds more strongly than ‘|’. Parentheses are currently not +implemented. Each element in the search is either a tag, a regular +expression matching tags, or an expression like ‘PROPERTY OPERATOR +VALUE’ with a comparison operator, accessing a property value. Each +element may be preceded by ‘-’ to select against it, and ‘+’ is +syntactic sugar for positive selection. The AND operator ‘&’ is +optional when ‘+’ or ‘-’ is present. Here are some examples, using only +tags. + +‘+work-boss’ + Select headlines tagged ‘work’, but discard those also tagged + ‘boss’. + +‘work|laptop’ + Selects lines tagged ‘work’ or ‘laptop’. + +‘work|laptop+night’ + Like before, but require the ‘laptop’ lines to be tagged also + ‘night’. + + Instead of a tag, you may also specify a regular expression enclosed +in curly braces (see *note Regular Expressions::). For example, +‘work+{^boss.*}’ matches headlines that contain the tag ‘:work:’ and any +tag _starting_ with ‘boss’. + + Group tags (see *note Tag Hierarchy::) are expanded as regular +expressions. E.g., if ‘work’ is a group tag for the group +‘:work:lab:conf:’, then searching for ‘work’ also searches for +‘{\(?:work\|lab\|conf\)}’ and searching for ‘-work’ searches for all +headlines but those with one of the tags in the group (i.e., +‘-{\(?:work\|lab\|conf\)}’). + + You may also test for properties (see *note Properties and Columns::) +at the same time as matching tags. The properties may be real +properties, or special properties that represent other metadata (see +*note Special Properties::). For example, the property ‘TODO’ +represents the TODO keyword of the entry. Or, the property ‘LEVEL’ +represents the level of an entry. So searching +‘+LEVEL=3+boss-TODO​="DONE"’ lists all level three headlines that have +the tag ‘boss’ and are _not_ marked with the TODO keyword ‘DONE’. In +buffers with ‘org-odd-levels-only’ set, ‘LEVEL’ does not count the +number of stars, but ‘LEVEL=2’ corresponds to 3 stars etc. + + Here are more examples: + +‘work+TODO​="WAITING"’ + Select ‘work’-tagged TODO lines with the specific TODO keyword + ‘WAITING’. + +‘work+TODO​="WAITING"|home+TODO​="WAITING"’ + Waiting tasks both at work and at home. + + When matching properties, a number of different operators can be used +to test the value of a property. Here is a complex example: + + +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2 + +With={Sarah\|Denny}+SCHEDULED>="<2008-10-11>" + +The type of comparison depends on how the comparison value is written: + + • If the comparison value is a plain number, a numerical comparison + is done, and the allowed operators are ‘<’, ‘=’, ‘>’, ‘<=’, ‘>=’, + and ‘<>’. + + • If the comparison value is enclosed in double-quotes, a string + comparison is done, and the same operators are allowed. + + • If the comparison value is enclosed in double-quotes _and_ angular + brackets (like ‘DEADLINE<​="<2008-12-24 18:30>"’), both values are + assumed to be date/time specifications in the standard Org way, and + the comparison is done accordingly. Valid values also include + ‘"<now>"’ for now (including time), ‘"<today>"’, and ‘"<tomorrow>"’ + for these days at 0:00 hours, i.e., without a time specification. + You can also use strings like ‘"<+5d>"’ or ‘"<-2m>"’ with units + ‘d’, ‘w’, ‘m’, and ‘y’ for day, week, month, and year, + respectively. + + • If the comparison value is enclosed in curly braces, a regexp match + is performed, with ‘=’ meaning that the regexp matches the property + value, and ‘<>’ meaning that it does not match. + + So the search string in the example finds entries tagged ‘work’ but +not ‘boss’, which also have a priority value ‘A’, a ‘Coffee’ property +with the value ‘unlimited’, an ‘EFFORT’ property that is numerically +smaller than 2, a ‘With’ property that is matched by the regular +expression ‘Sarah\|Denny’, and that are scheduled on or after October +11, 2008. + + You can configure Org mode to use property inheritance during a +search, but beware that this can slow down searches considerably. See +*note Property Inheritance::, for details. + + For backward compatibility, and also for typing speed, there is also +a different way to test TODO states in a search. For this, terminate +the tags/property part of the search string (which may include several +terms connected with ‘|’) with a ‘/’ and then specify a Boolean +expression just for TODO keywords. The syntax is then similar to that +for tags, but should be applied with care: for example, a positive +selection on several TODO keywords cannot meaningfully be combined with +boolean AND. However, _negative selection_ combined with AND can be +meaningful. To make sure that only lines are checked that actually have +any TODO keyword (resulting in a speed-up), use ‘M-x org-agenda M’, or +equivalently start the TODO part after the slash with ‘!’. Using ‘M-x +org-agenda M’ or ‘/!’ does not match TODO keywords in a DONE state. +Examples: + +‘work/WAITING’ + Same as ‘work+TODO​="WAITING"’. + +‘work/!-WAITING-NEXT’ + Select ‘work’-tagged TODO lines that are neither ‘WAITING’ nor + ‘NEXT’. + +‘work/!+WAITING|+NEXT’ + Select ‘work’-tagged TODO lines that are either ‘WAITING’ or + ‘NEXT’. + + +File: org.info, Node: Search view, Next: Stuck projects, Prev: Matching tags and properties, Up: Built-in Agenda Views + +11.3.4 Search view +------------------ + +This agenda view is a general text search facility for Org mode entries. +It is particularly useful to find notes. + +‘M-x org-agenda s’ (‘org-search-view’) + This is a special search that lets you select entries by matching a + substring or specific words using a boolean logic. + + For example, the search string ‘computer equipment’ matches entries +that contain ‘computer equipment’ as a substring, even if the two words +are separated by more space or a line break. + + Search view can also search for specific keywords in the entry, using +Boolean logic. The search string ‘+computer +wifi -ethernet +-{8\.11[bg]}’ matches note entries that contain the keywords ‘computer’ +and ‘wifi’, but not the keyword ‘ethernet’, and which are also not +matched by the regular expression ‘8\.11[bg]’, meaning to exclude both +‘8.11b’ and ‘8.11g’. The first ‘+’ is necessary to turn on boolean +search, other ‘+’ characters are optional. For more details, see the +docstring of the command ‘org-search-view’. + + You can incrementally and conveniently adjust a boolean search from +the agenda search view with the following keys + +‘[’ Add a positive search word +‘]’ Add a negative search word +‘{’ Add a positive regular expression +‘}’ Add a negative regular expression + + Note that in addition to the agenda files, this command also searches +the files listed in ‘org-agenda-text-search-extra-files’. + + +File: org.info, Node: Stuck projects, Prev: Search view, Up: Built-in Agenda Views + +11.3.5 Stuck projects +--------------------- + +If you are following a system like David Allen’s GTD to organize your +work, one of the “duties” you have is a regular review to make sure that +all projects move along. A _stuck_ project is a project that has no +defined next actions, so it never shows up in the TODO lists Org mode +produces. During the review, you need to identify such projects and +define next actions for them. + +‘M-x org-agenda #’ (‘org-agenda-list-stuck-projects’) + List projects that are stuck. + +‘M-x org-agenda !’ + Customize the variable ‘org-stuck-projects’ to define what a stuck + project is and how to find it. + + You almost certainly need to configure this view before it works for +you. The built-in default assumes that all your projects are level-2 +headlines, and that a project is not stuck if it has at least one entry +marked with a TODO keyword ‘TODO’ or ‘NEXT’ or ‘NEXTACTION’. + + Let’s assume that you, in your own way of using Org mode, identify +projects with a tag ‘:PROJECT:’, and that you use a TODO keyword ‘MAYBE’ +to indicate a project that should not be considered yet. Let’s further +assume that the TODO keyword ‘DONE’ marks finished projects, and that +‘NEXT’ and ‘TODO’ indicate next actions. The tag ‘:@shop:’ indicates +shopping and is a next action even without the NEXT tag. Finally, if +the project contains the special word ‘IGNORE’ anywhere, it should not +be listed either. In this case you would start by identifying eligible +projects with a tags/TODO match (see *note Tag Searches::) +‘+PROJECT/-MAYBE-DONE’, and then check for ‘TODO’, ‘NEXT’, ‘@shop’, and +‘IGNORE’ in the subtree to identify projects that are not stuck. The +correct customization for this is: + + (setq org-stuck-projects + '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@shop") + "\\<IGNORE\\>")) + + Note that if a project is identified as non-stuck, the subtree of +this entry is searched for stuck projects. + + +File: org.info, Node: Presentation and Sorting, Next: Agenda Commands, Prev: Built-in Agenda Views, Up: Agenda Views + +11.4 Presentation and Sorting +============================= + +Before displaying items in an agenda view, Org mode visually prepares +the items and sorts them. Each item occupies a single line. The line +starts with a _prefix_ that contains the _category_ (see *note +Categories::) of the item and other important information. You can +customize in which column tags are displayed through +‘org-agenda-tags-column’. You can also customize the prefix using the +option ‘org-agenda-prefix-format’. This prefix is followed by a +cleaned-up version of the outline headline associated with the item. + +* Menu: + +* Categories:: Not all tasks are equal. +* Time-of-day specifications:: How the agenda knows the time. +* Sorting of agenda items:: The order of things. +* Filtering/limiting agenda items:: Dynamically narrow the agenda. + + +File: org.info, Node: Categories, Next: Time-of-day specifications, Up: Presentation and Sorting + +11.4.1 Categories +----------------- + +The category is a broad label assigned to each agenda item. By default, +the category is simply derived from the file name, but you can also +specify it with a special line in the buffer, like this: + + #+CATEGORY: Thesis + + If you would like to have a special category for a single entry or a +(sub)tree, give the entry a ‘CATEGORY’ property with the special +category you want to apply as the value. + + The display in the agenda buffer looks best if the category is not +longer than 10 characters. You can set up icons for category by +customizing the ‘org-agenda-category-icon-alist’ variable. + + +File: org.info, Node: Time-of-day specifications, Next: Sorting of agenda items, Prev: Categories, Up: Presentation and Sorting + +11.4.2 Time-of-day specifications +--------------------------------- + +Org mode checks each agenda item for a time-of-day specification. The +time can be part of the timestamp that triggered inclusion into the +agenda, for example + + <2005-05-10 Tue 19:00> + +Time ranges can be specified with two timestamps: + + <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15> + + In the headline of the entry itself, a time(range)—like ‘12:45’ or a +‘8:30-1pm’—may also appear as plain text(1). + + If the agenda integrates the Emacs diary (see *note Weekly/daily +agenda::), time specifications in diary entries are recognized as well. + + For agenda display, Org mode extracts the time and displays it in a +standard 24 hour format as part of the prefix. The example times in the +previous paragraphs would end up in the agenda like this: + + 8:30-13:00 Arthur Dent lies in front of the bulldozer + 12:45...... Ford Prefect arrives and takes Arthur to the pub + 19:00...... The Vogon reads his poem + 20:30-22:15 Marvin escorts the Hitchhikers to the bridge + + If the agenda is in single-day mode, or for the display of today, the +timed entries are embedded in a time grid, like + + 8:00...... ------------------ + 8:30-13:00 Arthur Dent lies in front of the bulldozer + 10:00...... ------------------ + 12:00...... ------------------ + 12:45...... Ford Prefect arrives and takes Arthur to the pub + 14:00...... ------------------ + 16:00...... ------------------ + 18:00...... ------------------ + 19:00...... The Vogon reads his poem + 20:00...... ------------------ + 20:30-22:15 Marvin escorts the Hitchhikers to the bridge + + The time grid can be turned on and off with the variable +‘org-agenda-use-time-grid’, and can be configured with +‘org-agenda-time-grid’. + + ---------- Footnotes ---------- + + (1) You can, however, disable this by setting +‘org-agenda-search-headline-for-time’ variable to a ‘nil’ value. + + +File: org.info, Node: Sorting of agenda items, Next: Filtering/limiting agenda items, Prev: Time-of-day specifications, Up: Presentation and Sorting + +11.4.3 Sorting of agenda items +------------------------------ + +Before being inserted into a view, the items are sorted. How this is +done depends on the type of view. + + • For the daily/weekly agenda, the items for each day are sorted. + The default order is to first collect all items containing an + explicit time-of-day specification. These entries are shown at the + beginning of the list, as a _schedule_ for the day. After that, + items remain grouped in categories, in the sequence given by + ‘org-agenda-files’. Within each category, items are sorted by + priority (see *note Priorities::), which is composed of the base + priority (2000 for priority ‘A’, 1000 for ‘B’, and 0 for ‘C’), plus + additional increments for overdue scheduled or deadline items. + + • For the TODO list, items remain in the order of categories, but + within each category, sorting takes place according to priority + (see *note Priorities::). The priority used for sorting derives + from the priority cookie, with additions depending on how close an + item is to its due or scheduled date. + + • For tags matches, items are not sorted at all, but just appear in + the sequence in which they are found in the agenda files. + + Sorting can be customized using the variable +‘org-agenda-sorting-strategy’, and may also include criteria based on +the estimated effort of an entry (see *note Effort Estimates::). + + +File: org.info, Node: Filtering/limiting agenda items, Prev: Sorting of agenda items, Up: Presentation and Sorting + +11.4.4 Filtering/limiting agenda items +-------------------------------------- + +Agenda built-in or custom commands are statically defined. Agenda +filters and limits allow to flexibly narrow down the list of agenda +entries. + + _Filters_ only change the visibility of items, are very fast and are +mostly used interactively(1). 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 agenda +commands. + +Filtering in the agenda +....................... + +The general filtering command is ‘org-agenda-filter’, bound to ‘/’. +Before we introduce it, we describe commands for individual filter +types. All filtering commands handle prefix arguments in the same way: +A single ‘C-u’ prefix negates the filter, so it removes lines selected +by the filter. A double prefix adds the new filter condition to the +one(s) already in place, so filter elements are accumulated. + +‘\’ (‘org-agenda-filter-by-tag’) + Filter the agenda view with respect to a tag. You are prompted for + a tag selection letter; ‘<SPC>’ means any tag at all. Pressing + ‘<TAB>’ at that prompt offers completion to select a tag, including + any tags that do not have a selection character. The command then + hides all entries that do not contain or inherit this tag. + Pressing ‘+’ or ‘-’ at the prompt switches between filtering for + and against the next tag. To clear the filter, press ‘\’ twice + (once to call the command again, and once at the prompt). + +‘<’ (‘org-agenda-filter-by-category’) + Filter by category of the line at point, and show only entries with + this category. When called with a prefix argument, hide all + entries with the category at point. To clear the filter, call this + command again by pressing ‘<’. + +‘=’ (‘org-agenda-filter-by-regexp’) + Filter the agenda view by a regular expression: only show agenda + entries matching the regular expression the user entered. To clear + the filter, call the command again by pressing ‘=’. + +‘_’ (‘org-agenda-filter-by-effort’) + Filter the agenda view with respect to effort estimates, so select + tasks that take the right amount of time. You first need to set up + a list of efforts globally, for example + + (setq org-global-properties + '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00"))) + + You can then filter for an effort by first typing an operator, one + of ‘<’, ‘>’ and ‘=’, and then the one-digit index of an effort + estimate in your array of allowed values, where ‘0’ means the 10th + value. The filter then restricts to entries with effort + smaller-or-equal, equal, or larger-or-equal than the selected + value. For application of the operator, entries without a defined + effort are treated according to the value of + ‘org-sort-agenda-noeffort-is-high’. To clear the filter, press ‘_’ + twice (once to call the command again, and once at the first + prompt). + +‘^’ (‘org-agenda-filter-by-top-headline’) + Filter the current agenda view and only display items that fall + under the same top-level headline as the current entry. To clear + the filter, call this command again by pressing ‘^’. + +‘/’ (‘org-agenda-filter’) + This is the unified interface to four of the five filter methods + described above. At the prompt, specify different filter elements + in a single string, with full completion support. For example, + + +work-John+<0:10-/plot/ + + selects entries with category ‘work’ and effort estimates below 10 + minutes, and deselects entries with tag ‘John’ or matching the + regexp ‘plot’ (see *note Regular Expressions::). You can leave ‘+’ + out if that does not lead to ambiguities. The sequence of elements + is arbitrary. The filter syntax assumes that there is no overlap + between categories and tags. Otherwise, tags take priority. If + you reply to the prompt with the empty string, all filtering is + removed. If a filter is specified, it replaces all current + filters. But if you call the command with a double prefix + argument, or if you add an additional ‘+’ (e.g., ‘++work’) to the + front of the string, the new filter elements are added to the + active ones. A single prefix argument applies the entire filter in + a negative sense. + +‘|’ (‘org-agenda-filter-remove-all’) + Remove all filters in the current agenda view. + +Computed tag filtering +...................... + +If the variable ‘org-agenda-auto-exclude-function’ is set to a +user-defined function, that function can select tags that should be used +as a tag filter when requested. The function will be called with +lower-case versions of all tags represented in the current view. The +function should return ‘"-tag"’ if the filter should remove entries with +that tag, ‘"+tag"’ if only entries with this tag should be kept, or +‘nil’ if that tag is irrelevant. For example, let’s say you use a ‘Net’ +tag to identify tasks which need network access, an ‘Errand’ tag for +errands in town, and a ‘Call’ tag for making phone calls. You could +auto-exclude these tags based on the availability of the Internet, and +outside of business hours, with something like this: + + (defun my-auto-exclude-fn (tag) + (when (cond ((string= tag "net") + (/= 0 (call-process "/sbin/ping" nil nil nil + "-c1" "-q" "-t1" "mail.gnu.org"))) + ((member tag '("errand" "call")) + (let ((hr (nth 2 (decode-time)))) + (or (< hr 8) (> hr 21))))) + (concat "-" tag))) + + (setq org-agenda-auto-exclude-function #'my-auto-exclude-fn) + + You can apply this self-adapting filter by using a triple prefix +argument to ‘org-agenda-filter’, i.e. press ‘C-u C-u C-u /’, or by +pressing ‘<RET>’ in ‘org-agenda-filter-by-tag’. + +Setting limits for the agenda +............................. + +Here is a list of options that you can set, either globally, or locally +in your custom agenda views (see *note Custom Agenda Views::). + +‘org-agenda-max-entries’ + Limit the number of entries. + +‘org-agenda-max-effort’ + Limit the duration of accumulated efforts (as minutes). + +‘org-agenda-max-todos’ + Limit the number of entries with TODO keywords. + +‘org-agenda-max-tags’ + Limit the number of tagged entries. + + When set to a positive integer, each option excludes entries from +other categories: for example, ‘(setq org-agenda-max-effort 100)’ limits +the agenda to 100 minutes of effort and exclude any entry that has no +effort property. If you want to include entries with no effort +property, use a negative value for ‘org-agenda-max-effort’. One useful +setup is to use ‘org-agenda-max-entries’ locally in a custom command. +For example, this custom command displays the next five entries with a +‘NEXT’ TODO keyword. + + (setq org-agenda-custom-commands + '(("n" todo "NEXT" + ((org-agenda-max-entries 5))))) + + Once you mark one of these five entry as DONE, rebuilding the agenda +will again the next five entries again, including the first entry that +was excluded so far. + + You can also dynamically set temporary limits, which are lost when +rebuilding the agenda: + +‘~’ (‘org-agenda-limit-interactively’) + This prompts for the type of limit to apply and its value. + + ---------- Footnotes ---------- + + (1) 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 then +applied to the view and persists as a basic filter through refreshes and +more secondary filtering. The filter is a global 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. + + +File: org.info, Node: Agenda Commands, Next: Custom Agenda Views, Prev: Presentation and Sorting, Up: Agenda Views + +11.5 Commands in the Agenda Buffer +================================== + +Entries in the agenda buffer are linked back to the Org file or diary +file where they originate. You are not allowed to edit the agenda +buffer itself, but commands are provided to show and jump to the +original entry location, and to edit the Org files “remotely” from the +agenda buffer. In this way, all information is stored only once, +removing the risk that your agenda and note files may diverge. + + Some commands can be executed with mouse clicks on agenda lines. For +the other commands, point needs to be in the desired line. + +Motion +------ + +‘n’ (‘org-agenda-next-line’) + Next line (same as ‘<DOWN>’ and ‘C-n’). + +‘p’ (‘org-agenda-previous-line’) + Previous line (same as ‘<UP>’ and ‘C-p’). + +View/Go to Org file +------------------- + +‘<SPC>’ or ‘mouse-3’ (‘org-agenda-show-and-scroll-up’) + Display the original location of the item in another window. With + a prefix argument, make sure that drawers stay folded. + +‘L’ (‘org-agenda-recenter’) + Display original location and recenter that window. + +‘<TAB>’ or ‘mouse-2’ (‘org-agenda-goto’) + Go to the original location of the item in another window. + +‘<RET>’ (‘org-agenda-switch-to’) + Go to the original location of the item and delete other windows. + +‘F’ (‘org-agenda-follow-mode’) + Toggle Follow mode. In Follow mode, as you move point through the + agenda buffer, the other window always shows the corresponding + location in the Org file. The initial setting for this mode in new + agenda buffers can be set with the variable + ‘org-agenda-start-with-follow-mode’. + +‘C-c C-x b’ (‘org-agenda-tree-to-indirect-buffer’) + Display the entire subtree of the current item in an indirect + buffer. With a numeric prefix argument N, go up to level N and + then take that tree. If N is negative, go up that many levels. + With a ‘C-u’ prefix, do not remove the previously used indirect + buffer. + +‘C-c C-o’ (‘org-agenda-open-link’) + Follow a link in the entry. This offers a selection of any links + in the text belonging to the referenced Org node. If there is only + one link, follow it without a selection prompt. + +Change display +-------------- + +‘A’ + Interactively select another agenda view and append it to the + current view. + +‘o’ + Delete other windows. + +‘v d’ or short ‘d’ (‘org-agenda-day-view’) + Switch to day view. When switching to day view, this setting + becomes the default for subsequent agenda refreshes. A numeric + prefix argument may be used to jump directly to a specific day of + the year. For example, ‘32 d’ jumps to February 1st. When setting + day view, a year may be encoded in the prefix argument as well. + For example, ‘200712 d’ jumps to January 12, 2007. If such a year + specification has only one or two digits, it is expanded into one + of the 30 next years or the last 69 years. + +‘v w’ or short ‘w’ (‘org-agenda-week-view’) + Switch to week view. When switching week view, this setting + becomes the default for subsequent agenda refreshes. A numeric + prefix argument may be used to jump directly to a specific day of + the ISO week. For example ‘9 w’ to ISO week number 9. When + setting week view, a year may be encoded in the prefix argument as + well. For example, ‘200712 w’ jumps to week 12 in 2007. If such a + year specification has only one or two digits, it is expanded into + one of the 30 next years or the last 69 years. + +‘v m’ (‘org-agenda-month-view’) + Switch to month view. Because month views are slow to create, they + do not become the default for subsequent agenda refreshes. A + numeric prefix argument may be used to jump directly to a specific + day of the month. When setting month view, a year may be encoded + in the prefix argument as well. For example, ‘200712 m’ jumps to + December, 2007. If such a year specification has only one or two + digits, it is expanded into one of the 30 next years or the last 69 + years. + +‘v y’ (‘org-agenda-year-view’) + Switch to year view. Because year views are slow to create, they + do not become the default for subsequent agenda refreshes. A + numeric prefix argument may be used to jump directly to a specific + day of the year. + +‘v <SPC>’ (‘org-agenda-reset-view’) + Reset the current view to ‘org-agenda-span’. + +‘f’ (‘org-agenda-later’) + Go forward in time to display the span following the current one. + For example, if the display covers a week, switch to the following + week. With a prefix argument, repeat that many times. + +‘b’ (‘org-agenda-earlier’) + Go backward in time to display earlier dates. + +‘.’ (‘org-agenda-goto-today’) + Go to today. + +‘j’ (‘org-agenda-goto-date’) + Prompt for a date and go there. + +‘J’ (‘org-agenda-clock-goto’) + Go to the currently clocked-in task _in the agenda buffer_. + +‘D’ (‘org-agenda-toggle-diary’) + Toggle the inclusion of diary entries. See *note Weekly/daily + agenda::. + +‘v l’ or ‘v L’ or short ‘l’ (‘org-agenda-log-mode’) + Toggle Logbook mode. In Logbook mode, entries that were marked as + done while logging was on (see the variable ‘org-log-done’) are + shown in the agenda, as are entries that have been clocked on that + day. You can configure the entry types that should be included in + log mode using the variable ‘org-agenda-log-mode-items’. When + called with a ‘C-u’ prefix argument, show all possible logbook + entries, including state changes. When called with two prefix + arguments ‘C-u C-u’, show only logging information, nothing else. + ‘v L’ is equivalent to ‘C-u v l’. + +‘v [’ or short ‘[’ (‘org-agenda-manipulate-query-add’) + Include inactive timestamps into the current view. Only for + weekly/daily agenda. + +‘v a’ (‘org-agenda-archives-mode’) + Toggle Archives mode. In Archives mode, trees that are archived + (see *note Internal archiving::) are also scanned when producing + the agenda. To exit archives mode, press ‘v a’ again. + +‘v A’ + Toggle Archives mode. Include all archive files as well. + +‘v R’ or short ‘R’ (‘org-agenda-clockreport-mode’) + Toggle Clockreport mode. In Clockreport mode, the daily/weekly + agenda always shows a table with the clocked times for the time + span and file scope covered by the current agenda view. The + initial setting for this mode in new agenda buffers can be set with + the variable ‘org-agenda-start-with-clockreport-mode’. By using a + prefix argument when toggling this mode (i.e., ‘C-u R’), the clock + table does not show contributions from entries that are hidden by + agenda filtering(1). See also the variable + ‘org-clock-report-include-clocking-task’. + +‘v c’ + Show overlapping clock entries, clocking gaps, and other clocking + problems in the current agenda range. You can then visit clocking + lines and fix them manually. See the variable + ‘org-agenda-clock-consistency-checks’ for information on how to + customize the definition of what constituted a clocking problem. + To return to normal agenda display, press ‘l’ to exit Logbook mode. + +‘v E’ or short ‘E’ (‘org-agenda-entry-text-mode’) + Toggle entry text mode. In entry text mode, a number of lines from + the Org outline node referenced by an agenda line are displayed + below the line. The maximum number of lines is given by the + variable ‘org-agenda-entry-text-maxlines’. Calling this command + with a numeric prefix argument temporarily modifies that number to + the prefix value. + +‘G’ (‘org-agenda-toggle-time-grid’) + Toggle the time grid on and off. See also the variables + ‘org-agenda-use-time-grid’ and ‘org-agenda-time-grid’. + +‘r’ (‘org-agenda-redo’) +‘g’ + Recreate the agenda buffer, for example to reflect the changes + after modification of the timestamps of items with ‘S-<LEFT>’ and + ‘S-<RIGHT>’. When the buffer is the global TODO list, a prefix + argument is interpreted to create a selective list for a specific + TODO keyword. + +‘C-x C-s’ or short ‘s’ (‘org-save-all-org-buffers’) + Save all Org buffers in the current Emacs session, and also the + locations of IDs. + +‘C-c C-x C-c’ (‘org-agenda-columns’) + Invoke column view (see *note Column View::) in the agenda buffer. + The column view format is taken from the entry at point, or, if + there is no entry at point, from the first entry in the agenda + view. So whatever the format for that entry would be in the + original buffer (taken from a property, from a ‘COLUMNS’ keyword, + or from the default variable ‘org-columns-default-format’) is used + in the agenda. + +‘C-c C-x >’ (‘org-agenda-remove-restriction-lock’) + Remove the restriction lock on the agenda, if it is currently + restricted to a file or subtree (see *note Agenda Files::). + +‘M-<UP>’ (‘org-agenda-drag-line-backward’) + Drag the line at point backward one line. With a numeric prefix + argument, drag backward by that many lines. + + Moving agenda lines does not persist after an agenda refresh and + does not modify the contributing Org files. + +‘M-<DOWN>’ (‘org-agenda-drag-line-forward’) + Drag the line at point forward one line. With a numeric prefix + argument, drag forward by that many lines. + +Remote editing +-------------- + +‘0--9’ + Digit argument. + +‘C-_’ (‘org-agenda-undo’) + Undo a change due to a remote editing command. The change is + undone both in the agenda buffer and in the remote buffer. + +‘t’ (‘org-agenda-todo’) + Change the TODO state of the item, both in the agenda and in the + original Org file. A prefix arg is passed through to the + ‘org-todo’ command, so for example a ‘C-u’ prefix are will trigger + taking a note to document the state change. + +‘C-S-<RIGHT>’ (‘org-agenda-todo-nextset’) + Switch to the next set of TODO keywords. + +‘C-S-<LEFT>’, ‘org-agenda-todo-previousset’ + Switch to the previous set of TODO keywords. + +‘C-k’ (‘org-agenda-kill’) + Delete the current agenda item along with the entire subtree + belonging to it in the original Org file. If the text to be + deleted remotely is longer than one line, the kill needs to be + confirmed by the user. See variable ‘org-agenda-confirm-kill’. + +‘C-c C-w’ (‘org-agenda-refile’) + Refile the entry at point. + +‘C-c C-x C-a’ or short ‘a’ (‘org-agenda-archive-default-with-confirmation’) + Archive the subtree corresponding to the entry at point using the + default archiving command set in ‘org-archive-default-command’. + When using the ‘a’ key, confirmation is required. + +‘C-c C-x a’ (‘org-agenda-toggle-archive-tag’) + Toggle the archive tag (see *note Internal archiving::) for the + current headline. + +‘C-c C-x A’ (‘org-agenda-archive-to-archive-sibling’) + Move the subtree corresponding to the current entry to its _archive + sibling_. + +‘C-c C-x C-s’ or short ‘$’ (‘org-agenda-archive’) + Archive the subtree corresponding to the current headline. This + means the entry is moved to the configured archive location, most + likely a different file. + +‘T’ (‘org-agenda-show-tags’) + Show all tags associated with the current item. This is useful if + you have turned off ‘org-agenda-show-inherited-tags’, but still + want to see all tags of a headline occasionally. + +‘:’ (‘org-agenda-set-tags’) + Set tags for the current headline. If there is an active region in + the agenda, change a tag for all headings in the region. + +‘,’ (‘org-agenda-priority’) + Set the priority for the current item. Org mode prompts for the + priority character. If you reply with ‘<SPC>’, the priority cookie + is removed from the entry. + +‘+’ or ‘S-<UP>’ (‘org-agenda-priority-up’) + Increase the priority of the current item. The priority is changed + in the original buffer, but the agenda is not resorted. Use the + ‘r’ key for this. + +‘-’ or ‘S-<DOWN>’ (‘org-agenda-priority-down’) + Decrease the priority of the current item. + +‘C-c C-x e’ or short ‘e’ (‘org-agenda-set-effort’) + Set the effort property for the current item. + +‘C-c C-z’ or short ‘z’ (‘org-agenda-add-note’) + Add a note to the entry. This note is recorded, and then filed to + the same location where state change notes are put. Depending on + ‘org-log-into-drawer’, this may be inside a drawer. + +‘C-c C-a’ (‘org-attach’) + Dispatcher for all command related to attachments. + +‘C-c C-s’ (‘org-agenda-schedule’) + Schedule this item. With a prefix argument, remove the scheduling + timestamp + +‘C-c C-d’ (‘org-agenda-deadline’) + Set a deadline for this item. With a prefix argument, remove the + deadline. + +‘S-<RIGHT>’ (‘org-agenda-do-date-later’) + Change the timestamp associated with the current line by one day + into the future. If the date is in the past, the first call to + this command moves it to today. With a numeric prefix argument, + change it by that many days. For example, ‘3 6 5 S-<RIGHT>’ + changes it by a year. With a ‘C-u’ prefix, change the time by one + hour. If you immediately repeat the command, it will continue to + change hours even without the prefix argument. With a double ‘C-u + C-u’ prefix, do the same for changing minutes. The stamp is + changed in the original Org file, but the change is not directly + reflected in the agenda buffer. Use ‘r’ or ‘g’ to update the + buffer. + +‘S-<LEFT>’ (‘org-agenda-do-date-earlier’) + Change the timestamp associated with the current line by one day + into the past. + +‘>’ (‘org-agenda-date-prompt’) + Change the timestamp associated with the current line. The key ‘>’ + has been chosen, because it is the same as ‘S-.’ on my keyboard. + +‘I’ (‘org-agenda-clock-in’) + Start the clock on the current item. If a clock is running + already, it is stopped first. + +‘O’ (‘org-agenda-clock-out’) + Stop the previously started clock. + +‘X’ (‘org-agenda-clock-cancel’) + Cancel the currently running clock. + +‘J’ (‘org-agenda-clock-goto’) + Jump to the running clock in another window. + +‘k’ (‘org-agenda-capture’) + Like ‘org-capture’, but use the date at point as the default date + for the capture template. See ‘org-capture-use-agenda-date’ to + make this the default behavior of ‘org-capture’. + +Bulk remote editing selected entries +------------------------------------ + +‘m’ (‘org-agenda-bulk-mark’) + + Mark the entry at point for bulk action. If there is an active + region in the agenda, mark the entries in the region. With numeric + prefix argument, mark that many successive entries. + +‘*’ (‘org-agenda-bulk-mark-all’) + + Mark all visible agenda entries for bulk action. + +‘u’ (‘org-agenda-bulk-unmark’) + + Unmark entry for bulk action. + +‘U’ (‘org-agenda-bulk-remove-all-marks’) + + Unmark all marked entries for bulk action. + +‘M-m’ (‘org-agenda-bulk-toggle’) + + Toggle mark of the entry at point for bulk action. + +‘M-*’ (‘org-agenda-bulk-toggle-all’) + + Toggle mark of every entry for bulk action. + +‘%’ (‘org-agenda-bulk-mark-regexp’) + + Mark entries matching a regular expression for bulk action. + +‘B’ (‘org-agenda-bulk-action’) + + Bulk action: act on all marked entries in the agenda. This prompts + for another key to select the action to be applied. The prefix + argument to ‘B’ is passed through to the ‘s’ and ‘d’ commands, to + bulk-remove these special timestamps. By default, marks are + removed after the bulk. If you want them to persist, set + ‘org-agenda-bulk-persistent-marks’ to ‘t’ or hit ‘p’ at the prompt. + + ‘p’ + Toggle persistent marks. + + ‘$’ + Archive all selected entries. + + ‘A’ + Archive entries by moving them to their respective archive + siblings. + + ‘t’ + Change TODO state. This prompts for a single TODO keyword and + changes the state of all selected entries, bypassing blocking + and suppressing logging notes—but not timestamps. + + ‘+’ + Add a tag to all selected entries. + + ‘-’ + Remove a tag from all selected entries. + + ‘s’ + Schedule all items to a new date. To shift existing schedule + dates by a fixed number of days, use something starting with + double plus at the prompt, for example ‘++8d’ or ‘++2w’. + + ‘d’ + Set deadline to a specific date. + + ‘r’ + Prompt for a single refile target and move all entries. The + entries are no longer in the agenda; refresh (‘g’) to bring + them back. + + ‘S’ + Reschedule randomly into the coming N days. N is prompted + for. With a prefix argument (‘C-u B S’), scatter only across + weekdays. + + ‘f’ + Apply a function(2) to marked entries. For example, the + function below sets the ‘CATEGORY’ property of the entries to + ‘web’. + + (defun set-category () + (interactive "P") + (let ((marker (or (org-get-at-bol 'org-hd-marker) + (org-agenda-error)))) + (org-with-point-at marker + (org-back-to-heading t) + (org-set-property "CATEGORY" "web")))) + +Calendar commands +----------------- + +‘c’ (‘org-agenda-goto-calendar’) + Open the Emacs calendar and go to the date at point in the agenda. + +‘c’ (‘org-calendar-goto-agenda’) + When in the calendar, compute and show the Org agenda for the date + at point. + +‘i’ (‘org-agenda-diary-entry’) + + Insert a new entry into the diary, using the date at point and (for + block entries) the date at the mark. This adds to the Emacs diary + file(3), in a way similar to the ‘i’ command in the calendar. The + diary file pops up in another window, where you can add the entry. + + If you configure ‘org-agenda-diary-file’ to point to an Org file, + Org creates entries in that file instead. Most entries are stored + in a date-based outline tree that will later make it easy to + archive appointments from previous months/years. The tree is built + under an entry with a ‘DATE_TREE’ property, or else with years as + top-level entries. Emacs prompts you for the entry text—if you + specify it, the entry is created in ‘org-agenda-diary-file’ without + further interaction. If you directly press ‘<RET>’ at the prompt + without typing text, the target file is shown in another window for + you to finish the entry there. See also the ‘k r’ command. + +‘M’ (‘org-agenda-phases-of-moon’) + Show the phases of the moon for the three months around current + date. + +‘S’ (‘org-agenda-sunrise-sunset’) + Show sunrise and sunset times. The geographical location must be + set with calendar variables, see the documentation for the Emacs + calendar. + +‘C’ (‘org-agenda-convert-date’) + Convert the date at point into many other cultural and historic + calendars. + +‘H’ (‘org-agenda-holidays’) + Show holidays for three months around point date. + +Quit and exit +------------- + +‘q’ (‘org-agenda-quit’) + + Quit agenda, remove the agenda buffer. + +‘x’ (‘org-agenda-exit’) + + Exit agenda, remove the agenda buffer and all buffers loaded by + Emacs for the compilation of the agenda. Buffers created by the + user to visit Org files are not removed. + + ---------- Footnotes ---------- + + (1) Only tags filtering is respected here, effort filtering is +ignored. + + (2) You can also create persistent custom functions through +‘org-agenda-bulk-custom-functions’. + + (3) This file is parsed for the agenda when +‘org-agenda-include-diary’ is set. + + +File: org.info, Node: Custom Agenda Views, Next: Exporting Agenda Views, Prev: Agenda Commands, Up: Agenda Views + +11.6 Custom Agenda Views +======================== + +Custom agenda commands serve two purposes: to store and quickly access +frequently used TODO and tags searches, and to create special composite +agenda buffers. Custom agenda commands are accessible through the +dispatcher (see *note Agenda Dispatcher::), just like the default +commands. + +* Menu: + +* Storing searches:: Type once, use often. +* Block agenda:: All the stuff you need in a single buffer. +* Setting options:: Changing the rules. + + +File: org.info, Node: Storing searches, Next: Block agenda, Up: Custom Agenda Views + +11.6.1 Storing searches +----------------------- + +The first application of custom searches is the definition of keyboard +shortcuts for frequently used searches, either creating an agenda +buffer, or a sparse tree (the latter covering of course only the current +buffer). + + Custom commands are configured in the variable +‘org-agenda-custom-commands’. You can customize this variable, for +example by pressing ‘C’ from the agenda dispatcher (see *note Agenda +Dispatcher::). You can also directly set it with Emacs Lisp in the +Emacs init file. The following example contains all valid agenda views: + + (setq org-agenda-custom-commands + '(("x" agenda) + ("y" agenda*) + ("w" todo "WAITING") + ("W" todo-tree "WAITING") + ("u" tags "+boss-urgent") + ("v" tags-todo "+boss-urgent") + ("U" tags-tree "+boss-urgent") + ("f" occur-tree "\\<FIXME\\>") + ("h" . "HOME+Name tags searches") ;description for "h" prefix + ("hl" tags "+home+Lisa") + ("hp" tags "+home+Peter") + ("hk" tags "+home+Kim"))) + + The initial string in each entry defines the keys you have to press +after the dispatcher command in order to access the command. Usually +this is just a single character, but if you have many similar commands, +you can also define two-letter combinations where the first character is +the same in several combinations and serves as a prefix key(1). The +second parameter is the search type, followed by the string or regular +expression to be used for the matching. The example above will +therefore define: + +‘x’ + as a global search for agenda entries planned(2) this week/day. + +‘y’ + as the same search, but only for entries with an hour specification + like ‘[h]h:mm’—think of them as appointments. + +‘w’ + as a global search for TODO entries with ‘WAITING’ as the TODO + keyword. + +‘W’ + as the same search, but only in the current buffer and displaying + the results as a sparse tree. + +‘u’ + as a global tags search for headlines tagged ‘boss’ but not + ‘urgent’. + +‘v’ + The same search, but limiting it to headlines that are also TODO + items. + +‘U’ + as the same search, but only in the current buffer and displaying + the result as a sparse tree. + +‘f’ + to create a sparse tree (again, current buffer only) with all + entries containing the word ‘FIXME’. + +‘h’ + as a prefix command for a ‘HOME’ tags search where you have to + press an additional key (‘l’, ‘p’ or ‘k’) to select a name (Lisa, + Peter, or Kim) as additional tag to match. + + Note that ‘*-tree’ agenda views need to be called from an Org buffer +as they operate on the current buffer only. + + ---------- Footnotes ---------- + + (1) You can provide a description for a prefix key by inserting a +cons cell with the prefix and the description. + + (2) _Planned_ means here that these entries have some planning +information attached to them, like a time-stamp, a scheduled or a +deadline string. See ‘org-agenda-entry-types’ on how to set what +planning information is taken into account. + + +File: org.info, Node: Block agenda, Next: Setting options, Prev: Storing searches, Up: Custom Agenda Views + +11.6.2 Block agenda +------------------- + +Another possibility is the construction of agenda views that comprise +the results of _several_ commands, each of which creates a block in the +agenda buffer. The available commands include ‘agenda’ for the daily or +weekly agenda (as created with ‘a’) , ‘alltodo’ for the global TODO list +(as constructed with ‘t’), ‘stuck’ for the list of stuck projects (as +obtained with ‘#’) and the matching commands discussed above: ‘todo’, +‘tags’, and ‘tags-todo’. + + Here are two examples: + + (setq org-agenda-custom-commands + '(("h" "Agenda and Home-related tasks" + ((agenda "") + (tags-todo "home") + (tags "garden"))) + ("o" "Agenda and Office-related tasks" + ((agenda "") + (tags-todo "work") + (tags "office"))))) + +This defines ‘h’ to create a multi-block view for stuff you need to +attend to at home. The resulting agenda buffer contains your agenda for +the current week, all TODO items that carry the tag ‘home’, and also all +lines tagged with ‘garden’. Finally the command ‘o’ provides a similar +view for office tasks. + + +File: org.info, Node: Setting options, Prev: Block agenda, Up: Custom Agenda Views + +11.6.3 Setting options for custom commands +------------------------------------------ + +Org mode contains a number of variables regulating agenda construction +and display. The global variables define the behavior for all agenda +commands, including the custom commands. However, if you want to change +some settings just for a single custom view, you can do so. Setting +options requires inserting a list of variable names and values at the +right spot in ‘org-agenda-custom-commands’. For example: + + (setq org-agenda-custom-commands + '(("w" todo "WAITING" + ((org-agenda-sorting-strategy '(priority-down)) + (org-agenda-prefix-format " Mixed: "))) + ("U" tags-tree "+boss-urgent" + ((org-show-context-detail 'minimal))) + ("N" search "" + ((org-agenda-files '("~org/notes.org")) + (org-agenda-text-search-extra-files nil))))) + +Now the ‘w’ command sorts the collected entries only by priority, and +the prefix format is modified to just say ‘Mixed:’ instead of giving the +category of the entry. The sparse tags tree of ‘U’ now turns out +ultra-compact, because neither the headline hierarchy above the match, +nor the headline following the match are shown. The command ‘N’ does a +text search limited to only a single file. + + For command sets creating a block agenda, +‘org-agenda-custom-commands’ has two separate spots for setting options. +You can add options that should be valid for just a single command in +the set, and options that should be valid for all commands in the set. +The former are just added to the command entry; the latter must come +after the list of command entries. Going back to the block agenda +example (see *note Block agenda::), let’s change the sorting strategy +for the ‘h’ commands to ‘priority-down’, but let’s sort the results for +‘garden’ tags query in the opposite order, ‘priority-up’. This would +look like this: + + (setq org-agenda-custom-commands + '(("h" "Agenda and Home-related tasks" + ((agenda) + (tags-todo "home") + (tags "garden" + ((org-agenda-sorting-strategy '(priority-up))))) + ((org-agenda-sorting-strategy '(priority-down)))) + ("o" "Agenda and Office-related tasks" + ((agenda) + (tags-todo "work") + (tags "office"))))) + + As you see, the values and parentheses setting is a little complex. +When in doubt, use the customize interface to set this variable—it fully +supports its structure. Just one caveat: when setting options in this +interface, the _values_ are just Lisp expressions. So if the value is a +string, you need to add the double-quotes around the value yourself. + + To control whether an agenda command should be accessible from a +specific context, you can customize +‘org-agenda-custom-commands-contexts’. Let’s say for example that you +have an agenda command ‘o’ displaying a view that you only need when +reading emails. Then you would configure this option like this: + + (setq org-agenda-custom-commands-contexts + '(("o" (in-mode . "message-mode")))) + + You can also tell that the command key ‘o’ should refer to another +command key ‘r’. In that case, add this command key like this: + + (setq org-agenda-custom-commands-contexts + '(("o" "r" (in-mode . "message-mode")))) + + See the docstring of the variable for more information. + + +File: org.info, Node: Exporting Agenda Views, Next: Agenda Column View, Prev: Custom Agenda Views, Up: Agenda Views + +11.7 Exporting Agenda Views +=========================== + +If you are away from your computer, it can be very useful to have a +printed version of some agenda views to carry around. Org mode can +export custom agenda views as plain text, HTML(1), Postscript, PDF(2), +and iCalendar files. If you want to do this only occasionally, use the +following command: + +‘C-x C-w’ (‘org-agenda-write’) + + Write the agenda view to a file. + + If you need to export certain agenda views frequently, you can +associate any custom agenda command with a list of output file names(3). +Here is an example that first defines custom commands for the agenda and +the global TODO list, together with a number of files to which to export +them. Then we define two block agenda commands and specify file names +for them as well. File names can be relative to the current working +directory, or absolute. + + (setq org-agenda-custom-commands + '(("X" agenda "" nil ("agenda.html" "agenda.ps")) + ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps")) + ("h" "Agenda and Home-related tasks" + ((agenda "") + (tags-todo "home") + (tags "garden")) + nil + ("~/views/home.html")) + ("o" "Agenda and Office-related tasks" + ((agenda) + (tags-todo "work") + (tags "office")) + nil + ("~/views/office.ps" "~/calendars/office.ics")))) + + The extension of the file name determines the type of export. If it +is ‘.html’, Org mode uses the htmlize package to convert the buffer to +HTML and save it to this file name. If the extension is ‘.ps’, +‘ps-print-buffer-with-faces’ is used to produce Postscript output. If +the extension is ‘.ics’, iCalendar export is run export over all files +that were used to construct the agenda, and limit the export to entries +listed in the agenda. Any other extension produces a plain ASCII file. + + The export files are _not_ created when you use one of those commands +interactively because this might use too much overhead. Instead, there +is a special command to produce _all_ specified files in one step: + +‘e’ (‘org-store-agenda-views’) + Export all agenda views that have export file names associated with + them. + + You can use the options section of the custom agenda commands to also +set options for the export commands. For example: + + (setq org-agenda-custom-commands + '(("X" agenda "" + ((ps-number-of-columns 2) + (ps-landscape-mode t) + (org-agenda-prefix-format " [ ] ") + (org-agenda-with-colors nil) + (org-agenda-remove-tags t)) + ("theagenda.ps")))) + +This command sets two options for the Postscript exporter, to make it +print in two columns in landscape format—the resulting page can be cut +in two and then used in a paper agenda. The remaining settings modify +the agenda prefix to omit category and scheduling information, and +instead include a checkbox to check off items. We also remove the tags +to make the lines compact, and we do not want to use colors for the +black-and-white printer. Settings specified in +‘org-agenda-exporter-settings’ also apply, e.g., + + (setq org-agenda-exporter-settings + '((ps-number-of-columns 2) + (ps-landscape-mode t) + (org-agenda-add-entry-text-maxlines 5) + (htmlize-output-type 'css))) + +but the settings in ‘org-agenda-custom-commands’ take precedence. + + From the command line you may also use: + + emacs -eval (org-batch-store-agenda-views) -kill + +or, if you need to modify some parameters(4) + + emacs -eval '(org-batch-store-agenda-views \ + org-agenda-span (quote month) \ + org-agenda-start-day "2007-11-01" \ + org-agenda-include-diary nil \ + org-agenda-files (quote ("~/org/project.org")))' \ + -kill + +which creates the agenda views restricted to the file +‘~/org/project.org’, without diary entries and with a 30-day extent. + + You can also extract agenda information in a way that allows further +processing by other programs. See *note Extracting Agenda +Information::, for more information. + + ---------- Footnotes ---------- + + (1) For HTML you need to install Hrvoje Nikšić’s ‘htmlize.el’ as an +Emacs package from MELPA or from Hrvoje Nikšić’s repository +(https://github.com/hniksic/emacs-htmlize). + + (2) To create PDF output, the Ghostscript ps2pdf utility must be +installed on the system. Selecting a PDF file also creates the +postscript file. + + (3) If you want to store standard views like the weekly agenda or the +global TODO list as well, you need to define custom commands for them in +order to be able to specify file names. + + (4) Quoting depends on the system you use, please check the FAQ for +examples. + + +File: org.info, Node: Agenda Column View, Prev: Exporting Agenda Views, Up: Agenda Views + +11.8 Using Column View in the Agenda +==================================== + +Column view (see *note Column View::) is normally used to view and edit +properties embedded in the hierarchical structure of an Org file. It +can be quite useful to use column view also from the agenda, where +entries are collected by certain criteria. + +‘C-c C-x C-c’ (‘org-agenda-columns’) + + Turn on column view in the agenda. + + To understand how to use this properly, it is important to realize +that the entries in the agenda are no longer in their proper outline +environment. This causes the following issues: + + 1. Org needs to make a decision which columns format to use. Since + the entries in the agenda are collected from different files, and + different files may have different columns formats, this is a + non-trivial problem. Org first checks if + ‘org-overriding-columns-format’ is currently set, and if so, takes + the format from there. You should set this variable only in the + _local settings section_ of a custom agenda command (see *note + Custom Agenda Views::) to make it valid for that specific agenda + view. If no such binding exists, it checks, in sequence, + ‘org-columns-default-format-for-agenda’, the format associated with + the first item in the agenda (through a property or a ‘#+COLUMNS’ + setting in that buffer) and finally ‘org-columns-default-format’. + + 2. If any of the columns has a summary type defined (see *note Column + attributes::), turning on column view in the agenda visits all + relevant agenda files and make sure that the computations of this + property are up to date. This is also true for the special + ‘CLOCKSUM’ property. Org then sums the values displayed in the + agenda. In the daily/weekly agenda, the sums cover a single day; + in all other views they cover the entire block. + + It is important to realize that the agenda may show the same entry + _twice_—for example as scheduled and as a deadline—and it may show + two entries from the same hierarchy (for example a _parent_ and its + _child_). In these cases, the summation in the agenda leads to + incorrect results because some values count double. + + 3. When the column view in the agenda shows the ‘CLOCKSUM’ property, + that is always the entire clocked time for this item. So even in + the daily/weekly agenda, the clocksum listed in column view may + originate from times outside the current view. This has the + advantage that you can compare these values with a column listing + the planned total effort for a task—one of the major applications + for column view in the agenda. If you want information about + clocked time in the displayed period use clock table mode (press + ‘R’ in the agenda). + + 4. When the column view in the agenda shows the ‘CLOCKSUM_T’ property, + that is always today’s clocked time for this item. So even in the + weekly agenda, the clocksum listed in column view only originates + from today. This lets you compare the time you spent on a task for + today, with the time already spent—via ‘CLOCKSUM’—and with the + planned total effort for it. + + +File: org.info, Node: Markup for Rich Contents, Next: Exporting, Prev: Agenda Views, Up: Top + +12 Markup for Rich Contents +*************************** + +Org is primarily about organizing and searching through your plain-text +notes. However, it also provides a lightweight yet robust markup +language for rich text formatting and more. For instance, you may want +to center or emphasize text. Or you may need to insert a formula or +image in your writing. Org offers syntax for all of this and more. +Used in conjunction with the export framework (see *note Exporting::), +you can author beautiful documents in Org—like the fine manual you are +currently reading. + +* Menu: + +* Paragraphs:: The basic unit of text. +* Emphasis and Monospace:: Bold, italic, etc. +* Subscripts and Superscripts:: Simple syntax for raising/lowering text. +* Special Symbols:: Greek letters and other symbols. +* Embedded LaTeX:: LaTeX can be freely used inside Org documents. +* Literal Examples:: Source code examples with special formatting. +* Images:: Display an image. +* Captions:: Describe tables, images... +* Horizontal Rules:: Make a line. +* Creating Footnotes:: Edit and read footnotes. + + +File: org.info, Node: Paragraphs, Next: Emphasis and Monospace, Up: Markup for Rich Contents + +12.1 Paragraphs +=============== + +Paragraphs are separated by at least one empty line. If you need to +enforce a line break within a paragraph, use ‘\\’ at the end of a line. + + To preserve the line breaks, indentation and blank lines in a region, +but otherwise use normal formatting, you can use this construct, which +can also be used to format poetry. + + #+BEGIN_VERSE + Great clouds overhead + Tiny black birds rise and fall + Snow covers Emacs + + ---AlexSchroeder + #+END_VERSE + + When quoting a passage from another document, it is customary to +format this as a paragraph that is indented on both the left and the +right margin. You can include quotations in Org documents like this: + + #+BEGIN_QUOTE + Everything should be made as simple as possible, + but not any simpler ---Albert Einstein + #+END_QUOTE + + If you would like to center some text, do it like this: + + #+BEGIN_CENTER + Everything should be made as simple as possible, \\ + but not any simpler + #+END_CENTER + + +File: org.info, Node: Emphasis and Monospace, Next: Subscripts and Superscripts, Prev: Paragraphs, Up: Markup for Rich Contents + +12.2 Emphasis and Monospace +=========================== + +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. + + To turn off fontification for marked up text, you can set +‘org-fontify-emphasized-text’ to ‘nil’. To narrow down the list of +available markup syntax, you can customize ‘org-emphasis-alist’. + + Sometimes, when marked text also contains the marker character +itself, the result may be unsettling. For example, + + /One may expect this whole sentence to be italicized, but the + following ~user/?variable~ contains =/= character, which effectively + stops emphasis there./ + + You can use zero width space to help Org sorting out the ambiguity. +See *note Escape Character:: for more details. + + +File: org.info, Node: Subscripts and Superscripts, Next: Special Symbols, Prev: Emphasis and Monospace, Up: Markup for Rich Contents + +12.3 Subscripts and Superscripts +================================ + +‘^’ and ‘_’ are used to indicate super- and subscripts. To increase the +readability of ASCII text, it is not necessary, but OK, to surround +multi-character sub- and superscripts with curly braces. For example + + The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand, + the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}. + + 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. + + You can set ‘org-use-sub-superscripts’ in a file using the export +option ‘^:’ (see *note Export Settings::). For example, ‘#+OPTIONS: +^:{}’ sets ‘org-use-sub-superscripts’ to ‘{}’ and limits super- and +subscripts to the curly bracket notation. + + You can also toggle the visual display of super- and subscripts: + +‘C-c C-x \’ (‘org-toggle-pretty-entities’) + This command formats sub- and superscripts in a WYSIWYM way. + + Set both ‘org-pretty-entities’ and +‘org-pretty-entities-include-sub-superscripts’ to ‘t’ to start with +super- and subscripts _visually_ interpreted as specified by the option +‘org-use-sub-superscripts’. + + +File: org.info, Node: Special Symbols, Next: Embedded LaTeX, Prev: Subscripts and Superscripts, Up: Markup for Rich Contents + +12.4 Special Symbols +==================== + +You can use LaTeX-like syntax to insert special symbols—named +entities—like ‘\alpha’ to indicate the Greek letter, or ‘\to’ to +indicate an arrow. Completion for these symbols is available, just type +‘\’ and maybe a few letters, and press ‘M-<TAB>’ to see possible +completions. If you need such a symbol inside a word, terminate it with +a pair of curly brackets. For example + + Pro tip: Given a circle \Gamma of diameter d, the length of its + circumference is \pi{}d. + + A large number of entities is provided, with names taken from both +HTML and LaTeX; you can comfortably browse the complete list from a +dedicated buffer using the command ‘org-entities-help’. It is also +possible to provide your own special symbols in the variable +‘org-entities-user’. + + During export, these symbols are transformed into the native format +of the exporter back-end. Strings like ‘\alpha’ are exported as +‘α’ in the HTML output, and as ‘\(\alpha\)’ in the LaTeX output. +Similarly, ‘\nbsp’ becomes ‘ ’ in HTML and ‘~’ in LaTeX. + + If you would like to see entities displayed as UTF-8 characters, use +the following command(1): + +‘C-c C-x \’ (‘org-toggle-pretty-entities’) + + Toggle display of entities as UTF-8 characters. This does not + change the buffer content which remains plain ASCII, but it + overlays the UTF-8 character for display purposes only. + + In addition to regular entities defined above, Org exports in a +special way(2) the following commonly used character combinations: ‘\-’ +is treated as a shy hyphen, ‘--’ and ‘---’ are converted into dashes, +and ‘...’ becomes a compact set of dots. + + ---------- Footnotes ---------- + + (1) You can turn this on by default by setting the variable +‘org-pretty-entities’, or on a per-file base with the ‘STARTUP’ option +‘entitiespretty’. + + (2) This behavior can be disabled with ‘-’ export setting (see *note +Export Settings::). + + +File: org.info, Node: Embedded LaTeX, Next: Literal Examples, Prev: Special Symbols, Up: Markup for Rich Contents + +12.5 Embedded LaTeX +=================== + +Plain ASCII is normally sufficient for almost all note taking. +Exceptions include scientific notes, which often require mathematical +symbols and the occasional formula. LaTeX(1) 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 pretty +output for a number of export back-ends. + +* Menu: + +* LaTeX fragments:: Complex formulas made easy. +* Previewing LaTeX fragments:: What will this snippet look like? +* CDLaTeX mode:: Speed up entering of formulas. + + ---------- Footnotes ---------- + + (1) LaTeX is a macro system based on Donald E. Knuth’s TeX system. +Many of the features described here as “LaTeX” are really from TeX, but +for simplicity I am blurring this distinction. + + +File: org.info, Node: LaTeX fragments, Next: Previewing LaTeX fragments, Up: Embedded LaTeX + +12.5.1 LaTeX fragments +---------------------- + +Org mode can contain LaTeX math fragments, and it supports ways to +process these for several export back-ends. When exporting to LaTeX, +the code is left as it is. When exporting to HTML, Org can use either +MathJax (https://www.mathjax.org) (see *note Math formatting in HTML +export::) or transcode the math into images (see *note 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(1). The only requirement is that the + ‘\begin’ statement appears on a new line, preceded by only + whitespace. + + • Text within the usual LaTeX math delimiters. To avoid conflicts + with currency specifications, single ‘$’ characters are only + recognized as math delimiters if the enclosed text contains at most + two line breaks, is directly attached to the ‘$’ characters with no + whitespace in between, and if the closing ‘$’ is followed by + whitespace, punctuation or a dash. For the other delimiters, there + is no such restriction, so when in doubt, use ‘\(...\)’ as inline + math delimiters. + +For example: + + \begin{equation} % arbitrary environments, + x=\sqrt{b} % even tables, figures + \end{equation} % etc + + If $a^2=b$ and \( b=2 \), then the solution must be + either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \]. + + LaTeX processing can be configured with the variable +‘org-export-with-latex’. The default setting is ‘t’ which means MathJax +for HTML, and no processing for ASCII and LaTeX back-ends. You can also +set this variable on a per-file basis using one of these lines: + +‘#+OPTIONS: tex:t’ Do the right thing automatically (MathJax) +‘#+OPTIONS: tex:nil’ Do not process LaTeX fragments at all +‘#+OPTIONS: tex:verbatim’ Verbatim export, for jsMath or so + + ---------- Footnotes ---------- + + (1) 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. + + +File: org.info, Node: Previewing LaTeX fragments, Next: CDLaTeX mode, Prev: LaTeX fragments, Up: Embedded LaTeX + +12.5.2 Previewing LaTeX fragments +--------------------------------- + +If you have a working LaTeX installation and ‘dvipng’, ‘dvisvgm’ or +‘convert’ installed(1), LaTeX fragments can be processed to produce +images of the typeset expressions to be used for inclusion while +exporting to HTML (see *note LaTeX fragments::), or for inline +previewing within Org mode. + + You can customize the variables ‘org-format-latex-options’ and +‘org-format-latex-header’ to influence some aspects of the preview. In +particular, the ‘:scale’ (and for HTML export, ‘:html-scale’) property +of the former can be used to adjust the size of the preview images. + +‘C-c C-x C-l’ (‘org-latex-preview’) + + Produce a preview image of the LaTeX fragment at point and overlay + it over the source code. If there is no fragment at point, process + all fragments in the current entry—between two headlines. + + When called with a single prefix argument, clear all images in the + current entry. Two prefix arguments produce a preview image for + all fragments in the buffer, while three of them clear all the + images in that buffer. + + You can turn on the previewing of all LaTeX fragments in a file with + + #+STARTUP: latexpreview + + To disable it, simply use + + #+STARTUP: nolatexpreview + + ---------- Footnotes ---------- + + (1) These are respectively available at +<http://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. + + +File: org.info, Node: CDLaTeX mode, Prev: Previewing LaTeX fragments, Up: Embedded LaTeX + +12.5.3 Using CDLaTeX to enter math +---------------------------------- + +CDLaTeX mode is a minor mode that is normally used in combination with a +major LaTeX mode like AUCTeX in order to speed-up insertion of +environments and math templates. Inside Org mode, you can make use of +some of the features of CDLaTeX mode. You need to install ‘cdlatex.el’ +and ‘texmathp.el’ (the latter comes also with AUCTeX) using MELPA +(https://melpa.org/) with the Emacs packaging system +(https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html) +or alternatively from +<https://staff.fnwi.uva.nl/c.dominik/Tools/cdlatex/>. Do not use +CDLaTeX mode itself under Org mode, but use the special version Org +CDLaTeX minor mode that comes as part of Org. Turn it on for the +current buffer with ‘M-x org-cdlatex-mode’, or for all Org files with + + (add-hook 'org-mode-hook #'turn-on-org-cdlatex) + + When this mode is enabled, the following features are present (for +more details see the documentation of CDLaTeX mode): + +‘C-c {’ + + Insert an environment template. + +‘<TAB>’ + + The ‘<TAB>’ key expands the template if point is inside a LaTeX + fragment(1). For example, ‘<TAB>’ expands ‘fr’ to ‘\frac{}{}’ and + position point correctly inside the first brace. Another ‘<TAB>’ + gets you into the second brace. + + Even outside fragments, ‘<TAB>’ expands environment abbreviations + at the beginning of a line. For example, if you write ‘equ’ at the + beginning of a line and press ‘<TAB>’, this abbreviation is + expanded to an ‘equation’ environment. To get a list of all + abbreviations, type ‘M-x cdlatex-command-help’. + +‘^’ +‘_’ + + Pressing ‘_’ and ‘^’ inside a LaTeX fragment inserts these + characters together with a pair of braces. If you use ‘<TAB>’ to + move out of the braces, and if the braces surround only a single + character or macro, they are removed again (depending on the + variable ‘cdlatex-simplify-sub-super-scripts’). + +‘`’ + + Pressing the backquote followed by a character inserts math macros, + also outside LaTeX fragments. If you wait more than 1.5 seconds + after the backquote, a help window pops up. + +‘'’ + + Pressing the single-quote followed by another character modifies + the symbol before point with an accent or a font. If you wait more + than 1.5 seconds after the single-quote, a help window pops up. + Character modification works only inside LaTeX fragments; outside + the quote is normal. + + ---------- Footnotes ---------- + + (1) Org mode has a method to test if point is inside such a fragment, +see the documentation of the function ‘org-inside-LaTeX-fragment-p’. + + +File: org.info, Node: Literal Examples, Next: Images, Prev: Embedded LaTeX, Up: Markup for Rich Contents + +12.6 Literal Examples +===================== + +You can include literal examples that should not be subjected to markup. +Such examples are typeset in monospace, so this is well suited for +source code and similar examples. + + #+BEGIN_EXAMPLE + Some example from a text file. + #+END_EXAMPLE + + There is one limitation, however. You must insert a comma right +before lines starting with either ‘*’, ‘,*’, ‘#+’ or ‘,#+’, as those may +be interpreted as outlines nodes or some other special syntax. Org +transparently strips these additional commas whenever it accesses the +contents of the block. + + #+BEGIN_EXAMPLE + ,* I am no real headline + #+END_EXAMPLE + + For simplicity when using small examples, you can also start the +example lines with a colon followed by a space. There may also be +additional whitespace before the colon: + + Here is an example + : Some example from a text file. + + 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(1). 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(2), see *note +Structure Templates:: for shortcuts to easily insert code blocks. + + #+BEGIN_SRC emacs-lisp + (defun org-xor (a b) + "Exclusive or." + (if a (not b) b)) + #+END_SRC + + 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. + + #+BEGIN_SRC emacs-lisp -n 20 + ;; This exports with line number 20. + (message "This is line 21") + #+END_SRC + + #+BEGIN_SRC emacs-lisp +n 10 + ;; This is listed as line 31. + (message "This is line 32") + #+END_SRC + + In literal examples, Org interprets strings like ‘(ref:name)’ as +labels, and use them as targets for special hyperlinks like +‘[[(name)]]’—i.e., the reference name enclosed in single parenthesis. +In HTML, hovering the mouse over such a link remote-highlights the +corresponding code line, which is kind of cool. + + You can also add a ‘-r’ switch which _removes_ the labels from the +source code(3). With the ‘-n’ switch, links to these references are +labeled by the line numbers from the code listing. Otherwise links use +the labels with no parentheses. Here is an example: + + #+BEGIN_SRC emacs-lisp -n -r + (save-excursion (ref:sc) + (goto-char (point-min)) (ref:jump) + #+END_SRC + In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]] + jumps to point-min. + + Source code and examples may be _indented_ in order to align nicely +with the surrounding text, and in particular with plain list structure +(see *note Plain Lists::). By default, Org only retains the relative +indentation between lines, e.g., when exporting the contents of the +block. However, you can use the ‘-i’ switch to also preserve the global +indentation, if it does matter. See *note Editing Source Code::. + + If the syntax for the label format conflicts with the language +syntax, use a ‘-l’ switch to change the format, for example + + #+BEGIN_SRC pascal -n -r -l "((%s))" + +See also the variable ‘org-coderef-label-format’. + + HTML export also allows examples to be published as text areas (see +*note Text areas in HTML export::). + + Because the ‘#+BEGIN’ ... ‘#+END’ patterns need to be added so often, +a shortcut is provided (see *note Structure Templates::). + +‘C-c '’ (‘org-edit-special’) + Edit the source code example at point in its native mode. This + works by switching to a temporary buffer with the source code. You + need to exit by pressing ‘C-c '’ again. The edited version then + replaces the old version in the Org buffer. Fixed-width + regions—where each line starts with a colon followed by a space—are + edited using Artist mode(4) to allow creating ASCII drawings + easily. Using this command in an empty line creates a new + fixed-width region. + + Calling ‘org-store-link’ (see *note Handling Links::) while editing a +source code example in a temporary buffer created with ‘C-c '’ prompts +for a label. Make sure that it is unique in the current buffer, and +insert it with the proper formatting like ‘(ref:label)’ at the end of +the current line. Then the label is stored as a link ‘(label)’, for +retrieval with ‘C-c C-l’. + + ---------- Footnotes ---------- + + (1) 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 listings +(https://www.ctan.org/pkg/listings) package or the minted +(https://www.ctan.org/pkg/minted) package. Refer to +‘org-latex-listings’ for details. + + (2) Source code in code blocks may also be evaluated either +interactively or on export. See *note Working with Source Code:: for +more information on evaluating code blocks. + + (3) Adding ‘-k’ to ‘-n -r’ _keeps_ the labels in the source code +while using line numbers for the links, which might be useful to explain +those in an Org mode example code. + + (4) You may select a different mode with the variable +‘org-edit-fixed-width-region-mode’. + + +File: org.info, Node: Images, Next: Captions, Prev: Literal Examples, Up: Markup for Rich Contents + +12.7 Images +=========== + +An image is a link to an image file(1) that does not have a description +part, for example + + ./img/cat.jpg + + If you wish to define a caption for the image (see *note Captions::) +and maybe a label for internal cross references (see *note Internal +Links::), make sure that the link is on a line by itself and precede it +with ‘CAPTION’ and ‘NAME’ keywords as follows: + + #+CAPTION: This is the caption for the next figure link (or table) + #+NAME: fig:SED-HR4049 + [[./img/a.jpg]] + + Such images can be displayed within the buffer with the following +command: + +‘C-c C-x C-v’ (‘org-toggle-inline-images’) + Toggle the inline display of linked images. When called with a + prefix argument, also display images that do have a link + description. You can ask for inline images to be displayed at + startup by configuring the variable + ‘org-startup-with-inline-images’(2). + + ---------- Footnotes ---------- + + (1) What Emacs considers to be an image depends on +‘image-file-name-extensions’ and ‘image-file-name-regexps’. + + (2) The variable ‘org-startup-with-inline-images’ can be set within a +buffer with the ‘STARTUP’ options ‘inlineimages’ and ‘noinlineimages’. + + +File: org.info, Node: Captions, Next: Horizontal Rules, Prev: Images, Up: Markup for Rich Contents + +12.8 Captions +============= + +You can assign a caption to a specific part of a document by inserting a +‘CAPTION’ keyword immediately before it: + + #+CAPTION: This is the caption for the next table (or link) + | ... | ... | + |-----+-----| + + Optionally, the caption can take the form: + + #+CAPTION[Short caption]: Longer caption. + + Even though images and tables are prominent examples of captioned +structures, the same caption mechanism can apply to many others—e.g., +LaTeX equations, source code blocks. Depending on the export back-end, +those may or may not be handled. + + +File: org.info, Node: Horizontal Rules, Next: Creating Footnotes, Prev: Captions, Up: Markup for Rich Contents + +12.9 Horizontal Rules +===================== + +A line consisting of only dashes, and at least 5 of them, is exported as +a horizontal line. + + +File: org.info, Node: Creating Footnotes, Prev: Horizontal Rules, Up: Markup for Rich Contents + +12.10 Creating Footnotes +======================== + +A footnote is started by a footnote marker in square brackets in column +0, no indentation allowed. It ends at the next footnote definition, +headline, or after two consecutive empty lines. The footnote reference +is simply the marker in square brackets, inside text. Markers always +start with ‘fn:’. For example: + + The Org homepage[fn:1] now looks a lot better than it used to. + ... + [fn:1] The link is: https://orgmode.org + + Org mode extends the number-based syntax to _named_ footnotes and +optional inline definition. Here are the valid references: + +‘[fn:NAME]’ + A named footnote reference, where NAME is a unique label word, or, + for simplicity of automatic creation, a number. + +‘[fn:: This is the inline definition of this footnote]’ + An anonymous footnote where the definition is given directly at the + reference point. + +‘[fn:NAME: a definition]’ + An inline definition of a footnote, which also specifies a name for + the note. Since Org allows multiple references to the same note, + you can then use ‘[fn:NAME]’ to create additional references. + + Footnote labels can be created automatically, or you can create names +yourself. This is handled by the variable ‘org-footnote-auto-label’ and +its corresponding ‘STARTUP’ keywords. See the docstring of that +variable for details. + + The following command handles footnotes: + +‘C-c C-x f’ + The footnote action command. + + When point is on a footnote reference, jump to the definition. + When it is at a definition, jump to the—first—reference. + + Otherwise, create a new footnote. Depending on the variable + ‘org-footnote-define-inline’(1), the definition is placed right + into the text as part of the reference, or separately into the + location determined by the variable ‘org-footnote-section’. + + When this command is called with a prefix argument, a menu of + additional options is offered: + + ‘s’ Sort the footnote definitions by reference sequence. + ‘r’ Renumber the simple ‘fn:N’ footnotes. + ‘S’ Short for first ‘r’, then ‘s’ action. + ‘n’ Rename all footnotes into a ‘fn:1’ ... ‘fn:n’ sequence. + ‘d’ Delete the footnote at point, including definition and + references. + + Depending on the variable ‘org-footnote-auto-adjust’(2), + renumbering and sorting footnotes can be automatic after each + insertion or deletion. + +‘C-c C-c’ + If point is on a footnote reference, jump to the definition. If it + is at the definition, jump back to the reference. When called at a + footnote location with a prefix argument, offer the same menu as + ‘C-c C-x f’. + +‘C-c C-o’ or ‘mouse-1/2’ + Footnote labels are also links to the corresponding definition or + reference, and you can use the usual commands to follow these + links. + + ---------- Footnotes ---------- + + (1) The corresponding in-buffer setting is: ‘#+STARTUP: fninline’ or +‘#+STARTUP: nofninline’. + + (2) The corresponding in-buffer options are ‘#+STARTUP: fnadjust’ and +‘#+STARTUP: nofnadjust’. + + +File: org.info, Node: Exporting, Next: Publishing, Prev: Markup for Rich Contents, Up: Top + +13 Exporting +************ + +At some point you might want to print your notes, publish them on the +web, or share them with people not using Org. Org can convert and +export documents to a variety of other formats while retaining as much +structure (see *note Document Structure::) and markup (see *note Markup +for Rich Contents::) as possible. + + The libraries responsible for translating Org files to other formats +are called _back-ends_. Org ships with support for the following +back-ends: + + • _ascii_ (ASCII format) + • _beamer_ (LaTeX Beamer format) + • _html_ (HTML format) + • _icalendar_ (iCalendar format) + • _latex_ (LaTeX format) + • _md_ (Markdown format) + • _odt_ (OpenDocument Text format) + • _org_ (Org format) + • _texinfo_ (Texinfo format) + • _man_ (Man page format) + + Users can install libraries for additional formats from the Emacs +packaging system. For easy discovery, these packages have a common +naming scheme: ‘ox-NAME’, where NAME is a format. For example, +‘ox-koma-letter’ for _koma-letter_ back-end. More libraries can be +found in the ‘org-contrib’ repository (see *note Installation::). + + Org only loads back-ends for the following formats by default: ASCII, +HTML, iCalendar, LaTeX, and ODT. Additional back-ends can be loaded in +either of two ways: by configuring the ‘org-export-backends’ variable, +or by requiring libraries in the Emacs init file. For example, to load +the Markdown back-end, add this to your Emacs config: + + (require 'ox-md) + +* Menu: + +* The Export Dispatcher:: The main interface. +* Export Settings:: Common export settings. +* Table of Contents:: The if and where of the table of contents. +* Include Files:: Include additional files into a document. +* Macro Replacement:: Use macros to create templates. +* Comment Lines:: What will not be exported. +* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding. +* Beamer Export:: Producing presentations and slides. +* HTML Export:: Exporting to HTML. +* LaTeX Export:: Exporting to LaTeX and processing to PDF. +* Markdown Export:: Exporting to Markdown. +* OpenDocument Text Export:: Exporting to OpenDocument Text. +* Org Export:: Exporting to Org. +* Texinfo Export:: Exporting to Texinfo. +* iCalendar Export:: Exporting to iCalendar. +* Other Built-in Back-ends:: Exporting to a man page. +* Advanced Export Configuration:: Fine-tuning the export output. +* Export in Foreign Buffers:: Author tables and lists in Org syntax. + + +File: org.info, Node: The Export Dispatcher, Next: Export Settings, Up: Exporting + +13.1 The Export Dispatcher +========================== + +The export dispatcher is the main interface for Org’s exports. A +hierarchical menu presents the currently configured export formats. +Options are shown as easy toggle switches on the same screen. + + Org also has a minimal prompt interface for the export dispatcher. +When the variable ‘org-export-dispatch-use-expert-ui’ is set to a +non-‘nil’ value, Org prompts in the minibuffer. To switch back to the +hierarchical menu, press ‘?’. + +‘C-c C-e’ (‘org-export’) + + Invokes the export dispatcher interface. The options show default + settings. The ‘C-u’ prefix argument preserves options from the + previous export, including any sub-tree selections. + + Org exports the entire buffer by default. If the Org buffer has an +active region, then Org exports just that region. + + Within the dispatcher interface, the following key combinations can +further alter what is exported, and how. + +‘C-a’ + + Toggle asynchronous export. Asynchronous export uses an external + Emacs process with a specially configured initialization file to + complete the exporting process in the background, without tying-up + Emacs. This is particularly useful when exporting long documents. + + Output from an asynchronous export is saved on the _export stack_. + To view this stack, call the export dispatcher with a double ‘C-u’ + prefix argument. If already in the export dispatcher menu, ‘&’ + displays the stack. + + You can make asynchronous export the default by setting + ‘org-export-in-background’. + + You can set the initialization file used by the background process + by setting ‘org-export-async-init-file’. + +‘C-b’ + + Toggle body-only export. Useful for excluding headers and footers + in the export. Affects only those back-end formats that have + sections like ‘<head>...</head>’ in HTML. + +‘C-s’ + + Toggle sub-tree export. When turned on, Org exports only the + sub-tree starting from point position at the time the export + dispatcher was invoked. Org uses the top heading of this sub-tree + as the document’s title. If point is not on a heading, Org uses + the nearest enclosing header. If point is in the document + preamble, Org signals an error and aborts export. + + To make sub-tree export the default, customize the variable + ‘org-export-initial-scope’. + +‘C-v’ + + Toggle visible-only export. This is useful for exporting only + certain parts of an Org document by adjusting the visibility of + particular headings. See also *note Sparse Trees::. + + +File: org.info, Node: Export Settings, Next: Table of Contents, Prev: The Export Dispatcher, Up: Exporting + +13.2 Export Settings +==================== + +Export options can be set: globally with variables; for an individual +file by making variables buffer-local with in-buffer settings (see *note +In-buffer Settings::); by setting individual keywords or specifying them +in compact form with the ‘OPTIONS’ keyword; or for a tree by setting +properties (see *note Properties and Columns::). Options set at a +specific level override options set at a more general level. + + In-buffer settings may appear anywhere in the file, either directly +or indirectly through a file included using ‘#+SETUPFILE: filename or +URL’ syntax. Option keyword sets tailored to a particular back-end can +be inserted from the export dispatcher (see *note The Export +Dispatcher::) using the ‘Insert template’ command by pressing ‘#’. To +insert keywords individually, a good way to make sure the keyword is +correct is to type ‘#+’ and then to use ‘M-<TAB>’(1) for completion. + + The export keywords available for every back-end, and their +equivalent global variables, include: + +‘AUTHOR’ + The document author (‘user-full-name’). + +‘CREATOR’ + Entity responsible for output generation + (‘org-export-creator-string’). + +‘DATE’ + A date or a time-stamp(2). + +‘EMAIL’ + The email address (‘user-mail-address’). + +‘LANGUAGE’ + 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’(3). + +‘SELECT_TAGS’ + The default value is ‘("export")’. When a tree is tagged with + ‘export’ (‘org-export-select-tags’), Org selects that tree and its + sub-trees for export. Org excludes trees with ‘noexport’ tags, see + below. When selectively exporting files with ‘export’ tags set, + Org does not export any text that appears before the first + headline. + +‘EXCLUDE_TAGS’ + The default value is ‘("noexport")’. When a tree is tagged with + ‘noexport’ (‘org-export-exclude-tags’), Org excludes that tree and + its sub-trees from export. Entries tagged with ‘noexport’ are + unconditionally excluded from the export, even if they have an + ‘export’ tag. Even if a sub-tree is not exported, Org executes any + code blocks contained there. + +‘TITLE’ + Org displays this title. For long titles, use multiple ‘#+TITLE’ + lines. + +‘EXPORT_FILE_NAME’ + The name of the output file to be generated. Otherwise, Org + generates the file name based on the buffer name and the extension + based on the back-end format. + + The ‘OPTIONS’ keyword is a compact form. To configure multiple +options, use several ‘OPTIONS’ lines. ‘OPTIONS’ recognizes the +following arguments. + +‘'’ + Toggle smart quotes (‘org-export-with-smart-quotes’). Depending on + the language used, when activated, Org treats pairs of double + quotes as primary quotes, pairs of single quotes as secondary + quotes, and single quote marks as apostrophes. + +‘*’ + Toggle emphasized text (‘org-export-with-emphasize’). + +‘-’ + Toggle conversion of special strings + (‘org-export-with-special-strings’). + +‘:’ + Toggle fixed-width sections (‘org-export-with-fixed-width’). + +‘<’ + Toggle inclusion of time/date active/inactive stamps + (‘org-export-with-timestamps’). + +‘\n’ + Toggles whether to preserve line breaks + (‘org-export-preserve-breaks’). + +‘^’ + Toggle TeX-like syntax for sub- and superscripts. If you write + ‘^:{}’, ‘a_{b}’ is interpreted, but the simple ‘a_b’ is left as it + is (‘org-export-with-sub-superscripts’). + +‘arch’ + Configure how archived trees are exported. When set to ‘headline’, + the export process skips the contents and processes only the + headlines (‘org-export-with-archived-trees’). + +‘author’ + Toggle inclusion of author name into exported file + (‘org-export-with-author’). + +‘broken-links’ + Toggles if Org should continue exporting upon finding a broken + internal link. When set to ‘mark’, Org clearly marks the problem + link in the output (‘org-export-with-broken-links’). + +‘c’ + Toggle inclusion of ‘CLOCK’ keywords (‘org-export-with-clocks’). + +‘creator’ + Toggle inclusion of creator information in the exported file + (‘org-export-with-creator’). + +‘d’ + Toggles inclusion of drawers, or list of drawers to include, or + list of drawers to exclude (‘org-export-with-drawers’). + +‘date’ + Toggle inclusion of a date into exported file + (‘org-export-with-date’). + +‘e’ + Toggle inclusion of entities (‘org-export-with-entities’). + +‘email’ + Toggle inclusion of the author’s e-mail into exported file + (‘org-export-with-email’). + +‘f’ + Toggle the inclusion of footnotes (‘org-export-with-footnotes’). + +‘H’ + Set the number of headline levels for export + (‘org-export-headline-levels’). Below that level, headlines are + treated differently. In most back-ends, they become list items. + +‘inline’ + Toggle inclusion of inlinetasks (‘org-export-with-inlinetasks’). + +‘num’ + Toggle section-numbers (‘org-export-with-section-numbers’). When + set to number N, Org numbers only those headlines at level N or + above. Set ‘UNNUMBERED’ property to non-‘nil’ to disable numbering + of heading and subheadings entirely. Moreover, when the value is + ‘notoc’ the headline, and all its children, do not appear in the + table of contents either (see *note Table of Contents::). + +‘p’ + Toggle export of planning information (‘org-export-with-planning’). + “Planning information” comes from lines located right after the + headline and contain any combination of these cookies: ‘SCHEDULED’, + ‘DEADLINE’, or ‘CLOSED’. + +‘pri’ + Toggle inclusion of priority cookies (‘org-export-with-priority’). + +‘prop’ + Toggle inclusion of property drawers, or list the properties to + include (‘org-export-with-properties’). + +‘stat’ + Toggle inclusion of statistics cookies + (‘org-export-with-statistics-cookies’). + +‘tags’ + Toggle inclusion of tags, may also be ‘not-in-toc’ + (‘org-export-with-tags’). + +‘tasks’ + Toggle inclusion of tasks (TODO items); or ‘nil’ to remove all + tasks; or ‘todo’ to remove done tasks; or list the keywords to keep + (‘org-export-with-tasks’). + +‘tex’ + ‘nil’ does not export; ‘t’ exports; ‘verbatim’ keeps everything in + verbatim (‘org-export-with-latex’). + +‘timestamp’ + Toggle inclusion of the creation time in the exported file + (‘org-export-time-stamp-file’). + +‘title’ + Toggle inclusion of title (‘org-export-with-title’). + +‘toc’ + Toggle inclusion of the table of contents, or set the level limit + (‘org-export-with-toc’). + +‘todo’ + Toggle inclusion of TODO keywords into exported text + (‘org-export-with-todo-keywords’). + +‘|’ + Toggle inclusion of tables (‘org-export-with-tables’). + + When exporting sub-trees, special node properties can override the +above keywords. These properties have an ‘EXPORT_’ prefix. For +example, ‘DATE’ becomes, ‘EXPORT_DATE’ when used for a specific +sub-tree. Except for ‘SETUPFILE’, all other keywords listed above have +an ‘EXPORT_’ equivalent. + + If ‘org-export-allow-bind-keywords’ is non-‘nil’, Emacs variables can +become buffer-local during export by using the ‘BIND’ keyword. Its +syntax is ‘#+BIND: variable value’. This is particularly useful for +in-buffer settings that cannot be changed using keywords. + + ---------- Footnotes ---------- + + (1) Many desktops intercept ‘M-<TAB>’ to switch windows. Use ‘C-M-i’ +or ‘<ESC> <TAB>’ instead. + + (2) The variable ‘org-export-date-timestamp-format’ defines how this +timestamp are exported. + + (3) For export to LaTeX format—or LaTeX-related formats such as +Beamer—, the ‘org-latex-package-alist’ variable needs further +configuration. See *note LaTeX specific export settings::. + + +File: org.info, Node: Table of Contents, Next: Include Files, Prev: Export Settings, Up: Exporting + +13.3 Table of Contents +====================== + +The table of contents includes all headlines in the document. Its depth +is therefore the same as the headline levels in the file. If you need +to use a different depth, or turn it off entirely, set the +‘org-export-with-toc’ variable accordingly. You can achieve the same on +a per file basis, using the following ‘toc’ item in ‘OPTIONS’ keyword: + + #+OPTIONS: toc:2 (only include two levels in TOC) + #+OPTIONS: toc:nil (no default TOC at all) + + Org includes both numbered and unnumbered headlines in the table of +contents(1). If you need to exclude an unnumbered headline, along with +all its children, set the ‘UNNUMBERED’ property to ‘notoc’ value. + + * Subtree not numbered, not in table of contents either + :PROPERTIES: + :UNNUMBERED: notoc + :END: + + Org normally inserts the table of contents directly before the first +headline of the file. To move the table of contents to a different +location, first turn off the default with ‘org-export-with-toc’ variable +or with ‘#+OPTIONS: toc:nil’. Then insert ‘#+TOC: headlines N’ at the +desired location(s). + + #+OPTIONS: toc:nil + ... + #+TOC: headlines 2 + + To adjust the table of contents depth for a specific section of the +Org document, append an additional ‘local’ parameter. This parameter +becomes a relative depth for the current level. The following example +inserts a local table of contents, with direct children only. + + * Section + #+TOC: headlines 1 local + + Note that for this feature to work properly in LaTeX export, the Org +file requires the inclusion of the titletoc package. Because of +compatibility issues, titletoc has to be loaded _before_ hyperref. +Customize the ‘org-latex-default-packages-alist’ variable. + + The following example inserts a table of contents that links to the +children of the specified target. + + * Target + :PROPERTIES: + :CUSTOM_ID: TargetSection + :END: + ** Heading A + ** Heading B + * Another section + #+TOC: headlines 1 :target #TargetSection + + The ‘:target’ attribute is supported in HTML, Markdown, ODT, and +ASCII export. + + Use the ‘TOC’ keyword to generate list of tables—respectively, all +listings—with captions. + + #+TOC: listings + #+TOC: tables + + Normally Org uses the headline for its entry in the table of +contents. But with ‘ALT_TITLE’ property, a different entry can be +specified for the table of contents. + + ---------- Footnotes ---------- + + (1) At the moment, some export back-ends do not obey this +specification. For example, LaTeX export excludes every unnumbered +headline from the table of contents. + + +File: org.info, Node: Include Files, Next: Macro Replacement, Prev: Table of Contents, Up: Exporting + +13.4 Include Files +================== + +During export, you can include the content of another file. For +example, to include your ‘.emacs’ file, you could use: + + #+INCLUDE: "~/.emacs" src emacs-lisp + +The first parameter is the file name to include. The optional second +parameter specifies the block type: ‘example’, ‘export’ or ‘src’. The +optional third parameter specifies the source code language to use for +formatting the contents. This is relevant to both ‘export’ and ‘src’ +block types. + + If an included file is specified as having a markup language, Org +neither checks for valid syntax nor changes the contents in any way. +For example and source blocks, Org code-escapes the contents before +inclusion. + + If an included file is not specified as having any markup language, +Org assumes it be in Org format and proceeds as usual with a few +exceptions. Org makes the footnote labels (see *note Creating +Footnotes::) in the included file local to that file. The contents of +the included file belong to the same structure—headline, item—containing +the ‘INCLUDE’ keyword. In particular, headlines within the file become +children of the current section. That behavior can be changed by +providing an additional keyword parameter, ‘:minlevel’. It shifts the +headlines in the included file to become the lowest level. For example, +this syntax makes the included file a sibling of the current top-level +headline: + + #+INCLUDE: "~/my-book/chapter2.org" :minlevel 1 + + Inclusion of only portions of files are specified using ranges +parameter with ‘:lines’ keyword. The line at the upper end of the range +will not be included. The start and/or the end of the range may be +omitted to use the obvious defaults. + +‘#+INCLUDE: "~/.emacs" :lines "5-10"’ Include lines 5 to 10, 10 excluded +‘#+INCLUDE: "~/.emacs" :lines "-10"’ Include lines 1 to 10, 10 excluded +‘#+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’(1) (see *note Search Options::). The ranges for +‘:lines’ keyword are relative to the requested element. Therefore, + + #+INCLUDE: "./paper.org::*conclusion" :lines 1-20 + +includes the first 20 lines of the headline named ‘conclusion’. + + To extract only the contents of the matched object, set +‘:only-contents’ property to non-‘nil’. This omits any planning lines +or property drawers. For example, to include the body of the heading +with the custom ID ‘theory’, you can use + + #+INCLUDE: "./paper.org::#theory" :only-contents t + + The following command allows navigating to the included document: + +‘C-c '’ (‘org-edit~special’) + + Visit the included file at point. + + ---------- Footnotes ---------- + + (1) 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. + + +File: org.info, Node: Macro Replacement, Next: Comment Lines, Prev: Include Files, Up: Exporting + +13.5 Macro Replacement +====================== + +Macros replace text snippets during export. Macros are defined globally +in ‘org-export-global-macros’, or document-wise with the following +syntax: + + #+MACRO: name replacement text; $1, $2 are arguments + +which can be referenced using ‘{{{name(arg1, arg2)}}}’(1). For example + + #+MACRO: poem Rose is $1, violet's $2. Life's ordered: Org assists you. + {{{poem(red,blue)}}} + +becomes + + Rose is red, violet's blue. Life's ordered: Org assists you. + + As a special case, Org parses any replacement text starting with +‘(eval’ as an Emacs Lisp expression and evaluates it accordingly. +Within such templates, arguments become strings. Thus, the following +macro + + #+MACRO: gnustamp (eval (concat "GNU/" (capitalize $1))) + +turns ‘{{{gnustamp(linux)}}}’ into ‘GNU/Linux’ during export. + + Org recognizes macro references in following Org markup areas: +paragraphs, headlines, verse blocks, tables cells and lists. Org also +recognizes macro references in keywords, such as ‘CAPTION’, ‘TITLE’, +‘AUTHOR’, ‘DATE’, and for some back-end specific export options. + + Org comes with following pre-defined macros: + +‘{{{keyword(NAME)}}}’ +‘{{{title}}}’ +‘{{{author}}}’ +‘{{{email}}}’ + The ‘keyword’ macro collects all values from NAME keywords + throughout the buffer, separated with white space. ‘title’, + ‘author’ and ‘email’ macros are shortcuts for, respectively, + ‘{{{keyword(TITLE)}}}’, ‘{{{keyword(AUTHOR)}}}’ and + ‘{{{keyword(EMAIL)}}}’. + +‘{{{date}}}’ +‘{{{date(FORMAT)}}}’ + This macro refers to the ‘DATE’ keyword. FORMAT is an optional + argument to the ‘date’ macro that is used only if ‘DATE’ is a + single timestamp. FORMAT should be a format string understood by + ‘format-time-string’. + +‘{{{time(FORMAT)}}}’ +‘{{{modification-time(FORMAT, VC)}}}’ + These macros refer to the document’s date and time of export and + date and time of modification. FORMAT is a string understood by + ‘format-time-string’. If the second argument to the + ‘modification-time’ macro is non-‘nil’, Org uses ‘vc.el’ to + retrieve the document’s modification time from the version control + system. Otherwise Org reads the file attributes. + +‘{{{input-file}}}’ + This macro refers to the filename of the exported file. + +‘{{{property(PROPERTY-NAME)}}}’ +‘{{{property(PROPERTY-NAME, SEARCH OPTION)}}}’ + This macro returns the value of property PROPERTY-NAME in the + current entry. If SEARCH-OPTION (see *note Search Options::) + refers to a remote entry, use it instead. + +‘{{{n}}}’ +‘{{{n(NAME)}}}’ +‘{{{n(NAME, ACTION)}}}’ + This macro implements custom counters by returning the number of + times the macro has been expanded so far while exporting the + buffer. You can create more than one counter using different NAME + values. If ACTION is ‘-’, previous value of the counter is held, + i.e., the specified counter is not incremented. If the value is a + number, the specified counter is set to that value. If it is any + other non-empty string, the specified counter is reset to 1. You + may leave NAME empty to reset the default counter. + + Moreover, inline source blocks (see *note Structure of Code Blocks::) +use the special ‘results’ macro to mark their output. As such, you are +advised against re-defining it, unless you know what you are doing. + + The surrounding brackets can be made invisible by setting +‘org-hide-macro-markers’ to a non-‘nil’ value. + + Org expands macros at the very beginning of the export process. + + ---------- Footnotes ---------- + + (1) 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. + + +File: org.info, Node: Comment Lines, Next: ASCII/Latin-1/UTF-8 export, Prev: Macro Replacement, Up: Exporting + +13.6 Comment Lines +================== + +Lines starting with zero or more whitespace characters followed by one +‘#’ and a whitespace are treated as comments and, as such, are not +exported. + + Likewise, regions surrounded by ‘#+BEGIN_COMMENT’ ... ‘#+END_COMMENT’ +are not exported. + + Finally, a ‘COMMENT’ keyword at the beginning of an entry, but after +any other keyword or priority cookie, comments out the entire subtree. +In this case, the subtree is not exported and no code block within it is +executed either(1). The command below helps changing the comment status +of a headline. + +‘C-c ;’ (‘org-toggle-comment’) + + Toggle the ‘COMMENT’ keyword at the beginning of an entry. + + ---------- Footnotes ---------- + + (1) For a less drastic behavior, consider using a select tag (see +*note Export Settings::) instead. + + +File: org.info, Node: ASCII/Latin-1/UTF-8 export, Next: Beamer Export, Prev: Comment Lines, Up: Exporting + +13.7 ASCII/Latin-1/UTF-8 export +=============================== + +ASCII export produces an output file containing only plain ASCII +characters. This is the simplest and most direct text output. It does +not contain any Org markup. Latin-1 and UTF-8 export use additional +characters and symbols available in these encoding standards. All three +of these export formats offer the most basic of text output for maximum +portability. + + On export, Org fills and justifies text according to the text width +set in ‘org-ascii-text-width’. + + Org exports links using a footnote-like style where the descriptive +part is in the text and the link is in a note before the next heading. +See the variable ‘org-ascii-links-to-notes’ for details. + +ASCII export commands +--------------------- + +‘C-c C-e t a’ (‘org-ascii-export-to-ascii’) +‘C-c C-e t l’ +‘C-c C-e t u’ + + Export as an ASCII file with a ‘.txt’ extension. For ‘myfile.org’, + Org exports to ‘myfile.txt’, overwriting without warning. For + ‘myfile.txt’, Org exports to ‘myfile.txt.txt’ in order to prevent + data loss. + +‘C-c C-e t A’ (‘org-ascii-export-to-ascii’) +‘C-c C-e t L’ +‘C-c C-e t U’ + + Export to a temporary buffer. Does not create a file. + +ASCII specific export settings +------------------------------ + +The ASCII export back-end has one extra keyword for customizing ASCII +output. Setting this keyword works similar to the general options (see +*note Export Settings::). + +‘SUBTITLE’ + The document subtitle. For long subtitles, use multiple + ‘#+SUBTITLE’ lines in the Org file. Org prints them on one + continuous line, wrapping into multiple lines if necessary. + +Header and sectioning structure +------------------------------- + +Org converts the first three outline levels into headlines for ASCII +export. The remaining levels are turned into lists. To change this +cut-off point where levels become lists, see *note Export Settings::. + +Quoting ASCII text +------------------ + +To insert text within the Org file by the ASCII back-end, use one the +following constructs, inline, keyword, or export block: + + Inline text @@ascii:and additional text@@ within a paragraph. + + #+ASCII: Some text + + #+BEGIN_EXPORT ascii + Org exports text in this block only when using ASCII back-end. + #+END_EXPORT + +ASCII specific attributes +------------------------- + +ASCII back-end recognizes only one attribute, ‘:width’, which specifies +the width of a horizontal rule in number of characters. The keyword and +syntax for specifying widths is: + + #+ATTR_ASCII: :width 10 + ----- + +ASCII special blocks +-------------------- + +Besides ‘#+BEGIN_CENTER’ blocks (see *note Paragraphs::), ASCII back-end +has these two left and right justification blocks: + + #+BEGIN_JUSTIFYLEFT + It's just a jump to the left... + #+END_JUSTIFYLEFT + + #+BEGIN_JUSTIFYRIGHT + ...and then a step to the right. + #+END_JUSTIFYRIGHT + + +File: org.info, Node: Beamer Export, Next: HTML Export, Prev: ASCII/Latin-1/UTF-8 export, Up: Exporting + +13.8 Beamer Export +================== + +Org uses Beamer export to convert an Org file tree structure into +high-quality interactive slides for presentations. Beamer is a LaTeX +document class for creating presentations in PDF, HTML, and other +popular display formats. + +* Menu: + +* Beamer export commands:: For creating Beamer documents. +* Beamer specific export settings:: For customizing Beamer export. +* Frames and Blocks in Beamer:: For composing Beamer slides. +* Beamer specific syntax:: For using in Org documents. +* Editing support:: Editing support. +* A Beamer example:: A complete presentation. + + +File: org.info, Node: Beamer export commands, Next: Beamer specific export settings, Up: Beamer Export + +13.8.1 Beamer export commands +----------------------------- + +‘C-c C-e l b’ (‘org-beamer-export-to-latex’) + + Export as LaTeX file with a ‘.tex’ extension. For ‘myfile.org’, + Org exports to ‘myfile.tex’, overwriting without warning. + +‘C-c C-e l B’ (‘org-beamer-export-as-latex’) + + Export to a temporary buffer. Does not create a file. + +‘C-c C-e l P’ (‘org-beamer-export-to-pdf’) + + Export as LaTeX file and then convert it to PDF format. + +‘C-c C-e l O’ + + Export as LaTeX file, convert it to PDF format, and then open the + PDF file. + + +File: org.info, Node: Beamer specific export settings, Next: Frames and Blocks in Beamer, Prev: Beamer export commands, Up: Beamer Export + +13.8.2 Beamer specific export settings +-------------------------------------- + +Beamer export back-end has several additional keywords for customizing +Beamer output. These keywords work similar to the general options +settings (see *note Export Settings::). + +‘BEAMER_THEME’ + The Beamer layout theme (‘org-beamer-theme’). Use square brackets + for options. For example: + + #+BEAMER_THEME: Rochester [height=20pt] + +‘BEAMER_FONT_THEME’ + The Beamer font theme. + +‘BEAMER_INNER_THEME’ + The Beamer inner theme. + +‘BEAMER_OUTER_THEME’ + The Beamer outer theme. + +‘BEAMER_HEADER’ + Arbitrary lines inserted in the preamble, just before the + ‘hyperref’ settings. + +‘DESCRIPTION’ + The document description. For long descriptions, use multiple + ‘DESCRIPTION’ keywords. By default, ‘hyperref’ inserts + ‘DESCRIPTION’ as metadata. Use ‘org-latex-hyperref-template’ to + configure document metadata. Use ‘org-latex-title-command’ to + configure typesetting of description as part of front matter. + +‘KEYWORDS’ + The keywords for defining the contents of the document. Use + multiple ‘KEYWORDS’ lines if necessary. By default, ‘hyperref’ + inserts ‘KEYWORDS’ as metadata. Use ‘org-latex-hyperref-template’ + to configure document metadata. Use ‘org-latex-title-command’ to + configure typesetting of keywords as part of front matter. + +‘SUBTITLE’ + Document’s subtitle. For typesetting, use + ‘org-beamer-subtitle-format’ string. Use + ‘org-latex-hyperref-template’ to configure document metadata. Use + ‘org-latex-title-command’ to configure typesetting of subtitle as + part of front matter. + + +File: org.info, Node: Frames and Blocks in Beamer, Next: Beamer specific syntax, Prev: Beamer specific export settings, Up: Beamer Export + +13.8.3 Frames and Blocks in Beamer +---------------------------------- + +Org transforms heading levels into Beamer’s sectioning elements, frames +and blocks. Any Org tree with a not-too-deep-level nesting should in +principle be exportable as a Beamer presentation. + + • Org headlines become Beamer frames when the heading level in Org is + equal to ‘org-beamer-frame-level’ or ‘H’ value in a ‘OPTIONS’ line + (see *note Export Settings::). + + Org overrides headlines to frames conversion for the current tree + of an Org file if it encounters the ‘BEAMER_ENV’ property set to + ‘frame’ or ‘fullframe’. Org ignores whatever + ‘org-beamer-frame-level’ happens to be for that headline level in + the Org tree. In Beamer terminology, a full frame is a frame + without its title. + + • Org exports a Beamer frame’s objects as block environments. Org + can enforce wrapping in special block types when ‘BEAMER_ENV’ + property is set(1). For valid values see + ‘org-beamer-environments-default’. To add more values, see + ‘org-beamer-environments-extra’. + + • If ‘BEAMER_ENV’ is set to ‘appendix’, Org exports the entry as an + appendix. When set to ‘note’, Org exports the entry as a note + within the frame or between frames, depending on the entry’s + heading level. When set to ‘noteNH’, Org exports the entry as a + note without its title. When set to ‘againframe’, Org exports the + entry with ‘\againframe’ command, which makes setting the + ‘BEAMER_REF’ property mandatory because ‘\againframe’ needs frame + to resume. + + When ‘ignoreheading’ is set, Org export ignores the entry’s + headline but not its content. This is useful for inserting content + between frames. It is also useful for properly closing a ‘column’ + environment. @end itemize + + When ‘BEAMER_ACT’ is set for a headline, Org export translates that + headline as an overlay or action specification. When enclosed in + square brackets, Org export makes the overlay specification a + default. Use ‘BEAMER_OPT’ to set any options applicable to the + current Beamer frame or block. The Beamer export back-end wraps + with appropriate angular or square brackets. It also adds the + ‘fragile’ option for any code that may require a verbatim block. + + To create a column on the Beamer slide, use the ‘BEAMER_COL’ + property for its headline in the Org file. Set the value of + ‘BEAMER_COL’ to a decimal number representing the fraction of the + total text width. Beamer export uses this value to set the + column’s width and fills the column with the contents of the Org + entry. If the Org entry has no specific environment defined, + Beamer export ignores the heading. If the Org entry has a defined + environment, Beamer export uses the heading as title. Behind the + scenes, Beamer export automatically handles LaTeX column + separations for contiguous headlines. To manually adjust them for + any unique configurations needs, use the ‘BEAMER_ENV’ property. + + ---------- Footnotes ---------- + + (1) 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. + + +File: org.info, Node: Beamer specific syntax, Next: Editing support, Prev: Frames and Blocks in Beamer, Up: Beamer Export + +13.8.4 Beamer specific syntax +----------------------------- + +Since Org’s Beamer export back-end is an extension of the LaTeX +back-end, it recognizes other LaTeX specific syntax—for example, +‘#+LATEX:’ or ‘#+ATTR_LATEX:’. See *note LaTeX Export::, for details. + + Beamer export wraps the table of contents generated with ‘toc:t’ +‘OPTION’ keyword in a ‘frame’ environment. Beamer export does not wrap +the table of contents generated with ‘TOC’ keyword (see *note Table of +Contents::). Use square brackets for specifying options. + + #+TOC: headlines [currentsection] + + Insert Beamer-specific code using the following constructs: + + #+BEAMER: \pause + + #+BEGIN_EXPORT beamer + Only Beamer export back-end exports this. + #+END_BEAMER + + Text @@beamer:some code@@ within a paragraph. + + Inline constructs, such as the last one above, are useful for adding +overlay specifications to objects with ‘bold’, ‘item’, ‘link’, +‘radio-target’ and ‘target’ types. Enclose the value in angular +brackets and place the specification at the beginning of the object as +shown in this example: + + A *@@beamer:<2->@@useful* feature + + Beamer export recognizes the ‘ATTR_BEAMER’ keyword with the following +attributes from Beamer configurations: ‘:environment’ for changing local +Beamer environment, ‘:overlay’ for specifying Beamer overlays in angular +or square brackets, and ‘:options’ for inserting optional arguments. + + #+ATTR_BEAMER: :environment nonindentlist + - item 1, not indented + - item 2, not indented + - item 3, not indented + + #+ATTR_BEAMER: :overlay <+-> + - item 1 + - item 2 + + #+ATTR_BEAMER: :options [Lagrange] + Let $G$ be a finite group, and let $H$ be + a subgroup of $G$. Then the order of $H$ divides the order of $G$. + + +File: org.info, Node: Editing support, Next: A Beamer example, Prev: Beamer specific syntax, Up: Beamer Export + +13.8.5 Editing support +---------------------- + +Org Beamer mode is a special minor mode for faster editing of Beamer +documents. + + #+STARTUP: beamer + +‘C-c C-b’ (‘org-beamer-select-environment’) + + Org Beamer mode provides this key for quicker selections in Beamer + normal environments, and for selecting the ‘BEAMER_COL’ property. + + +File: org.info, Node: A Beamer example, Prev: Editing support, Up: Beamer Export + +13.8.6 A Beamer example +----------------------- + +Here is an example of an Org document ready for Beamer export. + + #+TITLE: Example Presentation + #+AUTHOR: Carsten Dominik + #+OPTIONS: H:2 toc:t num:t + #+LATEX_CLASS: beamer + #+LATEX_CLASS_OPTIONS: [presentation] + #+BEAMER_THEME: Madrid + #+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) + + * This is the first structural section + + ** Frame 1 + *** Thanks to Eric Fraga :B_block: + :PROPERTIES: + :BEAMER_COL: 0.48 + :BEAMER_ENV: block + :END: + for the first viable Beamer setup in Org + *** Thanks to everyone else :B_block: + :PROPERTIES: + :BEAMER_COL: 0.48 + :BEAMER_ACT: <2-> + :BEAMER_ENV: block + :END: + for contributing to the discussion + **** This will be formatted as a beamer note :B_note: + :PROPERTIES: + :BEAMER_env: note + :END: + ** Frame 2 (where we will not use columns) + *** Request + Please test this stuff! + + +File: org.info, Node: HTML Export, Next: LaTeX Export, Prev: Beamer Export, Up: Exporting + +13.9 HTML Export +================ + +Org mode contains an HTML exporter with extensive HTML formatting +compatible with XHTML 1.0 strict standard. + +* Menu: + +* HTML export commands:: Invoking HTML export. +* HTML specific export settings:: Settings for HTML export. +* HTML doctypes:: Exporting various (X)HTML flavors. +* HTML preamble and postamble:: Inserting preamble and postamble. +* Quoting HTML tags:: Using direct HTML in Org files. +* Headlines in HTML export:: Formatting headlines. +* Links in HTML export:: Inserting and formatting links. +* Tables in HTML export:: How to modify the formatting of tables. +* Images in HTML export:: How to insert figures into HTML output. +* Math formatting in HTML export:: Beautiful math also on the web. +* Text areas in HTML export:: An alternate way to show an example. +* CSS support:: Changing the appearance of the output. +* JavaScript support:: Info and folding in a web browser. + + +File: org.info, Node: HTML export commands, Next: HTML specific export settings, Up: HTML Export + +13.9.1 HTML export commands +--------------------------- + +‘C-c C-e h h’ (‘org-html-export-to-html’) + + Export as HTML file with a ‘.html’ extension. For ‘myfile.org’, + Org exports to ‘myfile.html’, overwriting without warning. ‘C-c + C-e h o’ exports to HTML and opens it in a web browser. + +‘C-c C-e h H’ (‘org-html-export-as-html’) + + Exports to a temporary buffer. Does not create a file. + + +File: org.info, Node: HTML specific export settings, Next: HTML doctypes, Prev: HTML export commands, Up: HTML Export + +13.9.2 HTML specific export settings +------------------------------------ + +HTML export has a number of keywords, similar to the general options +settings described in *note Export Settings::. + +‘DESCRIPTION’ + This is the document’s description, which the HTML exporter inserts + it as a HTML meta tag in the HTML file. For long descriptions, use + multiple ‘DESCRIPTION’ lines. The exporter takes care of wrapping + the lines properly. + + The exporter includes a number of other meta tags, which can be + customized by modifying ‘org-html-meta-tags’. + +‘HTML_DOCTYPE’ + Specify the document type, for example: HTML5 (‘org-html-doctype’). + +‘HTML_CONTAINER’ + Specify the HTML container, such as ‘div’, for wrapping sections + and elements (‘org-html-container-element’). + +‘HTML_LINK_HOME’ + The URL for home link (‘org-html-link-home’). + +‘HTML_LINK_UP’ + The URL for the up link of exported HTML pages + (‘org-html-link-up’). + +‘HTML_MATHJAX’ + Options for MathJax (‘org-html-mathjax-options’). MathJax is used + to typeset LaTeX math in HTML documents. See *note Math formatting + in HTML export::, for an example. + +‘HTML_HEAD’ + Arbitrary lines for appending to the HTML document’s head + (‘org-html-head’). + +‘HTML_HEAD_EXTRA’ + More arbitrary lines for appending to the HTML document’s head + (‘org-html-head-extra’). + +‘KEYWORDS’ + Keywords to describe the document’s content. HTML exporter inserts + these keywords as HTML meta tags. For long keywords, use multiple + ‘KEYWORDS’ lines. + +‘LATEX_HEADER’ + Arbitrary lines for appending to the preamble; HTML exporter + appends when transcoding LaTeX fragments to images (see *note Math + formatting in HTML export::). + +‘SUBTITLE’ + The document’s subtitle. HTML exporter formats subtitle if + document type is ‘HTML5’ and the CSS has a ‘subtitle’ class. + + Some of these keywords are explained in more detail in the following +sections of the manual. + + +File: org.info, Node: HTML doctypes, Next: HTML preamble and postamble, Prev: HTML specific export settings, Up: HTML Export + +13.9.3 HTML doctypes +-------------------- + +Org can export to various (X)HTML flavors. + + Set the ‘org-html-doctype’ variable for different (X)HTML variants. +Depending on the variant, the HTML exporter adjusts the syntax of HTML +conversion accordingly. Org includes the following ready-made variants: + + • ‘"html4-strict"’ + • ‘"html4-transitional"’ + • ‘"html4-frameset"’ + • ‘"xhtml-strict"’ + • ‘"xhtml-transitional"’ + • ‘"xhtml-frameset"’ + • ‘"xhtml-11"’ + • ‘"html5"’ + • ‘"xhtml5"’ + +See the variable ‘org-html-doctype-alist’ for details. The default is +‘"xhtml-strict"’. + + Org’s HTML exporter does not by default enable new block elements +introduced with the HTML5 standard. To enable them, set +‘org-html-html5-fancy’ to non-‘nil’. Or use an ‘OPTIONS’ line in the +file to set ‘html5-fancy’. + + HTML5 documents can now have arbitrary ‘#+BEGIN’ ... ‘#+END’ blocks. +For example: + + #+BEGIN_aside + Lorem ipsum + #+END_aside + +exports to: + + <aside> + <p>Lorem ipsum</p> + </aside> + +while this: + + #+ATTR_HTML: :controls controls :width 350 + #+BEGIN_video + #+HTML: <source src="movie.mp4" type="video/mp4"> + #+HTML: <source src="movie.ogg" type="video/ogg"> + Your browser does not support the video tag. + #+END_video + +exports to: + + <video controls="controls" width="350"> + <source src="movie.mp4" type="video/mp4"> + <source src="movie.ogg" type="video/ogg"> + <p>Your browser does not support the video tag.</p> + </video> + + When special blocks do not have a corresponding HTML5 element, the +HTML exporter reverts to standard translation (see +‘org-html-html5-elements’). For example, ‘#+BEGIN_lederhosen’ exports +to ‘<div class="lederhosen">’. + + Special blocks cannot have headlines. For the HTML exporter to wrap +the headline and its contents in ‘<section>’ or ‘<article>’ tags, set +the ‘HTML_CONTAINER’ property for the headline. + + +File: org.info, Node: HTML preamble and postamble, Next: Quoting HTML tags, Prev: HTML doctypes, Up: HTML Export + +13.9.4 HTML preamble and postamble +---------------------------------- + +The HTML exporter has delineations for preamble and postamble. The +default value for ‘org-html-preamble’ is ‘t’, which makes the HTML +exporter insert the preamble. See the variable +‘org-html-preamble-format’ for the format string. + + Set ‘org-html-preamble’ to a string to override the default format +string. If the string is a function, the HTML exporter expects the +function to return a string upon execution. The HTML exporter inserts +this string in the preamble. The HTML exporter does not insert a +preamble if ‘org-html-preamble’ is set ‘nil’. + + The default value for ‘org-html-postamble’ is ‘auto’, which makes the +HTML exporter build a postamble from looking up author’s name, email +address, creator’s name, and date. Set ‘org-html-postamble’ to ‘t’ to +insert the postamble in the format specified in the +‘org-html-postamble-format’ variable. The HTML exporter does not insert +a postamble if ‘org-html-postamble’ is set to ‘nil’. + + +File: org.info, Node: Quoting HTML tags, Next: Headlines in HTML export, Prev: HTML preamble and postamble, Up: HTML Export + +13.9.5 Quoting HTML tags +------------------------ + +The HTML export back-end transforms ‘<’ and ‘>’ to ‘<’ and ‘>’. +To include raw HTML code in the Org file so the HTML export back-end can +insert that HTML code in the output, use this inline syntax: +‘@@html:...@@’. For example: + + @@html:<b>@@bold text@@html:</b>@@ + + For larger raw HTML code blocks, use these HTML export code blocks: + + #+HTML: Literal HTML code for export + + #+BEGIN_EXPORT html + All lines between these markers are exported literally + #+END_EXPORT + + +File: org.info, Node: Headlines in HTML export, Next: Links in HTML export, Prev: Quoting HTML tags, Up: HTML Export + +13.9.6 Headlines in HTML export +------------------------------- + +Headlines are exported to ‘<h1>’, ‘<h2>’, etc. Each headline gets the +‘id’ attribute from ‘CUSTOM_ID’ property, or a unique generated value, +see *note Internal Links::. + + When ‘org-html-self-link-headlines’ is set to a non-‘nil’ value, the +text of the headlines is also wrapped in ‘<a>’ tags. These tags have a +‘href’ attribute making the headlines link to themselves. + + +File: org.info, Node: Links in HTML export, Next: Tables in HTML export, Prev: Headlines in HTML export, Up: HTML Export + +13.9.7 Links in HTML export +--------------------------- + +The HTML export back-end transforms Org’s internal links (see *note +Internal Links::) to equivalent HTML links in the output. The back-end +similarly handles Org’s automatic links created by radio targets (see +*note Radio Targets::) similarly. For Org links to external files, the +back-end transforms the links to _relative_ paths. + + For Org links to other ‘.org’ files, the back-end automatically +changes the file extension to ‘.html’ and makes file paths relative. If +the ‘.org’ files have an equivalent ‘.html’ version at the same +location, then the converted links should work without any further +manual intervention. However, to disable this automatic path +translation, set ‘org-html-link-org-files-as-html’ to ‘nil’. When +disabled, the HTML export back-end substitutes the ID-based links in the +HTML output. For more about linking files when publishing to a +directory, see *note Publishing links::. + + Org files can also have special directives to the HTML export +back-end. For example, by using ‘#+ATTR_HTML’ lines to specify new +format attributes to ‘<a>’ or ‘<img>’ tags. This example shows changing +the link’s title and style: + + #+ATTR_HTML: :title The Org mode homepage :style color:red; + [[https://orgmode.org]] + + +File: org.info, Node: Tables in HTML export, Next: Images in HTML export, Prev: Links in HTML export, Up: HTML Export + +13.9.8 Tables in HTML export +---------------------------- + +The HTML export back-end uses ‘org-html-table-default-attributes’ when +exporting Org tables to HTML. By default, the exporter does not draw +frames and cell borders. To change for this for a table, use the +following lines before the table in the Org file: + + #+CAPTION: This is a table with lines around and between cells + #+ATTR_HTML: :border 2 :rules all :frame border + + The HTML export back-end preserves column groupings in Org tables +(see *note Column Groups::) when exporting to HTML. + + Additional options for customizing tables for HTML export. + +‘org-html-table-align-individual-fields’ + Non-‘nil’ attaches style attributes for alignment to each table + field. + +‘org-html-table-caption-above’ + Non-‘nil’ places caption string at the beginning of the table. + +‘org-html-table-data-tags’ + Opening and ending tags for table data fields. + +‘org-html-table-default-attributes’ + Default attributes and values for table tags. + +‘org-html-table-header-tags’ + Opening and ending tags for table’s header fields. + +‘org-html-table-row-tags’ + Opening and ending tags for table rows. + +‘org-html-table-use-header-tags-for-first-column’ + Non-‘nil’ formats column one in tables with header tags. + + +File: org.info, Node: Images in HTML export, Next: Math formatting in HTML export, Prev: Tables in HTML export, Up: HTML Export + +13.9.9 Images in HTML export +---------------------------- + +The HTML export back-end has features to convert Org image links to HTML +inline images and HTML clickable image links. + + When the link in the Org file has no description, the HTML export +back-end by default in-lines that image. For example: +‘[[file:myimg.jpg]]’ is in-lined, while ‘[[file:myimg.jpg][the image]]’ +links to the text, ‘the image’. For more details, see the variable +‘org-html-inline-images’. + + On the other hand, if the description part of the Org link is itself +another link, such as ‘file:’ or ‘http:’ URL pointing to an image, the +HTML export back-end in-lines this image and links to the main image. +This Org syntax enables the back-end to link low-resolution thumbnail to +the high-resolution version of the image, as shown in this example: + + [[file:highres.jpg][file:thumb.jpg]] + + To change attributes of in-lined images, use ‘#+ATTR_HTML’ lines in +the Org file. This example shows realignment to right, and adds ‘alt’ +and ‘title’ attributes in support of text viewers and modern web +accessibility standards. + + #+CAPTION: A black cat stalking a spider + #+ATTR_HTML: :alt cat/spider image :title Action! :align right + [[./img/a.jpg]] + + The HTML export back-end copies the ‘http’ links from the Org file +as-is. + + +File: org.info, Node: Math formatting in HTML export, Next: Text areas in HTML export, Prev: Images in HTML export, Up: HTML Export + +13.9.10 Math formatting in HTML export +-------------------------------------- + +LaTeX math snippets (see *note LaTeX fragments::) can be displayed in +two different ways on HTML pages. The default is to use the MathJax +(https://www.mathjax.org), which should work out of the box with +Org(1)(2). Some MathJax display options can be configured via +‘org-html-mathjax-options’, or in the buffer. For example, with the +following settings, + + #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler + #+HTML_MATHJAX: cancel.js noErrors.js + +equation labels are displayed on the left margin and equations are five +em from the left margin. In addition, it loads the two MathJax +extensions ‘cancel.js’ and ‘noErrors.js’(3). + + See the docstring of ‘org-html-mathjax-options’ for all supported +variables. The MathJax template can be configure via +‘org-html-mathjax-template’. + + If you prefer, you can also request that LaTeX fragments are +processed into small images that will be inserted into the browser page. +Before the availability of MathJax, this was the default method for Org +files. This method requires that the dvipng program, dvisvgm or +ImageMagick suite is available on your system. You can still get this +processing with + + #+OPTIONS: tex:dvipng + + #+OPTIONS: tex:dvisvgm + +or + + #+OPTIONS: tex:imagemagick + + ---------- Footnotes ---------- + + (1) By default Org loads MathJax from cdnjs.com (https://cdnjs.com) +as recommended by MathJax (https://www.mathjax.org). + + (2) Please note that exported formulas are part of an HTML document, +and that signs such as ‘<’, ‘>’, or ‘&’ have special meanings. See +MathJax TeX and LaTeX support +(http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents). + + (3) See TeX and LaTeX extensions +(http://docs.mathjax.org/en/latest/tex.html#tex-extensions) in the +MathJax manual (http://docs.mathjax.org) to learn about extensions. + + +File: org.info, Node: Text areas in HTML export, Next: CSS support, Prev: Math formatting in HTML export, Up: HTML Export + +13.9.11 Text areas in HTML export +--------------------------------- + +Before Org mode’s Babel, one popular approach to publishing code in HTML +was by using ‘:textarea’. The advantage of this approach was that +copying and pasting was built into browsers with simple JavaScript +commands. Even editing before pasting was made simple. + + The HTML export back-end can create such text areas. It requires an +‘#+ATTR_HTML’ line as shown in the example below with the ‘:textarea’ +option. This must be followed by either an example or a source code +block. Other Org block types do not honor the ‘:textarea’ option. + + By default, the HTML export back-end creates a text area 80 +characters wide and height just enough to fit the content. Override +these defaults with ‘:width’ and ‘:height’ options on the ‘#+ATTR_HTML’ +line. + + #+ATTR_HTML: :textarea t :width 40 + #+BEGIN_EXAMPLE + (defun org-xor (a b) + "Exclusive or." + (if a (not b) b)) + #+END_EXAMPLE + + +File: org.info, Node: CSS support, Next: JavaScript support, Prev: Text areas in HTML export, Up: HTML Export + +13.9.12 CSS support +------------------- + +You can modify the CSS style definitions for the exported file. The +HTML exporter assigns the following special CSS classes(1) to +appropriate parts of the document—your style specifications may change +these, in addition to any of the standard classes like for headlines, +tables, etc. + +‘p.author’ author information, including email +‘p.date’ publishing date +‘p.creator’ creator info, about org mode version +‘.title’ document title +‘.subtitle’ document subtitle +‘.todo’ TODO keywords, all not-done states +‘.done’ the DONE keywords, all states that count as done +‘.WAITING’ each TODO keyword also uses a class named after itself +‘.timestamp’ timestamp +‘.timestamp-kwd’ keyword associated with a timestamp, like ‘SCHEDULED’ +‘.timestamp-wrapper’ span around keyword plus timestamp +‘.tag’ tag in a headline +‘._HOME’ each tag uses itself as a class, “@” replaced by “_” +‘.target’ target for links +‘.linenr’ the line number in a code example +‘.code-highlighted’ for highlighting referenced code lines +‘div.outline-N’ div for outline level N (headline plus text) +‘div.outline-text-N’ extra div for text at outline level N +‘.section-number-N’ section number in headlines, different for each level +‘.figure-number’ label like “Figure 1:” +‘.table-number’ label like “Table 1:” +‘.listing-number’ label like “Listing 1:” +‘div.figure’ how to format an in-lined image +‘pre.src’ formatted source code +‘pre.example’ normal example +‘p.verse’ verse paragraph +‘div.footnotes’ footnote section headline +‘p.footnote’ footnote definition paragraph, containing a footnote +‘.footref’ a footnote reference number (always a <sup>) +‘.footnum’ footnote number in footnote definition (always <sup>) +‘.org-svg’ default class for a linked ‘.svg’ image + + The HTML export back-end includes a compact default style in each +exported HTML file. To override the default style with another style, +use these keywords in the Org file. They will replace the global +defaults the HTML exporter uses. + + #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" /> + #+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" /> + + To just turn off the default style, customize +‘org-html-head-include-default-style’ variable, or use this option line +in the Org file. + + #+OPTIONS: html-style:nil + + For longer style definitions, either use several ‘HTML_HEAD’ and +‘HTML_HEAD_EXTRA’ keywords, or use ‘<style> ... </style>’ blocks around +them. Both of these approaches can avoid referring to an external file. + + In order to add styles to a sub-tree, use the ‘HTML_CONTAINER_CLASS’ +property to assign a class to the tree. In order to specify CSS styles +for a particular headline, you can use the ID specified in a ‘CUSTOM_ID’ +property. You can also assign a specific class to a headline with the +‘HTML_HEADLINE_CLASS’ property. + + Never change the ‘org-html-style-default’ constant. Instead use +other simpler ways of customizing as described above. + + ---------- Footnotes ---------- + + (1) If the classes on TODO keywords and tags lead to conflicts, use +the variables ‘org-html-todo-kwd-class-prefix’ and +‘org-html-tag-class-prefix’ to make them unique. + + +File: org.info, Node: JavaScript support, Prev: CSS support, Up: HTML Export + +13.9.13 JavaScript supported display of web pages +------------------------------------------------- + +Sebastian Rose has written a JavaScript program especially designed to +allow two different ways of viewing HTML files created with Org. One is +an _Info_-like mode where each section is displayed separately and +navigation can be done with the ‘n’ and ‘p’ keys, and some other keys as +well, press ‘?’ for an overview of the available keys. The second one +has a _folding_ view, much like Org provides inside Emacs. The script +is available at <https://orgmode.org/org-info.js> and the documentation +at <https://orgmode.org/worg/code/org-info-js/>. The script is hosted +on <https://orgmode.org>, but for reliability, prefer installing it on +your own web server. + + To use this program, just add this line to the Org file: + + #+INFOJS_OPT: view:info toc:nil + +The HTML header now has the code needed to automatically invoke the +script. For setting options, use the syntax from the above line for +options described below: + +‘path:’ + The path to the script. The default is to grab the script from + <https://orgmode.org/org-info.js>, but you might want to have a + local copy and use a path like ‘../scripts/org-info.js’. + +‘view:’ + Initial view when the website is first shown. Possible values are: + + ‘info’ Info-like interface with one section per page + ‘overview’ Folding interface, initially showing only top-level + ‘content’ Folding interface, starting with all headlines visible + ‘showall’ Folding interface, all headlines and text visible + +‘sdepth:’ + Maximum headline level still considered as an independent section + for info and folding modes. The default is taken from + ‘org-export-headline-levels’, i.e., the ‘H’ switch in ‘OPTIONS’. + If this is smaller than in ‘org-export-headline-levels’, each + info/folding section can still contain child headlines. + +‘toc:’ + Should the table of contents _initially_ be visible? Even when + ‘nil’, you can always get to the “toc” with ‘i’. + +‘tdepth:’ + The depth of the table of contents. The defaults are taken from + the variables ‘org-export-headline-levels’ and + ‘org-export-with-toc’. + +‘ftoc:’ + Does the CSS of the page specify a fixed position for the “toc”? + If yes, the toc is displayed as a section. + +‘ltoc:’ + Should there be short contents (children) in each section? Make + this ‘above’ if the section should be above initial text. + +‘mouse:’ + Headings are highlighted when the mouse is over them. Should be + ‘underline’ (default) or a background color like ‘#cccccc’. + +‘buttons:’ + Should view-toggle buttons be everywhere? When ‘nil’ (the + default), only one such button is present. + + You can choose default values for these options by customizing the +variable ‘org-infojs-options’. If you always want to apply the script +to your pages, configure the variable ‘org-export-html-use-infojs’. + + +File: org.info, Node: LaTeX Export, Next: Markdown Export, Prev: HTML Export, Up: Exporting + +13.10 LaTeX Export +================== + +The LaTeX export back-end can handle complex documents, incorporate +standard or custom LaTeX document classes, generate documents using +alternate LaTeX engines, and produce fully linked PDF files with +indexes, bibliographies, and tables of contents, destined for +interactive online viewing or high-quality print publication. + + While the details are covered in-depth in this section, here are some +quick references to variables for the impatient: for engines, see +‘org-latex-compiler’; for build sequences, see ‘org-latex-pdf-process’; +for packages, see ‘org-latex-default-packages-alist’ and +‘org-latex-packages-alist’. + + An important note about the LaTeX export back-end: it is sensitive to +blank lines in the Org document. That’s because LaTeX itself depends on +blank lines to tell apart syntactical elements, such as paragraphs. + +* Menu: + +* LaTeX/PDF export commands:: For producing LaTeX and PDF documents. +* LaTeX specific export settings:: Unique to this LaTeX back-end. +* LaTeX header and sectioning:: Setting up the export file structure. +* Quoting LaTeX code:: Incorporating literal LaTeX code. +* Tables in LaTeX export:: Options for exporting tables to LaTeX. +* Images in LaTeX export:: How to insert figures into LaTeX output. +* Plain lists in LaTeX export:: Attributes specific to lists. +* Source blocks in LaTeX export:: Attributes specific to source code blocks. +* Example blocks in LaTeX export:: Attributes specific to example blocks. +* Special blocks in LaTeX export:: Attributes specific to special blocks. +* Horizontal rules in LaTeX export:: Attributes specific to horizontal rules. +* Verse blocks in LaTeX export:: Attributes specific to special blocks. +* Quote blocks in LaTeX export:: Attributes specific to quote blocks. + + +File: org.info, Node: LaTeX/PDF export commands, Next: LaTeX specific export settings, Up: LaTeX Export + +13.10.1 LaTeX/PDF export commands +--------------------------------- + +‘C-c C-e l l’ (‘org-latex-export-to-latex’) + Export to a LaTeX file with a ‘.tex’ extension. For ‘myfile.org’, + Org exports to ‘myfile.tex’, overwriting without warning. + +‘C-c C-e l L’ (‘org-latex-export-as-latex’) + Export to a temporary buffer. Do not create a file. + +‘C-c C-e l p’ (‘org-latex-export-to-pdf’) + Export as LaTeX file and convert it to PDF file. + +‘C-c C-e l o’ + Export as LaTeX file and convert it to PDF, then open the PDF using + the default viewer. + +‘M-x org-export-region-as-latex’ + Convert the region to LaTeX under the assumption that it was in Org + mode syntax before. This is a global command that can be invoked + in any buffer. + + The LaTeX export back-end can use any of these LaTeX engines: +‘pdflatex’, ‘xelatex’, and ‘lualatex’. These engines compile LaTeX +files with different compilers, packages, and output options. The LaTeX +export back-end finds the compiler version to use from +‘org-latex-compiler’ variable or the ‘#+LATEX_COMPILER’ keyword in the +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(1). + + ---------- Footnotes ---------- + + (1) 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. + + +File: org.info, Node: LaTeX specific export settings, Next: LaTeX header and sectioning, Prev: LaTeX/PDF export commands, Up: LaTeX Export + +13.10.2 LaTeX specific export settings +-------------------------------------- + +The LaTeX export back-end has several additional keywords for +customizing LaTeX output. Setting these keywords works similar to the +general options (see *note Export Settings::). + +‘DESCRIPTION’ + The document’s description. The description along with author + name, keywords, and related file metadata are inserted in the + output file by the hyperref package. See + ‘org-latex-hyperref-template’ for customizing metadata items. See + ‘org-latex-title-command’ for typesetting description into the + document’s front matter. Use multiple ‘DESCRIPTION’ keywords for + long descriptions. + +‘LANGUAGE’ + In order to be effective, the ‘babel’ or ‘polyglossia’ + packages—according to the LaTeX compiler used—must be loaded with + the appropriate language as argument. This can be accomplished by + modifying the ‘org-latex-packages-alist’ variable, e.g., with the + following snippet: + + (add-to-list 'org-latex-packages-alist + '("AUTO" "babel" t ("pdflatex"))) + (add-to-list 'org-latex-packages-alist + '("AUTO" "polyglossia" t ("xelatex" "lualatex"))) + +‘LATEX_CLASS’ + This is LaTeX document class, such as _article_, _report_, _book_, + and so on, which contain predefined preamble and headline level + mapping that the LaTeX export back-end needs. The back-end reads + the default class name from the ‘org-latex-default-class’ variable. + Org has _article_ as the default class. A valid default class must + be an element of ‘org-latex-classes’. + +‘LATEX_CLASS_OPTIONS’ + Options the LaTeX export back-end uses when calling the LaTeX + document class. + +‘LATEX_COMPILER’ + The compiler, such as ‘pdflatex’, ‘xelatex’, ‘lualatex’, for + producing the PDF. See ‘org-latex-compiler’. + +‘LATEX_HEADER’ +‘LATEX_HEADER_EXTRA’ + Arbitrary lines to add to the document’s preamble, before the + hyperref settings. See ‘org-latex-classes’ for adjusting the + structure and order of the LaTeX headers. + +‘KEYWORDS’ + The keywords for the document. The description along with author + name, keywords, and related file metadata are inserted in the + output file by the hyperref package. See + ‘org-latex-hyperref-template’ for customizing metadata items. See + ‘org-latex-title-command’ for typesetting description into the + document’s front matter. Use multiple ‘KEYWORDS’ lines if + necessary. + +‘SUBTITLE’ + The document’s subtitle. It is typeset as per + ‘org-latex-subtitle-format’. If ‘org-latex-subtitle-separate’ is + non-‘nil’, it is typed outside of the ‘\title’ macro. See + ‘org-latex-hyperref-template’ for customizing metadata items. See + ‘org-latex-title-command’ for typesetting description into the + document’s front matter. + + The following sections have further details. + + +File: org.info, Node: LaTeX header and sectioning, Next: Quoting LaTeX code, Prev: LaTeX specific export settings, Up: LaTeX Export + +13.10.3 LaTeX header and sectioning structure +--------------------------------------------- + +The LaTeX export back-end converts the first three of Org’s outline +levels into LaTeX headlines. The remaining Org levels are exported as +lists. To change this globally for the cut-off point between levels and +lists, (see *note Export Settings::). + + By default, the LaTeX export back-end uses the _article_ class. + + To change the default class globally, edit ‘org-latex-default-class’. +To change the default class locally in an Org file, add option lines +‘#+LATEX_CLASS: myclass’. To change the default class for just a part +of the Org file, set a sub-tree property, ‘EXPORT_LATEX_CLASS’. The +class name entered here must be valid member of ‘org-latex-classes’. +This variable defines a header template for each class into which the +exporter splices the values of ‘org-latex-default-packages-alist’ and +‘org-latex-packages-alist’. Use the same three variables to define +custom sectioning or custom classes. + + The LaTeX export back-end sends the ‘LATEX_CLASS_OPTIONS’ keyword and +‘EXPORT_LATEX_CLASS_OPTIONS’ property as options to the LaTeX +‘\documentclass’ macro. The options and the syntax for specifying them, +including enclosing them in square brackets, follow LaTeX conventions. + + #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn] + + The LaTeX export back-end appends values from ‘LATEX_HEADER’ and +‘LATEX_HEADER_EXTRA’ keywords to the LaTeX header. The docstring for +‘org-latex-classes’ explains in more detail. Also note that LaTeX +export back-end does not append ‘LATEX_HEADER_EXTRA’ to the header when +previewing LaTeX snippets (see *note Previewing LaTeX fragments::). + + A sample Org file with the above headers: + + #+LATEX_CLASS: article + #+LATEX_CLASS_OPTIONS: [a4paper] + #+LATEX_HEADER: \usepackage{xyz} + + * Headline 1 + some text + * Headline 2 + some more text + + +File: org.info, Node: Quoting LaTeX code, Next: Tables in LaTeX export, Prev: LaTeX header and sectioning, Up: LaTeX Export + +13.10.4 Quoting LaTeX code +-------------------------- + +The LaTeX export back-end can insert any arbitrary LaTeX code, see *note +Embedded LaTeX::. There are three ways to embed such code in the Org +file and they all use different quoting syntax. + + Inserting in-line quoted with @ symbols: + + Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph. + + Inserting as one or more keyword lines in the Org file: + + #+LATEX: any arbitrary LaTeX code + + Inserting as an export block in the Org file, where the back-end +exports any code between begin and end markers: + + #+BEGIN_EXPORT latex + any arbitrary LaTeX code + #+END_EXPORT + + +File: org.info, Node: Tables in LaTeX export, Next: Images in LaTeX export, Prev: Quoting LaTeX code, Up: LaTeX Export + +13.10.5 Tables in LaTeX export +------------------------------ + +The LaTeX export back-end can pass several LaTeX attributes for table +contents and layout. Besides specifying a label (see *note Internal +Links::) and a caption (see *note Captions::), the other valid LaTeX +attributes include: + +‘:mode’ + The LaTeX export back-end wraps the table differently depending on + the mode for accurate rendering of math symbols. Mode is either + ‘table’, ‘math’, ‘inline-math’ or ‘verbatim’. + + For ‘math’ or ‘inline-math’ mode, LaTeX export back-end wraps the + table in a math environment, but every cell in it is exported + as-is. The LaTeX export back-end determines the default mode from + ‘org-latex-default-table-mode’. The LaTeX export back-end merges + contiguous tables in the same mode into a single environment. + +‘:environment’ + Set the default LaTeX table environment for the LaTeX export + back-end to use when exporting Org tables. Common LaTeX table + environments are provided by these packages: tabularx, longtable, + array, tabu, and bmatrix. For packages, such as tabularx and tabu, + or any newer replacements, include them in the + ‘org-latex-packages-alist’ variable so the LaTeX export back-end + can insert the appropriate load package headers in the converted + LaTeX file. Look in the docstring for the + ‘org-latex-packages-alist’ variable for configuring these packages + for LaTeX snippet previews, if any. + +‘:caption’ + Use ‘CAPTION’ keyword to set a simple caption for a table (see + *note Captions::). For custom captions, use ‘:caption’ attribute, + which accepts raw LaTeX code. ‘:caption’ value overrides ‘CAPTION’ + value. + +‘:float’ +‘:placement’ + The table environments by default are not floats in LaTeX. To make + them floating objects use ‘:float’ with one of the following + options: ‘sideways’, ‘multicolumn’, ‘t’, and ‘nil’. + + LaTeX floats can also have additional layout ‘:placement’ + attributes. These are the usual ‘[h t b p ! H]’ permissions + specified in square brackets. Note that for ‘:float sideways’ + tables, the LaTeX export back-end ignores ‘:placement’ attributes. + +‘:align’ +‘:font’ +‘:width’ + The LaTeX export back-end uses these attributes for regular tables + to set their alignments, fonts, and widths. + +‘:spread’ + When ‘:spread’ is non-‘nil’, the LaTeX export back-end spreads or + shrinks the table by the ‘:width’ for tabu and longtabu + environments. ‘:spread’ has no effect if ‘:width’ is not set. + +‘:booktabs’ +‘:center’ +‘:rmlines’ + All three commands are toggles. ‘:booktabs’ brings in modern + typesetting enhancements to regular tables. The booktabs package + has to be loaded through ‘org-latex-packages-alist’. ‘:center’ is + for centering the table. ‘:rmlines’ removes all but the very first + horizontal line made of ASCII characters from “table.el” tables + only. + +‘:math-prefix’ +‘:math-suffix’ +‘:math-arguments’ + The LaTeX export back-end inserts ‘:math-prefix’ string value in a + math environment before the table. The LaTeX export back-end + inserts ‘:math-suffix’ string value in a math environment after the + table. The LaTeX export back-end inserts ‘:math-arguments’ string + value between the macro name and the table’s contents. + ‘:math-arguments’ comes in use for matrix macros that require more + than one argument, such as ‘qbordermatrix’. + + LaTeX table attributes help formatting tables for a wide range of +situations, such as matrix product or spanning multiple pages: + + #+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l + | ... | ... | + | ... | ... | + + #+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times + | a | b | + | c | d | + #+ATTR_LATEX: :mode math :environment bmatrix + | 1 | 2 | + | 3 | 4 | + + Set the caption with the LaTeX command +‘\bicaption{HeadingA}{HeadingB}’: + + #+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB} + | ... | ... | + | ... | ... | + + +File: org.info, Node: Images in LaTeX export, Next: Plain lists in LaTeX export, Prev: Tables in LaTeX export, Up: LaTeX Export + +13.10.6 Images in LaTeX export +------------------------------ + +The LaTeX export back-end processes image links in Org files that do not +have descriptions, such as these links ‘[[file:img.jpg]]’ or +‘[[./img.jpg]]’, as direct image insertions in the final PDF output. In +the PDF, they are no longer links but actual images embedded on the +page. The LaTeX export back-end uses ‘\includegraphics’ macro to insert +the image. But for TikZ (<http://sourceforge.net/projects/pgf/>) +images, the back-end uses an ‘\input’ macro wrapped within a +‘tikzpicture’ environment. + + For specifying image ‘:width’, ‘:height’, ‘:scale’ and other +‘:options’, use this syntax: + + #+ATTR_LATEX: :width 5cm :options angle=90 + [[./img/sed-hr4049.pdf]] + + A ‘:scale’ attribute overrides both ‘:width’ and ‘:height’ +attributes. + + For custom commands for captions, use the ‘:caption’ attribute. It +overrides the default ‘#+CAPTION’ value: + + #+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB} + [[./img/sed-hr4049.pdf]] + + When captions follow the method as described in *note Captions::, the +LaTeX export back-end wraps the picture in a floating ‘figure’ +environment. To float an image without specifying a caption, set the +‘:float’ attribute to one of the following: + +‘t’ + For a standard ‘figure’ environment; used by default whenever an + image has a caption. + +‘multicolumn’ + To span the image across multiple columns of a page; the back-end + wraps the image in a ‘figure*’ environment. + +‘wrap’ + For text to flow around the image on the right; the figure occupies + the left half of the page. + +‘sideways’ + For a new page with the image sideways, rotated ninety degrees, in + a ‘sidewaysfigure’ environment; overrides ‘:placement’ setting. + +‘nil’ + To avoid a ‘:float’ even if using a caption. + + Use the ‘placement’ attribute to modify a floating environment’s +placement. + + #+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement {r}{0.4\textwidth} + [[./img/hst.png]] + + The LaTeX export back-end centers all images by default. Setting +‘:center’ to ‘nil’ disables centering. To disable centering globally, +set ‘org-latex-images-centered’ to ‘nil’. + + Set the ‘:comment-include’ attribute to non-‘nil’ value for the LaTeX +export back-end to comment out the ‘\includegraphics’ macro. + + +File: org.info, Node: Plain lists in LaTeX export, Next: Source blocks in LaTeX export, Prev: Images in LaTeX export, Up: LaTeX Export + +13.10.7 Plain lists in LaTeX export +----------------------------------- + +The LaTeX export back-end accepts the ‘environment’ and ‘options’ +attributes for plain lists. Both attributes work together for +customizing lists, as shown in the examples: + + #+LATEX_HEADER: \usepackage[inline]{enumitem} + Some ways to say "Hello": + #+ATTR_LATEX: :environment itemize* + #+ATTR_LATEX: :options [label={}, itemjoin={,}, itemjoin*={, and}] + - Hola + - Bonjour + - Guten Tag. + + Since LaTeX supports only four levels of nesting for lists, use an +external package, such as ‘enumitem’ in LaTeX, for levels deeper than +four: + + #+LATEX_HEADER: \usepackage{enumitem} + #+LATEX_HEADER: \renewlist{itemize}{itemize}{9} + #+LATEX_HEADER: \setlist[itemize]{label=$\circ$} + - One + - Two + - Three + - Four + - Five + + +File: org.info, Node: Source blocks in LaTeX export, Next: Example blocks in LaTeX export, Prev: Plain lists in LaTeX export, Up: LaTeX Export + +13.10.8 Source blocks in LaTeX export +------------------------------------- + +The LaTeX export back-end can make source code blocks into floating +objects through the attributes ‘:float’ and ‘:options’. For ‘:float’: + +‘t’ + Makes a source block float; by default floats any source block with + a caption. + +‘multicolumn’ + Spans the source block across multiple columns of a page. + +‘nil’ + Avoids a ‘:float’ even if using a caption; useful for source code + blocks that may not fit on a page. + + #+ATTR_LATEX: :float nil + #+BEGIN_SRC emacs-lisp + Lisp code that may not fit in a single page. + #+END_SRC + + The LaTeX export back-end passes string values in ‘:options’ to LaTeX +packages for customization of that specific source block. In the +example below, the ‘:options’ are set for Minted. Minted is a source +code highlighting LaTeX package with many configurable options(1). + + #+ATTR_LATEX: :options commentstyle=\bfseries + #+BEGIN_SRC emacs-lisp + (defun Fib (n) + (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2))))) + #+END_SRC + + To apply similar configuration options for all source blocks in a +file, use the ‘org-latex-listings-options’ and +‘org-latex-minted-options’ variables. + + ---------- Footnotes ---------- + + (1) Minted uses an external Python package for code highlighting, +which requires the flag ‘-shell-escape’ to be added to +‘org-latex-pdf-process’. + + +File: org.info, Node: Example blocks in LaTeX export, Next: Special blocks in LaTeX export, Prev: Source blocks in LaTeX export, Up: LaTeX Export + +13.10.9 Example blocks in LaTeX export +-------------------------------------- + +The LaTeX export back-end wraps the contents of example blocks in a +‘verbatim’ environment. To change this behavior to use another +environment globally, specify an appropriate export filter (see *note +Advanced Export Configuration::). To change this behavior to use +another environment for each block, use the ‘:environment’ parameter to +specify a custom environment. + + #+ATTR_LATEX: :environment myverbatim + #+BEGIN_EXAMPLE + This sentence is false. + #+END_EXAMPLE + + +File: org.info, Node: Special blocks in LaTeX export, Next: Horizontal rules in LaTeX export, Prev: Example blocks in LaTeX export, Up: LaTeX Export + +13.10.10 Special blocks in LaTeX export +--------------------------------------- + +For other special blocks in the Org file, the LaTeX export back-end +makes a special environment of the same name. The back-end also takes +‘:options’, if any, and appends as-is to that environment’s opening +string. For example: + + #+BEGIN_abstract + We demonstrate how to solve the Syracuse problem. + #+END_abstract + + #+ATTR_LATEX: :options [Proof of important theorem] + #+BEGIN_proof + ... + Therefore, any even number greater than 2 is the sum of two primes. + #+END_proof + +exports to + + \begin{abstract} + We demonstrate how to solve the Syracuse problem. + \end{abstract} + + \begin{proof}[Proof of important theorem] + ... + Therefore, any even number greater than 2 is the sum of two primes. + \end{proof} + + If you need to insert a specific caption command, use ‘:caption’ +attribute. It overrides standard ‘CAPTION’ value, if any. For example: + + #+ATTR_LATEX: :caption \MyCaption{HeadingA} + #+BEGIN_proof + ... + #+END_proof + + +File: org.info, Node: Horizontal rules in LaTeX export, Next: Verse blocks in LaTeX export, Prev: Special blocks in LaTeX export, Up: LaTeX Export + +13.10.11 Horizontal rules in LaTeX export +----------------------------------------- + +The LaTeX export back-end converts horizontal rules by the specified +‘:width’ and ‘:thickness’ attributes. For example: + + #+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt + ----- + + +File: org.info, Node: Verse blocks in LaTeX export, Next: Quote blocks in LaTeX export, Prev: Horizontal rules in LaTeX export, Up: LaTeX Export + +13.10.12 Verse blocks in LaTeX export +------------------------------------- + +The LaTeX export back-end accepts four attributes for verse blocks: +‘:lines’, ‘:center’, ‘:versewidth’ and ‘:latexcode’. The three first +require the external LaTeX package ‘verse.sty’, which is an extension of +the standard LaTeX environment. + +‘:lines’ + To add marginal verse numbering. Its value is an integer, the + sequence in which the verses should be numbered. +‘:center’ + With value ‘t’ all the verses on the page are optically centered (a + typographic convention for poetry), taking as a reference the + longest verse, which must be indicated by the attribute + ‘:versewidth’. +‘:versewidth’ + Its value is a literal text string with the longest verse. +‘:latexcode’ + It accepts any arbitrary LaTeX code that can be included within a + LaTeX ‘verse’ environment. + + A complete example with Shakespeare’s first sonnet: + + #+ATTR_LATEX: :center t :latexcode \color{red} :lines 5 + #+ATTR_LATEX: :versewidth Feed’st thy light’s flame with self-substantial fuel, + #+BEGIN_VERSE + From fairest creatures we desire increase, + That thereby beauty’s rose might never die, + But as the riper should by time decease + His tender heir might bear his memory + But thou, contracted to thine own bright eyes, + Feed’st thy light’s flame with self-substantial fuel, + Making a famine where abundance lies, + Thyself thy foe, to thy sweet self too cruel. + Thou that art now the world’s fresh ornament, + And only herald to the gaudy spring, + Within thine own bud buriest thy content, + And, tender churl, mak’st waste in niggardly. + Pity the world, or else this glutton be, + To eat the world’s due, by the grave and thee. + #+END_VERSE + + +File: org.info, Node: Quote blocks in LaTeX export, Prev: Verse blocks in LaTeX export, Up: LaTeX Export + +13.10.13 Quote blocks in LaTeX export +------------------------------------- + +The LaTeX export back-end accepts two attributes for quote blocks: +‘:environment’, for an arbitrary quoting environment (the default value +is that of ‘org-latex-default-quote-environment’: ‘"quote"’) and +‘:options’. For example, to choose the environment ‘quotation’, +included as an alternative to ‘quote’ in standard LaTeX classes: + + #+ATTR_LATEX: :environment quotation + #+BEGIN_QUOTE + some text... + #+END_QUOTE + + To choose the ‘foreigndisplayquote’ environment, included in the +LaTeX package ‘csquotes’, with the ‘german’ option, use this syntax: + + #+LATEX_HEADER:\usepackage[autostyle=true]{csquotes} + #+ATTR_LATEX: :environment foreigndisplayquote :options {german} + #+BEGIN_QUOTE + some text in German... + #+END_QUOTE + +which is exported to LaTeX as + + \begin{foreigndisplayquote}{german} + some text in German... + \end{foreigndisplayquote} + + +File: org.info, Node: Markdown Export, Next: OpenDocument Text Export, Prev: LaTeX Export, Up: Exporting + +13.11 Markdown Export +===================== + +The Markdown export back-end, “md”, converts an Org file to Markdown +format, as defined at <http://daringfireball.net/projects/markdown/>. + + Since it is built on top of the HTML back-end (see *note HTML +Export::), it converts every Org construct not defined in Markdown +syntax, such as tables, to HTML. + +Markdown export commands +------------------------ + +‘C-c C-e m m’ (‘org-md-export-to-markdown’) + Export to a text file with Markdown syntax. For ‘myfile.org’, Org + exports to ‘myfile.md’, overwritten without warning. + +‘C-c C-e m M’ (‘org-md-export-as-markdown’) + Export to a temporary buffer. Does not create a file. + +‘C-c C-e m o’ + Export as a text file with Markdown syntax, then open it. + +Header and sectioning structure +------------------------------- + +Based on ‘org-md-headline-style’, Markdown export can generate headlines +of both _atx_ and _setext_ types. _atx_ limits headline levels to two +whereas _setext_ limits headline levels to six. Beyond these limits, +the export back-end converts headlines to lists. To set a limit to a +level before the absolute limit (see *note Export Settings::). + + +File: org.info, Node: OpenDocument Text Export, Next: Org Export, Prev: Markdown Export, Up: Exporting + +13.12 OpenDocument Text Export +============================== + +The ODT export back-end handles creating of OpenDocument Text (ODT) +format. Documents created by this exporter use the ‘OpenDocument-v1.2 +specification’(1) and are compatible with LibreOffice 3.4. + +* Menu: + +* Pre-requisites for ODT export:: Required packages. +* ODT export commands:: Invoking export. +* ODT specific export settings:: Configuration options. +* Extending ODT export:: Producing DOC, PDF files. +* Applying custom styles:: Styling the output. +* Links in ODT export:: Handling and formatting links. +* Tables in ODT export:: Org tables conversions. +* Images in ODT export:: Inserting images. +* Math formatting in ODT export:: Formatting LaTeX fragments. +* Labels and captions in ODT export:: Rendering objects. +* Literal examples in ODT export:: For source code and example blocks. +* Advanced topics in ODT export:: For power users. + + ---------- Footnotes ---------- + + (1) See Open Document Format for Office Applications (OpenDocument) +Version 1.2 +(http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html). + + +File: org.info, Node: Pre-requisites for ODT export, Next: ODT export commands, Up: OpenDocument Text Export + +13.12.1 Pre-requisites for ODT export +------------------------------------- + +The ODT export back-end relies on the zip program to create the final +compressed ODT output. Check if ‘zip’ is locally available and +executable. Without it, export cannot finish. + + +File: org.info, Node: ODT export commands, Next: ODT specific export settings, Prev: Pre-requisites for ODT export, Up: OpenDocument Text Export + +13.12.2 ODT export commands +--------------------------- + +‘C-c C-e o o’ (‘org-export-to-odt’) + Export as OpenDocument Text file. + + If ‘org-odt-preferred-output-format’ is specified, the ODT export + back-end automatically converts the exported file to that format. + + For ‘myfile.org’, Org exports to ‘myfile.odt’, overwriting without + warning. The ODT export back-end exports a region only if a region + was active. + + If the selected region is a single tree, the ODT export back-end + makes the tree head the document title. Incidentally, ‘C-c @’ + selects the current sub-tree. If the tree head entry has, or + inherits, an ‘EXPORT_FILE_NAME’ property, the ODT export back-end + uses that for file name. + +‘C-c C-e o O’ + Export as an OpenDocument Text file and open the resulting file. + + If ‘org-export-odt-preferred-output-format’ is specified, open the + converted file instead. See *note Automatically exporting to other + formats::. + + +File: org.info, Node: ODT specific export settings, Next: Extending ODT export, Prev: ODT export commands, Up: OpenDocument Text Export + +13.12.3 ODT specific export settings +------------------------------------ + +The ODT export back-end has several additional keywords for customizing +ODT output. Setting these keywords works similar to the general options +(see *note Export Settings::). + +‘DESCRIPTION’ + This is the document’s description, which the ODT export back-end + inserts as document metadata. For long descriptions, use multiple + lines, prefixed with ‘DESCRIPTION’. + +‘KEYWORDS’ + The keywords for the document. The ODT export back-end inserts the + description along with author name, keywords, and related file + metadata as metadata in the output file. Use multiple ‘KEYWORDS’ + if necessary. + +‘ODT_STYLES_FILE’ + The ODT export back-end uses the ‘org-odt-styles-file’ by default. + See *note Applying custom styles:: for details. + +‘SUBTITLE’ + The document subtitle. + + +File: org.info, Node: Extending ODT export, Next: Applying custom styles, Prev: ODT specific export settings, Up: OpenDocument Text Export + +13.12.4 Extending ODT export +---------------------------- + +The ODT export back-end can produce documents in other formats besides +ODT using a specialized ODT converter process. Its common interface +works with popular converters to produce formats such as ‘doc’, or +convert a document from one format, say ‘csv’, to another format, say +‘xls’. + + Customize ‘org-odt-convert-process’ variable to point to ‘unoconv’, +which is the ODT’s preferred converter. Working installations of +LibreOffice would already have ‘unoconv’ installed. Alternatively, +other converters may be substituted here. See *note Configuring a +document converter::. + +Automatically exporting to other formats +........................................ + +If ODT format is just an intermediate step to get to other formats, such +as ‘doc’, ‘docx’, ‘rtf’, or ‘pdf’, etc., then extend the ODT export +back-end to directly produce that format. Specify the final format in +the ‘org-odt-preferred-output-format’ variable. This is one way to +extend (see *note ODT export commands::). + +Converting between document formats +................................... + +The Org export back-end is made to be inter-operable with a wide range +of text document format converters. Newer generation converters, such +as LibreOffice and Pandoc, can handle hundreds of formats at once. Org +provides a consistent interaction with whatever converter is installed. +Here are some generic commands: + +‘M-x org-odt-convert’ + Convert an existing document from one format to another. With a + prefix argument, opens the newly produced file. + + +File: org.info, Node: Applying custom styles, Next: Links in ODT export, Prev: Extending ODT export, Up: OpenDocument Text Export + +13.12.5 Applying custom styles +------------------------------ + +The ODT export back-end comes with many OpenDocument styles (see *note +Working with OpenDocument style files::). To expand or further +customize these built-in style sheets, either edit the style sheets +directly or generate them using an application such as LibreOffice. The +example here shows creating a style using LibreOffice. + +Applying custom styles: the easy way +.................................... + + 1. Create a sample ‘example.org’ file with settings as shown below, + and export it to ODT format. + + #+OPTIONS: H:10 num:t + + 2. Open the above ‘example.odt’ using LibreOffice. Use the _Stylist_ + to locate the target styles, which typically have the “Org” prefix. + Open one, modify, and save as either OpenDocument Text (ODT) or + OpenDocument Template (OTT) file. + + 3. Customize the variable ‘org-odt-styles-file’ and point it to the + newly created file. For additional configuration options, see + *note Overriding factory styles: x-overriding-factory-styles. + + To apply an ODT style to a particular file, use the + ‘ODT_STYLES_FILE’ keyword as shown in the example below: + + #+ODT_STYLES_FILE: "/path/to/example.ott" + + or + + #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png")) + +Using third-party styles and templates +...................................... + +The ODT export back-end relies on many templates and style names. Using +third-party styles and templates can lead to mismatches. Templates +derived from built in ODT templates and styles seem to have fewer +problems. + + +File: org.info, Node: Links in ODT export, Next: Tables in ODT export, Prev: Applying custom styles, Up: OpenDocument Text Export + +13.12.6 Links in ODT export +--------------------------- + +ODT exporter creates native cross-references for internal links. It +creates Internet-style links for all other links. + + A link with no description and pointing to a regular, un-itemized, +outline heading is replaced with a cross-reference and section number of +the heading. + + A ‘\ref{label}’-style reference to an image, table etc., is replaced +with a cross-reference and sequence number of the labeled entity. See +*note Labels and captions in ODT export::. + + +File: org.info, Node: Tables in ODT export, Next: Images in ODT export, Prev: Links in ODT export, Up: OpenDocument Text Export + +13.12.7 Tables in ODT export +---------------------------- + +The ODT export back-end handles native Org mode tables (see *note +Tables::) and simple ‘table.el’ tables. Complex ‘table.el’ tables +having column or row spans are not supported. Such tables are stripped +from the exported document. + + By default, the ODT export back-end exports a table with top and +bottom frames and with ruled lines separating row and column groups (see +*note Column Groups::). All tables are typeset to occupy the same +width. The ODT export back-end honors any table alignments and relative +widths for columns (see *note Column Width and Alignment::). + + Note that the ODT export back-end interprets column widths as +weighted ratios, the default weight being 1. + + Specifying ‘:rel-width’ property on an ‘ATTR_ODT’ line controls the +width of the table. For example: + + #+ATTR_ODT: :rel-width 50 + | Area/Month | Jan | Feb | Mar | Sum | + |---------------+-------+-------+-------+-------| + | / | < | | | < | + | <l13> | <r5> | <r5> | <r5> | <r6> | + | North America | 1 | 21 | 926 | 948 | + | Middle East | 6 | 75 | 844 | 925 | + | Asia Pacific | 9 | 27 | 790 | 826 | + |---------------+-------+-------+-------+-------| + | Sum | 16 | 123 | 2560 | 2699 | + + On export, the above table takes 50% of text width area. The +exporter sizes the columns in the ratio: 13:5:5:5:6. The first column +is left-aligned and rest of the columns, right-aligned. Vertical rules +separate the header and the last column. Horizontal rules separate the +header and the last row. + + For even more customization, create custom table styles and associate +them with a table using the ‘ATTR_ODT’ keyword. See *note Customizing +tables in ODT export::. + + +File: org.info, Node: Images in ODT export, Next: Math formatting in ODT export, Prev: Tables in ODT export, Up: OpenDocument Text Export + +13.12.8 Images in ODT export +---------------------------- + +Embedding images +................ + +The ODT export back-end processes image links in Org files that do not +have descriptions, such as these links ‘[[file:img.jpg]]’ or +‘[[./img.jpg]]’, as direct image insertions in the final output. Either +of these examples works: + + [[file:img.png]] + + [[./img.png]] + +Embedding clickable images +.......................... + +For clickable images, provide a link whose description is another link +to an image file. For example, to embed an image ‘org-mode-unicorn.png’ +which when clicked jumps to <https://orgmode.org> website, do the +following + + [[https://orgmode.org][./org-mode-unicorn.png]] + +Sizing and scaling of embedded images +..................................... + +Control the size and scale of the embedded images with the ‘ATTR_ODT’ +attribute. + + The ODT export back-end starts with establishing the size of the +image in the final document. The dimensions of this size are measured +in centimeters. The back-end then queries the image file for its +dimensions measured in pixels. For this measurement, the back-end +relies on ImageMagick’s identify program or Emacs ‘create-image’ and +‘image-size’ API. ImageMagick is the preferred choice for large file +sizes or frequent batch operations. The back-end then converts the +pixel dimensions using ‘org-odt-pixels-per-inch’ into the familiar 72 +dpi or 96 dpi. The default value for this is in +‘display-pixels-per-inch’, which can be tweaked for better results based +on the capabilities of the output device. Here are some common image +scaling operations: + +Explicitly size the image + To embed ‘img.png’ as a 10 cm x 10 cm image, do the following: + + #+ATTR_ODT: :width 10 :height 10 + [[./img.png]] + +Scale the image + To embed ‘img.png’ at half its size, do the following: + + #+ATTR_ODT: :scale 0.5 + [[./img.png]] + +Scale the image to a specific width + To embed ‘img.png’ with a width of 10 cm while retaining the + original height:width ratio, do the following: + + #+ATTR_ODT: :width 10 + [[./img.png]] + +Scale the image to a specific height + To embed ‘img.png’ with a height of 10 cm while retaining the + original height:width ratio, do the following: + + #+ATTR_ODT: :height 10 + [[./img.png]] + +Anchoring of images +................... + +The ODT export back-end can anchor images to ‘as-char’, ‘paragraph’, or +‘page’. Set the preferred anchor using the ‘:anchor’ property of the +‘ATTR_ODT’ line. + + To create an image that is anchored to a page: + + #+ATTR_ODT: :anchor page + [[./img.png]] + + +File: org.info, Node: Math formatting in ODT export, Next: Labels and captions in ODT export, Prev: Images in ODT export, Up: OpenDocument Text Export + +13.12.9 Math formatting in ODT export +------------------------------------- + +The ODT exporter has special support for handling math. + +* Menu: + +* LaTeX math snippets:: Embedding in LaTeX format. +* MathML and OpenDocument formula files:: Embedding in native format. + + +File: org.info, Node: LaTeX math snippets, Next: MathML and OpenDocument formula files, Up: Math formatting in ODT export + +13.12.9.1 LaTeX math snippets +............................. + +LaTeX math snippets (see *note LaTeX fragments::) can be embedded in the +ODT document in one of the following ways: + +MathML + Add this line to the Org file. This option is activated on a + per-file basis. + + #+OPTIONS: tex:t + + With this option, LaTeX fragments are first converted into MathML + fragments using an external LaTeX-to-MathML converter program. The + resulting MathML fragments are then embedded as an OpenDocument + Formula in the exported document. + + You can specify the LaTeX-to-MathML converter by customizing the + variables ‘org-latex-to-mathml-convert-command’ and + ‘org-latex-to-mathml-jar-file’. + + If you prefer to use MathToWeb(1) as your converter, you can + configure the above variables as shown below. + + (setq org-latex-to-mathml-convert-command + "java -jar %j -unicode -force -df %o %I" + org-latex-to-mathml-jar-file + "/path/to/mathtoweb.jar") + + or, to use LaTeX​ML(2) instead, + + (setq org-latex-to-mathml-convert-command + "latexmlmath \"%i\" --presentationmathml=%o") + + To quickly verify the reliability of the LaTeX-to-MathML converter, + use the following commands: + + ‘M-x org-export-as-odf’ + Convert a LaTeX math snippet to an OpenDocument formula + (‘.odf’) file. + + ‘M-x org-export-as-odf-and-open’ + Convert a LaTeX math snippet to an OpenDocument formula + (‘.odf’) file and open the formula file with the + system-registered application. + +PNG images + Add this line to the Org file. This option is activated on a + per-file basis. + + #+OPTIONS: tex:dvipng + + #+OPTIONS: tex:dvisvgm + + or + + #+OPTIONS: tex:imagemagick + + Under this option, LaTeX fragments are processed into PNG or SVG + images and the resulting images are embedded in the exported + document. This method requires dvipng program, dvisvgm or + ImageMagick programs. + + ---------- Footnotes ---------- + + (1) See MathToWeb +(http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl). + + (2) See <http://dlmf.nist.gov/LaTeXML/>. + + +File: org.info, Node: MathML and OpenDocument formula files, Prev: LaTeX math snippets, Up: Math formatting in ODT export + +13.12.9.2 MathML and OpenDocument formula files +............................................... + +When embedding LaTeX math snippets in ODT documents is not reliable, +there is one more option to try. Embed an equation by linking to its +MathML (‘.mml’) source or its OpenDocument formula (‘.odf’) file as +shown below: + + [[./equation.mml]] + +or + + [[./equation.odf]] + + +File: org.info, Node: Labels and captions in ODT export, Next: Literal examples in ODT export, Prev: Math formatting in ODT export, Up: OpenDocument Text Export + +13.12.10 Labels and captions in ODT export +------------------------------------------ + +ODT format handles labeling and captioning of objects based on their +types. Inline images, tables, LaTeX fragments, and Math formulas are +numbered and captioned separately. Each object also gets a unique +sequence number based on its order of first appearance in the Org file. +Each category has its own sequence. A caption is just a label applied +to these objects. + + #+CAPTION: Bell curve + #+NAME: fig:SED-HR4049 + [[./img/a.png]] + + When rendered, it may show as follows in the exported document: + + Figure 2: Bell curve + + To modify the category component of the caption, customize the option +‘org-odt-category-map-alist’. For example, to tag embedded images with +the string “Illustration” instead of the default string “Figure”, use +the following setting: + + (setq org-odt-category-map-alist + '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p))) + + With the above modification, the previous example changes to: + + Illustration 2: Bell curve + + +File: org.info, Node: Literal examples in ODT export, Next: Advanced topics in ODT export, Prev: Labels and captions in ODT export, Up: OpenDocument Text Export + +13.12.11 Literal examples in ODT export +--------------------------------------- + +The ODT export back-end supports literal examples (see *note Literal +Examples::) with full fontification. Internally, the ODT export +back-end relies on ‘htmlfontify.el’ to generate the style definitions +needed for fancy listings. The auto-generated styles get ‘OrgSrc’ +prefix and inherit colors from the faces used by Emacs Font Lock library +for that source language. + + For custom fontification styles, customize the +‘org-odt-create-custom-styles-for-srcblocks’ option. + + To turn off fontification of literal examples, customize the +‘org-odt-fontify-srcblocks’ option. + + +File: org.info, Node: Advanced topics in ODT export, Prev: Literal examples in ODT export, Up: OpenDocument Text Export + +13.12.12 Advanced topics in ODT export +-------------------------------------- + +The ODT export back-end has extensive features useful for power users +and frequent uses of ODT formats. + +Configuring a document converter +................................ + +The ODT export back-end works with popular converters with little or no +extra configuration. See *note Extending ODT export::. The following +is for unsupported converters or tweaking existing defaults. + +Register the converter + Add the name of the converter to the ‘org-odt-convert-processes’ + variable. Note that it also requires how the converter is invoked + on the command line. See the variable’s docstring for details. + +Configure its capabilities + Specify which formats the converter can handle by customizing the + variable ‘org-odt-convert-capabilities’. Use the entry for the + default values in this variable for configuring the new converter. + Also see its docstring for details. + +Choose the converter + Select the newly added converter as the preferred one by + customizing the option ‘org-odt-convert-process’. + +Working with OpenDocument style files +..................................... + +This section explores the internals of the ODT exporter; the means by +which it produces styled documents; the use of automatic and custom +OpenDocument styles. + + The ODT exporter relies on two files for generating its output. +These files are bundled with the distribution under the directory +pointed to by the variable ‘org-odt-styles-dir’. The two files are: + +‘OrgOdtStyles.xml’ + This file contributes to the ‘styles.xml’ file of the final ODT + document. This file gets modified for the following purposes: + + 1. To control outline numbering based on user settings; + + 2. To add styles generated by ‘htmlfontify.el’ for fontification + of code blocks. + +‘OrgOdtContentTemplate.xml’ + This file contributes to the ‘content.xml’ file of the final ODT + document. The contents of the Org outline are inserted between the + ‘<office:text>’ ... ‘</office:text>’ elements of this file. + + Apart from serving as a template file for the final ‘content.xml’, + the file serves the following purposes: + + 1. It contains automatic styles for formatting of tables which + are referenced by the exporter; + + 2. It contains ‘<text:sequence-decl>’ ... ‘</text:sequence-decl>’ + elements that control numbering of tables, images, equations, + and similar entities. + + The following two variables control the location from where the ODT +exporter picks up the custom styles and content template files. +Customize these variables to override the factory styles used by the +exporter. + +‘org-odt-styles-file’ + The ODT export back-end uses the file pointed to by this variable, + such as ‘styles.xml’, for the final output. It can take one of the + following values: + + ‘FILE.xml’ + Use this file instead of the default ‘styles.xml’ + + ‘FILE.odt’ or ‘FILE.ott’ + Use the ‘styles.xml’ contained in the specified OpenDocument + Text or Template file + + ‘FILE.odt’ or ‘FILE.ott’ and a subset of included files + Use the ‘styles.xml’ contained in the specified OpenDocument + Text or Template file. Additionally extract the specified + member files and embed those within the final ODT document. + + Use this option if the ‘styles.xml’ file references additional + files like header and footer images. + + ‘nil’ + Use the default ‘styles.xml’. + +‘org-odt-content-template-file’ + Use this variable to specify the blank ‘content.xml’ used in the + final output. + +Creating one-off styles +....................... + +The ODT export back-end can read embedded raw OpenDocument XML from the +Org file. Such direct formatting is useful for one-off instances. + +Embedding ODT tags as part of regular text + Enclose OpenDocument syntax in ‘@@odt:...@@’ for inline markup. + For example, to highlight a region of text do the following: + + @@odt:<text:span text:style-name="Highlight">This is highlighted + text</text:span>@@. But this is regular text. + + *Hint:* To see the above example in action, edit the ‘styles.xml’ + (see *note Factory styles: x-orgodtstyles-xml.) and add a custom + _Highlight_ style as shown below: + + <style:style style:name="Highlight" style:family="text"> + <style:text-properties fo:background-color="#ff0000"/> + </style:style> + +Embedding a one-line OpenDocument XML + The ODT export back-end can read one-liner options with ‘#+ODT:’ in + the Org file. For example, to force a page break: + + #+ODT: <text:p text:style-name="PageBreak"/> + + *Hint:* To see the above example in action, edit your ‘styles.xml’ + (see *note Factory styles: x-orgodtstyles-xml.) and add a custom + ‘PageBreak’ style as shown below. + + <style:style style:name="PageBreak" style:family="paragraph" + style:parent-style-name="Text_20_body"> + <style:paragraph-properties fo:break-before="page"/> + </style:style> + +Embedding a block of OpenDocument XML + The ODT export back-end can also read ODT export blocks for + OpenDocument XML. Such blocks use the ‘#+BEGIN_EXPORT odt’ ... + ‘#+END_EXPORT’ constructs. + + For example, to create a one-off paragraph that uses bold text, do + the following: + + #+BEGIN_EXPORT odt + <text:p text:style-name="Text_20_body_20_bold"> + This paragraph is specially formatted and uses bold text. + </text:p> + #+END_EXPORT + +Customizing tables in ODT export +................................ + +Override the default table format by specifying a custom table style +with the ‘#+ATTR_ODT’ line. For a discussion on default formatting of +tables, see *note Tables in ODT export::. + + This feature closely mimics the way table templates are defined in +the OpenDocument-v1.2 specification(1). + + For quick preview of this feature, install the settings below and +export the table that follows: + + (setq org-export-odt-table-styles + (append org-export-odt-table-styles + '(("TableWithHeaderRowAndColumn" "Custom" + ((use-first-row-styles . t) + (use-first-column-styles . t))) + ("TableWithFirstRowandLastRow" "Custom" + ((use-first-row-styles . t) + (use-last-row-styles . t)))))) + + #+ATTR_ODT: :style TableWithHeaderRowAndColumn + | Name | Phone | Age | + | Peter | 1234 | 17 | + | Anna | 4321 | 25 | + + The example above used ‘Custom’ template and installed two table +styles ‘TableWithHeaderRowAndColumn’ and ‘TableWithFirstRowandLastRow’. +*Important:* The OpenDocument styles needed for producing the above +template were pre-defined. They are available in the section marked +‘Custom Table Template’ in ‘OrgOdtContentTemplate.xml’ (see *note +Factory styles: x-orgodtcontenttemplate-xml.). For adding new +templates, define new styles there. + + To use this feature proceed as follows: + + 1. Create a table template(2). + + A table template is set of ‘table-cell’ and ‘paragraph’ styles for + each of the following table cell categories: + + • Body + • First column + • Last column + • First row + • Last row + • Even row + • Odd row + • Even column + • Odd Column + + The names for the above styles must be chosen based on the name of + the table template using a well-defined convention. + + The naming convention is better illustrated with an example. For a + table template with the name ‘Custom’, the needed style names are + listed in the following table. + + Cell type Cell style Paragraph style + ---------------------------------------------------------------------------------- + Body ‘CustomTableCell’ ‘CustomTableParagraph’ + First column ‘CustomFirstColumnTableCell’ ‘CustomFirstColumnTableParagraph’ + Last column ‘CustomLastColumnTableCell’ ‘CustomLastColumnTableParagraph’ + First row ‘CustomFirstRowTableCell’ ‘CustomFirstRowTableParagraph’ + Last row ‘CustomLastRowTableCell’ ‘CustomLastRowTableParagraph’ + Even row ‘CustomEvenRowTableCell’ ‘CustomEvenRowTableParagraph’ + Odd row ‘CustomOddRowTableCell’ ‘CustomOddRowTableParagraph’ + Even column ‘CustomEvenColumnTableCell’ ‘CustomEvenColumnTableParagraph’ + Odd column ‘CustomOddColumnTableCell’ ‘CustomOddColumnTableParagraph’ + + To create a table template with the name ‘Custom’, define the above + styles in the ‘<office:automatic-styles>’ ... + ‘</office:automatic-styles>’ element of the content template file + (see *note Factory styles: x-orgodtcontenttemplate-xml.). + + 2. Define a table style(3). + + To define a table style, create an entry for the style in the + variable ‘org-odt-table-styles’ and specify the following: + + • the name of the table template created in step (1), + • the set of cell styles in that template that are to be + activated. + + For example, the entry below defines two different table styles + ‘TableWithHeaderRowAndColumn’ and ‘TableWithFirstRowandLastRow’ + based on the same template ‘Custom’. The styles achieve their + intended effect by selectively activating the individual cell + styles in that template. + + (setq org-export-odt-table-styles + (append org-export-odt-table-styles + '(("TableWithHeaderRowAndColumn" "Custom" + ((use-first-row-styles . t) + (use-first-column-styles . t))) + ("TableWithFirstRowandLastRow" "Custom" + ((use-first-row-styles . t) + (use-last-row-styles . t)))))) + + 3. Associate a table with the table style. + + To do this, specify the table style created in step (2) as part of + the ‘ATTR_ODT’ line as shown below. + + #+ATTR_ODT: :style TableWithHeaderRowAndColumn + | Name | Phone | Age | + | Peter | 1234 | 17 | + | Anna | 4321 | 25 | + +Validating OpenDocument XML +........................... + +Sometimes ODT format files may not open due to ‘.odt’ file corruption. +To verify if such a file is corrupt, validate it against the +OpenDocument Relax NG Compact (RNC) syntax schema. But first the ‘.odt’ +files have to be decompressed using ‘zip’. Note that ‘.odt’ files are +ZIP archives: *note (emacs)File Archives::. The contents of ODT files +are in XML. For general help with validation—and schema-sensitive +editing—of XML files: *note (nxml-mode)Introduction::. + + Customize ‘org-odt-schema-dir’ to point to a directory with +OpenDocument RNC files and the needed schema-locating rules. The ODT +export back-end takes care of updating the ‘rng-schema-locating-files’. + + ---------- Footnotes ---------- + + (1) OpenDocument-v1.2 Specification +(http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html) + + (2) See the ‘<table:table-template>’ element of the OpenDocument-v1.2 +specification. + + (3) See the attributes ‘table:template-name’, +‘table:use-first-row-styles’, ‘table:use-last-row-styles’, +‘table:use-first-column-styles’, ‘table:use-last-column-styles’, +‘table:use-banding-rows-styles’, and ‘table:use-banding-column-styles’ +of the ‘<table:table>’ element in the OpenDocument-v1.2 specification. + + +File: org.info, Node: Org Export, Next: Texinfo Export, Prev: OpenDocument Text Export, Up: Exporting + +13.13 Org Export +================ + +_org_ export back-end creates a normalized version of the Org document +in current buffer. The exporter evaluates Babel code (see *note +Evaluating Code Blocks::) and removes content specific to other +back-ends. + +Org export commands +------------------- + +‘C-c C-e O o’ (‘org-org-export-to-org’) + Export as an Org file with a ‘.org’ extension. For ‘myfile.org’, + Org exports to ‘myfile.org.org’, overwriting without warning. + +‘C-c C-e O v’ (~~) + Export to an Org file, then open it. + + +File: org.info, Node: Texinfo Export, Next: iCalendar Export, Prev: Org Export, Up: Exporting + +13.14 Texinfo Export +==================== + +* Menu: + +* Texinfo export commands:: Invoking commands. +* Texinfo specific export settings:: Setting the environment. +* Texinfo file header:: Generating the header. +* Texinfo title and copyright page:: Creating preamble pages. +* Info directory file:: Installing a manual in Info file hierarchy. +* Headings and sectioning structure:: Building document structure. +* Indices:: Creating indices. +* Quoting Texinfo code:: Incorporating literal Texinfo code. +* Plain lists in Texinfo export:: List attributes. +* Tables in Texinfo export:: Table attributes. +* Images in Texinfo export:: Image attributes. +* Quotations in Texinfo export:: Quote block attributes. +* Special blocks in Texinfo export:: Special block attributes. +* A Texinfo example:: Processing Org to Texinfo. + + +File: org.info, Node: Texinfo export commands, Next: Texinfo specific export settings, Up: Texinfo Export + +13.14.1 Texinfo export commands +------------------------------- + +‘C-c C-e i t’ (‘org-texinfo-export-to-texinfo’) + Export as a Texinfo file with ‘.texi’ extension. For ‘myfile.org’, + Org exports to ‘myfile.texi’, overwriting without warning. + +‘C-c C-e i i’ (‘org-texinfo-export-to-info’) + Export to Texinfo format first and then process it to make an Info + file. To generate other formats, such as DocBook, customize the + ‘org-texinfo-info-process’ variable. + + +File: org.info, Node: Texinfo specific export settings, Next: Texinfo file header, Prev: Texinfo export commands, Up: Texinfo Export + +13.14.2 Texinfo specific export settings +---------------------------------------- + +The Texinfo export back-end has several additional keywords for +customizing Texinfo output. Setting these keywords works similar to the +general options (see *note Export Settings::). + +‘SUBTITLE’ + The document subtitle. + +‘SUBAUTHOR’ + Additional authors for the document. + +‘TEXINFO_FILENAME’ + The Texinfo filename. + +‘TEXINFO_CLASS’ + The default document class (‘org-texinfo-default-class’), which + must be a member of ‘org-texinfo-classes’. + +‘TEXINFO_HEADER’ + Arbitrary lines inserted at the end of the header. + +‘TEXINFO_POST_HEADER’ + Arbitrary lines inserted after the end of the header. + +‘TEXINFO_DIR_CATEGORY’ + The directory category of the document. + +‘TEXINFO_DIR_TITLE’ + The directory title of the document. + +‘TEXINFO_DIR_DESC’ + The directory description of the document. + +‘TEXINFO_PRINTED_TITLE’ + The printed title of the document. + + +File: org.info, Node: Texinfo file header, Next: Texinfo title and copyright page, Prev: Texinfo specific export settings, Up: Texinfo Export + +13.14.3 Texinfo file header +--------------------------- + +After creating the header for a Texinfo file, the Texinfo back-end +automatically generates a name and destination path for the Info file. +To override this default with a more sensible path and name, specify the +‘TEXINFO_FILENAME’ keyword. + + Along with the output’s file name, the Texinfo header also contains +language details (see *note Export Settings::) and encoding system as +set in the ‘org-texinfo-coding-system’ variable. Insert +‘TEXINFO_HEADER’ keywords for each additional command in the header, for +example: + + #+TEXINFO_HEADER: @synindex + + Instead of repeatedly installing the same set of commands, define a +class in ‘org-texinfo-classes’ once, and then activate it in the +document by setting the ‘TEXINFO_CLASS’ keyword to that class. + + +File: org.info, Node: Texinfo title and copyright page, Next: Info directory file, Prev: Texinfo file header, Up: Texinfo Export + +13.14.4 Texinfo title and copyright page +---------------------------------------- + +The default template for hard copy output has a title page with ‘TITLE’ +and ‘AUTHOR’ keywords (see *note Export Settings::). To replace the +regular title with something different for the printed version, use the +‘TEXINFO_PRINTED_TITLE’ and ‘SUBTITLE’ keywords. Both expect raw +Texinfo code for setting their values. + + If one ‘AUTHOR’ line is not sufficient, add multiple ‘SUBAUTHOR’ +keywords. They have to be set in raw Texinfo code. + + #+AUTHOR: Jane Smith + #+SUBAUTHOR: John Doe + #+TEXINFO_PRINTED_TITLE: This Long Title@@inlinefmt{tex,@*} Is Broken in @TeX{} + + Copying material is defined in a dedicated headline with a non-‘nil’ +‘COPYING’ property. The back-end inserts the contents within a +‘@copying’ command at the beginning of the document. The heading itself +does not appear in the structure of the document. + + Copyright information is printed on the back of the title page. + + * Legalese + :PROPERTIES: + :COPYING: t + :END: + + This is a short example of a complete Texinfo file, version 1.0. + + Copyright \copy 2016 Free Software Foundation, Inc. + + +File: org.info, Node: Info directory file, Next: Headings and sectioning structure, Prev: Texinfo title and copyright page, Up: Texinfo Export + +13.14.5 Info directory file +--------------------------- + +The end result of the Texinfo export process is the creation of an Info +file. This Info file’s metadata has variables for category, title, and +description: ‘TEXINFO_DIR_CATEGORY’, ‘TEXINFO_DIR_TITLE’, and +‘TEXINFO_DIR_DESC’ keywords that establish where in the Info hierarchy +the file fits. + + Here is an example that writes to the Info directory file: + + #+TEXINFO_DIR_CATEGORY: Emacs + #+TEXINFO_DIR_TITLE: Org Mode: (org) + #+TEXINFO_DIR_DESC: Outline-based notes management and organizer + + +File: org.info, Node: Headings and sectioning structure, Next: Indices, Prev: Info directory file, Up: Texinfo Export + +13.14.6 Headings and sectioning structure +----------------------------------------- + +The Texinfo export back-end uses a pre-defined scheme to convert Org +headlines to equivalent Texinfo structuring commands. A scheme like +this maps top-level headlines to numbered chapters tagged as ‘@chapter’ +and lower-level headlines to unnumbered chapters tagged as +‘@unnumbered’. To override such mappings to introduce ‘@part’ or other +Texinfo structuring commands, define a new class in +‘org-texinfo-classes’. Activate the new class with the ‘TEXINFO_CLASS’ +keyword. When no new class is defined and activated, the Texinfo export +back-end defaults to the ‘org-texinfo-default-class’. + + If an Org headline’s level has no associated Texinfo structuring +command, or is below a certain threshold (see *note Export Settings::), +then the Texinfo export back-end makes it into a list item. + + The Texinfo export back-end makes any headline with a non-‘nil’ +‘APPENDIX’ property into an appendix. This happens independent of the +Org headline level or the ‘TEXINFO_CLASS’ keyword. + + The Texinfo export back-end creates a menu entry after the Org +headline for each regular sectioning structure. To override this with a +shorter menu entry, use the ‘ALT_TITLE’ property (see *note Table of +Contents::). Texinfo menu entries also have an option for a longer +‘DESCRIPTION’ property. Here’s an example that uses both to override +the default menu entry: + + * Controlling Screen Display + :PROPERTIES: + :ALT_TITLE: Display + :DESCRIPTION: Controlling Screen Display + :END: + + The text before the first headline belongs to the _Top_ node, i.e., +the node in which a reader enters an Info manual. As such, it is +expected not to appear in printed output generated from the ‘.texi’ +file. See *note (texinfo)The Top Node::, for more information. + + +File: org.info, Node: Indices, Next: Quoting Texinfo code, Prev: Headings and sectioning structure, Up: Texinfo Export + +13.14.7 Indices +--------------- + +The Texinfo export back-end recognizes these indexing keywords if used +in the Org file: ‘CINDEX’, ‘FINDEX’, ‘KINDEX’, ‘PINDEX’, ‘TINDEX’ and +‘VINDEX’. Write their value as verbatim Texinfo code; in particular, +‘{’, ‘}’ and ‘@’ characters need to be escaped with ‘@’ if they do not +belong to a Texinfo command. + + #+CINDEX: Defining indexing entries + + For the back-end to generate an index entry for a headline, set the +‘INDEX’ property to ‘cp’ or ‘vr’. These abbreviations come from Texinfo +that stand for concept index and variable index. The Texinfo manual has +abbreviations for all other kinds of indexes. The back-end exports the +headline as an unnumbered chapter or section command, and then inserts +the index after its contents. + + * Concept Index + :PROPERTIES: + :INDEX: cp + :END: + + +File: org.info, Node: Quoting Texinfo code, Next: Plain lists in Texinfo export, Prev: Indices, Up: Texinfo Export + +13.14.8 Quoting Texinfo code +---------------------------- + +Use any of the following three methods to insert or escape raw Texinfo +code: + + Richard @@texinfo:@sc{@@Stallman@@texinfo:}@@ commence' GNU. + + #+TEXINFO: @need800 + This paragraph is preceded by... + + #+BEGIN_EXPORT texinfo + @auindex Johnson, Mark + @auindex Lakoff, George + #+END_EXPORT + + +File: org.info, Node: Plain lists in Texinfo export, Next: Tables in Texinfo export, Prev: Quoting Texinfo code, Up: Texinfo Export + +13.14.9 Plain lists in Texinfo export +------------------------------------- + +The Texinfo export back-end by default converts description lists in the +Org file using the default command ‘@table’, which results in a table +with two columns. To change this behavior, set ‘:table-type’ attribute +to either ‘ftable’ or ‘vtable’ value. For more information, see *note +(texinfo)Two-column Tables::. + + The Texinfo export back-end by default also applies a text highlight +based on the defaults stored in ‘org-texinfo-table-default-markup’. To +override the default highlight command, specify another one with the +‘:indic’ attribute. + + Org syntax is limited to one entry per list item. Nevertheless, the +Texinfo export back-end can split that entry according to any text +provided through the ‘:sep’ attribute. Each part then becomes a new +entry in the first column of the table. + + The following example illustrates all the attributes above: + + #+ATTR_TEXINFO: :table-type vtable :sep , :indic asis + - foo, bar :: This is the common text for variables foo and bar. + +becomes + + @vtable @asis + @item foo + @itemx bar + This is the common text for variables foo and bar. + @end table + + Ordered lists are numbered when exported to Texinfo format. Such +numbering obeys any counter (see *note Plain Lists::) in the first item +of the list. The ‘:enum’ attribute also let you start the list at a +specific number, or switch to a lettered list, as illustrated here + + #+ATTR_TEXINFO: :enum A + 1. Alpha + 2. Bravo + 3. Charlie + + +File: org.info, Node: Tables in Texinfo export, Next: Images in Texinfo export, Prev: Plain lists in Texinfo export, Up: Texinfo Export + +13.14.10 Tables in Texinfo export +--------------------------------- + +When exporting tables, the Texinfo export back-end uses the widest cell +width in each column. To override this and instead specify as fractions +of line length, use the ‘:columns’ attribute. See example below. + + #+ATTR_TEXINFO: :columns .5 .5 + | a cell | another cell | + + +File: org.info, Node: Images in Texinfo export, Next: Quotations in Texinfo export, Prev: Tables in Texinfo export, Up: Texinfo Export + +13.14.11 Images in Texinfo export +--------------------------------- + +Insert a file link to the image in the Org file, and the Texinfo export +back-end inserts the image. These links must have the usual supported +image extensions and no descriptions. To scale the image, use ‘:width’ +and ‘:height’ attributes. For alternate text, use ‘:alt’ and specify +the text using Texinfo code, as shown in the example: + + #+ATTR_TEXINFO: :width 1in :alt Alternate @i{text} + [[ridt.pdf]] + + +File: org.info, Node: Quotations in Texinfo export, Next: Special blocks in Texinfo export, Prev: Images in Texinfo export, Up: Texinfo Export + +13.14.12 Quotations in Texinfo export +------------------------------------- + +You can write the text of a quotation within a quote block (see *note +Paragraphs::). You may also emphasize some text at the beginning of the +quotation with the ‘:tag’ attribute. + + #+ATTR_TEXINFO: :tag Warning + #+BEGIN_QUOTE + Striking your thumb with a hammer may cause severe pain and discomfort. + #+END_QUOTE + + To specify the author of the quotation, use the ‘:author’ attribute. + + #+ATTR_TEXINFO: :author King Arthur + #+BEGIN_QUOTE + The Lady of the Lake, her arm clad in the purest shimmering samite, + held aloft Excalibur from the bosom of the water, signifying by divine + providence that I, Arthur, was to carry Excalibur. That is why I am + your king. + #+END_QUOTE + + +File: org.info, Node: Special blocks in Texinfo export, Next: A Texinfo example, Prev: Quotations in Texinfo export, Up: Texinfo Export + +13.14.13 Special blocks in Texinfo export +----------------------------------------- + +The Texinfo export back-end converts special blocks to commands with the +same name. It also adds any ‘:options’ attributes to the end of the +command, as shown in this example: + + #+ATTR_TEXINFO: :options org-org-export-to-org ... + #+BEGIN_defun + A somewhat obsessive function name. + #+END_defun + +becomes + + @defun org-org-export-to-org ... + A somewhat obsessive function name. + @end defun + + +File: org.info, Node: A Texinfo example, Prev: Special blocks in Texinfo export, Up: Texinfo Export + +13.14.14 A Texinfo example +-------------------------- + +Here is a more detailed example Org file. See *note (texinfo)GNU Sample +Texts:: for an equivalent example using Texinfo code. + + #+TITLE: GNU Sample {{{version}}} + #+SUBTITLE: for version {{{version}}}, {{{updated}}} + #+AUTHOR: A.U. Thor + #+EMAIL: bug-sample@gnu.org + + #+OPTIONS: ':t toc:t author:t email:t + #+LANGUAGE: en + + #+MACRO: version 2.0 + #+MACRO: updated last updated 4 March 2014 + + #+TEXINFO_FILENAME: sample.info + #+TEXINFO_HEADER: @syncodeindex pg cp + + #+TEXINFO_DIR_CATEGORY: Texinfo documentation system + #+TEXINFO_DIR_TITLE: sample: (sample) + #+TEXINFO_DIR_DESC: Invoking sample + + #+TEXINFO_PRINTED_TITLE: GNU Sample + + This manual is for GNU Sample (version {{{version}}}, + {{{updated}}}). + + * Copying + :PROPERTIES: + :COPYING: t + :END: + + This manual is for GNU Sample (version {{{version}}}, + {{{updated}}}), which is an example in the Texinfo documentation. + + Copyright \copy 2016 Free Software Foundation, Inc. + + #+BEGIN_QUOTE + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with no Front-Cover Texts, + and with no Back-Cover Texts. A copy of the license is included in + the section entitled "GNU Free Documentation License". + #+END_QUOTE + + * Invoking sample + + #+PINDEX: sample + #+CINDEX: invoking @command{sample} + + This is a sample manual. There is no sample program to invoke, but + if there were, you could see its basic usage and command line + options here. + + * GNU Free Documentation License + :PROPERTIES: + :APPENDIX: t + :END: + + #+INCLUDE: fdl.org + + * Index + :PROPERTIES: + :INDEX: cp + :END: + + +File: org.info, Node: iCalendar Export, Next: Other Built-in Back-ends, Prev: Texinfo Export, Up: Exporting + +13.15 iCalendar Export +====================== + +A large part of Org mode’s interoperability success is its ability to +easily export to or import from external applications. The iCalendar +export back-end takes calendar data from Org files and exports to the +standard iCalendar format. + + The iCalendar export back-end can also incorporate TODO entries based +on the configuration of the ‘org-icalendar-include-todo’ variable. The +back-end exports plain timestamps as ‘VEVENT’, TODO items as ‘VTODO’, +and also create events from deadlines that are in non-TODO items. The +back-end uses the deadlines and scheduling dates in Org TODO items for +setting the start and due dates for the iCalendar TODO entry. Consult +the ‘org-icalendar-use-deadline’ and ‘org-icalendar-use-scheduled’ +variables for more details. + + For tags on the headline, the iCalendar export back-end makes them +into iCalendar categories. To tweak the inheritance of tags and TODO +states, configure the variable ‘org-icalendar-categories’. To assign +clock alarms based on time, configure the ‘org-icalendar-alarm-time’ +variable. + + The iCalendar format standard requires globally unique identifier—or +UID—for each entry. The iCalendar export back-end creates UIDs during +export. To save a copy of the UID in the Org file set the variable +‘org-icalendar-store-UID’. The back-end looks for the ‘ID’ property of +the entry for re-using the same UID for subsequent exports. + + Since a single Org entry can result in multiple iCalendar +entries—timestamp, deadline, scheduled item, or TODO item—Org adds +prefixes to the UID, depending on which part of the Org entry triggered +the creation of the iCalendar entry. Prefixing ensures UIDs remains +unique, yet enable synchronization programs trace the connections. + +‘C-c C-e c f’ (‘org-icalendar-export-to-ics’) + Create iCalendar entries from the current Org buffer and store them + in the same directory, using a file extension ‘.ics’. + +‘C-c C-e c a’ (‘org-icalendar-export-agenda-files’) + Create iCalendar entries from Org files in ‘org-agenda-files’ and + store in a separate iCalendar file for each Org file. + +‘C-c C-e c c’ (‘org-icalendar-combine-agenda-files’) + Create a combined iCalendar file from Org files in + ‘org-agenda-files’ and write it to + ‘org-icalendar-combined-agenda-file’ file name. + + The iCalendar export back-end includes ‘SUMMARY’, ‘DESCRIPTION’, +‘LOCATION’, ‘TIMEZONE’ and ‘CLASS’ properties from the Org entries when +exporting. To force the back-end to inherit the ‘LOCATION’, ‘TIMEZONE’ +and ‘CLASS’ properties, configure the ‘org-use-property-inheritance’ +variable. + + When Org entries do not have ‘SUMMARY’, ‘DESCRIPTION’, ‘LOCATION’ and +‘CLASS’ properties, the iCalendar export back-end derives the summary +from the headline, and derives the description from the body of the Org +item. The ‘org-icalendar-include-body’ variable limits the maximum +number of characters of the content are turned into its description. + + The ‘TIMEZONE’ property can be used to specify a per-entry time zone, +and is applied to any entry with timestamp information. Time zones +should be specified as per the IANA time zone database format, e.g., +‘Asia/Almaty’. Alternately, the property value can be ‘UTC’, to force +UTC time for this entry only. + + The ‘CLASS’ property can be used to specify a per-entry visibility +class or access restrictions, and is applied to any entry with class +information. The iCalendar standard defines three visibility classes: +‘PUBLIC’ + The entry is publicly visible (this is the default). +‘CONFIDENTIAL’ + Only a limited group of clients get access to the event. +‘PRIVATE’ + The entry can be retrieved only by its owner. + The server should treat unknown class properties the same as +‘PRIVATE’. + + Exporting to iCalendar format depends in large part on the +capabilities of the destination application. Some are more lenient than +others. Consult the Org mode FAQ for advice on specific applications. + + +File: org.info, Node: Other Built-in Back-ends, Next: Advanced Export Configuration, Prev: iCalendar Export, Up: Exporting + +13.16 Other Built-in Back-ends +============================== + +Other export back-ends included with Org are: + + • ‘ox-man.el’: Export to a man page. + + To activate such back-ends, either customize ‘org-export-backends’ or +load directly with ‘(require 'ox-man)’. On successful load, the +back-end adds new keys in the export dispatcher (see *note The Export +Dispatcher::). + + Follow the comment section of such files, for example, ‘ox-man.el’, +for usage and configuration details. + + +File: org.info, Node: Advanced Export Configuration, Next: Export in Foreign Buffers, Prev: Other Built-in Back-ends, Up: Exporting + +13.17 Advanced Export Configuration +=================================== + +Export hooks +------------ + +The export process executes two hooks before the actual exporting +begins. The first hook, ‘org-export-before-processing-hook’, runs +before any expansions of macros, Babel code, and include keywords in the +buffer. The second hook, ‘org-export-before-parsing-hook’, runs before +the buffer is parsed. + + Functions added to these hooks are called with a single argument: the +export back-end actually used, as a symbol. You may use them for heavy +duty structural modifications of the document. For example, you can +remove every headline in the buffer during export like this: + + (defun my-headline-removal (backend) + "Remove all headlines in the current buffer. + BACKEND is the export back-end being used, as a symbol." + (org-map-entries + (lambda () (delete-region (point) (line-beginning-position 2))))) + + (add-hook 'org-export-before-parsing-hook #'my-headline-removal) + +Filters +------- + +Filters are lists of functions to be applied to certain parts for a +given back-end. The output from the first function in the filter is +passed on to the next function in the filter. The final output is the +output from the final function in the filter. + + The Org export process has many filter sets applicable to different +types of objects, plain text, parse trees, export options, and final +output formats. The filters are named after the element type or object +type: ‘org-export-filter-TYPE-functions’, where TYPE is the type +targeted by the filter. Valid types are: + +body bold babel-call +center-block clock code +diary-sexp drawer dynamic-block +entity example-block export-block +export-snippet final-output fixed-width +footnote-definition footnote-reference headline +horizontal-rule inline-babel-call inline-src-block +inlinetask italic item +keyword latex-environment latex-fragment +line-break link node-property +options paragraph parse-tree +plain-list plain-text planning +property-drawer quote-block radio-target +section special-block src-block +statistics-cookie strike-through subscript +superscript table table-cell +table-row target timestamp +underline verbatim verse-block + + Here is an example filter that replaces non-breaking spaces ‘ ’ in +the Org buffer with ‘~’ for the LaTeX back-end. + + (defun my-latex-filter-nobreaks (text backend info) + "Ensure \" \" are properly handled in LaTeX export." + (when (org-export-derived-backend-p backend 'latex) + (replace-regexp-in-string " " "~" text))) + + (add-to-list 'org-export-filter-plain-text-functions + 'my-latex-filter-nobreaks) + + A filter requires three arguments: the code to be transformed, the +name of the back-end, and some optional information about the export +process. The third argument can be safely ignored. Note the use of +‘org-export-derived-backend-p’ predicate that tests for _latex_ back-end +or any other back-end, such as _beamer_, derived from _latex_. + +Defining filters for individual files +------------------------------------- + +The Org export can filter not just for back-ends, but also for specific +files through the ‘BIND’ keyword. Here is an example with two filters; +one removes brackets from time stamps, and the other removes +strike-through text. The filter functions are defined in a code block +in the same Org file, which is a handy location for debugging. + + #+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp) + #+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through) + #+BEGIN_SRC emacs-lisp :exports results :results none + (defun tmp-f-timestamp (s backend info) + (replace-regexp-in-string "&[lg]t;\\|[][]" "" s)) + (defun tmp-f-strike-through (s backend info) "") + #+END_SRC + +Extending an existing back-end +------------------------------ + +Some parts of the conversion process can be extended for certain +elements so as to introduce a new or revised translation. That is how +the HTML export back-end was extended to handle Markdown format. The +extensions work seamlessly so any aspect of filtering not done by the +extended back-end is handled by the original back-end. Of all the +export customization in Org, extending is very powerful as it operates +at the parser level. + + For this example, make the _ascii_ back-end display the language used +in a source code block. Also make it display only when some attribute +is non-‘nil’, like the following: + + #+ATTR_ASCII: :language t + + Then extend ASCII back-end with a custom “my-ascii” back-end. + + (defun my-ascii-src-block (src-block contents info) + "Transcode a SRC-BLOCK element from Org to ASCII. + CONTENTS is nil. INFO is a plist used as a communication + channel." + (if (not (org-export-read-attribute :attr_ascii src-block :language)) + (org-export-with-backend 'ascii src-block contents info) + (concat + (format ",--[ %s ]--\n%s`----" + (org-element-property :language src-block) + (replace-regexp-in-string + "^" "| " + (org-element-normalize-string + (org-export-format-code-default src-block info))))))) + + (org-export-define-derived-backend 'my-ascii 'ascii + :translate-alist '((src-block . my-ascii-src-block))) + + The ‘my-ascii-src-block’ function looks at the attribute above the +current element. If not true, hands over to _ascii_ back-end. If true, +which it is in this example, it creates a box around the code and leaves +room for the inserting a string for language. The last form creates the +new back-end that springs to action only when translating ‘src-block’ +type elements. + + To use the newly defined back-end, evaluate the following from an Org +buffer: + + (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*") + + Further steps to consider would be an interactive function, +self-installing an item in the export dispatcher menu, and other +user-friendly improvements. + + +File: org.info, Node: Export in Foreign Buffers, Prev: Advanced Export Configuration, Up: Exporting + +13.18 Export in Foreign Buffers +=============================== + +The export back-ends in Org often include commands to convert selected +regions. A convenient feature of this in-place conversion is that the +exported output replaces the original source. Here are such functions: + +‘org-ascii-convert-region-to-ascii’ + Convert the selected region into ASCII. + +‘org-ascii-convert-region-to-utf8’ + Convert the selected region into UTF-8. + +‘org-html-convert-region-to-html’ + Convert the selected region into HTML. + +‘org-latex-convert-region-to-latex’ + Convert the selected region into LaTeX. + +‘org-texinfo-convert-region-to-texinfo’ + Convert the selected region into Texinfo. + +‘org-md-convert-region-to-md’ + Convert the selected region into Markdown. + + In-place conversions are particularly handy for quick conversion of +tables and lists in foreign buffers. For example, in an HTML buffer, +write a list in Org syntax, select it, and convert it to HTML with ‘M-x +org-html-convert-region-to-html’. + +* Menu: + +* Bare HTML:: Exporting HTML without CSS, Javascript, etc. + + +File: org.info, Node: Bare HTML, Up: Export in Foreign Buffers + +13.18.1 Exporting to minimal HTML +--------------------------------- + +If you want to output a minimal HTML file, with no CSS, no Javascript, +no preamble or postamble, here are the variable you would need to set: + + (setq org-html-head "" + org-html-head-extra "" + org-html-head-include-default-style nil + org-html-head-include-scripts nil + org-html-preamble nil + org-html-postamble nil + org-html-use-infojs nil) + + +File: org.info, Node: Publishing, Next: Citation handling, Prev: Exporting, Up: Top + +14 Publishing +************* + +Org includes a publishing management system that allows you to configure +automatic HTML conversion of _projects_ composed of interlinked Org +files. You can also configure Org to automatically upload your exported +HTML pages and related attachments, such as images and source code +files, to a web server. + + You can also use Org to convert files into PDF, or even combine HTML +and PDF conversion so that files are available in both formats on the +server. + + Publishing has been contributed to Org by David O’Toole. + +* Menu: + +* Configuration:: Defining projects. +* Uploading Files:: How to get files up on the server. +* Sample Configuration:: Example projects. +* Triggering Publication:: Publication commands. + + +File: org.info, Node: Configuration, Next: Uploading Files, Up: Publishing + +14.1 Configuration +================== + +Publishing needs significant configuration to specify files, destination +and many other properties of a project. + +* Menu: + +* Project alist:: The central configuration variable. +* Sources and destinations:: From here to there. +* Selecting files:: What files are part of the project? +* Publishing action:: Setting the function doing the publishing. +* Publishing options:: Tweaking HTML/LaTeX export. +* Publishing links:: Which links keep working after publishing? +* Site map:: Generating a list of all pages. +* Generating an index:: An index that reaches across pages. + + +File: org.info, Node: Project alist, Next: Sources and destinations, Up: Configuration + +14.1.1 The variable ‘org-publish-project-alist’ +----------------------------------------------- + +Publishing is configured almost entirely through setting the value of +one variable, called ‘org-publish-project-alist’. Each element of the +list configures one project, and may be in one of the two following +forms: + + ("project-name" :property value :property value ...) + +i.e., a well-formed property list with alternating keys and values, or: + + ("project-name" :components ("project-name" "project-name" ...)) + + In both cases, projects are configured by specifying property values. +A project defines the set of files that are to be published, as well as +the publishing configuration to use when publishing those files. When a +project takes the second form listed above, the individual members of +the ‘:components’ property are taken to be sub-projects, which group +together files requiring different publishing options. When you publish +such a “meta-project”, all the components are also published, in the +sequence given. + + +File: org.info, Node: Sources and destinations, Next: Selecting files, Prev: Project alist, Up: Configuration + +14.1.2 Sources and destinations for files +----------------------------------------- + +Most properties are optional, but some should always be set. In +particular, Org needs to know where to look for source files, and where +to put published files. + +‘:base-directory’ + Directory containing publishing source files. + +‘:publishing-directory’ + Directory where output files are published. You can directly + publish to a webserver using a file name syntax appropriate for the + Emacs tramp package. Or you can publish to a local directory and + use external tools to upload your website (see *note Uploading + Files::). + +‘:preparation-function’ + Function or list of functions to be called before starting the + publishing process, for example, to run ‘make’ for updating files + to be published. Each preparation function is called with a single + argument, the project property list. + +‘:completion-function’ + Function or list of functions called after finishing the publishing + process, for example, to change permissions of the resulting files. + Each completion function is called with a single argument, the + project property list. + + +File: org.info, Node: Selecting files, Next: Publishing action, Prev: Sources and destinations, Up: Configuration + +14.1.3 Selecting files +---------------------- + +By default, all files with extension ‘.org’ in the base directory are +considered part of the project. This can be modified by setting the +following properties + +‘:base-extension’ + Extension—without the dot—of source files. This actually is a + regular expression. Set this to the symbol ‘any’ if you want to + get all files in ‘:base-directory’, even without extension. + +‘:exclude’ + Regular expression to match file names that should not be + published, even though they have been selected on the basis of + their extension. + +‘:include’ + List of files to be included regardless of ‘:base-extension’ and + ‘:exclude’. + +‘:recursive’ + Non-‘nil’ means, check base-directory recursively for files to + publish. + + +File: org.info, Node: Publishing action, Next: Publishing options, Prev: Selecting files, Up: Configuration + +14.1.4 Publishing action +------------------------ + +Publishing means that a file is copied to the destination directory and +possibly transformed in the process. The default transformation is to +export Org files as HTML files, and this is done by the function +‘org-html-publish-to-html’ which calls the HTML exporter (see *note HTML +Export::). But you can also publish your content as PDF files using +‘org-latex-publish-to-pdf’, or as ASCII, Texinfo, etc., using the +corresponding functions. + + If you want to publish the Org file as an ‘.org’ file but with +_archived_, _commented_, and _tag-excluded_ trees removed, use +‘org-org-publish-to-org’. This produces ‘file.org’ and puts it in the +publishing directory. If you want a htmlized version of this file, set +the parameter ‘:htmlized-source’ to ‘t’. It produces ‘file.org.html’ in +the publishing directory(1). + + Other files like images only need to be copied to the publishing +destination; for this you can use ‘org-publish-attachment’. For non-Org +files, you always need to specify the publishing function: + +‘:publishing-function’ + Function executing the publication of a file. This may also be a + list of functions, which are all called in turn. + +‘:htmlized-source’ + Non-‘nil’ means, publish htmlized source. + + The function must accept three arguments: a property list containing +at least a ‘:publishing-directory’ property, the name of the file to be +published, and the path to the publishing directory of the output file. +It should take the specified file, make the necessary transformation, if +any, and place the result into the destination folder. + + ---------- Footnotes ---------- + + (1) If the publishing directory is the same as the source directory, +‘file.org’ is exported as ‘file.org.org’, so you probably do not want to +do this. + + +File: org.info, Node: Publishing options, Next: Publishing links, Prev: Publishing action, Up: Configuration + +14.1.5 Options for the exporters +-------------------------------- + +The property list can be used to set many export options for the HTML +and LaTeX exporters. In most cases, these properties correspond to user +variables in Org. The table below lists these properties along with the +variable they belong to. See the documentation string for the +respective variable for details. + + When a property is given a value in ‘org-publish-project-alist’, its +setting overrides the value of the corresponding user variable, if any, +during publishing. Options set within a file (see *note Export +Settings::), however, override everything. + +Generic properties +.................. + +‘:archived-trees’ ‘org-export-with-archived-trees’ +‘:exclude-tags’ ‘org-export-exclude-tags’ +‘:headline-levels’ ‘org-export-headline-levels’ +‘:language’ ‘org-export-default-language’ +‘:preserve-breaks’ ‘org-export-preserve-breaks’ +‘:section-numbers’ ‘org-export-with-section-numbers’ +‘:select-tags’ ‘org-export-select-tags’ +‘:with-author’ ‘org-export-with-author’ +‘:with-broken-links’ ‘org-export-with-broken-links’ +‘:with-clocks’ ‘org-export-with-clocks’ +‘:with-creator’ ‘org-export-with-creator’ +‘:with-date’ ‘org-export-with-date’ +‘:with-drawers’ ‘org-export-with-drawers’ +‘:with-email’ ‘org-export-with-email’ +‘:with-emphasize’ ‘org-export-with-emphasize’ +‘:with-fixed-width’ ‘org-export-with-fixed-width’ +‘:with-footnotes’ ‘org-export-with-footnotes’ +‘:with-latex’ ‘org-export-with-latex’ +‘:with-planning’ ‘org-export-with-planning’ +‘:with-priority’ ‘org-export-with-priority’ +‘:with-properties’ ‘org-export-with-properties’ +‘:with-special-strings’ ‘org-export-with-special-strings’ +‘:with-sub-superscript’ ‘org-export-with-sub-superscripts’ +‘:with-tables’ ‘org-export-with-tables’ +‘:with-tags’ ‘org-export-with-tags’ +‘:with-tasks’ ‘org-export-with-tasks’ +‘:with-timestamps’ ‘org-export-with-timestamps’ +‘:with-title’ ‘org-export-with-title’ +‘:with-toc’ ‘org-export-with-toc’ +‘:with-todo-keywords’ ‘org-export-with-todo-keywords’ + +ASCII specific properties +......................... + +‘:ascii-bullets’ ‘org-ascii-bullets’ +‘:ascii-caption-above’ ‘org-ascii-caption-above’ +‘:ascii-charset’ ‘org-ascii-charset’ +‘:ascii-global-margin’ ‘org-ascii-global-margin’ +‘:ascii-format-drawer-function’ ‘org-ascii-format-drawer-function’ +‘:ascii-format-inlinetask-function’ ‘org-ascii-format-inlinetask-function’ +‘:ascii-headline-spacing’ ‘org-ascii-headline-spacing’ +‘:ascii-indented-line-width’ ‘org-ascii-indented-line-width’ +‘:ascii-inlinetask-width’ ‘org-ascii-inlinetask-width’ +‘:ascii-inner-margin’ ‘org-ascii-inner-margin’ +‘:ascii-links-to-notes’ ‘org-ascii-links-to-notes’ +‘:ascii-list-margin’ ‘org-ascii-list-margin’ +‘:ascii-paragraph-spacing’ ‘org-ascii-paragraph-spacing’ +‘:ascii-quote-margin’ ‘org-ascii-quote-margin’ +‘:ascii-table-keep-all-vertical-lines’ ‘org-ascii-table-keep-all-vertical-lines’ +‘:ascii-table-use-ascii-art’ ‘org-ascii-table-use-ascii-art’ +‘:ascii-table-widen-columns’ ‘org-ascii-table-widen-columns’ +‘:ascii-text-width’ ‘org-ascii-text-width’ +‘:ascii-underline’ ‘org-ascii-underline’ +‘:ascii-verbatim-format’ ‘org-ascii-verbatim-format’ + +Beamer specific properties +.......................... + +‘:beamer-theme’ ‘org-beamer-theme’ +‘:beamer-column-view-format’ ‘org-beamer-column-view-format’ +‘:beamer-environments-extra’ ‘org-beamer-environments-extra’ +‘:beamer-frame-default-options’ ‘org-beamer-frame-default-options’ +‘:beamer-outline-frame-options’ ‘org-beamer-outline-frame-options’ +‘:beamer-outline-frame-title’ ‘org-beamer-outline-frame-title’ +‘:beamer-subtitle-format’ ‘org-beamer-subtitle-format’ + +HTML specific properties +........................ + +‘:html-allow-name-attribute-in-anchors’ ‘org-html-allow-name-attribute-in-anchors’ +‘:html-checkbox-type’ ‘org-html-checkbox-type’ +‘:html-container’ ‘org-html-container-element’ +‘:html-divs’ ‘org-html-divs’ +‘:html-doctype’ ‘org-html-doctype’ +‘:html-extension’ ‘org-html-extension’ +‘:html-footnote-format’ ‘org-html-footnote-format’ +‘:html-footnote-separator’ ‘org-html-footnote-separator’ +‘:html-footnotes-section’ ‘org-html-footnotes-section’ +‘:html-format-drawer-function’ ‘org-html-format-drawer-function’ +‘:html-format-headline-function’ ‘org-html-format-headline-function’ +‘:html-format-inlinetask-function’ ‘org-html-format-inlinetask-function’ +‘:html-head-extra’ ‘org-html-head-extra’ +‘:html-head-include-default-style’ ‘org-html-head-include-default-style’ +‘:html-head-include-scripts’ ‘org-html-head-include-scripts’ +‘:html-head’ ‘org-html-head’ +‘:html-home/up-format’ ‘org-html-home/up-format’ +‘:html-html5-fancy’ ‘org-html-html5-fancy’ +‘:html-indent’ ‘org-html-indent’ +‘:html-infojs-options’ ‘org-html-infojs-options’ +‘:html-infojs-template’ ‘org-html-infojs-template’ +‘:html-inline-image-rules’ ‘org-html-inline-image-rules’ +‘:html-inline-images’ ‘org-html-inline-images’ +‘:html-link-home’ ‘org-html-link-home’ +‘:html-link-org-files-as-html’ ‘org-html-link-org-files-as-html’ +‘:html-link-up’ ‘org-html-link-up’ +‘:html-link-use-abs-url’ ‘org-html-link-use-abs-url’ +‘:html-mathjax-options’ ‘org-html-mathjax-options’ +‘:html-mathjax-template’ ‘org-html-mathjax-template’ +‘:html-equation-reference-format’ ‘org-html-equation-reference-format’ +‘:html-metadata-timestamp-format’ ‘org-html-metadata-timestamp-format’ +‘:html-postamble-format’ ‘org-html-postamble-format’ +‘:html-postamble’ ‘org-html-postamble’ +‘:html-preamble-format’ ‘org-html-preamble-format’ +‘:html-preamble’ ‘org-html-preamble’ +‘:html-self-link-headlines’ ‘org-html-self-link-headlines’ +‘:html-table-align-individual-field’ ‘de{org-html-table-align-individual-fields’ +‘:html-table-attributes’ ‘org-html-table-default-attributes’ +‘:html-table-caption-above’ ‘org-html-table-caption-above’ +‘:html-table-data-tags’ ‘org-html-table-data-tags’ +‘:html-table-header-tags’ ‘org-html-table-header-tags’ +‘:html-table-row-tags’ ‘org-html-table-row-tags’ +‘:html-table-use-header-tags-for-first-column’ ‘org-html-table-use-header-tags-for-first-column’ +‘:html-tag-class-prefix’ ‘org-html-tag-class-prefix’ +‘:html-text-markup-alist’ ‘org-html-text-markup-alist’ +‘:html-todo-kwd-class-prefix’ ‘org-html-todo-kwd-class-prefix’ +‘:html-toplevel-hlevel’ ‘org-html-toplevel-hlevel’ +‘:html-use-infojs’ ‘org-html-use-infojs’ +‘:html-validation-link’ ‘org-html-validation-link’ +‘:html-viewport’ ‘org-html-viewport’ +‘:html-wrap-src-lines’ ‘org-html-wrap-src-lines’ +‘:html-xml-declaration’ ‘org-html-xml-declaration’ + +LaTeX specific properties +......................... + +‘:latex-active-timestamp-format’ ‘org-latex-active-timestamp-format’ +‘:latex-caption-above’ ‘org-latex-caption-above’ +‘:latex-classes’ ‘org-latex-classes’ +‘:latex-class’ ‘org-latex-default-class’ +‘:latex-compiler’ ‘org-latex-compiler’ +‘:latex-default-figure-position’ ‘org-latex-default-figure-position’ +‘:latex-default-table-environment’ ‘org-latex-default-table-environment’ +‘:latex-default-table-mode’ ‘org-latex-default-table-mode’ +‘:latex-diary-timestamp-format’ ‘org-latex-diary-timestamp-format’ +‘:latex-footnote-defined-format’ ‘org-latex-footnote-defined-format’ +‘:latex-footnote-separator’ ‘org-latex-footnote-separator’ +‘:latex-format-drawer-function’ ‘org-latex-format-drawer-function’ +‘:latex-format-headline-function’ ‘org-latex-format-headline-function’ +‘:latex-format-inlinetask-function’ ‘org-latex-format-inlinetask-function’ +‘:latex-hyperref-template’ ‘org-latex-hyperref-template’ +‘:latex-image-default-height’ ‘org-latex-image-default-height’ +‘:latex-image-default-option’ ‘org-latex-image-default-option’ +‘:latex-image-default-width’ ‘org-latex-image-default-width’ +‘:latex-images-centered’ ‘org-latex-images-centered’ +‘:latex-inactive-timestamp-format’ ‘org-latex-inactive-timestamp-format’ +‘:latex-inline-image-rules’ ‘org-latex-inline-image-rules’ +‘:latex-link-with-unknown-path-format’ ‘org-latex-link-with-unknown-path-format’ +‘:latex-listings-langs’ ‘org-latex-listings-langs’ +‘:latex-listings-options’ ‘org-latex-listings-options’ +‘:latex-listings’ ‘org-latex-listings’ +‘:latex-minted-langs’ ‘org-latex-minted-langs’ +‘:latex-minted-options’ ‘org-latex-minted-options’ +‘:latex-prefer-user-labels’ ‘org-latex-prefer-user-labels’ +‘:latex-subtitle-format’ ‘org-latex-subtitle-format’ +‘:latex-subtitle-separate’ ‘org-latex-subtitle-separate’ +‘:latex-table-scientific-notation’ ‘org-latex-table-scientific-notation’ +‘:latex-tables-booktabs’ ‘org-latex-tables-booktabs’ +‘:latex-tables-centered’ ‘org-latex-tables-centered’ +‘:latex-text-markup-alist’ ‘org-latex-text-markup-alist’ +‘:latex-title-command’ ‘org-latex-title-command’ +‘:latex-toc-command’ ‘org-latex-toc-command’ + +Markdown specific properties +............................ + +‘:md-footnote-format’ ‘org-md-footnote-format’ +‘:md-footnotes-section’ ‘org-md-footnotes-section’ +‘:md-headline-style’ ‘org-md-headline-style’ + +ODT specific properties +....................... + +‘:odt-content-template-file’ ‘org-odt-content-template-file’ +‘:odt-display-outline-level’ ‘org-odt-display-outline-level’ +‘:odt-fontify-srcblocks’ ‘org-odt-fontify-srcblocks’ +‘:odt-format-drawer-function’ ‘org-odt-format-drawer-function’ +‘:odt-format-headline-function’ ‘org-odt-format-headline-function’ +‘:odt-format-inlinetask-function’ ‘org-odt-format-inlinetask-function’ +‘:odt-inline-formula-rules’ ‘org-odt-inline-formula-rules’ +‘:odt-inline-image-rules’ ‘org-odt-inline-image-rules’ +‘:odt-pixels-per-inch’ ‘org-odt-pixels-per-inch’ +‘:odt-styles-file’ ‘org-odt-styles-file’ +‘:odt-table-styles’ ‘org-odt-table-styles’ +‘:odt-use-date-fields’ ‘org-odt-use-date-fields’ + +Texinfo specific properties +........................... + +‘:texinfo-active-timestamp-format’ ‘org-texinfo-active-timestamp-format’ +‘:texinfo-classes’ ‘org-texinfo-classes’ +‘:texinfo-class’ ‘org-texinfo-default-class’ +‘:texinfo-table-default-markup’ ‘org-texinfo-table-default-markup’ +‘:texinfo-diary-timestamp-format’ ‘org-texinfo-diary-timestamp-format’ +‘:texinfo-filename’ ‘org-texinfo-filename’ +‘:texinfo-format-drawer-function’ ‘org-texinfo-format-drawer-function’ +‘:texinfo-format-headline-function’ ‘org-texinfo-format-headline-function’ +‘:texinfo-format-inlinetask-function’ ‘org-texinfo-format-inlinetask-function’ +‘:texinfo-inactive-timestamp-format’ ‘org-texinfo-inactive-timestamp-format’ +‘:texinfo-link-with-unknown-path-format’ ‘org-texinfo-link-with-unknown-path-format’ +‘:texinfo-node-description-column’ ‘org-texinfo-node-description-column’ +‘:texinfo-table-scientific-notation’ ‘org-texinfo-table-scientific-notation’ +‘:texinfo-tables-verbatim’ ‘org-texinfo-tables-verbatim’ +‘:texinfo-text-markup-alist’ ‘org-texinfo-text-markup-alist’ + + +File: org.info, Node: Publishing links, Next: Site map, Prev: Publishing options, Up: Configuration + +14.1.6 Publishing links +----------------------- + +To create a link from one Org file to another, you would use something +like ‘[[file:foo.org][The foo]]’ or simply ‘[[file:foo.org]]’ (see *note +External Links::). When published, this link becomes a link to +‘foo.html’. You can thus interlink the pages of your “Org web” project +and the links will work as expected when you publish them to HTML. If +you also publish the Org source file and want to link to it, use an +‘http’ link instead of a ‘file:’ link, because ‘file’ links are +converted to link to the corresponding ‘.html’ file. + + You may also link to related files, such as images. Provided you are +careful with relative file names, and provided you have also configured +Org to upload the related files, these links will work too. See *note +Complex example::, for an example of this usage. + + Eventually, links between published documents can contain some search +options (see *note Search Options::), which will be resolved to the +appropriate location in the linked file. For example, once published to +HTML, the following links all point to a dedicated anchor in ‘foo.html’. + + [[file:foo.org::*heading]] + [[file:foo.org::#custom-id]] + [[file:foo.org::target]] + + +File: org.info, Node: Site map, Next: Generating an index, Prev: Publishing links, Up: Configuration + +14.1.7 Generating a sitemap +--------------------------- + +The following properties may be used to control publishing of a map of +files for a given project. + +‘:auto-sitemap’ + When non-‘nil’, publish a sitemap during + ‘org-publish-current-project’ or ‘org-publish-all’. + +‘:sitemap-filename’ + Filename for output of sitemap. Defaults to ‘sitemap.org’, which + becomes ‘sitemap.html’. + +‘:sitemap-title’ + Title of sitemap page. Defaults to name of file. + +‘:sitemap-format-entry’ + With this option one can tell how a site-map entry is formatted in + the site-map. It is a function called with three arguments: the + file or directory name relative to base directory of the project, + the site-map style and the current project. It is expected to + return a string. Default value turns file names into links and use + document titles as descriptions. For specific formatting needs, + one can use ‘org-publish-find-date’, ‘org-publish-find-title’ and + ‘org-publish-find-property’, to retrieve additional information + about published documents. + +‘:sitemap-function’ + Plug-in function to use for generation of the sitemap. It is + called with two arguments: the title of the site-map and a + representation of the files and directories involved in the project + as a nested list, which can further be transformed using + ‘org-list-to-generic’, ‘org-list-to-subtree’ and alike. Default + value generates a plain list of links to all files in the project. + +‘:sitemap-sort-folders’ + Where folders should appear in the sitemap. Set this to ‘first’ + (default) or ‘last’ to display folders first or last, respectively. + When set to ‘ignore’, folders are ignored altogether. Any other + value mixes files and folders. This variable has no effect when + site-map style is ‘tree’. + +‘:sitemap-sort-files’ + How the files are sorted in the site map. Set this to + ‘alphabetically’ (default), ‘chronologically’ or + ‘anti-chronologically’. ‘chronologically’ sorts the files with + older date first while ‘anti-chronologically’ sorts the files with + newer date first. ‘alphabetically’ sorts the files alphabetically. + The date of a file is retrieved with ‘org-publish-find-date’. + +‘:sitemap-ignore-case’ + Should sorting be case-sensitive? Default ‘nil’. + +‘:sitemap-file-entry-format’ + With this option one can tell how a sitemap’s entry is formatted in + the sitemap. This is a format string with some escape sequences: + ‘%t’ stands for the title of the file, ‘%a’ stands for the author + of the file and ‘%d’ stands for the date of the file. The date is + retrieved with the ‘org-publish-find-date’ function and formatted + with ‘org-publish-sitemap-date-format’. Default ‘%t’. + +‘:sitemap-date-format’ + Format string for the ‘format-time-string’ function that tells how + a sitemap entry’s date is to be formatted. This property bypasses + ‘org-publish-sitemap-date-format’ which defaults to ‘%Y-%m-%d’. + + +File: org.info, Node: Generating an index, Prev: Site map, Up: Configuration + +14.1.8 Generating an index +-------------------------- + +Org mode can generate an index across the files of a publishing project. + +‘:makeindex’ + When non-‘nil’, generate in index in the file ‘theindex.org’ and + publish it as ‘theindex.html’. + + The file is created when first publishing a project with the +‘:makeindex’ set. The file only contains a statement ‘#+INCLUDE: +"theindex.inc"’. You can then build around this include statement by +adding a title, style information, etc. + + Index entries are specified with ‘INDEX’ keyword. An entry that +contains an exclamation mark creates a sub item. + + *** Curriculum Vitae + #+INDEX: CV + #+INDEX: Application!CV + + +File: org.info, Node: Uploading Files, Next: Sample Configuration, Prev: Configuration, Up: Publishing + +14.2 Uploading Files +==================== + +For those people already utilizing third party sync tools such as Rsync +or Unison, it might be preferable not to use the built-in remote +publishing facilities of Org mode which rely heavily on Tramp. Tramp, +while very useful and powerful, tends not to be so efficient for +multiple file transfer and has been known to cause problems under heavy +usage. + + Specialized synchronization utilities offer several advantages. In +addition to timestamp comparison, they also do content and +permissions/attribute checks. For this reason you might prefer to +publish your web to a local directory—possibly even _in place_ with your +Org files—and then use Unison or Rsync to do the synchronization with +the remote host. + + Since Unison, for example, can be configured as to which files to +transfer to a certain remote destination, it can greatly simplify the +project publishing definition. Simply keep all files in the correct +location, process your Org files with ‘org-publish’ and let the +synchronization tool do the rest. You do not need, in this scenario, to +include attachments such as JPG, CSS or PNG files in the project +definition since the third-party tool syncs them. + + Publishing to a local directory is also much faster than to a remote +one, so that you can afford more easily to republish entire projects. +If you set ‘org-publish-use-timestamps-flag’ to ‘nil’, you gain the main +benefit of re-including any changed external files such as source +example files you might include with ‘INCLUDE’ keyword. The timestamp +mechanism in Org is not smart enough to detect if included files have +been modified. + + +File: org.info, Node: Sample Configuration, Next: Triggering Publication, Prev: Uploading Files, Up: Publishing + +14.3 Sample Configuration +========================= + +Below we provide two example configurations. The first one is a simple +project publishing only a set of Org files. The second example is more +complex, with a multi-component project. + +* Menu: + +* Simple example:: One-component publishing. +* Complex example:: A multi-component publishing example. + + +File: org.info, Node: Simple example, Next: Complex example, Up: Sample Configuration + +14.3.1 Example: simple publishing configuration +----------------------------------------------- + +This example publishes a set of Org files to the ‘public_html’ directory +on the local machine. + + (setq org-publish-project-alist + '(("org" + :base-directory "~/org/" + :publishing-function org-html-publish-to-html + :publishing-directory "~/public_html" + :section-numbers nil + :with-toc nil + :html-head "<link rel=\"stylesheet\" + href=\"../other/mystyle.css\" + type=\"text/css\"/>"))) + + +File: org.info, Node: Complex example, Prev: Simple example, Up: Sample Configuration + +14.3.2 Example: complex publishing configuration +------------------------------------------------ + +This more complicated example publishes an entire website, including Org +files converted to HTML, image files, Emacs Lisp source code, and style +sheets. The publishing directory is remote and private files are +excluded. + + To ensure that links are preserved, care should be taken to replicate +your directory structure on the web server, and to use relative file +paths. For example, if your Org files are kept in ‘~/org/’ and your +publishable images in ‘~/images/’, you would link to an image with + + file:../images/myimage.png + + On the web server, the relative path to the image should be the same. +You can accomplish this by setting up an ‘images/’ folder in the right +place on the web server, and publishing images to it. + + (setq org-publish-project-alist + '(("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 + :headline-levels 3 + :section-numbers nil + :with-toc nil + :html-head "<link rel=\"stylesheet\" + href=\"../other/mystyle.css\" type=\"text/css\"/>" + :html-preamble t) + + ("images" + :base-directory "~/images/" + :base-extension "jpg\\|gif\\|png" + :publishing-directory "/ssh:user@host:~/html/images/" + :publishing-function org-publish-attachment) + + ("other" + :base-directory "~/other/" + :base-extension "css\\|el" + :publishing-directory "/ssh:user@host:~/html/other/" + :publishing-function org-publish-attachment) + ("website" :components ("orgfiles" "images" "other")))) + + +File: org.info, Node: Triggering Publication, Prev: Sample Configuration, Up: Publishing + +14.4 Triggering Publication +=========================== + +Once properly configured, Org can publish with the following commands: + +‘C-c C-e P x’ (‘org-publish’) + Prompt for a specific project and publish all files that belong to + it. + +‘C-c C-e P p’ (‘org-publish-current-project’) + Publish the project containing the current file. + +‘C-c C-e P f’ (‘org-publish-current-file’) + Publish only the current file. + +‘C-c C-e P a’ (‘org-publish-all’) + Publish every project. + + Org uses timestamps to track when a file has changed. The above +functions normally only publish changed files. You can override this +and force publishing of all files by giving a prefix argument to any of +the commands above, or by customizing the variable +‘org-publish-use-timestamps-flag’. This may be necessary in particular +if files include other files via ‘SETUPFILE’ or ‘INCLUDE’ keywords. + + +File: org.info, Node: Citation handling, Next: Working with Source Code, Prev: Publishing, Up: Top + +15 Citation handling +******************** + +The ‘oc.el’ library provides tooling to handle citations in Org via +“citation processors” that offer some or all of the following +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. + + The user can configure these with ‘org-cite-activate-processor’, +‘org-cite-follow-processor’, ‘org-cite-insert-processor’, and +‘org-cite-export-processors’ respectively. + + The included “basic” processor provides all four capabilities. + +* Menu: + +* Citations:: +* Citation export processors:: + + +File: org.info, Node: Citations, Next: Citation export processors, Up: Citation handling + +15.1 Citations +============== + +Before adding citations, first set one-or-more bibliographies, either +globally with ‘org-cite-global-bibliography’, or locally using one or +more “bibliography” keywords. + + #+bibliography: SomeFile.bib + #+bibliography: /some/other/file.json + #+bibliography: "/some/file/with spaces/in its name.bib" + + One can then insert and edit citations using ‘org-cite-insert’, +called with ‘C-c C-x @’. + + A _citation_ requires one or more citation _key(s)_, elements +identifying a reference in the bibliography. + + • Each citation is surrounded by brackets and uses the ‘cite’ type. + + • Each key starts with the character ‘@’. + + • Each key can be qualified by a _prefix_ (e.g. “see ”) and/or a + _suffix_ (e.g. “p. 123”), giving information useful or necessary fo + the comprehension of the citation but not included in the + reference. + + • A single citation can cite more than one reference ; the keys are + separated by semicolons ; the formatting of such citation groups is + specified by the style. + + • One can also specify a stylistic variation for the citations by + inserting a ‘/’ and a style name between the ‘cite’ keyword and the + colon; this usually makes sense only for the author-year styles. + + [cite/style:common prefix ;prefix @key suffix; ... ; common suffix] + + The only mandatory elements are: + + • The ‘cite’ keyword and the colon. + • The ‘@’ character immediately preceding each key. + • The brackets surrounding the citation(s) (group). + + +File: org.info, Node: Citation export processors, Prev: Citations, Up: Citation handling + +15.2 Citation export processors +=============================== + +Org currently includes the following export processors: + + • Two processors can export to a variety of formats, including + ‘latex’ (and therefore ‘pdf’), ‘html’, ‘odt’ and plain (UTF8) text: + + basic + a basic export processor, well adapted to situations where + backward compatibility is not a requirement and formatting + needs are minimal; + + csl + this export processor uses format files written in Citation + Style Language + (https://en.wikipedia.org/wiki/Citation_Style_Language) via + citeproc-el (https://github.com/andras-simonyi/citeproc-el); + + • In contrast, two other processors target LaTeX and LaTeX-derived + formats exclusively: + + natbib + this export processor uses BibTeX, the historical + bibliographic processor used with LaTeX, thus allowing the use + of data and style files compatible with this processor + (including a large number of publishers’ styles). It uses + citation commands implemented in the LaTeX package ‘natbib’, + allowing more stylistic variants that LaTeX’s ‘\cite’ command. + + biblatex + this backend allows the use of data and formats prepared for + BibLaTeX, an alternate bibliographic processor used with + LaTeX, which overcomes some serious BibTeX limitations, but + has not (yet?) been widely adopted by publishers. + + The ‘CITE_EXPORT’ keyword specifies the export processor and the +citation (and possibly reference) style(s); for example (all arguments +are optional) + + #+cite_export: basic author author-year + +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 + +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; + + #+cite_export: natbib kluwer + +specifies the ‘natbib’ export processor with a label citation style +conformant to the Harvard style and the specification of the +Wolkers-Kluwer publisher; since it relies on the ‘bibtex’ processor of +your LaTeX installation, it won’t export to anything but PDF. + + +File: org.info, Node: Working with Source Code, Next: Miscellaneous, Prev: Citation handling, Up: Top + +16 Working with Source Code +*************************** + +Source code here refers to any plain text collection of computer +instructions, possibly with comments, written using a human-readable +programming language. Org can manage source code in an Org document +when the source code is identified with begin and end markers. Working +with source code begins with identifying source code blocks. A source +code block can be placed almost anywhere in an Org document; it is not +restricted to the preamble or the end of the document. However, Org +cannot manage a source code block if it is placed inside an Org comment +or within a fixed width section. + + Here is an example source code block in the Emacs Lisp language: + + #+BEGIN_SRC emacs-lisp + (defun org-xor (a b) + "Exclusive or." + (if a (not b) b)) + #+END_SRC + + Source code blocks are one of many Org block types, which also +include “center”, “comment”, “dynamic”, “example”, “export”, “quote”, +“special”, and “verse”. This section pertains to blocks between +‘#+BEGIN_SRC’ and ‘#+END_SRC’. + + Details of Org’s facilities for working with source code are +described in the following sections. + +* Menu: + +* Features Overview:: Enjoy the versatility of source blocks. +* Structure of Code Blocks:: Code block syntax described. +* Using Header Arguments:: Different ways to set header arguments. +* Environment of a Code Block:: Arguments, sessions, working directory... +* Evaluating Code Blocks:: Place results of evaluation in the Org buffer. +* Results of Evaluation:: Choosing a results type, post-processing... +* Exporting Code Blocks:: Export contents and/or results. +* Extracting Source Code:: Create pure source code files. +* Languages:: List of supported code block languages. +* Editing Source Code:: Language major-mode editing. +* Noweb Reference Syntax:: Literate programming in Org mode. +* Library of Babel:: Use and contribute to a library of useful code blocks. +* Key bindings and Useful Functions:: Work quickly with code blocks. +* Batch Execution:: Call functions from the command line. + + +File: org.info, Node: Features Overview, Next: Structure of Code Blocks, Up: Working with Source Code + +16.1 Features Overview +====================== + +Org can manage the source code in the block delimited by ‘#+BEGIN_SRC’ +... ‘#+END_SRC’ in several ways that can simplify housekeeping tasks +essential to modern source code maintenance. Org can edit, format, +extract, export, and publish source code blocks. Org can also compile +and execute a source code block, then capture the results. The Org mode +literature sometimes refers to source code blocks as _live code_ blocks +because they can alter the content of the Org document or the material +that it exports. Users can control the “liveliness” of each source code +block by tweaking the header arguments (see *note Using Header +Arguments::) for compiling, execution, extraction, and exporting. + + For editing and formatting a source code block, Org uses an +appropriate Emacs major mode that includes features specifically +designed for source code in that language. + + Org can extract one or more source code blocks and write them to one +or more source files—a process known as _tangling_ in literate +programming terminology. + + For exporting and publishing, Org’s back-ends can format a source +code block appropriately, often with native syntax highlighting. + + For executing and compiling a source code block, the user can +configure Org to select the appropriate compiler. Org provides +facilities to collect the result of the execution or compiler output, +insert it into the Org document, and/or export it. In addition to text +results, Org can insert links to other data types, including audio, +video, and graphics. Org can also link a compiler error message to the +appropriate line in the source code block. + + An important feature of Org’s management of source code blocks is the +ability to pass variables, functions, and results to one another using a +common syntax for source code blocks in any language. Although most +literate programming facilities are restricted to one language or +another, Org’s language-agnostic approach lets the literate programmer +match each programming task with the appropriate computer language and +to mix them all together in a single Org document. This +interoperability among languages explains why Org’s source code +management facility was named _Org Babel_ by its originators, Eric +Schulte and Dan Davison. + + Org mode fulfills the promise of easy verification and maintenance of +publishing reproducible research by keeping text, data, code, +configuration settings of the execution environment, the results of the +execution, and associated narratives, claims, references, and internal +and external links in a single Org document. + + +File: org.info, Node: Structure of Code Blocks, Next: Using Header Arguments, Prev: Features Overview, Up: Working with Source Code + +16.2 Structure of Code Blocks +============================= + +Org offers two ways to structure source code in Org documents: in a +source code block, and directly inline. Both specifications are shown +below. + + A source code block conforms to this structure: + + #+NAME: <name> + #+BEGIN_SRC <language> <switches> <header arguments> + <body> + #+END_SRC + + Do not be put-off by having to remember the source block syntax. Org +mode offers a command for wrapping existing text in a block (see *note +Structure Templates::). Org also works with other completion systems in +Emacs, some of which predate Org and have custom domain-specific +languages for defining templates. Regular use of templates reduces +errors, increases accuracy, and maintains consistency. + + An inline code block conforms to this structure: + + src_<language>{<body>} + +or + + src_<language>[<header arguments>]{<body>} + +‘#+NAME: <name>’ + Optional. Names the source block so it can be called, like a + function, from other source blocks or inline code to evaluate or to + capture the results. Code from other blocks, other files, and from + table formulas (see *note The Spreadsheet::) can use the name to + reference a source block. This naming serves the same purpose as + naming Org tables. Org mode requires unique names. For duplicate + names, Org mode’s behavior is undefined. + +‘#+BEGIN_SRC’ ... ‘#+END_SRC’ + Mandatory. They mark the start and end of a block that Org + requires. The ‘#+BEGIN_SRC’ line takes additional arguments, as + described next. + +‘<language>’ + Mandatory. It is the identifier of the source code language in the + block. See *note Languages::, for identifiers of supported + languages. + +‘<switches>’ + Optional. Switches provide finer control of the code execution, + export, and format (see the discussion of switches in *note Literal + Examples::). + +‘<header arguments>’ + Optional. Heading arguments control many aspects of evaluation, + export and tangling of code blocks (see *note Using Header + Arguments::). Using Org’s properties feature, header arguments can + be selectively applied to the entire buffer or specific sub-trees + of the Org document. + +‘<body>’ + Source code in the dialect of the specified language identifier. + + +File: org.info, Node: Using Header Arguments, Next: Environment of a Code Block, Prev: Structure of Code Blocks, Up: Working with Source Code + +16.3 Using Header Arguments +=========================== + +Org comes with many header arguments common to all languages. New +header arguments are added for specific languages as they become +available for use in source code blocks. A header argument is specified +with an initial colon followed by the argument’s name in lowercase. + + Since header arguments can be set in several ways, Org prioritizes +them in case of overlaps or conflicts by giving local settings a higher +priority. Header values in function calls, for example, override header +values from global defaults. + +System-wide header arguments +---------------------------- + +System-wide values of header arguments can be specified by customizing +the ‘org-babel-default-header-args’ variable, which defaults to the +following values: + + :session => "none" + :results => "replace" + :exports => "code" + :cache => "no" + :noweb => "no" + + The example below sets ‘:noweb’ header arguments to ‘yes’, which +makes Org expand ‘:noweb’ references by default. + + (setq org-babel-default-header-args + (cons '(:noweb . "yes") + (assq-delete-all :noweb org-babel-default-header-args))) + + Each language can have separate default header arguments by +customizing the variable ‘org-babel-default-header-args:<LANG>’, where +<LANG> is the name of the language. For details, see the +language-specific online documentation at +<https://orgmode.org/worg/org-contrib/babel/>. + +Header arguments in Org mode properties +--------------------------------------- + +For header arguments applicable to the buffer, use ‘PROPERTY’ keyword +anywhere in the Org file (see *note Property Syntax::). + + The following example makes all the R code blocks execute in the same +session. Setting ‘:results’ to ‘silent’ ignores the results of +executions for all blocks, not just R code blocks; no results inserted +for any block. + + #+PROPERTY: header-args:R :session *R* + #+PROPERTY: header-args :results silent + + Header arguments set through Org’s property drawers (see *note +Property Syntax::) apply at the sub-tree level on down. Since these +property drawers can appear anywhere in the file hierarchy, Org uses +outermost call or source block to resolve the values. Org ignores +‘org-use-property-inheritance’ setting. + + In this example, ‘:cache’ defaults to ‘yes’ for all code blocks in +the sub-tree. + + * sample header + :PROPERTIES: + :header-args: :cache yes + :END: + + Properties defined through ‘org-set-property’ function, bound to ‘C-c +C-x p’, apply to all active languages. They override properties set in +‘org-babel-default-header-args’. + + Language-specific header arguments are also read from properties +‘header-args:<LANG>’ where <LANG> is the language identifier. For +example, + + * Heading + :PROPERTIES: + :header-args:clojure: :session *clojure-1* + :header-args:R: :session *R* + :END: + ** Subheading + :PROPERTIES: + :header-args:clojure: :session *clojure-2* + :END: + +would force separate sessions for Clojure blocks in ‘Heading’ and +‘Subheading’, but use the same session for all R blocks. Blocks in +‘Subheading’ inherit settings from ‘Heading’. + +Code block specific header arguments +------------------------------------ + +Header arguments are most commonly set at the source code block level, +on the ‘#+BEGIN_SRC’ line. Arguments set at this level take precedence +over those set in the ‘org-babel-default-header-args’ variable, and also +those set as header properties. + + In the following example, setting ‘:results’ to ‘silent’ makes it +ignore results of the code execution. Setting ‘:exports’ to ‘code’ +exports only the body of the code block to HTML or LaTeX. + + #+NAME: factorial + #+BEGIN_SRC haskell :results silent :exports code :var n=0 + fac 0 = 1 + fac n = n * fac (n-1) + #+END_SRC + + The same header arguments in an inline code block: + + src_haskell[:exports both]{fac 5} + + Code block header arguments can span multiple lines using ‘#+HEADER:’ +on each line. Note that Org currently accepts the plural spelling of +‘#+HEADER:’ only as a convenience for backward-compatibility. It may be +removed at some point. + + Multi-line header arguments on an unnamed code block: + + #+HEADER: :var data1=1 + #+BEGIN_SRC emacs-lisp :var data2=2 + (message "data1:%S, data2:%S" data1 data2) + #+END_SRC + + #+RESULTS: + : data1:1, data2:2 + + Multi-line header arguments on a named code block: + + #+NAME: named-block + #+HEADER: :var data=2 + #+BEGIN_SRC emacs-lisp + (message "data:%S" data) + #+END_SRC + + #+RESULTS: named-block + : data:2 + +Header arguments in function calls +---------------------------------- + +Header arguments in function calls are the most specific and override +all other settings in case of an overlap. They get the highest +priority. Two ‘#+CALL:’ examples are shown below. For the complete +syntax of ‘CALL’ keyword, see *note Evaluating Code Blocks::. + + In this example, ‘:exports results’ header argument is applied to the +evaluation of the ‘#+CALL:’ line. + + #+CALL: factorial(n=5) :exports results + + In this example, ‘:session special’ header argument is applied to the +evaluation of ‘factorial’ code block. + + #+CALL: factorial[:session special](n=5) + + +File: org.info, Node: Environment of a Code Block, Next: Evaluating Code Blocks, Prev: Using Header Arguments, Up: Working with Source Code + +16.4 Environment of a Code Block +================================ + +Passing arguments +----------------- + +Use ‘var’ for passing arguments to source code blocks. The specifics of +variables in code blocks vary by the source language and are covered in +the language-specific documentation. The syntax for ‘var’, however, is +the same for all languages. This includes declaring a variable, and +assigning a default value. + + The following syntax is used to pass arguments to code blocks using +the ‘var’ header argument. + + :var NAME=ASSIGN + +NAME is the name of the variable bound in the code block body. ASSIGN +is a literal value, such as a string, a number, a reference to a table, +a list, a literal example, another code block—with or without +arguments—or the results of evaluating a code block. ASSIGN may specify +a filename for references to elements in a different file, using a ‘:’ +to separate the filename from the reference. + + :var NAME=FILE:REFERENCE + + Here are examples of passing values by reference: + +table + A table named with a ‘NAME’ keyword. + + #+NAME: example-table + | 1 | + | 2 | + | 3 | + | 4 | + + #+NAME: table-length + #+BEGIN_SRC emacs-lisp :var table=example-table + (length table) + #+END_SRC + + #+RESULTS: table-length + : 4 + + When passing a table, you can treat specially the row, or the + column, containing labels for the columns, or the rows, in the + table. + + The ‘colnames’ header argument accepts ‘yes’, ‘no’, or ‘nil’ + values. The default value is ‘nil’: if an input table has column + names—because the second row is a horizontal rule—then Org removes + the column names, processes the table, puts back the column names, + and then writes the table to the results block. Using ‘yes’, Org + does the same to the first row, even if the initial table does not + contain any horizontal rule. When set to ‘no’, Org does not + pre-process column names at all. + + #+NAME: less-cols + | a | + |---| + | b | + | c | + + #+BEGIN_SRC python :var tab=less-cols :colnames nil + return [[val + '*' for val in row] for row in tab] + #+END_SRC + + #+RESULTS: + | a | + |----| + | b* | + | c* | + + Similarly, the ‘rownames’ header argument can take two values: + ‘yes’ or ‘no’. When set to ‘yes’, Org removes the first column, + processes the table, puts back the first column, and then writes + the table to the results block. The default is ‘no’, which means + Org does not pre-process the first column. Note that Emacs Lisp + code blocks ignore ‘rownames’ header argument because of the ease + of table-handling in Emacs. + + #+NAME: with-rownames + | one | 1 | 2 | 3 | 4 | 5 | + | two | 6 | 7 | 8 | 9 | 10 | + + #+BEGIN_SRC python :var tab=with-rownames :rownames yes + return [[val + 10 for val in row] for row in tab] + #+END_SRC + + #+RESULTS: + | one | 11 | 12 | 13 | 14 | 15 | + | two | 16 | 17 | 18 | 19 | 20 | + + To refer to a table in another file, join the filename and table name +with a colon, for example: ‘:var table=other-file.org:example-table’. + +list + A simple named list. + + #+NAME: example-list + - simple + - not + - nested + - list + + #+BEGIN_SRC emacs-lisp :var x=example-list + (print x) + #+END_SRC + + #+RESULTS: + | simple | list | + + Note that only the top level list items are passed along. Nested + list items are ignored. + +code block without arguments + A code block name, as assigned by ‘NAME’ keyword from the example + above, optionally followed by parentheses. + + #+BEGIN_SRC emacs-lisp :var length=table-length() + (* 2 length) + #+END_SRC + + #+RESULTS: + : 8 + +code block with arguments + A code block name, as assigned by ‘NAME’ keyword, followed by + parentheses and optional arguments passed within the parentheses. + + #+NAME: double + #+BEGIN_SRC emacs-lisp :var input=8 + (* 2 input) + #+END_SRC + + #+RESULTS: double + : 16 + + #+NAME: squared + #+BEGIN_SRC emacs-lisp :var input=double(input=1) + (* input input) + #+END_SRC + + #+RESULTS: squared + : 4 + +literal example + A literal example block named with a ‘NAME’ keyword. + + #+NAME: literal-example + #+BEGIN_EXAMPLE + A literal example + on two lines + #+END_EXAMPLE + + #+NAME: read-literal-example + #+BEGIN_SRC emacs-lisp :var x=literal-example + (concatenate #'string x " for you.") + #+END_SRC + + #+RESULTS: read-literal-example + : A literal example + : on two lines for you. + + Indexing variable values enables referencing portions of a variable. +Indexes are 0 based with negative values counting backwards from the +end. If an index is separated by commas then each subsequent section +indexes as the next dimension. Note that this indexing occurs _before_ +other table-related header arguments are applied, such as ‘hlines’, +‘colnames’ and ‘rownames’. The following example assigns the last cell +of the first row the table ‘example-table’ to the variable ‘data’: + + #+NAME: example-table + | 1 | a | + | 2 | b | + | 3 | c | + | 4 | d | + + #+BEGIN_SRC emacs-lisp :var data=example-table[0,-1] + data + #+END_SRC + + #+RESULTS: + : a + + Two integers separated by a colon reference a range of variable +values. In that case the entire inclusive range is referenced. For +example the following assigns the middle three rows of ‘example-table’ +to ‘data’. + + #+NAME: example-table + | 1 | a | + | 2 | b | + | 3 | c | + | 4 | d | + | 5 | 3 | + + #+BEGIN_SRC emacs-lisp :var data=example-table[1:3] + data + #+END_SRC + + #+RESULTS: + | 2 | b | + | 3 | c | + | 4 | d | + + To pick the entire range, use an empty index, or the single character +‘*’. ‘0:-1’ does the same thing. Example below shows how to reference +the first column only. + + #+NAME: example-table + | 1 | a | + | 2 | b | + | 3 | c | + | 4 | d | + + #+BEGIN_SRC emacs-lisp :var data=example-table[,0] + data + #+END_SRC + + #+RESULTS: + | 1 | 2 | 3 | 4 | + + Index referencing can be used for tables and code blocks. Index +referencing can handle any number of dimensions. Commas delimit +multiple dimensions, as shown below. + + #+NAME: 3D + #+BEGIN_SRC emacs-lisp + '(((1 2 3) (4 5 6) (7 8 9)) + ((10 11 12) (13 14 15) (16 17 18)) + ((19 20 21) (22 23 24) (25 26 27))) + #+END_SRC + + #+BEGIN_SRC emacs-lisp :var data=3D[1,,1] + data + #+END_SRC + + #+RESULTS: + | 11 | 14 | 17 | + + Note that row names and column names are not removed prior to +variable indexing. You need to take them into account, even when +‘colnames’ or ‘rownames’ header arguments remove them. + + Emacs lisp code can also set the values for variables. To +differentiate a value from Lisp code, Org interprets any value starting +with ‘(’, ‘[’, ‘'’ or ‘`’ as Emacs Lisp code. The result of evaluating +that code is then assigned to the value of that variable. The following +example shows how to reliably query and pass the file name of the Org +mode buffer to a code block using headers. We need reliability here +because the file’s name could change once the code in the block starts +executing. + + #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both + wc -w $filename + #+END_SRC + + Note that values read from tables and lists are not mistakenly +evaluated as Emacs Lisp code, as illustrated in the following example. + + #+NAME: table + | (a b c) | + + #+HEADER: :var data=table[0,0] + #+BEGIN_SRC perl + $data + #+END_SRC + + #+RESULTS: + : (a b c) + +Using sessions +-------------- + +Two code blocks can share the same environment. The ‘session’ header +argument is for running multiple source code blocks under one session. +Org runs code blocks with the same session name in the same interpreter +process. + +‘none’ + Default. Each code block gets a new interpreter process to + execute. The process terminates once the block is evaluated. + +STRING + Any string besides ‘none’ turns that string into the name of that + session. For example, ‘:session STRING’ names it ‘STRING’. If + ‘session’ has no value, then the session name is derived from the + source language identifier. Subsequent blocks with the same source + code language use the same session. Depending on the language, + state variables, code from other blocks, and the overall + interpreted environment may be shared. Some interpreted languages + support concurrent sessions when subsequent source code language + blocks change session names. + + Only languages that provide interactive evaluation can have session +support. Not all languages provide this support, such as C and ditaa. +Even languages, such as Python and Haskell, that do support interactive +evaluation impose limitations on allowable language constructs that can +run interactively. Org inherits those limitations for those code blocks +running in a session. + +Choosing a working directory +---------------------------- + +The ‘dir’ header argument specifies the default directory during code +block execution. If it is absent, then the directory associated with +the current buffer is used. In other words, supplying ‘:dir DIRECTORY’ +temporarily has the same effect as changing the current directory with +‘M-x cd <RET> DIRECTORY’, and then not setting ‘dir’. Under the +surface, ‘dir’ simply sets the value of the Emacs variable +‘default-directory’. Setting ‘mkdirp’ header argument to a non-‘nil’ +value creates the directory, if necessary. + + For example, to save the plot file in the ‘Work/’ folder of the home +directory—notice tilde is expanded: + + #+BEGIN_SRC R :file myplot.png :dir ~/Work + matplot(matrix(rnorm(100), 10), type="l") + #+END_SRC + + To evaluate the code block on a remote machine, supply a remote +directory name using Tramp syntax. For example: + + #+BEGIN_SRC R :file plot.png :dir /scp:dand@yakuba.princeton.edu: + plot(1:10, main=system("hostname", intern=TRUE)) + #+END_SRC + + Org first captures the text results as usual for insertion in the Org +file. Then Org also inserts a link to the remote file, thanks to Emacs +Tramp. Org constructs the remote path to the file name from ‘dir’ and +‘default-directory’, as illustrated here: + + [[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]] + + When ‘dir’ is used with ‘session’, Org sets the starting directory +for a new session. But Org does not alter the directory of an already +existing session. + + Do not use ‘dir’ with ‘:exports results’ or with ‘:exports both’ to +avoid Org inserting incorrect links to remote files. That is because +Org does not expand ‘default directory’ to avoid some underlying +portability issues. + +Inserting headers and footers +----------------------------- + +The ‘prologue’ header argument is for appending to the top of the code +block for execution, like a reset instruction. For example, you may use +‘:prologue "reset"’ in a Gnuplot code block or, for every such block: + + (add-to-list 'org-babel-default-header-args:gnuplot + '((:prologue . "reset"))) + + + Likewise, the value of the ‘epilogue’ header argument is for +appending to the end of the code block for execution. + + +File: org.info, Node: Evaluating Code Blocks, Next: Results of Evaluation, Prev: Environment of a Code Block, Up: Working with Source Code + +16.5 Evaluating Code Blocks +=========================== + +A note about security: With code evaluation comes the risk of harm. Org +safeguards by prompting for user’s permission before executing any code +in the source block. To customize this safeguard, or disable it, see +*note Code Evaluation Security::. + +How to evaluate source code +--------------------------- + +Org captures the results of the code block evaluation and inserts them +in the Org file, right after the code block. The insertion point is +after a newline and the ‘RESULTS’ keyword. Org creates the ‘RESULTS’ +keyword if one is not already there. + + By default, Org enables only Emacs Lisp code blocks for execution. +See *note Languages:: to enable other languages. + + Org provides many ways to execute code blocks. ‘C-c C-c’ or ‘C-c C-v +e’ with the point on a code block(1) calls the +‘org-babel-execute-src-block’ function, which executes the code in the +block, collects the results, and inserts them in the buffer. + + By calling a named code block(2) 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 *note Library of Babel::). + + The syntax for ‘CALL’ keyword is: + + #+CALL: <name>(<arguments>) + #+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments> + + The syntax for inline named code blocks is: + + ... call_<name>(<arguments>) ... + ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ... + + When inline syntax is used, the result is wrapped based on the +variable ‘org-babel-inline-result-wrap’, which by default is set to +‘"=%s="’ to produce verbatim text suitable for markup. + +‘<name>’ + This is the name of the code block (see *note Structure of Code + Blocks::) to be evaluated in the current document. If the block is + located in another file, start ‘<name>’ with the file name followed + by a colon. For example, in order to execute a block named + ‘clear-data’ in ‘file.org’, you can write the following: + + #+CALL: file.org:clear-data() + +‘<arguments>’ + Org passes arguments to the code block using standard function call + syntax. For example, a ‘#+CALL:’ line that passes ‘4’ to a code + block named ‘double’, which declares the header argument ‘:var + n=2’, would be written as: + + #+CALL: double(n=4) + + Note how this function call syntax is different from the header + argument syntax. + +‘<inside header arguments>’ + Org passes inside header arguments to the named code block using + the header argument syntax. Inside header arguments apply to code + block evaluation. For example, ‘[:results output]’ collects + results printed to stdout during code execution of that block. + Note how this header argument syntax is different from the function + call syntax. + +‘<end header arguments>’ + End header arguments affect the results returned by the code block. + For example, ‘:results html’ wraps the results in a ‘#+BEGIN_EXPORT + html’ block before inserting the results in the Org buffer. + +Limit code block evaluation +--------------------------- + +The ‘eval’ header argument can limit evaluation of specific code blocks +and ‘CALL’ keyword. It is useful for protection against evaluating +untrusted code blocks by prompting for a confirmation. + +‘never’ or ‘no’ + Org never evaluates the source code. + +‘query’ + Org prompts the user for permission to evaluate the source code. + +‘never-export’ or ‘no-export’ + Org does not evaluate the source code when exporting, yet the user + can evaluate it interactively. + +‘query-export’ + Org prompts the user for permission to evaluate the source code + during export. + + If ‘eval’ header argument is not set, then Org determines whether to +evaluate the source code from the ‘org-confirm-babel-evaluate’ variable +(see *note Code Evaluation Security::). + +Cache results of evaluation +--------------------------- + +The ‘cache’ header argument is for caching results of evaluating code +blocks. Caching results can avoid re-evaluating a code block that have +not changed since the previous run. To benefit from the cache and avoid +redundant evaluations, the source block must have a result already +present in the buffer, and neither the header arguments—including the +value of ‘var’ references—nor the text of the block itself has changed +since the result was last computed. This feature greatly helps avoid +long-running calculations. For some edge cases, however, the cached +results may not be reliable. + + The caching feature is best for when code blocks are pure functions, +that is functions that return the same value for the same input +arguments (see *note Environment of a Code Block::), and that do not +have side effects, and do not rely on external variables other than the +input arguments. Functions that depend on a timer, file system objects, +and random number generators are clearly unsuitable for caching. + + A note of warning: when ‘cache’ is used in a session, caching may +cause unexpected results. + + When the caching mechanism tests for any source code changes, it does +not expand noweb style references (see *note Noweb Reference Syntax::). + + The ‘cache’ header argument can have one of two values: ‘yes’ or +‘no’. + +‘no’ + Default. No caching of results; code block evaluated every time. + +‘yes’ + Whether to run the code or return the cached results is determined + by comparing the SHA1 hash value of the combined code block and + arguments passed to it. This hash value is packed on the + ‘#+RESULTS:’ line from previous evaluation. When hash values + match, Org does not evaluate the code block. When hash values + mismatch, Org evaluates the code block, inserts the results, + recalculates the hash value, and updates ‘#+RESULTS:’ line. + + In this example, both functions are cached. But ‘caller’ runs only +if the result from ‘random’ has changed since the last run. + + #+NAME: random + #+BEGIN_SRC R :cache yes + runif(1) + #+END_SRC + + #+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random + 0.4659510825295 + + #+NAME: caller + #+BEGIN_SRC emacs-lisp :var x=random :cache yes + x + #+END_SRC + + #+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller + 0.254227238707244 + + ---------- Footnotes ---------- + + (1) The option ‘org-babel-no-eval-on-ctrl-c-ctrl-c’ can be used to +remove code evaluation from the ‘C-c C-c’ key binding. + + (2) Actually, the constructs ‘call_<name>()’ and ‘src_<lang>{}’ are +not evaluated when they appear in a keyword (see *note In-buffer +Settings::). + + +File: org.info, Node: Results of Evaluation, Next: Exporting Code Blocks, Prev: Evaluating Code Blocks, Up: Working with Source Code + +16.6 Results of Evaluation +========================== + +How Org handles results of a code block execution depends on many header +arguments working together. The primary determinant, however, is the +‘results’ header argument. It accepts four classes of options. Each +code block can take only one option per class: + +Collection + For how the results should be collected from the code block; + +Type + For which type of result the code block will return; affects how + Org processes and inserts results in the Org buffer; + +Format + For the result; affects how Org processes results; + +Handling + For inserting results once they are properly formatted. + +Collection +---------- + +Collection options specify the results. Choose one of the options; they +are mutually exclusive. + +‘value’ + Default for most Babel libraries(1). 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 languages like Python, an explicit ‘return’ statement is + mandatory when using ‘:results value’. Result is the value + returned by the last statement in the code block. + + When evaluating the code block in a session (see *note Environment + of a Code Block::), Org passes the code to an interpreter running + as an interactive Emacs inferior process. Org gets the value from + the source code interpreter’s last statement output. Org has to + use language-specific methods to obtain the value. For example, + from the variable ‘_’ in Ruby, and the value of ‘.Last.value’ in R. + +‘output’ + Scripting mode. Org passes the code to an external process running + the interpreter. Org returns the contents of the standard output + stream as text results. + + When using a session, Org passes the code to the interpreter + running as an interactive Emacs inferior process. Org concatenates + any text output from the interpreter and returns the collection as + a result. + +Type +---- + +Type tells what result types to expect from the execution of the code +block. Choose one of the options; they are mutually exclusive. The +default behavior is to automatically determine the result type. + +‘table’ +‘vector’ + Interpret the results as an Org table. If the result is a single + value, create a table with one row and one column. Usage example: + ‘:results value table’. + + In-between each table row or below the table headings, sometimes + results have horizontal lines, which are also known as “hlines”. + The ‘hlines’ argument with the default ‘no’ value strips such lines + from the input table. For most code, this is desirable, or else + those ‘hline’ symbols raise unbound variable errors. A ‘yes’ + accepts such lines, as demonstrated in the following example. + + #+NAME: many-cols + | a | b | c | + |---+---+---| + | d | e | f | + |---+---+---| + | g | h | i | + + #+NAME: no-hline + #+BEGIN_SRC python :var tab=many-cols :hlines no + return tab + #+END_SRC + + #+RESULTS: no-hline + | a | b | c | + | d | e | f | + | g | h | i | + + #+NAME: hlines + #+BEGIN_SRC python :var tab=many-cols :hlines yes + return tab + #+END_SRC + + #+RESULTS: hlines + | a | b | c | + |---+---+---| + | d | e | f | + |---+---+---| + | g | h | i | + +‘list’ + Interpret the results as an Org list. If the result is a single + value, create a list of one element. + +‘scalar’ +‘verbatim’ + Interpret literally and insert as quoted text. Do not create a + table. Usage example: ‘:results value verbatim’. + +‘file’ + Interpret as a filename. Save the results of execution of the code + block to that file, then insert a link to it. You can control both + the filename and the description associated to the link. + + Org first tries to generate the filename from the value of the + ‘file’ header argument and the directory specified using the + ‘output-dir’ header arguments. If ‘output-dir’ is not specified, + Org assumes it is the current directory. + + #+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/ + size(2cm); + draw(unitcircle); + #+END_SRC + + If ‘file’ header argument is missing, Org generates the base name + of the output file from the name of the code block, and its + extension from the ‘file-ext’ header argument. In that case, both + the name and the extension are mandatory. + + #+name: circle + #+BEGIN_SRC asymptote :results value file :file-ext pdf + size(2cm); + draw(unitcircle); + #+END_SRC + + The ‘file-desc’ header argument defines the description (see *note + Link Format::) for the link. If ‘file-desc’ is present but has no + value, the ‘file’ value is used as the link description. When this + argument is not present, the description is omitted. If you want + to provide the ‘file-desc’ argument but omit the description, you + can provide it with an empty vector (i.e., :file-desc []). + + By default, Org assumes that a table written to a file has + TAB-delimited output. You can choose a different separator with + the ‘sep’ header argument. + + The ‘file-mode’ header argument defines the file permissions. To + make it executable, use ‘:file-mode (identity #o755)’. + + #+BEGIN_SRC shell :results file :file script.sh :file-mode (identity #o755) + echo "#!/bin/bash" + echo "echo Hello World" + #+END_SRC + +Format +------ + +Format pertains to the type of the result returned by the code block. +Choose one of the options; they are mutually exclusive. The default +follows from the type specified above. + +‘code’ + Result enclosed in a code block. Useful for parsing. Usage + example: ‘:results value code’. + +‘drawer’ + Result wrapped in a ‘RESULTS’ drawer. Useful for containing ‘raw’ + or ‘org’ results for later scripting and automated processing. + Usage example: ‘:results value drawer’. + +‘html’ + Results enclosed in a ‘BEGIN_EXPORT html’ block. Usage example: + ‘:results value html’. + +‘latex’ + Results enclosed in a ‘BEGIN_EXPORT latex’ block. Usage example: + ‘:results value latex’. + +‘link’ +‘graphics’ + When used along with ‘file’ type, the result is a link to the file + specified in ‘:file’ header argument. However, unlike plain ‘file’ + type, nothing is written to the disk. The block is used for its + side-effects only, as in the following example: + + #+begin_src shell :results file link :file "download.tar.gz" + wget -c "https://example.com/download.tar.gz" + #+end_src + +‘org’ + Results enclosed in a ‘BEGIN_SRC org’ block. For comma-escape, + either ‘<TAB>’ in the block, or export the file. Usage example: + ‘:results value org’. + +‘pp’ + Result converted to pretty-print source code. Enclosed in a code + 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’. + + The ‘wrap’ header argument unconditionally marks the results block by +appending strings to ‘#+BEGIN_’ and ‘#+END_’. If no string is +specified, Org wraps the results in a ‘#+BEGIN_results’ ... +‘#+END_results’ block. It takes precedent over the ‘results’ value +listed above. E.g., + + #+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown + "<blink>Welcome back to the 90's</blink>" + #+END_SRC + + #+RESULTS: + #+BEGIN_EXPORT markdown + <blink>Welcome back to the 90's</blink> + #+END_EXPORT + +Handling +-------- + +Handling options after collecting the results. + +‘replace’ + Default. Insert results in the Org buffer. Remove previous + results. Usage example: ‘:results output replace’. + +‘silent’ + Do not insert results in the Org mode buffer, but echo them in the + minibuffer. Usage example: ‘:results output silent’. + +‘none’ + Do not process results at all. No inserting in the Org mode buffer + nor echo them in the minibuffer. Usage example: ‘:results none’. + +‘append’ + Append results to the Org buffer. Latest results are at the + bottom. Does not remove previous results. Usage example: + ‘:results output append’. + +‘prepend’ + Prepend results to the Org buffer. Latest results are at the top. + Does not remove previous results. Usage example: ‘:results output + prepend’. + +Post-processing +--------------- + +The ‘post’ header argument is for post-processing results from block +evaluation. When ‘post’ has any value, Org binds the results to +‘*this*’ variable for easy passing to ‘var’ header argument +specifications (see *note Environment of a Code Block::). That makes +results available to other code blocks, or even for direct Emacs Lisp +code execution. + + The following two examples illustrate ‘post’ header argument in +action. The first one shows how to attach an ‘ATTR_LATEX’ keyword using +‘post’. + + #+NAME: attr_wrap + #+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output + echo "#+ATTR_LATEX: :width $width" + echo "$data" + #+END_SRC + + #+HEADER: :file /tmp/it.png + #+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer + digraph{ + a -> b; + b -> c; + c -> a; + } + #+end_src + + #+RESULTS: + :RESULTS: + #+ATTR_LATEX :width 5cm + [[file:/tmp/it.png]] + :END: + + The second example shows use of ‘colnames’ header argument in ‘post’ +to pass data between code blocks. + + #+NAME: round-tbl + #+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f" + (mapcar (lambda (row) + (mapcar (lambda (cell) + (if (numberp cell) + (format fmt cell) + cell)) + row)) + tbl) + #+end_src + + #+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*) + set.seed(42) + data.frame(foo=rnorm(1)) + #+END_SRC + + #+RESULTS: + | foo | + |-------| + | 1.371 | + + ---------- Footnotes ---------- + + (1) Actually, the constructs ‘call_<name>()’ and ‘src_<lang>{}’ are +not evaluated when they appear in a keyword (see *note In-buffer +Settings::). + + +File: org.info, Node: Exporting Code Blocks, Next: Extracting Source Code, Prev: Results of Evaluation, Up: Working with Source Code + +16.7 Exporting Code Blocks +========================== + +It is possible to export the _code_ of code blocks, the _results_ of +code block evaluation, _both_ the code and the results of code block +evaluation, or _none_. Org defaults to exporting _code_ for most +languages. For some languages, such as ditaa, Org defaults to +_results_. To export just the body of code blocks, see *note Literal +Examples::. To selectively export sub-trees of an Org document, see +*note Exporting::. + + The ‘exports’ header argument is to specify if that part of the Org +file is exported to, say, HTML or LaTeX formats. + +‘code’ + The default. The body of code is included into the exported file. + Example: ‘:exports code’. + +‘results’ + The results of evaluation of the code is included in the exported + file. Example: ‘:exports results’. + +‘both’ + Both the code and results of evaluation are included in the + exported file. Example: ‘:exports both’. + +‘none’ + Neither the code nor the results of evaluation is included in the + exported file. Whether the code is evaluated at all depends on + other options. Example: ‘:exports none’. + + To stop Org from evaluating code blocks to speed exports, use the +header argument ‘:eval never-export’ (see *note Evaluating Code +Blocks::). To stop Org from evaluating code blocks for greater +security, set the ‘org-export-use-babel’ variable to ‘nil’, but +understand that header arguments will have no effect. + + Turning off evaluation comes in handy when batch processing. For +example, markup languages for wikis, which have a high risk of untrusted +code. Stopping code block evaluation also stops evaluation of all +header arguments of the code block. This may not be desirable in some +circumstances. So during export, to allow evaluation of just the header +arguments but not any code evaluation in the source block, set ‘:eval +never-export’ (see *note Evaluating Code Blocks::). + + Org never evaluates code blocks in commented sub-trees when exporting +(see *note Comment Lines::). On the other hand, Org does evaluate code +blocks in sub-trees excluded from export (see *note Export Settings::). + + +File: org.info, Node: Extracting Source Code, Next: Languages, Prev: Exporting Code Blocks, Up: Working with Source Code + +16.8 Extracting Source Code +=========================== + +Extracting source code from code blocks is a basic task in literate +programming. Org has features to make this easy. In literate +programming parlance, documents on creation are _woven_ with code and +documentation, and on export, the code is tangled for execution by a +computer. Org facilitates weaving and tangling for producing, +maintaining, sharing, and exporting literate programming documents. Org +provides extensive customization options for extracting source code. + + When Org tangles code blocks, it expands, merges, and transforms +them. Then Org recomposes them into one or more separate files, as +configured through the options. During this tangling process, Org +expands variables in the source code, and resolves any noweb style +references (see *note Noweb Reference Syntax::). + +Header arguments +---------------- + +The ‘tangle’ header argument specifies if the code block is exported to +source file(s). + +‘yes’ + Export the code block to source file. The file name for the source + file is derived from the name of the Org file, and the file + extension is derived from the source code language identifier. + Example: ‘:tangle yes’. + +‘no’ + The default. Do not extract the code in a source code file. + Example: ‘:tangle no’. + +FILENAME + Export the code block to source file whose file name is derived + from any string passed to the ‘tangle’ header argument. Org + derives the file name as being relative to the directory of the Org + file’s location. Example: ‘:tangle FILENAME’. + + The ‘mkdirp’ header argument creates parent directories for tangled +files if the directory does not exist. A ‘yes’ value enables directory +creation whereas ‘no’ inhibits it. + + The ‘comments’ header argument controls inserting comments into +tangled files. These are above and beyond whatever comments may already +exist in the code block. + +‘no’ + The default. Do not insert any extra comments during tangling. + +‘link’ + Wrap the code block in comments. Include links pointing back to + the place in the Org file from where the code was tangled. + +‘yes’ + Kept for backward compatibility; same as ‘link’. + +‘org’ + Nearest headline text from Org file is inserted as comment. The + exact text that is inserted is picked from the leading context of + the source block. + +‘both’ + Includes both ‘link’ and ‘org’ options. + +‘noweb’ + Includes ‘link’ option, expands noweb references (see *note Noweb + Reference Syntax::), and wraps them in link comments inside the + body of the code block. + + The ‘padline’ header argument controls insertion of newlines to pad +source code in the tangled file. + +‘yes’ + Default. Insert a newline before and after each code block in the + tangled file. + +‘no’ + Do not insert newlines to pad the tangled code blocks. + + The ‘shebang’ header argument can turn results into executable script +files. By setting it to a string value—for example, ‘:shebang +"#!/bin/bash"’—Org inserts that string as the first line of the tangled +file that the code block is extracted to. Org then turns on the tangled +file’s executable permission. + + The ‘tangle-mode’ header argument specifies what permissions to set +for tangled files by ‘set-file-modes’. For example, to make a read-only +tangled file, use ‘:tangle-mode (identity #o444)’. To make it +executable, use ‘:tangle-mode (identity #o755)’. It also overrides +executable permission granted by ‘shebang’. When multiple source code +blocks tangle to a single file with different and conflicting +‘tangle-mode’ header arguments, Org’s behavior is undefined. + + By default Org expands code blocks during tangling. The ‘no-expand’ +header argument turns off such expansions. Note that one side-effect of +expansion by ‘org-babel-expand-src-block’ also assigns values (see *note +Environment of a Code Block::) to variables. Expansions also replace +noweb references with their targets (see *note Noweb Reference +Syntax::). Some of these expansions may cause premature assignment, +hence this option. This option makes a difference only for tangling. +It has no effect when exporting since code blocks for execution have to +be expanded anyway. + +Functions +--------- + +‘org-babel-tangle’ + Tangle the current file. Bound to ‘C-c C-v t’. + + With prefix argument only tangle the current code block. + +‘org-babel-tangle-file’ + Choose a file to tangle. Bound to ‘C-c C-v f’. + +Tangle hooks +------------ + +‘org-babel-post-tangle-hook’ + This hook is run from within code files tangled by + ‘org-babel-tangle’, making it suitable for post-processing, + compilation, and evaluation of code in the tangled files. + +Jumping between code and Org +---------------------------- + +Debuggers normally link errors and messages back to the source code. +But for tangled files, we want to link back to the Org file, not to the +tangled source file. To make this extra jump, Org uses +‘org-babel-tangle-jump-to-org’ function with two additional source code +block header arguments: + + 1. Set ‘padline’ to true—this is the default setting. + 2. Set ‘comments’ to ‘link’, which makes Org insert links to the Org + file. + + +File: org.info, Node: Languages, Next: Editing Source Code, Prev: Extracting Source Code, Up: Working with Source Code + +16.9 Languages +============== + +Code blocks in dozens of languages are supported. See Worg for language +specific documentation +(https://orgmode.org/worg/org-contrib/babel/languages/index.html). + + By default, only Emacs Lisp is enabled for evaluation. To enable or +disable other languages, customize the ‘org-babel-load-languages’ +variable either through the Emacs customization interface, or by adding +code to the init file as shown next. + + In this example, evaluation is disabled for Emacs Lisp, and enabled +for R. + + (org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . nil) + (R . t))) + + Note that this is not the only way to enable a language. Org also +enables languages when loaded with ‘require’ statement. For example, +the following enables execution of Clojure code blocks: + + (require 'ob-clojure) + + +File: org.info, Node: Editing Source Code, Next: Noweb Reference Syntax, Prev: Languages, Up: Working with Source Code + +16.10 Editing Source Code +========================= + +Use ‘C-c '’ to edit the current code block. It opens a new major mode +edit buffer containing the body of the source code block, ready for any +edits. Use ‘C-c '’ again to close the buffer and return to the Org +buffer. + + ‘C-x C-s’ saves the buffer and updates the contents of the Org +buffer. Set ‘org-edit-src-auto-save-idle-delay’ to save the base buffer +after a certain idle delay time. Set ‘org-edit-src-turn-on-auto-save’ +to auto-save this buffer into a separate file using Auto-save mode. + + While editing the source code in the major mode, the Org Src minor +mode remains active. It provides these customization variables as +described below. For even more variables, look in the customization +group ‘org-edit-structure’. + +‘org-src-lang-modes’ + If an Emacs major-mode named ‘<LANG>-mode’ exists, where <LANG> is + the language identifier from code block’s header line, then the + edit buffer uses that major mode. Use this variable to arbitrarily + map language identifiers to major modes. + +‘org-src-window-setup’ + For specifying Emacs window arrangement when the new edit buffer is + created. + +‘org-src-preserve-indentation’ + Default is ‘nil’. Source code is indented. This indentation + applies during export or tangling, and depending on the context, + may alter leading spaces and tabs. When non-‘nil’, source code is + aligned with the leftmost column. No lines are modified during + export or tangling, which is very useful for white-space sensitive + languages, such as Python. + +‘org-src-ask-before-returning-to-edit-buffer’ + When ‘nil’, Org returns to the edit buffer without further prompts. + The default prompts for a confirmation. + + Set ‘org-src-fontify-natively’ to non-‘nil’ to turn on native code +fontification in the _Org_ buffer. Fontification of code blocks can +give visual separation of text and code on the display page. To further +customize the appearance of ‘org-block’ for specific languages, +customize ‘org-src-block-faces’. The following example shades the +background of regular blocks, and colors source blocks only for Python +and Emacs Lisp languages. + + (require 'color) + (set-face-attribute 'org-block nil :background + (color-darken-name + (face-attribute 'default :background) 3)) + + (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF")) + ("python" (:background "#E5FFB8")))) + + +File: org.info, Node: Noweb Reference Syntax, Next: Library of Babel, Prev: Editing Source Code, Up: Working with Source Code + +16.11 Noweb Reference Syntax +============================ + +Source code blocks can include references to other source code blocks, +using a noweb(1) style syntax: + + <<CODE-BLOCK-ID>> + +where CODE-BLOCK-ID refers to either the ‘NAME’ of a single source code +block, or a collection of one or more source code blocks sharing the +same ‘noweb-ref’ header argument (see *note Using Header Arguments::). +Org can replace such references with the source code of the block or +blocks being referenced, or, in the case of a single source code block +named with ‘NAME’, with the results of an evaluation of that block. + + The ‘noweb’ header argument controls expansion of noweb syntax +references. Expansions occur when source code blocks are evaluated, +tangled, or exported. + +‘no’ + Default. No expansion of noweb syntax references in the body of + the code when evaluating, tangling, or exporting. + +‘yes’ + Expansion of noweb syntax references in the body of the code block + when evaluating, tangling, or exporting. + +‘tangle’ + Expansion of noweb syntax references in the body of the code block + when tangling. No expansion when evaluating or exporting. + +‘no-export’ + Expansion of noweb syntax references in the body of the code block + when evaluating or tangling. No expansion when exporting. + +‘strip-export’ + Expansion of noweb syntax references in the body of the code block + when expanding prior to evaluating or tangling. Removes noweb + syntax references when exporting. + +‘eval’ + Expansion of noweb syntax references in the body of the code block + only before evaluating. + + In the most simple case, the contents of a single source block is +inserted within other blocks. Thus, in following example, + + #+NAME: initialization + #+BEGIN_SRC emacs-lisp + (setq sentence "Never a foot too far, even.") + #+END_SRC + + #+BEGIN_SRC emacs-lisp :noweb yes + <<initialization>> + (reverse sentence) + #+END_SRC + +the second code block is expanded as + + #+BEGIN_SRC emacs-lisp :noweb yes + (setq sentence "Never a foot too far, even.") + (reverse sentence) + #+END_SRC + + You may also include the contents of multiple blocks sharing a common +‘noweb-ref’ header argument, which can be set at the file, sub-tree, or +code block level. In the example Org file shown next, the body of the +source code in each block is extracted for concatenation to a pure code +file when tangled. + + #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh + <<fullest-disk>> + #+END_SRC + * the mount point of the fullest disk + :PROPERTIES: + :header-args: :noweb-ref fullest-disk + :END: + + ** query all mounted disks + #+BEGIN_SRC sh + df \ + #+END_SRC + + ** strip the header row + #+BEGIN_SRC sh + |sed '1d' \ + #+END_SRC + + ** output mount point of fullest disk + #+BEGIN_SRC sh + |awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}' + #+END_SRC + + By default a newline separates each noweb reference concatenation. +To use a different separator, edit the ‘noweb-sep’ header argument. + + Alternatively, Org can include the results of evaluation of a single +code block rather than its body. Evaluation occurs when parentheses, +possibly including arguments, are appended to the code block name, as +shown below. + + <<NAME(optional arguments)>> + + Note that in this case, a code block name set by ‘NAME’ keyword is +required; the reference set by ‘noweb-ref’ will not work when evaluation +is desired. + + Here is an example that demonstrates how the exported content changes +when noweb style references are used with parentheses versus without. +Given: + + #+NAME: some-code + #+BEGIN_SRC python :var num=0 :results output :exports none + print(num*10) + #+END_SRC + +this code block: + + #+BEGIN_SRC text :noweb yes + <<some-code>> + #+END_SRC + +expands to: + + print(num*10) + + Below, a similar noweb style reference is used, but with parentheses, +while setting a variable ‘num’ to 10: + + #+BEGIN_SRC text :noweb yes + <<some-code(num=10)>> + #+END_SRC + +Note that the expansion now contains the results of the code block +‘some-code’, not the code block itself: + + 100 + + Noweb insertions honor prefix characters that appear before the noweb +syntax reference. This behavior is illustrated in the following +example. Because the ‘<<example>>’ noweb reference appears behind the +SQL comment syntax, each line of the expanded noweb reference is +commented. With: + + #+NAME: example + #+BEGIN_SRC text + this is the + multi-line body of example + #+END_SRC + +this code block: + + #+BEGIN_SRC sql :noweb yes + ---<<example>> + #+END_SRC + +expands to: + + #+BEGIN_SRC sql :noweb yes + ---this is the + ---multi-line body of example + #+END_SRC + + Since this change does not affect noweb replacement text without +newlines in them, inline noweb references are acceptable. + + This feature can also be used for management of indentation in +exported code snippets. With: + + #+NAME: if-true + #+BEGIN_SRC python :exports none + print('do things when true') + #+end_src + + #+name: if-false + #+begin_src python :exports none + print('do things when false') + #+end_src + +this code block: + + #+begin_src python :noweb yes :results output + if true: + <<if-true>> + else: + <<if-false>> + #+end_src + +expands to: + + if true: + print('do things when true') + else: + print('do things when false') + + When in doubt about the outcome of a source code block expansion, you +can preview the results with the following command: + +‘C-c C-v v’ or ‘C-c C-v C-v’ (‘org-babel-expand-src-block’) + Expand the current source code block according to its header + arguments and pop open the results in a preview buffer. + + ---------- Footnotes ---------- + + (1) For noweb literate programming details, see +<http://www.cs.tufts.edu/~nr/noweb/>. + + +File: org.info, Node: Library of Babel, Next: Key bindings and Useful Functions, Prev: Noweb Reference Syntax, Up: Working with Source Code + +16.12 Library of Babel +====================== + +The “Library of Babel” is a collection of code blocks. Like a function +library, these code blocks can be called from other Org files. A +collection of useful code blocks is available on Worg +(https://orgmode.org/worg/library-of-babel.html). For remote code block +evaluation syntax, see *note Evaluating Code Blocks::. + + For any user to add code to the library, first save the code in +regular code blocks of an Org file, and then load the Org file with +‘org-babel-lob-ingest’, which is bound to ‘C-c C-v i’. + + +File: org.info, Node: Key bindings and Useful Functions, Next: Batch Execution, Prev: Library of Babel, Up: Working with Source Code + +16.13 Key bindings and Useful Functions +======================================= + +Many common Org mode key sequences are re-bound depending on the +context. + + Active key bindings in code blocks: + +Key binding Function +-------------------------------------------------------- +‘C-c C-c’ ‘org-babel-execute-src-block’ +‘C-c C-o’ ‘org-babel-open-src-block-result’ +‘M-<UP>’ ‘org-babel-load-in-session’ +‘M-<DOWN>’ ‘org-babel-pop-to-session’ + + Active key bindings in Org mode buffer: + +Key binding Function +-------------------------------------------------------------------------- +‘C-c C-v p’ or ‘C-c C-v C-p’ ‘org-babel-previous-src-block’ +‘C-c C-v n’ or ‘C-c C-v C-n’ ‘org-babel-next-src-block’ +‘C-c C-v e’ or ‘C-c C-v C-e’ ‘org-babel-execute-maybe’ +‘C-c C-v o’ or ‘C-c C-v C-o’ ‘org-babel-open-src-block-result’ +‘C-c C-v v’ or ‘C-c C-v C-v’ ‘org-babel-expand-src-block’ +‘C-c C-v u’ or ‘C-c C-v C-u’ ‘org-babel-goto-src-block-head’ +‘C-c C-v g’ or ‘C-c C-v C-g’ ‘org-babel-goto-named-src-block’ +‘C-c C-v r’ or ‘C-c C-v C-r’ ‘org-babel-goto-named-result’ +‘C-c C-v b’ or ‘C-c C-v C-b’ ‘org-babel-execute-buffer’ +‘C-c C-v s’ or ‘C-c C-v C-s’ ‘org-babel-execute-subtree’ +‘C-c C-v d’ or ‘C-c C-v C-d’ ‘org-babel-demarcate-block’ +‘C-c C-v t’ or ‘C-c C-v C-t’ ‘org-babel-tangle’ +‘C-c C-v f’ or ‘C-c C-v C-f’ ‘org-babel-tangle-file’ +‘C-c C-v c’ or ‘C-c C-v C-c’ ‘org-babel-check-src-block’ +‘C-c C-v j’ or ‘C-c C-v C-j’ ‘org-babel-insert-header-arg’ +‘C-c C-v l’ or ‘C-c C-v C-l’ ‘org-babel-load-in-session’ +‘C-c C-v i’ or ‘C-c C-v C-i’ ‘org-babel-lob-ingest’ +‘C-c C-v I’ or ‘C-c C-v C-I’ ‘org-babel-view-src-block-info’ +‘C-c C-v z’ or ‘C-c C-v C-z’ ‘org-babel-switch-to-session-with-code’ +‘C-c C-v a’ or ‘C-c C-v C-a’ ‘org-babel-sha1-hash’ +‘C-c C-v h’ or ‘C-c C-v C-h’ ‘org-babel-describe-bindings’ +‘C-c C-v x’ or ‘C-c C-v C-x’ ‘org-babel-do-key-sequence-in-edit-buffer’ + + +File: org.info, Node: Batch Execution, Prev: Key bindings and Useful Functions, Up: Working with Source Code + +16.14 Batch Execution +===================== + +Org mode features, including working with source code facilities can be +invoked from the command line. This enables building shell scripts for +batch processing, running automated system tasks, and expanding Org +mode’s usefulness. + + The sample script shows batch processing of multiple files using +‘org-babel-tangle’. + + #!/bin/sh + # Tangle files with Org mode + # + emacs -Q --batch --eval " + (progn + (require 'ob-tangle) + (dolist (file command-line-args-left) + (with-current-buffer (find-file-noselect file) + (org-babel-tangle)))) + " "$@" + + +File: org.info, Node: Miscellaneous, Next: Hacking, Prev: Working with Source Code, Up: Top + +17 Miscellaneous +**************** + +* Menu: + +* Completion:: ‘M-<TAB>’ guesses completions. +* Structure Templates:: Quick insertion of structural elements. +* Speed Keys:: Electric commands at the beginning of a headline. +* Clean View:: Getting rid of leading stars in the outline. +* Execute commands in the active region:: Execute commands on multiple items in Org or agenda view. +* Dynamic Headline Numbering:: Display and update outline numbering. +* The Very Busy C-c C-c Key:: When in doubt, press ‘C-c C-c’. +* In-buffer Settings:: Overview of keywords. +* Regular Expressions:: Elisp regular expressions. +* Org Syntax:: Formal description of Org’s syntax. +* Documentation Access:: Read documentation about current syntax. +* Escape Character:: Prevent Org from interpreting your writing. +* Code Evaluation Security:: Org files evaluate in-line code. +* Interaction:: With other Emacs packages. +* TTY Keys:: Using Org on a tty. +* Protocols:: External access to Emacs and Org. +* Org Crypt:: Encrypting Org files. +* Org Mobile:: Viewing and capture on a mobile device. + + +File: org.info, Node: Completion, Next: Structure Templates, Up: Miscellaneous + +17.1 Completion +=============== + +Org has in-buffer completions. Unlike minibuffer completions, which are +useful for quick command interactions, Org’s in-buffer completions are +more suitable for content creation in Org documents. Type one or more +letters and invoke the hot key to complete the text in-place. Depending +on the context and the keys, Org offers different types of completions. +No minibuffer is involved. Such mode-specific hot keys have become an +integral part of Emacs and Org provides several shortcuts. + +‘M-<TAB>’ + + Complete word at point. + + • At the beginning of an empty headline, complete TODO keywords. + + • After ‘\’, complete TeX symbols supported by the exporter. + + • After ‘:’ in a headline, complete tags. Org deduces the list + of tags from the ‘TAGS’ in-buffer option (see *note Setting + Tags::), the variable ‘org-tag-alist’, or from all tags used + in the current buffer. + + • After ‘:’ and not in a headline, complete property keys. The + list of keys is constructed dynamically from all keys used in + the current buffer. + + • After ‘[[’, complete link abbreviations (see *note Link + Abbreviations::). + + • After ‘[[*’, complete headlines in the current buffer so that + they can be used in search links like: ‘[[*find this + headline]]’ + + • After ‘#+’, complete the special keywords like ‘TYP_TODO’ or + file-specific ‘OPTIONS’. After option keyword is complete, + pressing ‘M-<TAB>’ again inserts example settings for this + keyword. + + • After ‘STARTUP’ keyword, complete startup items. + + • When point is anywhere else, complete dictionary words using + Ispell. + + +File: org.info, Node: Structure Templates, Next: Speed Keys, Prev: Completion, Up: Miscellaneous + +17.2 Structure Templates +======================== + +With just a few keystrokes, it is possible to insert empty structural +blocks, such as ‘#+BEGIN_SRC’ ... ‘#+END_SRC’, or to wrap existing text +in such a block. + +‘C-c C-,’ (‘org-insert-structure-template’) + Prompt for a type of block structure, and insert the block at + point. If the region is active, it is wrapped in the block. First + prompts the user for keys, which are used to look up a structure + type from the variable below. If the key is ‘<TAB>’, ‘<RET>’, or + ‘<SPC>’, the user is prompted to enter a block type. + + Available structure types are defined in +‘org-structure-template-alist’, see the docstring for adding or changing +values. + + Org Tempo expands snippets to structures defined in +‘org-structure-template-alist’ and ‘org-tempo-keywords-alist’. For +example, ‘< s <TAB>’ creates a code block. Enable it by customizing +‘org-modules’ or add ‘(require 'org-tempo)’ to your Emacs init file(1). + +‘a’ ‘#+BEGIN_EXPORT ascii’ ... ‘#+END_EXPORT’ +‘c’ ‘#+BEGIN_CENTER’ ... ‘#+END_CENTER’ +‘C’ ‘#+BEGIN_COMMENT’ ... ‘#+END_COMMENT’ +‘e’ ‘#+BEGIN_EXAMPLE’ ... ‘#+END_EXAMPLE’ +‘E’ ‘#+BEGIN_EXPORT’ ... ‘#+END_EXPORT’ +‘h’ ‘#+BEGIN_EXPORT html’ ... ‘#+END_EXPORT’ +‘l’ ‘#+BEGIN_EXPORT latex’ ... ‘#+END_EXPORT’ +‘q’ ‘#+BEGIN_QUOTE’ ... ‘#+END_QUOTE’ +‘s’ ‘#+BEGIN_SRC’ ... ‘#+END_SRC’ +‘v’ ‘#+BEGIN_VERSE’ ... ‘#+END_VERSE’ + + ---------- Footnotes ---------- + + (1) For more information, please refer to the commentary section in +‘org-tempo.el’. + + +File: org.info, Node: Speed Keys, Next: Clean View, Prev: Structure Templates, Up: Miscellaneous + +17.3 Speed Keys +=============== + +Single keystrokes can execute custom commands in an Org file when point +is on a headline. Without the extra burden of a meta or modifier key, +Speed Keys can speed navigation or execute custom commands. Besides +faster navigation, Speed Keys may come in handy on small mobile devices +that do not have full keyboards. Speed Keys may also work on TTY +devices known for their problems when entering Emacs key chords. + + By default, Org has Speed Keys disabled. To activate Speed Keys, set +the variable ‘org-use-speed-commands’ to a non-‘nil’ value. To trigger +a Speed Key, point must be at the beginning of an Org headline, before +any of the stars. + + Org comes with a pre-defined list of Speed Keys. To add or modify +Speed Keys, customize the option ‘org-speed-commands’. For more +details, see the variable’s docstring. With Speed Keys activated, ‘M-x +org-speed-command-help’, or ‘?’ when point is at the beginning of an Org +headline, shows currently active Speed Keys, including the user-defined +ones. + + +File: org.info, Node: Clean View, Next: Execute commands in the active region, Prev: Speed Keys, Up: Miscellaneous + +17.4 A Cleaner Outline View +=========================== + +Org’s outline with stars and no indents can look cluttered for short +documents. For _book-like_ long documents, the effect is not as +noticeable. Org provides an alternate stars and indentation scheme, as +shown on the right in the following table. It displays only one star +and indents text to line up with the heading: + + * Top level headline | * Top level headline + ** Second level | * Second level + *** Third level | * Third level + some text | some text + *** Third level | * Third level + more text | more text + * Another top level headline | * Another top level headline + + Org can achieve this in two ways, (1) by just displaying the buffer +in this way without changing it, or (2) by actually indenting every line +in the desired amount with hard spaces and hiding leading stars. + +* Menu: + +* Org Indent Mode:: +* Hard indentation:: + + +File: org.info, Node: Org Indent Mode, Next: Hard indentation, Up: Clean View + +17.4.1 Org Indent Mode +---------------------- + +To display the buffer in the indented view, activate Org Indent minor +mode, using ‘M-x org-indent-mode’. Text lines that are not headlines +are prefixed with virtual spaces to vertically align with the headline +text(1). + + To make more horizontal space, the headlines are shifted by two +characters. Configure ‘org-indent-indentation-per-level’ variable for a +different number. + + By default, Org Indent mode turns off ‘org-adapt-indentation’ and +does hide leading stars by locally setting ‘org-hide-leading-stars’ to +‘t’: only one star on each headline is visible, the rest are masked with +the same font color as the background. If you want to customize this +default behavior, see ‘org-indent-mode-turns-on-hiding-stars’ and +‘org-indent-mode-turns-off-org-adapt-indentation’. + + To globally turn on Org Indent mode for all files, customize the +variable ‘org-startup-indented’. To control it for individual files, +use ‘STARTUP’ keyword as follows: + + #+STARTUP: indent + #+STARTUP: noindent + + ---------- Footnotes ---------- + + (1) 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’. + + +File: org.info, Node: Hard indentation, Prev: Org Indent Mode, Up: Clean View + +17.4.2 Hard indentation +----------------------- + +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(1). +With Org’s support, you have to indent all lines to line up with the +outline headers. You would use these settings(2): + + (setq org-adapt-indentation t + org-hide-leading-stars t + org-odd-levels-only t) + +_Indentation of text below headlines_ (‘org-adapt-indentation’) + The first setting modifies paragraph filling, line wrapping, and + structure editing commands to preserving or adapting the + indentation as appropriate. + +_Hiding leading stars_ (‘org-hide-leading-stars’) + The second setting makes leading stars invisible by applying the + face ‘org-hide’ to them. For per-file preference, use these file + ‘STARTUP’ options: + + #+STARTUP: hidestars + #+STARTUP: showstars + +_Odd levels_ (‘org-odd-levels-only’) + The third setting makes Org use only odd levels, 1, 3, 5, ..., in + the outline to create more indentation. On a per-file level, + control this with: + + #+STARTUP: odd + #+STARTUP: oddeven + + To convert a file between single and double stars layouts, use ‘M-x + org-convert-to-odd-levels’ and ‘M-x org-convert-to-oddeven-levels’. + + ---------- Footnotes ---------- + + (1) This works, but requires extra effort. Org Indent mode is more +convenient for most applications. + + (2) ‘org-adapt-indentation’ can also be set to ‘'headline-data’, in +which case only data lines below the headline will be indented. + + +File: org.info, Node: Execute commands in the active region, Next: Dynamic Headline Numbering, Prev: Clean View, Up: Miscellaneous + +17.5 Execute commands in the active region +========================================== + +When in an Org buffer and the region is active, some commands will apply +to all the subtrees in the active region. For example, hitting ‘C-c +C-s’ when multiple headlines are within the active region will +successively prompt you for a new schedule date and time. To disable +this, set the option ‘org-loop-over-headlines-in-active-region’ to +non-‘t’, activate the region and run the command normally. + + ‘org-agenda-loop-over-headlines-in-active-region’ is the equivalent +option of the agenda buffer, where you can also use *note bulk editing +of selected entries: Bulk remote editing selected entries. + + Not all commands can loop in the active region and what subtrees or +headlines are considered can be refined: see the docstrings of these +options for more details. + + +File: org.info, Node: Dynamic Headline Numbering, Next: The Very Busy C-c C-c Key, Prev: Execute commands in the active region, Up: Miscellaneous + +17.6 Dynamic Headline Numbering +=============================== + +The Org Num minor mode, toggled with ‘M-x org-num-mode’, displays +outline numbering on top of headlines. It also updates it automatically +upon changes to the structure of the document. + + By default, all headlines are numbered. You can limit numbering to +specific headlines according to their level, tags, ‘COMMENT’ keyword, or +‘UNNUMBERED’ property. Set ‘org-num-max-level’, ‘org-num-skip-tags’, +‘org-num-skip-commented’, ‘org-num-skip-unnumbered’, or +‘org-num-skip-footnotes’ accordingly. + + If ‘org-num-skip-footnotes’ is non-‘nil’, footnotes sections (see +*note Creating Footnotes::) are not numbered either. + + You can control how the numbering is displayed by setting +‘org-num-face’ and ‘org-num-format-function’. + + You can also turn this mode globally for all Org files by setting the +option ‘org-startup-numerated’ to ‘t’, or locally on a file by using +‘#+startup: num’. + + +File: org.info, Node: The Very Busy C-c C-c Key, Next: In-buffer Settings, Prev: Dynamic Headline Numbering, Up: Miscellaneous + +17.7 The Very Busy ‘C-c C-c’ Key +================================ + +The ‘C-c C-c’ key in Org serves many purposes depending on the context. +It is probably the most over-worked, multi-purpose key combination in +Org. Its uses are well documented throughout this manual, but here is a +consolidated list for easy reference. + + • If column view (see *note Column View::) is on, exit column view. + + • If any highlights shown in the buffer from the creation of a sparse + tree, or from clock display, remove such highlights. + + • If point is in one of the special ‘KEYWORD’ lines, scan the buffer + for these lines and update the information. Also reset the Org + file cache used to temporary store the contents of URLs used as + values for keywords like ‘SETUPFILE’. + + • If point is inside a table, realign the table. + + • If point is on a ‘TBLFM’ keyword, re-apply the formulas to the + entire table. + + • If the current buffer is a capture buffer, close the note and file + it. With a prefix argument, also jump to the target location after + saving the note. + + • If point is on a ‘<<<target>>>’, update radio targets and + corresponding links in this buffer. + + • If point is on a property line or at the start or end of a property + drawer, offer property commands. + + • If point is at a footnote reference, go to the corresponding + definition, and _vice versa_. + + • If point is on a statistics cookie, update it. + + • If point is in a plain list item with a checkbox, toggle the status + of the checkbox. + + • If point is on a numbered item in a plain list, renumber the + ordered list. + + • If point is on the ‘#+BEGIN’ line of a dynamic block, the block is + updated. + + • If point is at a timestamp, fix the day name in the timestamp. + + +File: org.info, Node: In-buffer Settings, Next: Regular Expressions, Prev: The Very Busy C-c C-c Key, Up: Miscellaneous + +17.8 Summary of In-Buffer Settings +================================== + +In-buffer settings start with ‘#+’, followed by a keyword, a colon, and +then a word for each setting. Org accepts multiple settings on the same +line. Org also accepts multiple lines for a keyword. This manual +describes these settings throughout. A summary follows here. + + ‘C-c C-c’ activates any changes to the in-buffer settings. Closing +and reopening the Org file in Emacs also activates the changes. + +‘#+ARCHIVE: %s_done::’ + Sets the archive location of the agenda file. The corresponding + variable is ‘org-archive-location’. + +‘#+CATEGORY’ + Sets the category of the agenda file, which applies to the entire + document. + +‘#+COLUMNS: %25ITEM ...’ + Set the default format for columns view. This format applies when + columns view is invoked in locations where no ‘COLUMNS’ property + applies. + +‘#+CONSTANTS: name1=value1 ...’ + Set file-local values for constants that table formulas can use. + This line sets the local variable + ‘org-table-formula-constants-local’. The global version of this + variable is ‘org-table-formula-constants’. + +‘#+FILETAGS: :tag1:tag2:tag3:’ + Set tags that all entries in the file inherit from, including the + top-level entries. + +‘#+LINK: linkword replace’ + Each line specifies one abbreviation for one link. Use multiple + ‘LINK’ keywords for more, see *note Link Abbreviations::. The + corresponding variable is ‘org-link-abbrev-alist’. + +‘#+PRIORITIES: highest lowest default’ + This line sets the limits and the default for the priorities. All + three must be either letters A–Z or numbers 0–9. The highest + priority must have a lower ASCII number than the lowest priority. + +‘#+PROPERTY: Property_Name Value’ + This line sets a default inheritance value for entries in the + current buffer, most useful for specifying the allowed values of a + property. + +‘#+SETUPFILE: file’ + The setup file or a URL pointing to such file is for additional + in-buffer settings. Org loads this file and parses it for any + settings in it only when Org opens the main file. If URL is + specified, the contents are downloaded and stored in a temporary + file cache. ‘C-c C-c’ on the settings line parses and loads the + file, and also resets the temporary file cache. Org also parses + and loads the document during normal exporting process. Org parses + the contents of this document as if it was included in the buffer. + It can be another Org file. To visit the file—not a URL—use ‘C-c + '’ while point is on the line with the file name. + +‘#+STARTUP:’ + Startup options Org uses when first visiting a file. + + The first set of options deals with the initial visibility of the + outline tree. The corresponding variable for global default + settings is ‘org-startup-folded’ with a default value of + ‘showeverything’. + + ‘overview’ Top-level headlines only. + ‘content’ All headlines. + ‘showall’ No folding on any entry. + ‘show2levels’ Headline levels 1-2. + ‘show3levels’ Headline levels 1-3. + ‘show4levels’ Headline levels 1-4. + ‘show5levels’ Headline levels 1-5. + ‘showeverything’ Show even drawer contents. + + Dynamic virtual indentation is controlled by the variable + ‘org-startup-indented’(1). + + ‘indent’ Start with Org Indent mode turned on. + ‘noindent’ Start with Org Indent mode turned off. + + Dynamic virtual numeration of headlines is controlled by the + variable ‘org-startup-numerated’. + + ‘num’ Start with Org num mode turned on. + ‘nonum’ Start with Org num mode turned off. + + Aligns tables consistently upon visiting a file. The corresponding + variable is ‘org-startup-align-all-tables’ with ‘nil’ as default + value. + + ‘align’ Align all tables. + ‘noalign’ Do not align tables on startup. + + Shrink table columns with a width cookie. The corresponding + variable is ‘org-startup-shrink-all-tables’ with ‘nil’ as default + value. + + When visiting a file, inline images can be automatically displayed. + The corresponding variable is ‘org-startup-with-inline-images’, + with a default value ‘nil’ to avoid delays when visiting a file. + + ‘inlineimages’ Show inline images. + ‘noinlineimages’ Do not show inline images on startup. + + Logging the closing and reopening of TODO items and clock intervals + can be configured using these options (see variables + ‘org-log-done’, ‘org-log-note-clock-out’, and ‘org-log-repeat’). + + ‘logdone’ Record a timestamp when an item is marked as done. + ‘lognotedone’ Record timestamp and a note when DONE. + ‘nologdone’ Do not record when items are marked as done. + ‘logrepeat’ Record a time when reinstating a repeating item. + ‘lognoterepeat’ Record a note when reinstating a repeating item. + ‘nologrepeat’ Do not record when reinstating repeating item. + ‘lognoteclock-out’ Record a note when clocking out. + ‘nolognoteclock-out’ Do not record a note when clocking out. + ‘logreschedule’ Record a timestamp when scheduling time changes. + ‘lognotereschedule’ Record a note when scheduling time changes. + ‘nologreschedule’ Do not record when a scheduling date changes. + ‘logredeadline’ Record a timestamp when deadline changes. + ‘lognoteredeadline’ Record a note when deadline changes. + ‘nologredeadline’ Do not record when a deadline date changes. + ‘logrefile’ Record a timestamp when refiling. + ‘lognoterefile’ Record a note when refiling. + ‘nologrefile’ Do not record when refiling. + + Here are the options for hiding leading stars in outline headings, + and for indenting outlines. The corresponding variables are + ‘org-hide-leading-stars’ and ‘org-odd-levels-only’, both with a + default setting ‘nil’ (meaning ‘showstars’ and ‘oddeven’). + + ‘hidestars’ Make all but one of the stars starting a headline invisible. + ‘showstars’ Show all stars starting a headline. + ‘indent’ Virtual indentation according to outline level. + ‘noindent’ No virtual indentation according to outline level. + ‘odd’ Allow only odd outline levels (1, 3, ...). + ‘oddeven’ Allow all outline levels. + + To turn on custom format overlays over timestamps (variables + ‘org-put-time-stamp-overlays’ and + ‘org-time-stamp-overlay-formats’), use: + + ‘customtime’ Overlay custom time format. + + The following options influence the table spreadsheet (variable + ‘constants-unit-system’). + + ‘constcgs’ ‘constants.el’ should use the c-g-s unit system. + ‘constSI’ ‘constants.el’ should use the SI unit system. + + To influence footnote settings, use the following keywords. The + corresponding variables are ‘org-footnote-define-inline’, + ‘org-footnote-auto-label’, and ‘org-footnote-auto-adjust’. + + ‘fninline’ Define footnotes inline. + ‘fnnoinline’ Define footnotes in separate section. + ‘fnlocal’ Define footnotes near first reference, but not inline. + ‘fnprompt’ Prompt for footnote labels. + ‘fnauto’ Create ‘[fn:1]’-like labels automatically (default). + ‘fnconfirm’ Offer automatic label for editing or confirmation. + ‘fnadjust’ Automatically renumber and sort footnotes. + ‘nofnadjust’ Do not renumber and sort automatically. + + To hide blocks on startup, use these keywords. The corresponding + variable is ‘org-hide-block-startup’. + + ‘hideblocks’ Hide all begin/end blocks on startup. + ‘nohideblocks’ Do not hide blocks on startup. + + The display of entities as UTF-8 characters is governed by the + variable ‘org-pretty-entities’ and the keywords + + ‘entitiespretty’ Show entities as UTF-8 characters where possible. + ‘entitiesplain’ Leave entities plain. + +‘#+TAGS: TAG1(c1) TAG2(c2)’ + These lines (several such lines are allowed) specify the valid tags + in this file, and (potentially) the corresponding _fast tag + selection_ keys. The corresponding variable is ‘org-tag-alist’. + +‘#+TODO:’ +‘#+SEQ_TODO:’ +‘#+TYP_TODO:’ + These lines set the TODO keywords and their interpretation in the + current file. The corresponding variable is ‘org-todo-keywords’. + + ---------- Footnotes ---------- + + (1) Note that Org Indent mode also sets the ‘wrap-prefix’ property, +such that Visual Line mode (or purely setting ‘word-wrap’) wraps long +lines, including headlines, correctly indented. + + +File: org.info, Node: Regular Expressions, Next: Org Syntax, Prev: In-buffer Settings, Up: Miscellaneous + +17.9 Regular Expressions +======================== + +Org, as an Emacs mode, makes use of Elisp regular expressions for +searching, matching and filtering. Elisp regular expressions have a +somewhat different syntax then some common standards. Most notably, +alternation is indicated using ‘\|’ and matching groups are denoted by +‘\(...\)’. For example the string ‘home\|work’ matches either ‘home’ or +‘work’. + + For more information, see *note Regular Expressions in Emacs: +(emacs)Regexps. + + +File: org.info, Node: Org Syntax, Next: Documentation Access, Prev: Regular Expressions, Up: Miscellaneous + +17.10 Org Syntax +================ + +A reference document providing a formal description of Org’s syntax is +available as a draft on Worg +(https://orgmode.org/worg/dev/org-syntax.html), written and maintained +by Nicolas Goaziou. It defines Org’s core internal concepts such as +“headlines”, “sections”, “affiliated keywords”, “(greater) elements” and +“objects”. Each part of an Org document belongs to one of the previous +categories. + + To explore the abstract structure of an Org buffer, run this in a +buffer: + + M-: (org-element-parse-buffer) <RET> + +It outputs a list containing the buffer’s content represented as an +abstract structure. The export engine relies on the information stored +in this list. Most interactive commands—e.g., for structure +editing—also rely on the syntactic meaning of the surrounding context. + + You can probe the syntax of your documents with the command + + M-x org-lint <RET> + +It runs a number of checks to find common mistakes. It then displays +their location in a dedicated buffer, along with a description and a +“trust level”, since false-positive are possible. From there, you can +operate on the reports with the following keys: + +‘C-j’, ‘<TAB>’ Display the offending line +‘<RET>’ Move point to the offending line +‘g’ Check the document again +‘h’ Hide all reports from the same checker +‘i’ Also remove them from all subsequent checks +‘S’ Sort reports by the column at point + + +File: org.info, Node: Documentation Access, Next: Escape Character, Prev: Org Syntax, Up: Miscellaneous + +17.11 Context Dependent Documentation +===================================== + +‘C-c C-x I’ in an Org file tries to open a suitable section of the Org +manual depending on the syntax at point. For example, using it on a +headline displays “Document Structure” section. + + ‘q’ closes the Info window. + + +File: org.info, Node: Escape Character, Next: Code Evaluation Security, Prev: Documentation Access, Up: Miscellaneous + +17.12 Escape Character +====================== + +You may sometimes want to write text that looks like Org syntax, but +should really read as plain text. Org may use a specific escape +character in some situations, i.e., a backslash in macros (see *note +Macro Replacement::) and links (see *note Link Format::), or a comma in +source and example blocks (see *note Literal Examples::). In the +general case, however, we suggest to use the zero width space. You can +insert one with any of the following: + + C-x 8 <RET> zero width space <RET> + C-x 8 <RET> 200B <RET> + + For example, in order to write ‘[[1,2]]’ as-is in your document, you +may write instead + + [X[1,2]] + + where ‘X’ denotes the zero width space character. + + +File: org.info, Node: Code Evaluation Security, Next: Interaction, Prev: Escape Character, Up: Miscellaneous + +17.13 Code Evaluation and Security Issues +========================================= + +Unlike plain text, running code comes with risk. Each source code +block, in terms of risk, is equivalent to an executable file. Org +therefore puts a few confirmation prompts by default. This is to alert +the casual user from accidentally running untrusted code. + + For users who do not run code blocks or write code regularly, Org’s +default settings should suffice. However, some users may want to tweak +the prompts for fewer interruptions. To weigh the risks of automatic +execution of code blocks, here are some details about code evaluation. + + Org evaluates code in the following circumstances: + +_Source code blocks_ + Org evaluates source code blocks in an Org file during export. Org + also evaluates a source code block with the ‘C-c C-c’ key chord. + Users exporting or running code blocks must load files only from + trusted sources. Be wary of customizing variables that remove or + alter default security measures. + + -- User Option: org-confirm-babel-evaluate + When ‘t’, Org prompts the user for confirmation before + executing each code block. When ‘nil’, Org executes code + blocks without prompting the user for confirmation. When this + option is set to a custom function, Org invokes the function + with these two arguments: the source code language and the + body of the code block. The custom function must return + either a ‘t’ or ‘nil’, which determines if the user is + prompted. Each source code language can be handled separately + through this function argument. + + For example, here is how to execute ditaa code blocks without + prompting: + + (defun my-org-confirm-babel-evaluate (lang body) + (not (string= lang "ditaa"))) ;don't ask for ditaa + (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate) + +_Following ‘shell’ and ‘elisp’ links_ + Org has two link types that can directly evaluate code (see *note + External Links::). Because such code is not visible, these links + have a potential risk. Org therefore prompts the user when it + encounters such links. The customization variables are: + + -- User Option: org-link-shell-confirm-function + Function that prompts the user before executing a shell link. + + -- User Option: org-link-elisp-confirm-function + Function that prompts the user before executing an Emacs Lisp + link. + +_Formulas in tables_ + Formulas in tables (see *note The Spreadsheet::) are code that is + evaluated either by the Calc interpreter, or by the Emacs Lisp + interpreter. + + +File: org.info, Node: Interaction, Next: TTY Keys, Prev: Code Evaluation Security, Up: Miscellaneous + +17.14 Interaction with Other Packages +===================================== + +Org’s compatibility and the level of interaction with other Emacs +packages are documented here. + +* Menu: + +* Cooperation:: Packages Org cooperates with. +* Conflicts:: Packages that lead to conflicts. + + +File: org.info, Node: Cooperation, Next: Conflicts, Up: Interaction + +17.14.1 Packages that Org cooperates with +----------------------------------------- + +‘calc.el’ by Dave Gillespie + + Org uses the Calc package for implementing spreadsheet + functionality in its tables (see *note The Spreadsheet::). Org + also uses Calc for embedded calculations. See *note GNU Emacs Calc + Manual: (calc)Embedded Mode. + +‘constants.el’ by Carsten Dominik + + Org can use names for constants in formulas in tables. Org can + also use calculation suffixes for units, such as ‘M’ for ‘Mega’. + For a standard collection of such constants, install the + ‘constants’ package. Install version 2.0 of this package, + available at <http://www.astro.uva.nl/~dominik/Tools>. Org checks + if the function ‘constants-get’ has been autoloaded. Installation + instructions are in the file ‘constants.el’. + +‘cdlatex.el’ by Carsten Dominik + + Org mode can make use of the CDLaTeX package to efficiently enter + LaTeX fragments into Org files. See *note CDLaTeX mode::. + +‘imenu.el’ by Ake Stenhoff and Lars Lindberg + + Imenu creates dynamic menus based on an index of items in a file. + Org mode supports Imenu menus. Enable it with a mode hook as + follows: + + (add-hook 'org-mode-hook + (lambda () (imenu-add-to-menubar "Imenu"))) + + By default the index is two levels deep—you can modify the depth + using the option ‘org-imenu-depth’. + +‘speedbar.el’ by Eric M. Ludlam + + Speedbar package creates a special Emacs frame for displaying files + and index items in files. Org mode supports Speedbar; users can + drill into Org files directly from the Speedbar. The ‘<’ in the + Speedbar frame tweaks the agenda commands to that file or to a + subtree. + +‘table.el’ by Takaaki Ota + + Complex ASCII tables with automatic line wrapping, column- and + row-spanning, and alignment can be created using the Emacs table + package by Takaaki Ota. Org mode recognizes such tables and + exports them properly. ‘C-c '’ to edit these tables in a special + buffer, much like Org’s code blocks. Because of interference with + other Org mode functionality, Takaaki Ota tables cannot be edited + directly in the Org buffer. + + ‘C-c '’ (‘org-edit-special’) + Edit a ‘table.el’ table. Works when point is in a ‘table.el’ + table. + + ‘C-c ~​’ (‘org-table-create-with-table.el’) + Insert a ‘table.el’ table. If there is already a table at + point, this command converts it between the ‘table.el’ format + and the Org mode format. See the documentation string of the + command ‘org-convert-table’ for the restrictions under which + this is possible. + + +File: org.info, Node: Conflicts, Prev: Cooperation, Up: Interaction + +17.14.2 Packages that conflict with Org mode +-------------------------------------------- + +In Emacs, shift-selection combines motions of point with shift key to +enlarge regions. Emacs sets this mode by default. This conflicts with +Org’s use of ‘S-<cursor>’ commands to change timestamps, TODO keywords, +priorities, and item bullet types, etc. Since ‘S-<cursor>’ commands +outside of specific contexts do not do anything, Org offers the variable +‘org-support-shift-select’ for customization. Org mode accommodates +shift selection by (i) making it available outside of the special +contexts where special commands apply, and (ii) extending an existing +active region even if point moves across a special context. + +‘cua.el’ by Kim F. Storm + Org key bindings conflict with ‘S-<cursor>’ keys used by CUA mode. + For Org to relinquish these bindings to CUA mode, configure the + variable ‘org-replace-disputed-keys’. When set, Org moves the + following key bindings in Org files, and in the agenda buffer—but + not during date selection. + + ‘S-<UP>’ ⇒ ‘M-p’ ‘S-<DOWN>’ ⇒ ‘M-n’ + ‘S-<LEFT>’ ⇒ ‘M--’ ‘S-<RIGHT>’ ⇒ ‘M-+’ + ‘C-S-<LEFT>’ ⇒ ‘M-S--’ ‘C-S-<RIGHT>’ ⇒ ‘M-S-+’ + + Yes, these are unfortunately more difficult to remember. If you + want to have other replacement keys, look at the variable + ‘org-disputed-keys’. + +‘ecomplete.el’ by Lars Magne Ingebrigtsen + Ecomplete provides “electric” address completion in address header + lines in message buffers. Sadly Orgtbl mode cuts Ecomplete’s power + supply: no completion happens when Orgtbl mode is enabled in + message buffers while entering text in address header lines. If + one wants to use ecomplete one should _not_ follow the advice to + automagically turn on Orgtbl mode in message buffers (see *note + Orgtbl Mode::), but instead—after filling in the message + headers—turn on Orgtbl mode manually when needed in the messages + body. + +‘filladapt.el’ by Kyle Jones + Org mode tries to do the right thing when filling paragraphs, list + items and other elements. Many users reported problems using both + ‘filladapt.el’ and Org mode, so a safe thing to do is to disable + filladapt like this: + + (add-hook 'org-mode-hook 'turn-off-filladapt-mode) + +‘viper.el’ by Michael Kifer + + Viper uses ‘C-c /’ and therefore makes this key not access the + corresponding Org mode command ‘org-sparse-tree’. You need to find + another key for this command, or override the key in + ‘viper-vi-global-user-map’ with + + (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree) + +‘windmove.el’ by Hovav Shacham + + This package also uses the ‘S-<cursor>’ keys, so everything written + in the paragraph above about CUA mode also applies here. If you + want to make the windmove function active in locations where Org + mode does not have special functionality on ‘S-<cursor>’, add this + to your configuration: + + ;; Make windmove work in Org mode: + (add-hook 'org-shiftup-final-hook 'windmove-up) + (add-hook 'org-shiftleft-final-hook 'windmove-left) + (add-hook 'org-shiftdown-final-hook 'windmove-down) + (add-hook 'org-shiftright-final-hook 'windmove-right) + +‘yasnippet.el’ + The way Org mode binds the ‘<TAB>’ key (binding to ‘[tab]’ instead + of ‘"\t"’) overrules YASnippet’s access to this key. The following + code fixed this problem: + + (add-hook 'org-mode-hook + (lambda () + (setq-local yas/trigger-key [tab]) + (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand))) + + The latest version of YASnippet does not play well with Org mode. + If the above code does not fix the conflict, start by defining the + following function: + + (defun yas/org-very-safe-expand () + (let ((yas/fallback-behavior 'return-nil)) (yas/expand))) + + Then, tell Org mode to use that function: + + (add-hook 'org-mode-hook + (lambda () + (make-variable-buffer-local 'yas/trigger-key) + (setq yas/trigger-key [tab]) + (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand) + (define-key yas/keymap [tab] 'yas/next-field))) + + +File: org.info, Node: TTY Keys, Next: Protocols, Prev: Interaction, Up: Miscellaneous + +17.15 Using Org on a TTY +======================== + +Org provides alternative key bindings for TTY and modern mobile devices +that cannot perform movement commands on point and key bindings with +modifier keys. Some of these workarounds may be more cumbersome than +necessary. Users should look into customizing these further based on +their usage needs. For example, the normal ‘S-<cursor>’ for editing +timestamp might be better with ‘C-c .’ chord. + +Default Alternative 1 Speed key Alternative 2 +---------------------------------------------------------------- +‘S-<TAB>’ ‘C-u <TAB>’ ‘C’ +‘M-<LEFT>’ ‘C-c C-x l’ ‘l’ ‘Esc <LEFT>’ +‘M-S-<LEFT>’ ‘C-c C-x L’ ‘L’ +‘M-<RIGHT>’ ‘C-c C-x r’ ‘r’ ‘Esc <RIGHT>’ +‘M-S-<RIGHT>’ ‘C-c C-x R’ ‘R’ +‘M-<UP>’ ‘C-c C-x u’ ‘Esc <UP>’ +‘M-S-<UP>’ ‘C-c C-x U’ ‘U’ +‘M-<DOWN>’ ‘C-c C-x d’ ‘Esc <DOWN>’ +‘M-S-<DOWN>’ ‘C-c C-x D’ ‘D’ +‘S-<RET>’ ‘C-c C-x c’ +‘M-<RET>’ ‘C-c C-x m’ ‘Esc <RET>’ +‘M-S-<RET>’ ‘C-c C-x M’ +‘S-<LEFT>’ ‘C-c <LEFT>’ +‘S-<RIGHT>’ ‘C-c <RIGHT>’ +‘S-<UP>’ ‘C-c <UP>’ +‘S-<DOWN>’ ‘C-c <DOWN>’ +‘C-S-<LEFT>’ ‘C-c C-x <LEFT>’ +‘C-S-<RIGHT>’ ‘C-c C-x <RIGHT>’ + + +File: org.info, Node: Protocols, Next: Org Crypt, Prev: TTY Keys, Up: Miscellaneous + +17.16 Protocols for External Access +=================================== + +Org protocol is a tool to trigger custom actions in Emacs from external +applications. Any application that supports calling external programs +with an URL as argument may be used with this functionality. For +example, you can configure bookmarks in your web browser to send a link +to the current page to Org and create a note from it using capture (see +*note Capture::). You can also create a bookmark that tells Emacs to +open the local source file of a remote website you are browsing. + + In order to use Org protocol from an application, you need to +register ‘org-protocol://’ as a valid scheme-handler. External calls +are passed to Emacs through the ‘emacsclient’ command, so you also need +to ensure an Emacs server is running. More precisely, when the +application calls + + emacsclient "org-protocol://PROTOCOL?key1=val1&key2=val2" + +Emacs calls the handler associated to PROTOCOL with argument ‘(:key1 +val1 :key2 val2)’. + + Org protocol comes with three predefined protocols, detailed in the +following sections. Configure ‘org-protocol-protocol-alist’ to define +your own. + +* Menu: + +* The store-link protocol:: Store a link, push URL to kill-ring. +* The capture protocol:: Fill a buffer with external information. +* The open-source protocol:: Edit published contents. + + +File: org.info, Node: The store-link protocol, Next: The capture protocol, Up: Protocols + +17.16.1 The ‘store-link’ protocol +--------------------------------- + +Using the ‘store-link’ handler, you can copy links, to that they can be +inserted using ‘M-x org-insert-link’ or yanking. More precisely, the +command + + emacsclient "org-protocol://store-link?url=URL&title=TITLE" + +stores the following link: + + [[URL][TITLE]] + + In addition, URL is pushed on the kill-ring for yanking. You need to +encode URL and TITLE if they contain slashes, and probably quote those +for the shell. + + To use this feature from a browser, add a bookmark with an arbitrary +name, e.g., ‘Org: store-link’ and enter this as _Location_: + + javascript:location.href='org-protocol://store-link?' + + new URLSearchParams({url:location.href, title:document.title}); + + Title is an optional parameter. Another expression was recommended +earlier: + + javascript:location.href='org-protocol://store-link?url='+ + encodeURIComponent(location.href); + + The latter form is compatible with older Org versions from 9.0 to +9.4. + + +File: org.info, Node: The capture protocol, Next: The open-source protocol, Prev: The store-link protocol, Up: Protocols + +17.16.2 The ‘capture’ protocol +------------------------------ + +Activating the “capture” handler pops up a ‘Capture’ buffer in Emacs, +using acapture template. + + emacsclient "org-protocol://capture?template=X&url=URL&title=TITLE&body=BODY" + + To use this feature, add a bookmark with an arbitrary name, e.g., +‘Org: capture’, and enter this as ‘Location’: + + javascript:location.href='org-protocol://capture?' + + new URLSearchParams({ + template: 'x', url: window.location.href, + title: document.title, body: window.getSelection()}); + + You might have seen another expression: + + javascript:location.href='org-protocol://capture?template=x'+ + '&url='+encodeURIComponent(window.location.href)+ + '&title='+encodeURIComponent(document.title)+ + '&body='+encodeURIComponent(window.getSelection()); + + It is a bit more cluttered than the former one, but it is compatible +with previous Org versions 9.0-9.4. In these versions encoding of space +as “+” character was not supported by URI decoder. + + The capture template to be used can be specified in the bookmark +(like ‘X’ above). If unspecified, the template key is set in the +variable ‘org-protocol-default-template-key’. The following template +placeholders are available: + + %:link The URL + %:description The webpage title + %:annotation Equivalent to [[%:link][%:description]] + %i The selected text + + +File: org.info, Node: The open-source protocol, Prev: The capture protocol, Up: Protocols + +17.16.3 The ‘open-source’ protocol +---------------------------------- + +The ‘open-source’ handler is designed to help with editing local sources +when reading a document. To that effect, you can use a bookmark with +the following location: + + javascript:location.href='org-protocol://open-source?&url='+ + encodeURIComponent(location.href) + + The variable ‘org-protocol-project-alist’ maps URLs to local file +names, by stripping URL parameters from the end and replacing the +‘:base-url’ with ‘:working-directory’ and ‘:online-suffix’ with +‘:working-suffix’. For example, assuming you own a local copy of +‘https://orgmode.org/worg/’ contents at ‘/home/user/worg’, you can set +‘org-protocol-project-alist’ to the following + + (setq org-protocol-project-alist + '(("Worg" + :base-url "https://orgmode.org/worg/" + :working-directory "/home/user/worg/" + :online-suffix ".html" + :working-suffix ".org"))) + +If you are now browsing +‘https://orgmode.org/worg/org-contrib/org-protocol.html’ and find a typo +or have an idea about how to enhance the documentation, simply click the +bookmark and start editing. + + However, such mapping may not always yield the desired results. +Suppose you maintain an online store located at ‘https://example.com/’. +The local sources reside in ‘/home/user/example/’. It is common +practice to serve all products in such a store through one file and +rewrite URLs that do not match an existing file on the server. That +way, a request to ‘https://example.com/print/posters.html’ might be +rewritten on the server to something like +‘https://example.com/shop/products.php/posters.html.php’. The +‘open-source’ handler probably cannot find a file named +‘/home/user/example/print/posters.html.php’ and fails. + + Such an entry in ‘org-protocol-project-alist’ may hold an additional +property ‘:rewrites’. This property is a list of cons cells, each of +which maps a regular expression to a path relative to the +‘:working-directory’. + + Now map the URL to the path ‘/home/user/example/products.php’ by +adding ‘:rewrites’ rules like this: + + (setq org-protocol-project-alist + '(("example.com" + :base-url "https://example.com/" + :working-directory "/home/user/example/" + :online-suffix ".php" + :working-suffix ".php" + :rewrites (("example.com/print/" . "products.php") + ("example.com/$" . "index.php"))))) + +Since ‘example.com/$’ is used as a regular expression, it maps +‘http://example.com/’, ‘https://example.com’, ‘http://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 +existing file name is matched. + + Two functions can help you filling ‘org-protocol-project-alist’ with +valid contents: ‘org-protocol-create’ and ‘org-protocol-create-for-org’. +The latter is of use if you’re editing an Org file that is part of a +publishing project. + + +File: org.info, Node: Org Crypt, Next: Org Mobile, Prev: Protocols, Up: Miscellaneous + +17.17 Org Crypt +=============== + +Org Crypt encrypts the text of an entry, but not the headline, or +properties. Behind the scene, it uses the *note Emacs EasyPG Library: +(epa)Top. to encrypt and decrypt files, and EasyPG needs a correct *note +GnuPG: (gnupg)Top. setup. + + Any text below a headline that has a ‘crypt’ tag is automatically +encrypted when the file is saved. To use a different tag, customize the +‘org-crypt-tag-matcher’ setting. + + Here is a suggestion for Org Crypt settings in Emacs init file: + + (require 'org-crypt) + (org-crypt-use-before-save-magic) + (setq org-tags-exclude-from-inheritance '("crypt")) + + (setq org-crypt-key nil) + ;; GPG key to use for encryption + ;; Either the Key ID or set to nil to use symmetric encryption. + + (setq auto-save-default nil) + ;; Auto-saving does not cooperate with org-crypt.el: so you need to + ;; turn it off if you plan to use org-crypt.el quite often. Otherwise, + ;; you'll get an (annoying) message each time you start Org. + + ;; To turn it off only locally, you can insert this: + ;; + ;; # -*- buffer-auto-save-file-name: nil; -*- + + It’s possible to use different keys for different headings by +specifying the respective key as property ‘CRYPTKEY’, e.g.: + + * Totally secret :crypt: + :PROPERTIES: + :CRYPTKEY: 0x0123456789012345678901234567890123456789 + :END: + + Excluding the ‘crypt’ tag from inheritance prevents already encrypted +text from being encrypted again. + + +File: org.info, Node: Org Mobile, Prev: Org Crypt, Up: Miscellaneous + +17.18 Org Mobile +================ + +Org Mobile is a protocol for synchronizing Org files between Emacs and +other applications, e.g., on mobile devices. It enables offline-views +and capture support for an Org mode system that is rooted on a “real” +computer. The external application can also record changes to existing +entries. + + This appendix describes Org’s support for agenda view formats +compatible with Org Mobile. It also describes synchronizing changes, +such as to notes, between the mobile application and the computer. + + To change tags and TODO states in the mobile application, first +customize the variables ‘org-todo-keywords’, ‘org-tag-alist’ and +‘org-tag-persistent-alist’. These should cover all the important tags +and TODO keywords, even if Org files use only some of them. Though the +mobile application is expected to support in-buffer settings, it is +required to understand TODO states _sets_ (see *note Per-file +keywords::) and _mutually exclusive_ tags (see *note Setting Tags::) +only for those set in these variables. + +* Menu: + +* Setting up the staging area:: For the mobile device. +* Pushing to the mobile application:: Uploading Org files and agendas. +* Pulling from the mobile application:: Integrating captured and flagged items. + + +File: org.info, Node: Setting up the staging area, Next: Pushing to the mobile application, Up: Org Mobile + +17.18.1 Setting up the staging area +----------------------------------- + +The mobile application needs access to a file directory on a server(1) +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: + + (setq org-mobile-directory "~/orgmobile/") + + Alternatively, by using TRAMP (see *note TRAMP User Manual: +(tramp)Top.), ‘org-mobile-directory’ may point to a remote directory +accessible through, for example, SSH, SCP, or DAVS: + + (setq org-mobile-directory "/davs:user@remote.host:/org/webdav/") + + With a public server, consider encrypting the files. Org also +requires OpenSSL installed on the local computer. To turn on +encryption, set the same password in the mobile application and in +Emacs. Set the password in the variable ‘org-mobile-use-encryption’(2). +Note that even after the mobile application encrypts the file contents, +the file name remains visible on the file systems of the local computer, +the server, and the mobile device. + + ---------- Footnotes ---------- + + (1) For a server to host files, consider using a WebDAV server, such +as Nextcloud (https://nextcloud.com). Additional help is at this FAQ +entry (https://orgmode.org/worg/org-faq.html#mobileorg_webdav). + + (2) If Emacs is configured for safe storing of passwords, then +configure the variable ‘org-mobile-encryption-password’; please read the +docstring of that variable. + + +File: org.info, Node: Pushing to the mobile application, Next: Pulling from the mobile application, Prev: Setting up the staging area, Up: Org Mobile + +17.18.2 Pushing to the mobile application +----------------------------------------- + +The command ‘org-mobile-push’ copies files listed in ‘org-mobile-files’ +into the staging area. Files include agenda files (as listed in +‘org-agenda-files’). Customize ‘org-mobile-files’ to add other files. +File names are staged with paths relative to ‘org-directory’, so all +files should be inside this directory(1). + + Push creates a special Org file ‘agendas.org’ with custom agenda +views defined by the user(2). + + Finally, Org writes the file ‘index.org’, containing links to other +files. The mobile application reads this file first from the server to +determine what other files to download for agendas. For faster +downloads, it is expected to only read files whose checksums(3) have +changed. + + ---------- Footnotes ---------- + + (1) Symbolic links in ‘org-directory’ need to have the same name as +their targets. + + (2) 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. + + (3) Checksums are stored automatically in the file ‘checksums.dat’. + + +File: org.info, Node: Pulling from the mobile application, Prev: Pushing to the mobile application, Up: Org Mobile + +17.18.3 Pulling from the mobile application +------------------------------------------- + +The command ‘org-mobile-pull’ synchronizes changes with the server. +More specifically, it first pulls the Org files for viewing. It then +appends captured entries and pointers to flagged or changed entries to +the file ‘mobileorg.org’ on the server. Org ultimately integrates its +data in an inbox file format, through the following steps: + + 1. Org moves all entries found in ‘mobileorg.org’(1) and appends them + to the file pointed to by the variable ‘org-mobile-inbox-for-pull’. + It should reside neither in the staging area nor on the server. + Each captured entry and each editing event is a top-level entry in + the inbox file. + + 2. After moving the entries, Org processes changes to the shared + files. Some of them are applied directly and without user + interaction. Examples include changes to tags, TODO state, + headline and body text. Entries requiring further action are + tagged as ‘FLAGGED’. Org marks entries with problems with an error + message in the inbox. They have to be resolved manually. + + 3. Org generates an agenda view for flagged entries for user + intervention to clean up. For notes stored in flagged entries, Org + displays them in the echo area when point is on the corresponding + agenda item. + + ‘?’ + Pressing ‘?’ displays the entire flagged note in another + window. Org also pushes it to the kill ring. To store + flagged note as a normal note, use ‘? z C-y C-c C-c’. + Pressing ‘?’ twice does these things: first it removes the + ‘FLAGGED’ tag; second, it removes the flagged note from the + property drawer; third, it signals that manual editing of the + flagged entry is now finished. + + From the agenda dispatcher, ‘?’ returns to the view to finish +processing flagged entries. Note that these entries may not be the most +recent since the mobile application searches files that were last +pulled. To get an updated agenda view with changes since the last pull, +pull again. + + ---------- Footnotes ---------- + + (1) The file will be empty after this operation. + + +File: org.info, Node: Hacking, Next: History and Acknowledgments, Prev: Miscellaneous, Up: Top + +Appendix A Hacking +****************** + +This appendix describes some ways a user can extend the functionality of +Org. + +* Menu: + +* Hooks:: How to reach into Org’s internals. +* Add-on Packages:: Available extensions. +* Adding Hyperlink Types:: New custom link types. +* Adding Export Back-ends:: How to write new export back-ends. +* Tables in Arbitrary Syntax:: Orgtbl for LaTeX and other programs. +* Dynamic Blocks:: Automatically filled blocks. +* Special Agenda Views:: Customized views. +* Speeding Up Your Agendas:: Tips on how to speed up your agendas. +* Extracting Agenda Information:: Post-processing agenda information. +* Using the Property API:: Writing programs that use entry properties. +* Using the Mapping API:: Mapping over all or selected entries. + + +File: org.info, Node: Hooks, Next: Add-on Packages, Up: Hacking + +A.1 Hooks +========= + +Org has a large number of hook variables for adding functionality. This +appendix illustrates using a few. A complete list of hooks with +documentation is maintained by the Worg project at +<https://orgmode.org/worg/doc.html#hooks>. + + +File: org.info, Node: Add-on Packages, Next: Adding Hyperlink Types, Prev: Hooks, Up: Hacking + +A.2 Add-on Packages +=================== + +Various authors wrote a large number of add-on packages for Org. Some +of these packages used to be part of the ‘org-mode’ repository but are +now hosted in a separate ‘org-contrib’ repository here +(https://git.sr.ht/~bzg/org-contrib). A Worg page with more information +is at: <https://orgmode.org/worg/org-contrib/>. + + +File: org.info, Node: Adding Hyperlink Types, Next: Adding Export Back-ends, Prev: Add-on Packages, Up: Hacking + +A.3 Adding Hyperlink Types +========================== + +Org has many built-in hyperlink types (see *note Hyperlinks::), and an +interface for adding new link types. The following example shows the +process of adding Org links to Unix man pages, which look like this + + [[man:printf][The printf manual]] + +The following ‘ol-man.el’ file implements it + + ;;; ol-man.el - Support for links to man pages in Org mode + (require 'ol) + + (org-link-set-parameters "man" + :follow #'org-man-open + :export #'org-man-export + :store #'org-man-store-link) + + (defcustom org-man-command 'man + "The Emacs command to be used to display a man page." + :group 'org-link + :type '(choice (const man) (const woman))) + + (defun org-man-open (path _) + "Visit the manpage on PATH. + PATH should be a topic that can be thrown at the man command." + (funcall org-man-command path)) + + (defun org-man-store-link () + "Store a link to a man page." + (when (memq major-mode '(Man-mode woman-mode)) + ;; This is a man page, we do make this link. + (let* ((page (org-man-get-page-name)) + (link (concat "man:" page)) + (description (format "Man page for %s" page))) + (org-link-store-props + :type "man" + :link link + :description description)))) + + (defun org-man-get-page-name () + "Extract the page name from the buffer name." + ;; This works for both `Man-mode' and `woman-mode'. + (if (string-match " \\(\\S-+\\)\\*" (buffer-name)) + (match-string 1 (buffer-name)) + (error "Cannot create link to this man page"))) + + (defun org-man-export (link description format _) + "Export a man page link from Org files." + (let ((path (format "http://man.he.net/?topic=%s§ion=all" link)) + (desc (or description link))) + (pcase format + (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc)) + (`latex (format "\\href{%s}{%s}" path desc)) + (`texinfo (format "@uref{%s,%s}" path desc)) + (`ascii (format "%s (%s)" desc path)) + (t path)))) + + (provide ol-man) + ;;; ol-man.el ends here + +To activate links to man pages in Org, enter this in the Emacs init +file: + + (require 'ol-man) + +A review of ‘ol-man.el’: + + 1. First, ‘(require 'ol)’ ensures that ‘ol.el’ is loaded. + + 2. Then ‘org-link-set-parameters’ defines a new link type with ‘man’ + prefix and associates functions for following, exporting and + storing such links. See the variable ‘org-link-parameters’ for a + complete list of possible associations. + + 3. The rest of the file implements necessary variables and functions. + + For example, ‘org-man-store-link’ is responsible for storing a link + when ‘org-store-link’ (see *note Handling Links::) is called from a + buffer displaying a man page. It first checks if the major mode is + appropriate. If check fails, the function returns ‘nil’, which + means it isn’t responsible for creating a link to the current + buffer. Otherwise the function makes a link string by combining + the ‘man:’ prefix with the man topic. It also provides a default + description. The function ‘org-insert-link’ can insert it back + into an Org buffer later on. + + +File: org.info, Node: Adding Export Back-ends, Next: Tables in Arbitrary Syntax, Prev: Adding Hyperlink Types, Up: Hacking + +A.4 Adding Export Back-ends +=========================== + +Org’s export engine makes it easy for writing new back-ends. The +framework on which the engine was built makes it easy to derive new +back-ends from existing ones. + + The two main entry points to the export engine are: +‘org-export-define-backend’ and ‘org-export-define-derived-backend’. To +grok these functions, see ‘ox-latex.el’ for an example of defining a new +back-end from scratch, and ‘ox-beamer.el’ for an example of deriving +from an existing engine. + + For creating a new back-end from scratch, first set its name as a +symbol in an alist consisting of elements and export functions. To make +the back-end visible to the export dispatcher, set ‘:menu-entry’ +keyword. For export options specific to this back-end, set the +‘:options-alist’. + + For creating a new back-end from an existing one, set +‘:translate-alist’ to an alist of export functions. This alist replaces +the parent back-end functions. + + For complete documentation, see the Org Export Reference on Worg +(https://orgmode.org/worg/dev/org-export-reference.html). + + +File: org.info, Node: Tables in Arbitrary Syntax, Next: Dynamic Blocks, Prev: Adding Export Back-ends, Up: Hacking + +A.5 Tables in Arbitrary Syntax +============================== + +Due to Org’s success in handling tables with Orgtbl, a frequently +requested feature is the use of Org’s table functions in other modes, +e.g., LaTeX. This would be hard to do in a general way without +complicated customization nightmares. Moreover, that would take Org +away from its simplicity roots that Orgtbl has proven. There is, +however, an alternate approach to accomplishing the same. + + This approach involves implementing a custom _translate_ function +that operates on a native Org _source table_ to produce a table in +another format. This strategy would keep the excellently working Orgtbl +simple and isolate complications, if any, confined to the translate +function. To add more alien table formats, we just add more translate +functions. Also the burden of developing custom translate functions for +new table formats is in the hands of those who know those formats best. + +* Menu: + +* Radio tables:: Sending and receiving radio tables. +* A LaTeX example:: Step by step, almost a tutorial. +* Translator functions:: Copy and modify. + + +File: org.info, Node: Radio tables, Next: A LaTeX example, Up: Tables in Arbitrary Syntax + +A.5.1 Radio tables +------------------ + +Radio tables are target locations for translated tables that are not +near their source. Org finds the target location and inserts the +translated table. + + The key to finding the target location is the magic words ‘BEGIN/END +RECEIVE ORGTBL’. They have to appear as comments in the current mode. +If the mode is C, then: + + /* BEGIN RECEIVE ORGTBL table_name */ + /* END RECEIVE ORGTBL table_name */ + + At the location of source, Org needs a special line to direct Orgtbl +to translate and to find the target for inserting the translated table. +For example: + + #+ORGTBL: SEND table_name translation_function arguments ... + +‘table_name’ is the table’s reference name, which is also used in the +receiver lines, and the ‘translation_function’ is the Lisp function that +translates. This line, in addition, may also contain alternating key +and value arguments at the end. The translation function gets these +values as a property list. A few standard parameters are already +recognized and acted upon before the translation function is called: + +‘:skip N’ + Skip the first N lines of the table. Hlines do count; include them + if they are to be skipped. + +‘:skipcols (n1 n2 ...)’ + List of columns to be skipped. First Org automatically discards + columns with calculation marks and then sends the table to the + translator function, which then skips columns as specified in + ‘skipcols’. + + To keep the source table intact in the buffer without being disturbed +when the source file is compiled or otherwise being worked on, use one +of these strategies: + + • Place the table in a block comment. For example, in C mode you + could wrap the table between ‘/*’ and ‘*/’ lines. + + • Put the table after an “end” statement. For example ‘\bye’ in TeX + and ‘\end{document}’ in LaTeX. + + • Comment and un-comment each line of the table during edits. The + ‘M-x orgtbl-toggle-comment’ command makes toggling easy. + + +File: org.info, Node: A LaTeX example, Next: Translator functions, Prev: Radio tables, Up: Tables in Arbitrary Syntax + +A.5.2 A LaTeX example of radio tables +------------------------------------- + +To wrap a source table in LaTeX, use the ‘comment’ environment provided +by ‘comment.sty’(1). To activate it, put ‘\usepackage{comment}’ in the +document header. Orgtbl mode inserts a radio table skeleton(2) with the +command ‘M-x orgtbl-insert-radio-table’, which prompts for a table name. +For example, if ‘salesfigures’ is the name, the template inserts: + + % BEGIN RECEIVE ORGTBL salesfigures + % END RECEIVE ORGTBL salesfigures + \begin{comment} + #+ORGTBL: SEND salesfigures orgtbl-to-latex + | | | + \end{comment} + +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(3): + + % BEGIN RECEIVE ORGTBL salesfigures + % END RECEIVE ORGTBL salesfigures + \begin{comment} + #+ORGTBL: SEND salesfigures orgtbl-to-latex + | Month | Days | Nr sold | per day | + |-------+------+---------+---------| + | Jan | 23 | 55 | 2.4 | + | Feb | 21 | 16 | 0.8 | + | March | 22 | 278 | 12.6 | + #+TBLFM: $4=$3/$2;%.1f + % $ (optional extra dollar to keep Font Lock happy, see footnote) + \end{comment} + + After editing, ‘C-c C-c’ inserts the translated table at the target +location, between the two marker lines. + + For hand-made custom tables, note that the translator needs to skip +the first two lines of the source table. Also the command has to +_splice_ out the target table without the header and footer. + + \begin{tabular}{lrrr} + Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\ + % BEGIN RECEIVE ORGTBL salesfigures + % END RECEIVE ORGTBL salesfigures + \end{tabular} + % + \begin{comment} + #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2 + | Month | Days | Nr sold | per day | + |-------+------+---------+---------| + | Jan | 23 | 55 | 2.4 | + | Feb | 21 | 16 | 0.8 | + | March | 22 | 278 | 12.6 | + #+TBLFM: $4=$3/$2;%.1f + \end{comment} + + The LaTeX translator function ‘orgtbl-to-latex’ is already part of +Orgtbl mode and uses a ‘tabular’ environment to typeset the table and +marks horizontal lines with ‘\hline’. For additional parameters to +control output, see *note Translator functions::: + +‘:splice BOOLEAN’ + When {{{var(BOOLEAN}}} is non-‘nil’, return only table body lines; + i.e., not wrapped in ‘tabular’ environment. Default is ‘nil’. + +‘:fmt FMT’ + Format string to warp each field. It should contain ‘%s’ for the + original field value. For example, to wrap each field value in + dollar symbol, you could use ‘:fmt "$%s$"’. Format can also wrap a + property list with column numbers and formats, for example ‘:fmt (2 + "$%s$" 4 "%s\\%%")’. In place of a string, a function of one + argument can be used; the function must return a formatted string. + +‘:efmt EFMT’ + Format numbers as exponentials. The spec should have ‘%s’ twice + for inserting mantissa and exponent, for example + ‘"%s\\times10^{%s}"’. This may also be a property list with column + numbers and formats, for example ‘:efmt (2 "$%s\\times10^{%s}$" 4 + "$%s\\cdot10^{%s}$")’. After EFMT has been applied to a value, + FMT—see above—is also applied. Functions with two arguments can be + supplied instead of strings. By default, no special formatting is + applied. + + ---------- Footnotes ---------- + + (1) <https://www.ctan.org/pkg/comment> + + (2) By default this works only for LaTeX, HTML, and Texinfo. +Configure the variable ‘orgtbl-radio-table-templates’ to install +templates for other modes. + + (3) 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 expressions. +If you are using AUCTeX with the font-latex library, a much better +solution is to add the ‘comment’ environment to the variable +‘LaTeX-verbatim-environments’. + + +File: org.info, Node: Translator functions, Prev: A LaTeX example, Up: Tables in Arbitrary Syntax + +A.5.3 Translator functions +-------------------------- + +Orgtbl mode has built-in translator functions: ‘orgtbl-to-csv’ +(comma-separated values), ‘orgtbl-to-tsv’ (TAB-separated values), +‘orgtbl-to-latex’, ‘orgtbl-to-html’, ‘orgtbl-to-texinfo’, +‘orgtbl-to-unicode’ and ‘orgtbl-to-orgtbl’. They use the generic +translator, ‘orgtbl-to-generic’, which delegates translations to various +export back-ends. + + Properties passed to the function through the ‘ORGTBL SEND’ line take +precedence over properties defined inside the function. For example, +this overrides the default LaTeX line endings, ‘\\’, with ‘\\[2mm]’: + + #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]" + + For a new language translator, define a converter function. It can +be a generic function, such as shown in this example. It marks a +beginning and ending of a table with ‘!BTBL!’ and ‘!ETBL!’; a beginning +and ending of lines with ‘!BL!’ and ‘!EL!’; and uses a TAB for a field +separator: + + (defun orgtbl-to-language (table params) + "Convert the orgtbl-mode TABLE to language." + (orgtbl-to-generic + table + (org-combine-plists + '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t") + params))) + +The documentation for the ‘orgtbl-to-generic’ function shows a complete +list of parameters, each of which can be passed through to +‘orgtbl-to-latex’, ‘orgtbl-to-texinfo’, and any other function using +that generic function. + + For complicated translations the generic translator function could be +replaced by a custom translator function. Such a custom function must +take two arguments and return a single string containing the formatted +table. The first argument is the table whose lines are a list of fields +or the symbol ‘hline’. The second argument is the property list +consisting of parameters specified in the ‘#+ORGTBL: SEND’ line. Please +share your translator functions by posting them to the Org users mailing +list, at <emacs-orgmode@gnu.org>. + + +File: org.info, Node: Dynamic Blocks, Next: Special Agenda Views, Prev: Tables in Arbitrary Syntax, Up: Hacking + +A.6 Dynamic Blocks +================== + +Org supports _dynamic blocks_ in Org documents. They are inserted with +begin and end markers like any other code block, but the contents are +updated automatically by a user function. + + You can insert a dynamic block with +‘org-dynamic-block-insert-dblock’, which is bound to ‘C-c C-x x’ by +default. For example, ‘C-c C-x x c l o c k t a b l e <RET>’ inserts a +table that updates the work time (see *note Clocking Work Time::). + + Dynamic blocks can have names and function parameters. The syntax is +similar to source code block specifications: + + #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ... + ... + #+END: + + These commands update dynamic blocks: + +‘C-c C-x C-u’ (‘org-dblock-update’) + Update dynamic block at point. + +‘C-u C-c C-x C-u’ + Update all dynamic blocks in the current file. + + Before updating a dynamic block, Org removes content between the +‘BEGIN’ and ‘END’ markers. Org then reads the parameters on the ‘BEGIN’ +line for passing to the writer function as a plist. The previous +content of the dynamic block becomes erased from the buffer and appended +to the plist under ‘:content’. + + The syntax for naming a writer function with a dynamic block labeled +‘myblock’ is: ‘org-dblock-write:myblock’. + + The following is an example of a dynamic block and a block writer +function that updates the time when the function was last run: + + #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M" + ... + #+END: + +The dynamic block’s writer function: + + (defun org-dblock-write:block-update-time (params) + (let ((fmt (or (plist-get params :format) "%d. %m. %Y"))) + (insert "Last block update at: " + (format-time-string fmt)))) + + To keep dynamic blocks up-to-date in an Org file, use the function, +‘org-update-all-dblocks’ in hook, such as ‘before-save-hook’. The +‘org-update-all-dblocks’ function does not run if the file is not in Org +mode. + + Dynamic blocks, like any other block, can be narrowed with +‘org-narrow-to-block’. + + +File: org.info, Node: Special Agenda Views, Next: Speeding Up Your Agendas, Prev: Dynamic Blocks, Up: Hacking + +A.7 Special Agenda Views +======================== + +Org provides a special hook to further limit items in agenda views: +‘agenda’, ‘agenda*’(1), ‘todo’, ‘alltodo’, ‘tags’, ‘tags-todo’, +‘tags-tree’. Specify a custom function that tests inclusion of every +matched item in the view. This function can also skip as much as is +needed. + + For a global condition applicable to agenda views, use the +‘org-agenda-skip-function-global’ variable. Org uses a global condition +with ‘org-agenda-skip-function’ for custom searching. + + This example defines a function for a custom view showing TODO items +with ‘waiting’ status. Manually this is a multi-step search process, +but with a custom view, this can be automated as follows: + + The custom function searches the subtree for the ‘waiting’ tag and +returns ‘nil’ on match. Otherwise it gives the location from where the +search continues. + + (defun my-skip-unless-waiting () + "Skip trees that are not waiting" + (let ((subtree-end (save-excursion (org-end-of-subtree t)))) + (if (re-search-forward ":waiting:" subtree-end t) + nil ; tag found, do not skip + subtree-end))) ; tag not found, continue after end of subtree + + To use this custom function in a custom agenda command: + + (org-add-agenda-custom-command + '("b" todo "PROJECT" + ((org-agenda-skip-function 'my-skip-unless-waiting) + (org-agenda-overriding-header "Projects waiting for something: ")))) + + Note that this also binds ‘org-agenda-overriding-header’ to a more +meaningful string suitable for the agenda view. + + Search for entries with a limit set on levels for the custom search. +This is a general approach to creating custom searches in Org. To +include all levels, use ‘LEVEL>0’(2). Then to selectively pick the +matched entries, use ‘org-agenda-skip-function’, which also accepts Lisp +forms, such as ‘org-agenda-skip-entry-if’ and +‘org-agenda-skip-subtree-if’. For example: + +‘(org-agenda-skip-entry-if 'scheduled)’ + Skip current entry if it has been scheduled. + +‘(org-agenda-skip-entry-if 'notscheduled)’ + Skip current entry if it has not been scheduled. + +‘(org-agenda-skip-entry-if 'deadline)’ + Skip current entry if it has a deadline. + +‘(org-agenda-skip-entry-if 'scheduled 'deadline)’ + Skip current entry if it has a deadline, or if it is scheduled. + +‘(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))’ + Skip current entry if the TODO keyword is TODO or WAITING. + +‘(org-agenda-skip-entry-if 'todo 'done)’ + Skip current entry if the TODO keyword marks a DONE state. + +‘(org-agenda-skip-entry-if 'timestamp)’ + Skip current entry if it has any timestamp, may also be deadline or + scheduled. + +‘(org-agenda-skip-entry-if 'regexp "regular expression")’ + Skip current entry if the regular expression matches in the entry. + +‘(org-agenda-skip-entry-if 'notregexp "regular expression")’ + Skip current entry unless the regular expression matches. + +‘(org-agenda-skip-subtree-if 'regexp "regular expression")’ + Same as above, but check and skip the entire subtree. + + The following is an example of a search for ‘waiting’ without the +special function: + + (org-add-agenda-custom-command + '("b" todo "PROJECT" + ((org-agenda-skip-function '(org-agenda-skip-subtree-if + 'regexp ":waiting:")) + (org-agenda-overriding-header "Projects waiting for something: ")))) + + ---------- Footnotes ---------- + + (1) The ‘agenda*’ view is the same as ‘agenda’ except that it only +considers _appointments_, i.e., scheduled and deadline items that have a +time specification ‘[h]h:mm’ in their time-stamps. + + (2) Note that, for ‘org-odd-levels-only’, a level number corresponds +to order in the hierarchy, not to the number of stars. + + +File: org.info, Node: Speeding Up Your Agendas, Next: Extracting Agenda Information, Prev: Special Agenda Views, Up: Hacking + +A.8 Speeding Up Your Agendas +============================ + +Some agenda commands slow down when the Org files grow in size or +number. Here are tips to speed up: + + • Reduce the number of Org agenda files to avoid slowdowns due to + hard drive accesses. + + • Reduce the number of DONE and archived headlines so agenda + operations that skip over these can finish faster. + + • Do not dim blocked tasks: + + (setq org-agenda-dim-blocked-tasks nil) + + • Stop preparing agenda buffers on startup: + + (setq org-agenda-inhibit-startup t) + + • Disable tag inheritance for agendas: + + (setq org-agenda-use-tag-inheritance nil) + + These options can be applied to selected agenda views. For more +details about generation of agenda views, see the docstrings for the +relevant variables, and this dedicated Worg page +(https://orgmode.org/worg/agenda-optimization.html) for agenda +optimization. + + +File: org.info, Node: Extracting Agenda Information, Next: Using the Property API, Prev: Speeding Up Your Agendas, Up: Hacking + +A.9 Extracting Agenda Information +================================= + +Org provides commands to access agendas through Emacs batch mode. +Through this command-line interface, agendas are automated for further +processing or printing. + + ‘org-batch-agenda’ creates an agenda view in ASCII and outputs to +standard output. This command takes one string parameter. When string +consists of a single character, Org uses it as a key to +‘org-agenda-custom-commands’. These are the same ones available through +the agenda dispatcher (see *note Agenda Dispatcher::). + + This example command line directly prints the TODO list to the +printer: + + emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr + + When the string parameter length is two or more characters, Org +matches it with tags/TODO strings. For example, this example command +line prints items tagged with ‘shop’, but excludes items tagged with +‘NewYork’: + + emacs -batch -l ~/.emacs \ + -eval '(org-batch-agenda "+shop-NewYork")' | lpr + +An example showing on-the-fly parameter modifications: + + emacs -batch -l ~/.emacs \ + -eval '(org-batch-agenda "a" \ + org-agenda-span (quote month) \ + org-agenda-include-diary nil \ + org-agenda-files (quote ("~/org/project.org")))' \ + | lpr + +which produces an agenda for the next 30 days from just the +‘~/org/projects.org’ file. + + For structured processing of agenda output, use +‘org-batch-agenda-csv’ with the following fields: + +category + The category of the item +head + The headline, without TODO keyword, TAGS and PRIORITY +type + The type of the agenda entry, can be + + ‘todo’ selected in TODO match + ‘tagsmatch’ selected in tags match + ‘diary’ imported from diary + ‘deadline’ a deadline + ‘scheduled’ scheduled + ‘timestamp’ appointment, selected by timestamp + ‘closed’ entry was closed on date + ‘upcoming-deadline’ warning about nearing deadline + ‘past-scheduled’ forwarded scheduled item + ‘block’ entry has date block including date + +todo + The TODO keyword, if any +tags + All tags including inherited ones, separated by colons +date + The relevant date, like ‘2007-2-14’ +time + The time, like ‘15:00-16:50’ +extra + String with extra planning info +priority-l + The priority letter if any was given +priority-n + The computed numerical priority + + If the selection of the agenda item was based on a timestamp, +including those items with ‘DEADLINE’ and ‘SCHEDULED’ keywords, then Org +includes date and time in the output. + + If the selection of the agenda item was based on a timestamp (or +deadline/scheduled), then Org includes date and time in the output. + + Here is an example of a post-processing script in Perl. It takes the +CSV output from Emacs and prints with a checkbox: + + #!/usr/bin/perl + + # define the Emacs command to run + $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'"; + + # run it and capture the output + $agenda = qx{$cmd 2>/dev/null}; + + # loop over all lines + foreach $line (split(/\n/,$agenda)) { + # get the individual values + ($category,$head,$type,$todo,$tags,$date,$time,$extra, + $priority_l,$priority_n) = split(/,/,$line); + # process and print + print "[ ] $head\n"; + } + + +File: org.info, Node: Using the Property API, Next: Using the Mapping API, Prev: Extracting Agenda Information, Up: Hacking + +A.10 Using the Property API +=========================== + +Here is a description of the functions that can be used to work with +properties. + + -- Function: org-entry-properties &optional pom which + Get all properties of the entry at point-or-marker POM. This + includes the TODO keyword, the tags, time strings for deadline, + scheduled, and clocking, and any additional properties defined in + the entry. The return value is an alist. Keys may occur multiple + times if the property key was used several times. POM may also be + ‘nil’, in which case the current entry is used. If WHICH is ‘nil’ + or ‘all’, get all properties. If WHICH is ‘special’ or ‘standard’, + only get that subclass. + + -- Function: org-entry-get pom property &optional inherit + Get value of PROPERTY for entry at point-or-marker POM. By + default, this only looks at properties defined locally in the + entry. If INHERIT is non-‘nil’ and the entry does not have the + property, then also check higher levels of the hierarchy. If + INHERIT is the symbol ‘selective’, use inheritance if and only if + the setting of ‘org-use-property-inheritance’ selects PROPERTY for + inheritance. + + -- Function: org-entry-delete pom property + Delete the property PROPERTY from entry at point-or-marker POM. + + -- Function: org-entry-put pom property value + Set PROPERTY to VALUES for entry at point-or-marker POM. + + -- Function: org-buffer-property-keys &optional include-specials + Get all property keys in the current buffer. + + -- Function: org-insert-property-drawer + Insert a property drawer for the current entry. Also + + -- Function: org-entry-put-multivalued-property pom property &rest + values + Set PROPERTY at point-or-marker POM to VALUES. VALUES should be a + list of strings. They are concatenated, with spaces as separators. + + -- Function: org-entry-get-multivalued-property pom property + Treat the value of the property PROPERTY as a whitespace-separated + list of values and return the values as a list of strings. + + -- Function: org-entry-add-to-multivalued-property pom property value + Treat the value of the property PROPERTY as a whitespace-separated + list of values and make sure that VALUE is in this list. + + -- Function: org-entry-remove-from-multivalued-property pom property + value + Treat the value of the property PROPERTY as a whitespace-separated + list of values and make sure that VALUE is _not_ in this list. + + -- Function: org-entry-member-in-multivalued-property pom property + value + Treat the value of the property PROPERTY as a whitespace-separated + list of values and check if VALUE is in this list. + + -- User Option: org-property-allowed-value-functions + Hook for functions supplying allowed values for a specific + property. The functions must take a single argument, the name of + the property, and return a flat list of allowed values. If ‘:ETC’ + is one of the values, use the values as completion help, but allow + also other values to be entered. The functions must return ‘nil’ + if they are not responsible for this property. + + +File: org.info, Node: Using the Mapping API, Prev: Using the Property API, Up: Hacking + +A.11 Using the Mapping API +========================== + +Org has sophisticated mapping capabilities to find all entries +satisfying certain criteria. Internally, this functionality is used to +produce agenda views, but there is also an API that can be used to +execute arbitrary functions for each or selected entries. The main +entry point for this API is: + + -- Function: org-map-entries func &optional match scope &rest skip + Call FUNC at each headline selected by MATCH in SCOPE. + + FUNC is a function or a Lisp form. With point positioned at the + beginning of the headline, call the function without arguments. + Org returns an alist of return values of calls to the function. + + To avoid preserving point, Org wraps the call to FUNC in + ‘save-excursion’ form. After evaluation, Org moves point to the + end of the line that was just processed. Search continues from + that point forward. This may not always work as expected under + some conditions, such as if the current sub-tree was removed by a + previous archiving operation. In such rare circumstances, Org + skips the next entry entirely when it should not. To stop Org from + such skips, make FUNC set the variable ‘org-map-continue-from’ to a + specific buffer position. + + MATCH is a tags/property/TODO match. Org iterates only matched + headlines. Org iterates over all headlines when MATCH is ‘nil’ or + ‘t’. + + SCOPE determines the scope of this command. It can be any of: + + ‘nil’ + The current buffer, respecting the restriction, if any. + + ‘tree’ + The subtree started with the entry at point. + + ‘region’ + The entries within the active region, if any. + + ‘file’ + The current buffer, without restriction. + + ‘file-with-archives’ + The current buffer, and any archives associated with it. + + ‘agenda’ + All agenda files. + + ‘agenda-with-archives’ + All agenda files with any archive files associated with them. + + list of filenames + If this is a list, all files in the list are scanned. + + The remaining arguments are treated as settings for the scanner’s + skipping facilities. Valid arguments are: + + ‘archive’ + Skip trees with the ‘ARCHIVE’ tag. + + ‘comment’ + Skip trees with the COMMENT keyword. + + function or Lisp form + Used as value for ‘org-agenda-skip-function’, so whenever the + function returns ‘t’, FUNC is called for that entry and search + continues from the point where the function leaves it. + + The mapping routine can call any arbitrary function, even functions +that change meta data or query the property API (see *note Using the +Property API::). Here are some handy functions: + + -- Function: org-todo &optional arg + Change the TODO state of the entry. See the docstring of the + functions for the many possible values for the argument ARG. + + -- Function: org-priority &optional action + Change the priority of the entry. See the docstring of this + function for the possible values for ACTION. + + -- Function: org-toggle-tag tag &optional onoff + Toggle the tag TAG in the current entry. Setting ONOFF to either + ‘on’ or ‘off’ does not toggle tag, but ensure that it is either on + or off. + + -- Function: org-promote + Promote the current entry. + + -- Function: org-demote + Demote the current entry. + + This example turns all entries tagged with ‘TOMORROW’ into TODO +entries with keyword ‘UPCOMING’. Org ignores entries in comment trees +and archive trees. + + (org-map-entries '(org-todo "UPCOMING") + "+TOMORROW" 'file 'archive 'comment) + + The following example counts the number of entries with TODO keyword +‘WAITING’, in all agenda files. + + (length (org-map-entries t "/+WAITING" 'agenda)) + + +File: org.info, Node: History and Acknowledgments, Next: GNU Free Documentation License, Prev: Hacking, Up: Top + +Appendix B History and Acknowledgments +************************************** + +B.1 From Carsten +================ + +Org was born in 2003, out of frustration over the user interface of the +Emacs Outline mode. I was trying to organize my notes and projects, and +using Emacs seemed to be the natural way to go. However, having to +remember eleven different commands with two or three keys per command, +only to hide and show parts of the outline tree, that seemed entirely +unacceptable to me. Also, when using outlines to take notes, I +constantly wanted to restructure the tree, organizing it parallel to my +thoughts and plans. _Visibility cycling_ and _structure editing_ were +originally implemented in the package ‘outline-magic.el’, but quickly +moved to the more general ‘org.el’. As this environment became +comfortable for project planning, the next step was adding _TODO +entries_, basic _timestamps_, and _table support_. These areas +highlighted the two main goals that Org still has today: to be a new, +outline-based, plain text mode with innovative and intuitive editing +features, and to incorporate project planning functionality directly +into a notes file. + + Since the first release, literally thousands of emails to me or to +the mailing list <emacs-orgmode@gnu.org> have provided a constant stream +of bug reports, feedback, new ideas, and sometimes patches and add-on +code. Many thanks to everyone who has helped to improve this package. +I am trying to keep here a list of the people who had significant +influence in shaping one or more aspects of Org. The list may not be +complete, if I have forgotten someone, please accept my apologies and +let me know. + + Before I get to this list, a few special mentions are in order: + +Bastien Guerry + Bastien has written a large number of extensions to Org (most of + them integrated into the core by now), including the LaTeX exporter + and the plain list parser. His support during the early days was + central to the success of this project. Bastien also invented + Worg, helped establishing the Web presence of Org, and sponsored + hosting costs for the orgmode.org website. Bastien stepped in as + maintainer of Org between 2011 and 2013, at a time when I + desperately needed a break. + +Eric Schulte and Dan Davison + Eric and Dan are jointly responsible for the Org Babel system, + which turns Org into a multi-language environment for evaluating + code and doing literate programming and reproducible research. + This has become one of Org’s killer features that define what Org + is today. + +John Wiegley + John has contributed a number of great ideas and patches directly + to Org, including the attachment system (‘org-attach.el’), + integration with Apple Mail (‘org-mac-message.el’), hierarchical + dependencies of TODO items, habit tracking (‘org-habits.el’), and + encryption (‘org-crypt.el’). Also, the capture system is really an + extended copy of his great ‘remember.el’. + +Sebastian Rose + Without Sebastian, the HTML/XHTML publishing of Org would be the + pitiful work of an ignorant amateur. Sebastian has pushed this + part of Org onto a much higher level. He also wrote ‘org-info.js’, + a JavaScript program for displaying webpages derived from Org using + an Info-like or a folding interface with single-key navigation. + + See below for the full list of contributions! Again, please let me +know what I am missing here! + +B.2 From Bastien +================ + +I (Bastien) have been maintaining Org between 2011 and 2013. This +appendix would not be complete without adding a few more acknowledgments +and thanks. + + I am first grateful to Carsten for his trust while handing me over +the maintainership of Org. His unremitting support is what really +helped me getting more confident over time, with both the community and +the code. + + When I took over maintainership, I knew I would have to make Org more +collaborative than ever, as I would have to rely on people that are more +knowledgeable than I am on many parts of the code. Here is a list of +the persons I could rely on, they should really be considered +co-maintainers, either of the code or the community: + +Eric Schulte + Eric is maintaining the Babel parts of Org. His reactivity here + kept me away from worrying about possible bugs here and let me + focus on other parts. + +Nicolas Goaziou + Nicolas is maintaining the consistency of the deepest parts of Org. + His work on ‘org-element.el’ and ‘ox.el’ has been outstanding, and + it opened the doors for many new ideas and features. He rewrote + many of the old exporters to use the new export engine, and helped + with documenting this major change. More importantly (if that’s + possible), he has been more than reliable during all the work done + for Org 8.0, and always very reactive on the mailing list. + +Achim Gratz + Achim rewrote the building process of Org, turning some _ad hoc_ + tools into a flexible and conceptually clean process. He patiently + coped with the many hiccups that such a change can create for + users. + +Nick Dokos + The Org mode mailing list would not be such a nice place without + Nick, who patiently helped users so many times. It is impossible + to overestimate such a great help, and the list would not be so + active without him. + + I received support from so many users that it is clearly impossible +to be fair when shortlisting a few of them, but Org’s history would not +be complete if the ones above were not mentioned in this manual. + +B.3 List of Contributions +========================= + + • Russell Adams came up with the idea for drawers. + + • Thomas Baumann wrote ‘ol-bbdb.el’ and ‘ol-mhe.el’. + + • Christophe Bataillon created the great unicorn logo that we use on + the Org mode website. + + • Alex Bochannek provided a patch for rounding timestamps. + + • Jan Böcker wrote ‘ol-docview.el’. + + • Brad Bozarth showed how to pull RSS feed data into Org files. + + • Tom Breton wrote ‘org-choose.el’. + + • Charles Cave’s suggestion sparked the implementation of templates + for Remember, which are now templates for capture. + + • Timothy E Chapman worked on a complete overhaul of the orgmode.org + website in 2020 and helped fixing various bugs. + + • Pavel Chalmoviansky influenced the agenda treatment of items with + specified time. + + • Gregory Chernov patched support for Lisp forms into table + calculations and improved XEmacs compatibility, in particular by + porting ‘nouline.el’ to XEmacs. + + • Sacha Chua suggested copying some linking code from Planner. + + • Baoqiu Cui contributed the DocBook exporter. + + • Eddward DeVilla proposed and tested checkbox statistics. He also + came up with the idea of properties, and that there should be an + API for them. + + • Nick Dokos tracked down several nasty bugs. + + • Kees Dullemond used to edit projects lists directly in HTML and so + inspired some of the early development, including HTML export. He + also asked for a way to narrow wide table columns. + + • Thomas S. Dye contributed documentation on Worg and helped + integrating the Org Babel documentation into the manual. + + • Christian Egli converted the documentation into Texinfo format, + inspired the agenda, patched CSS formatting into the HTML exporter, + and wrote ‘org-taskjuggler.el’. + + • David Emery provided a patch for custom CSS support in exported + HTML agendas. + + • Nic Ferrier contributed mailcap and XOXO support. + + • Miguel A. Figueroa-Villanueva implemented hierarchical checkboxes. + + • John Foerch figured out how to make incremental search show context + around a match in a hidden outline tree. + + • Raimar Finken wrote ‘org-git-line.el’. + + • Mikael Fornius works as a mailing list moderator. + + • Austin Frank works as a mailing list moderator. + + • Eric Fraga drove the development of Beamer export with ideas and + testing. + + • Barry Gidden did proofreading the manual in preparation for the + book publication through Network Theory Ltd. + + • Niels Giesen had the idea to automatically archive DONE trees. + + • Nicolas Goaziou rewrote much of the plain list code. + + • Kai Grossjohann pointed out key-binding conflicts with other + packages. + + • Brian Gough of Network Theory Ltd publishes the Org mode manual as + a book. + + • Bernt Hansen has driven much of the support for auto-repeating + tasks, task state change logging, and the clocktable. His clear + explanations have been critical when we started to adopt the Git + version control system. + + • Manuel Hermenegildo has contributed various ideas, small fixes and + patches. + + • Phil Jackson wrote ‘ol-irc.el’. + + • Scott Jaderholm proposed footnotes, control over whitespace between + folded entries, and column view for properties. + + • Matt Jones wrote MobileOrg Android. + + • Tokuya Kameshima wrote ‘org-wl.el’ and ‘org-mew.el’. + + • Shidai Liu (“Leo”) asked for embedded LaTeX and tested it. He also + provided frequent feedback and some patches. + + • Matt Lundin has proposed last-row references for table formulas and + named invisible anchors. He has also worked a lot on the FAQ. + + • David Maus wrote ‘org-atom.el’, maintains the issues file for Org, + and is a prolific contributor on the mailing list with competent + replies, small fixes and patches. + + • Jason F. McBrayer suggested agenda export to CSV format. + + • Kyle Meyer helped setting up the public-inbox + (https://public-inbox.org/) archive of the Org mailing list + (https://orgmode.org/list/) and has been fixing many bugs. + + • Max Mikhanosha came up with the idea of refiling. + + • Dmitri Minaev sent a patch to set priority limits on a per-file + basis. + + • Stefan Monnier provided a patch to keep the Emacs Lisp compiler + happy. + + • Richard Moreland wrote MobileOrg for the iPhone. + + • Rick Moynihan proposed allowing multiple TODO sequences in a file + and being able to quickly restrict the agenda to a subtree. + + • Todd Neal provided patches for links to Info files and Elisp forms. + + • Greg Newman refreshed the unicorn logo into its current form. + + • Tim O’Callaghan suggested in-file links, search options for general + file links, and tags. + + • Osamu Okano wrote ‘orgcard2ref.pl’, a Perl program to create a text + version of the reference card. + + • Takeshi Okano translated the manual and David O’Toole’s tutorial + into Japanese. + + • Oliver Oppitz suggested multi-state TODO items. + + • Scott Otterson sparked the introduction of descriptive text for + links, among other things. + + • Pete Phillips helped during the development of the TAGS feature, + and provided frequent feedback. + + • Martin Pohlack provided the code snippet to bundle character + insertion into bundles of 20 for undo. + + • Ihor Radchenko helped with fixing bugs and improving the user + experience regarding Org’s speed. + + • T. V. Raman reported bugs and suggested improvements. + + • Matthias Rempe (Oelde) provided ideas, Windows support, and quality + control. + + • Paul Rivier provided the basic implementation of named footnotes. + He also acted as mailing list moderator for some time. + + • Kevin Rogers contributed code to access VM files on remote hosts. + + • Frank Ruell solved the mystery of the ‘keymapp nil’ bug, a conflict + with ‘allout.el’. + + • Jason Riedy generalized the send-receive mechanism for Orgtbl + tables with extensive patches. + + • Philip Rooke created the Org reference card, provided lots of + feedback, developed and applied standards to the Org documentation. + + • Christian Schlauer proposed angular brackets around links, among + other things. + + • Paul Sexton wrote ‘org-ctags.el’. + + • Tom Shannon’s ‘organizer-mode.el’ inspired linking to VM/BBDB/Gnus. + + • Ilya Shlyakhter proposed the Archive Sibling, line numbering in + literal examples, and remote highlighting for referenced code + lines. + + • Stathis Sideris wrote the ‘ditaa.jar’ ASCII to PNG converter that + is now packaged into the org-contrib + (https://git.sr.ht/~bzg/org-contrib) repository. + + • Daniel Sinder came up with the idea of internal archiving by + locking subtrees. + + • Dale Smith proposed link abbreviations. + + • James TD Smith has contributed a large number of patches for useful + tweaks and features. + + • Adam Spiers asked for global linking commands, inspired the link + extension system, added support for Mairix, and proposed the + mapping API. + + • Ulf Stegemann created the table to translate special symbols to + HTML, LaTeX, UTF-8, Latin-1 and ASCII. + + • Andy Stewart contributed code to ‘ol-w3m.el’, to copy HTML content + with links transformation to Org syntax. + + • David O’Toole wrote ‘org-publish.el’ and drafted the manual chapter + about publishing. + + • Jambunathan K. contributed the ODT exporter. + + • Sebastien Vauban reported many issues with LaTeX and Beamer export + and enabled source code highlighting in Gnus. + + • Stefan Vollmar organized a video-recorded talk at the + Max-Planck-Institute for Neurology. He also inspired the creation + of a concept index for HTML export. + + • Jürgen Vollmer contributed code generating the table of contents in + HTML output. + + • Samuel Wales has provided important feedback and bug reports. + + • Chris Wallace provided a patch implementing the ‘QUOTE’ block. + + • David Wainberg suggested archiving, and improvements to the linking + system. + + • Carsten Wimmer suggested some changes and helped fix a bug in + linking to Gnus. + + • Roland Winkler requested additional key bindings to make Org work + on a TTY. + + • Piotr Zielinski wrote ‘org-mouse.el’, proposed agenda blocks and + contributed various ideas and code snippets. + + • Marco Wahl wrote ‘ol-eww.el’. + + +File: org.info, Node: GNU Free Documentation License, Next: Main Index, Prev: History and Acknowledgments, Up: Top + +Appendix C GNU Free Documentation License +***************************************** + + Version 1.3, 3 November 2008 + + Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + <https://fsf.org/> + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + functional and useful document “free” in the sense of freedom: to + assure everyone the effective freedom to copy and redistribute it, + with or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the + author and publisher a way to get credit for their work, while not + being considered responsible for modifications made by others. + + This License is a kind of “copyleft”, which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. We + recommend this License principally for works whose purpose is + instruction or reference. + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work, in any medium, + that contains a notice placed by the copyright holder saying it can + be distributed under the terms of this License. Such a notice + grants a world-wide, royalty-free license, unlimited in duration, + to use that work under the conditions stated herein. The + “Document”, below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as “you”. You accept + the license if you copy, modify or distribute the work in a way + requiring permission under copyright law. + + A “Modified Version” of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A “Secondary Section” is a named appendix or a front-matter section + of the Document that deals exclusively with the relationship of the + publishers or authors of the Document to the Document’s overall + subject (or to related matters) and contains nothing that could + fall directly within that overall subject. (Thus, if the Document + is in part a textbook of mathematics, a Secondary Section may not + explain any mathematics.) The relationship could be a matter of + historical connection with the subject or with related matters, or + of legal, commercial, philosophical, ethical or political position + regarding them. + + The “Invariant Sections” are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in the + notice that says that the Document is released under this License. + If a section does not fit the above definition of Secondary then it + is not allowed to be designated as Invariant. The Document may + contain zero Invariant Sections. If the Document does not identify + any Invariant Sections then there are none. + + The “Cover Texts” are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. A + Front-Cover Text may be at most 5 words, and a Back-Cover Text may + be at most 25 words. + + A “Transparent” copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images composed + of pixels) generic paint programs or (for drawings) some widely + available drawing editor, and that is suitable for input to text + formatters or for automatic translation to a variety of formats + suitable for input to text formatters. A copy made in an otherwise + Transparent file format whose markup, or absence of markup, has + been arranged to thwart or discourage subsequent modification by + readers is not Transparent. An image format is not Transparent if + used for any substantial amount of text. A copy that is not + “Transparent” is called “Opaque”. + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and standard-conforming + simple HTML, PostScript or PDF designed for human modification. + Examples of transparent image formats include PNG, XCF and JPG. + Opaque formats include proprietary formats that can be read and + edited only by proprietary word processors, SGML or XML for which + the DTD and/or processing tools are not generally available, and + the machine-generated HTML, PostScript or PDF produced by some word + processors for output purposes only. + + The “Title Page” means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, “Title + Page” means the text near the most prominent appearance of the + work’s title, preceding the beginning of the body of the text. + + The “publisher” means any person or entity that distributes copies + of the Document to the public. + + A section “Entitled XYZ” means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ + stands for a specific section name mentioned below, such as + “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) + To “Preserve the Title” of such a section when you modify the + Document means that it remains a section “Entitled XYZ” according + to this definition. + + The Document may include Warranty Disclaimers next to the notice + which states that this License applies to the Document. These + Warranty Disclaimers are considered to be included by reference in + this License, but only as regards disclaiming warranties: any other + implication that these Warranty Disclaimers may have is void and + has no effect on the meaning of this License. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow the + conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies (or copies in media that commonly + have printed covers) of the Document, numbering more than 100, and + the Document’s license notice requires Cover Texts, you must + enclose the copies in covers that carry, clearly and legibly, all + these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the title + equally prominent and visible. You may add other material on the + covers in addition. Copying with changes limited to the covers, as + long as they preserve the title of the Document and satisfy these + conditions, can be treated as verbatim copying in other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a machine-readable + Transparent copy along with each Opaque copy, or state in or with + each Opaque copy a computer-network location from which the general + network-using public has access to download using public-standard + network protocols a complete Transparent copy of the Document, free + of added material. If you use the latter option, you must take + reasonably prudent steps, when you begin distribution of Opaque + copies in quantity, to ensure that this Transparent copy will + remain thus accessible at the stated location until at least one + year after the last time you distribute an Opaque copy (directly or + through your agents or retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of copies, + to give them a chance to provide you with an updated version of the + Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with the + Modified Version filling the role of the Document, thus licensing + distribution and modification of the Modified Version to whoever + possesses a copy of it. In addition, you must do these things in + the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of previous + versions (which should, if there were any, be listed in the + History section of the Document). You may use the same title + as a previous version if the original publisher of that + version gives permission. + + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in + the Modified Version, together with at least five of the + principal authors of the Document (all of its principal + authors, if it has fewer than five), unless they release you + from this requirement. + + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + + D. Preserve all the copyright notices of the Document. + + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified + Version under the terms of this License, in the form shown in + the Addendum below. + + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document’s + license notice. + + H. Include an unaltered copy of this License. + + I. Preserve the section Entitled “History”, Preserve its Title, + and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on the + Title Page. If there is no section Entitled “History” in the + Document, create one stating the title, year, authors, and + publisher of the Document as given on its Title Page, then add + an item describing the Modified Version as stated in the + previous sentence. + + J. Preserve the network location, if any, given in the Document + for public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in the + “History” section. You may omit a network location for a work + that was published at least four years before the Document + itself, or if the original publisher of the version it refers + to gives permission. + + K. For any section Entitled “Acknowledgements” or “Dedications”, + Preserve the Title of the section, and preserve in the section + all the substance and tone of each of the contributor + acknowledgements and/or dedications given therein. + + L. Preserve all the Invariant Sections of the Document, unaltered + in their text and in their titles. Section numbers or the + equivalent are not considered part of the section titles. + + M. Delete any section Entitled “Endorsements”. Such a section + may not be included in the Modified Version. + + N. Do not retitle any existing section to be Entitled + “Endorsements” or to conflict in title with any Invariant + Section. + + O. Preserve any Warranty Disclaimers. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option designate + some or all of these sections as invariant. To do this, add their + titles to the list of Invariant Sections in the Modified Version’s + license notice. These titles must be distinct from any other + section titles. + + You may add a section Entitled “Endorsements”, provided it contains + nothing but endorsements of your Modified Version by various + parties—for example, statements of peer review or that the text has + been approved by an organization as the authoritative definition of + a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end of + the list of Cover Texts in the Modified Version. Only one passage + of Front-Cover Text and one of Back-Cover Text may be added by (or + through arrangements made by) any one entity. If the Document + already includes a cover text for the same cover, previously added + by you or by arrangement made by the same entity you are acting on + behalf of, you may not add another; but you may replace the old + one, on explicit permission from the previous publisher that added + the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination all + of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice, and that you preserve all + their Warranty Disclaimers. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections Entitled + “History” in the various original documents, forming one section + Entitled “History”; likewise combine any sections Entitled + “Acknowledgements”, and any sections Entitled “Dedications”. You + must delete all sections Entitled “Endorsements.” + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the documents + in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow this + License in all other respects regarding verbatim copying of that + document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of a + storage or distribution medium, is called an “aggregate” if the + copyright resulting from the compilation is not used to limit the + legal rights of the compilation’s users beyond what the individual + works permit. When the Document is included in an aggregate, this + License does not apply to the other works in the aggregate which + are not themselves derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one half + of the entire aggregate, the Document’s Cover Texts may be placed + on covers that bracket the Document within the aggregate, or the + electronic equivalent of covers if the Document is in electronic + form. Otherwise they must appear on printed covers that bracket + the whole aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License, and all the license notices in the + Document, and any Warranty Disclaimers, provided that you also + include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of + this License or a notice or disclaimer, the original version will + prevail. + + If a section in the Document is Entitled “Acknowledgements”, + “Dedications”, or “History”, the requirement (section 4) to + Preserve its Title (section 1) will typically require changing the + actual title. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided under this License. Any attempt + otherwise to copy, modify, sublicense, or distribute it is void, + and will automatically terminate your rights under this License. + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and (b) permanently, if the + copyright holder fails to notify you of the violation by some + reasonable means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you have + received notice of violation of this License (for any work) from + that copyright holder, and you cure the violation prior to 30 days + after your receipt of the notice. + + Termination of your rights under this section does not terminate + the licenses of parties who have received copies or rights from you + under this License. If your rights have been terminated and not + permanently reinstated, receipt of a copy of some or all of the + same material does not give you any rights to use it. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. See + <https://www.gnu.org/copyleft/>. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License “or any later version” applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If the + Document does not specify a version number of this License, you may + choose any version ever published (not as a draft) by the Free + Software Foundation. If the Document specifies that a proxy can + decide which future versions of this License can be used, that + proxy’s public statement of acceptance of a version permanently + authorizes you to choose that version for the Document. + + 11. RELICENSING + + “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any + World Wide Web server that publishes copyrightable works and also + provides prominent facilities for anybody to edit those works. A + public wiki that anybody can edit is an example of such a server. + A “Massive Multiauthor Collaboration” (or “MMC”) contained in the + site means any set of copyrightable works thus published on the MMC + site. + + “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 + license published by Creative Commons Corporation, a not-for-profit + corporation with a principal place of business in San Francisco, + California, as well as future copyleft versions of that license + published by that same organization. + + “Incorporate” means to publish or republish a Document, in whole or + in part, as part of another Document. + + An MMC is “eligible for relicensing” if it is licensed under this + License, and if all works that were first published under this + License somewhere other than this MMC, and subsequently + incorporated in whole or in part into the MMC, (1) had no cover + texts or invariant sections, and (2) were thus incorporated prior + to November 1, 2008. + + The operator of an MMC Site may republish an MMC contained in the + site under CC-BY-SA on the same site at any time before August 1, + 2009, provided the MMC is eligible for relicensing. + +C.1 ADDENDUM: How to use this License for your documents +======================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. + + If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the “with...Texts.” line with this: + + with the Invariant Sections being LIST THEIR TITLES, with + the Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. + + If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of free +software license, such as the GNU General Public License, to permit +their use in free software. + + +File: org.info, Node: Main Index, Next: Key Index, Prev: GNU Free Documentation License, Up: Top + +D Main Index +************ + +�[index�] +* Menu: + +* *this*, in post header argument: Results of Evaluation. + (line 253) +* + suffix, in properties: Property Syntax. (line 52) +* _ALL suffix, in properties: Property Syntax. (line 50) +* abbreviation, links: Link Abbreviations. (line 6) +* abstract, in LaTeX export: Special blocks in LaTeX export. + (line 6) +* action, for publishing: Publishing action. (line 6) +* activation: Activation. (line 6) +* active region: Structure Editing. (line 46) +* add-on packages: Add-on Packages. (line 6) +* agenda: Weekly/daily agenda. (line 6) +* agenda dispatcher: Agenda Dispatcher. (line 6) +* agenda files: Agenda Files. (line 6) +* agenda files, removing buffers: Agenda Commands. (line 496) +* agenda filtering: Filtering/limiting agenda items. + (line 20) +* agenda views: Agenda Views. (line 6) +* agenda views, custom: Custom Agenda Views. (line 6) +* agenda views, exporting: Exporting Agenda Views. + (line 6) +* agenda views, exporting <1>: Exporting Agenda Views. + (line 13) +* agenda views, main example: Storing searches. (line 11) +* agenda views, optimization: Speeding Up Your Agendas. + (line 6) +* agenda views, user-defined: Special Agenda Views. + (line 6) +* agenda*, as an agenda views: Storing searches. (line 11) +* agenda, as an agenda views: Storing searches. (line 11) +* agenda, column view: Agenda Column View. (line 6) +* agenda, pipe: Extracting Agenda Information. + (line 6) +* agenda, with block views: Block agenda. (line 6) +* alignment in tables: Column Width and Alignment. + (line 6) +* ALLTAGS, special property: Special Properties. (line 13) +* ALT_TITLE, property: Table of Contents. (line 68) +* ALT_TITLE, property <1>: Headings and sectioning structure. + (line 24) +* angle bracket links: Link Format. (line 6) +* angular brackets, around links: External Links. (line 136) +* anniversaries, from BBDB: Weekly/daily agenda. (line 78) +* API, for mapping: Using the Mapping API. + (line 6) +* API, for properties: Using the Property API. + (line 6) +* APPENDIX, property: Headings and sectioning structure. + (line 20) +* appointment: Timestamps. (line 14) +* appointment <1>: Weekly/daily agenda. (line 125) +* appointment reminders: Weekly/daily agenda. (line 125) +* appt.el: Weekly/daily agenda. (line 125) +* APPT_WARNTIME, keyword: Weekly/daily agenda. (line 125) +* archive locations: Moving subtrees. (line 25) +* ARCHIVE, keyword: Moving subtrees. (line 35) +* ARCHIVE, keyword <1>: In-buffer Settings. (line 15) +* ARCHIVE, property: Property Inheritance. + (line 33) +* ARCHIVE, property <1>: Moving subtrees. (line 37) +* ARCHIVE, tag: Internal archiving. (line 6) +* archived entries, in agenda views: Agenda Views. (line 37) +* archiving: Refiling and Archiving. + (line 6) +* archiving <1>: Archiving. (line 6) +* arguments, in code blocks: Environment of a Code Block. + (line 9) +* ASCII export: ASCII/Latin-1/UTF-8 export. + (line 6) +* ASCII, keyword: ASCII/Latin-1/UTF-8 export. + (line 63) +* Atom feeds: Capture and Attachments. + (line 6) +* Atom feeds <1>: RSS Feeds. (line 6) +* attach from Dired: Attach from Dired. (line 6) +* attachment links: External Links. (line 6) +* attachment links, searching: Search Options. (line 6) +* attachments: Capture and Attachments. + (line 6) +* attachments <1>: Attachments. (line 6) +* ATTR_ASCII, keyword: ASCII/Latin-1/UTF-8 export. + (line 74) +* ATTR_BEAMER, keyword: Beamer specific syntax. + (line 35) +* ATTR_HTML, keyword: Links in HTML export. + (line 27) +* ATTR_HTML, keyword <1>: Tables in HTML export. + (line 11) +* ATTR_HTML, keyword <2>: Images in HTML export. + (line 28) +* ATTR_LATEX, keyword: Images in LaTeX export. + (line 6) +* ATTR_LATEX, keyword <1>: Plain lists in LaTeX export. + (line 6) +* ATTR_LATEX, keyword <2>: Source blocks in LaTeX export. + (line 6) +* ATTR_LATEX, keyword <3>: Example blocks in LaTeX export. + (line 6) +* ATTR_LATEX, keyword <4>: Special blocks in LaTeX export. + (line 6) +* ATTR_LATEX, keyword <5>: Horizontal rules in LaTeX export. + (line 6) +* ATTR_LATEX, keyword <6>: Verse blocks in LaTeX export. + (line 6) +* ATTR_LATEX, keyword <7>: Quote blocks in LaTeX export. + (line 6) +* ATTR_ODT, keyword: Tables in ODT export. + (line 20) +* ATTR_ODT, keyword <1>: Images in ODT export. + (line 31) +* ATTR_ODT, keyword <2>: Images in ODT export. + (line 76) +* ATTR_ODT, keyword <3>: Advanced topics in ODT export. + (line 151) +* ATTR_TEXINFO, keyword: Plain lists in Texinfo export. + (line 6) +* ATTR_TEXINFO, keyword <1>: Tables in Texinfo export. + (line 6) +* ATTR_TEXINFO, keyword <2>: Images in Texinfo export. + (line 6) +* ATTR_TEXINFO, keyword <3>: Quotations in Texinfo export. + (line 6) +* ATTR_TEXINFO, keyword <4>: Special blocks in Texinfo export. + (line 6) +* author: Feedback. (line 6) +* AUTHOR, keyword: Export Settings. (line 25) +* author, macro: Macro Replacement. (line 41) +* auto clocking out after idle time: Resolving idle time. (line 91) +* auto-save, in code block editing: Editing Source Code. (line 11) +* autoload: Activation. (line 6) +* babel, languages: Languages. (line 6) +* babel, library of: Library of Babel. (line 6) +* backslashes, in links: Link Format. (line 17) +* backtrace of an error: Feedback. (line 68) +* BBDB links: External Links. (line 6) +* BBDB, anniversaries: Weekly/daily agenda. (line 78) +* Beamer export: Beamer Export. (line 6) +* BEAMER, keyword: Beamer specific syntax. + (line 19) +* BEAMER_ACT, property: Frames and Blocks in Beamer. + (line 41) +* BEAMER_COL, property: Frames and Blocks in Beamer. + (line 49) +* BEAMER_ENV, property: Frames and Blocks in Beamer. + (line 14) +* BEAMER_FONT_THEME, keyword: Beamer specific export settings. + (line 17) +* BEAMER_HEADER, keyword: Beamer specific export settings. + (line 26) +* BEAMER_INNER_THEME, keyword: Beamer specific export settings. + (line 20) +* BEAMER_OPT, property: Frames and Blocks in Beamer. + (line 41) +* BEAMER_OUTER_THEME, keyword: Beamer specific export settings. + (line 23) +* BEAMER_REF, property: Frames and Blocks in Beamer. + (line 27) +* BEAMER_THEME, keyword: Beamer specific export settings. + (line 11) +* BEGIN clocktable: The clock table. (line 36) +* BEGIN columnview: Capturing column view. + (line 11) +* BEGIN_CENTER: Paragraphs. (line 32) +* BEGIN_COMMENT: Comment Lines. (line 10) +* BEGIN_EXAMPLE: Literal Examples. (line 10) +* BEGIN_EXPORT ascii: ASCII/Latin-1/UTF-8 export. + (line 63) +* BEGIN_EXPORT beamer: Beamer specific syntax. + (line 19) +* BEGIN_EXPORT html: Quoting HTML tags. (line 13) +* BEGIN_EXPORT latex: Quoting LaTeX code. (line 18) +* BEGIN_EXPORT texinfo: Quoting Texinfo code. + (line 9) +* BEGIN_JUSTIFYLEFT: ASCII/Latin-1/UTF-8 export. + (line 84) +* BEGIN_JUSTIFYRIGHT: ASCII/Latin-1/UTF-8 export. + (line 84) +* BEGIN_QUOTE: Paragraphs. (line 25) +* BEGIN_SRC: Literal Examples. (line 38) +* BEGIN_SRC <1>: Structure of Code Blocks. + (line 6) +* BEGIN_VERSE: Paragraphs. (line 13) +* BIND, keyword: Export Settings. (line 210) +* block agenda: Block agenda. (line 6) +* BLOCKED, special property: Special Properties. (line 13) +* blocking, of checkboxes: Checkboxes. (line 45) +* blocks, folding: Blocks. (line 6) +* bold text, markup rules: Emphasis and Monospace. + (line 6) +* boolean logic, for agenda searches: Matching tags and properties. + (line 32) +* bracket links: Link Format. (line 9) +* bug reports: Feedback. (line 6) +* C-c C-c, overview: The Very Busy C-c C-c Key. + (line 6) +* cache results of code evaluation: Evaluating Code Blocks. + (line 106) +* cache, header argument: Evaluating Code Blocks. + (line 106) +* Calc package: The Spreadsheet. (line 6) +* calc.el: Cooperation. (line 7) +* calculations, in tables: Built-in Table Editor. + (line 180) +* calculations, in tables <1>: The Spreadsheet. (line 6) +* calendar commands, from agenda: Agenda Commands. (line 446) +* calendar integration: Weekly/daily agenda. (line 32) +* calendar, for selecting date: The date/time prompt. + (line 78) +* CALL, keyword: Evaluating Code Blocks. + (line 27) +* CAPTION, keyword: Captions. (line 6) +* CAPTION, keyword <1>: Tables in HTML export. + (line 11) +* CAPTION, keyword <2>: Images in HTML export. + (line 28) +* captions, markup rules: Captions. (line 6) +* capture: Capture and Attachments. + (line 6) +* capture <1>: Capture. (line 6) +* capture protocol: The capture protocol. + (line 6) +* capturing, from agenda: Agenda Commands. (line 345) +* category: Categories. (line 6) +* category filtering, in agenda: Filtering/limiting agenda items. + (line 20) +* category, for tags/property match: Matching tags and properties. + (line 65) +* CATEGORY, keyword: Categories. (line 6) +* CATEGORY, keyword <1>: In-buffer Settings. (line 19) +* CATEGORY, property: Property Inheritance. + (line 29) +* CATEGORY, property <1>: Categories. (line 12) +* CDLaTeX: CDLaTeX mode. (line 6) +* cdlatex.el: Cooperation. (line 24) +* center blocks: Paragraphs. (line 32) +* center image in LaTeX export: Images in LaTeX export. + (line 60) +* change agenda display: Agenda Commands. (line 63) +* checkbox blocking: Checkboxes. (line 45) +* checkbox statistics: Checkboxes. (line 29) +* checkboxes: Checkboxes. (line 6) +* checkboxes and TODO dependencies: TODO dependencies. (line 53) +* children, subtree visibility state: Global and local cycling. + (line 6) +* CINDEX, keyword: Indices. (line 6) +* citation: Citation handling. (line 6) +* CLASS, property: iCalendar Export. (line 51) +* clean outline view: Clean View. (line 6) +* clocking time: Clocking Work Time. (line 6) +* CLOCKSUM, special property: Special Properties. (line 13) +* CLOCKSUM, special property <1>: Agenda Column View. (line 32) +* CLOCKSUM_T, special property: Special Properties. (line 13) +* CLOCKSUM_T, special property <1>: Agenda Column View. (line 56) +* clocktable, dynamic block: The clock table. (line 6) +* CLOCK_MODELINE_TOTAL, property: Clocking commands. (line 21) +* CLOSED, special property: Special Properties. (line 13) +* code block, batch execution: Batch Execution. (line 6) +* code block, editing: Editing Source Code. (line 6) +* code block, evaluating: Evaluating Code Blocks. + (line 6) +* code block, exporting: Exporting Code Blocks. + (line 6) +* code block, extracting source code: Extracting Source Code. + (line 6) +* code block, key bindings: Key bindings and Useful Functions. + (line 6) +* code block, languages: Languages. (line 6) +* code block, library: Library of Babel. (line 6) +* code block, noweb reference: Noweb Reference Syntax. + (line 6) +* code block, results of evaluation: Results of Evaluation. + (line 6) +* code block, structure: Structure of Code Blocks. + (line 6) +* code line references, markup rules: Literal Examples. (line 6) +* code text, markup rules: Emphasis and Monospace. + (line 6) +* colnames, header argument: Environment of a Code Block. + (line 52) +* column formula: Column formulas. (line 6) +* column view, for properties: Defining columns. (line 6) +* column view, in agenda: Agenda Column View. (line 6) +* column, of field coordinates: References. (line 90) +* COLUMNS, keyword: Scope of column definitions. + (line 18) +* COLUMNS, property: Property Inheritance. + (line 22) +* COLUMNS, property <1>: In-buffer Settings. (line 23) +* comma escape, in literal examples: Literal Examples. (line 14) +* commands, in agenda buffer: Agenda Commands. (line 6) +* comment block: Comment Lines. (line 10) +* comment lines: Comment Lines. (line 6) +* comment trees: Comment Lines. (line 13) +* commented entries, in agenda views: Agenda Views. (line 37) +* comments, header argument: Extracting Source Code. + (line 46) +* completion, of dictionary words: Completion. (line 6) +* completion, of file names: Handling Links. (line 94) +* completion, of link abbreviations: Completion. (line 6) +* completion, of links: Handling Links. (line 71) +* completion, of option keywords: Per-file keywords. (line 26) +* completion, of option keywords <1>: Completion. (line 6) +* completion, of property keys: Completion. (line 6) +* completion, of tags: Setting Tags. (line 11) +* completion, of tags <1>: Completion. (line 6) +* completion, of TeX symbols: Completion. (line 6) +* completion, of TODO keywords: Workflow states. (line 17) +* completion, of TODO keywords <1>: Completion. (line 6) +* concept index, in Texinfo export: Indices. (line 6) +* constants, in calculations: References. (line 114) +* CONSTANTS, keyword: References. (line 114) +* CONSTANTS, keyword <1>: In-buffer Settings. (line 28) +* constants.el: Cooperation. (line 14) +* contents, global visibility state: Global and local cycling. + (line 20) +* continuous clocking: Resolving idle time. (line 78) +* control code block evaluation: Evaluating Code Blocks. + (line 81) +* convert: Advanced topics in ODT export. + (line 12) +* converter: Advanced topics in ODT export. + (line 12) +* COOKIE_DATA, property: Breaking Down Tasks. (line 21) +* COOKIE_DATA, property <1>: Checkboxes. (line 29) +* coordinates, of field: References. (line 90) +* copying notes: Refiling and Archiving. + (line 6) +* copying notes <1>: Refile and Copy. (line 6) +* copying, of subtrees: Structure Editing. (line 6) +* COPYING, property: Texinfo title and copyright page. + (line 19) +* countdown timer: Timers. (line 6) +* counter, macro: Macro Replacement. (line 75) +* CREATOR, keyword: Export Settings. (line 28) +* CSS, for HTML export: CSS support. (line 6) +* cua.el: Conflicts. (line 17) +* custom agenda views: Custom Agenda Views. (line 6) +* custom date/time format: Custom time format. (line 6) +* custom search strings: Custom Searches. (line 6) +* CUSTOM_ID, property: Internal Links. (line 11) +* CUSTOM_ID, property <1>: Handling Links. (line 21) +* cutting, of subtrees: Structure Editing. (line 6) +* cycling, in plain lists: Plain Lists. (line 70) +* cycling, of agenda files: Agenda Files. (line 26) +* cycling, of TODO states: TODO Basics. (line 14) +* cycling, visibility: Visibility Cycling. (line 6) +* daily agenda: Weekly/daily agenda. (line 6) +* dash, special symbol: Special Symbols. (line 36) +* data type index, in Texinfo export: Indices. (line 6) +* date format, custom: Custom time format. (line 6) +* date range: Timestamps. (line 42) +* date stamp: Dates and Times. (line 6) +* date stamps: Timestamps. (line 6) +* date tree: Using capture. (line 7) +* DATE, keyword: Export Settings. (line 32) +* date, macro: Macro Replacement. (line 49) +* date, reading in minibuffer: The date/time prompt. + (line 6) +* dates: Dates and Times. (line 6) +* DEADLINE marker: Deadlines and Scheduling. + (line 11) +* DEADLINE, special property: Special Properties. (line 13) +* deadlines: Timestamps. (line 6) +* debugging, of table formulas: Editing and debugging formulas. + (line 132) +* default header arguments per language: Using Header Arguments. + (line 36) +* defining new protocols: Protocols. (line 25) +* demotion, of subtrees: Structure Editing. (line 6) +* dependencies, of TODO states: TODO dependencies. (line 6) +* DESCRIPTION, keyword: Beamer specific export settings. + (line 30) +* DESCRIPTION, keyword <1>: HTML specific export settings. + (line 10) +* DESCRIPTION, keyword <2>: LaTeX specific export settings. + (line 11) +* DESCRIPTION, keyword <3>: ODT specific export settings. + (line 11) +* DESCRIPTION, property: Headings and sectioning structure. + (line 24) +* DESCRIPTION, property <1>: iCalendar Export. (line 51) +* diary entries, creating from agenda: Agenda Commands. (line 455) +* diary integration: Weekly/daily agenda. (line 32) +* diary style timestamps: Timestamps. (line 34) +* dictionary word completion: Completion. (line 6) +* dir file, in Texinfo export: Info directory file. (line 6) +* dir, header argument: Environment of a Code Block. + (line 309) +* DIR, property: Attachment defaults and dispatcher. + (line 68) +* DIR, property <1>: Attachment defaults and dispatcher. + (line 73) +* directories, for publishing: Sources and destinations. + (line 6) +* dispatcher, for export commands: The Export Dispatcher. + (line 6) +* dispatching agenda commands: Agenda Dispatcher. (line 6) +* display changing, in agenda: Agenda Commands. (line 63) +* doc, docx, rtf: Advanced topics in ODT export. + (line 12) +* document structure: Document Structure. (line 6) +* document title: Export Settings. (line 60) +* documentation: Documentation Access. + (line 6) +* DONE, final TODO keyword: Per-file keywords. (line 29) +* drawer, for properties: Property Syntax. (line 6) +* drawer, for state change recording: Tracking TODO state changes. + (line 6) +* drawers: Drawers. (line 6) +* duration, computing: Durations and time values. + (line 6) +* dvipng: Math formatting in HTML export. + (line 6) +* dvipng <1>: LaTeX math snippets. (line 50) +* dvisvgm: Math formatting in HTML export. + (line 6) +* dvisvgm <1>: LaTeX math snippets. (line 50) +* dynamic blocks: Dynamic Blocks. (line 6) +* dynamic indentation: Clean View. (line 6) +* ecomplete.el: Conflicts. (line 32) +* editing tables: Tables. (line 6) +* editing, of table formulas: Editing and debugging formulas. + (line 6) +* edits, catching invisible: Catching invisible edits. + (line 6) +* effort estimates: Effort Estimates. (line 6) +* effort filtering, in agenda: Filtering/limiting agenda items. + (line 20) +* EFFORT, property: Effort Estimates. (line 6) +* Elisp links: External Links. (line 6) +* ellipsis, special symbol: Special Symbols. (line 36) +* ELPA: Activation. (line 6) +* EMAIL, keyword: Export Settings. (line 35) +* email, macro: Macro Replacement. (line 41) +* embedding images in ODT: Images in ODT export. + (line 6) +* entities: Special Symbols. (line 6) +* enum, Texinfo attribute: Plain lists in Texinfo export. + (line 35) +* epilogue, header argument: Environment of a Code Block. + (line 359) +* escape character: Escape Character. (line 6) +* escape syntax, for links: Link Format. (line 17) +* eval, header argument: Evaluating Code Blocks. + (line 81) +* evaluate time range: Creating Timestamps. (line 62) +* example block: Literal Examples. (line 10) +* example blocks, in LaTeX export: Example blocks in LaTeX export. + (line 6) +* EXCLUDE_TAGS, keyword: Export Settings. (line 52) +* excluding entries from table of contents: Table of Contents. + (line 15) +* export back-end: Exporting. (line 12) +* export, dispatcher: The Export Dispatcher. + (line 6) +* export, include files: Include Files. (line 6) +* export, OpenDocument: OpenDocument Text Export. + (line 6) +* Export, settings: Export Settings. (line 6) +* Export, writing back-ends: Adding Export Back-ends. + (line 6) +* exporting: Exporting. (line 6) +* exporting agenda views: Exporting Agenda Views. + (line 13) +* exporting, not: Comment Lines. (line 6) +* exports, header argument: Exporting Code Blocks. + (line 14) +* EXPORT_FILE_NAME, keyword: Export Settings. (line 64) +* EXPORT_FILE_NAME, property: ODT export commands. (line 9) +* EXPORT_LATEX_CLASS, property: LaTeX header and sectioning. + (line 23) +* EXPORT_LATEX_CLASS_OPTIONS, property: LaTeX header and sectioning. + (line 23) +* extended TODO keywords: TODO Extensions. (line 6) +* external archiving: Moving subtrees. (line 6) +* external links: External Links. (line 6) +* external links, in HTML export: Links in HTML export. + (line 6) +* faces, for TODO keywords: Faces for TODO keywords. + (line 6) +* FAQ: Summary. (line 49) +* feedback: Feedback. (line 6) +* field coordinates: References. (line 90) +* field formula: Field and range formulas. + (line 6) +* field references: References. (line 15) +* file links: External Links. (line 6) +* file links, searching: Search Options. (line 6) +* file name completion: Handling Links. (line 94) +* file, header argument: Results of Evaluation. + (line 119) +* FILE, special property: Special Properties. (line 13) +* file-desc, header argument: Results of Evaluation. + (line 140) +* file-ext, header argument: Results of Evaluation. + (line 129) +* file-mode, header argument: Results of Evaluation. + (line 151) +* files for agenda: Agenda Files. (line 6) +* files, adding to agenda list: Agenda Files. (line 16) +* files, selecting for publishing: Selecting files. (line 6) +* FILETAGS, keyword: Tag Inheritance. (line 20) +* FILETAGS, keyword <1>: In-buffer Settings. (line 34) +* filladapt.el: Conflicts. (line 43) +* filtering entries, in agenda: Filtering/limiting agenda items. + (line 20) +* Filters, exporting: Advanced Export Configuration. + (line 31) +* FINDEX, keyword: Indices. (line 6) +* FLAGGED, tag: Pulling from the mobile application. + (line 18) +* folded, subtree visibility state: Global and local cycling. + (line 6) +* folding, sparse trees: Sparse Trees. (line 6) +* following links: Handling Links. (line 104) +* footers, in code blocks: Environment of a Code Block. + (line 351) +* footnotes: Creating Footnotes. (line 6) +* format specifier, in spreadsheet: Formula syntax for Calc. + (line 17) +* format, of links: Link Format. (line 6) +* formatting source code, markup rules: Literal Examples. (line 31) +* formula debugging: Editing and debugging formulas. + (line 132) +* formula editing: Editing and debugging formulas. + (line 6) +* formula syntax, Calc: Formula syntax for Calc. + (line 6) +* formula, for individual table field: Field and range formulas. + (line 6) +* formula, for range of fields: Field and range formulas. + (line 6) +* formula, for table column: Column formulas. (line 6) +* formula, in tables: Built-in Table Editor. + (line 180) +* function index, in Texinfo export: Indices. (line 6) +* global cycling: Global and local cycling. + (line 20) +* global key bindings: Activation. (line 6) +* global TODO list: Global TODO list. (line 6) +* global visibility states: Global and local cycling. + (line 20) +* Gnus links: External Links. (line 6) +* graph, in tables: Org Plot. (line 6) +* group tags: Tag Hierarchy. (line 6) +* group tags, as regular expressions: Matching tags and properties. + (line 58) +* grouping columns in tables: Column Groups. (line 6) +* habits: Tracking your habits. + (line 6) +* hacking: Hacking. (line 6) +* header arguments per language: Using Header Arguments. + (line 74) +* header arguments, in code blocks: Structure of Code Blocks. + (line 57) +* header lines, in tables: Built-in Table Editor. + (line 6) +* header, for LaTeX files: LaTeX header and sectioning. + (line 6) +* HEADER, keyword: Using Header Arguments. + (line 114) +* headers, in code blocks: Environment of a Code Block. + (line 351) +* headline navigation: Motion. (line 6) +* headline tagging: Tags. (line 6) +* headline, promotion and demotion: Structure Editing. (line 6) +* headlines: Headlines. (line 6) +* headlines, in HTML export: Headlines in HTML export. + (line 6) +* Help links: External Links. (line 6) +* hide text: Visibility Cycling. (line 6) +* hiding leading stars: Clean View. (line 6) +* hlines, header argument: Results of Evaluation. + (line 69) +* hooks: Hooks. (line 6) +* horizontal rule, in tables: Built-in Table Editor. + (line 6) +* horizontal rules, in ASCII export: ASCII/Latin-1/UTF-8 export. + (line 74) +* horizontal rules, in LaTeX export: Horizontal rules in LaTeX export. + (line 6) +* horizontal rules, markup rules: Horizontal Rules. (line 6) +* HTML export: HTML Export. (line 6) +* HTML export, CSS: CSS support. (line 6) +* HTML, and Orgtbl mode: Translator functions. + (line 6) +* HTML, keyword: Quoting HTML tags. (line 13) +* html-style, OPTIONS item: CSS support. (line 56) +* HTML5, export new elements: HTML doctypes. (line 25) +* HTML_CONTAINER, keyword: HTML specific export settings. + (line 22) +* HTML_CONTAINER_CLASS, property: CSS support. (line 62) +* HTML_DOCTYPE, keyword: HTML specific export settings. + (line 19) +* HTML_HEAD, keyword: HTML specific export settings. + (line 38) +* HTML_HEAD, keyword <1>: CSS support. (line 49) +* HTML_HEADLINE_CLASS, property: CSS support. (line 62) +* HTML_HEAD_EXTRA, keyword: HTML specific export settings. + (line 42) +* HTML_HEAD_EXTRA, keyword <1>: CSS support. (line 49) +* HTML_INCLUDE_STYLE, keyword: CSS support. (line 44) +* HTML_LINK_HOME, keyword: HTML specific export settings. + (line 26) +* HTML_LINK_UP, keyword: HTML specific export settings. + (line 29) +* HTML_MATHJAX, keyword: HTML specific export settings. + (line 33) +* hyperlinks: Hyperlinks. (line 6) +* hyperlinks, adding new types: Adding Hyperlink Types. + (line 6) +* iCalendar export: iCalendar Export. (line 6) +* ID, property: Handling Links. (line 21) +* ID, property <1>: Capturing column view. + (line 34) +* ID, property <2>: iCalendar Export. (line 26) +* identify, ImageMagick: Images in ODT export. + (line 34) +* idle, resolve, dangling: Resolving idle time. (line 9) +* image, centering in LaTeX export: Images in LaTeX export. + (line 60) +* ImageMagick: Math formatting in HTML export. + (line 6) +* ImageMagick <1>: LaTeX math snippets. (line 50) +* images, embedding in ODT: Images in ODT export. + (line 6) +* images, inline in HTML: Images in HTML export. + (line 6) +* images, inline in LaTeX: Images in LaTeX export. + (line 6) +* images, markup rules: Images. (line 6) +* imenu.el: Cooperation. (line 29) +* in-buffer settings: In-buffer Settings. (line 6) +* inactive timestamp: Timestamps. (line 50) +* include files, during export: Include Files. (line 6) +* INCLUDE, keyword: Include Files. (line 6) +* Indent mode: Org Indent Mode. (line 6) +* indentation, in code blocks: Editing Source Code. (line 32) +* indentation, in source blocks: Literal Examples. (line 81) +* index, in a publishing project: Generating an index. (line 6) +* INDEX, keyword: Generating an index. (line 17) +* INDEX, property: Indices. (line 14) +* indic, Texinfo attribute: Plain lists in Texinfo export. + (line 12) +* Info: Documentation Access. + (line 6) +* Info directory file, in Texinfo export: Info directory file. + (line 6) +* Info links: External Links. (line 6) +* INFOJS_OPT, keyword: JavaScript support. (line 19) +* inheritance, of properties: Property Inheritance. + (line 6) +* inheritance, of tags: Tag Inheritance. (line 6) +* inline, in LaTeX export: Quoting LaTeX code. (line 10) +* inlining images: Images. (line 6) +* inlining images in HTML: Images in HTML export. + (line 6) +* inlining images in LaTeX: Images in LaTeX export. + (line 6) +* input-file, macro: Macro Replacement. (line 64) +* inserting links: Handling Links. (line 71) +* insertion, of templates: Structure Templates. (line 6) +* insertion, of templates <1>: Structure Templates. (line 21) +* install-info, in Texinfo export: Info directory file. (line 6) +* installation: Installation. (line 6) +* Installing Org protocol: Protocols. (line 14) +* internal links: Internal Links. (line 6) +* internal links, in HTML export: Links in HTML export. + (line 6) +* introduction: Introduction. (line 6) +* IRC links: External Links. (line 6) +* italic text, markup rules: Emphasis and Monospace. + (line 6) +* ITEM, special property: Special Properties. (line 13) +* jumping, to headlines: Motion. (line 6) +* key bindings, global: Activation. (line 6) +* keystroke index, in Texinfo export: Indices. (line 6) +* keyword options: Per-file keywords. (line 6) +* keyword, macro: Macro Replacement. (line 41) +* KEYWORDS, keyword: Beamer specific export settings. + (line 37) +* KEYWORDS, keyword <1>: HTML specific export settings. + (line 46) +* KEYWORDS, keyword <2>: LaTeX specific export settings. + (line 54) +* KEYWORDS, keyword <3>: ODT specific export settings. + (line 16) +* KINDEX, keyword: Indices. (line 6) +* language specific default header arguments: Using Header Arguments. + (line 36) +* language specific header arguments properties: Using Header Arguments. + (line 74) +* language, in code blocks: Structure of Code Blocks. + (line 47) +* LANGUAGE, keyword: Export Settings. (line 38) +* LANGUAGE, keyword <1>: LaTeX specific export settings. + (line 20) +* LAST_REPEAT, property: Clocking commands. (line 21) +* LaTeX class: LaTeX header and sectioning. + (line 6) +* LaTeX export: LaTeX Export. (line 6) +* LaTeX fragments: LaTeX fragments. (line 6) +* LaTeX fragments, preview: Previewing LaTeX fragments. + (line 6) +* LaTeX header: LaTeX header and sectioning. + (line 6) +* LaTeX interpretation: Embedded LaTeX. (line 6) +* LaTeX sectioning structure: LaTeX header and sectioning. + (line 6) +* LaTeX, and Orgtbl mode: A LaTeX example. (line 6) +* LATEX, keyword: Quoting LaTeX code. (line 14) +* LATEX_CLASS, keyword: LaTeX specific export settings. + (line 32) +* LATEX_CLASS, keyword <1>: LaTeX header and sectioning. + (line 23) +* LATEX_CLASS_OPTIONS, keyword: LaTeX specific export settings. + (line 40) +* LATEX_CLASS_OPTIONS, keyword <1>: LaTeX header and sectioning. + (line 23) +* LATEX_COMPILER, keyword: LaTeX/PDF export commands. + (line 25) +* LATEX_COMPILER, keyword <1>: LaTeX specific export settings. + (line 44) +* LATEX_HEADER, keyword: HTML specific export settings. + (line 51) +* LATEX_HEADER, keyword <1>: LaTeX specific export settings. + (line 49) +* LATEX_HEADER, keyword <2>: LaTeX header and sectioning. + (line 30) +* LATEX_HEADER_EXTRA, keyword: LaTeX specific export settings. + (line 49) +* LATEX_HEADER_EXTRA, keyword <1>: LaTeX header and sectioning. + (line 30) +* Latin-1 export: ASCII/Latin-1/UTF-8 export. + (line 6) +* lettered lists, in Texinfo export: Plain lists in Texinfo export. + (line 35) +* level, for tags/property match: Matching tags and properties. + (line 65) +* LibreOffice: OpenDocument Text Export. + (line 6) +* limits, in agenda: Filtering/limiting agenda items. + (line 129) +* line breaks, markup rules: Paragraphs. (line 9) +* lines, include: Include Files. (line 36) +* link abbreviations: Link Abbreviations. (line 6) +* link abbreviations, completion of: Completion. (line 6) +* link completion: Handling Links. (line 71) +* link format: Link Format. (line 6) +* LINK, keyword: Link Abbreviations. (line 49) +* LINK, keyword <1>: In-buffer Settings. (line 38) +* links, external: External Links. (line 6) +* links, finding next/previous: Handling Links. (line 153) +* links, handling: Handling Links. (line 6) +* links, in HTML export: Links in HTML export. + (line 6) +* links, in ODT export: Links in ODT export. (line 6) +* links, internal: Internal Links. (line 6) +* links, publishing: Publishing links. (line 6) +* links, radio targets: Radio Targets. (line 6) +* links, returning to: Handling Links. (line 146) +* linter: Org Syntax. (line 24) +* Lisp forms, as table formulas: Formula syntax for Lisp. + (line 6) +* list of listings: Table of Contents. (line 6) +* list of tables: Table of Contents. (line 6) +* lists, in other modes: Tables in Arbitrary Syntax. + (line 6) +* lists, ordered: Plain Lists. (line 6) +* lists, plain: Plain Lists. (line 6) +* literal examples, markup rules: Literal Examples. (line 6) +* LOCATION, property: iCalendar Export. (line 51) +* logging, of progress: Progress Logging. (line 6) +* LOGGING, property: Tracking TODO state changes. + (line 45) +* LOGGING, property <1>: Property Inheritance. + (line 37) +* LOG_INTO_DRAWER, property: Tracking TODO state changes. + (line 6) +* LOG_INTO_DRAWER, property <1>: Clocking commands. (line 7) +* lookup functions in tables: Lookup functions. (line 6) +* lualatex: LaTeX/PDF export commands. + (line 25) +* macro replacement, during export: Macro Replacement. (line 6) +* MACRO, keyword: Macro Replacement. (line 6) +* maintainer: Feedback. (line 6) +* mapping entries, API: Using the Mapping API. + (line 6) +* mappings in open-source protocol: The open-source protocol. + (line 67) +* mark ring: Handling Links. (line 141) +* Markdown export: Markdown Export. (line 6) +* marking characters, tables: Advanced features. (line 39) +* match view: Matching tags and properties. + (line 6) +* matching, of properties: Matching tags and properties. + (line 6) +* matching, of tags: Matching tags and properties. + (line 6) +* matching, tags: Tags. (line 6) +* math symbols: Special Symbols. (line 6) +* MathJax: Math formatting in HTML export. + (line 6) +* MathML: LaTeX math snippets. (line 10) +* MH-E links: External Links. (line 6) +* minlevel, include: Include Files. (line 22) +* minor mode for tables: Orgtbl Mode. (line 6) +* mkdirp, header argument: Environment of a Code Block. + (line 309) +* mkdirp, header argument <1>: Extracting Source Code. + (line 42) +* mode, for Calc: Formula syntax for Calc. + (line 17) +* modification-time, macro: Macro Replacement. (line 56) +* motion commands in agenda: Agenda Commands. (line 19) +* motion, between headlines: Motion. (line 6) +* multiple formula lines: Editing and debugging formulas. + (line 98) +* multiple items in Texinfo lists: Plain lists in Texinfo export. + (line 17) +* n, macro: Macro Replacement. (line 75) +* NAME keyword, in source blocks: Structure of Code Blocks. + (line 6) +* NAME, keyword: References. (line 135) +* NAME, keyword <1>: Internal Links. (line 21) +* name, of column or field: References. (line 114) +* name, of column or field <1>: References. (line 135) +* named references: References. (line 114) +* names as TODO keywords: TODO types. (line 6) +* narrow columns in tables: Column Width and Alignment. + (line 6) +* no-expand, header argument: Extracting Source Code. + (line 97) +* NOBLOCKING, property: TODO dependencies. (line 29) +* noweb, header argument: Noweb Reference Syntax. + (line 18) +* noweb-ref, header argument: Noweb Reference Syntax. + (line 6) +* noweb-sep, header argument: Noweb Reference Syntax. + (line 96) +* number headlines: Dynamic Headline Numbering. + (line 6) +* occur, command: Sparse Trees. (line 6) +* occur-tree: Storing searches. (line 11) +* odd-levels-only outlines: Clean View. (line 6) +* ODT: OpenDocument Text Export. + (line 6) +* ODT, keyword: Advanced topics in ODT export. + (line 120) +* ODT_STYLES_FILE, keyword: ODT specific export settings. + (line 22) +* ODT_STYLES_FILE, keyword <1>: Applying custom styles. + (line 29) +* only-contents, include: Include Files. (line 53) +* open-source protocol: The open-source protocol. + (line 6) +* OpenDocument: OpenDocument Text Export. + (line 6) +* option keyword completion: Completion. (line 6) +* options, for custom agenda views: Setting options. (line 6) +* options, for export: Export Settings. (line 6) +* options, for publishing: Publishing options. (line 6) +* OPTIONS, keyword: Export Settings. (line 6) +* ordered lists: Plain Lists. (line 6) +* ORDERED, property: TODO dependencies. (line 6) +* ORDERED, property <1>: Checkboxes. (line 45) +* Org export: Org Export. (line 6) +* Org mode, turning on: Activation. (line 24) +* Org Num mode: Dynamic Headline Numbering. + (line 6) +* Org protocol, set-up: Protocols. (line 14) +* org-agenda, command: Weekly/daily agenda. (line 10) +* org-latex-default-quote-environment: Quote blocks in LaTeX export. + (line 6) +* Orgtbl mode: Orgtbl Mode. (line 6) +* Orgtbl mode <1>: Tables in Arbitrary Syntax. + (line 6) +* ORGTBL, keyword: Radio tables. (line 21) +* outline tree: Headlines. (line 6) +* output-dir, header argument: Results of Evaluation. + (line 119) +* overview, global visibility state: Global and local cycling. + (line 20) +* packages, interaction with other: Interaction. (line 6) +* padline, header argument: Extracting Source Code. + (line 73) +* paragraphs, markup rules: Paragraphs. (line 6) +* passing arguments to code blocks: Environment of a Code Block. + (line 9) +* pasting, of subtrees: Structure Editing. (line 6) +* PDF export: LaTeX Export. (line 6) +* pdflatex: LaTeX/PDF export commands. + (line 25) +* per-file keywords: Per-file keywords. (line 6) +* PINDEX, keyword: Indices. (line 6) +* plain links: Link Format. (line 6) +* plain lists: Plain Lists. (line 6) +* plain lists, in LaTeX export: Plain lists in LaTeX export. + (line 6) +* plain text external links: External Links. (line 136) +* plot tables using Gnuplot: Org Plot. (line 6) +* PLOT, keyword: Org Plot. (line 12) +* post, header argument: Results of Evaluation. + (line 253) +* presentation, of agenda items: Presentation and Sorting. + (line 6) +* print edition: Summary. (line 54) +* printing sparse trees: Sparse Trees. (line 52) +* priorities: Priorities. (line 6) +* PRIORITIES, keyword: Priorities. (line 52) +* PRIORITIES, keyword <1>: In-buffer Settings. (line 43) +* priorities, of agenda items: Sorting of agenda items. + (line 6) +* priority cookie: Priorities. (line 6) +* PRIORITY, special property: Special Properties. (line 13) +* program index, in Texinfo export: Indices. (line 6) +* progress logging: Progress Logging. (line 6) +* projects, for publishing: Project alist. (line 6) +* prologue, header argument: Environment of a Code Block. + (line 351) +* promotion, of subtrees: Structure Editing. (line 6) +* proof, in LaTeX export: Special blocks in LaTeX export. + (line 6) +* properties: Properties and Columns. + (line 6) +* properties, API: Using the Property API. + (line 6) +* properties, column view: Defining columns. (line 6) +* properties, inheritance: Property Inheritance. + (line 6) +* properties, searching: Property Searches. (line 6) +* properties, special: Special Properties. (line 6) +* property syntax: Property Syntax. (line 6) +* PROPERTY, keyword: Property Syntax. (line 50) +* PROPERTY, keyword <1>: In-buffer Settings. (line 48) +* property, macro: Macro Replacement. (line 68) +* protocol, capture: The capture protocol. + (line 6) +* protocol, new protocol: Protocols. (line 25) +* protocol, open-source: The open-source protocol. + (line 6) +* protocol, open-source rewritten URL: The open-source protocol. + (line 32) +* protocol, open-source, set-up mapping: The open-source protocol. + (line 67) +* protocol, store-link: The store-link protocol. + (line 6) +* protocols, for external access: Capture and Attachments. + (line 6) +* protocols, for external access <1>: Protocols. (line 6) +* publishing: Publishing. (line 6) +* publishing options: Publishing options. (line 6) +* query editing, in agenda: Filtering/limiting agenda items. + (line 20) +* quote blocks: Paragraphs. (line 25) +* quote blocks, in LaTeX export: Quote blocks in LaTeX export. + (line 6) +* radio button, checkbox as: Checkboxes. (line 75) +* radio tables: Radio tables. (line 6) +* radio targets: Radio Targets. (line 6) +* range formula: Field and range formulas. + (line 6) +* range references: References. (line 64) +* ranges, time: Timestamps. (line 6) +* recomputing table fields: Updating the table. (line 6) +* references: References. (line 6) +* references, named: References. (line 114) +* references, remote: References. (line 135) +* references, to a different table: References. (line 135) +* references, to fields: References. (line 15) +* references, to ranges: References. (line 64) +* refiling notes: Refiling and Archiving. + (line 6) +* refiling notes <1>: Refile and Copy. (line 6) +* refresh set-up: In-buffer Settings. (line 11) +* region, active: Structure Editing. (line 46) +* regular expressions syntax: Regular Expressions. (line 6) +* regular expressions, in searches: Regular Expressions. (line 6) +* regular expressions, with tags search: Matching tags and properties. + (line 53) +* relative timer: Timers. (line 6) +* reminders: Weekly/daily agenda. (line 125) +* remote editing, bulk, from agenda: Agenda Commands. (line 352) +* remote editing, from agenda: Agenda Commands. (line 223) +* remote editing, undo: Agenda Commands. (line 227) +* remote references: References. (line 135) +* repeated tasks: Repeated tasks. (line 6) +* report, of clocked time: The clock table. (line 6) +* reporting a bug: Feedback. (line 6) +* resolve idle time: Resolving idle time. (line 9) +* results, header argument: Results of Evaluation. + (line 6) +* RESULTS, keyword: Evaluating Code Blocks. + (line 6) +* results, macro: Macro Replacement. (line 84) +* revealing context: Global and local cycling. + (line 43) +* rewritten URL in open-source protocol: The open-source protocol. + (line 32) +* Rmail links: External Links. (line 6) +* row separator, in tables: Built-in Table Editor. + (line 6) +* row, of field coordinates: References. (line 90) +* rownames, header argument: Environment of a Code Block. + (line 77) +* RSS feeds: Capture and Attachments. + (line 6) +* RSS feeds <1>: RSS Feeds. (line 6) +* rsync: Uploading Files. (line 6) +* SCHEDULED marker: Deadlines and Scheduling. + (line 31) +* SCHEDULED, special property: Special Properties. (line 13) +* scheduling: Timestamps. (line 6) +* scripts, for agenda processing: Extracting Agenda Information. + (line 6) +* search option in file links: Search Options. (line 6) +* search strings, custom: Custom Searches. (line 6) +* search view: Search view. (line 6) +* searching for tags: Tag Searches. (line 6) +* searching, for text: Search view. (line 6) +* searching, of properties: Property Searches. (line 6) +* sectioning structure, for LaTeX export: LaTeX header and sectioning. + (line 6) +* SELECT_TAGS, keyword: Export Settings. (line 44) +* sep, header argument: Results of Evaluation. + (line 147) +* sep, Texinfo attribute: Plain lists in Texinfo export. + (line 17) +* SEQ_TODO, keyword: Per-file keywords. (line 6) +* SEQ_TODO, keyword <1>: In-buffer Settings. (line 190) +* session, header argument: Environment of a Code Block. + (line 279) +* setting tags: Setting Tags. (line 6) +* SETUPFILE, keyword: Export Settings. (line 13) +* SETUPFILE, keyword <1>: In-buffer Settings. (line 53) +* sexp timestamps: Timestamps. (line 34) +* shebang, header argument: Extracting Source Code. + (line 83) +* shell links: External Links. (line 6) +* shift-selection: Conflicts. (line 6) +* shift-selection-mode: Plain Lists. (line 95) +* show all, command: Global and local cycling. + (line 40) +* show all, global visibility state: Global and local cycling. + (line 20) +* show branches, command: Global and local cycling. + (line 52) +* show children, command: Global and local cycling. + (line 55) +* show hidden text: Visibility Cycling. (line 6) +* shy hyphen, special symbol: Special Symbols. (line 36) +* sitemap, of published pages: Site map. (line 6) +* smartphone: Org Mobile. (line 6) +* sorting, of agenda items: Sorting of agenda items. + (line 6) +* sorting, of plain list: Plain Lists. (line 159) +* sorting, of subtrees: Structure Editing. (line 6) +* source block: Literal Examples. (line 38) +* source blocks, in LaTeX export: Source blocks in LaTeX export. + (line 6) +* source code, batch execution: Batch Execution. (line 6) +* source code, block structure: Structure of Code Blocks. + (line 6) +* source code, editing: Editing Source Code. (line 6) +* source code, evaluating: Evaluating Code Blocks. + (line 6) +* source code, exporting: Exporting Code Blocks. + (line 6) +* source code, extracting: Extracting Source Code. + (line 6) +* source code, inline: Structure of Code Blocks. + (line 24) +* source code, languages: Languages. (line 6) +* source code, library: Library of Babel. (line 6) +* source code, noweb reference: Noweb Reference Syntax. + (line 6) +* source code, results of evaluation: Results of Evaluation. + (line 6) +* source code, working with: Working with Source Code. + (line 6) +* sparse tree, for deadlines: Inserting deadline/schedule. + (line 26) +* sparse tree, for TODO: TODO Basics. (line 35) +* sparse tree, tag based: Tags. (line 6) +* sparse trees: Sparse Trees. (line 6) +* special blocks, in ASCII export: ASCII/Latin-1/UTF-8 export. + (line 84) +* special blocks, in LaTeX export: Special blocks in LaTeX export. + (line 6) +* special keywords: In-buffer Settings. (line 6) +* special symbols: Special Symbols. (line 6) +* special symbols, in-buffer display: Special Symbols. (line 27) +* speed keys: Speed Keys. (line 6) +* speedbar.el: Cooperation. (line 41) +* spreadsheet capabilities: The Spreadsheet. (line 6) +* square brackets, around links: External Links. (line 136) +* startup visibility: Global and local cycling. + (line 36) +* STARTUP, keyword: Initial visibility. (line 11) +* STARTUP, keyword <1>: Blocks. (line 14) +* STARTUP, keyword <2>: In-buffer Settings. (line 65) +* statistics, for checkboxes: Checkboxes. (line 29) +* statistics, for TODO items: Breaking Down Tasks. (line 6) +* store-link protocol: The store-link protocol. + (line 6) +* storing link, in a source code buffer: Literal Examples. (line 111) +* storing links: Handling Links. (line 9) +* strike-through text, markup rules: Emphasis and Monospace. + (line 6) +* structure editing: Structure Editing. (line 6) +* structure of document: Document Structure. (line 6) +* STYLE, property: Tracking your habits. + (line 6) +* styles, custom: Applying custom styles. + (line 6) +* styles, custom <1>: Advanced topics in ODT export. + (line 34) +* SUBAUTHOR, keyword: Texinfo specific export settings. + (line 14) +* SUBAUTHOR, keyword <1>: Texinfo title and copyright page. + (line 12) +* sublevels, inclusion into tags match: Tag Inheritance. (line 6) +* sublevels, inclusion into TODO list: Global TODO list. (line 38) +* subscript: Subscripts and Superscripts. + (line 6) +* SUBTITLE, keyword: ASCII/Latin-1/UTF-8 export. + (line 46) +* SUBTITLE, keyword <1>: Beamer specific export settings. + (line 44) +* SUBTITLE, keyword <2>: HTML specific export settings. + (line 56) +* SUBTITLE, keyword <3>: LaTeX specific export settings. + (line 63) +* SUBTITLE, keyword <4>: ODT specific export settings. + (line 26) +* SUBTITLE, keyword <5>: Texinfo specific export settings. + (line 11) +* subtree cycling: Global and local cycling. + (line 6) +* subtree visibility states: Global and local cycling. + (line 6) +* subtree, cut and paste: Structure Editing. (line 6) +* subtree, subtree visibility state: Global and local cycling. + (line 6) +* subtrees, cut and paste: Structure Editing. (line 6) +* summary: Summary. (line 6) +* SUMMARY, property: iCalendar Export. (line 51) +* superscript: Subscripts and Superscripts. + (line 6) +* switches, in code blocks: Structure of Code Blocks. + (line 52) +* syntax checker: Org Syntax. (line 24) +* syntax, noweb: Noweb Reference Syntax. + (line 6) +* syntax, of formulas: Formula syntax for Calc. + (line 6) +* table editor, built-in: Built-in Table Editor. + (line 6) +* table editor, table.el: Cooperation. (line 49) +* table indirection: References. (line 148) +* table lookup functions: Lookup functions. (line 6) +* table of contents: Table of Contents. (line 6) +* table of contents, exclude entries: Table of Contents. (line 15) +* table syntax: Built-in Table Editor. + (line 6) +* table-type, Texinfo attribute: Plain lists in Texinfo export. + (line 6) +* table.el: Cooperation. (line 49) +* tables: Tables. (line 6) +* tables, in HTML: Tables in HTML export. + (line 6) +* tables, in LaTeX export: Tables in LaTeX export. + (line 6) +* tables, in ODT export: Tables in ODT export. + (line 6) +* tables, in ODT export <1>: Advanced topics in ODT export. + (line 151) +* tables, in other modes: Tables in Arbitrary Syntax. + (line 6) +* tag completion: Completion. (line 6) +* tag filtering, in agenda: Filtering/limiting agenda items. + (line 20) +* tag inheritance: Tag Inheritance. (line 6) +* tag searches: Tag Searches. (line 6) +* tags: Tags. (line 6) +* tags hierarchy: Tag Hierarchy. (line 6) +* tags view: Matching tags and properties. + (line 6) +* tags, as an agenda view: Storing searches. (line 11) +* tags, groups: Tag Hierarchy. (line 6) +* TAGS, keyword: Setting Tags. (line 22) +* TAGS, keyword <1>: In-buffer Settings. (line 183) +* tags, setting: Setting Tags. (line 6) +* TAGS, special property: Special Properties. (line 13) +* tags-todo: Storing searches. (line 11) +* tags-tree: Storing searches. (line 11) +* tangle, header argument: Extracting Source Code. + (line 23) +* tangle-mode, header argument: Extracting Source Code. + (line 89) +* tangling: Extracting Source Code. + (line 6) +* targets, for links: Internal Links. (line 17) +* targets, radio: Radio Targets. (line 6) +* tasks, breaking down: Breaking Down Tasks. (line 6) +* tasks, repeated: Repeated tasks. (line 6) +* TBLFM keywords, multiple: Editing and debugging formulas. + (line 98) +* TBLFM, keyword: Field and range formulas. + (line 12) +* TBLFM, switching: Editing and debugging formulas. + (line 98) +* template expansion: Structure Templates. (line 21) +* template insertion: Structure Templates. (line 6) +* template, custom: Applying custom styles. + (line 6) +* template, custom <1>: Advanced topics in ODT export. + (line 34) +* templates, for Capture: Capture templates. (line 6) +* Tempo: Structure Templates. (line 21) +* TeX interpretation: Embedded LaTeX. (line 6) +* TeX symbol completion: Completion. (line 6) +* TEXINFO, keyword: Quoting Texinfo code. + (line 9) +* TEXINFO_CLASS, keyword: Texinfo specific export settings. + (line 20) +* TEXINFO_CLASS, keyword <1>: Texinfo file header. (line 19) +* TEXINFO_CLASS, keyword <2>: Headings and sectioning structure. + (line 6) +* TEXINFO_DIR_CATEGORY, keyword: Texinfo specific export settings. + (line 30) +* TEXINFO_DIR_CATEGORY, keyword <1>: Info directory file. (line 6) +* TEXINFO_DIR_DESC, keyword: Texinfo specific export settings. + (line 36) +* TEXINFO_DIR_DESC, keyword <1>: Info directory file. (line 6) +* TEXINFO_DIR_TITLE, keyword: Texinfo specific export settings. + (line 33) +* TEXINFO_DIR_TITLE, keyword <1>: Info directory file. (line 6) +* TEXINFO_FILENAME, keyword: Texinfo specific export settings. + (line 17) +* TEXINFO_FILENAME, keyword <1>: Texinfo file header. (line 6) +* TEXINFO_HEADER, keyword: Texinfo specific export settings. + (line 24) +* TEXINFO_HEADER, keyword <1>: Texinfo file header. (line 11) +* TEXINFO_POST_HEADER, keyword: Texinfo specific export settings. + (line 27) +* TEXINFO_PRINTED_TITLE, keyword: Texinfo specific export settings. + (line 39) +* TEXINFO_PRINTED_TITLE, keyword <1>: Texinfo title and copyright page. + (line 6) +* text areas, in HTML: Text areas in HTML export. + (line 6) +* text search: Search view. (line 6) +* time clocking: Clocking Work Time. (line 6) +* time format, custom: Custom time format. (line 6) +* time grid: Time-of-day specifications. + (line 31) +* time, computing: Durations and time values. + (line 6) +* time, macro: Macro Replacement. (line 56) +* time, reading in minibuffer: The date/time prompt. + (line 6) +* time-of-day specification: Time-of-day specifications. + (line 6) +* timerange: Timestamps. (line 42) +* times: Dates and Times. (line 6) +* timestamp: Dates and Times. (line 6) +* timestamp <1>: Timestamps. (line 14) +* timestamp, inactive: Timestamps. (line 50) +* TIMESTAMP, special property: Special Properties. (line 13) +* timestamp, with repeater interval: Timestamps. (line 25) +* timestamps: Timestamps. (line 6) +* TIMESTAMP_IA, special property: Special Properties. (line 13) +* TIMEZONE, property: iCalendar Export. (line 51) +* TINDEX, keyword: Indices. (line 6) +* TITLE, keyword: Export Settings. (line 60) +* title, macro: Macro Replacement. (line 41) +* toc, in OPTIONS keyword: Table of Contents. (line 6) +* TOC, keyword: Table of Contents. (line 24) +* TODO dependencies: TODO dependencies. (line 6) +* TODO dependencies, NOBLOCKING: TODO dependencies. (line 29) +* TODO items: TODO Items. (line 6) +* TODO keyword matching: Global TODO list. (line 18) +* TODO keyword matching, with tags search: Matching tags and properties. + (line 65) +* TODO keyword sets: Multiple sets in one file. + (line 6) +* TODO keywords completion: Completion. (line 6) +* TODO list, global: Global TODO list. (line 6) +* TODO types: TODO types. (line 6) +* TODO workflow: Workflow states. (line 6) +* todo, as an agenda view: Storing searches. (line 11) +* TODO, keyword: Per-file keywords. (line 6) +* TODO, keyword <1>: In-buffer Settings. (line 190) +* TODO, special property: Special Properties. (line 13) +* todo-tree: Storing searches. (line 11) +* top headline filtering, in agenda: Filtering/limiting agenda items. + (line 20) +* Top node, in Texinfo export: Headings and sectioning structure. + (line 37) +* transient mark mode: Structure Editing. (line 46) +* translator function: Translator functions. + (line 6) +* trees, sparse: Sparse Trees. (line 6) +* trees, visibility: Visibility Cycling. (line 6) +* tty key bindings: TTY Keys. (line 6) +* two-column tables, in Texinfo export: Plain lists in Texinfo export. + (line 6) +* types as TODO keywords: TODO types. (line 6) +* TYP_TODO, keyword: Per-file keywords. (line 6) +* TYP_TODO, keyword <1>: In-buffer Settings. (line 190) +* underlined text, markup rules: Emphasis and Monospace. + (line 6) +* undoing remote-editing events: Agenda Commands. (line 227) +* unison: Uploading Files. (line 6) +* UNNUMBERED, property: Export Settings. (line 149) +* unoconv: Extending ODT export. + (line 12) +* updating, table: Updating the table. (line 6) +* URL links: External Links. (line 6) +* Usenet links: External Links. (line 6) +* using sessions in code blocks: Environment of a Code Block. + (line 279) +* UTF-8 export: ASCII/Latin-1/UTF-8 export. + (line 6) +* var, header argument: Environment of a Code Block. + (line 9) +* variable index, in Texinfo export: Indices. (line 6) +* vectors, in table calculations: Formula syntax for Calc. + (line 14) +* verbatim blocks, in LaTeX export: Example blocks in LaTeX export. + (line 6) +* verbatim text, markup rules: Emphasis and Monospace. + (line 6) +* verse blocks: Paragraphs. (line 13) +* verse blocks, in LaTeX export: Verse blocks in LaTeX export. + (line 6) +* view file commands in agenda: Agenda Commands. (line 28) +* VINDEX, keyword: Indices. (line 6) +* viper.el: Conflicts. (line 51) +* visibility cycling: Visibility Cycling. (line 6) +* visibility cycling, drawers: Drawers. (line 6) +* VISIBILITY, property: Initial visibility. (line 20) +* visible text, printing: Sparse Trees. (line 52) +* VM links: External Links. (line 109) +* Wanderlust links: External Links. (line 109) +* weekly agenda: Weekly/daily agenda. (line 6) +* windmove.el: Conflicts. (line 60) +* workflow states as TODO keywords: Workflow states. (line 6) +* working directory, in a code block: Environment of a Code Block. + (line 309) +* wrap, header argument: Results of Evaluation. + (line 208) +* xelatex: LaTeX/PDF export commands. + (line 25) +* yasnippet.el: Conflicts. (line 74) +* zero width space: Escape Character. (line 6) +* zip: Pre-requisites for ODT export. + (line 6) + + +File: org.info, Node: Key Index, Next: Command and Function Index, Prev: Main Index, Up: Top + +E Key Index +*********** + +�[index�] +* Menu: + +* !: Setting Tags. (line 127) +* ! (Agenda dispatcher): Stuck projects. (line 17) +* # (Agenda dispatcher): Stuck projects. (line 14) +* $: Agenda Commands. (line 265) +* %: Agenda Commands. (line 379) +* ': CDLaTeX mode. (line 57) +* *: Agenda Commands. (line 359) +* * (Agenda dispatcher): Agenda Dispatcher. (line 55) +* +: Agenda Commands. (line 284) +* ,: Agenda Commands. (line 279) +* -: Agenda Commands. (line 289) +* .: The date/time prompt. + (line 84) +* . <1>: Agenda Commands. (line 118) +* / (Agenda dispatcher): Agenda Dispatcher. (line 30) +* 1..9,0: Using column view. (line 35) +* :: Agenda Commands. (line 275) +* <: Using column view. (line 67) +* < <1>: The date/time prompt. + (line 84) +* < (Agenda dispatcher): Agenda Dispatcher. (line 43) +* < < (Agenda dispatcher): Agenda Dispatcher. (line 49) +* >: Using column view. (line 67) +* > <1>: The date/time prompt. + (line 84) +* > <2>: Agenda Commands. (line 328) +* ? (Agenda dispatcher): Pulling from the mobile application. + (line 39) +* [: Agenda Commands. (line 142) +* ^: CDLaTeX mode. (line 43) +* _: CDLaTeX mode. (line 43) +* `: CDLaTeX mode. (line 51) +* a: Using column view. (line 57) +* A: Agenda Commands. (line 64) +* a <1>: Agenda Commands. (line 252) +* a (Agenda dispatcher): Weekly/daily agenda. (line 10) +* b: Agenda Commands. (line 115) +* B: Agenda Commands. (line 383) +* C: Resolving idle time. (line 46) +* c: Agenda Commands. (line 447) +* c <1>: Agenda Commands. (line 450) +* C <1>: Agenda Commands. (line 481) +* C (Agenda dispatcher): Storing searches. (line 11) +* C (Capture menu: Capture templates. (line 11) +* C-#: Advanced features. (line 11) +* C-': Agenda Files. (line 26) +* C-,: Agenda Files. (line 26) +* C-.: The date/time prompt. + (line 84) +* C-0 C-c C-w: Refile and Copy. (line 46) +* C-2 C-c C-w: Refile and Copy. (line 38) +* C-3 C-c C-w: Refile and Copy. (line 41) +* C-c !: Creating Timestamps. (line 25) +* C-c #: Checkboxes. (line 98) +* C-c $: Moving subtrees. (line 10) +* C-c %: Handling Links. (line 141) +* C-c &: Handling Links. (line 146) +* C-c ': Editing and debugging formulas. + (line 37) +* C-c ' <1>: Literal Examples. (line 102) +* C-c ' <2>: Include Files. (line 63) +* C-c ' <3>: Editing Source Code. (line 6) +* C-c ' <4>: Cooperation. (line 59) +* C-c *: Structure Editing. (line 129) +* C-c * <1>: Plain Lists. (line 143) +* C-c * <2>: Updating the table. (line 14) +* C-c +: Built-in Table Editor. + (line 181) +* C-c ,: Priorities. (line 33) +* C-c -: Plain Lists. (line 131) +* C-c - <1>: Built-in Table Editor. + (line 126) +* C-c .: Creating Timestamps. (line 11) +* C-c /: Sparse Trees. (line 16) +* C-c / <1>: Conflicts. (line 51) +* C-c / /: Sparse Trees. (line 20) +* C-c / a: Inserting deadline/schedule. + (line 36) +* C-c / b: Inserting deadline/schedule. + (line 33) +* C-c / d: Inserting deadline/schedule. + (line 26) +* C-c / m: Tag Searches. (line 10) +* C-c / m <1>: Property Searches. (line 11) +* C-c / p: Property Searches. (line 29) +* C-c / r: Sparse Trees. (line 20) +* C-c / t: TODO Basics. (line 35) +* C-c ;: Comment Lines. (line 20) +* C-c <: Creating Timestamps. (line 32) +* C-c =: Column formulas. (line 33) +* C-c = <1>: Editing and debugging formulas. + (line 14) +* C-c >: Creating Timestamps. (line 35) +* C-c ?: Editing and debugging formulas. + (line 25) +* C-c @: Structure Editing. (line 66) +* C-c C-*: Plain Lists. (line 148) +* C-c C-,: Structure Templates. (line 11) +* C-c C-a: Attachment defaults and dispatcher. + (line 20) +* C-c C-a <1>: Agenda Commands. (line 300) +* C-c C-a a: Attachment defaults and dispatcher. + (line 25) +* C-c C-a b: Attachment defaults and dispatcher. + (line 35) +* C-c C-a c: Attachment defaults and dispatcher. + (line 31) +* C-c C-a d: Attachment defaults and dispatcher. + (line 61) +* C-c C-a D: Attachment defaults and dispatcher. + (line 64) +* C-c C-a f: Attachment defaults and dispatcher. + (line 55) +* C-c C-a F: Attachment defaults and dispatcher. + (line 58) +* C-c C-a l: Attachment defaults and dispatcher. + (line 31) +* C-c C-a m: Attachment defaults and dispatcher. + (line 31) +* C-c C-a n: Attachment defaults and dispatcher. + (line 39) +* C-c C-a o: Attachment defaults and dispatcher. + (line 46) +* C-c C-a O: Attachment defaults and dispatcher. + (line 52) +* C-c C-a s: Attachment defaults and dispatcher. + (line 68) +* C-c C-a S: Attachment defaults and dispatcher. + (line 73) +* C-c C-a z: Attachment defaults and dispatcher. + (line 42) +* C-c C-b: Motion. (line 18) +* C-c C-b <1>: Editing support. (line 12) +* C-c C-c: Plain Lists. (line 126) +* C-c C-c <1>: Built-in Table Editor. + (line 60) +* C-c C-c <2>: Column Width and Alignment. + (line 17) +* C-c C-c <3>: Editing and debugging formulas. + (line 45) +* C-c C-c <4>: Editing and debugging formulas. + (line 91) +* C-c C-c <5>: Editing and debugging formulas. + (line 98) +* C-c C-c <6>: Checkboxes. (line 52) +* C-c C-c <7>: Setting Tags. (line 20) +* C-c C-c <8>: Setting Tags. (line 131) +* C-c C-c <9>: Property Syntax. (line 100) +* C-c C-c <10>: Using column view. (line 26) +* C-c C-c <11>: Using column view. (line 49) +* C-c C-c <12>: Capturing column view. + (line 80) +* C-c C-c <13>: Creating Timestamps. (line 29) +* C-c C-c <14>: Clocking commands. (line 53) +* C-c C-c <15>: The clock table. (line 20) +* C-c C-c <16>: Creating Footnotes. (line 65) +* C-c C-c <17>: Evaluating Code Blocks. + (line 22) +* C-c C-c <18>: Key bindings and Useful Functions. + (line 11) +* C-c C-c <19>: The Very Busy C-c C-c Key. + (line 6) +* C-c C-c (Capture buffer): Using capture. (line 15) +* C-c C-c c: Property Syntax. (line 117) +* C-c C-c d: Property Syntax. (line 111) +* C-c C-c D: Property Syntax. (line 114) +* C-c C-c m m: Markdown Export. (line 17) +* C-c C-c m M: Markdown Export. (line 21) +* C-c C-c s: Property Syntax. (line 103) +* C-c C-d: Inserting deadline/schedule. + (line 10) +* C-c C-d <1>: Agenda Commands. (line 307) +* C-c C-e: The Export Dispatcher. + (line 16) +* C-c C-e c a: iCalendar Export. (line 43) +* C-c C-e c c: iCalendar Export. (line 47) +* C-c C-e c f: iCalendar Export. (line 39) +* C-c C-e C-a: The Export Dispatcher. + (line 28) +* C-c C-e C-b: The Export Dispatcher. + (line 46) +* C-c C-e C-s: The Export Dispatcher. + (line 52) +* C-c C-e C-v: Sparse Trees. (line 52) +* C-c C-e C-v <1>: The Export Dispatcher. + (line 64) +* C-c C-e h h: HTML export commands. + (line 7) +* C-c C-e h H: HTML export commands. + (line 13) +* C-c C-e h o: HTML export commands. + (line 7) +* C-c C-e i i: Texinfo export commands. + (line 11) +* C-c C-e i t: Texinfo export commands. + (line 7) +* C-c C-e l b: Beamer export commands. + (line 7) +* C-c C-e l B: Beamer export commands. + (line 12) +* C-c C-e l l: LaTeX/PDF export commands. + (line 7) +* C-c C-e l L: LaTeX/PDF export commands. + (line 11) +* C-c C-e l O: Beamer export commands. + (line 20) +* C-c C-e l o: LaTeX/PDF export commands. + (line 17) +* C-c C-e l P: Beamer export commands. + (line 16) +* C-c C-e l p: LaTeX/PDF export commands. + (line 14) +* C-c C-e m o: Markdown Export. (line 24) +* C-c C-e o o: ODT export commands. (line 7) +* C-c C-e o O: ODT export commands. (line 23) +* C-c C-e O o: Org Export. (line 15) +* C-c C-e O v: Org Export. (line 19) +* C-c C-e P a: Triggering Publication. + (line 19) +* C-c C-e P f: Triggering Publication. + (line 16) +* C-c C-e P p: Triggering Publication. + (line 13) +* C-c C-e P x: Triggering Publication. + (line 9) +* C-c C-e t a: ASCII/Latin-1/UTF-8 export. + (line 26) +* C-c C-e t A: ASCII/Latin-1/UTF-8 export. + (line 35) +* C-c C-e t l: ASCII/Latin-1/UTF-8 export. + (line 26) +* C-c C-e t L: ASCII/Latin-1/UTF-8 export. + (line 35) +* C-c C-e t u: ASCII/Latin-1/UTF-8 export. + (line 26) +* C-c C-e t U: ASCII/Latin-1/UTF-8 export. + (line 35) +* C-c C-f: Motion. (line 15) +* C-c C-j: Motion. (line 24) +* C-c C-k: Global and local cycling. + (line 52) +* C-c C-k (Capture buffer): Using capture. (line 31) +* C-c C-l: Handling Links. (line 71) +* C-c C-M-w: Refile and Copy. (line 55) +* C-c C-n: Motion. (line 9) +* C-c C-o: Handling Links. (line 108) +* C-c C-o <1>: Creating Timestamps. (line 40) +* C-c C-o <2>: Agenda Commands. (line 56) +* C-c C-o <3>: Creating Footnotes. (line 71) +* C-c C-o <4>: Key bindings and Useful Functions. + (line 11) +* C-c C-p: Motion. (line 12) +* C-c C-q: Editing and debugging formulas. + (line 49) +* C-c C-q <1>: Setting Tags. (line 11) +* C-c C-r: Global and local cycling. + (line 43) +* C-c C-r <1>: Editing and debugging formulas. + (line 52) +* C-c C-s: Inserting deadline/schedule. + (line 18) +* C-c C-s <1>: Agenda Commands. (line 303) +* C-c C-t: TODO Basics. (line 14) +* C-c C-t <1>: Clocking commands. (line 71) +* C-c C-u: Motion. (line 21) +* C-c C-v a: Key bindings and Useful Functions. + (line 20) +* C-c C-v b: Key bindings and Useful Functions. + (line 20) +* C-c C-v c: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-a: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-b: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-c: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-d: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-e: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-f: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-g: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-h: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-i: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-I: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-j: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-l: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-n: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-o: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-p: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-r: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-s: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-t: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-u: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-v: Noweb Reference Syntax. + (line 202) +* C-c C-v C-v <1>: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-x: Key bindings and Useful Functions. + (line 20) +* C-c C-v C-z: Key bindings and Useful Functions. + (line 20) +* C-c C-v d: Key bindings and Useful Functions. + (line 20) +* C-c C-v e: Evaluating Code Blocks. + (line 22) +* C-c C-v e <1>: Key bindings and Useful Functions. + (line 20) +* C-c C-v f: Extracting Source Code. + (line 116) +* C-c C-v f <1>: Key bindings and Useful Functions. + (line 20) +* C-c C-v g: Key bindings and Useful Functions. + (line 20) +* C-c C-v h: Key bindings and Useful Functions. + (line 20) +* C-c C-v i: Library of Babel. (line 12) +* C-c C-v i <1>: Key bindings and Useful Functions. + (line 20) +* C-c C-v I: Key bindings and Useful Functions. + (line 20) +* C-c C-v j: Key bindings and Useful Functions. + (line 20) +* C-c C-v l: Key bindings and Useful Functions. + (line 20) +* C-c C-v n: Key bindings and Useful Functions. + (line 20) +* C-c C-v o: Key bindings and Useful Functions. + (line 20) +* C-c C-v p: Key bindings and Useful Functions. + (line 20) +* C-c C-v r: Key bindings and Useful Functions. + (line 20) +* C-c C-v s: Key bindings and Useful Functions. + (line 20) +* C-c C-v t: Extracting Source Code. + (line 111) +* C-c C-v t <1>: Key bindings and Useful Functions. + (line 20) +* C-c C-v u: Key bindings and Useful Functions. + (line 20) +* C-c C-v v: Noweb Reference Syntax. + (line 202) +* C-c C-v v <1>: Key bindings and Useful Functions. + (line 20) +* C-c C-v x: Key bindings and Useful Functions. + (line 20) +* C-c C-v z: Key bindings and Useful Functions. + (line 20) +* C-c C-w: Structure Editing. (line 104) +* C-c C-w <1>: Refile and Copy. (line 13) +* C-c C-w <2>: Agenda Commands. (line 249) +* C-c C-w (Capture buffer): Using capture. (line 22) +* C-c C-x ,: Timers. (line 44) +* C-c C-x -: Timers. (line 36) +* C-c C-x .: Timers. (line 32) +* C-c C-x 0: Timers. (line 13) +* C-c C-x ;: Timers. (line 23) +* C-c C-x <: Agenda Files. (line 43) +* C-c C-x >: Agenda Files. (line 52) +* C-c C-x > <1>: Agenda Commands. (line 206) +* C-c C-x @: Citations. (line 14) +* C-c C-x a: Internal archiving. (line 39) +* C-c C-x A: Internal archiving. (line 54) +* C-c C-x a <1>: Agenda Commands. (line 257) +* C-c C-x A <1>: Agenda Commands. (line 261) +* C-c C-x b: Global and local cycling. + (line 59) +* C-c C-x b <1>: Agenda Commands. (line 49) +* C-c C-x c: Structure Editing. (line 96) +* C-c C-x C-a: Archiving. (line 12) +* C-c C-x C-a <1>: Agenda Commands. (line 252) +* C-c C-x C-b: Checkboxes. (line 58) +* C-c C-x C-c: Using column view. (line 10) +* C-c C-x C-c <1>: Agenda Commands. (line 197) +* C-c C-x C-c <2>: Agenda Column View. (line 12) +* C-c C-x C-d: Clocking commands. (line 84) +* C-c C-x C-e: Clocking commands. (line 50) +* C-c C-x C-e <1>: Effort Estimates. (line 24) +* C-c C-x C-i: Clocking commands. (line 7) +* C-c C-x C-j: Clocking commands. (line 79) +* C-c C-x C-l: Previewing LaTeX fragments. + (line 18) +* C-c C-x C-n: Handling Links. (line 153) +* C-c C-x C-o: Clocking commands. (line 36) +* C-c C-x C-p: Handling Links. (line 153) +* C-c C-x C-q: Clocking commands. (line 75) +* C-c C-x C-r: Checkboxes. (line 75) +* C-c C-x C-s: Moving subtrees. (line 10) +* C-c C-x C-s <1>: Agenda Commands. (line 265) +* C-c C-x C-t: Custom time format. (line 13) +* C-c C-x C-u: Capturing column view. + (line 80) +* C-c C-x C-u <1>: The clock table. (line 20) +* C-c C-x C-u <2>: Dynamic Blocks. (line 25) +* C-c C-x C-v: Images. (line 24) +* C-c C-x C-w: Structure Editing. (line 70) +* C-c C-x C-w <1>: Built-in Table Editor. + (line 157) +* C-c C-x C-x: Clocking commands. (line 44) +* C-c C-x C-y: Structure Editing. (line 78) +* C-c C-x C-y <1>: Built-in Table Editor. + (line 161) +* C-c C-x d: Drawers. (line 18) +* C-c C-x e: Effort Estimates. (line 19) +* C-c C-x e <1>: Agenda Commands. (line 292) +* C-c C-x f: Creating Footnotes. (line 42) +* C-c C-x g: RSS Feeds. (line 23) +* C-c C-x G: RSS Feeds. (line 27) +* C-c C-x I: Documentation Access. + (line 6) +* C-c C-x M-w: Structure Editing. (line 74) +* C-c C-x M-w <1>: Built-in Table Editor. + (line 151) +* C-c C-x o: TODO dependencies. (line 38) +* C-c C-x o <1>: Checkboxes. (line 90) +* C-c C-x p: Property Syntax. (line 90) +* C-c C-x p <1>: Using Header Arguments. + (line 70) +* C-c C-x q: Tag Hierarchy. (line 87) +* C-c C-x v: Global and local cycling. + (line 65) +* C-c C-x x: Capturing column view. + (line 72) +* C-c C-x x <1>: The clock table. (line 11) +* C-c C-x x <2>: Dynamic Blocks. (line 10) +* C-c C-x \: Subscripts and Superscripts. + (line 27) +* C-c C-x \ <1>: Special Symbols. (line 31) +* C-c C-x _: Timers. (line 47) +* C-c C-y: Creating Timestamps. (line 62) +* C-c C-y <1>: Clocking commands. (line 53) +* C-c C-z: Drawers. (line 39) +* C-c C-z <1>: Agenda Commands. (line 295) +* C-c M-w: Refile and Copy. (line 51) +* C-c RET: Built-in Table Editor. + (line 130) +* C-c TAB: Global and local cycling. + (line 55) +* C-c TAB <1>: Column Width and Alignment. + (line 44) +* C-c [: Agenda Files. (line 16) +* C-c \: Tag Searches. (line 10) +* C-c \ <1>: Property Searches. (line 11) +* C-c ]: Agenda Files. (line 22) +* C-c ^: Structure Editing. (line 108) +* C-c ^ <1>: Plain Lists. (line 159) +* C-c ^ <2>: Built-in Table Editor. + (line 134) +* C-c `: Built-in Table Editor. + (line 202) +* C-c {: Editing and debugging formulas. + (line 34) +* C-c { <1>: CDLaTeX mode. (line 25) +* C-c |: Built-in Table Editor. + (line 42) +* C-c | <1>: Built-in Table Editor. + (line 221) +* C-c }: Editing and debugging formulas. + (line 29) +* C-c } <1>: Editing and debugging formulas. + (line 83) +* C-c ~: Cooperation. (line 63) +* C-g: Setting Tags. (line 121) +* C-k: Agenda Commands. (line 243) +* C-RET: Structure Editing. (line 26) +* C-S-DOWN: Clocking commands. (line 59) +* C-S-LEFT: Multiple sets in one file. + (line 28) +* C-S-LEFT <1>: Agenda Commands. (line 240) +* C-S-RET: Structure Editing. (line 33) +* C-S-RIGHT: Multiple sets in one file. + (line 28) +* C-S-RIGHT <1>: Agenda Commands. (line 237) +* C-S-UP: Clocking commands. (line 59) +* C-TAB: Internal archiving. (line 51) +* C-u C-c !: Creating Timestamps. (line 25) +* C-u C-c *: Updating the table. (line 19) +* C-u C-c .: Creating Timestamps. (line 16) +* C-u C-c =: Field and range formulas. + (line 28) +* C-u C-c = <1>: Editing and debugging formulas. + (line 14) +* C-u C-c C-c: Updating the table. (line 19) +* C-u C-c C-l: Handling Links. (line 94) +* C-u C-c C-t: Progress Logging. (line 10) +* C-u C-c C-w: Refile and Copy. (line 32) +* C-u C-c C-x a: Internal archiving. (line 44) +* C-u C-c C-x C-s: Moving subtrees. (line 14) +* C-u C-c C-x C-u: Capturing column view. + (line 84) +* C-u C-c C-x C-u <1>: The clock table. (line 24) +* C-u C-c C-x C-u <2>: Dynamic Blocks. (line 28) +* C-u C-c TAB: Column Width and Alignment. + (line 54) +* C-u C-u C-c !: Creating Timestamps. (line 25) +* C-u C-u C-c *: Updating the table. (line 24) +* C-u C-u C-c .: Creating Timestamps. (line 21) +* C-u C-u C-c =: Editing and debugging formulas. + (line 19) +* C-u C-u C-c C-c: Updating the table. (line 24) +* C-u C-u C-c C-t: Multiple sets in one file. + (line 28) +* C-u C-u C-c C-w: Refile and Copy. (line 35) +* C-u C-u C-c C-x C-s: Moving subtrees. (line 21) +* C-u C-u C-c TAB: Column Width and Alignment. + (line 57) +* C-u C-u C-u C-c C-w: Refile and Copy. (line 46) +* C-u C-u C-u C-u C-c C-t: TODO dependencies. (line 46) +* C-u C-u C-u TAB: Global and local cycling. + (line 40) +* C-u C-u TAB: Global and local cycling. + (line 36) +* C-u C-u TAB <1>: Initial visibility. (line 26) +* C-u TAB: Global and local cycling. + (line 20) +* C-v: The date/time prompt. + (line 84) +* C-x C-s: Editing and debugging formulas. + (line 45) +* C-x C-s <1>: Agenda Commands. (line 193) +* C-x C-s <2>: Editing Source Code. (line 11) +* C-x C-w: Exporting Agenda Views. + (line 13) +* C-x n b: Structure Editing. (line 123) +* C-x n s: Structure Editing. (line 120) +* C-x n w: Structure Editing. (line 126) +* C-y: Structure Editing. (line 84) +* C-_: Agenda Commands. (line 227) +* d: Agenda Commands. (line 71) +* D: Agenda Commands. (line 127) +* e: Using column view. (line 43) +* E: Agenda Commands. (line 173) +* e <1>: Agenda Commands. (line 292) +* e (Agenda dispatcher): Exporting Agenda Views. + (line 53) +* F: Agenda Commands. (line 42) +* f: Agenda Commands. (line 110) +* g: Using column view. (line 22) +* G: Agenda Commands. (line 181) +* g <1>: Agenda Commands. (line 186) +* H: Agenda Commands. (line 485) +* I: Agenda Commands. (line 332) +* i: Agenda Commands. (line 454) +* j: Agenda Commands. (line 121) +* J: Agenda Commands. (line 124) +* J <1>: Agenda Commands. (line 342) +* k: Resolving idle time. (line 23) +* K: Resolving idle time. (line 29) +* k <1>: Agenda Commands. (line 345) +* k c (Agenda): Using capture. (line 33) +* l: Agenda Commands. (line 131) +* m: Agenda Commands. (line 353) +* M: Agenda Commands. (line 472) +* m (Agenda dispatcher): Tag Searches. (line 15) +* M (Agenda dispatcher): Tag Searches. (line 19) +* m (Agenda dispatcher) <1>: Property Searches. (line 15) +* M (Agenda dispatcher) <1>: Property Searches. (line 18) +* m (Agenda dispatcher) <2>: Matching tags and properties. + (line 13) +* M (Agenda dispatcher) <2>: Matching tags and properties. + (line 21) +* M-*: Agenda Commands. (line 375) +* M-a: Built-in Table Editor. + (line 78) +* M-DOWN: Structure Editing. (line 63) +* M-DOWN <1>: Plain Lists. (line 102) +* M-DOWN <2>: Built-in Table Editor. + (line 104) +* M-DOWN <3>: Editing and debugging formulas. + (line 80) +* M-DOWN <4>: Agenda Commands. (line 217) +* M-DOWN <5>: Key bindings and Useful Functions. + (line 11) +* M-e: Built-in Table Editor. + (line 82) +* M-g M-n: Sparse Trees. (line 32) +* M-g M-p: Sparse Trees. (line 35) +* M-g n: Sparse Trees. (line 32) +* M-g p: Sparse Trees. (line 35) +* M-LEFT: Structure Editing. (line 44) +* M-LEFT <1>: Plain Lists. (line 108) +* M-LEFT <2>: Built-in Table Editor. + (line 88) +* M-m: Agenda Commands. (line 371) +* M-RET: Structure Editing. (line 7) +* M-RET <1>: Plain Lists. (line 83) +* M-RET <2>: Built-in Table Editor. + (line 168) +* M-RET <3>: Timers. (line 40) +* M-RIGHT: Structure Editing. (line 44) +* M-RIGHT <1>: Plain Lists. (line 108) +* M-RIGHT <2>: Built-in Table Editor. + (line 91) +* M-S-DOWN: Built-in Table Editor. + (line 122) +* M-S-DOWN <1>: Editing and debugging formulas. + (line 74) +* M-S-LEFT: Structure Editing. (line 54) +* M-S-LEFT <1>: Plain Lists. (line 113) +* M-S-LEFT <2>: Built-in Table Editor. + (line 94) +* M-S-LEFT <3>: The date/time prompt. + (line 84) +* M-S-RET: Structure Editing. (line 29) +* M-S-RET <1>: Plain Lists. (line 91) +* M-S-RET <2>: Checkboxes. (line 86) +* M-S-RIGHT: Structure Editing. (line 57) +* M-S-RIGHT <1>: Plain Lists. (line 113) +* M-S-RIGHT <2>: Built-in Table Editor. + (line 97) +* M-S-RIGHT <3>: The date/time prompt. + (line 84) +* M-S-UP: Built-in Table Editor. + (line 107) +* M-S-UP <1>: Editing and debugging formulas. + (line 71) +* M-TAB: Editing and debugging formulas. + (line 63) +* M-TAB <1>: Per-file keywords. (line 26) +* M-TAB <2>: Setting Tags. (line 6) +* M-TAB <3>: Property Syntax. (line 86) +* M-TAB <4>: Completion. (line 15) +* M-UP: Structure Editing. (line 60) +* M-UP <1>: Plain Lists. (line 102) +* M-UP <2>: Built-in Table Editor. + (line 101) +* M-UP <3>: Editing and debugging formulas. + (line 77) +* M-UP <4>: Agenda Commands. (line 210) +* M-UP <5>: Key bindings and Useful Functions. + (line 11) +* M-v: The date/time prompt. + (line 84) +* mouse-1: Handling Links. (line 133) +* mouse-1 <1>: The date/time prompt. + (line 84) +* mouse-1 <2>: Creating Footnotes. (line 71) +* mouse-2: Handling Links. (line 133) +* mouse-2 <1>: Agenda Commands. (line 36) +* mouse-2 <2>: Creating Footnotes. (line 71) +* mouse-3: Handling Links. (line 137) +* mouse-3 <1>: Agenda Commands. (line 29) +* n: Using column view. (line 39) +* n <1>: Agenda Commands. (line 20) +* o: Agenda Commands. (line 68) +* O: Agenda Commands. (line 336) +* p: Using column view. (line 39) +* p <1>: Agenda Commands. (line 23) +* q: Setting Tags. (line 124) +* q <1>: Using column view. (line 26) +* q <2>: Agenda Commands. (line 491) +* r: Using column view. (line 22) +* r <1>: Global TODO list. (line 25) +* R: Agenda Commands. (line 154) +* r <2>: Agenda Commands. (line 186) +* RET: Built-in Table Editor. + (line 73) +* RET <1>: Handling Links. (line 129) +* RET <2>: Setting Tags. (line 118) +* RET <3>: The date/time prompt. + (line 84) +* RET <4>: Agenda Commands. (line 39) +* s: Resolving idle time. (line 35) +* S: Resolving idle time. (line 40) +* s <1>: Agenda Commands. (line 193) +* S <1>: Agenda Commands. (line 476) +* s (Agenda dispatcher): Agenda Dispatcher. (line 25) +* s (Agenda dispatcher) <1>: Search view. (line 10) +* S-DOWN: Plain Lists. (line 95) +* S-DOWN <1>: Built-in Table Editor. + (line 113) +* S-DOWN <2>: Editing and debugging formulas. + (line 66) +* S-DOWN <3>: Priorities. (line 41) +* S-DOWN <4>: Creating Timestamps. (line 50) +* S-DOWN <5>: The date/time prompt. + (line 84) +* S-DOWN <6>: Agenda Commands. (line 289) +* S-LEFT: Plain Lists. (line 154) +* S-LEFT <1>: Built-in Table Editor. + (line 116) +* S-LEFT <2>: Editing and debugging formulas. + (line 66) +* S-LEFT <3>: TODO Basics. (line 28) +* S-LEFT <4>: Multiple sets in one file. + (line 36) +* S-LEFT <5>: Property Syntax. (line 108) +* S-LEFT <6>: Using column view. (line 39) +* S-LEFT <7>: Creating Timestamps. (line 45) +* S-LEFT <8>: The date/time prompt. + (line 84) +* S-LEFT <9>: The clock table. (line 29) +* S-LEFT <10>: Agenda Commands. (line 324) +* S-M-DOWN: Clocking commands. (line 64) +* S-M-LEFT: Using column view. (line 73) +* S-M-RET: TODO Basics. (line 54) +* S-M-RIGHT: Using column view. (line 70) +* S-M-UP: Clocking commands. (line 64) +* S-RET: Built-in Table Editor. + (line 186) +* S-RIGHT: Plain Lists. (line 154) +* S-RIGHT <1>: Built-in Table Editor. + (line 119) +* S-RIGHT <2>: Editing and debugging formulas. + (line 66) +* S-RIGHT <3>: TODO Basics. (line 28) +* S-RIGHT <4>: Multiple sets in one file. + (line 36) +* S-RIGHT <5>: Property Syntax. (line 108) +* S-RIGHT <6>: Using column view. (line 39) +* S-RIGHT <7>: Creating Timestamps. (line 45) +* S-RIGHT <8>: The date/time prompt. + (line 84) +* S-RIGHT <9>: The clock table. (line 29) +* S-RIGHT <10>: Agenda Commands. (line 311) +* S-TAB: Global and local cycling. + (line 20) +* S-TAB <1>: Built-in Table Editor. + (line 70) +* S-UP: Plain Lists. (line 95) +* S-UP <1>: Built-in Table Editor. + (line 110) +* S-UP <2>: Editing and debugging formulas. + (line 66) +* S-UP <3>: Priorities. (line 41) +* S-UP <4>: Creating Timestamps. (line 50) +* S-UP <5>: The date/time prompt. + (line 84) +* S-UP <6>: Agenda Commands. (line 284) +* SPC: Setting Tags. (line 115) +* SPC <1>: Agenda Commands. (line 29) +* t: Agenda Commands. (line 231) +* T: Agenda Commands. (line 270) +* t (Agenda dispatcher): TODO Basics. (line 46) +* t (Agenda dispatcher) <1>: Global TODO list. (line 10) +* T (Agenda dispatcher): Global TODO list. (line 18) +* TAB: Global and local cycling. + (line 11) +* TAB <1>: Structure Editing. (line 37) +* TAB <2>: Plain Lists. (line 70) +* TAB <3>: Built-in Table Editor. + (line 63) +* TAB <4>: Editing and debugging formulas. + (line 56) +* TAB <5>: Setting Tags. (line 108) +* TAB <6>: Agenda Commands. (line 36) +* TAB <7>: CDLaTeX mode. (line 29) +* u: Agenda Commands. (line 363) +* U: Agenda Commands. (line 367) +* v: Using column view. (line 53) +* v a: Agenda Commands. (line 146) +* v A: Agenda Commands. (line 151) +* v c: Agenda Commands. (line 165) +* v d: Agenda Commands. (line 71) +* v E: Agenda Commands. (line 173) +* v l: Agenda Commands. (line 131) +* v L: Agenda Commands. (line 131) +* v m: Agenda Commands. (line 91) +* v R: Agenda Commands. (line 154) +* v SPC: Agenda Commands. (line 107) +* v w: Agenda Commands. (line 81) +* v y: Agenda Commands. (line 101) +* v [: Agenda Commands. (line 142) +* w: Agenda Commands. (line 81) +* X: Agenda Commands. (line 339) +* x: Agenda Commands. (line 495) +* z: Agenda Commands. (line 295) + + +File: org.info, Node: Command and Function Index, Next: Variable Index, Prev: Key Index, Up: Top + +F Command and Function Index +**************************** + +�[index�] +* Menu: + +* lisp-complete-symbol: Editing and debugging formulas. + (line 63) +* next-error: Sparse Trees. (line 32) +* or-clock-goto: Clocking commands. (line 79) +* org-agenda: Activation. (line 13) +* org-agenda-add-note: Agenda Commands. (line 295) +* org-agenda-archive: Agenda Commands. (line 265) +* org-agenda-archive-default-with-confirmation: Agenda Commands. + (line 252) +* org-agenda-archive-to-archive-sibling: Agenda Commands. (line 261) +* org-agenda-archives-mode: Agenda Commands. (line 146) +* org-agenda-bulk-action: Agenda Commands. (line 383) +* org-agenda-bulk-mark: Agenda Commands. (line 353) +* org-agenda-bulk-mark-all: Agenda Commands. (line 359) +* org-agenda-bulk-mark-regexp: Agenda Commands. (line 379) +* org-agenda-bulk-remove-all-marks: Agenda Commands. (line 367) +* org-agenda-bulk-toggle: Agenda Commands. (line 371) +* org-agenda-bulk-toggle-all: Agenda Commands. (line 375) +* org-agenda-bulk-unmark: Agenda Commands. (line 363) +* org-agenda-capture: Agenda Commands. (line 345) +* org-agenda-clock-cancel: Agenda Commands. (line 339) +* org-agenda-clock-goto: Agenda Commands. (line 124) +* org-agenda-clock-goto <1>: Agenda Commands. (line 342) +* org-agenda-clock-in: Agenda Commands. (line 332) +* org-agenda-clock-out: Agenda Commands. (line 336) +* org-agenda-clockreport-mode: Agenda Commands. (line 154) +* org-agenda-columns: Agenda Commands. (line 197) +* org-agenda-columns <1>: Agenda Column View. (line 12) +* org-agenda-convert-date: Agenda Commands. (line 481) +* org-agenda-date-prompt: Agenda Commands. (line 328) +* org-agenda-day-view: Agenda Commands. (line 71) +* org-agenda-deadline: Agenda Commands. (line 307) +* org-agenda-diary-entry: Agenda Commands. (line 454) +* org-agenda-do-date-earlier: Agenda Commands. (line 324) +* org-agenda-do-date-later: Agenda Commands. (line 311) +* org-agenda-drag-line-backward: Agenda Commands. (line 210) +* org-agenda-drag-line-forward: Agenda Commands. (line 217) +* org-agenda-earlier: Agenda Commands. (line 115) +* org-agenda-entry-text-mode: Agenda Commands. (line 173) +* org-agenda-exit: Agenda Commands. (line 495) +* org-agenda-file-to-front: Agenda Files. (line 16) +* org-agenda-filter: Filtering/limiting agenda items. + (line 73) +* org-agenda-filter-by-category: Filtering/limiting agenda items. + (line 38) +* org-agenda-filter-by-effort: Filtering/limiting agenda items. + (line 49) +* org-agenda-filter-by-regexp: Filtering/limiting agenda items. + (line 44) +* org-agenda-filter-by-tag: Filtering/limiting agenda items. + (line 28) +* org-agenda-filter-by-top-headline: Filtering/limiting agenda items. + (line 68) +* org-agenda-follow-mode: Agenda Commands. (line 42) +* org-agenda-goto: Agenda Commands. (line 36) +* org-agenda-goto-calendar: Agenda Commands. (line 447) +* org-agenda-goto-date: Agenda Commands. (line 121) +* org-agenda-goto-today: Agenda Commands. (line 118) +* org-agenda-holidays: Agenda Commands. (line 485) +* org-agenda-kill: Agenda Commands. (line 243) +* org-agenda-later: Agenda Commands. (line 110) +* org-agenda-limit-interactively: Filtering/limiting agenda items. + (line 165) +* org-agenda-list: Weekly/daily agenda. (line 10) +* org-agenda-list-stuck-projects: Stuck projects. (line 14) +* org-agenda-log-mode: Agenda Commands. (line 131) +* org-agenda-manipulate-query-add: Agenda Commands. (line 142) +* org-agenda-month-view: Agenda Commands. (line 91) +* org-agenda-next-line: Agenda Commands. (line 20) +* org-agenda-open-link: Agenda Commands. (line 56) +* org-agenda-phases-of-moon: Agenda Commands. (line 472) +* org-agenda-previous-line: Agenda Commands. (line 23) +* org-agenda-priority: Agenda Commands. (line 279) +* org-agenda-priority-down: Agenda Commands. (line 289) +* org-agenda-priority-up: Agenda Commands. (line 284) +* org-agenda-quit: Agenda Commands. (line 491) +* org-agenda-recenter: Agenda Commands. (line 33) +* org-agenda-redo: Agenda Commands. (line 186) +* org-agenda-refile: Agenda Commands. (line 249) +* org-agenda-remove-restriction-lock: Agenda Files. (line 52) +* org-agenda-remove-restriction-lock <1>: Agenda Files. (line 65) +* org-agenda-remove-restriction-lock <2>: Agenda Commands. (line 206) +* org-agenda-reset-view: Agenda Commands. (line 107) +* org-agenda-schedule: Agenda Commands. (line 303) +* org-agenda-set-effort: Agenda Commands. (line 292) +* org-agenda-set-restriction-lock: Agenda Files. (line 43) +* org-agenda-set-tags: Agenda Commands. (line 275) +* org-agenda-show-and-scroll-up: Agenda Commands. (line 29) +* org-agenda-show-tags: Agenda Commands. (line 270) +* org-agenda-sunrise-sunset: Agenda Commands. (line 476) +* org-agenda-switch-to: Agenda Commands. (line 39) +* org-agenda-todo: Agenda Commands. (line 231) +* org-agenda-todo-nextset: Agenda Commands. (line 237) +* org-agenda-toggle-archive-tag: Agenda Commands. (line 257) +* org-agenda-toggle-diary: Agenda Commands. (line 127) +* org-agenda-tree-to-indirect-buffer: Agenda Commands. (line 49) +* org-agenda-undo: Agenda Commands. (line 227) +* org-agenda-week-view: Agenda Commands. (line 81) +* org-agenda-write: Exporting Agenda Views. + (line 13) +* org-agenda-year-view: Agenda Commands. (line 101) +* org-archive-subtree: Moving subtrees. (line 10) +* org-archive-subtree-default: Archiving. (line 12) +* org-archive-to-archive-sibling: Internal archiving. (line 54) +* org-ascii-convert-region-to-ascii: Export in Foreign Buffers. + (line 11) +* org-ascii-convert-region-to-utf8: Export in Foreign Buffers. + (line 14) +* org-ascii-export-as-ascii: ASCII/Latin-1/UTF-8 export. + (line 35) +* org-ascii-export-to-ascii: ASCII/Latin-1/UTF-8 export. + (line 26) +* org-attach: Attachment defaults and dispatcher. + (line 20) +* org-attach <1>: Agenda Commands. (line 300) +* org-attach-attach: Attachment defaults and dispatcher. + (line 25) +* org-attach-buffer: Attachment defaults and dispatcher. + (line 35) +* org-attach-dired-to-subtree: Attach from Dired. (line 6) +* org-attach-new: Attachment defaults and dispatcher. + (line 39) +* org-attach-open: Attachment defaults and dispatcher. + (line 46) +* org-attach-open-in-emacs: Attachment defaults and dispatcher. + (line 52) +* org-attach-reveal: Attachment defaults and dispatcher. + (line 55) +* org-attach-reveal-in-emacs: Attachment defaults and dispatcher. + (line 58) +* org-attach-sync: Attachment defaults and dispatcher. + (line 42) +* org-babel-check-src-block: Key bindings and Useful Functions. + (line 20) +* org-babel-demarcate-block: Key bindings and Useful Functions. + (line 20) +* org-babel-describe-bindings: Key bindings and Useful Functions. + (line 20) +* org-babel-do-key-sequence-in-edit-buffer: Key bindings and Useful Functions. + (line 20) +* org-babel-execute-buffer: Key bindings and Useful Functions. + (line 20) +* org-babel-execute-maybe: Key bindings and Useful Functions. + (line 20) +* org-babel-execute-src-block: Evaluating Code Blocks. + (line 22) +* org-babel-execute-src-block <1>: Key bindings and Useful Functions. + (line 11) +* org-babel-execute-subtree: Key bindings and Useful Functions. + (line 20) +* org-babel-expand-src-block: Noweb Reference Syntax. + (line 202) +* org-babel-expand-src-block <1>: Key bindings and Useful Functions. + (line 20) +* org-babel-goto-named-result: Key bindings and Useful Functions. + (line 20) +* org-babel-goto-named-src-block: Key bindings and Useful Functions. + (line 20) +* org-babel-goto-src-block-head: Key bindings and Useful Functions. + (line 20) +* org-babel-insert-header-arg: Key bindings and Useful Functions. + (line 20) +* org-babel-load-in-session: Key bindings and Useful Functions. + (line 11) +* org-babel-load-in-session <1>: Key bindings and Useful Functions. + (line 20) +* org-babel-lob-ingest: Library of Babel. (line 12) +* org-babel-lob-ingest <1>: Key bindings and Useful Functions. + (line 20) +* org-babel-next-src-block: Key bindings and Useful Functions. + (line 20) +* org-babel-open-src-block-result: Key bindings and Useful Functions. + (line 11) +* org-babel-open-src-block-result <1>: Key bindings and Useful Functions. + (line 20) +* org-babel-pop-to-session: Key bindings and Useful Functions. + (line 11) +* org-babel-previous-src-block: Key bindings and Useful Functions. + (line 20) +* org-babel-sha1-hash: Key bindings and Useful Functions. + (line 20) +* org-babel-switch-to-session-with-code: Key bindings and Useful Functions. + (line 20) +* org-babel-tangle: Extracting Source Code. + (line 111) +* org-babel-tangle <1>: Key bindings and Useful Functions. + (line 20) +* org-babel-tangle-file: Extracting Source Code. + (line 116) +* org-babel-tangle-file <1>: Key bindings and Useful Functions. + (line 20) +* org-babel-tangle-jump-to-org: Extracting Source Code. + (line 129) +* org-babel-view-src-block-info: Key bindings and Useful Functions. + (line 20) +* org-backward-heading-same-level: Motion. (line 18) +* org-batch-agenda: Extracting Agenda Information. + (line 10) +* org-batch-agenda-csv: Extracting Agenda Information. + (line 41) +* org-bbdb-anniversaries: Weekly/daily agenda. (line 78) +* org-bbdb-anniversaries-future: Weekly/daily agenda. (line 109) +* org-beamer-export-as-latex: Beamer export commands. + (line 12) +* org-beamer-export-to-latex: Beamer export commands. + (line 7) +* org-beamer-export-to-pdf: Beamer export commands. + (line 16) +* org-beamer-select-environment: Editing support. (line 12) +* org-buffer-property-keys: Using the Property API. + (line 34) +* org-calendar-goto-agenda: Agenda Commands. (line 450) +* org-capture: Activation. (line 13) +* org-capture <1>: Using capture. (line 7) +* org-capture-finalize: Using capture. (line 15) +* org-capture-kill: Using capture. (line 31) +* org-capture-refile: Using capture. (line 22) +* org-check-after-date: Inserting deadline/schedule. + (line 36) +* org-check-before-date: Inserting deadline/schedule. + (line 33) +* org-check-deadlines: Inserting deadline/schedule. + (line 26) +* org-cite-insert: Citations. (line 14) +* org-clock-cancel: Clocking commands. (line 75) +* org-clock-display: Clocking commands. (line 84) +* org-clock-in: Clocking commands. (line 7) +* org-clock-in-last: Clocking commands. (line 44) +* org-clock-modify-effort-estimate: Clocking commands. (line 50) +* org-clock-modify-effort-estimate <1>: Effort Estimates. (line 24) +* org-clock-out: Clocking commands. (line 36) +* org-clock-report: The clock table. (line 11) +* org-clock-timestamp-down: Clocking commands. (line 64) +* org-clock-timestamp-up: Clocking commands. (line 64) +* org-clock-timestamps-down: Clocking commands. (line 59) +* org-clock-timestamps-up: Clocking commands. (line 59) +* org-clocktable-try-shift: The clock table. (line 29) +* org-clocktable-write-default: The clock table. (line 118) +* org-clone-subtree-with-time-shift: Structure Editing. (line 96) +* org-columns-delete: Using column view. (line 73) +* org-columns-edit-allowed: Using column view. (line 57) +* org-columns-edit-value: Using column view. (line 43) +* org-columns-insert-dblock: Capturing column view. + (line 72) +* org-columns-narrow: Using column view. (line 67) +* org-columns-new: Using column view. (line 70) +* org-columns-next-allowed-value: Using column view. (line 39) +* org-columns-previous-allowed-value: Using column view. (line 39) +* org-columns-quit: Using column view. (line 26) +* org-columns-redo: Using column view. (line 22) +* org-columns-show-value: Using column view. (line 53) +* org-columns-toggle-or-columns-quit: Using column view. (line 49) +* org-columns-widen: Using column view. (line 67) +* org-compute-property-at-point: Property Syntax. (line 117) +* org-copy-subtree: Structure Editing. (line 74) +* org-copy-visible: Global and local cycling. + (line 65) +* org-cut-subtree: Structure Editing. (line 70) +* org-cycle: Global and local cycling. + (line 11) +* org-cycle <1>: Structure Editing. (line 37) +* org-cycle <2>: Plain Lists. (line 70) +* org-cycle-agenda-files: Agenda Files. (line 26) +* org-date-from-calendar: Creating Timestamps. (line 32) +* org-dblock-update: Capturing column view. + (line 80) +* org-dblock-update <1>: The clock table. (line 20) +* org-dblock-update <2>: Dynamic Blocks. (line 25) +* org-deadline: Inserting deadline/schedule. + (line 10) +* org-delete-property: Property Syntax. (line 111) +* org-delete-property-globally: Property Syntax. (line 114) +* org-demote: Using the Mapping API. + (line 93) +* org-demote-subtree: Structure Editing. (line 57) +* org-do-demote: Structure Editing. (line 44) +* org-do-promote: Structure Editing. (line 44) +* org-dynamic-block-insert-dblock: Dynamic Blocks. (line 10) +* org-edit-special: Literal Examples. (line 102) +* org-edit-special <1>: Include Files. (line 63) +* org-edit-special <2>: Cooperation. (line 59) +* org-entities-help: Special Symbols. (line 16) +* org-entry-add-to-multivalued-property: Using the Property API. + (line 49) +* org-entry-delete: Using the Property API. + (line 28) +* org-entry-get: Using the Property API. + (line 19) +* org-entry-get-multivalued-property: Using the Property API. + (line 45) +* org-entry-member-in-multivalued-property: Using the Property API. + (line 58) +* org-entry-properties: Using the Property API. + (line 9) +* org-entry-put: Using the Property API. + (line 31) +* org-entry-put-multivalued-property: Using the Property API. + (line 40) +* org-entry-remove-from-multivalued-property: Using the Property API. + (line 53) +* org-evaluate-time-range: Creating Timestamps. (line 62) +* org-evaluate-time-range <1>: Clocking commands. (line 53) +* org-export: The Export Dispatcher. + (line 16) +* org-export-define-backend: Adding Export Back-ends. + (line 10) +* org-export-define-derived-backend: Adding Export Back-ends. + (line 10) +* org-export-to-odt: ODT export commands. (line 7) +* org-forward-heading-same-level: Motion. (line 15) +* org-global-cycle: Global and local cycling. + (line 20) +* org-goto: Motion. (line 24) +* org-goto-calendar: Creating Timestamps. (line 35) +* org-html-convert-region-to-html: Export in Foreign Buffers. + (line 17) +* org-html-export-as-html: HTML export commands. + (line 13) +* org-html-export-to-html: HTML export commands. + (line 7) +* org-icalendar-combine-agenda-files: iCalendar Export. (line 47) +* org-icalendar-export-agenda-files: iCalendar Export. (line 43) +* org-icalendar-export-to-ics: iCalendar Export. (line 39) +* org-indent-mode: Org Indent Mode. (line 6) +* org-info-find-node: Documentation Access. + (line 6) +* org-insert-drawer: Drawers. (line 18) +* org-insert-drawer <1>: Property Syntax. (line 94) +* org-insert-heading: Plain Lists. (line 83) +* org-insert-heading <1>: Timers. (line 40) +* org-insert-heading-respect-content: Structure Editing. (line 26) +* org-insert-link: Handling Links. (line 71) +* org-insert-link-global: Using Links Outside Org. + (line 6) +* org-insert-property-drawer: Using the Property API. + (line 19) +* org-insert-property-drawer <1>: Using the Property API. + (line 37) +* org-insert-structure-template: Structure Templates. (line 11) +* org-insert-todo-heading: Structure Editing. (line 29) +* org-insert-todo-heading <1>: TODO Basics. (line 54) +* org-insert-todo-heading <2>: Checkboxes. (line 86) +* org-insert-todo-heading-respect-content: Structure Editing. (line 33) +* org-latex-convert-region-to-latex: Export in Foreign Buffers. + (line 20) +* org-latex-export-as-latex: LaTeX/PDF export commands. + (line 11) +* org-latex-export-to-latex~: LaTeX/PDF export commands. + (line 7) +* org-latex-export-to-pdf: LaTeX/PDF export commands. + (line 14) +* org-latex-preview: Previewing LaTeX fragments. + (line 18) +* org-link-escape: Link Format. (line 25) +* org-link-set-parameters: Adding Hyperlink Types. + (line 74) +* org-lint: Org Syntax. (line 24) +* org-list-checkbox-radio-mode: Checkboxes. (line 81) +* org-lookup-all: Lookup functions. (line 23) +* org-lookup-first: Lookup functions. (line 9) +* org-lookup-last: Lookup functions. (line 19) +* org-map-entries: Using the Mapping API. + (line 12) +* org-mark-ring-goto: Handling Links. (line 146) +* org-mark-ring-push: Handling Links. (line 141) +* org-mark-subtree: Structure Editing. (line 66) +* org-match-sparse-tree: Tag Searches. (line 10) +* org-match-sparse-tree <1>: Property Searches. (line 11) +* org-md-convert-region-to-md: Export in Foreign Buffers. + (line 26) +* org-md-export-as-markdown: Markdown Export. (line 21) +* org-md-export-to-markdown: Markdown Export. (line 17) +* org-meta-return: Structure Editing. (line 7) +* org-mobile-pull: Pulling from the mobile application. + (line 6) +* org-mobile-push: Pushing to the mobile application. + (line 6) +* org-move-subtree-down: Structure Editing. (line 63) +* org-move-subtree-up: Structure Editing. (line 60) +* org-narrow-to-block: Structure Editing. (line 123) +* org-narrow-to-block <1>: Dynamic Blocks. (line 58) +* org-narrow-to-subtree: Structure Editing. (line 120) +* org-next-link: Handling Links. (line 153) +* org-next-visible-heading: Motion. (line 9) +* org-occur: Sparse Trees. (line 20) +* org-odt-convert: Extending ODT export. + (line 37) +* org-open-at-point: Handling Links. (line 108) +* org-open-at-point <1>: Creating Timestamps. (line 40) +* org-open-at-point-global: Using Links Outside Org. + (line 6) +* org-org-export-to-org: Org Export. (line 15) +* org-paste-subtree: Structure Editing. (line 78) +* org-previous-link: Handling Links. (line 153) +* org-previous-visible-heading: Motion. (line 12) +* org-priority: Priorities. (line 33) +* org-priority <1>: Using the Mapping API. + (line 81) +* org-priority-down: Priorities. (line 41) +* org-priority-up: Priorities. (line 41) +* org-promote: Using the Mapping API. + (line 90) +* org-promote-subtree: Structure Editing. (line 54) +* org-property-action: Property Syntax. (line 100) +* org-protocol-create: The open-source protocol. + (line 67) +* org-protocol-create-for-org: The open-source protocol. + (line 67) +* org-publish: Triggering Publication. + (line 9) +* org-publish-all: Triggering Publication. + (line 19) +* org-publish-current-file: Triggering Publication. + (line 16) +* org-publish-current-project: Triggering Publication. + (line 13) +* org-publish-find-date: Site map. (line 21) +* org-publish-find-property: Site map. (line 21) +* org-publish-find-title: Site map. (line 21) +* org-refile: Structure Editing. (line 104) +* org-refile <1>: Refile and Copy. (line 13) +* org-refile-cache-clear: Refile and Copy. (line 46) +* org-refile-copy: Refile and Copy. (line 51) +* org-refile-goto-last-stored: Refile and Copy. (line 35) +* org-refile-reverse: Refile and Copy. (line 55) +* org-remove-file: Agenda Files. (line 22) +* org-reveal: Global and local cycling. + (line 43) +* org-save-all-org-buffers: Agenda Commands. (line 193) +* org-schedule: Inserting deadline/schedule. + (line 18) +* org-search-view: Search view. (line 10) +* org-set-effort: Effort Estimates. (line 19) +* org-set-property: Property Syntax. (line 90) +* org-set-property <1>: Property Syntax. (line 103) +* org-set-property <2>: Using Header Arguments. + (line 70) +* org-set-startup-visibility: Global and local cycling. + (line 36) +* org-set-startup-visibility <1>: Initial visibility. (line 26) +* org-set-tags-command: Setting Tags. (line 11) +* org-show-todo-tree: TODO Basics. (line 35) +* org-sort: Structure Editing. (line 108) +* org-sparse-tree: Sparse Trees. (line 16) +* org-speed-command-help: Speed Keys. (line 18) +* org-speedbar-set-agenda-restriction: Agenda Files. (line 58) +* org-store-agenda-views: Exporting Agenda Views. + (line 53) +* org-store-link: Activation. (line 13) +* org-store-link <1>: Handling Links. (line 9) +* org-submit-bug-report: Feedback. (line 16) +* org-switchb: Agenda Files. (line 29) +* org-table-align: Built-in Table Editor. + (line 60) +* org-table-align <1>: Column Width and Alignment. + (line 17) +* org-table-beginning-of-field: Built-in Table Editor. + (line 78) +* org-table-blank-field: Built-in Table Editor. + (line 67) +* org-table-copy-down: Built-in Table Editor. + (line 186) +* org-table-copy-region: Built-in Table Editor. + (line 151) +* org-table-create-or-convert-from-region: Built-in Table Editor. + (line 42) +* org-table-create-or-convert-from-region <1>: Built-in Table Editor. + (line 221) +* org-table-create-with-table.el: Cooperation. (line 63) +* org-table-cut-region: Built-in Table Editor. + (line 157) +* org-table-delete-column: Built-in Table Editor. + (line 94) +* org-table-edit-field: Built-in Table Editor. + (line 202) +* org-table-edit-formulas: Editing and debugging formulas. + (line 37) +* org-table-end-of-field: Built-in Table Editor. + (line 82) +* org-table-eval-formula: Field and range formulas. + (line 28) +* org-table-eval-formula <1>: Column formulas. (line 33) +* org-table-eval-formula <2>: Editing and debugging formulas. + (line 14) +* org-table-eval-formula <3>: Editing and debugging formulas. + (line 19) +* org-table-expand: Column Width and Alignment. + (line 57) +* org-table-export: Built-in Table Editor. + (line 226) +* org-table-fedit-abort: Editing and debugging formulas. + (line 49) +* org-table-fedit-finish: Editing and debugging formulas. + (line 45) +* org-table-fedit-line-down: Editing and debugging formulas. + (line 74) +* org-table-fedit-line-up: Editing and debugging formulas. + (line 71) +* org-table-fedit-lisp-indent: Editing and debugging formulas. + (line 56) +* org-table-fedit-ref-down: Editing and debugging formulas. + (line 66) +* org-table-fedit-ref-left: Editing and debugging formulas. + (line 66) +* org-table-fedit-ref-right: Editing and debugging formulas. + (line 66) +* org-table-fedit-ref-up: Editing and debugging formulas. + (line 66) +* org-table-fedit-scroll-down: Editing and debugging formulas. + (line 80) +* org-table-fedit-scroll-up: Editing and debugging formulas. + (line 77) +* org-table-fedit-toggle-ref-type: Editing and debugging formulas. + (line 52) +* org-table-field-info: Editing and debugging formulas. + (line 25) +* org-table-header-line-mode: Built-in Table Editor. + (line 237) +* org-table-hline-and-move: Built-in Table Editor. + (line 130) +* org-table-import: Built-in Table Editor. + (line 212) +* org-table-insert-column: Built-in Table Editor. + (line 97) +* org-table-insert-hline: Built-in Table Editor. + (line 126) +* org-table-insert-row: Built-in Table Editor. + (line 122) +* org-table-iterate: Updating the table. (line 24) +* org-table-iterate-buffer-tables: Updating the table. (line 32) +* org-table-kill-row: Built-in Table Editor. + (line 107) +* org-table-move-cell-down: Built-in Table Editor. + (line 113) +* org-table-move-cell-left: Built-in Table Editor. + (line 116) +* org-table-move-cell-right: Built-in Table Editor. + (line 119) +* org-table-move-cell-up: Built-in Table Editor. + (line 110) +* org-table-move-column-left: Built-in Table Editor. + (line 88) +* org-table-move-column-right: Built-in Table Editor. + (line 91) +* org-table-move-row-down: Built-in Table Editor. + (line 104) +* org-table-move-row-up: Built-in Table Editor. + (line 101) +* org-table-next-field: Built-in Table Editor. + (line 63) +* org-table-next-row: Built-in Table Editor. + (line 73) +* org-table-paste-rectangle: Built-in Table Editor. + (line 161) +* org-table-previous-field: Built-in Table Editor. + (line 70) +* org-table-recalculate: Updating the table. (line 14) +* org-table-recalculate-buffer-tables: Updating the table. (line 29) +* org-table-rotate-recalc-marks: Advanced features. (line 11) +* org-table-shrink: Column Width and Alignment. + (line 54) +* org-table-sort-lines: Built-in Table Editor. + (line 134) +* org-table-sum: Built-in Table Editor. + (line 181) +* org-table-toggle-column-width: Column Width and Alignment. + (line 44) +* org-table-toggle-coordinate-overlays: Editing and debugging formulas. + (line 29) +* org-table-toggle-coordinate-overlays <1>: Editing and debugging formulas. + (line 83) +* org-table-toggle-formula-debugger: Editing and debugging formulas. + (line 34) +* org-table-transpose-table-at-point: Built-in Table Editor. + (line 243) +* org-table-wrap-region: Built-in Table Editor. + (line 168) +* org-tags-view: Tag Searches. (line 15) +* org-tags-view <1>: Property Searches. (line 15) +* org-tags-view <2>: Matching tags and properties. + (line 13) +* org-tags-view <3>: Matching tags and properties. + (line 21) +* org-texinfo-convert-region-to-texinfo: Export in Foreign Buffers. + (line 23) +* org-texinfo-export-to-info: Texinfo export commands. + (line 11) +* org-texinfo-export-to-texinfo: Texinfo export commands. + (line 7) +* org-time-stamp: Creating Timestamps. (line 11) +* org-time-stamp-inactive: Creating Timestamps. (line 25) +* org-timer: Timers. (line 32) +* org-timer-item: Timers. (line 36) +* org-timer-pause-or-continue: Timers. (line 44) +* org-timer-set-timer: Timers. (line 23) +* org-timer-start: Timers. (line 13) +* org-timer-stop: Timers. (line 47) +* org-timestamp-down-day: Creating Timestamps. (line 45) +* org-timestamp-up-day: Creating Timestamps. (line 45) +* org-todo: Clocking commands. (line 71) +* org-todo <1>: Using the Mapping API. + (line 77) +* org-todo-list: Global TODO list. (line 10) +* org-todo-list <1>: Global TODO list. (line 18) +* org-toggle-archive-tag: Internal archiving. (line 39) +* org-toggle-checkbox: Checkboxes. (line 52) +* org-toggle-comment: Comment Lines. (line 20) +* org-toggle-heading: Structure Editing. (line 129) +* org-toggle-inline-images: Images. (line 24) +* org-toggle-ordered-property: TODO dependencies. (line 38) +* org-toggle-ordered-property <1>: Checkboxes. (line 90) +* org-toggle-pretty-entities: Subscripts and Superscripts. + (line 27) +* org-toggle-pretty-entities <1>: Special Symbols. (line 31) +* org-toggle-radio-button: Checkboxes. (line 75) +* org-toggle-sticky-agenda: Agenda Dispatcher. (line 55) +* org-toggle-tag: Using the Mapping API. + (line 85) +* org-toggle-tags-groups: Tag Hierarchy. (line 87) +* org-toggle-time-stamp-overlays: Custom time format. (line 13) +* org-tree-to-indirect-buffer: Global and local cycling. + (line 59) +* org-update-statistics-cookies: Checkboxes. (line 98) +* org-version: Feedback. (line 16) +* org-yank: Structure Editing. (line 84) +* orgtbl-ascii-draw: Org Plot. (line 144) +* orgtbl-mode: Orgtbl Mode. (line 6) +* orgtbl-to-csv: Translator functions. + (line 6) +* orgtbl-to-generic: Translator functions. + (line 6) +* orgtbl-to-html: Translator functions. + (line 6) +* orgtbl-to-latex: Translator functions. + (line 6) +* orgtbl-to-orgtbl: Translator functions. + (line 6) +* orgtbl-to-texinfo: Translator functions. + (line 6) +* orgtbl-to-tsv: Translator functions. + (line 6) +* orgtbl-to-unicode: Translator functions. + (line 6) +* outline-show-all: Global and local cycling. + (line 40) +* outline-show-branches: Global and local cycling. + (line 52) +* outline-show-children: Global and local cycling. + (line 55) +* outline-up-heading: Motion. (line 21) +* pcomplete: Property Syntax. (line 86) +* previous-error: Sparse Trees. (line 35) +* widen: Structure Editing. (line 126) + + +File: org.info, Node: Variable Index, Prev: Command and Function Index, Up: Top + +G Variable Index +**************** + +This is not a complete index of variables and faces, only the ones that +are mentioned in the manual. For a more complete list, use ‘M-x +org-customize’ and then click yourself through the tree. + +�[index�] +* Menu: + +* cdlatex-simplify-sub-super-scripts: CDLaTeX mode. (line 43) +* constants-unit-system: References. (line 121) +* constants-unit-system <1>: In-buffer Settings. (line 151) +* LaTeX-verbatim-environments: A LaTeX example. (line 19) +* org-adapt-indentation: Hard indentation. (line 16) +* org-agenda-auto-exclude-function: Filtering/limiting agenda items. + (line 99) +* org-agenda-bulk-custom-functions: Agenda Commands. (line 352) +* org-agenda-bulk-custom-functions <1>: Agenda Commands. (line 431) +* org-agenda-bulk-persistent-marks: Agenda Commands. (line 383) +* org-agenda-category-filter-preset: Filtering/limiting agenda items. + (line 6) +* org-agenda-category-icon-alist: Categories. (line 16) +* org-agenda-clock-consistency-checks: Agenda Commands. (line 165) +* org-agenda-columns-add-appointments-to-effort-sum: Effort Estimates. + (line 45) +* org-agenda-confirm-kill: Agenda Commands. (line 243) +* org-agenda-custom-commands: Sparse Trees. (line 37) +* org-agenda-custom-commands <1>: Storing searches. (line 11) +* org-agenda-custom-commands <2>: Setting options. (line 6) +* org-agenda-custom-commands <3>: Extracting Agenda Information. + (line 10) +* org-agenda-custom-commands-contexts: Setting options. (line 59) +* org-agenda-diary-file: Agenda Commands. (line 460) +* org-agenda-dim-blocked-tasks: TODO dependencies. (line 48) +* org-agenda-dim-blocked-tasks <1>: Speeding Up Your Agendas. + (line 15) +* org-agenda-effort-filter-preset: Filtering/limiting agenda items. + (line 6) +* org-agenda-entry-text-maxlines: Agenda Commands. (line 173) +* org-agenda-exporter-settings: Exporting Agenda Views. + (line 14) +* org-agenda-exporter-settings <1>: Exporting Agenda Views. + (line 68) +* org-agenda-files: Agenda Files. (line 6) +* org-agenda-files <1>: Sorting of agenda items. + (line 9) +* org-agenda-inhibit-startup: Speeding Up Your Agendas. + (line 19) +* org-agenda-log-mode-items: Agenda Commands. (line 131) +* org-agenda-loop-over-headlines-in-active-region: Execute commands in the active region. + (line 13) +* org-agenda-max-effort: Filtering/limiting agenda items. + (line 136) +* org-agenda-max-entries: Filtering/limiting agenda items. + (line 133) +* org-agenda-max-tags: Filtering/limiting agenda items. + (line 142) +* org-agenda-max-todos: Filtering/limiting agenda items. + (line 139) +* org-agenda-overriding-header: Special Agenda Views. + (line 38) +* org-agenda-prefix-format: Presentation and Sorting. + (line 6) +* org-agenda-regexp-filter-preset: Filtering/limiting agenda items. + (line 6) +* org-agenda-restore-windows-after-quit: Agenda Views. (line 42) +* org-agenda-search-headline-for-time: Time-of-day specifications. + (line 16) +* org-agenda-show-inherited-tags: Agenda Commands. (line 270) +* org-agenda-show-inherited-tags <1>: Speeding Up Your Agendas. + (line 23) +* org-agenda-skip-archived-trees: Internal archiving. (line 23) +* org-agenda-skip-archived-trees <1>: Agenda Views. (line 37) +* org-agenda-skip-comment-trees: Agenda Views. (line 37) +* org-agenda-skip-deadline-prewarning-if-scheduled: Deadlines and Scheduling. + (line 24) +* org-agenda-skip-function: Special Agenda Views. + (line 6) +* org-agenda-skip-function <1>: Special Agenda Views. + (line 41) +* org-agenda-skip-function <2>: Using the Mapping API. + (line 69) +* org-agenda-skip-function-global: Special Agenda Views. + (line 6) +* org-agenda-skip-scheduled-delay-if-deadline: Deadlines and Scheduling. + (line 42) +* org-agenda-skip-scheduled-if-deadline-is-shown: Repeated tasks. + (line 80) +* org-agenda-skip-scheduled-if-done: Deadlines and Scheduling. + (line 34) +* org-agenda-sorting-strategy: Sorting of agenda items. + (line 28) +* org-agenda-span: Weekly/daily agenda. (line 15) +* org-agenda-span <1>: Agenda Commands. (line 107) +* org-agenda-start-day: Weekly/daily agenda. (line 15) +* org-agenda-start-on-weekday: Weekly/daily agenda. (line 15) +* org-agenda-start-with-clockreport-mode: Agenda Commands. (line 154) +* org-agenda-start-with-entry-text-mode: Agenda Commands. (line 173) +* org-agenda-start-with-follow-mode: Agenda Commands. (line 42) +* org-agenda-sticky: Agenda Dispatcher. (line 55) +* org-agenda-tag-filter-preset: Filtering/limiting agenda items. + (line 6) +* org-agenda-tags-column: Presentation and Sorting. + (line 6) +* org-agenda-tags-todo-honor-ignore-options: Matching tags and properties. + (line 21) +* org-agenda-text-search-extra-files: Agenda Dispatcher. (line 30) +* org-agenda-text-search-extra-files <1>: Search view. (line 34) +* org-agenda-time-grid: Time-of-day specifications. + (line 46) +* org-agenda-time-grid <1>: Agenda Commands. (line 181) +* org-agenda-todo-ignore-deadlines: Global TODO list. (line 42) +* org-agenda-todo-ignore-scheduled: Global TODO list. (line 42) +* org-agenda-todo-ignore-timestamp: Global TODO list. (line 42) +* org-agenda-todo-ignore-with-date: Global TODO list. (line 42) +* org-agenda-todo-list-sublevels: Breaking Down Tasks. (line 6) +* org-agenda-todo-list-sublevels <1>: Global TODO list. (line 53) +* org-agenda-use-tag-inheritance: Tag Inheritance. (line 32) +* org-agenda-use-tag-inheritance <1>: Speeding Up Your Agendas. + (line 23) +* org-agenda-use-time-grid: Time-of-day specifications. + (line 46) +* org-agenda-use-time-grid <1>: Agenda Commands. (line 181) +* org-agenda-window-setup: Agenda Views. (line 42) +* org-alphabetical-lists: Plain Lists. (line 15) +* org-archive-default-command: Archiving. (line 12) +* org-archive-default-command <1>: Agenda Commands. (line 252) +* org-archive-location: Moving subtrees. (line 10) +* org-archive-location <1>: In-buffer Settings. (line 15) +* org-archive-save-context-info: Moving subtrees. (line 41) +* org-archive-subtree-save-file-p: Moving subtrees. (line 47) +* org-ascii-links-to-notes: ASCII/Latin-1/UTF-8 export. + (line 16) +* org-ascii-text-width: ASCII/Latin-1/UTF-8 export. + (line 13) +* org-attach-archive-delete: Attachment options. (line 60) +* org-attach-auto-tag: Attachment options. (line 64) +* org-attach-commands: Attachment options. (line 85) +* org-attach-dir-relative: Attachment options. (line 13) +* org-attach-expert: Attachment options. (line 88) +* org-attach-id-dir: Attachment options. (line 9) +* org-attach-id-to-path-function-list: Attachment options. (line 68) +* org-attach-method: Attachment defaults and dispatcher. + (line 25) +* org-attach-method <1>: Attachment options. (line 49) +* org-attach-preferred-new-method: Attachment options. (line 55) +* org-attach-store-link-p: Attachment options. (line 77) +* org-attach-use-inheritance: Attachment options. (line 18) +* org-babel-default-header-args: Using Header Arguments. + (line 19) +* org-babel-default-header-args <1>: Using Header Arguments. + (line 19) +* org-babel-inline-result-wrap: Evaluating Code Blocks. + (line 27) +* org-babel-load-languages: Languages. (line 10) +* org-babel-post-tangle-hook: Extracting Source Code. + (line 122) +* org-beamer-environments-default: Frames and Blocks in Beamer. + (line 25) +* org-beamer-environments-extra: Frames and Blocks in Beamer. + (line 25) +* org-beamer-frame-level: Frames and Blocks in Beamer. + (line 10) +* org-beamer-theme: Beamer specific export settings. + (line 11) +* org-calc-default-modes: Formula syntax for Calc. + (line 17) +* org-capture-bookmark: Using capture. (line 48) +* org-capture-last-stored: Using capture. (line 48) +* org-capture-templates: Capture templates. (line 11) +* org-capture-templates-contexts: Templates in contexts. + (line 6) +* org-capture-use-agenda-date: Agenda Commands. (line 345) +* org-catch-invisible-edits: Catching invisible edits. + (line 6) +* org-clock-auto-clockout-timer: Resolving idle time. (line 91) +* org-clock-continuously: Clocking commands. (line 7) +* org-clock-continuously <1>: Clocking commands. (line 44) +* org-clock-continuously <2>: Resolving idle time. (line 78) +* org-clock-display-default-range: The clock table. (line 80) +* org-clock-idle-time: Resolving idle time. (line 14) +* org-clock-in-prepare-hook: Clocking commands. (line 21) +* org-clock-into-drawer: Clocking commands. (line 7) +* org-clock-mode-line-total: Clocking commands. (line 21) +* org-clock-persist: Clocking Work Time. (line 19) +* org-clock-report-include-clocking-task: Agenda Commands. (line 154) +* org-clock-x11idle-program-name: Resolving idle time. (line 14) +* org-clocktable-defaults: The clock table. (line 39) +* org-closed-keep-when-no-todo: Closing items. (line 11) +* org-coderef-label-format: Literal Examples. (line 88) +* org-columns: Using column view. (line 10) +* org-columns-default-format: Using column view. (line 10) +* org-columns-default-format <1>: Effort Estimates. (line 35) +* org-columns-default-format <2>: Agenda Commands. (line 197) +* org-columns-default-format <3>: Agenda Column View. (line 19) +* org-columns-default-format-for-agenda: Agenda Column View. (line 19) +* org-columns-skip-archived-trees: Internal archiving. (line 33) +* org-columns-summary-types: Column attributes. (line 51) +* org-complete-tags-always-offer-all-agenda-tags: Setting Tags. + (line 22) +* org-confirm-babel-evaluate: Code Evaluation Security. + (line 25) +* org-create-file-search-functions: Custom Searches. (line 12) +* org-crypt-tag-matcher: Org Crypt. (line 11) +* org-ctrl-k-protect-subtree: Headlines. (line 6) +* org-cycle-emulate-tab: Global and local cycling. + (line 16) +* org-cycle-global-at-bob: Global and local cycling. + (line 31) +* org-cycle-include-plain-lists: Plain Lists. (line 70) +* org-cycle-open-archived-trees: Internal archiving. (line 13) +* org-cycle-separator-lines: Headlines. (line 29) +* org-deadline-warning-days: Deadlines and Scheduling. + (line 14) +* org-deadline-warning-days <1>: Inserting deadline/schedule. + (line 26) +* org-default-notes-file: Setting up capture. (line 8) +* org-default-notes-file <1>: Template elements. (line 50) +* org-directory: Template elements. (line 50) +* org-display-custom-times: Custom time format. (line 6) +* org-disputed-keys: Conflicts. (line 27) +* org-done, face: Faces for TODO keywords. + (line 6) +* org-edit-src-auto-save-idle-delay: Editing Source Code. (line 11) +* org-effort-property: Effort Estimates. (line 6) +* org-enforce-todo-dependencies: TODO dependencies. (line 6) +* org-enforce-todo-dependencies <1>: TODO dependencies. (line 53) +* org-entities-user: Special Symbols. (line 16) +* org-execute-file-search-functions: Custom Searches. (line 12) +* org-export-allow-bind-keywords: Export Settings. (line 210) +* org-export-async-init-file: The Export Dispatcher. + (line 42) +* org-export-backends: Exporting. (line 33) +* org-export-before-parsing-hook: Advanced Export Configuration. + (line 9) +* org-export-before-processing-hook: Advanced Export Configuration. + (line 9) +* org-export-creator-string: HTML preamble and postamble. + (line 6) +* org-export-date-timestamp-format: Export Settings. (line 32) +* org-export-default-language: Export Settings. (line 38) +* org-export-dispatch-use-expert-ui: The Export Dispatcher. + (line 10) +* org-export-exclude-tags: Export Settings. (line 52) +* org-export-global-macros: Macro Replacement. (line 6) +* org-export-headline-levels: Export Settings. (line 141) +* org-export-html-table-tag: Tables in HTML export. + (line 6) +* org-export-html-tag-class-prefix: CSS support. (line 6) +* org-export-html-todo-kwd-class-prefix: CSS support. (line 6) +* org-export-html-use-infojs: JavaScript support. (line 70) +* org-export-in-background: The Export Dispatcher. + (line 39) +* org-export-initial-scope: The Export Dispatcher. + (line 60) +* org-export-odt-convert-capabilities: Advanced topics in ODT export. + (line 22) +* org-export-odt-convert-process: Advanced topics in ODT export. + (line 28) +* org-export-odt-convert-processes: Advanced topics in ODT export. + (line 17) +* org-export-odt-preferred-output-format: ODT export commands. + (line 25) +* org-export-odt-schema-dir: Advanced topics in ODT export. + (line 269) +* org-export-preserve-breaks: Export Settings. (line 93) +* org-export-select-tags: Export Settings. (line 44) +* org-export-time-stamp-file: Export Settings. (line 187) +* org-export-time-stamp-file <1>: HTML preamble and postamble. + (line 6) +* org-export-use-babel: Exporting Code Blocks. + (line 34) +* org-export-with-archived-trees: Internal archiving. (line 29) +* org-export-with-archived-trees <1>: Export Settings. (line 102) +* org-export-with-author: Export Settings. (line 107) +* org-export-with-broken-links: Export Settings. (line 111) +* org-export-with-clocks: Export Settings. (line 116) +* org-export-with-creator: Export Settings. (line 119) +* org-export-with-date: Export Settings. (line 127) +* org-export-with-drawers: Export Settings. (line 123) +* org-export-with-email: Export Settings. (line 134) +* org-export-with-emphasize: Export Settings. (line 79) +* org-export-with-entities: Export Settings. (line 131) +* org-export-with-fixed-width: Export Settings. (line 86) +* org-export-with-footnotes: Export Settings. (line 138) +* org-export-with-inlinetasks: Export Settings. (line 146) +* org-export-with-latex: LaTeX fragments. (line 38) +* org-export-with-latex <1>: Export Settings. (line 183) +* org-export-with-planning: Export Settings. (line 157) +* org-export-with-priority: Export Settings. (line 163) +* org-export-with-properties: Export Settings. (line 166) +* org-export-with-section-numbers: Export Settings. (line 149) +* org-export-with-smart-quotes: Export Settings. (line 73) +* org-export-with-special-strings: Export Settings. (line 82) +* org-export-with-statistics-cookies: Export Settings. (line 170) +* org-export-with-sub-superscripts: Export Settings. (line 97) +* org-export-with-tables: Export Settings. (line 202) +* org-export-with-tags: Export Settings. (line 174) +* org-export-with-tasks: Export Settings. (line 178) +* org-export-with-timestamps: Export Settings. (line 89) +* org-export-with-title: Export Settings. (line 191) +* org-export-with-toc: Export Settings. (line 194) +* org-export-with-toc <1>: Table of Contents. (line 6) +* org-export-with-todo-keywords: Export Settings. (line 198) +* org-expot-creator-string: Export Settings. (line 28) +* org-faces-easy-properties: Faces for TODO keywords. + (line 17) +* org-fast-tag-selection-include-todo: Fast access to TODO states. + (line 16) +* org-fast-tag-selection-single-key: Setting Tags. (line 142) +* org-file-apps: Handling Links. (line 108) +* org-file-apps <1>: Attachment defaults and dispatcher. + (line 46) +* org-fontify-emphasized-text: Emphasis and Monospace. + (line 11) +* org-footnote-auto-adjust: Creating Footnotes. (line 60) +* org-footnote-auto-adjust <1>: In-buffer Settings. (line 157) +* org-footnote-auto-label: Creating Footnotes. (line 32) +* org-footnote-auto-label <1>: In-buffer Settings. (line 157) +* org-footnote-define-inline: Creating Footnotes. (line 45) +* org-footnote-define-inline <1>: In-buffer Settings. (line 157) +* org-footnote-section: Headlines. (line 18) +* org-footnote-section <1>: Creating Footnotes. (line 45) +* org-format-latex-header: LaTeX fragments. (line 6) +* org-format-latex-header <1>: Previewing LaTeX fragments. + (line 12) +* org-format-latex-options: Previewing LaTeX fragments. + (line 12) +* org-global-properties: Property Syntax. (line 80) +* org-global-properties <1>: Effort Estimates. (line 35) +* org-goto-auto-isearch: Motion. (line 24) +* org-goto-interface: Motion. (line 41) +* org-group-tags: Tag Hierarchy. (line 87) +* org-habit-following-days: Tracking your habits. + (line 91) +* org-habit-graph-column: Tracking your habits. + (line 82) +* org-habit-preceding-days: Tracking your habits. + (line 87) +* org-habit-show-habits-only-for-today: Tracking your habits. + (line 94) +* org-hide, face: Hard indentation. (line 21) +* org-hide-block-startup: Blocks. (line 6) +* org-hide-block-startup <1>: In-buffer Settings. (line 170) +* org-hide-leading-stars: Hard indentation. (line 21) +* org-hide-leading-stars <1>: In-buffer Settings. (line 133) +* org-hide-macro-markers: Macro Replacement. (line 88) +* org-hierarchical-checkbox-statistics: Checkboxes. (line 29) +* org-hierarchical-todo-statistics: Breaking Down Tasks. (line 25) +* org-html-container-element: HTML specific export settings. + (line 22) +* org-html-doctype: HTML specific export settings. + (line 19) +* org-html-doctype <1>: HTML doctypes. (line 8) +* org-html-doctype-alist: HTML doctypes. (line 8) +* org-html-head: HTML specific export settings. + (line 38) +* org-html-head <1>: CSS support. (line 44) +* org-html-head <2>: Bare HTML. (line 9) +* org-html-head-extra: HTML specific export settings. + (line 42) +* org-html-head-extra <1>: CSS support. (line 44) +* org-html-head-extra <2>: Bare HTML. (line 9) +* org-html-head-include-default-style: CSS support. (line 52) +* org-html-head-include-default-style <1>: Bare HTML. (line 9) +* org-html-head-include-scripts: Bare HTML. (line 9) +* org-html-html5-elements: HTML doctypes. (line 60) +* org-html-html5-fancy: HTML doctypes. (line 25) +* org-html-inline-images: Images in HTML export. + (line 9) +* org-html-link-home: HTML specific export settings. + (line 26) +* org-html-link-org-files-as-html: Links in HTML export. + (line 12) +* org-html-link-up: HTML specific export settings. + (line 29) +* org-html-mathjax-options: HTML specific export settings. + (line 33) +* org-html-mathjax-options~: Math formatting in HTML export. + (line 6) +* org-html-mathjax-template: Math formatting in HTML export. + (line 20) +* org-html-postamble: HTML preamble and postamble. + (line 6) +* org-html-postamble <1>: Bare HTML. (line 9) +* org-html-postamble-format: HTML preamble and postamble. + (line 6) +* org-html-preamble: HTML preamble and postamble. + (line 6) +* org-html-preamble <1>: Bare HTML. (line 9) +* org-html-preamble-format: HTML preamble and postamble. + (line 6) +* org-html-self-link-headlines: Headlines in HTML export. + (line 10) +* org-html-style-default: CSS support. (line 44) +* org-html-table-align-individual-fields: Tables in HTML export. + (line 20) +* org-html-table-caption-above: Tables in HTML export. + (line 24) +* org-html-table-data-tags: Tables in HTML export. + (line 27) +* org-html-table-default-attributes: Tables in HTML export. + (line 30) +* org-html-table-header-tags: Tables in HTML export. + (line 33) +* org-html-table-row-tags: Tables in HTML export. + (line 36) +* org-html-table-use-header-tags-for-first-column: Tables in HTML export. + (line 39) +* org-html-use-infojs: Bare HTML. (line 9) +* org-html-validation-link: HTML preamble and postamble. + (line 6) +* org-icalendar-alarm-time: iCalendar Export. (line 20) +* org-icalendar-categories: iCalendar Export. (line 20) +* org-icalendar-combined-agenda-file: iCalendar Export. (line 47) +* org-icalendar-include-body: iCalendar Export. (line 57) +* org-icalendar-include-todo: iCalendar Export. (line 11) +* org-icalendar-store-UID: iCalendar Export. (line 26) +* org-icalendar-use-deadline: iCalendar Export. (line 11) +* org-icalendar-use-scheduled: iCalendar Export. (line 11) +* org-id-link-to-org-use-id: Handling Links. (line 21) +* org-imenu-depth: Cooperation. (line 37) +* org-indent-indentation-per-level: Org Indent Mode. (line 11) +* org-indent-mode-turns-off-org-adapt-indentation: Org Indent Mode. + (line 15) +* org-indent-mode-turns-on-hiding-stars: Org Indent Mode. (line 15) +* org-infojs-options: JavaScript support. (line 70) +* org-insert-mode-line-in-empty-file: Activation. (line 30) +* org-irc-links-to-logs: Handling Links. (line 47) +* org-latex-bibtex-compiler: LaTeX/PDF export commands. + (line 25) +* org-latex-classes: LaTeX specific export settings. + (line 32) +* org-latex-classes <1>: LaTeX specific export settings. + (line 49) +* org-latex-classes <2>: LaTeX header and sectioning. + (line 13) +* org-latex-compiler: LaTeX/PDF export commands. + (line 25) +* org-latex-compiler <1>: LaTeX specific export settings. + (line 44) +* org-latex-default-class: LaTeX specific export settings. + (line 32) +* org-latex-default-class <1>: LaTeX header and sectioning. + (line 13) +* org-latex-default-packages-alist: LaTeX/PDF export commands. + (line 25) +* org-latex-default-packages-alist <1>: LaTeX header and sectioning. + (line 13) +* org-latex-default-table-environment: Tables in LaTeX export. + (line 23) +* org-latex-default-table-mode: Tables in LaTeX export. + (line 12) +* org-latex-hyperref-template: LaTeX specific export settings. + (line 11) +* org-latex-hyperref-template <1>: LaTeX specific export settings. + (line 54) +* org-latex-images-centered: Images in LaTeX export. + (line 60) +* org-latex-listings: Literal Examples. (line 31) +* org-latex-listings-options: Source blocks in LaTeX export. + (line 25) +* org-latex-minted-options: Source blocks in LaTeX export. + (line 25) +* org-latex-packages-alist: LaTeX specific export settings. + (line 20) +* org-latex-packages-alist <1>: LaTeX header and sectioning. + (line 13) +* org-latex-subtitle-format: LaTeX specific export settings. + (line 63) +* org-latex-subtitle-separate: LaTeX specific export settings. + (line 63) +* org-latex-tables-booktabs: Tables in LaTeX export. + (line 65) +* org-latex-tables-centered: Tables in LaTeX export. + (line 65) +* org-latex-title-command: LaTeX specific export settings. + (line 11) +* org-latex-title-command <1>: LaTeX specific export settings. + (line 54) +* org-latex-to-mathml-convert-command: LaTeX math snippets. (line 20) +* org-latex-to-mathml-jar-file: LaTeX math snippets. (line 20) +* org-link-abbrev-alist: Link Abbreviations. (line 12) +* org-link-abbrev-alist <1>: In-buffer Settings. (line 38) +* org-link-elisp-confirm-function: Code Evaluation Security. + (line 52) +* org-link-email-description-format: Handling Links. (line 33) +* org-link-frame-setup: Handling Links. (line 123) +* org-link-from-user-regexp: Template expansion. (line 108) +* org-link-keep-stored-after-insertion: Handling Links. (line 71) +* org-link-parameters: Adding Hyperlink Types. + (line 74) +* org-link-search-must-match-exact-headline: Internal Links. (line 31) +* org-link-shell-confirm-function: Code Evaluation Security. + (line 49) +* org-link-use-indirect-buffer-for-internals: Handling Links. (line 137) +* org-list-automatic-rules: Plain Lists. (line 63) +* org-list-automatic-rules <1>: Checkboxes. (line 6) +* org-list-demote-modify-bullet: Plain Lists. (line 57) +* org-list-indent-offset: Plain Lists. (line 57) +* org-list-use-circular-motion: Plain Lists. (line 95) +* org-log-done: Tracking TODO state changes. + (line 25) +* org-log-done <1>: Agenda Commands. (line 131) +* org-log-done <2>: In-buffer Settings. (line 111) +* org-log-into-drawer: Tracking TODO state changes. + (line 6) +* org-log-into-drawer <1>: Agenda Commands. (line 295) +* org-log-note-clock-out: Clocking commands. (line 36) +* org-log-note-clock-out <1>: In-buffer Settings. (line 111) +* org-log-redeadline: Inserting deadline/schedule. + (line 10) +* org-log-refile: Refile and Copy. (line 13) +* org-log-repeat: Repeated tasks. (line 40) +* org-log-repeat <1>: In-buffer Settings. (line 111) +* org-log-reschedule: Inserting deadline/schedule. + (line 18) +* org-log-states-order-reversed: Tracking TODO state changes. + (line 6) +* org-loop-over-headlines-in-active-region: Execute commands in the active region. + (line 6) +* org-M-RET-may-split-line: Structure Editing. (line 7) +* org-M-RET-may-split-line <1>: Plain Lists. (line 83) +* org-md-headline-style: Markdown Export. (line 29) +* org-mobile-directory: Setting up the staging area. + (line 6) +* org-mobile-encryption: Setting up the staging area. + (line 19) +* org-mobile-files: Pushing to the mobile application. + (line 6) +* org-mobile-inbox-for-pull: Pulling from the mobile application. + (line 12) +* org-num-face: Dynamic Headline Numbering. + (line 19) +* org-num-format-function: Dynamic Headline Numbering. + (line 19) +* org-num-max-level: Dynamic Headline Numbering. + (line 10) +* org-num-skip-commented: Dynamic Headline Numbering. + (line 10) +* org-num-skip-footnotes: Dynamic Headline Numbering. + (line 16) +* org-num-skip-tags: Dynamic Headline Numbering. + (line 10) +* org-num-skip-unnumbered: Dynamic Headline Numbering. + (line 10) +* org-odd-levels-only: Matching tags and properties. + (line 65) +* org-odd-levels-only <1>: Hard indentation. (line 29) +* org-odd-levels-only <2>: In-buffer Settings. (line 133) +* org-odd-levels-only <3>: Special Agenda Views. + (line 41) +* org-odt-category-map-alist: Labels and captions in ODT export. + (line 21) +* org-odt-convert-process: Extending ODT export. + (line 12) +* org-odt-create-custom-styles-for-srcblocks: Literal examples in ODT export. + (line 16) +* org-odt-fontify-srcblocks: Literal examples in ODT export. + (line 13) +* org-odt-pixels-per-inch: Images in ODT export. + (line 34) +* org-odt-preferred-output-format: ODT export commands. (line 9) +* org-odt-preferred-output-format <1>: Extending ODT export. + (line 21) +* org-odt-styles-file: ODT specific export settings. + (line 22) +* org-odt-styles-file <1>: Applying custom styles. + (line 25) +* org-odt-table-styles: Advanced topics in ODT export. + (line 158) +* org-odt-table-styles <1>: Advanced topics in ODT export. + (line 226) +* org-outline-path-complete-in-steps: Refile and Copy. (line 13) +* org-plain-list-ordered-item-terminator: Plain Lists. (line 15) +* org-plain-list-ordered-item-terminator <1>: Plain Lists. (line 131) +* org-popup-calendar-for-date-prompt: The date/time prompt. + (line 78) +* org-pretty-entities: Subscripts and Superscripts. + (line 29) +* org-pretty-entities <1>: In-buffer Settings. (line 176) +* org-pretty-entities-include-sub-superscripts: Subscripts and Superscripts. + (line 29) +* org-preview-latex-default-process: Previewing LaTeX fragments. + (line 6) +* org-priority-default: Priorities. (line 46) +* org-priority-default <1>: In-buffer Settings. (line 43) +* org-priority-faces: Priorities. (line 13) +* org-priority-highest: Priorities. (line 46) +* org-priority-highest <1>: In-buffer Settings. (line 43) +* org-priority-lowest: Priorities. (line 46) +* org-priority-lowest <1>: In-buffer Settings. (line 43) +* org-priority-start-cycle-with-default: Priorities. (line 41) +* org-property-allowed-value-functions: Using the Property API. + (line 63) +* org-protocol-default-template-key: The capture protocol. + (line 30) +* org-protocol-project-alist: The open-source protocol. + (line 13) +* org-publish-project-alist: Project alist. (line 6) +* org-publish-project-alist <1>: Publishing options. (line 12) +* org-publish-use-timestamps-flag: Triggering Publication. + (line 21) +* org-put-time-stamp-overlays: In-buffer Settings. (line 145) +* org-read-date-display-live: The date/time prompt. + (line 98) +* org-read-date-force-compatible-dates: The date/time prompt. + (line 62) +* org-read-date-prefer-future: The date/time prompt. + (line 6) +* org-refile-allow-creating-parent-nodes: Refile and Copy. (line 13) +* org-refile-keep: Refile and Copy. (line 41) +* org-refile-targets: Refile and Copy. (line 13) +* org-refile-use-cache: Refile and Copy. (line 46) +* org-refile-use-outline-path: Refile and Copy. (line 13) +* org-remove-highlights-with-change: Sparse Trees. (line 20) +* org-remove-highlights-with-change <1>: Clocking commands. (line 84) +* org-replace-disputed-keys: Conflicts. (line 17) +* org-return-follows-link: Handling Links. (line 129) +* org-reverse-note-order: Refile and Copy. (line 13) +* org-scheduled-delay-days: Deadlines and Scheduling. + (line 42) +* org-show-context-detail: Sparse Trees. (line 6) +* org-sort-agenda-noeffort-is-high: Filtering/limiting agenda items. + (line 56) +* org-sparse-tree-open-archived-trees: Internal archiving. (line 19) +* org-special-ctrl-a/e: Headlines. (line 6) +* org-special-ctrl-k: Headlines. (line 6) +* org-speed-commands: Speed Keys. (line 18) +* org-src-ask-before-returning-to-edit-buffer: Editing Source Code. + (line 40) +* org-src-block-faces: Editing Source Code. (line 43) +* org-src-fontify-natively: Editing Source Code. (line 43) +* org-src-lang-modes: Editing Source Code. (line 22) +* org-src-preserve-indentation: Editing Source Code. (line 32) +* org-src-window-setup: Editing Source Code. (line 28) +* org-startup-align-all-tables: Column Width and Alignment. + (line 19) +* org-startup-align-all-tables <1>: In-buffer Settings. (line 93) +* org-startup-folded: Initial visibility. (line 6) +* org-startup-folded <1>: In-buffer Settings. (line 67) +* org-startup-folded <2>: Speeding Up Your Agendas. + (line 19) +* org-startup-indented: Org Indent Mode. (line 22) +* org-startup-indented <1>: In-buffer Settings. (line 81) +* org-startup-numerated: Dynamic Headline Numbering. + (line 22) +* org-startup-numerated <1>: In-buffer Settings. (line 87) +* org-startup-shrink-all-tables: Column Width and Alignment. + (line 64) +* org-startup-shrink-all-tables <1>: In-buffer Settings. (line 100) +* org-startup-with-inline-images: Images. (line 24) +* org-startup-with-inline-images <1>: In-buffer Settings. (line 104) +* org-startup-with-latex-preview: Previewing LaTeX fragments. + (line 28) +* org-store-link-props: Template expansion. (line 106) +* org-structure-template-alist: Structure Templates. (line 17) +* org-stuck-projects: Stuck projects. (line 17) +* org-support-shift-select: Plain Lists. (line 95) +* org-support-shift-select <1>: Plain Lists. (line 154) +* org-support-shift-select <2>: Conflicts. (line 6) +* org-table-automatic-realign: Column Width and Alignment. + (line 10) +* org-table-copy-increment: Built-in Table Editor. + (line 186) +* org-table-current-column: References. (line 90) +* org-table-current-dline: References. (line 90) +* org-table-duration-custom-format: Durations and time values. + (line 6) +* org-table-export-default-format: Built-in Table Editor. + (line 226) +* org-table-formula: In-buffer Settings. (line 28) +* org-table-formula-constants: References. (line 114) +* org-table-formula-constants <1>: In-buffer Settings. (line 28) +* org-table-formula-constants <2>: Cooperation. (line 14) +* org-table-header-line-p: Built-in Table Editor. + (line 237) +* org-table-use-standard-references: Editing and debugging formulas. + (line 6) +* org-tag-alist: Setting Tags. (line 22) +* org-tag-alist <1>: In-buffer Settings. (line 183) +* org-tag-faces: Tags. (line 10) +* org-tag-persistent-alist: Setting Tags. (line 37) +* org-tags-column: Setting Tags. (line 11) +* org-tags-exclude-from-inheritance: Tag Inheritance. (line 22) +* org-tags-match-list-sublevels: Tag Inheritance. (line 26) +* org-tags-match-list-sublevels <1>: Tag Searches. (line 19) +* org-tags-match-list-sublevels <2>: Property Searches. (line 18) +* org-tags-match-list-sublevels <3>: Matching tags and properties. + (line 21) +* org-tempo-keywords-alist: Structure Templates. (line 21) +* org-texinfo-classes: Texinfo file header. (line 19) +* org-texinfo-classes <1>: Headings and sectioning structure. + (line 6) +* org-texinfo-coding-system: Texinfo file header. (line 11) +* org-texinfo-default-class: Texinfo specific export settings. + (line 20) +* org-texinfo-default-class <1>: Headings and sectioning structure. + (line 6) +* org-texinfo-info-process: Texinfo export commands. + (line 11) +* org-texinfo-table-default-markup: Plain lists in Texinfo export. + (line 12) +* org-time-stamp-custom-formats: Custom time format. (line 6) +* org-time-stamp-overlay-formats: In-buffer Settings. (line 145) +* org-time-stamp-rounding-minutes: Creating Timestamps. (line 16) +* org-timer-default-timer: Timers. (line 23) +* org-todo, face: Faces for TODO keywords. + (line 6) +* org-todo-keyword-faces: Faces for TODO keywords. + (line 6) +* org-todo-keywords: TODO Basics. (line 35) +* org-todo-keywords <1>: TODO Extensions. (line 6) +* org-todo-keywords <2>: Global TODO list. (line 18) +* org-todo-keywords <3>: In-buffer Settings. (line 190) +* org-todo-repeat-to-state: Repeated tasks. (line 22) +* org-todo-state-tags-triggers: TODO Basics. (line 56) +* org-track-ordered-property-with-tag: TODO dependencies. (line 38) +* org-track-ordered-property-with-tag <1>: Checkboxes. (line 90) +* org-treat-insert-todo-heading-as-state-change: Structure Editing. + (line 29) +* org-treat-S-cursor-todo-selection-as-state-change: TODO Basics. + (line 28) +* org-use-property-inheritance: Property Inheritance. + (line 6) +* org-use-property-inheritance <1>: Using Header Arguments. + (line 56) +* org-use-property-inheritance <2>: Using the Property API. + (line 19) +* org-use-speed-commands: Speed Keys. (line 13) +* org-use-sub-superscripts: Subscripts and Superscripts. + (line 13) +* org-use-tag-inheritance: Tag Inheritance. (line 22) +* org-yank-adjusted-subtrees: Structure Editing. (line 84) +* org-yank-folded-subtrees: Structure Editing. (line 84) +* parse-time-months: The date/time prompt. + (line 58) +* parse-time-weekdays: The date/time prompt. + (line 58) +* user-full-name: Export Settings. (line 25) +* user-mail-address: Export Settings. (line 35) + + + +Tag Table: +Node: Top884 +Node: Introduction22812 +Node: Summary23274 +Node: Installation25991 +Ref: Using Emacs packaging system26533 +Ref: Using Org's git repository27041 +Ref: Installing Org's contributed packages27951 +Node: Activation28287 +Ref: Activation-Footnote-129910 +Node: Feedback30038 +Ref: How to create a useful backtrace32724 +Ref: Feedback-Footnote-133876 +Node: Conventions34002 +Ref: TODO keywords tags properties etc34173 +Ref: Key bindings and commands35066 +Node: Document Structure35696 +Node: Headlines36868 +Ref: Headlines-Footnote-138166 +Node: Visibility Cycling38445 +Node: Global and local cycling38835 +Ref: Global and local cycling-Footnote-141552 +Ref: Global and local cycling-Footnote-241614 +Node: Initial visibility41918 +Ref: Initial visibility-Footnote-143102 +Node: Catching invisible edits43295 +Node: Motion43771 +Node: Structure Editing45235 +Node: Sparse Trees51695 +Ref: Sparse Trees-Footnote-154292 +Ref: Sparse Trees-Footnote-254407 +Node: Plain Lists54483 +Ref: Plain Lists-Footnote-162008 +Ref: Plain Lists-Footnote-262372 +Ref: Plain Lists-Footnote-362472 +Ref: Plain Lists-Footnote-462729 +Ref: Plain Lists-Footnote-562906 +Ref: Plain Lists-Footnote-663010 +Ref: Plain Lists-Footnote-763116 +Node: Drawers63186 +Ref: Drawers-Footnote-164856 +Node: Blocks64968 +Node: Tables65561 +Node: Built-in Table Editor66244 +Ref: Creation and conversion67978 +Ref: Re-aligning and field motion68916 +Ref: Column and row editing69829 +Ref: Regions72259 +Ref: Calculations73658 +Ref: Miscellaneous (1)74471 +Ref: Built-in Table Editor-Footnote-176948 +Node: Column Width and Alignment77056 +Node: Column Groups80393 +Node: Orgtbl Mode81960 +Node: The Spreadsheet82775 +Node: References84249 +Ref: Field references84708 +Ref: Range references87147 +Ref: Field coordinates in formulas88406 +Ref: Named references89391 +Ref: Remote references90362 +Ref: References-Footnote-191284 +Ref: References-Footnote-291512 +Ref: References-Footnote-391615 +Node: Formula syntax for Calc91940 +Ref: Formula syntax for Calc-Footnote-197801 +Node: Formula syntax for Lisp98140 +Node: Durations and time values100373 +Node: Field and range formulas101760 +Node: Column formulas104229 +Node: Lookup functions106341 +Node: Editing and debugging formulas108310 +Ref: Using multiple TBLFM lines112827 +Ref: Debugging formulas113670 +Node: Updating the table114094 +Node: Advanced features115466 +Ref: Advanced features-Footnote-1119917 +Node: Org Plot120025 +Ref: Graphical plots using Gnuplot120226 +Ref: Plot options122749 +Ref: ASCII bar plots125541 +Node: Hyperlinks126791 +Node: Link Format127655 +Ref: Link Format-Footnote-1129718 +Ref: Link Format-Footnote-2129950 +Node: Internal Links130082 +Ref: Internal Links-Footnote-1132644 +Ref: Internal Links-Footnote-2132884 +Node: Radio Targets133025 +Node: External Links133742 +Ref: External Links-Footnote-1139226 +Node: Handling Links139650 +Ref: Handling Links-Footnote-1147413 +Ref: Handling Links-Footnote-2147574 +Ref: Handling Links-Footnote-3147764 +Ref: Handling Links-Footnote-4148060 +Ref: Handling Links-Footnote-5148322 +Ref: Handling Links-Footnote-6148444 +Node: Using Links Outside Org148519 +Node: Link Abbreviations148994 +Node: Search Options151830 +Ref: Search Options-Footnote-1153968 +Node: Custom Searches154049 +Node: TODO Items155083 +Ref: TODO Items-Footnote-1156208 +Node: TODO Basics156322 +Node: TODO Extensions158957 +Node: Workflow states160010 +Ref: Workflow states-Footnote-1161409 +Node: TODO types161525 +Ref: TODO types-Footnote-1163344 +Node: Multiple sets in one file163416 +Node: Fast access to TODO states165361 +Ref: Fast access to TODO states-Footnote-1166244 +Ref: Fast access to TODO states-Footnote-2166351 +Node: Per-file keywords166653 +Ref: Per-file keywords-Footnote-1168123 +Node: Faces for TODO keywords168327 +Node: TODO dependencies169400 +Node: Progress Logging171891 +Node: Closing items173028 +Ref: Closing items-Footnote-1174028 +Ref: Closing items-Footnote-2174102 +Node: Tracking TODO state changes174180 +Ref: Tracking TODO state changes-Footnote-1177315 +Ref: Tracking TODO state changes-Footnote-2177377 +Ref: Tracking TODO state changes-Footnote-3177535 +Node: Tracking your habits177813 +Node: Priorities182234 +Ref: Priorities-Footnote-1184746 +Node: Breaking Down Tasks184819 +Ref: Breaking Down Tasks-Footnote-1186861 +Node: Checkboxes186968 +Ref: Checkboxes-Footnote-1192111 +Ref: Checkboxes-Footnote-2192239 +Ref: Checkboxes-Footnote-3192419 +Node: Tags192533 +Node: Tag Inheritance193626 +Ref: Tag Inheritance-Footnote-1195498 +Ref: Tag Inheritance-Footnote-2195602 +Node: Setting Tags195732 +Ref: Setting Tags-Footnote-1202303 +Ref: Setting Tags-Footnote-2202481 +Node: Tag Hierarchy202559 +Node: Tag Searches206159 +Node: Properties and Columns207470 +Node: Property Syntax208858 +Node: Special Properties213464 +Node: Property Searches215154 +Node: Property Inheritance216629 +Node: Column View218501 +Node: Defining columns219752 +Node: Scope of column definitions220137 +Node: Column attributes221196 +Ref: Column attributes-Footnote-1225607 +Ref: Column attributes-Footnote-2225738 +Ref: Column attributes-Footnote-3225936 +Node: Using column view226075 +Ref: Turning column view on or off226241 +Ref: Editing values227282 +Ref: Modifying column view on-the-fly228685 +Node: Capturing column view229057 +Ref: Capturing column view-Footnote-1232785 +Node: Dates and Times232922 +Node: Timestamps233841 +Ref: Timestamps-Footnote-1236197 +Ref: Timestamps-Footnote-2236493 +Node: Creating Timestamps237242 +Node: The date/time prompt240256 +Ref: The date/time prompt-Footnote-1245217 +Ref: The date/time prompt-Footnote-2245388 +Ref: The date/time prompt-Footnote-3245499 +Ref: The date/time prompt-Footnote-4245754 +Node: Custom time format245852 +Node: Deadlines and Scheduling247621 +Ref: Deadlines and Scheduling-Footnote-1251191 +Node: Inserting deadline/schedule251354 +Ref: Inserting deadline/schedule-Footnote-1253346 +Ref: Inserting deadline/schedule-Footnote-2253507 +Ref: Inserting deadline/schedule-Footnote-3253633 +Node: Repeated tasks253759 +Ref: Repeated tasks-Footnote-1258394 +Ref: Repeated tasks-Footnote-2258477 +Ref: Repeated tasks-Footnote-3258760 +Node: Clocking Work Time258982 +Ref: Clocking Work Time-Footnote-1260187 +Ref: Clocking Work Time-Footnote-2260340 +Node: Clocking commands260482 +Ref: Clocking commands-Footnote-1265587 +Ref: Clocking commands-Footnote-2265702 +Ref: Clocking commands-Footnote-3265784 +Ref: Clocking commands-Footnote-4265847 +Node: The clock table265930 +Ref: The clock table-Footnote-1274013 +Ref: The clock table-Footnote-2274122 +Ref: The clock table-Footnote-3274220 +Node: Resolving idle time274346 +Ref: Resolving idle time (1)274542 +Ref: Continuous clocking277739 +Ref: Clocking out automatically after some idle time278245 +Ref: Resolving idle time-Footnote-1278877 +Node: Effort Estimates279325 +Ref: Effort Estimates-Footnote-1282282 +Node: Timers282393 +Node: Refiling and Archiving284612 +Node: Refile and Copy285175 +Ref: Refile and Copy-Footnote-1288003 +Node: Archiving288117 +Node: Moving subtrees288830 +Node: Internal archiving290956 +Node: Capture and Attachments293685 +Node: Capture294490 +Node: Setting up capture295014 +Node: Using capture295377 +Node: Capture templates297775 +Node: Template elements299814 +Ref: Template elements-Footnote-1307296 +Ref: Template elements-Footnote-2307629 +Ref: Template elements-Footnote-3307816 +Node: Template expansion307911 +Ref: Template expansion-Footnote-1311978 +Ref: Template expansion-Footnote-2312069 +Ref: Template expansion-Footnote-3312259 +Node: Templates in contexts312358 +Node: Attachments313203 +Node: Attachment defaults and dispatcher314233 +Ref: Attachment defaults and dispatcher-Footnote-1317583 +Node: Attachment options317734 +Node: Attachment links321753 +Node: Automatic version-control with Git322392 +Node: Attach from Dired322907 +Node: RSS Feeds324271 +Node: Agenda Views325722 +Node: Agenda Files328129 +Ref: Agenda Files-Footnote-1331040 +Ref: Agenda Files-Footnote-2331184 +Node: Agenda Dispatcher331382 +Ref: Agenda Dispatcher-Footnote-1334262 +Ref: Agenda Dispatcher-Footnote-2334360 +Node: Built-in Agenda Views334466 +Node: Weekly/daily agenda335063 +Ref: Calendar/Diary integration336403 +Ref: Anniversaries from BBDB338479 +Ref: Appointment reminders340270 +Ref: Weekly/daily agenda-Footnote-1340820 +Ref: Weekly/daily agenda-Footnote-2341064 +Node: Global TODO list341284 +Node: Matching tags and properties344134 +Node: Search view351243 +Node: Stuck projects352890 +Node: Presentation and Sorting355027 +Node: Categories356004 +Node: Time-of-day specifications356750 +Ref: Time-of-day specifications-Footnote-1358741 +Node: Sorting of agenda items358864 +Node: Filtering/limiting agenda items360482 +Ref: Filtering in the agenda361187 +Ref: Computed tag filtering365321 +Ref: Setting limits for the agenda366815 +Ref: Filtering/limiting agenda items-Footnote-1368364 +Node: Agenda Commands368916 +Ref: Motion (1)369649 +Ref: View/Go to Org file369852 +Ref: Change display371358 +Ref: Remote editing378868 +Ref: Bulk remote editing selected entries384221 +Ref: Calendar commands387316 +Ref: Quit and exit389197 +Ref: Agenda Commands-Footnote-1389559 +Ref: Agenda Commands-Footnote-2389635 +Ref: Agenda Commands-Footnote-3389739 +Node: Custom Agenda Views389826 +Node: Storing searches390478 +Ref: Storing searches-Footnote-1393430 +Ref: Storing searches-Footnote-2393547 +Node: Block agenda393794 +Node: Setting options395123 +Node: Exporting Agenda Views398737 +Ref: Exporting Agenda Views-Footnote-1403276 +Ref: Exporting Agenda Views-Footnote-2403464 +Ref: Exporting Agenda Views-Footnote-3403614 +Ref: Exporting Agenda Views-Footnote-4403801 +Node: Agenda Column View403883 +Node: Markup for Rich Contents407231 +Node: Paragraphs408529 +Node: Emphasis and Monospace409664 +Node: Subscripts and Superscripts410723 +Node: Special Symbols412341 +Ref: Special Symbols-Footnote-1414254 +Ref: Special Symbols-Footnote-2414419 +Node: Embedded LaTeX414516 +Ref: Embedded LaTeX-Footnote-1415365 +Node: LaTeX fragments415561 +Ref: LaTeX fragments-Footnote-1417718 +Node: Previewing LaTeX fragments417911 +Ref: Previewing LaTeX fragments-Footnote-1419394 +Node: CDLaTeX mode419642 +Ref: CDLaTeX mode-Footnote-1422373 +Node: Literal Examples422520 +Ref: Literal Examples-Footnote-1427631 +Ref: Literal Examples-Footnote-2427994 +Ref: Literal Examples-Footnote-3428172 +Ref: Literal Examples-Footnote-4428357 +Node: Images428455 +Ref: Images-Footnote-1429542 +Ref: Images-Footnote-2429665 +Node: Captions429826 +Node: Horizontal Rules430526 +Node: Creating Footnotes430782 +Ref: Creating Footnotes-Footnote-1433911 +Ref: Creating Footnotes-Footnote-2434017 +Node: Exporting434124 +Node: The Export Dispatcher436898 +Node: Export Settings439648 +Ref: Export Settings-Footnote-1447747 +Ref: Export Settings-Footnote-2447859 +Ref: Export Settings-Footnote-3447960 +Node: Table of Contents448158 +Ref: Table of Contents-Footnote-1450832 +Node: Include Files450999 +Ref: Include Files-Footnote-1453936 +Node: Macro Replacement454114 +Ref: Macro Replacement-Footnote-1457995 +Node: Comment Lines458212 +Ref: Comment Lines-Footnote-1459075 +Node: ASCII/Latin-1/UTF-8 export459179 +Ref: ASCII export commands460033 +Ref: ASCII specific export settings460566 +Ref: Header and sectioning structure461010 +Ref: Quoting ASCII text461284 +Ref: ASCII specific attributes461656 +Ref: ASCII special blocks461933 +Node: Beamer Export462280 +Node: Beamer export commands463030 +Node: Beamer specific export settings463735 +Node: Frames and Blocks in Beamer465640 +Ref: Frames and Blocks in Beamer-Footnote-1469012 +Node: Beamer specific syntax469171 +Node: Editing support471150 +Node: A Beamer example471621 +Node: HTML Export472875 +Node: HTML export commands473985 +Node: HTML specific export settings474527 +Node: HTML doctypes476746 +Node: HTML preamble and postamble478921 +Node: Quoting HTML tags480116 +Node: Headlines in HTML export480815 +Node: Links in HTML export481410 +Node: Tables in HTML export482880 +Node: Images in HTML export484337 +Node: Math formatting in HTML export485827 +Ref: Math formatting in HTML export-Footnote-1487368 +Ref: Math formatting in HTML export-Footnote-2487493 +Ref: Math formatting in HTML export-Footnote-3487754 +Node: Text areas in HTML export487926 +Node: CSS support489071 +Ref: CSS support-Footnote-1492723 +Node: JavaScript support492903 +Node: LaTeX Export496090 +Node: LaTeX/PDF export commands498010 +Ref: LaTeX/PDF export commands-Footnote-1499513 +Node: LaTeX specific export settings499715 +Node: LaTeX header and sectioning502947 +Node: Quoting LaTeX code505064 +Node: Tables in LaTeX export505860 +Node: Images in LaTeX export510278 +Node: Plain lists in LaTeX export512883 +Node: Source blocks in LaTeX export513903 +Ref: Source blocks in LaTeX export-Footnote-1515372 +Node: Example blocks in LaTeX export515530 +Node: Special blocks in LaTeX export516256 +Node: Horizontal rules in LaTeX export517519 +Node: Verse blocks in LaTeX export517956 +Node: Quote blocks in LaTeX export519970 +Node: Markdown Export521089 +Ref: Markdown export commands521556 +Ref: Header and sectioning structure (1)521993 +Node: OpenDocument Text Export522410 +Ref: OpenDocument Text Export-Footnote-1523516 +Node: Pre-requisites for ODT export523665 +Node: ODT export commands524043 +Node: ODT specific export settings525224 +Node: Extending ODT export526275 +Ref: Automatically exporting to other formats527086 +Ref: Converting between document formats527512 +Node: Applying custom styles528054 +Ref: Applying custom styles the easy way528586 +Ref: Using third-party styles and templates529544 +Node: Links in ODT export529841 +Node: Tables in ODT export530503 +Node: Images in ODT export532513 +Ref: Embedding images532717 +Ref: Embedding clickable images533034 +Ref: Sizing and scaling of embedded images533368 +Ref: Anchoring of images535052 +Node: Math formatting in ODT export535374 +Node: LaTeX math snippets535803 +Ref: LaTeX math snippets-Footnote-1538056 +Ref: LaTeX math snippets-Footnote-2538132 +Node: MathML and OpenDocument formula files538177 +Node: Labels and captions in ODT export538685 +Node: Literal examples in ODT export539961 +Node: Advanced topics in ODT export540802 +Ref: Configuring a document converter541112 +Ref: Working with OpenDocument style files542053 +Ref: x-orgodtstyles-xml542519 +Ref: x-orgodtcontenttemplate-xml542861 +Ref: x-overriding-factory-styles543505 +Ref: Creating one-off styles544749 +Ref: Customizing tables in ODT export546753 +Ref: Validating OpenDocument XML551613 +Ref: Advanced topics in ODT export-Footnote-1552410 +Ref: Advanced topics in ODT export-Footnote-2552514 +Ref: Advanced topics in ODT export-Footnote-3552607 +Node: Org Export552955 +Ref: Org export commands553311 +Node: Texinfo Export553617 +Node: Texinfo export commands554600 +Node: Texinfo specific export settings555225 +Node: Texinfo file header556378 +Node: Texinfo title and copyright page557361 +Node: Info directory file558725 +Node: Headings and sectioning structure559450 +Node: Indices561480 +Node: Quoting Texinfo code562509 +Node: Plain lists in Texinfo export563007 +Node: Tables in Texinfo export564733 +Node: Images in Texinfo export565229 +Node: Quotations in Texinfo export565867 +Node: Special blocks in Texinfo export566821 +Node: A Texinfo example567474 +Node: iCalendar Export569576 +Node: Other Built-in Back-ends573865 +Node: Advanced Export Configuration574497 +Ref: Export hooks574709 +Ref: Filters575647 +Ref: Defining filters for individual files578156 +Ref: Extending an existing back-end578962 +Node: Export in Foreign Buffers581202 +Node: Bare HTML582443 +Node: Publishing582985 +Node: Configuration583861 +Node: Project alist584643 +Node: Sources and destinations585785 +Node: Selecting files587103 +Node: Publishing action588058 +Ref: Publishing action-Footnote-1589891 +Node: Publishing options590054 +Ref: Generic properties590806 +Ref: ASCII specific properties592693 +Ref: Beamer specific properties594293 +Ref: HTML specific properties594858 +Ref: LaTeX specific properties599344 +Ref: Markdown specific properties602268 +Ref: ODT specific properties602506 +Ref: Texinfo specific properties603438 +Node: Publishing links604785 +Node: Site map606165 +Node: Generating an index609482 +Node: Uploading Files610274 +Node: Sample Configuration612057 +Node: Simple example612555 +Node: Complex example613271 +Node: Triggering Publication615320 +Node: Citation handling616346 +Node: Citations617215 +Node: Citation export processors618907 +Node: Working with Source Code621516 +Node: Features Overview623855 +Node: Structure of Code Blocks626614 +Node: Using Header Arguments629124 +Ref: System-wide header arguments629851 +Ref: Header arguments in Org mode properties630774 +Ref: Code block specific header arguments632602 +Ref: Header arguments in function calls634101 +Node: Environment of a Code Block634775 +Ref: Passing arguments634989 +Ref: Using sessions643178 +Ref: Choosing a working directory644577 +Ref: Inserting headers and footers646431 +Node: Evaluating Code Blocks646941 +Ref: How to evaluate source code647396 +Ref: Limit code block evaluation650298 +Ref: Cache results of evaluation651158 +Ref: Evaluating Code Blocks-Footnote-1653670 +Ref: Evaluating Code Blocks-Footnote-2653804 +Node: Results of Evaluation653962 +Ref: Collection654769 +Ref: Type656230 +Ref: Format660024 +Ref: Handling662326 +Ref: Post-processing663201 +Ref: Results of Evaluation-Footnote-1664951 +Node: Exporting Code Blocks665109 +Node: Extracting Source Code667462 +Ref: Header arguments668443 +Ref: Functions671984 +Ref: Tangle hooks672235 +Ref: Jumping between code and Org672484 +Node: Languages672994 +Node: Editing Source Code673987 +Node: Noweb Reference Syntax676717 +Ref: Noweb Reference Syntax-Footnote-1682865 +Node: Library of Babel682955 +Node: Key bindings and Useful Functions683673 +Node: Batch Execution686098 +Node: Miscellaneous686881 +Node: Completion688275 +Node: Structure Templates690200 +Ref: Structure Templates-Footnote-1691950 +Node: Speed Keys692042 +Node: Clean View693211 +Node: Org Indent Mode694413 +Ref: Org Indent Mode-Footnote-1695619 +Node: Hard indentation695843 +Ref: Hard indentation-Footnote-1697326 +Ref: Hard indentation-Footnote-2697432 +Node: Execute commands in the active region697576 +Node: Dynamic Headline Numbering698588 +Node: The Very Busy C-c C-c Key699754 +Node: In-buffer Settings701742 +Ref: In-buffer Settings-Footnote-1710848 +Node: Regular Expressions711046 +Node: Org Syntax711668 +Node: Documentation Access713326 +Node: Escape Character713747 +Node: Code Evaluation Security714608 +Node: Interaction717475 +Node: Cooperation717898 +Node: Conflicts720790 +Node: TTY Keys725392 +Node: Protocols726994 +Node: The store-link protocol728455 +Node: The capture protocol729598 +Node: The open-source protocol731231 +Node: Org Crypt734472 +Node: Org Mobile736085 +Node: Setting up the staging area737441 +Ref: Setting up the staging area-Footnote-1738681 +Ref: Setting up the staging area-Footnote-2738888 +Node: Pushing to the mobile application739060 +Ref: Pushing to the mobile application-Footnote-1740071 +Ref: Pushing to the mobile application-Footnote-2740162 +Ref: Pushing to the mobile application-Footnote-3740529 +Node: Pulling from the mobile application740605 +Ref: Pulling from the mobile application-Footnote-1742918 +Node: Hacking742971 +Node: Hooks743922 +Node: Add-on Packages744246 +Node: Adding Hyperlink Types744715 +Node: Adding Export Back-ends748310 +Node: Tables in Arbitrary Syntax749567 +Node: Radio tables750836 +Node: A LaTeX example752973 +Ref: A LaTeX example-Footnote-1756825 +Ref: A LaTeX example-Footnote-2756868 +Ref: A LaTeX example-Footnote-3757029 +Node: Translator functions757481 +Node: Dynamic Blocks759657 +Node: Special Agenda Views761903 +Ref: Special Agenda Views-Footnote-1765614 +Ref: Special Agenda Views-Footnote-2765821 +Node: Speeding Up Your Agendas765953 +Node: Extracting Agenda Information767012 +Node: Using the Property API770817 +Node: Using the Mapping API774172 +Node: History and Acknowledgments778208 +Ref: From Carsten778406 +Ref: From Bastien781837 +Ref: List of Contributions783969 +Node: GNU Free Documentation License792631 +Ref: ADDENDUM How to use this License for your documents816589 +Node: Main Index817982 +Node: Key Index915591 +Node: Command and Function Index972247 +Node: Variable Index1019293 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/elpa/org-9.5.2/orgguide.info b/elpa/org-9.5.2/orgguide.info new file mode 100644 index 0000000..d0eaa5f --- /dev/null +++ b/elpa/org-9.5.2/orgguide.info @@ -0,0 +1,2642 @@ +This is orgguide.info, produced by makeinfo version 6.7 from +orgguide.texi. + +Copyright © 2004–2021 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with the Front-Cover Texts + being “A GNU Manual,” and with the Back-Cover Texts as in (a) + below. A copy of the license is included in the section entitled + “GNU Free Documentation License.” in the full Org manual, which is + distributed together with this compact guide. + + (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and + modify this GNU manual.” + +INFO-DIR-SECTION Emacs editing modes +START-INFO-DIR-ENTRY +* Org Guide: (orgguide). Abbreviated Org mode manual. +END-INFO-DIR-ENTRY + + +File: orgguide.info, Node: Top, Next: Introduction, Up: (dir) + +Org Mode Compact Guide +********************** + +Copyright © 2004–2021 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with the Front-Cover Texts + being “A GNU Manual,” and with the Back-Cover Texts as in (a) + below. A copy of the license is included in the section entitled + “GNU Free Documentation License.” in the full Org manual, which is + distributed together with this compact guide. + + (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and + modify this GNU manual.” + +* Menu: + +* Introduction:: Welcome! +* Document Structure:: A tree works like your brain. +* Tables:: Pure magic for quick formatting. +* Hyperlinks:: Notes in context. +* TODO Items:: Every tree branch can be a TODO item. +* Tags:: Tagging headlines and matching sets of tags. +* Properties:: Storing information about an entry. +* Dates and Times:: Making items useful for planning. +* Capture, Refile, Archive: Capture Refile Archive. The ins and outs for projects. +* Agenda Views:: Collecting information into views. +* Markup:: Compose beautiful documents. +* Exporting:: Sharing and publishing notes. +* Publishing:: Create a web site of linked Org files. +* Working with Source Code:: Export, evaluate, and tangle code blocks. +* Miscellaneous:: All the rest which did not fit elsewhere. + +— The Detailed Node Listing — + +Document Structure + +* Headlines:: How to typeset Org tree nodes. +* Visibility Cycling:: Show and hide, much simplified. +* Motion:: Jumping to other headlines. +* Structure Editing:: Changing sequence and level of headlines. +* Sparse Trees:: Matches embedded in context. +* Plain Lists:: Additional structure within an entry. + +TODO Items + +* TODO Basics:: Marking and displaying TODO entries. +* Multi-state Workflow:: More than just on/off. +* Progress Logging:: Dates and notes for progress. +* Priorities:: Some things are more important than others. +* Breaking Down Tasks:: Splitting a task into manageable pieces. +* Checkboxes:: Tick-off lists. + +Dates and Times + +* Timestamps:: Assigning a time to a tree entry. +* Creating Timestamps:: Commands that insert timestamps. +* Deadlines and Scheduling:: Planning your work. +* Clocking Work Time:: Tracking how long you spent on a task. + +Capture, Refile, Archive + +* Capture:: Capturing new stuff. +* Refile and Copy:: Moving/copying a tree from one place to another. +* Archiving:: What to do with finished products. + +Agenda Views + +* Agenda Files:: Files being searched for agenda information. +* Agenda Dispatcher:: Keyboard access to agenda views. +* Built-in Agenda Views:: What is available out of the box? +* Global TODO List:: All unfinished action items. +* Matching Tags and Properties:: Structured information with fine-tuned search. +* Search View:: Find entries by searching for text. +* Agenda Commands:: Remote editing of Org trees. +* Custom Agenda Views:: Defining special searches and views. + +Markup + +* Paragraphs:: The basic unit of text. +* Emphasis and Monospace:: Bold, italic, etc. +* Embedded LaTeX:: LaTeX can be freely used inside Org documents. +* Literal examples:: Source code examples with special formatting. +* Images:: Display an image. +* Creating Footnotes:: Edit and read footnotes. + +Exporting + +* The Export Dispatcher:: The main interface. +* Export Settings:: Common export settings. +* Table of Contents:: The if and where of the table of contents. +* Include Files:: Include additional files into a document. +* Comment Lines:: What will not be exported. +* ASCII/UTF-8 Export:: Exporting to flat files with encoding. +* HTML Export:: Exporting to HTML. +* LaTeX Export:: Exporting to LaTeX and processing to PDF. +* iCalendar Export:: Exporting to iCalendar. + + + +File: orgguide.info, Node: Introduction, Next: Document Structure, Prev: Top, Up: Top + +1 Introduction +************** + +Org is a mode for keeping notes, maintaining TODO lists, and doing +project planning with a fast and effective plain-text system. It is +also an authoring and publishing system, and it supports working with +source code for literal programming and reproducible research. + + This document is a much compressed derivative of the *note +comprehensive Org mode manual: (org)Top. It contains all basic features +and commands, along with important hints for customization. It is +intended for beginners who would shy back from a 200 pages manual +because of sheer size. + +Installation +============ + + Important: If you are using a version of Org that is part of the + Emacs distribution, please skip this section and go directly to + *note Activation::. + + If you have downloaded Org from the web, either as a distribution +‘.zip’ or ‘.tar’ file, or as a Git archive, it is best to run it +directly from the distribution directory. You need to add the ‘lisp/’ +subdirectories to the Emacs load path. To do this, add the following +line to your Emacs init file: + + (add-to-list 'load-path "~/path/to/orgdir/lisp") + +If you have been using git or a tar ball to get Org, you need to run the +following command to generate autoload information. + + make autoloads + +Activation +========== + +Add the following lines to your Emacs init file to define _global_ keys +for three commands that are useful in any Emacs buffer, not just Org +buffers. Please choose suitable keys yourself. + + (global-set-key (kbd "C-c l") #'org-store-link) + (global-set-key (kbd "C-c a") #'org-agenda) + (global-set-key (kbd "C-c c") #'org-capture) + + Files with extension ‘.org’ will be put into Org mode automatically. + +Feedback +======== + +If you find problems with Org, or if you have questions, remarks, or +ideas about it, please mail to the Org mailing list +<emacs-orgmode@gnu.org>. For information on how to submit bug reports, +see the main manual. + + +File: orgguide.info, Node: Document Structure, Next: Tables, Prev: Introduction, Up: Top + +2 Document Structure +******************** + +Org is an outliner. Outlines allow a document to be organized in a +hierarchical structure, which, least for me, is the best representation +of notes and thoughts. An overview of this structure is achieved by +folding, i.e., hiding large parts of the document to show only the +general document structure and the parts currently being worked on. Org +greatly simplifies the use of outlines by compressing the entire show +and hide functionalities into a single command, ‘org-cycle’, which is +bound to the ‘<TAB>’ key. + +* Menu: + +* Headlines:: How to typeset Org tree nodes. +* Visibility Cycling:: Show and hide, much simplified. +* Motion:: Jumping to other headlines. +* Structure Editing:: Changing sequence and level of headlines. +* Sparse Trees:: Matches embedded in context. +* Plain Lists:: Additional structure within an entry. + + +File: orgguide.info, Node: Headlines, Next: Visibility Cycling, Up: Document Structure + +2.1 Headlines +============= + +Headlines define the structure of an outline tree. The headlines in Org +start on the left margin(1) with one or more stars followed by a space. +For example: + + * Top level headline + ** Second level + *** Third level + some text + *** Third level + more text + * Another top level headline + + Note that a headline named after ‘org-footnote-section’, which +defaults to ‘Footnotes’, is considered as special. A subtree with this +headline will be silently ignored by exporting functions. + + Some people find the many stars too noisy and would prefer an outline +that has whitespace followed by a single star as headline starters. See +*note Miscellaneous:: for a setup to realize this. + + ---------- Footnotes ---------- + + (1) See the variable ‘org-special-ctrl-a/e’ to configure special +behavior of ‘C-a’ and ‘C-e’ in headlines. + + +File: orgguide.info, Node: Visibility Cycling, Next: Motion, Prev: Headlines, Up: Document Structure + +2.2 Visibility Cycling +====================== + +Outlines make it possible to hide parts of the text in the buffer. Org +uses just two commands, bound to ‘<TAB>’ and {{{kbd{S-TAB)}}} to change +the visibility in the buffer. + +‘<TAB>’ + _Subtree cycling_: Rotate current subtree among the states + + ,-> FOLDED -> CHILDREN -> SUBTREE --. + '-----------------------------------' + + When called with a prefix argument (‘C-u <TAB>’), or with the Shift + key, global cycling is invoked. + +‘S-<TAB>’ +‘C-u <TAB>’ + _Global cycling_: Rotate the entire buffer among the states + + ,-> OVERVIEW -> CONTENTS -> SHOW ALL --. + '--------------------------------------' + +‘C-u C-u C-u <TAB>’ + Show all, including drawers. + + When Emacs first visits an Org file, the global state is set to +OVERVIEW, i.e., only the top level headlines are visible. This can be +configured through the variable ‘org-startup-folded’, or on a per-file +basis by adding a ‘STARTUP’ keyword to ‘overview’, ‘content’, ‘showall’, +‘showeverything’ or ‘show<n>levels’ (n = 2..5) like this: + + #+STARTUP: content + + +File: orgguide.info, Node: Motion, Next: Structure Editing, Prev: Visibility Cycling, Up: Document Structure + +2.3 Motion +========== + +The following commands jump to other headlines in the buffer. + +‘C-c C-n’ + Next heading. + +‘C-c C-p’ + Previous heading. + +‘C-c C-f’ + Next heading same level. + +‘C-c C-b’ + Previous heading same level. + +‘C-c C-u’ + Backward to higher level heading. + + +File: orgguide.info, Node: Structure Editing, Next: Sparse Trees, Prev: Motion, Up: Document Structure + +2.4 Structure Editing +===================== + +‘M-<RET>’ + Insert new heading with same level as current. If point is in a + plain list item, a new item is created (see *note Plain Lists::). + When this command is used in the middle of a line, the line is + split and the rest of the line becomes the new headline(1). + +‘M-S-<RET>’ + Insert new TODO entry with same level as current heading. + +‘<TAB>’ in new +empty entry + In a new entry with no text yet, ‘<TAB>’ cycles through reasonable + levels. + +‘M-<LEFT>’ +‘M-<RIGHT>’ + Promote or demote current heading by one level. + +‘M-<UP>’ +‘M-<DOWN>’ + Move subtree up or down, i.e., swap with previous or next subtree + of same level. + +‘C-c C-w’ + Refile entry or region to a different location. See *note Refile + and Copy::. + +‘C-x n s’ +‘C-x n w’ + Narrow buffer to current subtree and widen it again. + + When there is an active region (Transient Mark mode), promotion and +demotion work on all headlines in the region. + + ---------- Footnotes ---------- + + (1) If you do not want the line to be split, customize the variable +‘org-M-RET-may-split-line’. + + +File: orgguide.info, Node: Sparse Trees, Next: Plain Lists, Prev: Structure Editing, Up: Document Structure + +2.5 Sparse Trees +================ + +An important feature of Org mode is the ability to construct _sparse +trees_ for selected information in an outline tree, so that the entire +document is folded as much as possible, but the selected information is +made visible along with the headline structure above it(1). Just try it +out and you will see immediately how it works. + + Org mode contains several commands creating such trees, all these +commands can be accessed through a dispatcher: + +‘C-c /’ + This prompts for an extra key to select a sparse-tree creating + command. + +‘C-c / r’ + Occur. Prompts for a regexp and shows a sparse tree with all + matches. Each match is also highlighted; the highlights disappear + by pressing ‘C-c C-c’. + + The other sparse tree commands select headings based on TODO + keywords, tags, or properties and will be discussed later in this + manual. + + ---------- Footnotes ---------- + + (1) See also the variable ‘org-show-context-detail’ to decide how +much context is shown around each match. + + +File: orgguide.info, Node: Plain Lists, Prev: Sparse Trees, Up: Document Structure + +2.6 Plain Lists +=============== + +Within an entry of the outline tree, hand-formatted lists can provide +additional structure. They also provide a way to create lists of +checkboxes (see *note Checkboxes::). Org supports editing such lists, +and every exporter (see *note Exporting::) can parse and format them. + + Org knows ordered lists, unordered lists, and description lists. + + • _Unordered_ list items start with ‘-’, ‘+’, or ‘*’ as bullets. + + • _Ordered_ list items start with ‘1.’, or ‘1)’. + + • _Description_ list use ‘::’ to separate the _term_ from the + description. + + Items belonging to the same list must have the same indentation on +the first line. An item ends before the next line that is indented like +its bullet/number, or less. A list ends when all items are closed, or +before two blank lines. An example: + + * Lord of the Rings + My favorite scenes are (in this order) + 1. The attack of the Rohirrim + 2. Eowyn's fight with the witch king + + this was already my favorite scene in the book + + I really like Miranda Otto. + Important actors in this film are: + - Elijah Wood :: He plays Frodo + - Sean Astin :: He plays Sam, Frodo's friend. + + The following commands act on items when point is in the first line +of an item (the line with the bullet or number). + +‘<TAB>’ + Items can be folded just like headline levels. + +‘M-<RET>’ + Insert new item at current level. With a prefix argument, force a + new heading (see *note Structure Editing::). + +‘M-S-<RET>’ + Insert a new item with a checkbox (see *note Checkboxes::). + +‘M-S-<UP>’ +‘M-S-<DOWN>’ + Move the item including subitems up/down (swap with previous/next + item of same indentation). If the list is ordered, renumbering is + automatic. + +‘M-<LEFT>’ +‘M-<RIGHT>’ + Decrease/increase the indentation of an item, leaving children + alone. + +‘M-S-<LEFT>’ +‘M-S-<RIGHT>’ + Decrease/increase the indentation of the item, including subitems. + +‘C-c C-c’ + If there is a checkbox (see *note Checkboxes::) in the item line, + toggle the state of the checkbox. Also verify bullets and + indentation consistency in the whole list. + +‘C-c -’ + Cycle the entire list level through the different itemize/enumerate + bullets (‘-’, ‘+’, ‘*’, ‘1.’, ‘1)’). + + +File: orgguide.info, Node: Tables, Next: Hyperlinks, Prev: Document Structure, Up: Top + +3 Tables +******** + +Org comes with a fast and intuitive table editor. Spreadsheet-like +calculations are supported in connection with the Emacs Calc package +(see *note GNU Emacs Calculator Manual: (calc)Top.). + + Org makes it easy to format tables in plain ASCII. Any line with ‘|’ +as the first non-whitespace character is considered part of a table. +‘|’ is also the column separator. A table might look like this: + + | Name | Phone | Age | + |-------+-------+-----| + | Peter | 1234 | 17 | + | Anna | 4321 | 25 | + + A table is re-aligned automatically each time you press ‘<TAB>’ or +‘<RET>’ or ‘C-c C-c’ inside the table. ‘<TAB>’ also moves to the next +field (‘<RET>’ to the next row) and creates new table rows at the end of +the table or before horizontal lines. The indentation of the table is +set by the first line. Any line starting with ‘|-’ is considered as a +horizontal separator line and will be expanded on the next re-align to +span the whole table width. So, to create the above table, you would +only type + + |Name|Phone|Age| + |- + +and then press ‘<TAB>’ to align the table and start filling in fields. +Even faster would be to type ‘|Name|Phone|Age’ followed by ‘C-c <RET>’. + + When typing text into a field, Org treats ‘DEL’, ‘Backspace’, and all +character keys in a special way, so that inserting and deleting avoids +shifting other fields. Also, when typing _immediately after point was +moved into a new field with ‘<TAB>’, ‘S-<TAB>’ or ‘<RET>’_, the field is +automatically made blank. + +Creation and conversion +======================= + +‘C-c |’ + Convert the active region to table. If every line contains at + least one ‘<TAB>’ character, the function assumes that the material + is tab separated. If every line contains a comma, comma-separated + values (CSV) are assumed. If not, lines are split at whitespace + into fields. + + If there is no active region, this command creates an empty Org + table. But it is easier just to start typing, like ‘| N a m e | P + h o n e | A g e <RET> | - <TAB>’. + +Re-aligning and field motion +============================ + +‘C-c C-c’ + Re-align the table without moving point. + +‘<TAB>’ + Re-align the table, move to the next field. Creates a new row if + necessary. + +‘S-<TAB>’ + Re-align, move to previous field. + +‘<RET>’ + Re-align the table and move down to next row. Creates a new row if + necessary. + +‘S-<UP>’ +‘S-<DOWN>’ +‘S-<LEFT>’ +‘S-<RIGHT>’ + Move a cell up, down, left, and right by swapping with adjacent + cell. + +Column and row editing +====================== + +‘M-<LEFT>’, ‘M-<RIGHT>’ + Move the current column left/right. + +‘M-S-<LEFT>’ + Kill the current column. + +‘M-S-<RIGHT>’ + Insert a new column to the left of point position. + +‘M-<UP>’, ‘M-<DOWN>’ + Move the current row up/down. + +‘M-S-<UP>’ + Kill the current row or horizontal line. + +‘M-S-<DOWN>’ + Insert a new row above the current row. With a prefix argument, + the line is created below the current one. + +‘C-c -’ + Insert a horizontal line below current row. With a prefix + argument, the line is created above the current line. + +‘C-c <RET>’ + Insert a horizontal line below current row, and move the point into + the row below that line. + +‘C-c ^’ + Sort the table lines in the region. The position of point + indicates the column to be used for sorting, and the range of lines + is the range between the nearest horizontal separator lines, or the + entire table. + + +File: orgguide.info, Node: Hyperlinks, Next: TODO Items, Prev: Tables, Up: Top + +4 Hyperlinks +************ + +Like HTML, Org provides links inside a file, external links to other +files, Usenet articles, emails, and much more. + + Org recognizes plain URIs, possibly wrapped within angle brackets, +and activate them as clickable links. The general link format, however, +looks like this: + + [[LINK][DESCRIPTION]] + +or alternatively + + [[LINK]] + + Once a link in the buffer is complete, with all brackets present, Org +changes the display so that ‘DESCRIPTION’ is displayed instead of +‘[[LINK][DESCRIPTION]]’ and ‘LINK’ is displayed instead of ‘[[LINK]]’. +To edit the invisible LINK part, use ‘C-c C-l’ with the point on the +link. + +Internal links +============== + +If the link does not look like a URL, it is considered to be internal in +the current file. The most important case is a link like +‘[[#my-custom-id]]’ which links to the entry with the ‘CUSTOM_ID’ +property ‘my-custom-id’. + + Links such as ‘[[My Target]]’ or ‘[[My Target][Find my target]]’ lead +to a text search in the current file for the corresponding target, which +looks like ‘<<My Target>>’. + +External Links +============== + +Org supports links to files, websites, Usenet and email messages, BBDB +database entries and links to both IRC conversations and their logs. +External links are URL-like locators. They start with a short +identifying string followed by a colon. There can be no space after the +colon. Here are some examples: + +‘http://www.astro.uva.nl/=dominik’ on the web +‘file:/home/dominik/images/jupiter.jpg’ file, absolute path +‘/home/dominik/images/jupiter.jpg’ same as above +‘file:papers/last.pdf’ file, relative path +‘./papers/last.pdf’ same as above +‘file:projects.org’ another Org file +‘docview:papers/last.pdf::NNN’ open in DocView mode at page NNN +‘id:B7423F4D-2E8A-471B-8810-C40F074717E9’ link to heading by ID +‘news:comp.emacs’ Usenet link +‘mailto:adent@galaxy.net’ mail link +‘mhe:folder#id’ MH-E message link +‘rmail:folder#id’ Rmail message link +‘gnus:group#id’ Gnus article link +‘bbdb:R.*Stallman’ BBDB link (with regexp) +‘irc:/irc.com/#emacs/bob’ IRC link +‘info:org#Hyperlinks’ Info node link + + File links can contain additional information to make Emacs jump to a +particular location in the file when following a link. This can be a +line number or a search option after a double colon. Here are a few +examples,, together with an explanation: + +‘file:~/code/main.c::255’ Find line 255 +‘file:~/xx.org::My Target’ Find ‘<<My Target>>’ +‘[[file:~/xx.org::#my-custom-id]]’ Find entry with a custom ID + +Handling Links +============== + +Org provides methods to create a link in the correct syntax, to insert +it into an Org file, and to follow the link. + + The main function is ‘org-store-link’, called with ‘M-x +org-store-link’. Because of its importance, we suggest to bind it to a +widely available key (see *note Activation::). It stores a link to the +current location. The link is stored for later insertion into an Org +buffer—see below. + + From an Org buffer, the following commands create, navigate or, more +generally, act on links. + +‘C-c C-l’ + Insert a link. This prompts for a link to be inserted into the + buffer. You can just type a link, or use history keys ‘<UP>’ and + ‘<DOWN>’ to access stored links. You will be prompted for the + description part of the link. + + When called with a ‘C-u’ prefix argument, file name completion is + used to link to a file. + +‘C-c C-l’ (with point on existing link) + When point is on an existing link, ‘C-c C-l’ allows you to edit the + link and description parts of the link. + +‘C-c C-o’ + Open link at point. + +‘C-c &’ + Jump back to a recorded position. A position is recorded by the + commands following internal links, and by ‘C-c %’. Using this + command several times in direct succession moves through a ring of + previously recorded positions. + + +File: orgguide.info, Node: TODO Items, Next: Tags, Prev: Hyperlinks, Up: Top + +5 TODO Items +************ + +Org mode does not require TODO lists to live in separate documents. +Instead, TODO items are part of a notes file, because TODO items usually +come up while taking notes! With Org mode, simply mark any entry in a +tree as being a TODO item. In this way, information is not duplicated, +and TODO items remain in the context from which they emerged. + + Org mode provides methods to give you an overview of all the things +that you have to do, collected from many files. + +* Menu: + +* TODO Basics:: Marking and displaying TODO entries. +* Multi-state Workflow:: More than just on/off. +* Progress Logging:: Dates and notes for progress. +* Priorities:: Some things are more important than others. +* Breaking Down Tasks:: Splitting a task into manageable pieces. +* Checkboxes:: Tick-off lists. + + +File: orgguide.info, Node: TODO Basics, Next: Multi-state Workflow, Up: TODO Items + +5.1 Basic TODO Functionality +============================ + +Any headline becomes a TODO item when it starts with the word ‘TODO’, +for example: + + *** TODO Write letter to Sam Fortune + + The most important commands to work with TODO entries are: + +‘C-c C-t’ + Rotate the TODO state of the current item among + + ,-> (unmarked) -> TODO -> DONE --. + '--------------------------------' + + The same rotation can also be done “remotely” from the agenda + buffer with the ‘t’ command key (see *note Agenda Commands::). + +‘S-<RIGHT>’ +‘S-<LEFT>’ + Select the following/preceding TODO state, similar to cycling. + +‘C-c / t’ + View TODO items in a _sparse tree_ (see *note Sparse Trees::). + Folds the entire buffer, but shows all TODO items—with not-DONE + state—and the headings hierarchy above them. + +‘M-x org-agenda t’ + Show the global TODO list. Collects the TODO items (with not-DONE + states) from all agenda files (see *note Agenda Views::) into a + single buffer. See *note Global TODO List::, for more information. + +‘S-M-<RET>’ + Insert a new TODO entry below the current one. + + Changing a TODO state can also trigger tag changes. See the +docstring of the option ‘org-todo-state-tags-triggers’ for details. + + +File: orgguide.info, Node: Multi-state Workflow, Next: Progress Logging, Prev: TODO Basics, Up: TODO Items + +5.2 Multi-state Workflow +======================== + +You can use TODO keywords to indicate @emph{sequential} working progress +states: + + (setq org-todo-keywords + '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED"))) + +The vertical bar separates the ‘TODO’ keywords (states that _need +action_) from the ‘DONE’ states (which need _no further action_). If +you do not provide the separator bar, the last state is used as the +‘DONE’ state. With this setup, the command ‘C-c C-t’ cycles an entry +from ‘TODO’ to ‘FEEDBACK’, then to ‘VERIFY’, and finally to ‘DONE’ and +‘DELEGATED’. + + Sometimes you may want to use different sets of TODO keywords in +parallel. For example, you may want to have the basic ‘TODO=/=DONE’, +but also a workflow for bug fixing. Your setup would then look like +this: + + (setq org-todo-keywords + '((sequence "TODO(t)" "|" "DONE(d)") + (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)"))) + +The keywords should all be different, this helps Org mode to keep track +of which subsequence should be used for a given entry. The example also +shows how to define keys for fast access of a particular state, by +adding a letter in parenthesis after each keyword—you will be prompted +for the key after ‘C-c C-t’. + + To define TODO keywords that are valid only in a single file, use the +following text anywhere in the file. + + #+TODO: TODO(t) | DONE(d) + #+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f) + #+TODO: | CANCELED(c) + + After changing one of these lines, use ‘C-c C-c’ with the cursor +still in the line to make the changes known to Org mode. + + +File: orgguide.info, Node: Progress Logging, Next: Priorities, Prev: Multi-state Workflow, Up: TODO Items + +5.3 Progress Logging +==================== + +To record a timestamp and a note when changing a TODO state, call the +command ‘org-todo’ with a prefix argument. + +‘C-u C-c C-t’ + Prompt for a note and record a the time of the TODO state change. + + Org mode can also automatically record a timestamp and optionally a +note when you mark a TODO item as DONE, or even each time you change the +state of a TODO item. This system is highly configurable, settings can +be on a per-keyword basis and can be localized to a file or even a +subtree. For information on how to clock working time for a task, see +*note Clocking Work Time::. + +Closing items +------------- + +The most basic logging is to keep track of _when_ a certain TODO item +was marked as done. This can be achieved with(1) + + (setq org-log-done 'time) + +Then each time you turn an entry from a TODO (not-done) state into any +of the DONE states, a line ‘CLOSED: [timestamp]’ is inserted just after +the headline. + + If you want to record a note along with the timestamp, use(2) + + (setq org-log-done 'note) + +You are then be prompted for a note, and that note is stored below the +entry with a ‘Closing Note’ heading. + +Tracking TODO state changes +--------------------------- + +You might want to keep track of TODO state changes. You can either +record just a timestamp, or a time-stamped note for a change. These +records are inserted after the headline as an itemized list. When +taking a lot of notes, you might want to get the notes out of the way +into a drawer. Customize the variable ‘org-log-into-drawer’ to get this +behavior. + + For state logging, Org mode expects configuration on a per-keyword +basis. This is achieved by adding special markers ‘!’ (for a timestamp) +and ‘@’ (for a note) in parentheses after each keyword. For example: + + #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@) + +defines TODO keywords and fast access keys, and also request that a time +is recorded when the entry is set to ‘DONE’, and that a note is recorded +when switching to ‘WAIT’ or ‘CANCELED’. The same syntax works also when +setting ‘org-todo-keywords’. + + ---------- Footnotes ---------- + + (1) The corresponding in-buffer setting is ‘#+STARTUP: logdone’. + + (2) The corresponding in-buffer setting is ‘#+STARTUP: logenotedone’. + + +File: orgguide.info, Node: Priorities, Next: Breaking Down Tasks, Prev: Progress Logging, Up: TODO Items + +5.4 Priorities +============== + +If you use Org mode extensively, you may end up with enough TODO items +that it starts to make sense to prioritize them. Prioritizing can be +done by placing a _priority cookie_ into the headline of a TODO item, +like this + + *** TODO [#A] Write letter to Sam Fortune + + Org mode supports three priorities: ‘A’, ‘B’, and ‘C’. ‘A’ is the +highest, ‘B’ the default if none is given. Priorities make a difference +only in the agenda. + +‘C-c ,’ + Set the priority of the current headline. Press ‘A’, ‘B’ or ‘C’ to + select a priority, or ‘<SPC>’ to remove the cookie. + +‘S-<UP>’ (‘org-priority-up’) +‘S-<DOWN>’ (‘org-priority-down’) + Increase/decrease the priority of the current headline. + + +File: orgguide.info, Node: Breaking Down Tasks, Next: Checkboxes, Prev: Priorities, Up: TODO Items + +5.5 Breaking Tasks Down into Subtasks +===================================== + +It is often advisable to break down large tasks into smaller, manageable +subtasks. You can do this by creating an outline tree below a TODO +item, with detailed subtasks on the tree. To keep an overview of the +fraction of subtasks that have already been marked as done, insert +either ‘[/]’ or ‘[%]’ anywhere in the headline. These cookies are +updated each time the TODO status of a child changes, or when pressing +‘C-c C-c’ on the cookie. For example: + + * Organize Party [33%] + ** TODO Call people [1/2] + *** TODO Peter + *** DONE Sarah + ** TODO Buy food + ** DONE Talk to neighbor + + +File: orgguide.info, Node: Checkboxes, Prev: Breaking Down Tasks, Up: TODO Items + +5.6 Checkboxes +============== + +Every item in a plain list (see *note Plain Lists::) can be made into a +checkbox by starting it with the string ‘[ ]’. Checkboxes are not +included into the global TODO list, so they are often great to split a +task into a number of simple steps. + + Here is an example of a checkbox list. + + * TODO Organize party [2/4] + - [-] call people [1/2] + - [ ] Peter + - [X] Sarah + - [X] order food + + Checkboxes work hierarchically, so if a checkbox item has children +that are checkboxes, toggling one of the children checkboxes makes the +parent checkbox reflect if none, some, or all of the children are +checked. + + The following commands work with checkboxes: + +‘C-c C-c’ + Toggle checkbox status or—with prefix argument—checkbox presence at + point. + +‘M-S-<RET>’ + Insert a new item with a checkbox. This works only if point is + already in a plain list item (see *note Plain Lists::). + + +File: orgguide.info, Node: Tags, Next: Properties, Prev: TODO Items, Up: Top + +6 Tags +****** + +An excellent way to implement labels and contexts for cross-correlating +information is to assign _tags_ to headlines. Org mode has extensive +support for tags. + + Every headline can contain a list of tags; they occur at the end of +the headline. Tags are normal words containing letters, numbers, ‘_’, +and ‘@’. Tags must be preceded and followed by a single colon, e.g., +‘:work:’. Several tags can be specified, as in ‘:work:urgent:’. Tags +by default are in bold face with the same color as the headline. + +Tag inheritance +=============== + +Tags make use of the hierarchical structure of outline trees. If a +heading has a certain tag, all subheadings inherit the tag as well. For +example, in the list + + * Meeting with the French group :work: + ** Summary by Frank :boss:notes: + *** TODO Prepare slides for him :action: + +the final heading has the tags ‘work’, ‘boss’, ‘notes’, and ‘action’ +even though the final heading is not explicitly marked with those tags. + + You can also set tags that all entries in a file should inherit just +as if these tags were defined in a hypothetical level zero that +surrounds the entire file. Use a line like this(1): + + #+FILETAGS: :Peter:Boss:Secret: + +Setting tags +============ + +Tags can simply be typed into the buffer at the end of a headline. +After a colon, ‘M-<TAB>’ offers completion on tags. There is also a +special command for inserting tags: + +‘C-c C-q’ + Enter new tags for the current headline. Org mode either offers + completion or a special single-key interface for setting tags, see + below. + +‘C-c C-c’ + When point is in a headline, this does the same as ‘C-c C-q’. + + Org supports tag insertion based on a _list of tags_. By default +this list is constructed dynamically, containing all tags currently used +in the buffer. You may also globally specify a hard list of tags with +the variable ‘org-tag-alist’. Finally you can set the default tags for +a given file using the ‘TAGS’ keyword, like + + #+TAGS: @work @home @tennisclub + #+TAGS: laptop car pc sailboat + + By default Org mode uses the standard minibuffer completion +facilities for entering tags. However, it also implements another, +quicker, tag selection method called _fast tag selection_. This allows +you to select and deselect tags with just a single key press. For this +to work well you should assign unique letters to most of your commonly +used tags. You can do this globally by configuring the variable +‘org-tag-alist’ in your Emacs init file. For example, you may find the +need to tag many items in different files with ‘@home’. In this case +you can set something like: + + (setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l))) + + If the tag is only relevant to the file you are working on, then you +can instead set the ‘TAGS’ keyword as: + + #+TAGS: @work(w) @home(h) @tennisclub(t) laptop(l) pc(p) + +Tag groups +========== + +A tag can be defined as a _group tag_ for a set of other tags. The +group tag can be seen as the “broader term” for its set of tags. + + You can set group tags by using brackets and inserting a colon +between the group tag and its related tags: + + #+TAGS: [ GTD : Control Persp ] + +or, if tags in the group should be mutually exclusive: + + #+TAGS: { Context : @Home @Work } + + When you search for a group tag, it return matches for all members in +the group and its subgroups. In an agenda view, filtering by a group +tag displays or hide headlines tagged with at least one of the members +of the group or any of its subgroups. + + If you want to ignore group tags temporarily, toggle group tags +support with ‘org-toggle-tags-groups’, bound to ‘C-c C-x q’. + +Tag searches +============ + +‘C-c / m’ or ‘C-c \’ + Create a sparse tree with all headlines matching a tags search. + With a ‘C-u’ prefix argument, ignore headlines that are not a TODO + line. + +‘M-x org-agenda m’ + Create a global list of tag matches from all agenda files. See + *note Matching Tags and Properties::. + +‘M-x org-agenda M’ + Create a global list of tag matches from all agenda files, but + check only TODO items and force checking subitems (see the option + ‘org-tags-match-list-sublevels’). + + These commands all prompt for a match string which allows basic +Boolean logic like ‘+boss+urgent-project1’, to find entries with tags +‘boss’ and ‘urgent’, but not ‘project1’, or ‘Kathy|Sally’ to find +entries which are tagged, like ‘Kathy’ or ‘Sally’. The full syntax of +the search string is rich and allows also matching against TODO +keywords, entry levels and properties. For a more detailed description +with many examples, see *note Matching Tags and Properties::. + + ---------- Footnotes ---------- + + (1) As with all these in-buffer settings, pressing ‘C-c C-c’ +activates any changes in the line. + + +File: orgguide.info, Node: Properties, Next: Dates and Times, Prev: Tags, Up: Top + +7 Properties +************ + +Properties are key-value pairs associated with an entry. They live in a +special drawer with the name ‘PROPERTIES’. Each property is specified +on a single line, with the key (surrounded by colons) first, and the +value after it: + + * CD collection + ** Classic + *** Goldberg Variations + :PROPERTIES: + :Title: Goldberg Variations + :Composer: J.S. Bach + :Publisher: Deutsche Grammophon + :NDisks: 1 + :END: + + You may define the allowed values for a particular property ‘Xyz’ by +setting a property ‘Xyz_ALL’. This special property is _inherited_, so +if you set it in a level 1 entry, it applies to the entire tree. When +allowed values are defined, setting the corresponding property becomes +easier and is less prone to typing errors. For the example with the CD +collection, we can pre-define publishers and the number of disks in a +box like this: + + * CD collection + :PROPERTIES: + :NDisks_ALL: 1 2 3 4 + :Publisher_ALL: "Deutsche Grammophon" Philips EMI + :END: + + If you want to set properties that can be inherited by any entry in a +file, use a line like: + + #+PROPERTY: NDisks_ALL 1 2 3 4 + + The following commands help to work with properties: + +‘C-c C-x p’ + Set a property. This prompts for a property name and a value. + +‘C-c C-c d’ + Remove a property from the current entry. + + To create sparse trees and special lists with selection based on +properties, the same commands are used as for tag searches (see *note +Tags::). The syntax for the search string is described in *note +Matching Tags and Properties::. + + +File: orgguide.info, Node: Dates and Times, Next: Capture Refile Archive, Prev: Properties, Up: Top + +8 Dates and Times +***************** + +To assist project planning, TODO items can be labeled with a date and/or +a time. The specially formatted string carrying the date and time +information is called a _timestamp_ in Org mode. + +* Menu: + +* Timestamps:: Assigning a time to a tree entry. +* Creating Timestamps:: Commands that insert timestamps. +* Deadlines and Scheduling:: Planning your work. +* Clocking Work Time:: Tracking how long you spent on a task. + + +File: orgguide.info, Node: Timestamps, Next: Creating Timestamps, Up: Dates and Times + +8.1 Timestamps +============== + +A timestamp is a specification of a date—possibly with a time or a range +of times—in a special format, either ‘<2003-09-16 Tue>’ or ‘<2003-09-16 +Tue 09:39>’ or ‘<2003-09-16 Tue 12:00-12:30>’. A timestamp can appear +anywhere in the headline or body of an Org tree entry. Its presence +causes entries to be shown on specific dates in the agenda (see [BROKEN +LINK: *The Weekly/daily Agenda]). We distinguish: + +Plain timestamp; Event; Appointment + A simple timestamp just assigns a date/time to an item. This is + just like writing down an appointment or event in a paper agenda. + + * Meet Peter at the movies + <2006-11-01 Wed 19:15> + * Discussion on climate change + <2006-11-02 Thu 20:00-22:00> + +Timestamp with repeater interval + A timestamp may contain a _repeater interval_, indicating that it + applies not only on the given date, but again and again after a + certain interval of N days (d), weeks (w), months (m), or years + (y). The following shows up in the agenda every Wednesday: + + * Pick up Sam at school + <2007-05-16 Wed 12:30 +1w> + +Diary-style expression entries + For more complex date specifications, Org mode supports using the + special expression diary entries implemented in the Emacs Calendar + package. For example, with optional time: + + * 22:00-23:00 The nerd meeting on every 2nd Thursday of the month + <%%(diary-float t 4 2)> + +Time/Date range + Two timestamps connected by ‘--’ denote a range. + + ** Meeting in Amsterdam + <2004-08-23 Mon>--<2004-08-26 Thu> + +Inactive timestamp + Just like a plain timestamp, but with square brackets instead of + angular ones. These timestamps are inactive in the sense that they + do _not_ trigger an entry to show up in the agenda. + + * Gillian comes late for the fifth time + [2006-11-01 Wed] + + +File: orgguide.info, Node: Creating Timestamps, Next: Deadlines and Scheduling, Prev: Timestamps, Up: Dates and Times + +8.2 Creating Timestamps +======================= + +For Org mode to recognize timestamps, they need to be in the specific +format. All commands listed below produce timestamps in the correct +format. + +‘C-c .’ + Prompt for a date and insert a corresponding timestamp. When point + is at an existing timestamp in the buffer, the command is used to + modify this timestamp instead of inserting a new one. When this + command is used twice in succession, a time range is inserted. + With a prefix argument, it also adds the current time. + +‘C-c !’ + Like ‘C-c .’, but insert an inactive timestamp that does not cause + an agenda entry. + +‘S-<LEFT>’ +‘S-<RIGHT>’ + Change date at point by one day. + +‘S-<UP>’ +‘S-<DOWN>’ + On the beginning or enclosing bracket of a timestamp, change its + type. Within a timestamp, change the item under point. Point can + be on a year, month, day, hour or minute. When the timestamp + contains a time range like ‘15:30-16:30’, modifying the first time + also shifts the second, shifting the time block with constant + length. To change the length, modify the second time. + + When Org mode prompts for a date/time, it accepts any string +containing some date and/or time information, and intelligently +interprets the string, deriving defaults for unspecified information +from the current date and time. You can also select a date in the +pop-up calendar. See the manual for more information on how exactly the +date/time prompt works. + + +File: orgguide.info, Node: Deadlines and Scheduling, Next: Clocking Work Time, Prev: Creating Timestamps, Up: Dates and Times + +8.3 Deadlines and Scheduling +============================ + +A timestamp may be preceded by special keywords to facilitate planning: + +‘C-c C-d’ + Insert ‘DEADLINE’ keyword along with a time stamp, in the line + following the headline. + + Meaning: the task—most likely a TODO item, though not + necessarily—is supposed to be finished on that date. + + On the deadline date, the task is listed in the agenda. In + addition, the agenda for _today_ carries a warning about the + approaching or missed deadline, starting + ‘org-deadline-warning-days’ before the due date, and continuing + until the entry is marked as done. An example: + + *** TODO write article about the Earth for the Guide + DEADLINE: <2004-02-29 Sun> + The editor in charge is [[bbdb:Ford Prefect]] + +‘C-c C-s’ + Insert ‘SCHEDULED’ keyword along with a stamp, in the line + following the headline. + + Meaning: you are planning to start working on that task on the + given date(1). + + The headline is listed under the given date(2). In addition, a + reminder that the scheduled date has passed is present in the + compilation for _today_, until the entry is marked as done, i.e., + the task is automatically forwarded until completed. + + *** TODO Call Trillian for a date on New Years Eve. + SCHEDULED: <2004-12-25 Sat> + + Some tasks need to be repeated again and again. Org mode helps to +organize such tasks using a so-called repeater in a ‘DEADLINE’, +‘SCHEDULED’, or plain timestamps. In the following example: + + ** TODO Pay the rent + DEADLINE: <2005-10-01 Sat +1m> + +the ‘+1m’ is a repeater; the intended interpretation is that the task +has a deadline on ‘<2005-10-01>’ and repeats itself every (one) month +starting from that time. + + ---------- Footnotes ---------- + + (1) This is quite different from what is normally understood by +_scheduling a meeting_, which is done in Org by just inserting a time +stamp without keyword. + + (2) It will still be listed on that date after it has been marked as +done. If you do not like this, set the variable +‘org-agenda-skip-scheduled-if-done’. + + +File: orgguide.info, Node: Clocking Work Time, Prev: Deadlines and Scheduling, Up: Dates and Times + +8.4 Clocking Work Time +====================== + +Org mode allows you to clock the time you spend on specific tasks in a +project. + +‘C-c C-x C-i’ + Start the clock on the current item (clock-in). This inserts the + ‘CLOCK’ keyword together with a timestamp. When called with a + ‘C-u’ prefix argument, select the task from a list of recently + clocked tasks. + +‘C-c C-x C-o’ + Stop the clock (clock-out). This inserts another timestamp at the + same location where the clock was last started. It also directly + computes the resulting time in inserts it after the time range as + ‘=>HH:MM’. + +‘C-c C-x C-e’ + Update the effort estimate for the current clock task. + +‘C-c C-x C-q’ + Cancel the current clock. This is useful if a clock was started by + mistake, or if you ended up working on something else. + +‘C-c C-x C-j’ + Jump to the headline of the currently clocked in task. With a + ‘C-u’ prefix argument, select the target task from a list of + recently clocked tasks. + + The ‘l’ key may be used in the agenda (see [BROKEN LINK: *The +Weekly/daily Agenda]) to show which tasks have been worked on or closed +during a day. + + +File: orgguide.info, Node: Capture Refile Archive, Next: Agenda Views, Prev: Dates and Times, Up: Top + +9 Capture, Refile, Archive +************************** + +An important part of any organization system is the ability to quickly +capture new ideas and tasks, and to associate reference material with +them. Org does this using a process called _capture_. It also can +store files related to a task (_attachments_) in a special directory. +Once in the system, tasks and projects need to be moved around. Moving +completed project trees to an archive file keeps the system compact and +fast. + +* Menu: + +* Capture:: Capturing new stuff. +* Refile and Copy:: Moving/copying a tree from one place to another. +* Archiving:: What to do with finished products. + + +File: orgguide.info, Node: Capture, Next: Refile and Copy, Up: Capture Refile Archive + +9.1 Capture +=========== + +Capture lets you quickly store notes with little interruption of your +work flow. You can define templates for new entries and associate them +with different targets for storing notes. + +Setting up capture +------------------ + +The following customization sets a default target(1) file for notes. + + (setq org-default-notes-file (concat org-directory "/notes.org")) + + You may also define a global key for capturing new material (see +*note Activation::). + +Using capture +------------- + +‘M-x org-capture’ + Start a capture process, placing you into a narrowed indirect + buffer to edit. + +‘C-c C-c’ + Once you have finished entering information into the capture + buffer, ‘C-c C-c’ returns you to the window configuration before + the capture process, so that you can resume your work without + further distraction. + +‘C-c C-w’ + Finalize the capture process by refiling the note to a different + place (see *note Refile and Copy::). + +‘C-c C-k’ + Abort the capture process and return to the previous state. + +Capture templates +----------------- + +You can use templates for different types of capture items, and for +different target locations. Say you would like to use one template to +create general TODO entries, and you want to put these entries under the +heading ‘Tasks’ in your file ‘~/org/gtd.org’. Also, a date tree in the +file ‘journal.org’ should capture journal entries. A possible +configuration would look like: + + (setq org-capture-templates + '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks") + "* TODO %?\n %i\n %a") + ("j" "Journal" entry (file+datetree "~/org/journal.org") + "* %?\nEntered on %U\n %i\n %a"))) + + If you then press ‘t’ from the capture menu, Org will prepare the +template for you like this: + + * TODO + [[file:LINK TO WHERE YOU INITIATED CAPTURE]] + +During expansion of the template, special %-escapes(2) allow dynamic +insertion of content. Here is a small selection of the possibilities, +consult the manual for more. + +‘%a’ annotation, normally the link created with ‘org-store-link’ +‘%i’ initial content, the region when capture is called with ‘C-u’ +‘%t’, ‘%T’ timestamp, date only, or date and time +‘%u’, ‘%U’ like above, but inactive timestamps +‘%?’ after completing the template, position point here + + ---------- Footnotes ---------- + + (1) Using capture templates, you get finer control over capture +locations. See *note Capture templates::. + + (2) If you need one of these sequences literally, escape the ‘%’ with +a backslash. + + +File: orgguide.info, Node: Refile and Copy, Next: Archiving, Prev: Capture, Up: Capture Refile Archive + +9.2 Refile and Copy +=================== + +When reviewing the captured data, you may want to refile or to copy some +of the entries into a different list, for example into a project. +Cutting, finding the right location, and then pasting the note is +cumbersome. To simplify this process, you can use the following special +command: + +‘C-c C-w’ + Refile the entry or region at point. This command offers possible + locations for refiling the entry and lets you select one with + completion. The item (or all items in the region) is filed below + the target heading as a subitem. + + By default, all level 1 headlines in the current buffer are + considered to be targets, but you can have more complex definitions + across a number of files. See the variable ‘org-refile-targets’ + for details. + +‘C-u C-c C-w’ + Use the refile interface to jump to a heading. + +‘C-u C-u C-c C-w’ + Jump to the location where ‘org-refile’ last moved a tree to. + +‘C-c M-w’ + Copying works like refiling, except that the original note is not + deleted. + + +File: orgguide.info, Node: Archiving, Prev: Refile and Copy, Up: Capture Refile Archive + +9.3 Archiving +============= + +When a project represented by a (sub)tree is finished, you may want to +move the tree out of the way and to stop it from contributing to the +agenda. Archiving is important to keep your working files compact and +global searches like the construction of agenda views fast. + + The most common archiving action is to move a project tree to another +file, the archive file. + +‘C-c C-x C-a’ + Archive the current entry using the command specified in the + variable ‘org-archive-default-command’. + +‘C-c C-x C-s’ or short ‘C-c $’ + Archive the subtree starting at point position to the location + given by ‘org-archive-location’. + + The default archive location is a file in the same directory as the +current file, with the name derived by appending ‘_archive’ to the +current file name. You can also choose what heading to file archived +items under, with the possibility to add them to a datetree in a file. +For information and examples on how to specify the file and the heading, +see the documentation string of the variable ‘org-archive-location’. + + There is also an in-buffer option for setting this variable, for +example: + + #+ARCHIVE: %s_done:: + + +File: orgguide.info, Node: Agenda Views, Next: Markup, Prev: Capture Refile Archive, Up: Top + +10 Agenda Views +*************** + +Due to the way Org works, TODO items, time-stamped items, and tagged +headlines can be scattered throughout a file or even a number of files. +To get an overview of open action items, or of events that are important +for a particular date, this information must be collected, sorted and +displayed in an organized way. + + The extracted information is displayed in a special _agenda buffer_. +This buffer is read-only, but provides commands to visit the +corresponding locations in the original Org files, and even to edit +these files remotely. Remote editing from the agenda buffer means, for +example, that you can change the dates of deadlines and appointments +from the agenda buffer. For commands available in the Agenda buffer, +see *note Agenda Commands::. + +* Menu: + +* Agenda Files:: Files being searched for agenda information. +* Agenda Dispatcher:: Keyboard access to agenda views. +* Built-in Agenda Views:: What is available out of the box? +* Global TODO List:: All unfinished action items. +* Matching Tags and Properties:: Structured information with fine-tuned search. +* Search View:: Find entries by searching for text. +* Agenda Commands:: Remote editing of Org trees. +* Custom Agenda Views:: Defining special searches and views. + + +File: orgguide.info, Node: Agenda Files, Next: Agenda Dispatcher, Up: Agenda Views + +10.1 Agenda Files +================= + +The information to be shown is normally collected from all _agenda +files_, the files listed in the variable ‘org-agenda-files’. + +‘C-c [’ + Add current file to the list of agenda files. The file is added to + the front of the list. If it was already in the list, it is moved + to the front. With a prefix argument, file is added/moved to the + end. + +‘C-c ]’ + Remove current file from the list of agenda files. + +‘C-'’ +‘C-,’ + Cycle through agenda file list, visiting one file after the other. + + +File: orgguide.info, Node: Agenda Dispatcher, Next: Built-in Agenda Views, Prev: Agenda Files, Up: Agenda Views + +10.2 The Agenda Dispatcher +========================== + +The views are created through a dispatcher, accessible with ‘M-x +org-agenda’, or, better, bound to a global key (see *note Activation::). +It displays a menu from which an additional letter is required to +execute a command. The dispatcher offers the following default +commands: + +‘a’ + Create the calendar-like agenda (see [BROKEN LINK: *The + Weekly/daily Agenda]). + +‘t’ +‘T’ + Create a list of all TODO items (see *note Global TODO List::). + +‘m’ +‘M’ + Create a list of headlines matching a given expression (see *note + Matching Tags and Properties::). + +‘s’ + Create a list of entries selected by a boolean expression of + keywords and/or regular expressions that must or must not occur in + the entry. + + +File: orgguide.info, Node: Built-in Agenda Views, Next: Global TODO List, Prev: Agenda Dispatcher, Up: Agenda Views + +10.3 The Weekly/Daily Agenda +============================ + +The purpose of the weekly/daily _agenda_ is to act like a page of a +paper agenda, showing all the tasks for the current week or day. + +‘M-x org-agenda a’ + Compile an agenda for the current week from a list of Org files. + The agenda shows the entries for each day. + + Org mode understands the syntax of the diary and allows you to use +diary expression entries directly in Org files: + + * Holidays + :PROPERTIES: + :CATEGORY: Holiday + :END: + %%(org-calendar-holiday) ; special function for holiday names + + * Birthdays + :PROPERTIES: + :CATEGORY: Ann + :END: + %%(org-anniversary 1956 5 14) Arthur Dent is %d years old + %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old + + Org can interact with Emacs appointments notification facility. To +add the appointments of your agenda files, use the command +‘org-agenda-to-appt’. + + +File: orgguide.info, Node: Global TODO List, Next: Matching Tags and Properties, Prev: Built-in Agenda Views, Up: Agenda Views + +10.4 The Global TODO List +========================= + +The global TODO list contains all unfinished TODO items formatted and +collected into a single place. Remote editing of TODO items lets you +can change the state of a TODO entry with a single key press. For +commands available in the TODO list, see *note Agenda Commands::. + +‘M-x org-agenda t’ + Show the global TODO list. This collects the TODO items from all + agenda files (see *note Agenda Views::) into a single buffer. + +‘M-x org-agenda T’ + Like the above, but allows selection of a specific TODO keyword. + + +File: orgguide.info, Node: Matching Tags and Properties, Next: Search View, Prev: Global TODO List, Up: Agenda Views + +10.5 Matching Tags and Properties +================================= + +If headlines in the agenda files are marked with _tags_ (see *note +Tags::), or have properties (see *note Properties::), you can select +headlines based on this metadata and collect them into an agenda buffer. +The match syntax described here also applies when creating sparse trees +with ‘C-c / m’. + +‘M-x org-agenda m’ + Produce a list of all headlines that match a given set of tags. + The command prompts for a selection criterion, which is a boolean + logic expression with tags, like ‘+work+urgent-withboss’ or + ‘work|home’ (see *note Tags::). If you often need a specific + search, define a custom command for it (see *note Agenda + Dispatcher::). + +‘M-x org-agenda M’ + Like ‘m’, but only select headlines that are also TODO items. + + A search string can use Boolean operators ‘&’ for AND and ‘|’ for OR. +‘&’ binds more strongly than ‘|’. Parentheses are currently not +implemented. Each element in the search is either a tag, a regular +expression matching tags, or an expression like ‘PROPERTY OPERATOR +VALUE’ with a comparison operator, accessing a property value. Each +element may be preceded by ‘-’ to select against it, and ‘+’ is +syntactic sugar for positive selection. The AND operator ‘&’ is +optional when ‘+’ or ‘-’ is present. Here are some examples, using only +tags. + +‘+work-boss’ + Select headlines tagged ‘work’, but discard those also tagged + ‘boss’. + +‘work|laptop’ + Selects lines tagged ‘work’ or ‘laptop’. + +‘work|laptop+night’ + Like before, but require the ‘laptop’ lines to be tagged also + ‘night’. + + You may also test for properties at the same time as matching tags, +see the manual for more information. + + +File: orgguide.info, Node: Search View, Next: Agenda Commands, Prev: Matching Tags and Properties, Up: Agenda Views + +10.6 Search View +================ + +This agenda view is a general text search facility for Org mode entries. +It is particularly useful to find notes. + +‘M-x org-agenda s’ (‘org-search-view’) + This is a special search that lets you select entries by matching a + substring or specific words using a boolean logic. + + For example, the search string ‘computer equipment’ matches entries +that contain ‘computer equipment’ as a substring. + + Search view can also search for specific keywords in the entry, using +Boolean logic. The search string ‘+computer +wifi -ethernet +-{8\.11[bg]}’ matches note entries that contain the keywords ‘computer’ +and ‘wifi’, but not the keyword ‘ethernet’, and which are also not +matched by the regular expression ‘8\.11[bg]’, meaning to exclude both +‘8.11b’ and ‘8.11g’. + + Note that in addition to the agenda files, this command also searches +the files listed in ‘org-agenda-text-search-extra-files’. + + +File: orgguide.info, Node: Agenda Commands, Next: Custom Agenda Views, Prev: Search View, Up: Agenda Views + +10.7 Commands in the Agenda Buffer +================================== + +Entries in the agenda buffer are linked back to the Org file or diary +file where they originate. You are not allowed to edit the agenda +buffer itself, but commands are provided to show and jump to the +original entry location, and to edit the Org files “remotely” from the +agenda buffer. This is just a selection of the many commands, explore +the agenda menu and the manual for a complete list. + +Motion +------ + +‘n’ + Next line (same as ‘<DOWN>’ and ‘C-n’). + +‘p’ + Previous line (same as ‘<UP>’ and ‘C-p’). + +View/Go to Org file +------------------- + +‘<SPC>’ + Display the original location of the item in another window. With + a prefix argument, make sure that drawers stay folded. + +‘<TAB>’ + Go to the original location of the item in another window. + +‘<RET>’ + Go to the original location of the item and delete other windows. + +Change display +-------------- + +‘o’ + Delete other windows. + +‘v d’ or short ‘d’ + Switch to day view. + +‘v w’ or short ‘w’ + Switch to week view. + +‘f’ + Go forward in time to display the span following the current one. + For example, if the display covers a week, switch to the following + week. + +‘b’ + Go backward in time to display earlier dates. + +‘.’ + Go to today. + +‘j’ + Prompt for a date and go there. + +‘v l’ or ‘v L’ or short ‘l’ + Toggle Logbook mode. In Logbook mode, entries that were marked as + done while logging was on (see the variable ‘org-log-done’) are + shown in the agenda, as are entries that have been clocked on that + day. When called with a ‘C-u’ prefix argument, show all possible + logbook entries, including state changes. + +‘r’ +‘g’ + Recreate the agenda buffer, for example to reflect the changes + after modification of the timestamps of items. + +‘s’ + Save all Org buffers in the current Emacs session, and also the + locations of IDs. + +Remote editing +-------------- + +‘0--9’ + Digit argument. + +‘t’ + Change the TODO state of the item, both in the agenda and in the + original Org file. + +‘C-k’ + Delete the current agenda item along with the entire subtree + belonging to it in the original Org file. + +‘C-c C-w’ + Refile the entry at point. + +‘a’ + Archive the subtree corresponding to the entry at point using the + default archiving command set in ‘org-archive-default-command’. + +‘$’ + Archive the subtree corresponding to the current headline. + +‘C-c C-s’ + Schedule this item. With a prefix argument, remove the scheduling + timestamp + +‘C-c C-d’ + Set a deadline for this item. With a prefix argument, remove the + deadline. + +‘S-<RIGHT>’ + Change the timestamp associated with the current line by one day + into the future. + +‘S-<LEFT>’ + Change the timestamp associated with the current line by one day + into the past. + +‘I’ + Start the clock on the current item. + +‘O’ + Stop the previously started clock. + +‘X’ + Cancel the currently running clock. + +‘J’ + Jump to the running clock in another window. + +Quit and exit +------------- + +‘q’ + Quit agenda, remove the agenda buffer. + +‘x’ + Exit agenda, remove the agenda buffer and all buffers loaded by + Emacs for the compilation of the agenda. + + +File: orgguide.info, Node: Custom Agenda Views, Prev: Agenda Commands, Up: Agenda Views + +10.8 Custom Agenda Views +======================== + +The first application of custom searches is the definition of keyboard +shortcuts for frequently used searches, either creating an agenda +buffer, or a sparse tree (the latter covering of course only the current +buffer). + + Custom commands are configured in the variable +‘org-agenda-custom-commands’. You can customize this variable, for +example by pressing ‘C’ from the agenda dispatcher (see *note Agenda +Dispatcher::). You can also directly set it with Emacs Lisp in the +Emacs init file. The following example contains all valid agenda views: + + (setq org-agenda-custom-commands + '(("w" todo "WAITING") + ("u" tags "+boss-urgent") + ("v" tags-todo "+boss-urgent"))) + + The initial string in each entry defines the keys you have to press +after the dispatcher command in order to access the command. Usually +this is just a single character. The second parameter is the search +type, followed by the string or regular expression to be used for the +matching. The example above will therefore define: + +‘w’ + as a global search for TODO entries with ‘WAITING’ as the TODO + keyword. + +‘u’ + as a global tags search for headlines tagged ‘boss’ but not + ‘urgent’. + +‘v’ + The same search, but limiting it to headlines that are also TODO + items. + + +File: orgguide.info, Node: Markup, Next: Exporting, Prev: Agenda Views, Up: Top + +11 Markup for Rich Contents +*************************** + +Org is primarily about organizing and searching through your plain-text +notes. However, it also provides a lightweight yet robust markup +language for rich text formatting and more. Used in conjunction with +the export framework (see *note Exporting::), you can author beautiful +documents in Org. + +* Menu: + +* Paragraphs:: The basic unit of text. +* Emphasis and Monospace:: Bold, italic, etc. +* Embedded LaTeX:: LaTeX can be freely used inside Org documents. +* Literal examples:: Source code examples with special formatting. +* Images:: Display an image. +* Creating Footnotes:: Edit and read footnotes. + + +File: orgguide.info, Node: Paragraphs, Next: Emphasis and Monospace, Up: Markup + +11.1 Paragraphs +=============== + +Paragraphs are separated by at least one empty line. If you need to +enforce a line break within a paragraph, use ‘\\’ at the end of a line. + + To preserve the line breaks, indentation and blank lines in a region, +but otherwise use normal formatting, you can use this construct, which +can also be used to format poetry. + + #+BEGIN_VERSE + Great clouds overhead + Tiny black birds rise and fall + Snow covers Emacs + + ---AlexSchroeder + #+END_VERSE + + When quoting a passage from another document, it is customary to +format this as a paragraph that is indented on both the left and the +right margin. You can include quotations in Org documents like this: + + #+BEGIN_QUOTE + Everything should be made as simple as possible, + but not any simpler ---Albert Einstein + #+END_QUOTE + + If you would like to center some text, do it like this: + + #+BEGIN_CENTER + Everything should be made as simple as possible, \\ + but not any simpler + #+END_CENTER + + +File: orgguide.info, Node: Emphasis and Monospace, Next: Embedded LaTeX, Prev: Paragraphs, Up: Markup + +11.2 Emphasis and Monospace +=========================== + +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. + + +File: orgguide.info, Node: Embedded LaTeX, Next: Literal examples, Prev: Emphasis and Monospace, Up: Markup + +11.3 Embedded LaTeX +=================== + +For scientific notes which need to be able to contain mathematical +symbols and the occasional formula, Org mode supports embedding LaTeX +code into its files. You can directly use TeX-like syntax for special +symbols, enter formulas and entire LaTeX environments. + + The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand, + the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}. + + \begin{equation} % arbitrary environments, + x=\sqrt{b} % even tables, figures + \end{equation} % etc + + If $a^2=b$ and \( b=2 \), then the solution must be + either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \]. + + +File: orgguide.info, Node: Literal examples, Next: Images, Prev: Embedded LaTeX, Up: Markup + +11.4 Literal examples +===================== + +You can include literal examples that should not be subjected to markup. +Such examples are typeset in monospace, so this is well suited for +source code and similar examples. + + #+BEGIN_EXAMPLE + Some example from a text file. + #+END_EXAMPLE + + For simplicity when using small examples, you can also start the +example lines with a colon followed by a space. There may also be +additional whitespace before the colon: + + Here is an example + : Some example from a text file. + + 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. + + #+BEGIN_SRC emacs-lisp + (defun org-xor (a b) + "Exclusive or." + (if a (not b) b)) + #+END_SRC + + To edit the example in a special buffer supporting this language, use +‘C-c '’ to both enter and leave the editing buffer. + + +File: orgguide.info, Node: Images, Next: Creating Footnotes, Prev: Literal examples, Up: Markup + +11.5 Images +=========== + +An image is a link to an image file that does not have a description +part, for example + + ./img/cat.jpg + + If you wish to define a caption for the image and maybe a label for +internal cross references (see *note Hyperlinks::), make sure that the +link is on a line by itself and precede it with ‘CAPTION’ and ‘NAME’ +keywords as follows: + + #+CAPTION: This is the caption for the next figure link (or table) + #+NAME: fig:SED-HR4049 + [[./img/a.jpg]] + + +File: orgguide.info, Node: Creating Footnotes, Prev: Images, Up: Markup + +11.6 Creating Footnotes +======================= + +A footnote is defined in a paragraph that is started by a footnote +marker in square brackets in column 0, no indentation allowed. The +footnote reference is simply the marker in square brackets, inside text. +For example: + + The Org homepage[fn:1] now looks a lot better than it used to. + ... + [fn:1] The link is: https://orgmode.org + + The following commands handle footnotes: + +‘C-c C-x f’ + The footnote action command. When point is on a footnote + reference, jump to the definition. When it is at a definition, + jump to the (first) reference. Otherwise, create a new footnote. + When this command is called with a prefix argument, a menu of + additional options including renumbering is offered. + +‘C-c C-c’ + Jump between definition and reference. + + +File: orgguide.info, Node: Exporting, Next: Publishing, Prev: Markup, Up: Top + +12 Exporting +************ + +Org can convert and export documents to a variety of other formats while +retaining as much structure (see *note Document Structure::) and markup +(see *note Markup::) as possible. + +* Menu: + +* The Export Dispatcher:: The main interface. +* Export Settings:: Common export settings. +* Table of Contents:: The if and where of the table of contents. +* Include Files:: Include additional files into a document. +* Comment Lines:: What will not be exported. +* ASCII/UTF-8 Export:: Exporting to flat files with encoding. +* HTML Export:: Exporting to HTML. +* LaTeX Export:: Exporting to LaTeX and processing to PDF. +* iCalendar Export:: Exporting to iCalendar. + + +File: orgguide.info, Node: The Export Dispatcher, Next: Export Settings, Up: Exporting + +12.1 The Export Dispatcher +========================== + +The export dispatcher is the main interface for Org’s exports. A +hierarchical menu presents the currently configured export formats. +Options are shown as easy toggle switches on the same screen. + +‘C-c C-e’ + Invokes the export dispatcher interface. + + Org exports the entire buffer by default. If the Org buffer has an +active region, then Org exports just that region. + + +File: orgguide.info, Node: Export Settings, Next: Table of Contents, Prev: The Export Dispatcher, Up: Exporting + +12.2 Export Settings +==================== + +The exporter recognizes special lines in the buffer which provide +additional information. These lines may be put anywhere in the file: + + #+TITLE: I'm in the Mood for Org + + Most proeminent export options include: + +‘TITLE’ the title to be shown +‘AUTHOR’ the author (default taken from ‘user-full-name’) +‘DATE’ a date, fixed, or an Org timestamp +‘EMAIL’ email address (default from ‘user-mail-address’) +‘LANGUAGE’ language code, e.g., ‘en’ + + Option keyword sets can be inserted from the export dispatcher (see +*note The Export Dispatcher::) using the ‘Insert template’ command by +pressing ‘#’. + + +File: orgguide.info, Node: Table of Contents, Next: Include Files, Prev: Export Settings, Up: Exporting + +12.3 Table of Contents +====================== + +The table of contents includes all headlines in the document. Its depth +is therefore the same as the headline levels in the file. If you need +to use a different depth, or turn it off entirely, set the +‘org-export-with-toc’ variable accordingly. You can achieve the same on +a per file basis, using the following ‘toc’ item in ‘OPTIONS’ keyword: + + #+OPTIONS: toc:2 (only include two levels in TOC) + #+OPTIONS: toc:nil (no default TOC at all) + + Org normally inserts the table of contents directly before the first +headline of the file. + + +File: orgguide.info, Node: Include Files, Next: Comment Lines, Prev: Table of Contents, Up: Exporting + +12.4 Include Files +================== + +During export, you can include the content of another file. For +example, to include your ‘.emacs’ file, you could use: + + #+INCLUDE: "~/.emacs" src emacs-lisp + +The first parameter is the file name to include. The optional second +parameter specifies the block type: ‘example’, ‘export’ or ‘src’. The +optional third parameter specifies the source code language to use for +formatting the contents. This is relevant to both ‘export’ and ‘src’ +block types. + + You can visit the included file with ‘C-c '’. + + +File: orgguide.info, Node: Comment Lines, Next: ASCII/UTF-8 Export, Prev: Include Files, Up: Exporting + +12.5 Comment Lines +================== + +Lines starting with zero or more whitespace characters followed by one +‘#’ and a whitespace are treated as comments and, as such, are not +exported. + + Likewise, regions surrounded by ‘#+BEGIN_COMMENT’ ... ‘#+END_COMMENT’ +are not exported. + + Finally, a ‘COMMENT’ keyword at the beginning of an entry, but after +any other keyword or priority cookie, comments out the entire subtree. +The command below helps changing the comment status of a headline. + +‘C-c ;’ + Toggle the ‘COMMENT’ keyword at the beginning of an entry. + + +File: orgguide.info, Node: ASCII/UTF-8 Export, Next: HTML Export, Prev: Comment Lines, Up: Exporting + +12.6 ASCII/UTF-8 Export +======================= + +ASCII export produces an output file containing only plain ASCII +characters. This is the simplest and most direct text output. It does +not contain any Org markup. UTF-8 export uses additional characters and +symbols available in this encoding standards. + +‘C-c C-e t a’ +‘C-c C-e t u’ + Export as an ASCII file with a ‘.txt’ extension. For ‘myfile.org’, + Org exports to ‘myfile.txt’, overwriting without warning. For + ‘myfile.txt’, Org exports to ‘myfile.txt.txt’ in order to prevent + data loss. + + +File: orgguide.info, Node: HTML Export, Next: LaTeX Export, Prev: ASCII/UTF-8 Export, Up: Exporting + +12.7 HTML Export +================ + +Org mode contains an HTML exporter with extensive HTML formatting +compatible with XHTML 1.0 strict standard. + +‘C-c C-e h h’ + Export as HTML file with a ‘.html’ extension. For ‘myfile.org’, + Org exports to ‘myfile.html’, overwriting without warning. ‘C-c + C-e h o’ exports to HTML and opens it in a web browser. + + The HTML export back-end transforms ‘<’ and ‘>’ to ‘<’ and ‘>’. +To include raw HTML code in the Org file so the HTML export back-end can +insert that HTML code in the output, use this inline syntax: +‘@@html:...@@’. For example: + + @@html:<b>@@bold text@@html:</b>@@ + + For larger raw HTML code blocks, use these HTML export code blocks: + + #+HTML: Literal HTML code for export + + #+BEGIN_EXPORT html + All lines between these markers are exported literally + #+END_EXPORT + + +File: orgguide.info, Node: LaTeX Export, Next: iCalendar Export, Prev: HTML Export, Up: Exporting + +12.8 LaTeX Export +================= + +The LaTeX export back-end can handle complex documents, incorporate +standard or custom LaTeX document classes, generate documents using +alternate LaTeX engines, and produce fully linked PDF files with +indexes, bibliographies, and tables of contents, destined for +interactive online viewing or high-quality print publication. + + By default, the LaTeX output uses the _article_ class. You can +change this by adding an option like ‘#+LATEX_CLASS: myclass’ in your +file. The class must be listed in ‘org-latex-classes’. + +‘C-c C-e l l’ + Export to a LaTeX file with a ‘.tex’ extension. For ‘myfile.org’, + Org exports to ‘myfile.tex’, overwriting without warning. + +‘C-c C-e l p’ + Export as LaTeX file and convert it to PDF file. + +‘C-c C-e l o’ + Export as LaTeX file and convert it to PDF, then open the PDF using + the default viewer. + + The LaTeX export back-end can insert any arbitrary LaTeX code, see +*note Embedded LaTeX::. There are three ways to embed such code in the +Org file and they all use different quoting syntax. + + Inserting in-line quoted with @ symbols: + + Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph. + + Inserting as one or more keyword lines in the Org file: + + #+LATEX: any arbitrary LaTeX code + + Inserting as an export block in the Org file, where the back-end +exports any code between begin and end markers: + + #+BEGIN_EXPORT latex + any arbitrary LaTeX code + #+END_EXPORT + + +File: orgguide.info, Node: iCalendar Export, Prev: LaTeX Export, Up: Exporting + +12.9 iCalendar Export +===================== + +A large part of Org mode’s interoperability success is its ability to +easily export to or import from external applications. The iCalendar +export back-end takes calendar data from Org files and exports to the +standard iCalendar format. + +‘C-c C-e c f’ + Create iCalendar entries from the current Org buffer and store them + in the same directory, using a file extension ‘.ics’. + +‘C-c C-e c c’ + Create a combined iCalendar file from Org files in + ‘org-agenda-files’ and write it to + ‘org-icalendar-combined-agenda-file’ file name. + + +File: orgguide.info, Node: Publishing, Next: Working with Source Code, Prev: Exporting, Up: Top + +13 Publishing +************* + +Org includes a publishing management system that allows you to configure +automatic HTML conversion of _projects_ composed of interlinked Org +files. You can also configure Org to automatically upload your exported +HTML pages and related attachments, such as images and source code +files, to a web server. + + You can also use Org to convert files into PDF, or even combine HTML +and PDF conversion so that files are available in both formats on the +server. + + For detailed instructions about setup, see the manual. Here is an +example: + + (setq org-publish-project-alist + '(("org" + :base-directory "~/org/" + :publishing-function org-html-publish-to-html + :publishing-directory "~/public_html" + :section-numbers nil + :with-toc nil + :html-head "<link rel=\"stylesheet\" + href=\"../other/mystyle.css\" + type=\"text/css\"/>"))) + +‘C-c C-e P x’ + Prompt for a specific project and publish all files that belong to + it. + +‘C-c C-e P p’ + Publish the project containing the current file. + +‘C-c C-e P f’ + Publish only the current file. + +‘C-c C-e P a’ + Publish every project. + + Org uses timestamps to track when a file has changed. The above +functions normally only publish changed files. You can override this +and force publishing of all files by giving a prefix argument to any of +the commands above. + + +File: orgguide.info, Node: Working with Source Code, Next: Miscellaneous, Prev: Publishing, Up: Top + +14 Working with Source Code +*************************** + +Org mode provides a number of features for working with source code, +including editing of code blocks in their native major mode, evaluation +of code blocks, tangling of code blocks, and exporting code blocks and +their results in several formats. + + A source code block conforms to this structure: + + #+NAME: <name> + #+BEGIN_SRC <language> <switches> <header arguments> + <body> + #+END_SRC + +where: + + • ‘<name>’ is a string used to uniquely name the code block, + + • ‘<language>’ specifies the language of the code block, e.g., + ‘emacs-lisp’, ‘shell’, ‘R’, ‘python’, etc., + + • ‘<switches>’ can be used to control export of the code block, + + • ‘<header arguments>’ can be used to control many aspects of code + block behavior as demonstrated below, + + • ‘<body>’ contains the actual source code. + + Use ‘C-c '’ to edit the current code block. It opens a new major +mode edit buffer containing the body of the source code block, ready for +any edits. Use ‘C-c '’ again to close the buffer and return to the Org +buffer. + +Using header arguments +====================== + +A header argument is specified with an initial colon followed by the +argument’s name in lowercase. + + Header arguments can be set in several ways; Org prioritizes them in +case of overlaps or conflicts by giving local settings a higher +priority. + +System-wide header arguments + Those are specified by customizing ‘org-babel-default-header-args’ + variable, or, for a specific language LANG + ‘org-babel-default-header-args:LANG’. + +Header arguments in properties + You can set them using ‘header-args’ property (see *note + Properties::)—or ‘header-args:LANG’ for language LANG. Header + arguments set through properties drawers apply at the sub-tree + level on down. + +Header arguments in code blocks + Header arguments are most commonly set at the source code block + level, on the ‘BEGIN_SRC’ line: + + #+NAME: factorial + #+BEGIN_SRC haskell :results silent :exports code :var n=0 + fac 0 = 1 + fac n = n * fac (n-1) + #+END_SRC + + Code block header arguments can span multiple lines using ‘HEADER’ + keyword on each line. + +Evaluating code blocks +====================== + +Use ‘C-c C-c’ to evaluate the current code block and insert its results +in the Org document. By default, evaluation is only turned on for +‘emacs-lisp’ code blocks, however support exists for evaluating blocks +in many languages. For a complete list of supported languages see the +manual. The following shows a code block and its results. + + #+BEGIN_SRC emacs-lisp + (+ 1 2 3 4) + #+END_SRC + + #+RESULTS: + : 10 + + The following syntax is used to pass arguments to code blocks using +the ‘var’ header argument. + + :var NAME=ASSIGN + +NAME is the name of the variable bound in the code block body. ASSIGN +is a literal value, such as a string, a number, a reference to a table, +a list, a literal example, another code block—with or without +arguments—or the results of evaluating a code block. + +Results of evaluation +===================== + +How Org handles results of a code block execution depends on many header +arguments working together. The primary determinant, however, is the +‘results’ header argument. It controls the _collection_, _type_, +_format_, and _handling_ of code block results. + +Collection + How the results should be collected from the code block. You may + choose either ‘output’ or ‘value’ (the default). + +Type + What result types to expect from the execution of the code block. + You may choose among ‘table’, ‘list’, ‘scalar’, and ‘file’. Org + tries to guess it if you do not provide it. + +Format + How Org processes results. Some possible values are ‘code’, + ‘drawer’, ‘html’, ‘latex’, ‘link’, and ‘raw’. + +Handling + How to insert the results once properly formatted. Allowed values + are ‘silent’, ‘replace’ (the default), ‘append’, or ‘prepend’. + + Code blocks which output results to files—e.g.: graphs, diagrams and +figures—can accept a ‘:file FILENAME’ header argument, in which case the +results are saved to the named file, and a link to the file is inserted +into the buffer. + +Exporting code blocks +===================== + +It is possible to export the _code_ of code blocks, the _results_ of +code block evaluation, _both_ the code and the results of code block +evaluation, or _none_. Org defaults to exporting _code_ for most +languages. + + The ‘exports’ header argument is to specify if that part of the Org +file is exported to, say, HTML or LaTeX formats. It can be set to +either ‘code’, ‘results’, ‘both’ or ‘none’. + +Extracting source code +====================== + +Use ‘C-c C-v t’ to create pure source code files by extracting code from +source blocks in the current buffer. This is referred to as +“tangling”—a term adopted from the literate programming community. +During tangling of code blocks their bodies are expanded using +‘org-babel-expand-src-block’, which can expand both variable and “Noweb” +style references. In order to tangle a code block it must have a +‘tangle’ header argument, see the manual for details. + + +File: orgguide.info, Node: Miscellaneous, Prev: Working with Source Code, Up: Top + +15 Miscellaneous +**************** + +Completion +========== + +Org has in-buffer completions with ‘M-<TAB>’. No minibuffer is +involved. Type one or more letters and invoke the hot key to complete +the text in-place. + + For example, this command will complete TeX symbols after ‘\’, TODO +keywords at the beginning of a headline, and tags after ‘:’ in a +headline. + +Structure Templates +=================== + +To quickly insert empty structural blocks, such as ‘#+BEGIN_SRC’ ... +‘#+END_SRC’, or to wrap existing text in such a block, use + +‘C-c C-,’ + Prompt for a type of block structure, and insert the block at + point. If the region is active, it is wrapped in the block. + +Clean view +========== + +Org’s default outline with stars and no indents can become too cluttered +for short documents. For _book-like_ long documents, the effect is not +as noticeable. Org provides an alternate stars and indentation scheme, +as shown on the right in the following table. It uses only one star and +indents text to line with the heading: + + * Top level headline | * Top level headline + ** Second level | * Second level + *** Third level | * Third level + some text | some text + *** Third level | * Third level + more text | more text + * Another top level headline | * Another top level headline + + This kind of view can be achieved dynamically at display time using +Org Indent mode (‘M-x org-indent-mode <RET>’), which prepends intangible +space to each line. You can turn on Org Indent mode for all files by +customizing the variable ‘org-startup-indented’, or you can turn it on +for individual files using + + #+STARTUP: indent + + If you want the indentation to be hard space characters so that the +plain text file looks as similar as possible to the Emacs display, Org +supports you by helping to indent (with ‘<TAB>’) text below each +headline, by hiding leading stars, and by only using levels 1, 3, etc to +get two characters indentation for each level. To get this support in a +file, use + + #+STARTUP: hidestars odd + + + +Tag Table: +Node: Top922 +Node: Introduction5668 +Ref: Installation6354 +Ref: Activation7066 +Ref: Feedback7509 +Node: Document Structure7743 +Node: Headlines8814 +Ref: Headlines-Footnote-19696 +Node: Visibility Cycling9819 +Node: Motion11094 +Node: Structure Editing11516 +Ref: Structure Editing-Footnote-112710 +Node: Sparse Trees12814 +Ref: Sparse Trees-Footnote-113882 +Node: Plain Lists13997 +Node: Tables16503 +Ref: Creation and conversion18194 +Ref: Re-aligning and field motion18746 +Ref: Column and row editing19262 +Node: Hyperlinks20267 +Ref: Internal links21025 +Ref: External Links21478 +Ref: Handling Links23308 +Node: TODO Items24697 +Node: TODO Basics25674 +Node: Multi-state Workflow27069 +Node: Progress Logging28865 +Ref: Closing items29612 +Ref: Tracking TODO state changes30167 +Ref: Progress Logging-Footnote-131166 +Ref: Progress Logging-Footnote-231239 +Node: Priorities31317 +Node: Breaking Down Tasks32213 +Node: Checkboxes33016 +Node: Tags34076 +Ref: Tag inheritance34701 +Ref: Setting tags35439 +Ref: Tag groups37159 +Ref: Tag searches37955 +Ref: Tags-Footnote-139047 +Node: Properties39151 +Node: Dates and Times40910 +Node: Timestamps41512 +Node: Creating Timestamps43569 +Node: Deadlines and Scheduling45230 +Ref: Deadlines and Scheduling-Footnote-147254 +Ref: Deadlines and Scheduling-Footnote-247415 +Node: Clocking Work Time47578 +Node: Capture Refile Archive48891 +Node: Capture49699 +Ref: Setting up capture50001 +Ref: Using capture50272 +Ref: Capture templates50867 +Ref: Capture-Footnote-152283 +Ref: Capture-Footnote-252394 +Node: Refile and Copy52485 +Node: Archiving53683 +Node: Agenda Views54995 +Node: Agenda Files56450 +Node: Agenda Dispatcher57110 +Node: Built-in Agenda Views58040 +Node: Global TODO List59129 +Node: Matching Tags and Properties59846 +Node: Search View61815 +Node: Agenda Commands62925 +Ref: Motion (1)63511 +Ref: View/Go to Org file63652 +Ref: Change display63999 +Ref: Remote editing65087 +Ref: Quit and exit66278 +Node: Custom Agenda Views66484 +Node: Markup67960 +Node: Paragraphs68786 +Node: Emphasis and Monospace69908 +Node: Embedded LaTeX70326 +Node: Literal examples71195 +Node: Images72285 +Node: Creating Footnotes72886 +Node: Exporting73807 +Node: The Export Dispatcher74683 +Node: Export Settings75213 +Node: Table of Contents76038 +Node: Include Files76771 +Node: Comment Lines77457 +Node: ASCII/UTF-8 Export78155 +Node: HTML Export78854 +Node: LaTeX Export79862 +Node: iCalendar Export81501 +Node: Publishing82202 +Node: Working with Source Code83804 +Ref: Using header arguments85071 +Ref: Evaluating code blocks86249 +Ref: Results of evaluation87124 +Ref: Exporting code blocks88346 +Ref: Extracting source code88810 +Node: Miscellaneous89337 +Ref: Completion89460 +Ref: Structure Templates89797 +Ref: Clean view90123 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/elpa/org-9.5.2/ox-ascii.el b/elpa/org-9.5.2/ox-ascii.el new file mode 100644 index 0000000..78e6fb4 --- /dev/null +++ b/elpa/org-9.5.2/ox-ascii.el @@ -0,0 +1,2205 @@ +;;; ox-ascii.el --- ASCII Back-End for Org Export Engine -*- lexical-binding: t; -*- + +;; Copyright (C) 2012-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou <n.goaziou at gmail dot com> +;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com> +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: +;; +;; This library implements an ASCII back-end for Org generic exporter. +;; See Org manual for more information. + +;;; Code: + +(require 'ox) +(require 'ox-publish) +(require 'cl-lib) + +;;; Function Declarations + +(declare-function aa2u "ext:ascii-art-to-unicode" ()) + +;;; Define Back-End +;; +;; The following setting won't allow modifying preferred charset +;; through a buffer keyword or an option item, but, since the property +;; will appear in communication channel nonetheless, it allows +;; overriding `org-ascii-charset' variable on the fly by the ext-plist +;; mechanism. +;; +;; We also install a filter for headlines and sections, in order to +;; control blank lines separating them in output string. + +(org-export-define-backend 'ascii + '((bold . org-ascii-bold) + (center-block . org-ascii-center-block) + (clock . org-ascii-clock) + (code . org-ascii-code) + (drawer . org-ascii-drawer) + (dynamic-block . org-ascii-dynamic-block) + (entity . org-ascii-entity) + (example-block . org-ascii-example-block) + (export-block . org-ascii-export-block) + (export-snippet . org-ascii-export-snippet) + (fixed-width . org-ascii-fixed-width) + (footnote-reference . org-ascii-footnote-reference) + (headline . org-ascii-headline) + (horizontal-rule . org-ascii-horizontal-rule) + (inline-src-block . org-ascii-inline-src-block) + (inlinetask . org-ascii-inlinetask) + (inner-template . org-ascii-inner-template) + (italic . org-ascii-italic) + (item . org-ascii-item) + (keyword . org-ascii-keyword) + (latex-environment . org-ascii-latex-environment) + (latex-fragment . org-ascii-latex-fragment) + (line-break . org-ascii-line-break) + (link . org-ascii-link) + (node-property . org-ascii-node-property) + (paragraph . org-ascii-paragraph) + (plain-list . org-ascii-plain-list) + (plain-text . org-ascii-plain-text) + (planning . org-ascii-planning) + (property-drawer . org-ascii-property-drawer) + (quote-block . org-ascii-quote-block) + (radio-target . org-ascii-radio-target) + (section . org-ascii-section) + (special-block . org-ascii-special-block) + (src-block . org-ascii-src-block) + (statistics-cookie . org-ascii-statistics-cookie) + (strike-through . org-ascii-strike-through) + (subscript . org-ascii-subscript) + (superscript . org-ascii-superscript) + (table . org-ascii-table) + (table-cell . org-ascii-table-cell) + (table-row . org-ascii-table-row) + (target . org-ascii-target) + (template . org-ascii-template) + (timestamp . org-ascii-timestamp) + (underline . org-ascii-underline) + (verbatim . org-ascii-verbatim) + (verse-block . org-ascii-verse-block)) + :menu-entry + '(?t "Export to Plain Text" + ((?A "As ASCII buffer" + (lambda (a s v b) + (org-ascii-export-as-ascii a s v b '(:ascii-charset ascii)))) + (?a "As ASCII file" + (lambda (a s v b) + (org-ascii-export-to-ascii a s v b '(:ascii-charset ascii)))) + (?L "As Latin1 buffer" + (lambda (a s v b) + (org-ascii-export-as-ascii a s v b '(:ascii-charset latin1)))) + (?l "As Latin1 file" + (lambda (a s v b) + (org-ascii-export-to-ascii a s v b '(:ascii-charset latin1)))) + (?U "As UTF-8 buffer" + (lambda (a s v b) + (org-ascii-export-as-ascii a s v b '(:ascii-charset utf-8)))) + (?u "As UTF-8 file" + (lambda (a s v b) + (org-ascii-export-to-ascii a s v b '(:ascii-charset utf-8)))))) + :filters-alist '((:filter-headline . org-ascii-filter-headline-blank-lines) + (:filter-parse-tree org-ascii-filter-paragraph-spacing + org-ascii-filter-comment-spacing) + (:filter-section . org-ascii-filter-headline-blank-lines)) + :options-alist + '((:subtitle "SUBTITLE" nil nil parse) + (:ascii-bullets nil nil org-ascii-bullets) + (:ascii-caption-above nil nil org-ascii-caption-above) + (:ascii-charset nil nil org-ascii-charset) + (:ascii-global-margin nil nil org-ascii-global-margin) + (:ascii-format-drawer-function nil nil org-ascii-format-drawer-function) + (:ascii-format-inlinetask-function + nil nil org-ascii-format-inlinetask-function) + (:ascii-headline-spacing nil nil org-ascii-headline-spacing) + (:ascii-indented-line-width nil nil org-ascii-indented-line-width) + (:ascii-inlinetask-width nil nil org-ascii-inlinetask-width) + (:ascii-inner-margin nil nil org-ascii-inner-margin) + (:ascii-links-to-notes nil nil org-ascii-links-to-notes) + (:ascii-list-margin nil nil org-ascii-list-margin) + (:ascii-paragraph-spacing nil nil org-ascii-paragraph-spacing) + (:ascii-quote-margin nil nil org-ascii-quote-margin) + (:ascii-table-keep-all-vertical-lines + nil nil org-ascii-table-keep-all-vertical-lines) + (:ascii-table-use-ascii-art nil nil org-ascii-table-use-ascii-art) + (:ascii-table-widen-columns nil nil org-ascii-table-widen-columns) + (:ascii-text-width nil nil org-ascii-text-width) + (:ascii-underline nil nil org-ascii-underline) + (:ascii-verbatim-format nil nil org-ascii-verbatim-format))) + + + +;;; User Configurable Variables + +(defgroup org-export-ascii nil + "Options for exporting Org mode files to ASCII." + :tag "Org Export ASCII" + :group 'org-export) + +(defcustom org-ascii-text-width 72 + "Maximum width of exported text. +This number includes margin size, as set in +`org-ascii-global-margin'." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'integer) + +(defcustom org-ascii-global-margin 0 + "Width of the left margin, in number of characters." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'integer) + +(defcustom org-ascii-inner-margin 2 + "Width of the inner margin, in number of characters. +Inner margin is applied between each headline." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'integer) + +(defcustom org-ascii-quote-margin 6 + "Width of margin used for quoting text, in characters. +This margin is applied on both sides of the text. It is also +applied on the left side of contents in descriptive lists." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'integer) + +(defcustom org-ascii-list-margin 0 + "Width of margin used for plain lists, in characters. +This margin applies to top level list only, not to its +sub-lists." + :group 'org-export-ascii + :version "26.1" + :package-version '(Org . "8.3") + :type 'integer) + +(defcustom org-ascii-inlinetask-width 30 + "Width of inline tasks, in number of characters. +This number ignores any margin." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'integer) + +(defcustom org-ascii-headline-spacing '(1 . 2) + "Number of blank lines inserted around headlines. + +This variable can be set to a cons cell. In that case, its car +represents the number of blank lines present before headline +contents whereas its cdr reflects the number of blank lines after +contents. + +A nil value replicates the number of blank lines found in the +original Org buffer at the same place." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Replicate original spacing" nil) + (cons :tag "Set a uniform spacing" + (integer :tag "Number of blank lines before contents") + (integer :tag "Number of blank lines after contents")))) + +(defcustom org-ascii-indented-line-width 'auto + "Additional indentation width for the first line in a paragraph. +If the value is an integer, indent the first line of each +paragraph by this width, unless it is located at the beginning of +a section, in which case indentation is removed from that line. +If it is the symbol `auto' preserve indentation from original +document." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (integer :tag "Number of white spaces characters") + (const :tag "Preserve original width" auto))) + +(defcustom org-ascii-paragraph-spacing 'auto + "Number of white lines between paragraphs. +If the value is an integer, add this number of blank lines +between contiguous paragraphs. If is it the symbol `auto', keep +the same number of blank lines as in the original document." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (integer :tag "Number of blank lines") + (const :tag "Preserve original spacing" auto))) + +(defcustom org-ascii-charset 'ascii + "The charset allowed to represent various elements and objects. +Possible values are: +`ascii' Only use plain ASCII characters +`latin1' Include Latin-1 characters +`utf-8' Use all UTF-8 characters" + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "ASCII" ascii) + (const :tag "Latin-1" latin1) + (const :tag "UTF-8" utf-8))) + +(defcustom org-ascii-underline '((ascii ?= ?~ ?-) + (latin1 ?= ?~ ?-) + (utf-8 ?═ ?─ ?╌ ?┄ ?┈)) + "Characters for underlining headings in ASCII export. + +Alist whose key is a symbol among `ascii', `latin1' and `utf-8' +and whose value is a list of characters. + +For each supported charset, this variable associates a sequence +of underline characters. In a sequence, the characters will be +used in order for headlines level 1, 2, ... If no character is +available for a given level, the headline won't be underlined." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type '(list + (cons :tag "Underline characters sequence" + (const :tag "ASCII charset" ascii) + (repeat character)) + (cons :tag "Underline characters sequence" + (const :tag "Latin-1 charset" latin1) + (repeat character)) + (cons :tag "Underline characters sequence" + (const :tag "UTF-8 charset" utf-8) + (repeat character)))) + +(defcustom org-ascii-bullets '((ascii ?* ?+ ?-) + (latin1 ?§ ?¶) + (utf-8 ?◊)) + "Bullet characters for headlines converted to lists in ASCII export. + +Alist whose key is a symbol among `ascii', `latin1' and `utf-8' +and whose value is a list of characters. + +The first character is used for the first level considered as low +level, and so on. If there are more levels than characters given +here, the list will be repeated. + +Note that this variable doesn't affect plain lists +representation." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type '(list + (cons :tag "Bullet characters for low level headlines" + (const :tag "ASCII charset" ascii) + (repeat character)) + (cons :tag "Bullet characters for low level headlines" + (const :tag "Latin-1 charset" latin1) + (repeat character)) + (cons :tag "Bullet characters for low level headlines" + (const :tag "UTF-8 charset" utf-8) + (repeat character)))) + +(defcustom org-ascii-links-to-notes t + "Non-nil means convert links to notes before the next headline. +When nil, the link will be exported in place. If the line +becomes long in this way, it will be wrapped." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-ascii-table-keep-all-vertical-lines nil + "Non-nil means keep all vertical lines in ASCII tables. +When nil, vertical lines will be removed except for those needed +for column grouping." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-ascii-table-widen-columns t + "Non-nil means widen narrowed columns for export. +When nil, narrowed columns will look in ASCII export just like in +Org mode, i.e. with \"=>\" as ellipsis." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-ascii-table-use-ascii-art nil + "Non-nil means \"table.el\" tables are turned into ASCII art. +It only makes sense when export charset is `utf-8'. It is nil by +default since it requires \"ascii-art-to-unicode.el\" package, +available through, e.g., GNU ELPA." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-ascii-caption-above nil + "When non-nil, place caption string before the element. +Otherwise, place it right after it." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-ascii-verbatim-format "`%s'" + "Format string used for verbatim text and inline code." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-ascii-format-drawer-function + (lambda (_name contents _width) contents) + "Function called to format a drawer in ASCII. + +The function must accept three parameters: + NAME the drawer name, like \"LOGBOOK\" + CONTENTS the contents of the drawer. + WIDTH the text width within the drawer. + +The function should return either the string to be exported or +nil to ignore the drawer. + +The default value simply returns the value of CONTENTS." + :group 'org-export-ascii + :version "24.4" + :package-version '(Org . "8.0") + :type 'function) + +(defcustom org-ascii-format-inlinetask-function + 'org-ascii-format-inlinetask-default + "Function called to format an inlinetask in ASCII. + +The function must accept nine parameters: + TODO the todo keyword, as a string + TODO-TYPE the todo type, a symbol among `todo', `done' and nil. + PRIORITY the inlinetask priority, as a string + NAME the inlinetask name, as a string. + TAGS the inlinetask tags, as a list of strings. + CONTENTS the contents of the inlinetask, as a string. + WIDTH the width of the inlinetask, as a number. + INLINETASK the inlinetask itself. + INFO the info channel. + +The function should return either the string to be exported or +nil to ignore the inline task." + :group 'org-export-ascii + :version "26.1" + :package-version '(Org . "8.3") + :type 'function) + + + +;;; Internal Functions + +;; Internal functions fall into three categories. + +;; The first one is about text formatting. The core functions are +;; `org-ascii--current-text-width' and +;; `org-ascii--current-justification', which determine, respectively, +;; the current text width allowed to a given element and its expected +;; justification. Once this information is known, +;; `org-ascii--fill-string', `org-ascii--justify-lines', +;; `org-ascii--justify-element' `org-ascii--box-string' and +;; `org-ascii--indent-string' can operate on a given output string. +;; In particular, justification happens at the regular (i.e., +;; non-greater) element level, which means that when the exporting +;; process reaches a container (e.g., a center block) content are +;; already justified. + +;; The second category contains functions handling elements listings, +;; triggered by "#+TOC:" keyword. As such, `org-ascii--build-toc' +;; returns a complete table of contents, `org-ascii--list-listings' +;; returns a list of referenceable src-block elements, and +;; `org-ascii--list-tables' does the same for table elements. + +;; The third category includes general helper functions. +;; `org-ascii--build-title' creates the title for a given headline +;; or inlinetask element. `org-ascii--build-caption' returns the +;; caption string associated to a table or a src-block. +;; `org-ascii--describe-links' creates notes about links for +;; insertion at the end of a section. It uses +;; `org-ascii--unique-links' to get the list of links to describe. +;; Eventually, `org-ascii--translate' translates a string according +;; to language and charset specification. + + +(defun org-ascii--fill-string (s text-width info &optional justify) + "Fill a string with specified text-width and return it. + +S is the string being filled. TEXT-WIDTH is an integer +specifying maximum length of a line. INFO is the plist used as +a communication channel. + +Optional argument JUSTIFY can specify any type of justification +among `left', `center', `right' or `full'. A nil value is +equivalent to `left'. For a justification that doesn't also fill +string, see `org-ascii--justify-lines' and +`org-ascii--justify-block'. + +Return nil if S isn't a string." + (when (stringp s) + (let ((double-space-p sentence-end-double-space)) + (with-temp-buffer + (let ((fill-column text-width) + (use-hard-newlines t) + (sentence-end-double-space double-space-p)) + (insert (if (plist-get info :preserve-breaks) + (replace-regexp-in-string "\n" hard-newline s) + s)) + (fill-region (point-min) (point-max) justify)) + (buffer-string))))) + +(defun org-ascii--justify-lines (s text-width how) + "Justify all lines in string S. +TEXT-WIDTH is an integer specifying maximum length of a line. +HOW determines the type of justification: it can be `left', +`right', `full' or `center'." + (with-temp-buffer + (insert s) + (goto-char (point-min)) + (let ((fill-column text-width) + ;; Ensure that `indent-tabs-mode' is nil so that indentation + ;; will always be achieved using spaces rather than tabs. + (indent-tabs-mode nil) + ;; Disable `adaptive-fill-mode' so it doesn't prevent + ;; filling lines matching `adaptive-fill-regexp'. + (adaptive-fill-mode nil)) + (while (< (point) (point-max)) + (justify-current-line how) + (forward-line))) + (buffer-string))) + +(defun org-ascii--justify-element (contents element info) + "Justify CONTENTS of ELEMENT. +INFO is a plist used as a communication channel. Justification +is done according to the type of element. More accurately, +paragraphs are filled and other elements are justified as blocks, +that is according to the widest non blank line in CONTENTS." + (if (not (org-string-nw-p contents)) contents + (let ((text-width (org-ascii--current-text-width element info)) + (how (org-ascii--current-justification element))) + (cond + ((eq (org-element-type element) 'paragraph) + ;; Paragraphs are treated specially as they need to be filled. + (org-ascii--fill-string contents text-width info how)) + ((eq how 'left) contents) + (t (with-temp-buffer + (insert contents) + (goto-char (point-min)) + (catch 'exit + (let ((max-width 0)) + ;; Compute maximum width. Bail out if it is greater + ;; than page width, since no justification is + ;; possible. + (save-excursion + (while (not (eobp)) + (unless (looking-at-p "[ \t]*$") + (end-of-line) + (let ((column (current-column))) + (cond + ((>= column text-width) (throw 'exit contents)) + ((> column max-width) (setq max-width column))))) + (forward-line))) + ;; Justify every line according to TEXT-WIDTH and + ;; MAX-WIDTH. + (let ((offset (/ (- text-width max-width) + (if (eq how 'right) 1 2)))) + (if (zerop offset) (throw 'exit contents) + (while (not (eobp)) + (unless (looking-at-p "[ \t]*$") + (indent-to-column offset)) + (forward-line))))) + (buffer-string)))))))) + +(defun org-ascii--indent-string (s width) + "Indent string S by WIDTH white spaces. +Empty lines are not indented." + (when (stringp s) + (replace-regexp-in-string + "\\(^\\)[ \t]*\\S-" (make-string width ?\s) s nil nil 1))) + +(defun org-ascii--box-string (s info) + "Return string S with a partial box to its left. +INFO is a plist used as a communication channel." + (let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))) + (format (if utf8p "┌────\n%s\n└────" ",----\n%s\n`----") + (replace-regexp-in-string + "^" (if utf8p "│ " "| ") + ;; Remove last newline character. + (replace-regexp-in-string "\n[ \t]*\\'" "" s))))) + +(defun org-ascii--current-text-width (element info) + "Return maximum text width for ELEMENT's contents. +INFO is a plist used as a communication channel." + (pcase (org-element-type element) + ;; Elements with an absolute width: `headline' and `inlinetask'. + (`inlinetask (plist-get info :ascii-inlinetask-width)) + (`headline + (- (plist-get info :ascii-text-width) + (let ((low-level-rank (org-export-low-level-p element info))) + (if low-level-rank (* low-level-rank 2) + (plist-get info :ascii-global-margin))))) + ;; Elements with a relative width: store maximum text width in + ;; TOTAL-WIDTH. + (_ + (let* ((genealogy (org-element-lineage element nil t)) + ;; Total width is determined by the presence, or not, of an + ;; inline task among ELEMENT parents. + (total-width + (if (cl-some (lambda (parent) + (eq (org-element-type parent) 'inlinetask)) + genealogy) + (plist-get info :ascii-inlinetask-width) + ;; No inlinetask: Remove global margin from text width. + (- (plist-get info :ascii-text-width) + (plist-get info :ascii-global-margin) + (let ((parent (org-export-get-parent-headline element))) + ;; Inner margin doesn't apply to text before first + ;; headline. + (if (not parent) 0 + (let ((low-level-rank + (org-export-low-level-p parent info))) + ;; Inner margin doesn't apply to contents of + ;; low level headlines, since they've got their + ;; own indentation mechanism. + (if low-level-rank (* low-level-rank 2) + (plist-get info :ascii-inner-margin))))))))) + (- total-width + ;; Each `quote-block' and `verse-block' above narrows text + ;; width by twice the standard margin size. + (+ (* (cl-count-if (lambda (parent) + (memq (org-element-type parent) + '(quote-block verse-block))) + genealogy) + 2 + (plist-get info :ascii-quote-margin)) + ;; Apply list margin once per "top-level" plain-list + ;; containing current line + (* (cl-count-if + (lambda (e) + (and (eq (org-element-type e) 'plain-list) + (not (eq (org-element-type (org-export-get-parent e)) + 'item)))) + genealogy) + (plist-get info :ascii-list-margin)) + ;; Compute indentation offset due to current list. It is + ;; `org-ascii-quote-margin' per descriptive item in the + ;; genealogy, bullet's length otherwise. + (let ((indentation 0)) + (dolist (e genealogy) + (cond + ((not (eq 'item (org-element-type e)))) + ((eq (org-element-property :type (org-export-get-parent e)) + 'descriptive) + (cl-incf indentation org-ascii-quote-margin)) + (t + (cl-incf indentation + (+ (string-width + (or (org-ascii--checkbox e info) "")) + (string-width + (org-element-property :bullet e))))))) + indentation))))))) + +(defun org-ascii--current-justification (element) + "Return expected justification for ELEMENT's contents. +Return value is a symbol among `left', `center', `right' and +`full'." + (let (justification) + (while (and (not justification) + (setq element (org-element-property :parent element))) + (pcase (org-element-type element) + (`center-block (setq justification 'center)) + (`special-block + (let ((name (org-element-property :type element))) + (cond ((string= name "JUSTIFYRIGHT") (setq justification 'right)) + ((string= name "JUSTIFYLEFT") (setq justification 'left))))))) + (or justification 'left))) + +(defun org-ascii--build-title + (element info text-width &optional underline notags toc) + "Format ELEMENT title and return it. + +ELEMENT is either an `headline' or `inlinetask' element. INFO is +a plist used as a communication channel. TEXT-WIDTH is an +integer representing the maximum length of a line. + +When optional argument UNDERLINE is non-nil, underline title, +without the tags, according to `org-ascii-underline' +specifications. + +If optional argument NOTAGS is non-nil, no tags will be added to +the title. + +When optional argument TOC is non-nil, use optional title if +possible. It doesn't apply to `inlinetask' elements." + (let* ((headlinep (eq (org-element-type element) 'headline)) + (numbers + ;; Numbering is specific to headlines. + (and headlinep + (org-export-numbered-headline-p element info) + (let ((numbering (org-export-get-headline-number element info))) + (if toc (format "%d. " (org-last numbering)) + (concat (mapconcat #'number-to-string numbering ".") + " "))))) + (text + (org-trim + (org-export-data + (if (and toc headlinep) (org-export-get-alt-title element info) + (org-element-property :title element)) + info))) + (todo + (and (plist-get info :with-todo-keywords) + (let ((todo (org-element-property :todo-keyword element))) + (and todo (concat (org-export-data todo info) " "))))) + (tags (and (not notags) + (plist-get info :with-tags) + (let ((tag-list (org-export-get-tags element info))) + (and tag-list + (org-make-tag-string tag-list))))) + (priority + (and (plist-get info :with-priority) + (let ((char (org-element-property :priority element))) + (and char (format "(#%c) " char))))) + (first-part (concat numbers todo priority text))) + (concat + first-part + ;; Align tags, if any. + (when tags + (format + (format " %%%ds" + (max (- text-width (1+ (string-width first-part))) + (string-width tags))) + tags)) + ;; Maybe underline text, if ELEMENT type is `headline' and an + ;; underline character has been defined. + (when (and underline headlinep) + (let ((under-char + (nth (1- (org-export-get-relative-level element info)) + (cdr (assq (plist-get info :ascii-charset) + (plist-get info :ascii-underline)))))) + (and under-char + (concat "\n" + (make-string (/ (string-width first-part) + (char-width under-char)) + under-char)))))))) + +(defun org-ascii--has-caption-p (element _info) + "Non-nil when ELEMENT has a caption affiliated keyword. +INFO is a plist used as a communication channel. This function +is meant to be used as a predicate for `org-export-get-ordinal'." + (org-element-property :caption element)) + +(defun org-ascii--build-caption (element info) + "Return caption string for ELEMENT, if applicable. + +INFO is a plist used as a communication channel. + +The caption string contains the sequence number of ELEMENT along +with its real caption. Return nil when ELEMENT has no affiliated +caption keyword." + (let ((caption (org-export-get-caption element))) + (when caption + ;; Get sequence number of current src-block among every + ;; src-block with a caption. + (let ((reference + (org-export-get-ordinal + element info nil 'org-ascii--has-caption-p)) + (title-fmt (org-ascii--translate + (pcase (org-element-type element) + (`table "Table %d:") + (`src-block "Listing %d:")) + info))) + (org-ascii--fill-string + (concat (format title-fmt reference) + " " + (org-export-data caption info)) + (org-ascii--current-text-width element info) info))))) + +(defun org-ascii--build-toc (info &optional n keyword scope) + "Return a table of contents. + +INFO is a plist used as a communication channel. + +Optional argument N, when non-nil, is an integer specifying the +depth of the table. + +Optional argument KEYWORD specifies the TOC keyword, if any, from +which the table of contents generation has been initiated. + +When optional argument SCOPE is non-nil, build a table of +contents according to the specified scope." + (concat + (unless scope + (let ((title (org-ascii--translate "Table of Contents" info))) + (concat title "\n" + (make-string + (string-width title) + (if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_)) + "\n\n"))) + (let ((text-width + (if keyword (org-ascii--current-text-width keyword info) + (- (plist-get info :ascii-text-width) + (plist-get info :ascii-global-margin))))) + (mapconcat + (lambda (headline) + (let* ((level (org-export-get-relative-level headline info)) + (indent (* (1- level) 3))) + (concat + (unless (zerop indent) (concat (make-string (1- indent) ?.) " ")) + (org-ascii--build-title + headline info (- text-width indent) nil + (or (not (plist-get info :with-tags)) + (eq (plist-get info :with-tags) 'not-in-toc)) + 'toc)))) + (org-export-collect-headlines info n scope) "\n")))) + +(defun org-ascii--list-listings (keyword info) + "Return a list of listings. + +KEYWORD is the keyword that initiated the list of listings +generation. INFO is a plist used as a communication channel." + (let ((title (org-ascii--translate "List of Listings" info))) + (concat + title "\n" + (make-string (string-width title) + (if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_)) + "\n\n" + (let ((text-width + (if keyword (org-ascii--current-text-width keyword info) + (- (plist-get info :ascii-text-width) + (plist-get info :ascii-global-margin)))) + ;; Use a counter instead of retrieving ordinal of each + ;; src-block. + (count 0)) + (mapconcat + (lambda (src-block) + ;; Store initial text so its length can be computed. This is + ;; used to properly align caption right to it in case of + ;; filling (like contents of a description list item). + (let* ((initial-text + (format (org-ascii--translate "Listing %d:" info) + (cl-incf count))) + (initial-width (string-width initial-text))) + (concat + initial-text " " + (org-trim + (org-ascii--indent-string + (org-ascii--fill-string + ;; Use short name in priority, if available. + (let ((caption (or (org-export-get-caption src-block t) + (org-export-get-caption src-block)))) + (org-export-data caption info)) + (- text-width initial-width) info) + initial-width))))) + (org-export-collect-listings info) "\n"))))) + +(defun org-ascii--list-tables (keyword info) + "Return a list of tables. + +KEYWORD is the keyword that initiated the list of tables +generation. INFO is a plist used as a communication channel." + (let ((title (org-ascii--translate "List of Tables" info))) + (concat + title "\n" + (make-string (string-width title) + (if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_)) + "\n\n" + (let ((text-width + (if keyword (org-ascii--current-text-width keyword info) + (- (plist-get info :ascii-text-width) + (plist-get info :ascii-global-margin)))) + ;; Use a counter instead of retrieving ordinal of each + ;; src-block. + (count 0)) + (mapconcat + (lambda (table) + ;; Store initial text so its length can be computed. This is + ;; used to properly align caption right to it in case of + ;; filling (like contents of a description list item). + (let* ((initial-text + (format (org-ascii--translate "Table %d:" info) + (cl-incf count))) + (initial-width (string-width initial-text))) + (concat + initial-text " " + (org-trim + (org-ascii--indent-string + (org-ascii--fill-string + ;; Use short name in priority, if available. + (let ((caption (or (org-export-get-caption table t) + (org-export-get-caption table)))) + (org-export-data caption info)) + (- text-width initial-width) info) + initial-width))))) + (org-export-collect-tables info) "\n"))))) + +(defun org-ascii--unique-links (element info) + "Return a list of unique link references in ELEMENT. +ELEMENT is either a headline element or a section element. INFO +is a plist used as a communication channel." + (let* (seen + (unique-link-p + ;; Return LINK if it wasn't referenced so far, or nil. + ;; Update SEEN links along the way. + (lambda (link) + (let ((footprint + ;; Normalize description in footprints. + (cons (org-element-property :raw-link link) + (let ((contents (org-element-contents link))) + (and contents + (replace-regexp-in-string + "[ \r\t\n]+" " " + (org-trim + (org-element-interpret-data contents)))))))) + ;; Ignore LINK if it hasn't been translated already. It + ;; can happen if it is located in an affiliated keyword + ;; that was ignored. + (when (and (org-string-nw-p + (gethash link (plist-get info :exported-data))) + (not (member footprint seen))) + (push footprint seen) link))))) + (org-element-map (if (eq (org-element-type element) 'section) + element + ;; In a headline, only retrieve links in title + ;; and relative section, not in children. + (list (org-element-property :title element) + (car (org-element-contents element)))) + 'link unique-link-p info nil 'headline t))) + +(defun org-ascii--describe-datum (datum info) + "Describe DATUM object or element. +If DATUM is a string, consider it to be a file name, per +`org-export-resolve-id-link'. INFO is the communication channel, +as a plist." + (pcase (org-element-type datum) + (`plain-text (format "See file %s" datum)) ;External file + (`headline + (format (org-ascii--translate "See section %s" info) + (if (org-export-numbered-headline-p datum info) + (mapconcat #'number-to-string + (org-export-get-headline-number datum info) + ".") + (org-export-data (org-element-property :title datum) info)))) + (_ + (let ((number (org-export-get-ordinal + datum info nil #'org-ascii--has-caption-p)) + ;; If destination is a target, make sure we can name the + ;; container it refers to. + (enumerable + (org-element-lineage datum + '(headline paragraph src-block table) t))) + (pcase (org-element-type enumerable) + (`headline + (format (org-ascii--translate "See section %s" info) + (if (org-export-numbered-headline-p enumerable info) + (mapconcat #'number-to-string number ".") + (org-export-data + (org-element-property :title enumerable) info)))) + ((guard (not number)) + (org-ascii--translate "Unknown reference" info)) + (`paragraph + (format (org-ascii--translate "See figure %s" info) number)) + (`src-block + (format (org-ascii--translate "See listing %s" info) number)) + (`table + (format (org-ascii--translate "See table %s" info) number)) + (_ (org-ascii--translate "Unknown reference" info))))))) + +(defun org-ascii--describe-links (links width info) + "Return a string describing a list of links. +LINKS is a list of link type objects, as returned by +`org-ascii--unique-links'. WIDTH is the text width allowed for +the output string. INFO is a plist used as a communication +channel." + (mapconcat + (lambda (link) + (let* ((type (org-element-property :type link)) + (description (org-element-contents link)) + (anchor (org-export-data + (or description (org-element-property :raw-link link)) + info))) + (cond + ((member type '("coderef" "radio")) nil) + ((member type '("custom-id" "fuzzy" "id")) + ;; 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) + (org-export-resolve-id-link link info)))) + (concat + (org-ascii--fill-string + (format "[%s] %s" anchor (org-ascii--describe-datum dest info)) + width info) + "\n\n")))) + ;; Do not add a link that cannot be resolved and doesn't have + ;; any description: destination is already visible in the + ;; paragraph. + ((not (org-element-contents link)) nil) + ;; Do not add a link already handled by custom export + ;; functions. + ((org-export-custom-protocol-maybe link anchor 'ascii info) nil) + (t + (concat + (org-ascii--fill-string + (format "[%s] <%s>" anchor (org-element-property :raw-link link)) + width info) + "\n\n"))))) + links "")) + +(defun org-ascii--checkbox (item info) + "Return checkbox string for ITEM or nil. +INFO is a plist used as a communication channel." + (let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))) + (pcase (org-element-property :checkbox item) + (`on (if utf8p "☑ " "[X] ")) + (`off (if utf8p "☐ " "[ ] ")) + (`trans (if utf8p "☒ " "[-] "))))) + + + +;;; Template + +(defun org-ascii-template--document-title (info) + "Return document title, as a string. +INFO is a plist used as a communication channel." + (let* ((text-width (plist-get info :ascii-text-width)) + ;; Links in the title will not be resolved later, so we make + ;; sure their path is located right after them. + (info (org-combine-plists info '(:ascii-links-to-notes nil))) + (with-title (plist-get info :with-title)) + (title (org-export-data + (when with-title (plist-get info :title)) info)) + (subtitle (org-export-data + (when with-title (plist-get info :subtitle)) info)) + (author (and (plist-get info :with-author) + (let ((auth (plist-get info :author))) + (and auth (org-export-data auth info))))) + (email (and (plist-get info :with-email) + (org-export-data (plist-get info :email) info))) + (date (and (plist-get info :with-date) + (org-export-data (org-export-get-date info) info)))) + ;; There are two types of title blocks depending on the presence + ;; of a title to display. + (if (string= title "") + ;; Title block without a title. DATE is positioned at the top + ;; right of the document, AUTHOR to the top left and EMAIL + ;; just below. + (cond + ((and (org-string-nw-p date) (org-string-nw-p author)) + (concat + author + (make-string (- text-width (string-width date) (string-width author)) + ?\s) + date + (when (org-string-nw-p email) (concat "\n" email)) + "\n\n\n")) + ((and (org-string-nw-p date) (org-string-nw-p email)) + (concat + email + (make-string (- text-width (string-width date) (string-width email)) + ?\s) + date "\n\n\n")) + ((org-string-nw-p date) + (concat + (org-ascii--justify-lines date text-width 'right) + "\n\n\n")) + ((and (org-string-nw-p author) (org-string-nw-p email)) + (concat author "\n" email "\n\n\n")) + ((org-string-nw-p author) (concat author "\n\n\n")) + ((org-string-nw-p email) (concat email "\n\n\n"))) + ;; Title block with a title. Document's TITLE, along with the + ;; AUTHOR and its EMAIL are both overlined and an underlined, + ;; centered. Date is just below, also centered. + (let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)) + ;; Format TITLE. It may be filled if it is too wide, + ;; that is wider than the two thirds of the total width. + (title-len (min (apply #'max + (mapcar #'string-width + (org-split-string + (concat title "\n" subtitle) "\n"))) + (/ (* 2 text-width) 3))) + (formatted-title (org-ascii--fill-string title title-len info)) + (formatted-subtitle (when (org-string-nw-p subtitle) + (org-ascii--fill-string subtitle title-len info))) + (line + (make-string + (min (+ (max title-len + (string-width (or author "")) + (string-width (or email ""))) + 2) + text-width) (if utf8p ?━ ?_)))) + (org-ascii--justify-lines + (concat line "\n" + (unless utf8p "\n") + (upcase formatted-title) + (and formatted-subtitle (concat "\n" formatted-subtitle)) + (cond + ((and (org-string-nw-p author) (org-string-nw-p email)) + (concat "\n\n" author "\n" email)) + ((org-string-nw-p author) (concat "\n\n" author)) + ((org-string-nw-p email) (concat "\n\n" email))) + "\n" line + (when (org-string-nw-p date) (concat "\n\n\n" date)) + "\n\n\n") text-width 'center))))) + +(defun org-ascii-inner-template (contents info) + "Return complete document string after ASCII conversion. +CONTENTS is the transcoded contents string. INFO is a plist +holding export options." + (org-element-normalize-string + (let ((global-margin (plist-get info :ascii-global-margin))) + (org-ascii--indent-string + (concat + ;; 1. Document's body. + contents + ;; 2. Footnote definitions. + (let ((definitions (org-export-collect-footnote-definitions info)) + ;; Insert full links right inside the footnote definition + ;; as they have no chance to be inserted later. + (info (org-combine-plists info '(:ascii-links-to-notes nil)))) + (when definitions + (concat + "\n\n\n" + (let ((title (org-ascii--translate "Footnotes" info))) + (concat + title "\n" + (make-string + (string-width title) + (if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_)))) + "\n\n" + (let ((text-width (- (plist-get info :ascii-text-width) + global-margin))) + (mapconcat + (lambda (ref) + (let ((id (format "[%s] " (car ref)))) + ;; Distinguish between inline definitions and + ;; full-fledged definitions. + (org-trim + (let ((def (nth 2 ref))) + (if (org-element-map def org-element-all-elements + #'identity info 'first-match) + ;; Full-fledged definition: footnote ID is + ;; inserted inside the first parsed + ;; paragraph (FIRST), if any, to be sure + ;; filling will take it into consideration. + (let ((first (car (org-element-contents def)))) + (if (not (eq (org-element-type first) 'paragraph)) + (concat id "\n" (org-export-data def info)) + (push id (nthcdr 2 first)) + (org-export-data def info))) + ;; Fill paragraph once footnote ID is inserted + ;; in order to have a correct length for first + ;; line. + (org-ascii--fill-string + (concat id (org-export-data def info)) + text-width info)))))) + definitions "\n\n")))))) + global-margin)))) + +(defun org-ascii-template (contents info) + "Return complete document string after ASCII conversion. +CONTENTS is the transcoded contents string. INFO is a plist +holding export options." + (let ((global-margin (plist-get info :ascii-global-margin))) + (concat + ;; Build title block. + (org-ascii--indent-string + (concat (org-ascii-template--document-title info) + ;; 2. Table of contents. + (let ((depth (plist-get info :with-toc))) + (when depth + (concat + (org-ascii--build-toc info (and (wholenump depth) depth)) + "\n\n\n")))) + global-margin) + ;; Document's body. + contents + ;; Creator. Justify it to the bottom right. + (and (plist-get info :with-creator) + (org-ascii--indent-string + (let ((text-width + (- (plist-get info :ascii-text-width) global-margin))) + (concat + "\n\n\n" + (org-ascii--fill-string + (plist-get info :creator) text-width info 'right))) + global-margin))))) + +(defun org-ascii--translate (s info) + "Translate string S according to specified language and charset. +INFO is a plist used as a communication channel." + (let ((charset (intern (format ":%s" (plist-get info :ascii-charset))))) + (org-export-translate s charset info))) + + + +;;; Transcode Functions + +;;;; Bold + +(defun org-ascii-bold (_bold contents _info) + "Transcode BOLD from Org to ASCII. +CONTENTS is the text with bold markup. INFO is a plist holding +contextual information." + (format "*%s*" contents)) + + +;;;; Center Block + +(defun org-ascii-center-block (_center-block contents _info) + "Transcode a CENTER-BLOCK element from Org to ASCII. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + ;; Center has already been taken care of at a lower level, so + ;; there's nothing left to do. + contents) + + +;;;; Clock + +(defun org-ascii-clock (clock _contents info) + "Transcode a CLOCK object from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual +information." + (org-ascii--justify-element + (concat org-clock-string " " + (org-timestamp-translate (org-element-property :value clock)) + (let ((time (org-element-property :duration clock))) + (and time + (concat " => " + (apply 'format + "%2s:%02s" + (org-split-string time ":")))))) + clock info)) + + +;;;; Code + +(defun org-ascii-code (code _contents info) + "Return a CODE object from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual +information." + (format (plist-get info :ascii-verbatim-format) + (org-element-property :value code))) + + +;;;; Drawer + +(defun org-ascii-drawer (drawer contents info) + "Transcode a DRAWER element from Org to ASCII. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + (let ((name (org-element-property :drawer-name drawer)) + (width (org-ascii--current-text-width drawer info))) + (funcall (plist-get info :ascii-format-drawer-function) + name contents width))) + + +;;;; Dynamic Block + +(defun org-ascii-dynamic-block (_dynamic-block contents _info) + "Transcode a DYNAMIC-BLOCK element from Org to ASCII. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + contents) + + +;;;; Entity + +(defun org-ascii-entity (entity _contents info) + "Transcode an ENTITY object from Org to ASCII. +CONTENTS are the definition itself. INFO is a plist holding +contextual information." + (org-element-property + (intern (concat ":" (symbol-name (plist-get info :ascii-charset)))) + entity)) + + +;;;; Example Block + +(defun org-ascii-example-block (example-block _contents info) + "Transcode a EXAMPLE-BLOCK element from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual information." + (org-ascii--justify-element + (org-ascii--box-string + (org-export-format-code-default example-block info) info) + example-block info)) + + +;;;; Export Snippet + +(defun org-ascii-export-snippet (export-snippet _contents _info) + "Transcode a EXPORT-SNIPPET object from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual information." + (when (eq (org-export-snippet-backend export-snippet) 'ascii) + (org-element-property :value export-snippet))) + + +;;;; Export Block + +(defun org-ascii-export-block (export-block _contents info) + "Transcode a EXPORT-BLOCK element from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual information." + (when (string= (org-element-property :type export-block) "ASCII") + (org-ascii--justify-element + (org-element-property :value export-block) export-block info))) + + +;;;; Fixed Width + +(defun org-ascii-fixed-width (fixed-width _contents info) + "Transcode a FIXED-WIDTH element from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual information." + (org-ascii--justify-element + (org-ascii--box-string + (org-remove-indentation + (org-element-property :value fixed-width)) + info) + fixed-width info)) + + +;;;; Footnote Definition + +;; Footnote Definitions are ignored. They are compiled at the end of +;; the document, by `org-ascii-inner-template'. + + +;;;; Footnote Reference + +(defun org-ascii-footnote-reference (footnote-reference _contents info) + "Transcode a FOOTNOTE-REFERENCE element from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual information." + (format "[%s]" (org-export-get-footnote-number footnote-reference info))) + + +;;;; Headline + +(defun org-ascii-headline (headline contents info) + "Transcode a HEADLINE element from Org to ASCII. +CONTENTS holds the contents of the headline. INFO is a plist +holding contextual information." + ;; Don't export footnote section, which will be handled at the end + ;; of the template. + (unless (org-element-property :footnote-section-p headline) + (let* ((low-level (org-export-low-level-p headline info)) + (width (org-ascii--current-text-width headline info)) + ;; Export title early so that any link in it can be + ;; exported and seen in `org-ascii--unique-links'. + (title (org-ascii--build-title headline info width (not low-level))) + ;; Blank lines between headline and its contents. + ;; `org-ascii-headline-spacing', when set, overwrites + ;; original buffer's spacing. + (pre-blanks + (make-string (or (car (plist-get info :ascii-headline-spacing)) + (org-element-property :pre-blank headline) + 0) + ?\n)) + (links (and (plist-get info :ascii-links-to-notes) + (org-ascii--describe-links + (org-ascii--unique-links headline info) width info))) + ;; Re-build contents, inserting section links at the right + ;; place. The cost is low since build results are cached. + (body + (if (not (org-string-nw-p links)) contents + (let* ((contents (org-element-contents headline)) + (section (let ((first (car contents))) + (and (eq (org-element-type first) 'section) + first)))) + (concat (and section + (concat (org-element-normalize-string + (org-export-data section info)) + "\n\n")) + links + (mapconcat (lambda (e) (org-export-data e info)) + (if section (cdr contents) contents) + "")))))) + ;; Deep subtree: export it as a list item. + (if low-level + (let* ((bullets (cdr (assq (plist-get info :ascii-charset) + (plist-get info :ascii-bullets)))) + (bullet + (format "%c " + (nth (mod (1- low-level) (length bullets)) bullets)))) + (concat bullet title "\n" pre-blanks + ;; Contents, indented by length of bullet. + (org-ascii--indent-string body (length bullet)))) + ;; Else: Standard headline. + (concat title "\n" pre-blanks body))))) + + +;;;; Horizontal Rule + +(defun org-ascii-horizontal-rule (horizontal-rule _contents info) + "Transcode an HORIZONTAL-RULE object from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual +information." + (let ((text-width (org-ascii--current-text-width horizontal-rule info)) + (spec-width + (org-export-read-attribute :attr_ascii horizontal-rule :width))) + (org-ascii--justify-lines + (make-string (if (and spec-width (string-match "^[0-9]+$" spec-width)) + (string-to-number spec-width) + text-width) + (if (eq (plist-get info :ascii-charset) 'utf-8) ?― ?-)) + text-width 'center))) + + +;;;; Inline Src Block + +(defun org-ascii-inline-src-block (inline-src-block _contents info) + "Transcode an INLINE-SRC-BLOCK element from Org to ASCII. +CONTENTS holds the contents of the item. INFO is a plist holding +contextual information." + (format (plist-get info :ascii-verbatim-format) + (org-element-property :value inline-src-block))) + + +;;;; Inlinetask + +(defun org-ascii-format-inlinetask-default + (_todo _type _priority _name _tags contents width inlinetask info) + "Format an inline task element for ASCII export. +See `org-ascii-format-inlinetask-function' for a description +of the parameters." + (let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)) + (width (or width (plist-get info :ascii-inlinetask-width)))) + (org-ascii--indent-string + (concat + ;; Top line, with an additional blank line if not in UTF-8. + (make-string width (if utf8p ?━ ?_)) "\n" + (unless utf8p (concat (make-string width ? ) "\n")) + ;; Add title. Fill it if wider than inlinetask. + (let ((title (org-ascii--build-title inlinetask info width))) + (if (<= (string-width title) width) title + (org-ascii--fill-string title width info))) + "\n" + ;; If CONTENTS is not empty, insert it along with + ;; a separator. + (when (org-string-nw-p contents) + (concat (make-string width (if utf8p ?─ ?-)) "\n" contents)) + ;; Bottom line. + (make-string width (if utf8p ?━ ?_))) + ;; Flush the inlinetask to the right. + (- (plist-get info :ascii-text-width) (plist-get info :ascii-global-margin) + (if (not (org-export-get-parent-headline inlinetask)) 0 + (plist-get info :ascii-inner-margin)) + (org-ascii--current-text-width inlinetask info))))) + +(defun org-ascii-inlinetask (inlinetask contents info) + "Transcode an INLINETASK element from Org to ASCII. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + (let ((width (org-ascii--current-text-width inlinetask info))) + (funcall (plist-get info :ascii-format-inlinetask-function) + ;; todo. + (and (plist-get info :with-todo-keywords) + (let ((todo (org-element-property + :todo-keyword inlinetask))) + (and todo (org-export-data todo info)))) + ;; todo-type + (org-element-property :todo-type inlinetask) + ;; priority + (and (plist-get info :with-priority) + (org-element-property :priority inlinetask)) + ;; title + (org-export-data (org-element-property :title inlinetask) info) + ;; tags + (and (plist-get info :with-tags) + (org-element-property :tags inlinetask)) + ;; contents and width + contents width inlinetask info))) + + +;;;; Italic + +(defun org-ascii-italic (_italic contents _info) + "Transcode italic from Org to ASCII. +CONTENTS is the text with italic markup. INFO is a plist holding +contextual information." + (format "/%s/" contents)) + + +;;;; Item + +(defun org-ascii-item (item contents info) + "Transcode an ITEM element from Org to ASCII. +CONTENTS holds the contents of the item. INFO is a plist holding +contextual information." + (let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)) + (checkbox (org-ascii--checkbox item info)) + (list-type (org-element-property :type (org-export-get-parent item))) + (bullet + ;; First parent of ITEM is always the plain-list. Get + ;; `:type' property from it. + (pcase list-type + (`descriptive + (concat checkbox + (org-export-data (org-element-property :tag item) + info))) + (`ordered + ;; Return correct number for ITEM, paying attention to + ;; counters. + (let* ((struct (org-element-property :structure item)) + (bul (org-list-bullet-string + (org-element-property :bullet item))) + (num (number-to-string + (car (last (org-list-get-item-number + (org-element-property :begin item) + struct + (org-list-prevs-alist struct) + (org-list-parents-alist struct))))))) + (replace-regexp-in-string "[0-9]+" num bul))) + (_ (let ((bul (org-list-bullet-string + (org-element-property :bullet item)))) + ;; Change bullets into more visible form if UTF-8 is active. + (if (not utf8p) bul + (replace-regexp-in-string + "-" "•" + (replace-regexp-in-string + "\\+" "⁃" + (replace-regexp-in-string "\\*" "‣" bul)))))))) + (indentation (if (eq list-type 'descriptive) org-ascii-quote-margin + (string-width bullet)))) + (concat + bullet + checkbox + ;; Contents: Pay attention to indentation. Note: check-boxes are + ;; already taken care of at the paragraph level so they don't + ;; interfere with indentation. + (let ((contents (org-ascii--indent-string contents indentation))) + ;; Determine if contents should follow the bullet or start + ;; a new line. Do the former when the first contributing + ;; element to contents is a paragraph. In descriptive lists + ;; however, contents always start a new line. + (if (and (not (eq list-type 'descriptive)) + (org-string-nw-p contents) + (eq 'paragraph + (org-element-type + (cl-some (lambda (e) + (and (org-string-nw-p (org-export-data e info)) + e)) + (org-element-contents item))))) + (org-trim contents) + (concat "\n" contents)))))) + + +;;;; Keyword + +(defun org-ascii-keyword (keyword _contents info) + "Transcode a KEYWORD element from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual +information." + (let ((key (org-element-property :key keyword)) + (value (org-element-property :value keyword))) + (cond + ((string= key "ASCII") (org-ascii--justify-element value keyword info)) + ((string= key "TOC") + (org-ascii--justify-element + (let ((case-fold-search t)) + (cond + ((string-match-p "\\<headlines\\>" value) + (let ((depth (and (string-match "\\<[0-9]+\\>" value) + (string-to-number (match-string 0 value)))) + (scope + (cond + ((string-match ":target +\\(\".+?\"\\|\\S-+\\)" value) ;link + (org-export-resolve-link + (org-strip-quotes (match-string 1 value)) info)) + ((string-match-p "\\<local\\>" value) keyword)))) ;local + (org-ascii--build-toc info depth keyword scope))) + ((string-match-p "\\<tables\\>" value) + (org-ascii--list-tables keyword info)) + ((string-match-p "\\<listings\\>" value) + (org-ascii--list-listings keyword info)))) + keyword info))))) + + +;;;; Latex Environment + +(defun org-ascii-latex-environment (latex-environment _contents info) + "Transcode a LATEX-ENVIRONMENT element from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual +information." + (when (plist-get info :with-latex) + (org-ascii--justify-element + (org-remove-indentation (org-element-property :value latex-environment)) + latex-environment info))) + + +;;;; Latex Fragment + +(defun org-ascii-latex-fragment (latex-fragment _contents info) + "Transcode a LATEX-FRAGMENT object from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual +information." + (when (plist-get info :with-latex) + (org-element-property :value latex-fragment))) + + +;;;; Line Break + +(defun org-ascii-line-break (_line-break _contents _info) + "Transcode a LINE-BREAK object from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual + information." hard-newline) + + +;;;; Link + +(defun org-ascii-link (link desc info) + "Transcode a LINK object from Org to ASCII. + +DESC is the description part of the link, or the empty string. +INFO is a plist holding contextual information." + (let ((type (org-element-property :type link))) + (cond + ((org-export-custom-protocol-maybe link desc 'ascii info)) + ((string= type "coderef") + (let ((ref (org-element-property :path link))) + (format (org-export-get-coderef-format ref desc) + (org-export-resolve-coderef ref info)))) + ;; Do not apply a special syntax on radio links. Though, use + ;; transcoded target's contents as output. + ((string= type "radio") desc) + ((member type '("custom-id" "fuzzy" "id")) + (let ((destination (if (string= type "fuzzy") + (org-export-resolve-fuzzy-link link info) + (org-export-resolve-id-link link info)))) + (pcase (org-element-type destination) + ((guard desc) + (if (plist-get info :ascii-links-to-notes) + (format "[%s]" desc) + (concat desc + (format " (%s)" + (org-ascii--describe-datum destination info))))) + ;; External file. + (`plain-text destination) + (`headline + (if (org-export-numbered-headline-p destination info) + (mapconcat #'number-to-string + (org-export-get-headline-number destination info) + ".") + (org-export-data (org-element-property :title destination) info))) + ;; Handle enumerable elements and targets within them. + ((and (let number (org-export-get-ordinal + destination info nil #'org-ascii--has-caption-p)) + (guard number)) + (if (atom number) (number-to-string number) + (mapconcat #'number-to-string number "."))) + ;; Don't know what to do. Signal it. + (_ "???")))) + (t + (let ((path (org-element-property :raw-link link))) + (if (not (org-string-nw-p desc)) (format "<%s>" path) + (concat (format "[%s]" desc) + (and (not (plist-get info :ascii-links-to-notes)) + (format " (<%s>)" path))))))))) + + +;;;; Node Properties + +(defun org-ascii-node-property (node-property _contents _info) + "Transcode a NODE-PROPERTY element from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual +information." + (format "%s:%s" + (org-element-property :key node-property) + (let ((value (org-element-property :value node-property))) + (if value (concat " " value) "")))) + + +;;;; Paragraph + +(defun org-ascii-paragraph (paragraph contents info) + "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." + (org-ascii--justify-element + (let ((indented-line-width (plist-get info :ascii-indented-line-width))) + (if (not (wholenump indented-line-width)) contents + (concat + ;; Do not indent first paragraph in a section. + (unless (and (not (org-export-get-previous-element paragraph info)) + (eq (org-element-type (org-export-get-parent paragraph)) + 'section)) + (make-string indented-line-width ?\s)) + (replace-regexp-in-string "\\`[ \t]+" "" contents)))) + paragraph info)) + + +;;;; Plain List + +(defun org-ascii-plain-list (plain-list contents info) + "Transcode a PLAIN-LIST element from Org to ASCII. +CONTENTS is the contents of the list. INFO is a plist holding +contextual information." + (let ((margin (plist-get info :ascii-list-margin))) + (if (or (< margin 1) + (eq (org-element-type (org-export-get-parent plain-list)) 'item)) + contents + (org-ascii--indent-string contents margin)))) + + +;;;; Plain Text + +(defun org-ascii-plain-text (text info) + "Transcode a TEXT string from Org to ASCII. +INFO is a plist used as a communication channel." + (let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))) + (when (and utf8p (plist-get info :with-smart-quotes)) + (setq text (org-export-activate-smart-quotes text :utf-8 info))) + (if (not (plist-get info :with-special-strings)) text + (setq text (replace-regexp-in-string "\\\\-" "" text)) + (if (not utf8p) text + ;; Usual replacements in utf-8 with proper option set. + (replace-regexp-in-string + "\\.\\.\\." "…" + (replace-regexp-in-string + "--" "–" + (replace-regexp-in-string "---" "—" text))))))) + + +;;;; Planning + +(defun org-ascii-planning (planning _contents info) + "Transcode a PLANNING element from Org to ASCII. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (org-ascii--justify-element + (mapconcat + #'identity + (delq nil + (list (let ((closed (org-element-property :closed planning))) + (when closed + (concat org-closed-string " " + (org-timestamp-translate closed)))) + (let ((deadline (org-element-property :deadline planning))) + (when deadline + (concat org-deadline-string " " + (org-timestamp-translate deadline)))) + (let ((scheduled (org-element-property :scheduled planning))) + (when scheduled + (concat org-scheduled-string " " + (org-timestamp-translate scheduled)))))) + " ") + planning info)) + + +;;;; Property Drawer + +(defun org-ascii-property-drawer (property-drawer contents info) + "Transcode a PROPERTY-DRAWER element from Org to ASCII. +CONTENTS holds the contents of the drawer. INFO is a plist +holding contextual information." + (and (org-string-nw-p contents) + (org-ascii--justify-element contents property-drawer info))) + + +;;;; Quote Block + +(defun org-ascii-quote-block (_quote-block contents info) + "Transcode a QUOTE-BLOCK element from Org to ASCII. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + (org-ascii--indent-string contents (plist-get info :ascii-quote-margin))) + + +;;;; Radio Target + +(defun org-ascii-radio-target (_radio-target contents _info) + "Transcode a RADIO-TARGET object from Org to ASCII. +CONTENTS is the contents of the target. INFO is a plist holding +contextual information." + contents) + + +;;;; Section + +(defun org-ascii-section (section contents info) + "Transcode a SECTION element from Org to ASCII. +CONTENTS is the contents of the section. INFO is a plist holding +contextual information." + (let ((links + (and (plist-get info :ascii-links-to-notes) + ;; Take care of links in first section of the document. + (not (org-element-lineage section '(headline))) + (org-ascii--describe-links + (org-ascii--unique-links section info) + (org-ascii--current-text-width section info) + info)))) + (org-ascii--indent-string + (if (not (org-string-nw-p links)) contents + (concat (org-element-normalize-string contents) "\n\n" links)) + ;; Do not apply inner margin if parent headline is low level. + (let ((headline (org-export-get-parent-headline section))) + (if (or (not headline) (org-export-low-level-p headline info)) 0 + (plist-get info :ascii-inner-margin)))))) + + +;;;; Special Block + +(defun org-ascii-special-block (_special-block contents _info) + "Transcode a SPECIAL-BLOCK element from Org to ASCII. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + ;; "JUSTIFYLEFT" and "JUSTIFYRIGHT" have already been taken care of + ;; at a lower level. There is no other special block type to + ;; handle. + contents) + + +;;;; Src Block + +(defun org-ascii-src-block (src-block _contents info) + "Transcode a SRC-BLOCK element from Org to ASCII. +CONTENTS holds the contents of the item. INFO is a plist holding +contextual information." + (let ((caption (org-ascii--build-caption src-block info)) + (caption-above-p (plist-get info :ascii-caption-above)) + (code (org-export-format-code-default src-block info))) + (if (equal code "") "" + (org-ascii--justify-element + (concat + (and caption caption-above-p (concat caption "\n")) + (org-ascii--box-string code info) + (and caption (not caption-above-p) (concat "\n" caption))) + src-block info)))) + + +;;;; Statistics Cookie + +(defun org-ascii-statistics-cookie (statistics-cookie _contents _info) + "Transcode a STATISTICS-COOKIE object from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual information." + (org-element-property :value statistics-cookie)) + + +;;;; Subscript + +(defun org-ascii-subscript (subscript contents _info) + "Transcode a SUBSCRIPT object from Org to ASCII. +CONTENTS is the contents of the object. INFO is a plist holding +contextual information." + (if (org-element-property :use-brackets-p subscript) + (format "_{%s}" contents) + (format "_%s" contents))) + + +;;;; Superscript + +(defun org-ascii-superscript (superscript contents _info) + "Transcode a SUPERSCRIPT object from Org to ASCII. +CONTENTS is the contents of the object. INFO is a plist holding +contextual information." + (if (org-element-property :use-brackets-p superscript) + (format "^{%s}" contents) + (format "^%s" contents))) + + +;;;; Strike-through + +(defun org-ascii-strike-through (_strike-through contents _info) + "Transcode STRIKE-THROUGH from Org to ASCII. +CONTENTS is text with strike-through markup. INFO is a plist +holding contextual information." + (format "+%s+" contents)) + + +;;;; Table + +(defun org-ascii-table (table contents info) + "Transcode a TABLE element from Org to ASCII. +CONTENTS is the contents of the table. INFO is a plist holding +contextual information." + (let ((caption (org-ascii--build-caption table info)) + (caption-above-p (plist-get info :ascii-caption-above))) + (org-ascii--justify-element + (concat + ;; Possibly add a caption string above. + (and caption caption-above-p (concat caption "\n")) + ;; Insert table. Note: "table.el" tables are left unmodified. + (cond ((eq (org-element-property :type table) 'org) contents) + ((and (plist-get info :ascii-table-use-ascii-art) + (eq (plist-get info :ascii-charset) 'utf-8) + (require 'ascii-art-to-unicode nil t)) + (with-temp-buffer + (insert (org-remove-indentation + (org-element-property :value table))) + (goto-char (point-min)) + (aa2u) + (goto-char (point-max)) + (skip-chars-backward " \r\t\n") + (buffer-substring (point-min) (point)))) + (t (org-remove-indentation (org-element-property :value table)))) + ;; Possible add a caption string below. + (and (not caption-above-p) caption)) + table info))) + + +;;;; Table Cell + +(defun org-ascii--table-cell-width (table-cell info) + "Return width of TABLE-CELL. + +INFO is a plist used as a communication channel. + +Width of a cell is determined either by a width cookie in the +same column as the cell, or by the maximum cell's length in that +column. + +When `org-ascii-table-widen-columns' is non-nil, width cookies +are ignored." + (let* ((row (org-export-get-parent table-cell)) + (table (org-export-get-parent row)) + (col (let ((cells (org-element-contents row))) + (- (length cells) (length (memq table-cell cells))))) + (cache + (or (plist-get info :ascii-table-cell-width-cache) + (plist-get (setq info + (plist-put info :ascii-table-cell-width-cache + (make-hash-table :test 'equal))) + :ascii-table-cell-width-cache))) + (key (cons table col)) + (widenp (plist-get info :ascii-table-widen-columns))) + (or (gethash key cache) + (puthash + key + (let ((cookie-width (org-export-table-cell-width table-cell info))) + (or (and (not widenp) cookie-width) + (let ((contents-width + (let ((max-width 0)) + (org-element-map table 'table-row + (lambda (row) + (setq max-width + (max (string-width + (org-export-data + (org-element-contents + (elt (org-element-contents row) col)) + info)) + max-width))) + info) + max-width))) + (cond ((not cookie-width) contents-width) + (widenp (max cookie-width contents-width)) + (t cookie-width))))) + cache)))) + +(defun org-ascii-table-cell (table-cell contents info) + "Transcode a TABLE-CELL object from Org to ASCII. +CONTENTS is the cell contents. INFO is a plist used as +a communication channel." + ;; Determine column width. When `org-ascii-table-widen-columns' + ;; is nil and some width cookie has set it, use that value. + ;; Otherwise, compute the maximum width among transcoded data of + ;; each cell in the column. + (let ((width (org-ascii--table-cell-width table-cell info))) + ;; When contents are too large, truncate them. + (unless (or (plist-get info :ascii-table-widen-columns) + (<= (string-width (or contents "")) width)) + (setq contents (concat (substring contents 0 (- width 2)) "=>"))) + ;; Align contents correctly within the cell. + (let* ((indent-tabs-mode nil) + (data + (when contents + (org-ascii--justify-lines + contents width + (org-export-table-cell-alignment table-cell info))))) + (setq contents + (concat data + (make-string (- width (string-width (or data ""))) ?\s)))) + ;; Return cell. + (concat (format " %s " contents) + (when (memq 'right (org-export-table-cell-borders table-cell info)) + (if (eq (plist-get info :ascii-charset) 'utf-8) "│" "|"))))) + + +;;;; Table Row + +(defun org-ascii-table-row (table-row contents info) + "Transcode a TABLE-ROW element from Org to ASCII. +CONTENTS is the row contents. INFO is a plist used as +a communication channel." + (when (eq (org-element-property :type table-row) 'standard) + (let ((build-hline + (lambda (lcorner horiz vert rcorner) + (concat + (apply + 'concat + (org-element-map table-row 'table-cell + (lambda (cell) + (let ((width (org-ascii--table-cell-width cell info)) + (borders (org-export-table-cell-borders cell info))) + (concat + ;; In order to know if CELL starts the row, do + ;; not compare it with the first cell in the + ;; row as there might be a special column. + ;; Instead, compare it with first exportable + ;; cell, obtained with `org-element-map'. + (when (and (memq 'left borders) + (eq (org-element-map table-row 'table-cell + 'identity info t) + cell)) + lcorner) + (make-string (+ 2 width) (string-to-char horiz)) + (cond + ((not (memq 'right borders)) nil) + ((eq (car (last (org-element-contents table-row))) cell) + rcorner) + (t vert))))) + info)) "\n"))) + (utf8p (eq (plist-get info :ascii-charset) 'utf-8)) + (borders (org-export-table-cell-borders + (org-element-map table-row 'table-cell 'identity info t) + info))) + (concat (cond + ((and (memq 'top borders) (or utf8p (memq 'above borders))) + (if utf8p (funcall build-hline "┍" "━" "┯" "┑") + (funcall build-hline "+" "-" "+" "+"))) + ((memq 'above borders) + (if utf8p (funcall build-hline "├" "─" "┼" "┤") + (funcall build-hline "+" "-" "+" "+")))) + (when (memq 'left borders) (if utf8p "│" "|")) + contents "\n" + (when (and (memq 'bottom borders) (or utf8p (memq 'below borders))) + (if utf8p (funcall build-hline "┕" "━" "┷" "┙") + (funcall build-hline "+" "-" "+" "+"))))))) + + +;;;; Timestamp + +(defun org-ascii-timestamp (timestamp _contents info) + "Transcode a TIMESTAMP object from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual information." + (org-ascii-plain-text (org-timestamp-translate timestamp) info)) + + +;;;; Underline + +(defun org-ascii-underline (_underline contents _info) + "Transcode UNDERLINE from Org to ASCII. +CONTENTS is the text with underline markup. INFO is a plist +holding contextual information." + (format "_%s_" contents)) + + +;;;; Verbatim + +(defun org-ascii-verbatim (verbatim _contents info) + "Return a VERBATIM object from Org to ASCII. +CONTENTS is nil. INFO is a plist holding contextual information." + (format (plist-get info :ascii-verbatim-format) + (org-element-property :value verbatim))) + + +;;;; Verse Block + +(defun org-ascii-verse-block (verse-block contents info) + "Transcode a VERSE-BLOCK element from Org to ASCII. +CONTENTS is verse block contents. INFO is a plist holding +contextual information." + (org-ascii--indent-string + (org-ascii--justify-element contents verse-block info) + (plist-get info :ascii-quote-margin))) + + + +;;; Filters + +(defun org-ascii-filter-headline-blank-lines (headline _backend info) + "Filter controlling number of blank lines after a headline. + +HEADLINE is a string representing a transcoded headline. BACKEND +is symbol specifying back-end used for export. INFO is plist +containing the communication channel. + +This function only applies to `ascii' back-end. See +`org-ascii-headline-spacing' for information." + (let ((headline-spacing (plist-get info :ascii-headline-spacing))) + (if (not headline-spacing) headline + (let ((blanks (make-string (1+ (cdr headline-spacing)) ?\n))) + (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline))))) + +(defun org-ascii-filter-paragraph-spacing (tree _backend info) + "Filter controlling number of blank lines between paragraphs. + +TREE is the parse tree. BACKEND is the symbol specifying +back-end used for export. INFO is a plist used as +a communication channel. + +See `org-ascii-paragraph-spacing' for information." + (let ((paragraph-spacing (plist-get info :ascii-paragraph-spacing))) + (when (wholenump paragraph-spacing) + (org-element-map tree 'paragraph + (lambda (p) + (when (eq (org-element-type (org-export-get-next-element p info)) + 'paragraph) + (org-element-put-property p :post-blank paragraph-spacing)))))) + tree) + +(defun org-ascii-filter-comment-spacing (tree _backend info) + "Filter removing blank lines between comments. +TREE is the parse tree. BACKEND is the symbol specifying +back-end used for export. INFO is a plist used as +a communication channel." + (org-element-map tree '(comment comment-block) + (lambda (c) + (when (memq (org-element-type (org-export-get-next-element c info)) + '(comment comment-block)) + (org-element-put-property c :post-blank 0)))) + tree) + + + +;;; End-user functions + +;;;###autoload +(defun org-ascii-convert-region-to-ascii () + "Assume region has Org syntax, and convert it to plain ASCII." + (interactive) + (let ((org-ascii-charset 'ascii)) + (org-export-replace-region-by 'ascii))) + +;;;###autoload +(defun org-ascii-convert-region-to-utf8 () + "Assume region has Org syntax, and convert it to UTF-8." + (interactive) + (let ((org-ascii-charset 'utf-8)) + (org-export-replace-region-by 'ascii))) + +;;;###autoload +(defun org-ascii-export-as-ascii + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer to a text buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, strip title and +table of contents from output. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org ASCII Export*\", which +will be displayed when `org-export-show-temporary-export-buffer' +is non-nil." + (interactive) + (org-export-to-buffer 'ascii "*Org ASCII Export*" + async subtreep visible-only body-only ext-plist (lambda () (text-mode)))) + +;;;###autoload +(defun org-ascii-export-to-ascii + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer to a text file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, strip title and +table of contents from output. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file's name." + (interactive) + (let ((file (org-export-output-file-name ".txt" subtreep))) + (org-export-to-file 'ascii file + async subtreep visible-only body-only ext-plist))) + +;;;###autoload +(defun org-ascii-publish-to-ascii (plist filename pub-dir) + "Publish an Org file to ASCII. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name." + (org-publish-org-to + 'ascii filename ".txt" `(:ascii-charset ascii ,@plist) pub-dir)) + +;;;###autoload +(defun org-ascii-publish-to-latin1 (plist filename pub-dir) + "Publish an Org file to Latin-1. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name." + (org-publish-org-to + 'ascii filename ".txt" `(:ascii-charset latin1 ,@plist) pub-dir)) + +;;;###autoload +(defun org-ascii-publish-to-utf8 (plist filename pub-dir) + "Publish an org file to UTF-8. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name." + (org-publish-org-to + 'ascii filename ".txt" `(:ascii-charset utf-8 ,@plist) pub-dir)) + + +(provide 'ox-ascii) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; coding: utf-8 +;; End: + +;;; ox-ascii.el ends here diff --git a/elpa/org-9.5.2/ox-ascii.elc b/elpa/org-9.5.2/ox-ascii.elc new file mode 100644 index 0000000..2e3d571 Binary files /dev/null and b/elpa/org-9.5.2/ox-ascii.elc differ diff --git a/elpa/org-9.5.2/ox-beamer.el b/elpa/org-9.5.2/ox-beamer.el new file mode 100644 index 0000000..77de0aa --- /dev/null +++ b/elpa/org-9.5.2/ox-beamer.el @@ -0,0 +1,1158 @@ +;;; ox-beamer.el --- Beamer Back-End for Org Export Engine -*- lexical-binding: t; -*- + +;; Copyright (C) 2007-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com> +;; Nicolas Goaziou <n.goaziou AT gmail DOT com> +;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com> +;; Keywords: org, wp, tex + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: +;; +;; This library implements both a Beamer back-end, derived from the +;; LaTeX one and a minor mode easing structure edition of the +;; document. See Org manual for more information. + +;;; Code: + +(require 'cl-lib) +(require 'ox-latex) + +;; Install a default set-up for Beamer export. +(unless (assoc "beamer" org-latex-classes) + (add-to-list 'org-latex-classes + '("beamer" + "\\documentclass[presentation]{beamer}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))) + + + +;;; User-Configurable Variables + +(defgroup org-export-beamer nil + "Options specific for using the beamer class in LaTeX export." + :tag "Org Beamer" + :group 'org-export + :version "24.2") + +(defcustom org-beamer-frame-level 1 + "The level at which headlines become frames. + +Headlines at a lower level will be translated into a sectioning +structure. At a higher level, they will be translated into +blocks. + +If a headline with a \"BEAMER_env\" property set to \"frame\" is +found within a tree, its level locally overrides this number. + +This variable has no effect on headlines with the \"BEAMER_env\" +property set to either \"ignoreheading\", \"appendix\", or +\"note\", which will respectively, be invisible, become an +appendix or a note. + +This integer is relative to the minimal level of a headline +within the parse tree, defined as 1." + :group 'org-export-beamer + :type 'integer) + +(defcustom org-beamer-frame-default-options "" + "Default options string to use for frames. +For example, it could be set to \"allowframebreaks\"." + :group 'org-export-beamer + :type '(string :tag "[options]")) + +(defcustom org-beamer-column-view-format + "%45ITEM %10BEAMER_env(Env) %10BEAMER_act(Act) %4BEAMER_col(Col) %8BEAMER_opt(Opt)" + "Column view format that should be used to fill the template." + :group 'org-export-beamer + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Do not insert Beamer column view format" nil) + (string :tag "Beamer column view format"))) + +(defcustom org-beamer-theme "default" + "Default theme used in Beamer presentations." + :group 'org-export-beamer + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Do not insert a Beamer theme" nil) + (string :tag "Beamer theme"))) + +(defcustom org-beamer-environments-extra nil + "Environments triggered by tags in Beamer export. +Each entry has 4 elements: + +name Name of the environment +key Selection key for `org-beamer-select-environment' +open The opening template for the environment, with the following escapes + %a the action/overlay specification + %A the default action/overlay specification + %R the raw BEAMER_act value + %o the options argument, with square brackets + %O the raw BEAMER_opt value + %h the headline text + %r the raw headline text (i.e. without any processing) + %H if there is headline text, that raw text in {} braces + %U if there is headline text, that raw text in [] brackets +close The closing string of the environment." + :group 'org-export-beamer + :version "24.4" + :package-version '(Org . "8.1") + :type '(repeat + (list + (string :tag "Environment") + (string :tag "Selection key") + (string :tag "Begin") + (string :tag "End")))) + +(defcustom org-beamer-outline-frame-title "Outline" + "Default title of a frame containing an outline." + :group 'org-export-beamer + :type '(string :tag "Outline frame title")) + +(defcustom org-beamer-outline-frame-options "" + "Outline frame options appended after \\begin{frame}. +You might want to put e.g. \"allowframebreaks=0.9\" here." + :group 'org-export-beamer + :type '(string :tag "Outline frame options")) + + +(defcustom org-beamer-subtitle-format "\\subtitle{%s}" + "Format string used for transcoded subtitle. +The format string should have at most one \"%s\"-expression, +which is replaced with the subtitle." + :group 'org-export-beamer + :version "26.1" + :package-version '(Org . "8.3") + :type '(string :tag "Format string")) + + +;;; Internal Variables + +(defconst org-beamer-column-widths + "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC" + "The column widths that should be installed as allowed property values.") + +(defconst org-beamer-environments-special + '(("againframe" "A") + ("appendix" "x") + ("column" "c") + ("columns" "C") + ("frame" "f") + ("fullframe" "F") + ("ignoreheading" "i") + ("note" "n") + ("noteNH" "N")) + "Alist of environments treated in a special way by the back-end. +Keys are environment names, as strings, values are bindings used +in `org-beamer-select-environment'. Environments listed here, +along with their binding, are hard coded and cannot be modified +through `org-beamer-environments-extra' variable.") + +(defconst org-beamer-environments-default + '(("block" "b" "\\begin{block}%a{%h}" "\\end{block}") + ("alertblock" "a" "\\begin{alertblock}%a{%h}" "\\end{alertblock}") + ("verse" "v" "\\begin{verse}%a %% %h" "\\end{verse}") + ("quotation" "q" "\\begin{quotation}%a %% %h" "\\end{quotation}") + ("quote" "Q" "\\begin{quote}%a %% %h" "\\end{quote}") + ("structureenv" "s" "\\begin{structureenv}%a %% %h" "\\end{structureenv}") + ("theorem" "t" "\\begin{theorem}%a[%h]" "\\end{theorem}") + ("definition" "d" "\\begin{definition}%a[%h]" "\\end{definition}") + ("example" "e" "\\begin{example}%a[%h]" "\\end{example}") + ("exampleblock" "E" "\\begin{exampleblock}%a{%h}" "\\end{exampleblock}") + ("proof" "p" "\\begin{proof}%a[%h]" "\\end{proof}") + ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}" "\\end{beamercolorbox}")) + "Environments triggered by properties in Beamer export. +These are the defaults - for user definitions, see +`org-beamer-environments-extra'.") + +(defconst org-beamer-verbatim-elements + '(code example-block fixed-width inline-src-block src-block verbatim) + "List of element or object types producing verbatim text. +This is used internally to determine when a frame should have the +\"fragile\" option.") + + + +;;; Internal functions + +(defun org-beamer--normalize-argument (argument type) + "Return ARGUMENT string with proper boundaries. + +TYPE is a symbol among the following: +`action' Return ARGUMENT within angular brackets. +`defaction' Return ARGUMENT within both square and angular brackets. +`option' Return ARGUMENT within square brackets." + (if (not (string-match "\\S-" argument)) "" + (cl-case type + (action (format "<%s>" (org-unbracket-string "<" ">" argument))) + (defaction + (format "[<%s>]" + (org-unbracket-string "<" ">" (org-unbracket-string "[" "]" argument)))) + (option (format "[%s]" (org-unbracket-string "[" "]" argument))) + (otherwise (error "Invalid `type' argument to `org-beamer--normalize-argument': %s" + type))))) + +(defun org-beamer--element-has-overlay-p (element) + "Non-nil when ELEMENT has an overlay specified. +An element has an overlay specification when it starts with an +`beamer' export-snippet whose value is between angular brackets. +Return overlay specification, as a string, or nil." + (let ((first-object (car (org-element-contents element)))) + (when (eq (org-element-type first-object) 'export-snippet) + (let ((value (org-element-property :value first-object))) + (and (string-prefix-p "<" value) (string-suffix-p ">" value) + value))))) + + + +;;; Define Back-End + +(org-export-define-derived-backend 'beamer 'latex + :menu-entry + '(?l 1 + ((?B "As LaTeX buffer (Beamer)" org-beamer-export-as-latex) + (?b "As LaTeX file (Beamer)" org-beamer-export-to-latex) + (?P "As PDF file (Beamer)" org-beamer-export-to-pdf) + (?O "As PDF file and open (Beamer)" + (lambda (a s v b) + (if a (org-beamer-export-to-pdf t s v b) + (org-open-file (org-beamer-export-to-pdf nil s v b))))))) + :options-alist + '((:headline-levels nil "H" org-beamer-frame-level) + (:latex-class "LATEX_CLASS" nil "beamer" t) + (:beamer-subtitle-format nil nil org-beamer-subtitle-format) + (:beamer-column-view-format "COLUMNS" nil org-beamer-column-view-format) + (:beamer-theme "BEAMER_THEME" nil org-beamer-theme) + (:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t) + (:beamer-font-theme "BEAMER_FONT_THEME" nil nil t) + (:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t) + (:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t) + (:beamer-header "BEAMER_HEADER" nil nil newline) + (:beamer-environments-extra nil nil org-beamer-environments-extra) + (:beamer-frame-default-options nil nil org-beamer-frame-default-options) + (:beamer-outline-frame-options nil nil org-beamer-outline-frame-options) + (:beamer-outline-frame-title nil nil org-beamer-outline-frame-title)) + :translate-alist '((bold . org-beamer-bold) + (export-block . org-beamer-export-block) + (export-snippet . org-beamer-export-snippet) + (headline . org-beamer-headline) + (item . org-beamer-item) + (keyword . org-beamer-keyword) + (link . org-beamer-link) + (plain-list . org-beamer-plain-list) + (radio-target . org-beamer-radio-target) + (template . org-beamer-template))) + + + +;;; Transcode Functions + +;;;; Bold + +(defun org-beamer-bold (bold contents _info) + "Transcode BLOCK object into Beamer code. +CONTENTS is the text being bold. INFO is a plist used as +a communication channel." + (format "\\alert%s{%s}" + (or (org-beamer--element-has-overlay-p bold) "") + contents)) + + +;;;; Export Block + +(defun org-beamer-export-block (export-block _contents _info) + "Transcode an EXPORT-BLOCK element into Beamer code. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (when (member (org-element-property :type export-block) '("BEAMER" "LATEX")) + (org-remove-indentation (org-element-property :value export-block)))) + + +;;;; Export Snippet + +(defun org-beamer-export-snippet (export-snippet _contents info) + "Transcode an EXPORT-SNIPPET object into Beamer code. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (let ((backend (org-export-snippet-backend export-snippet)) + (value (org-element-property :value export-snippet))) + ;; Only "latex" and "beamer" snippets are retained. + (cond ((eq backend 'latex) value) + ;; Ignore "beamer" snippets specifying overlays. + ((and (eq backend 'beamer) + (or (org-export-get-previous-element export-snippet info) + (not (string-match "\\`<.*>\\'" value)))) + value)))) + + +;;;; Headline +;; +;; The main function to translate a headline is +;; `org-beamer-headline'. +;; +;; Depending on the level at which a headline is considered as +;; a frame (given by `org-beamer--frame-level'), the headline is +;; either a section (`org-beamer--format-section'), a frame +;; (`org-beamer--format-frame') or a block +;; (`org-beamer--format-block'). +;; +;; `org-beamer-headline' also takes care of special environments +;; like "ignoreheading", "note", "noteNH", "appendix" and +;; "againframe". + +(defun org-beamer--get-label (headline info) + "Return label for HEADLINE, as a string. + +INFO is a plist used as a communication channel. + +The value is either the label specified in \"BEAMER_opt\" +property, the custom ID, if there is one and +`:latex-prefer-user-labels' property has a non-nil value, or +a unique internal label. This function assumes HEADLINE will be +treated as a frame." + (cond + ((let ((opt (org-element-property :BEAMER_OPT headline))) + (and (stringp opt) + (string-match "\\(?:^\\|,\\)label=\\(.*?\\)\\(?:$\\|,\\)" opt) + (let ((label (match-string 1 opt))) + (if (string-match-p "\\`{.*}\\'" label) + (substring label 1 -1) + label))))) + ((and (plist-get info :latex-prefer-user-labels) + (org-element-property :CUSTOM_ID headline))) + (t (format "sec:%s" (org-export-get-reference headline info))))) + +(defun org-beamer--frame-level (headline info) + "Return frame level in subtree containing HEADLINE. +INFO is a plist used as a communication channel." + (or + ;; 1. Look for "frame" environment in parents, starting from the + ;; farthest. + (catch 'exit + (dolist (parent (nreverse (org-element-lineage headline))) + (let ((env (org-element-property :BEAMER_ENV parent))) + (when (and env (member-ignore-case env '("frame" "fullframe"))) + (throw 'exit (org-export-get-relative-level parent info)))))) + ;; 2. Look for "frame" environment in HEADLINE. + (let ((env (org-element-property :BEAMER_ENV headline))) + (and env (member-ignore-case env '("frame" "fullframe")) + (org-export-get-relative-level headline info))) + ;; 3. Look for "frame" environment in sub-tree. + (org-element-map headline 'headline + (lambda (hl) + (let ((env (org-element-property :BEAMER_ENV hl))) + (when (and env (member-ignore-case env '("frame" "fullframe"))) + (org-export-get-relative-level hl info)))) + info 'first-match) + ;; 4. No "frame" environment in tree: use default value. + (plist-get info :headline-levels))) + +(defun org-beamer--format-section (headline contents info) + "Format HEADLINE as a sectioning part. +CONTENTS holds the contents of the headline. INFO is a plist +used as a communication channel." + (let ((latex-headline + (org-export-with-backend + ;; We create a temporary export back-end which behaves the + ;; same as current one, but adds "\protect" in front of the + ;; output of some objects. + (org-export-create-backend + :parent 'latex + :transcoders + (let ((protected-output + (lambda (object contents info) + (let ((code (org-export-with-backend + 'beamer object contents info))) + (if (org-string-nw-p code) (concat "\\protect" code) + code))))) + (mapcar (lambda (type) (cons type protected-output)) + '(bold footnote-reference italic strike-through timestamp + underline)))) + headline + contents + info)) + (mode-specs (org-element-property :BEAMER_ACT headline))) + (if (and mode-specs + (string-match "\\`\\\\\\(.*?\\)\\(?:\\*\\|\\[.*\\]\\)?{" + latex-headline)) + ;; Insert overlay specifications. + (replace-match (concat (match-string 1 latex-headline) + (format "<%s>" mode-specs)) + nil nil latex-headline 1) + latex-headline))) + +(defun org-beamer--format-frame (headline contents info) + "Format HEADLINE as a frame. +CONTENTS holds the contents of the headline. INFO is a plist +used as a communication channel." + (let ((fragilep + ;; FRAGILEP is non-nil when HEADLINE contains an element + ;; among `org-beamer-verbatim-elements'. + (org-element-map headline org-beamer-verbatim-elements 'identity + info 'first-match))) + (concat "\\begin{frame}" + ;; Overlay specification, if any. When surrounded by + ;; square brackets, consider it as a default + ;; specification. + (let ((action (org-element-property :BEAMER_ACT headline))) + (cond + ((not action) "") + ((string-match "\\`\\[.*\\]\\'" action ) + (org-beamer--normalize-argument action 'defaction)) + (t (org-beamer--normalize-argument action 'action)))) + ;; Options, if any. + (let* ((beamer-opt (org-element-property :BEAMER_OPT headline)) + (options + ;; Collect nonempty options from default value and + ;; headline's properties. + (cl-remove-if-not #'org-string-nw-p + (append + (org-split-string + (plist-get info :beamer-frame-default-options) ",") + (and beamer-opt + (org-split-string + ;; Remove square brackets if user provided + ;; them. + (and (string-match "^\\[?\\(.*\\)\\]?$" beamer-opt) + (match-string 1 beamer-opt)) + ","))))) + (fragile + ;; Add "fragile" option if necessary. + (and fragilep + (not (member "fragile" options)) + (list "fragile"))) + (label + ;; Provide an automatic label for the frame unless + ;; the user specified one. Also refrain from + ;; labeling `allowframebreaks' frames; this is not + ;; allowed by Beamer. + (and (not (member "allowframebreaks" options)) + (not (cl-some (lambda (s) (string-match-p "^label=" s)) + options)) + (list + (let ((label (org-beamer--get-label headline info))) + ;; Labels containing colons need to be + ;; wrapped within braces. + (format (if (string-match-p ":" label) + "label={%s}" + "label=%s") + label)))))) + ;; Change options list into a string. + (org-beamer--normalize-argument + (mapconcat #'identity (append label fragile options) ",") + 'option)) + ;; Title. + (let ((env (org-element-property :BEAMER_ENV headline))) + (format "{%s}" + (if (and env (equal (downcase env) "fullframe")) "" + (org-export-data + (org-element-property :title headline) info)))) + "\n" + ;; The following workaround is required in fragile frames + ;; as Beamer will append "\par" to the beginning of the + ;; contents. So we need to make sure the command is + ;; separated from the contents by at least one space. If + ;; it isn't, it will create "\parfirst-word" command and + ;; remove the first word from the contents in the PDF + ;; output. + (if (not fragilep) contents + (replace-regexp-in-string "\\`\n*" "\\& " (or contents ""))) + "\\end{frame}"))) + +(defun org-beamer--format-block (headline contents info) + "Format HEADLINE as a block. +CONTENTS holds the contents of the headline. INFO is a plist +used as a communication channel." + (let* ((column-width (org-element-property :BEAMER_COL headline)) + ;; ENVIRONMENT defaults to "block" if none is specified and + ;; there is no column specification. If there is a column + ;; specified but still no explicit environment, ENVIRONMENT + ;; is "column". + (environment (let ((env (org-element-property :BEAMER_ENV headline))) + (cond + ;; "block" is the fallback environment. + ((and (not env) (not column-width)) "block") + ;; "column" only. + ((not env) "column") + ;; Use specified environment. + (t env)))) + (raw-title (org-element-property :raw-value headline)) + (env-format + (cond ((member environment '("column" "columns")) nil) + ((assoc environment + (append (plist-get info :beamer-environments-extra) + org-beamer-environments-default))) + (t (user-error "Wrong block type at a headline named \"%s\"" + raw-title)))) + (title (org-export-data (org-element-property :title headline) info)) + (raw-options (org-element-property :BEAMER_OPT headline)) + (options (if raw-options + (org-beamer--normalize-argument raw-options 'option) + "")) + ;; Start a "columns" environment when explicitly requested or + ;; when there is no previous headline or the previous + ;; headline do not have a BEAMER_column property. + (parent-env (org-element-property + :BEAMER_ENV (org-export-get-parent-headline headline))) + (start-columns-p + (or (equal environment "columns") + (and column-width + (not (and parent-env + (equal (downcase parent-env) "columns"))) + (or (org-export-first-sibling-p headline info) + (not (org-element-property + :BEAMER_COL + (org-export-get-previous-element + headline info))))))) + ;; End the "columns" environment when explicitly requested or + ;; when there is no next headline or the next headline do not + ;; have a BEAMER_column property. + (end-columns-p + (or (equal environment "columns") + (and column-width + (not (and parent-env + (equal (downcase parent-env) "columns"))) + (or (org-export-last-sibling-p headline info) + (not (org-element-property + :BEAMER_COL + (org-export-get-next-element headline info)))))))) + (concat + (when start-columns-p + ;; Column can accept options only when the environment is + ;; explicitly defined. + (if (not (equal environment "columns")) "\\begin{columns}\n" + (format "\\begin{columns}%s\n" options))) + (when column-width + (format "\\begin{column}%s{%s}\n" + ;; One can specify placement for column only when + ;; HEADLINE stands for a column on its own. + (if (equal environment "column") options "") + (format "%s\\columnwidth" column-width))) + ;; Block's opening string. + (when (nth 2 env-format) + (concat + (org-fill-template + (nth 2 env-format) + (nconc + ;; If BEAMER_act property has its value enclosed in square + ;; brackets, it is a default overlay specification and + ;; overlay specification is empty. Otherwise, it is an + ;; overlay specification and the default one is nil. + (let ((action (org-element-property :BEAMER_ACT headline))) + (cond + ((not action) (list (cons "a" "") (cons "A" "") (cons "R" ""))) + ((and (string-prefix-p "[" action) + (string-suffix-p "]" action)) + (list + (cons "A" (org-beamer--normalize-argument action 'defaction)) + (cons "a" "") + (cons "R" action))) + (t + (list (cons "a" (org-beamer--normalize-argument action 'action)) + (cons "A" "") + (cons "R" action))))) + (list (cons "o" options) + (cons "O" (or raw-options "")) + (cons "h" title) + (cons "r" raw-title) + (cons "H" (if (equal raw-title "") "" + (format "{%s}" raw-title))) + (cons "U" (if (equal raw-title "") "" + (format "[%s]" raw-title)))))) + "\n")) + contents + ;; Block's closing string, if any. + (and (nth 3 env-format) (concat (nth 3 env-format) "\n")) + (when column-width "\\end{column}\n") + (when end-columns-p "\\end{columns}")))) + +(defun org-beamer-headline (headline contents info) + "Transcode HEADLINE element into Beamer code. +CONTENTS is the contents of the headline. INFO is a plist used +as a communication channel." + (unless (org-element-property :footnote-section-p headline) + (let ((level (org-export-get-relative-level headline info)) + (frame-level (org-beamer--frame-level headline info)) + (environment (let ((env (org-element-property :BEAMER_ENV headline))) + (or (org-string-nw-p env) "block")))) + (cond + ;; Case 1: Resume frame specified by "BEAMER_ref" property. + ((equal environment "againframe") + (let ((ref (org-element-property :BEAMER_REF headline))) + ;; Reference to frame being resumed is mandatory. Ignore + ;; the whole headline if it isn't provided. + (when (org-string-nw-p ref) + (concat "\\againframe" + ;; Overlay specification. + (let ((overlay (org-element-property :BEAMER_ACT headline))) + (when overlay + (org-beamer--normalize-argument + overlay + (if (string-match "\\`\\[.*\\]\\'" overlay) 'defaction + 'action)))) + ;; Options. + (let ((options (org-element-property :BEAMER_OPT headline))) + (when options + (org-beamer--normalize-argument options 'option))) + ;; Resolve reference provided by "BEAMER_ref" + ;; property. This is done by building a minimal + ;; fake link and calling the appropriate resolve + ;; function, depending on the reference syntax. + (let ((target + (if (string-match "\\`\\(id:\\|#\\)" ref) + (org-export-resolve-id-link + `(link (:path ,(substring ref (match-end 0)))) + info) + (org-export-resolve-fuzzy-link + `(link (:path + ;; Look for headlines only. + ,(if (eq (string-to-char ref) ?*) ref + (concat "*" ref)))) + info)))) + ;; Now use user-defined label provided in TARGET + ;; headline, or fallback to standard one. + (format "{%s}" (org-beamer--get-label target info))))))) + ;; Case 2: Creation of an appendix is requested. + ((equal environment "appendix") + (concat "\\appendix" + (org-element-property :BEAMER_ACT headline) + "\n" + (make-string (org-element-property :pre-blank headline) ?\n) + contents)) + ;; Case 3: Ignore heading. + ((equal environment "ignoreheading") + (concat (make-string (org-element-property :pre-blank headline) ?\n) + contents)) + ;; Case 4: HEADLINE is a note. + ((member environment '("note" "noteNH")) + (concat "\\note" + ;; Overlay specification. + (let ((overlay (org-element-property :BEAMER_ACT headline))) + (when overlay + (org-beamer--normalize-argument + overlay + (if (string-match "\\`\\[.*\\]\\'" overlay) + 'defaction 'action)))) + (format "{%s}" + (concat (and (equal environment "note") + (concat + (org-export-data + (org-element-property :title headline) + info) + "\n")) + (org-trim contents))))) + ;; Case 5: HEADLINE is a frame. + ((= level frame-level) + (org-beamer--format-frame headline contents info)) + ;; Case 6: Regular section, extracted from + ;; `org-latex-classes'. + ((< level frame-level) + (org-beamer--format-section headline contents info)) + ;; Case 7: Otherwise, HEADLINE is a block. + (t (org-beamer--format-block headline contents info)))))) + + +;;;; Item + +(defun org-beamer-item (item contents info) + "Transcode an ITEM element into Beamer code. +CONTENTS holds the contents of the item. INFO is a plist holding +contextual information." + (org-export-with-backend + ;; Delegate item export to `latex'. However, we use `beamer' + ;; transcoders for objects in the description tag. + (org-export-create-backend + :parent 'beamer + :transcoders + (list + (cons + 'item + (lambda (item _c _i) + (let ((action + (let ((first (car (org-element-contents item)))) + (and (eq (org-element-type first) 'paragraph) + (org-beamer--element-has-overlay-p first)))) + (output (org-latex-item item contents info))) + (if (not (and action (string-match "\\\\item" output))) output + ;; If the item starts with a paragraph and that paragraph + ;; starts with an export snippet specifying an overlay, + ;; append it to the \item command. + (replace-match (concat "\\\\item" action) nil nil output))))))) + item contents info)) + + +;;;; Keyword + +(defun org-beamer-keyword (keyword contents info) + "Transcode a KEYWORD element into Beamer code. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (let ((key (org-element-property :key keyword)) + (value (org-element-property :value keyword))) + ;; Handle specifically BEAMER and TOC (headlines only) keywords. + ;; Otherwise, fallback to `latex' back-end. + (cond + ((equal key "BEAMER") value) + ((and (equal key "TOC") (string-match "\\<headlines\\>" value)) + (let ((depth (or (and (string-match "[0-9]+" value) + (string-to-number (match-string 0 value))) + (plist-get info :with-toc))) + (options (and (string-match "\\[.*?\\]" value) + (match-string 0 value)))) + (concat + (when (wholenump depth) (format "\\setcounter{tocdepth}{%s}\n" depth)) + "\\tableofcontents" options))) + (t (org-export-with-backend 'latex keyword contents info))))) + + +;;;; Link + +(defun org-beamer-link (link contents info) + "Transcode a LINK object into Beamer code. +CONTENTS is the description part of the link. INFO is a plist +used as a communication channel." + (or (org-export-custom-protocol-maybe link contents 'beamer info) + ;; Fall-back to LaTeX export. However, prefer "\hyperlink" over + ;; "\hyperref" since the former handles overlay specifications. + (let ((latex-link (org-export-with-backend 'latex link contents info))) + (if (string-match "\\`\\\\hyperref\\[\\(.*?\\)\\]" latex-link) + (replace-match + (format "\\\\hyperlink%s{\\1}" + (or (org-beamer--element-has-overlay-p link) "")) + nil nil latex-link) + latex-link)))) + + +;;;; Plain List +;; +;; Plain lists support `:environment', `:overlay' and `:options' +;; attributes. + +(defun org-beamer-plain-list (plain-list contents info) + "Transcode a PLAIN-LIST element into Beamer code. +CONTENTS is the contents of the list. INFO is a plist holding +contextual information." + (let* ((type (org-element-property :type plain-list)) + (attributes (org-combine-plists + (org-export-read-attribute :attr_latex plain-list) + (org-export-read-attribute :attr_beamer plain-list))) + (latex-type (let ((env (plist-get attributes :environment))) + (cond (env) + ((eq type 'ordered) "enumerate") + ((eq type 'descriptive) "description") + (t "itemize"))))) + (org-latex--wrap-label + plain-list + (format "\\begin{%s}%s%s\n%s\\end{%s}" + latex-type + ;; Default overlay specification, if any. + (org-beamer--normalize-argument + (or (plist-get attributes :overlay) "") + 'defaction) + ;; Second optional argument depends on the list type. + (org-beamer--normalize-argument + (or (plist-get attributes :options) "") + 'option) + ;; Eventually insert contents and close environment. + contents + latex-type) + info))) + + +;;;; Radio Target + +(defun org-beamer-radio-target (radio-target text info) + "Transcode a RADIO-TARGET object into Beamer code. +TEXT is the text of the target. INFO is a plist holding +contextual information." + (format "\\hypertarget%s{%s}{%s}" + (or (org-beamer--element-has-overlay-p radio-target) "") + (org-export-get-reference radio-target info) + text)) + + +;;;; Template +;; +;; Template used is similar to the one used in `latex' back-end, +;; excepted for the table of contents and Beamer themes. + +(defun org-beamer-template (contents info) + "Return complete document string after Beamer conversion. +CONTENTS is the transcoded contents string. INFO is a plist +holding export options." + (let ((title (org-export-data (plist-get info :title) info)) + (subtitle (org-export-data (plist-get info :subtitle) info))) + (concat + ;; Time-stamp. + (and (plist-get info :time-stamp-file) + (format-time-string "%% Created %Y-%m-%d %a %H:%M\n")) + ;; LaTeX compiler + (org-latex--insert-compiler info) + ;; Document class and packages. + (org-latex-make-preamble info) + ;; Insert themes. + (let ((format-theme + (lambda (prop command) + (let ((theme (plist-get info prop))) + (when theme + (concat command + (if (not (string-match "\\[.*\\]" theme)) + (format "{%s}\n" theme) + (format "%s{%s}\n" + (match-string 0 theme) + (org-trim + (replace-match "" nil nil theme)))))))))) + (mapconcat (lambda (args) (apply format-theme args)) + '((:beamer-theme "\\usetheme") + (:beamer-color-theme "\\usecolortheme") + (:beamer-font-theme "\\usefonttheme") + (:beamer-inner-theme "\\useinnertheme") + (:beamer-outer-theme "\\useoutertheme")) + "")) + ;; Possibly limit depth for headline numbering. + (let ((sec-num (plist-get info :section-numbers))) + (when (integerp sec-num) + (format "\\setcounter{secnumdepth}{%d}\n" sec-num))) + ;; Author. + (let ((author (and (plist-get info :with-author) + (let ((auth (plist-get info :author))) + (and auth (org-export-data auth info))))) + (email (and (plist-get info :with-email) + (org-export-data (plist-get info :email) info)))) + (cond ((and author email (not (string= "" email))) + (format "\\author{%s\\thanks{%s}}\n" author email)) + ((or author email) (format "\\author{%s}\n" (or author email))))) + ;; Date. + (let ((date (and (plist-get info :with-date) (org-export-get-date info)))) + (format "\\date{%s}\n" (org-export-data date info))) + ;; Title + (format "\\title{%s}\n" title) + (when (org-string-nw-p subtitle) + (concat (format (plist-get info :beamer-subtitle-format) subtitle) "\n")) + ;; Beamer-header + (let ((beamer-header (plist-get info :beamer-header))) + (when beamer-header + (format "%s\n" (plist-get info :beamer-header)))) + ;; 9. Hyperref options. + (let ((template (plist-get info :latex-hyperref-template))) + (and (stringp template) + (format-spec template (org-latex--format-spec info)))) + ;; Document start. + "\\begin{document}\n\n" + ;; Title command. + (org-element-normalize-string + (cond ((not (plist-get info :with-title)) nil) + ((string= "" title) nil) + ((not (stringp org-latex-title-command)) nil) + ((string-match "\\(?:[^%]\\|^\\)%s" + org-latex-title-command) + (format org-latex-title-command title)) + (t org-latex-title-command))) + ;; Table of contents. + (let ((depth (plist-get info :with-toc))) + (when depth + (concat + (format "\\begin{frame}%s{%s}\n" + (org-beamer--normalize-argument + (plist-get info :beamer-outline-frame-options) 'option) + (plist-get info :beamer-outline-frame-title)) + (when (wholenump depth) + (format "\\setcounter{tocdepth}{%d}\n" depth)) + "\\tableofcontents\n" + "\\end{frame}\n\n"))) + ;; Document's body. + contents + ;; Creator. + (if (plist-get info :with-creator) + (concat (plist-get info :creator) "\n") + "") + ;; Document end. + "\\end{document}"))) + + + +;;; Minor Mode + + +(defvar org-beamer-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-c\C-b" 'org-beamer-select-environment) + map) + "The keymap for `org-beamer-mode'.") + +;;;###autoload +(define-minor-mode org-beamer-mode + "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)) + +(defface org-beamer-tag '((t (:box (:line-width 1 :color grey40)))) + "The special face for beamer tags." + :group 'org-export-beamer) + +(defun org-beamer-property-changed (property value) + "Track the BEAMER_env property with tags. +PROPERTY is the name of the modified property. VALUE is its new +value." + (cond + ((equal property "BEAMER_env") + (save-excursion + (org-back-to-heading t) + ;; Filter out Beamer-related tags and install environment tag. + (let ((tags (cl-remove-if (lambda (x) (string-match "^B_" x)) + (org-get-tags nil t))) + (env-tag (and (org-string-nw-p value) (concat "B_" value)))) + (org-set-tags (if env-tag (cons env-tag tags) tags)) + (when env-tag (org-toggle-tag env-tag 'on))))) + ((equal property "BEAMER_col") + (org-toggle-tag "BMCOL" (if (org-string-nw-p value) 'on 'off))))) + +(add-hook 'org-property-changed-functions 'org-beamer-property-changed) + +(defun org-beamer-allowed-property-values (property) + "Supply allowed values for PROPERTY." + (cond + ((and (equal property "BEAMER_env") + (not (org-entry-get nil (concat property "_ALL") 'inherit))) + ;; If no allowed values for BEAMER_env have been defined, + ;; supply all defined environments + (mapcar 'car (append org-beamer-environments-special + org-beamer-environments-extra + org-beamer-environments-default))) + ((and (equal property "BEAMER_col") + (not (org-entry-get nil (concat property "_ALL") 'inherit))) + ;; If no allowed values for BEAMER_col have been defined, supply + ;; some. + (split-string org-beamer-column-widths " ")))) + +(add-hook 'org-property-allowed-value-functions + 'org-beamer-allowed-property-values) + + + +;;; Commands + +;;;###autoload +(defun org-beamer-export-as-latex + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a Beamer buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org BEAMER Export*\", which +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)))) + +;;;###autoload +(defun org-beamer-export-to-latex + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a Beamer presentation (tex). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file's name." + (interactive) + (let ((file (org-export-output-file-name ".tex" subtreep))) + (org-export-to-file 'beamer file + async subtreep visible-only body-only ext-plist))) + +;;;###autoload +(defun org-beamer-export-to-pdf + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a Beamer presentation (PDF). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{document}\" and \"\\end{document}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return PDF file's name." + (interactive) + (let ((file (org-export-output-file-name ".tex" subtreep))) + (org-export-to-file 'beamer file + async subtreep visible-only body-only ext-plist + #'org-latex-compile))) + +;;;###autoload +(defun org-beamer-select-environment () + "Select the environment to be used by beamer for this entry. +While this uses (for convenience) a tag selection interface, the +result of this command will be that the BEAMER_env *property* of +the entry is set. + +In addition to this, the command will also set a tag as a visual +aid, but the tag does not have any semantic meaning." + (interactive) + ;; Make sure `org-beamer-environments-special' has a higher + ;; priority than `org-beamer-environments-extra'. + (let* ((envs (append org-beamer-environments-special + org-beamer-environments-extra + org-beamer-environments-default)) + (org-current-tag-alist + (append '((:startgroup)) + (mapcar (lambda (e) (cons (concat "B_" (car e)) + (string-to-char (nth 1 e)))) + envs) + '((:endgroup)) + '(("BMCOL" . ?|)))) + (org-tag-persistent-alist nil) + (org-use-fast-tag-selection t) + (org-fast-tag-selection-single-key t)) + (org-set-tags-command) + (let ((tags (org-get-tags nil t))) + (cond + ;; For a column, automatically ask for its width. + ((eq org-last-tag-selection-key ?|) + (if (member "BMCOL" tags) + (org-set-property "BEAMER_col" (read-string "Column width: ")) + (org-delete-property "BEAMER_col"))) + ;; For an "againframe" section, automatically ask for reference + ;; to resumed frame and overlay specifications. + ((eq org-last-tag-selection-key ?A) + (if (equal (org-entry-get nil "BEAMER_env") "againframe") + (progn (org-entry-delete nil "BEAMER_env") + (org-entry-delete nil "BEAMER_ref") + (org-entry-delete nil "BEAMER_act")) + (org-entry-put nil "BEAMER_env" "againframe") + (org-set-property + "BEAMER_ref" + (read-string "Frame reference (*Title, #custom-id, id:...): ")) + (org-set-property "BEAMER_act" + (read-string "Overlay specification: ")))) + ((let* ((tags-re (concat "B_" (regexp-opt (mapcar #'car envs) t))) + (env (cl-some (lambda (tag) + (and (string-match tags-re tag) + (match-string 1 tag))) + tags))) + (and env (progn (org-entry-put nil "BEAMER_env" env) t)))) + (t (org-entry-delete nil "BEAMER_env")))))) + +;;;###autoload +(defun org-beamer-publish-to-latex (plist filename pub-dir) + "Publish an Org file to a Beamer presentation (LaTeX). + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name." + (org-publish-org-to 'beamer filename ".tex" plist pub-dir)) + +;;;###autoload +(defun org-beamer-publish-to-pdf (plist filename pub-dir) + "Publish an Org file to a Beamer presentation (PDF, via LaTeX). + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name." + ;; Unlike to `org-beamer-publish-to-latex', PDF file is generated in + ;; working directory and then moved to publishing directory. + (org-publish-attachment + plist + ;; Default directory could be anywhere when this function is + ;; called. We ensure it is set to source file directory during + ;; compilation so as to not break links to external documents. + (let ((default-directory (file-name-directory filename))) + (org-latex-compile + (org-publish-org-to + 'beamer filename ".tex" plist (file-name-directory filename)))) + pub-dir)) + + +(provide 'ox-beamer) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; ox-beamer.el ends here diff --git a/elpa/org-9.5.2/ox-beamer.elc b/elpa/org-9.5.2/ox-beamer.elc new file mode 100644 index 0000000..2430f9c Binary files /dev/null and b/elpa/org-9.5.2/ox-beamer.elc differ diff --git a/elpa/org-9.5.2/ox-html.el b/elpa/org-9.5.2/ox-html.el new file mode 100644 index 0000000..a150b1f --- /dev/null +++ b/elpa/org-9.5.2/ox-html.el @@ -0,0 +1,3895 @@ +;;; ox-html.el --- HTML Back-End for Org Export Engine -*- lexical-binding: t; -*- + +;; Copyright (C) 2011-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik <carsten.dominik@gmail.com> +;; Jambunathan K <kjambunathan at gmail dot com> +;; Maintainer: TEC <tecosaur@gmail.com> +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This library implements a HTML back-end for Org generic exporter. +;; See Org manual for more information. + +;;; Code: + +;;; Dependencies + +(require 'cl-lib) +(require 'format-spec) +(require 'ox) +(require 'ox-publish) +(require 'table) + + +;;; Function Declarations + +(declare-function org-id-find-id-file "org-id" (id)) +(declare-function htmlize-region "ext:htmlize" (beg end)) +(declare-function mm-url-decode-entities "mm-url" ()) + +(defvar htmlize-css-name-prefix) +(defvar htmlize-output-type) +(defvar htmlize-output-type) +(defvar htmlize-css-name-prefix) + +;;; Define Back-End + +(org-export-define-backend 'html + '((bold . org-html-bold) + (center-block . org-html-center-block) + (clock . org-html-clock) + (code . org-html-code) + (drawer . org-html-drawer) + (dynamic-block . org-html-dynamic-block) + (entity . org-html-entity) + (example-block . org-html-example-block) + (export-block . org-html-export-block) + (export-snippet . org-html-export-snippet) + (fixed-width . org-html-fixed-width) + (footnote-reference . org-html-footnote-reference) + (headline . org-html-headline) + (horizontal-rule . org-html-horizontal-rule) + (inline-src-block . org-html-inline-src-block) + (inlinetask . org-html-inlinetask) + (inner-template . org-html-inner-template) + (italic . org-html-italic) + (item . org-html-item) + (keyword . org-html-keyword) + (latex-environment . org-html-latex-environment) + (latex-fragment . org-html-latex-fragment) + (line-break . org-html-line-break) + (link . org-html-link) + (node-property . org-html-node-property) + (paragraph . org-html-paragraph) + (plain-list . org-html-plain-list) + (plain-text . org-html-plain-text) + (planning . org-html-planning) + (property-drawer . org-html-property-drawer) + (quote-block . org-html-quote-block) + (radio-target . org-html-radio-target) + (section . org-html-section) + (special-block . org-html-special-block) + (src-block . org-html-src-block) + (statistics-cookie . org-html-statistics-cookie) + (strike-through . org-html-strike-through) + (subscript . org-html-subscript) + (superscript . org-html-superscript) + (table . org-html-table) + (table-cell . org-html-table-cell) + (table-row . org-html-table-row) + (target . org-html-target) + (template . org-html-template) + (timestamp . org-html-timestamp) + (underline . org-html-underline) + (verbatim . org-html-verbatim) + (verse-block . org-html-verse-block)) + :filters-alist '((:filter-options . org-html-infojs-install-script) + (:filter-parse-tree . org-html-image-link-filter) + (:filter-final-output . org-html-final-function)) + :menu-entry + '(?h "Export to HTML" + ((?H "As HTML buffer" org-html-export-as-html) + (?h "As HTML file" org-html-export-to-html) + (?o "As HTML file and open" + (lambda (a s v b) + (if a (org-html-export-to-html t s v b) + (org-open-file (org-html-export-to-html nil s v b))))))) + :options-alist + '((:html-doctype "HTML_DOCTYPE" nil org-html-doctype) + (:html-container "HTML_CONTAINER" nil org-html-container-element) + (:html-content-class "HTML_CONTENT_CLASS" nil org-html-content-class) + (:description "DESCRIPTION" nil nil newline) + (:keywords "KEYWORDS" nil nil space) + (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy) + (:html-link-use-abs-url nil "html-link-use-abs-url" org-html-link-use-abs-url) + (:html-link-home "HTML_LINK_HOME" nil org-html-link-home) + (:html-link-up "HTML_LINK_UP" nil org-html-link-up) + (:html-mathjax "HTML_MATHJAX" nil "" space) + (:html-equation-reference-format "HTML_EQUATION_REFERENCE_FORMAT" nil org-html-equation-reference-format t) + (:html-postamble nil "html-postamble" org-html-postamble) + (:html-preamble nil "html-preamble" org-html-preamble) + (:html-head "HTML_HEAD" nil org-html-head newline) + (:html-head-extra "HTML_HEAD_EXTRA" nil org-html-head-extra newline) + (:subtitle "SUBTITLE" nil nil parse) + (:html-head-include-default-style + nil "html-style" org-html-head-include-default-style) + (:html-head-include-scripts nil "html-scripts" org-html-head-include-scripts) + (:html-allow-name-attribute-in-anchors + nil nil org-html-allow-name-attribute-in-anchors) + (:html-divs nil nil org-html-divs) + (:html-checkbox-type nil nil org-html-checkbox-type) + (:html-extension nil nil org-html-extension) + (:html-footnote-format nil nil org-html-footnote-format) + (:html-footnote-separator nil nil org-html-footnote-separator) + (:html-footnotes-section nil nil org-html-footnotes-section) + (:html-format-drawer-function nil nil org-html-format-drawer-function) + (:html-format-headline-function nil nil org-html-format-headline-function) + (:html-format-inlinetask-function + nil nil org-html-format-inlinetask-function) + (:html-home/up-format nil nil org-html-home/up-format) + (:html-indent nil nil org-html-indent) + (:html-infojs-options nil nil org-html-infojs-options) + (:html-infojs-template nil nil org-html-infojs-template) + (:html-inline-image-rules nil nil org-html-inline-image-rules) + (:html-link-org-files-as-html nil nil org-html-link-org-files-as-html) + (:html-mathjax-options nil nil org-html-mathjax-options) + (:html-mathjax-template nil nil org-html-mathjax-template) + (:html-metadata-timestamp-format nil nil org-html-metadata-timestamp-format) + (:html-postamble-format nil nil org-html-postamble-format) + (:html-preamble-format nil nil org-html-preamble-format) + (:html-prefer-user-labels nil nil org-html-prefer-user-labels) + (:html-self-link-headlines nil nil org-html-self-link-headlines) + (:html-table-align-individual-fields + nil nil org-html-table-align-individual-fields) + (:html-table-caption-above nil nil org-html-table-caption-above) + (:html-table-data-tags nil nil org-html-table-data-tags) + (:html-table-header-tags nil nil org-html-table-header-tags) + (:html-table-use-header-tags-for-first-column + nil nil org-html-table-use-header-tags-for-first-column) + (:html-tag-class-prefix nil nil org-html-tag-class-prefix) + (:html-text-markup-alist nil nil org-html-text-markup-alist) + (:html-todo-kwd-class-prefix nil nil org-html-todo-kwd-class-prefix) + (:html-toplevel-hlevel nil nil org-html-toplevel-hlevel) + (:html-use-infojs nil nil org-html-use-infojs) + (:html-validation-link nil nil org-html-validation-link) + (:html-viewport nil nil org-html-viewport) + (:html-inline-images nil nil org-html-inline-images) + (:html-table-attributes nil nil org-html-table-default-attributes) + (:html-table-row-open-tag nil nil org-html-table-row-open-tag) + (:html-table-row-close-tag nil nil org-html-table-row-close-tag) + (:html-xml-declaration nil nil org-html-xml-declaration) + (:html-wrap-src-lines nil nil org-html-wrap-src-lines) + (:html-klipsify-src nil nil org-html-klipsify-src) + (:html-klipse-css nil nil org-html-klipse-css) + (:html-klipse-js nil nil org-html-klipse-js) + (:html-klipse-selection-script nil nil org-html-klipse-selection-script) + (:infojs-opt "INFOJS_OPT" nil nil) + ;; Redefine regular options. + (:creator "CREATOR" nil org-html-creator-string) + (:with-latex nil "tex" org-html-with-latex) + ;; Retrieve LaTeX header for fragments. + (:latex-header "LATEX_HEADER" nil nil newline))) + + +;;; Internal Variables + +(defvar org-html-format-table-no-css) +(defvar htmlize-buffer-places) ; from htmlize.el + +(defvar org-html--pre/postamble-class "status" + "CSS class used for pre/postamble.") + +(defconst org-html-doctype-alist + '(("html4-strict" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" +\"http://www.w3.org/TR/html4/strict.dtd\">") + ("html4-transitional" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" +\"http://www.w3.org/TR/html4/loose.dtd\">") + ("html4-frameset" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" +\"http://www.w3.org/TR/html4/frameset.dtd\">") + + ("xhtml-strict" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" +\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">") + ("xhtml-transitional" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" +\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">") + ("xhtml-frameset" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" +\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">") + ("xhtml-11" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" +\"http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd\">") + + ("html5" . "<!DOCTYPE html>") + ("xhtml5" . "<!DOCTYPE html>")) + "An alist mapping (x)html flavors to specific doctypes.") + +(defconst org-html-html5-elements + '("article" "aside" "audio" "canvas" "details" "figcaption" + "figure" "footer" "header" "menu" "meter" "nav" "output" + "progress" "section" "summary" "video") + "New elements in html5. + +For blocks that should contain headlines, use the HTML_CONTAINER +property on the headline itself.") + +(defconst org-html-special-string-regexps + '(("\\\\-" . "­") ; shy + ("---\\([^-]\\)" . "—\\1") ; mdash + ("--\\([^-]\\)" . "–\\1") ; ndash + ("\\.\\.\\." . "…")) ; hellip + "Regular expressions for special string conversion.") + +(defcustom org-html-scripts + "<script> +// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later + function CodeHighlightOn(elem, id) + { + var target = document.getElementById(id); + if(null != target) { + elem.classList.add(\"code-highlighted\"); + target.classList.add(\"code-highlighted\"); + } + } + function CodeHighlightOff(elem, id) + { + var target = document.getElementById(id); + if(null != target) { + elem.classList.remove(\"code-highlighted\"); + target.classList.remove(\"code-highlighted\"); + } + } +// @license-end +</script>" + "Basic JavaScript to allow highlighting references in code blocks." + :group 'org-export-html + :package-version '(Org . "9.5") + :type 'string) + +(defcustom org-html-style-default + "<style> + #content { max-width: 60em; margin: auto; } + .title { text-align: center; + margin-bottom: .2em; } + .subtitle { text-align: center; + font-size: medium; + font-weight: bold; + margin-top:0; } + .todo { font-family: monospace; color: red; } + .done { font-family: monospace; color: green; } + .priority { font-family: monospace; color: orange; } + .tag { background-color: #eee; font-family: monospace; + padding: 2px; font-size: 80%; font-weight: normal; } + .timestamp { color: #bebebe; } + .timestamp-kwd { color: #5f9ea0; } + .org-right { margin-left: auto; margin-right: 0px; text-align: right; } + .org-left { margin-left: 0px; margin-right: auto; text-align: left; } + .org-center { margin-left: auto; margin-right: auto; text-align: center; } + .underline { text-decoration: underline; } + #postamble p, #preamble p { font-size: 90%; margin: .2em; } + p.verse { margin-left: 3%; } + pre { + border: 1px solid #e6e6e6; + border-radius: 3px; + background-color: #f2f2f2; + padding: 8pt; + font-family: monospace; + overflow: auto; + margin: 1.2em; + } + pre.src { + position: relative; + overflow: auto; + } + pre.src:before { + display: none; + position: absolute; + top: -8px; + right: 12px; + padding: 3px; + color: #555; + background-color: #f2f2f299; + } + pre.src:hover:before { display: inline; margin-top: 14px;} + /* Languages per Org manual */ + pre.src-asymptote:before { content: 'Asymptote'; } + pre.src-awk:before { content: 'Awk'; } + pre.src-authinfo::before { content: 'Authinfo'; } + pre.src-C:before { content: 'C'; } + /* pre.src-C++ doesn't work in CSS */ + pre.src-clojure:before { content: 'Clojure'; } + pre.src-css:before { content: 'CSS'; } + pre.src-D:before { content: 'D'; } + pre.src-ditaa:before { content: 'ditaa'; } + pre.src-dot:before { content: 'Graphviz'; } + pre.src-calc:before { content: 'Emacs Calc'; } + pre.src-emacs-lisp:before { content: 'Emacs Lisp'; } + pre.src-fortran:before { content: 'Fortran'; } + pre.src-gnuplot:before { content: 'gnuplot'; } + pre.src-haskell:before { content: 'Haskell'; } + pre.src-hledger:before { content: 'hledger'; } + pre.src-java:before { content: 'Java'; } + pre.src-js:before { content: 'Javascript'; } + pre.src-latex:before { content: 'LaTeX'; } + pre.src-ledger:before { content: 'Ledger'; } + pre.src-lisp:before { content: 'Lisp'; } + pre.src-lilypond:before { content: 'Lilypond'; } + pre.src-lua:before { content: 'Lua'; } + pre.src-matlab:before { content: 'MATLAB'; } + pre.src-mscgen:before { content: 'Mscgen'; } + pre.src-ocaml:before { content: 'Objective Caml'; } + pre.src-octave:before { content: 'Octave'; } + pre.src-org:before { content: 'Org mode'; } + pre.src-oz:before { content: 'OZ'; } + pre.src-plantuml:before { content: 'Plantuml'; } + pre.src-processing:before { content: 'Processing.js'; } + pre.src-python:before { content: 'Python'; } + pre.src-R:before { content: 'R'; } + pre.src-ruby:before { content: 'Ruby'; } + pre.src-sass:before { content: 'Sass'; } + pre.src-scheme:before { content: 'Scheme'; } + pre.src-screen:before { content: 'Gnu Screen'; } + pre.src-sed:before { content: 'Sed'; } + pre.src-sh:before { content: 'shell'; } + pre.src-sql:before { content: 'SQL'; } + pre.src-sqlite:before { content: 'SQLite'; } + /* additional languages in org.el's org-babel-load-languages alist */ + pre.src-forth:before { content: 'Forth'; } + pre.src-io:before { content: 'IO'; } + pre.src-J:before { content: 'J'; } + pre.src-makefile:before { content: 'Makefile'; } + pre.src-maxima:before { content: 'Maxima'; } + pre.src-perl:before { content: 'Perl'; } + pre.src-picolisp:before { content: 'Pico Lisp'; } + pre.src-scala:before { content: 'Scala'; } + pre.src-shell:before { content: 'Shell Script'; } + pre.src-ebnf2ps:before { content: 'ebfn2ps'; } + /* additional language identifiers per \"defun org-babel-execute\" + in ob-*.el */ + pre.src-cpp:before { content: 'C++'; } + pre.src-abc:before { content: 'ABC'; } + pre.src-coq:before { content: 'Coq'; } + pre.src-groovy:before { content: 'Groovy'; } + /* additional language identifiers from org-babel-shell-names in + ob-shell.el: ob-shell is the only babel language using a lambda to put + the execution function name together. */ + pre.src-bash:before { content: 'bash'; } + pre.src-csh:before { content: 'csh'; } + pre.src-ash:before { content: 'ash'; } + pre.src-dash:before { content: 'dash'; } + pre.src-ksh:before { content: 'ksh'; } + pre.src-mksh:before { content: 'mksh'; } + pre.src-posh:before { content: 'posh'; } + /* Additional Emacs modes also supported by the LaTeX listings package */ + pre.src-ada:before { content: 'Ada'; } + pre.src-asm:before { content: 'Assembler'; } + pre.src-caml:before { content: 'Caml'; } + pre.src-delphi:before { content: 'Delphi'; } + pre.src-html:before { content: 'HTML'; } + pre.src-idl:before { content: 'IDL'; } + pre.src-mercury:before { content: 'Mercury'; } + pre.src-metapost:before { content: 'MetaPost'; } + pre.src-modula-2:before { content: 'Modula-2'; } + pre.src-pascal:before { content: 'Pascal'; } + pre.src-ps:before { content: 'PostScript'; } + pre.src-prolog:before { content: 'Prolog'; } + pre.src-simula:before { content: 'Simula'; } + pre.src-tcl:before { content: 'tcl'; } + pre.src-tex:before { content: 'TeX'; } + pre.src-plain-tex:before { content: 'Plain TeX'; } + pre.src-verilog:before { content: 'Verilog'; } + pre.src-vhdl:before { content: 'VHDL'; } + pre.src-xml:before { content: 'XML'; } + pre.src-nxml:before { content: 'XML'; } + /* add a generic configuration mode; LaTeX export needs an additional + (add-to-list 'org-latex-listings-langs '(conf \" \")) in .emacs */ + pre.src-conf:before { content: 'Configuration File'; } + + table { border-collapse:collapse; } + caption.t-above { caption-side: top; } + caption.t-bottom { caption-side: bottom; } + td, th { vertical-align:top; } + th.org-right { text-align: center; } + th.org-left { text-align: center; } + th.org-center { text-align: center; } + td.org-right { text-align: right; } + td.org-left { text-align: left; } + td.org-center { text-align: center; } + dt { font-weight: bold; } + .footpara { display: inline; } + .footdef { margin-bottom: 1em; } + .figure { padding: 1em; } + .figure p { text-align: center; } + .equation-container { + display: table; + text-align: center; + width: 100%; + } + .equation { + vertical-align: middle; + } + .equation-label { + display: table-cell; + text-align: right; + vertical-align: middle; + } + .inlinetask { + padding: 10px; + border: 2px solid gray; + margin: 10px; + background: #ffffcc; + } + #org-div-home-and-up + { text-align: right; font-size: 70%; white-space: nowrap; } + textarea { overflow-x: auto; } + .linenr { font-size: smaller } + .code-highlighted { background-color: #ffff00; } + .org-info-js_info-navigation { border-style: none; } + #org-info-js_console-label + { font-size: 10px; font-weight: bold; white-space: nowrap; } + .org-info-js_search-highlight + { background-color: #ffff00; color: #000000; font-weight: bold; } + .org-svg { width: 90%; } +</style>" + "The default style specification for exported HTML files. +You can use `org-html-head' and `org-html-head-extra' to add to +this style. If you don't want to include this default style, +customize `org-html-head-include-default-style'." + :group 'org-export-html + :package-version '(Org . "9.5") + :type 'string) + + +;;; User Configuration Variables + +(defgroup org-export-html nil + "Options for exporting Org mode files to HTML." + :tag "Org Export HTML" + :group 'org-export) + +;;;; Handle infojs + +(defvar org-html-infojs-opts-table + '((path PATH "https://orgmode.org/org-info.js") + (view VIEW "info") + (toc TOC :with-toc) + (ftoc FIXED_TOC "0") + (tdepth TOC_DEPTH "max") + (sdepth SECTION_DEPTH "max") + (mouse MOUSE_HINT "underline") + (buttons VIEW_BUTTONS "0") + (ltoc LOCAL_TOC "1") + (up LINK_UP :html-link-up) + (home LINK_HOME :html-link-home)) + "JavaScript options, long form for script, default values.") + +(defcustom org-html-use-infojs 'when-configured + "Non-nil when Sebastian Rose's Java Script org-info.js should be active. +This option can be nil or t to never or always use the script. +It can also be the symbol `when-configured', meaning that the +script will be linked into the export file if and only if there +is a \"#+INFOJS_OPT:\" line in the buffer. See also the variable +`org-html-infojs-options'." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Never" nil) + (const :tag "When configured in buffer" when-configured) + (const :tag "Always" t))) + +(defcustom org-html-infojs-options + (mapcar (lambda (x) (cons (car x) (nth 2 x))) org-html-infojs-opts-table) + "Options settings for the INFOJS JavaScript. +Each of the options must have an entry in `org-html-infojs-opts-table'. +The value can either be a string that will be passed to the script, or +a property. This property is then assumed to be a property that is defined +by the Export/Publishing setup of Org. +The `sdepth' and `tdepth' parameters can also be set to \"max\", which +means to use the maximum value consistent with other options." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type + `(set :greedy t :inline t + ,@(mapcar + (lambda (x) + (list 'cons (list 'const (car x)) + '(choice + (symbol :tag "Publishing/Export property") + (string :tag "Value")))) + org-html-infojs-opts-table))) + +(defcustom org-html-infojs-template + "<script src=\"%SCRIPT_PATH\"> +// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later +// @license-end +</script> + +<script> +// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later +%MANAGER_OPTIONS +org_html_manager.setup(); // activate after the parameters are set +// @license-end +</script>" + "The template for the export style additions when org-info.js is used. +Option settings will replace the %MANAGER-OPTIONS cookie." + :group 'org-export-html + :package-version '(Org . "9.4") + :type 'string) + +(defun org-html-infojs-install-script (exp-plist _backend) + "Install script in export options when appropriate. +EXP-PLIST is a plist containing export options. BACKEND is the +export back-end currently used." + (unless (or (memq 'body-only (plist-get exp-plist :export-options)) + (not (plist-get exp-plist :html-use-infojs)) + (and (eq (plist-get exp-plist :html-use-infojs) 'when-configured) + (let ((opt (plist-get exp-plist :infojs-opt))) + (or (not opt) + (string= "" opt) + (string-match "\\<view:nil\\>" opt))))) + (let* ((template (plist-get exp-plist :html-infojs-template)) + (ptoc (plist-get exp-plist :with-toc)) + (hlevels (plist-get exp-plist :headline-levels)) + (sdepth hlevels) + (tdepth (if (integerp ptoc) (min ptoc hlevels) hlevels)) + (options (plist-get exp-plist :infojs-opt)) + (infojs-opt (plist-get exp-plist :html-infojs-options)) + (table org-html-infojs-opts-table) + style) + (dolist (entry table) + (let* ((opt (car entry)) + (var (nth 1 entry)) + ;; Compute default values for script option OPT from + ;; `org-html-infojs-options' variable. + (default + (let ((default (cdr (assq opt infojs-opt)))) + (if (and (symbolp default) (not (memq default '(t nil)))) + (plist-get exp-plist default) + default))) + ;; Value set through INFOJS_OPT keyword has precedence + ;; over the default one. + (val (if (and options + (string-match (format "\\<%s:\\(\\S-+\\)" opt) + options)) + (match-string 1 options) + default))) + (pcase opt + (`path (setq template + (replace-regexp-in-string + "%SCRIPT_PATH" val template t t))) + (`sdepth (when (integerp (read val)) + (setq sdepth (min (read val) sdepth)))) + (`tdepth (when (integerp (read val)) + (setq tdepth (min (read val) tdepth)))) + (_ (setq val + (cond + ((or (eq val t) (equal val "t")) "1") + ((or (eq val nil) (equal val "nil")) "0") + ((stringp val) val) + (t (format "%s" val)))) + (push (cons var val) style))))) + ;; Now we set the depth of the *generated* TOC to SDEPTH, + ;; because the toc will actually determine the splitting. How + ;; much of the toc will actually be displayed is governed by the + ;; TDEPTH option. + (setq exp-plist (plist-put exp-plist :with-toc sdepth)) + ;; The table of contents should not show more sections than we + ;; generate. + (setq tdepth (min tdepth sdepth)) + (push (cons "TOC_DEPTH" tdepth) style) + ;; Build style string. + (setq style (mapconcat + (lambda (x) + (format "org_html_manager.set(\"%s\", \"%s\");" + (car x) (cdr x))) + style "\n")) + (when (and style (> (length style) 0)) + (and (string-match "%MANAGER_OPTIONS" template) + (setq style (replace-match style t t template)) + (setq exp-plist + (plist-put + exp-plist :html-head-extra + (concat (or (plist-get exp-plist :html-head-extra) "") + "\n" + style))))) + ;; This script absolutely needs the table of contents, so we + ;; change that setting. + (unless (plist-get exp-plist :with-toc) + (setq exp-plist (plist-put exp-plist :with-toc t))) + ;; Return the modified property list. + exp-plist))) + +;;;; Bold, etc. + +(defcustom org-html-text-markup-alist + '((bold . "<b>%s</b>") + (code . "<code>%s</code>") + (italic . "<i>%s</i>") + (strike-through . "<del>%s</del>") + (underline . "<span class=\"underline\">%s</span>") + (verbatim . "<code>%s</code>")) + "Alist of HTML expressions to convert text markup. + +The key must be a symbol among `bold', `code', `italic', +`strike-through', `underline' and `verbatim'. The value is +a formatting string to wrap fontified text with. + +If no association can be found for a given markup, text will be +returned as-is." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type '(alist :key-type (symbol :tag "Markup type") + :value-type (string :tag "Format string")) + :options '(bold code italic strike-through underline verbatim)) + +(defcustom org-html-indent nil + "Non-nil means to indent the generated HTML. +Warning: non-nil may break indentation of source code blocks." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +;;;; Drawers + +(defcustom org-html-format-drawer-function (lambda (_name contents) contents) + "Function called to format a drawer in HTML code. + +The function must accept two parameters: + NAME the drawer name, like \"LOGBOOK\" + CONTENTS the contents of the drawer. + +The function should return the string to be exported. + +The default value simply returns the value of CONTENTS." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'function) + +;;;; Footnotes + +(defcustom org-html-footnotes-section "<div id=\"footnotes\"> +<h2 class=\"footnotes\">%s: </h2> +<div id=\"text-footnotes\"> +%s +</div> +</div>" + "Format for the footnotes section. +Should contain a two instances of %s. The first will be replaced with the +language-specific word for \"Footnotes\", the second one will be replaced +by the footnotes themselves." + :group 'org-export-html + :type 'string) + +(defcustom org-html-footnote-format "<sup>%s</sup>" + "The format for the footnote reference. +%s will be replaced by the footnote reference itself." + :group 'org-export-html + :type 'string) + +(defcustom org-html-footnote-separator "<sup>, </sup>" + "Text used to separate footnotes." + :group 'org-export-html + :type 'string) + +;;;; Headline + +(defcustom org-html-toplevel-hlevel 2 + "The <H> level for level 1 headings in HTML export. +This is also important for the classes that will be wrapped around headlines +and outline structure. If this variable is 1, the top-level headlines will +be <h1>, and the corresponding classes will be outline-1, section-number-1, +and outline-text-1. If this is 2, all of these will get a 2 instead. +The default for this variable is 2, because we use <h1> for formatting the +document title." + :group 'org-export-html + :type 'integer) + +(defcustom org-html-format-headline-function + 'org-html-format-headline-default-function + "Function to format headline text. + +This function will be called with six arguments: +TODO the todo keyword (string or nil). +TODO-TYPE the type of todo (symbol: `todo', `done', nil) +PRIORITY the priority of the headline (integer or nil) +TEXT the main headline text (string). +TAGS the tags (string or nil). +INFO the export options (plist). + +The function result will be used in the section format string." + :group 'org-export-html + :version "26.1" + :package-version '(Org . "8.3") + :type 'function) + +;;;; HTML-specific + +(defcustom org-html-allow-name-attribute-in-anchors nil + "When nil, do not set \"name\" attribute in anchors. +By default, when appropriate, anchors are formatted with \"id\" +but without \"name\" attribute." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-html-self-link-headlines nil + "When non-nil, the headlines contain a hyperlink to themselves." + :group 'org-export-html + :package-version '(Org . "9.3") + :type 'boolean + :safe #'booleanp) + +(defcustom org-html-prefer-user-labels nil + "When non-nil use user-defined names and ID over internal ones. + +By default, Org generates its own internal ID values during HTML +export. This process ensures that these values are unique and +valid, but the keys are not available in advance of the export +process, and not so readable. + +When this variable is non-nil, Org will use NAME keyword, or the +real name of the target to create the ID attribute. + +Independently of this variable, however, CUSTOM_ID are always +used as a reference." + :group 'org-export-html + :package-version '(Org . "9.4") + :type 'boolean + :safe #'booleanp) + +;;;; Inlinetasks + +(defcustom org-html-format-inlinetask-function + 'org-html-format-inlinetask-default-function + "Function called to format an inlinetask in HTML code. + +The function must accept seven parameters: + TODO the todo keyword, as a string + TODO-TYPE the todo type, a symbol among `todo', `done' and nil. + PRIORITY the inlinetask priority, as a string + NAME the inlinetask name, as a string. + TAGS the inlinetask tags, as a list of strings. + CONTENTS the contents of the inlinetask, as a string. + INFO the export options, as a plist + +The function should return the string to be exported." + :group 'org-export-html + :version "26.1" + :package-version '(Org . "8.3") + :type 'function) + +;;;; LaTeX + +(defcustom org-html-equation-reference-format "\\eqref{%s}" + "The MathJax command to use when referencing equations. + +This is a format control string that expects a single string argument +specifying the label that is being referenced. The argument is +generated automatically on export. + +The default is to wrap equations in parentheses (using \"\\eqref{%s}\)\". + +Most common values are: + + \\eqref{%s} Wrap the equation in parentheses + \\ref{%s} Do not wrap the equation in parentheses" + :group 'org-export-html + :package-version '(Org . "9.4") + :type 'string + :safe #'stringp) + +(defcustom org-html-with-latex org-export-with-latex + "Non-nil means process LaTeX math snippets. + +When set, the exporter will process LaTeX environments and +fragments. + +This option can also be set with the +OPTIONS line, +e.g. \"tex:mathjax\". Allowed values are: + + nil Ignore math snippets. + `verbatim' Keep everything in verbatim + `mathjax', t Do MathJax preprocessing and arrange for MathJax.js to + be loaded. + `html' Use `org-latex-to-html-convert-command' to convert + LaTeX fragments to HTML. + SYMBOL Any symbol defined in `org-preview-latex-process-alist', + e.g., `dvipng'." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "Do not process math in any way" nil) + (const :tag "Leave math verbatim" verbatim) + (const :tag "Use MathJax to display math" mathjax) + (symbol :tag "Convert to image to display math" :value dvipng))) + +;;;; Links :: Generic + +(defcustom org-html-link-org-files-as-html t + "Non-nil means make file links to \"file.org\" point to \"file.html\". + +When Org mode is exporting an Org file to HTML, links to non-HTML files +are directly put into a \"href\" tag in HTML. However, links to other Org files +(recognized by the extension \".org\") should become links to the corresponding +HTML file, assuming that the linked Org file will also be converted to HTML. + +When nil, the links still point to the plain \".org\" file." + :group 'org-export-html + :type 'boolean) + +;;;; Links :: Inline images + +(defcustom org-html-inline-images t + "Non-nil means inline images into exported HTML pages. +This is done using an <img> tag. When nil, an anchor with href is used to +link to the image." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.1") + :type 'boolean) + +(defcustom org-html-inline-image-rules + `(("file" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg" ".webp"))) + ("http" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg" ".webp"))) + ("https" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg" ".webp")))) + "Rules characterizing image files that can be inlined into HTML. +A rule consists in an association whose key is the type of link +to consider, and value is a regexp that will be matched against +link's path." + :group 'org-export-html + :package-version '(Org . "9.5") + :type '(alist :key-type (string :tag "Type") + :value-type (regexp :tag "Path"))) + +;;;; Plain Text + +(defvar org-html-protect-char-alist + '(("&" . "&") + ("<" . "<") + (">" . ">")) + "Alist of characters to be converted by `org-html-encode-plain-text'.") + +;;;; Src Block + +(defcustom org-html-htmlize-output-type 'inline-css + "Output type to be used by htmlize when formatting code snippets. +Choices are `css' to export the CSS selectors only,`inline-css' +to export the CSS attribute values inline in the HTML or nil to +export plain text. We use as default `inline-css', in order to +make the resulting HTML self-containing. + +However, this will fail when using Emacs in batch mode for export, because +then no rich font definitions are in place. It will also not be good if +people with different Emacs setup contribute HTML files to a website, +because the fonts will represent the individual setups. In these cases, +it is much better to let Org/Htmlize assign classes only, and to use +a style file to define the look of these classes. +To get a start for your css file, start Emacs session and make sure that +all the faces you are interested in are defined, for example by loading files +in all modes you want. Then, use the command +`\\[org-html-htmlize-generate-css]' to extract class definitions." + :group 'org-export-html + :type '(choice (const css) (const inline-css) (const nil))) + +(defcustom org-html-htmlize-font-prefix "org-" + "The prefix for CSS class names for htmlize font specifications." + :group 'org-export-html + :type 'string) + +(defcustom org-html-wrap-src-lines nil + "If non-nil, wrap individual lines of source blocks in \"code\" elements. +In this case, add line number in attribute \"data-ox-html-linenr\" when line +numbers are enabled." + :group 'org-export-html + :package-version '(Org . "9.3") + :type 'boolean + :safe #'booleanp) + +;;;; Table + +(defcustom org-html-table-default-attributes + '(:border "2" :cellspacing "0" :cellpadding "6" :rules "groups" :frame "hsides") + "Default attributes and values which will be used in table tags. +This is a plist where attributes are symbols, starting with +colons, and values are strings. + +When exporting to HTML5, these values will be disregarded." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type '(plist :key-type (symbol :tag "Property") + :value-type (string :tag "Value"))) + +(defcustom org-html-table-header-tags '("<th scope=\"%s\"%s>" . "</th>") + "The opening and ending tags for table header fields. +This is customizable so that alignment options can be specified. +The first %s will be filled with the scope of the field, either row or col. +The second %s will be replaced by a style entry to align the field. +See also the variable `org-html-table-use-header-tags-for-first-column'. +See also the variable `org-html-table-align-individual-fields'." + :group 'org-export-html + :type '(cons (string :tag "Opening tag") (string :tag "Closing tag"))) + +(defcustom org-html-table-data-tags '("<td%s>" . "</td>") + "The opening and ending tags for table data fields. +This is customizable so that alignment options can be specified. +The first %s will be filled with the scope of the field, either row or col. +The second %s will be replaced by a style entry to align the field. +See also the variable `org-html-table-align-individual-fields'." + :group 'org-export-html + :type '(cons (string :tag "Opening tag") (string :tag "Closing tag"))) + +(defcustom org-html-table-row-open-tag "<tr>" + "The opening tag for table rows. +This is customizable so that alignment options can be specified. +Instead of strings, these can be a Lisp function that will be +evaluated for each row in order to construct the table row tags. + +The function will be called with these arguments: + + `number': row number (0 is the first row) + `group-number': group number of current row + `start-group?': non-nil means the row starts a group + `end-group?': non-nil means the row ends a group + `top?': non-nil means this is the top row + `bottom?': non-nil means this is the bottom row + +For example: + + (setq org-html-table-row-open-tag + (lambda (number group-number start-group? end-group-p top? bottom?) + (cond (top? \"<tr class=\\\"tr-top\\\">\") + (bottom? \"<tr class=\\\"tr-bottom\\\">\") + (t (if (= (mod number 2) 1) + \"<tr class=\\\"tr-odd\\\">\" + \"<tr class=\\\"tr-even\\\">\"))))) + +will use the \"tr-top\" and \"tr-bottom\" classes for the top row +and the bottom row, and otherwise alternate between \"tr-odd\" and +\"tr-even\" for odd and even rows." + :group 'org-export-html + :type '(choice :tag "Opening tag" + (string :tag "Specify") + (function))) + +(defcustom org-html-table-row-close-tag "</tr>" + "The closing tag for table rows. +This is customizable so that alignment options can be specified. +Instead of strings, this can be a Lisp function that will be +evaluated for each row in order to construct the table row tags. + +See documentation of `org-html-table-row-open-tag'." + :group 'org-export-html + :type '(choice :tag "Closing tag" + (string :tag "Specify") + (function))) + +(defcustom org-html-table-align-individual-fields t + "Non-nil means attach style attributes for alignment to each table field. +When nil, alignment will only be specified in the column tags, but this +is ignored by some browsers (like Firefox, Safari). Opera does it right +though." + :group 'org-export-html + :type 'boolean) + +(defcustom org-html-table-use-header-tags-for-first-column nil + "Non-nil means format column one in tables with header tags. +When nil, also column one will use data tags." + :group 'org-export-html + :type 'boolean) + +(defcustom org-html-table-caption-above t + "When non-nil, place caption string at the beginning of the table. +Otherwise, place it near the end." + :group 'org-export-html + :type 'boolean) + +;;;; Tags + +(defcustom org-html-tag-class-prefix "" + "Prefix to class names for TODO keywords. +Each tag gets a class given by the tag itself, with this prefix. +The default prefix is empty because it is nice to just use the keyword +as a class name. But if you get into conflicts with other, existing +CSS classes, then this prefix can be very useful." + :group 'org-export-html + :type 'string) + +;;;; Template :: Generic + +(defcustom org-html-extension "html" + "The extension for exported HTML files." + :group 'org-export-html + :type 'string) + +(defcustom org-html-xml-declaration + '(("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>") + ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>")) + "The extension for exported HTML files. +%s will be replaced with the charset of the exported file. +This may be a string, or an alist with export extensions +and corresponding declarations. + +This declaration only applies when exporting to XHTML." + :group 'org-export-html + :type '(choice + (string :tag "Single declaration") + (repeat :tag "Dependent on extension" + (cons (string :tag "Extension") + (string :tag "Declaration"))))) + +(defcustom org-html-coding-system 'utf-8 + "Coding system for HTML export. +Use utf-8 as the default value." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'coding-system) + +(defcustom org-html-doctype "xhtml-strict" + "Document type definition to use for exported HTML files. +Can be set with the in-buffer HTML_DOCTYPE property or for +publishing, with :html-doctype." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type (append + '(choice) + (mapcar (lambda (x) `(const ,(car x))) org-html-doctype-alist) + '((string :tag "Custom doctype" )))) + +(defcustom org-html-html5-fancy nil + "Non-nil means using new HTML5 elements. +This variable is ignored for anything other than HTML5 export." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +(defcustom org-html-container-element "div" + "HTML element to use for wrapping top level sections. +Can be set with the in-buffer HTML_CONTAINER property or for +publishing, with :html-container. + +Note that changing the default will prevent you from using +org-info.js for your website." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-html-content-class "content" + "CSS class name to use for the top level content wrapper. +Can be set with the in-buffer HTML_CONTENT_CLASS property or for +publishing, with :html-content-class." + :group 'org-export-html + :version "27.2" + :package-version '(Org . "9.5") + :type 'string) + + +(defcustom org-html-divs + '((preamble "div" "preamble") + (content "div" "content") + (postamble "div" "postamble")) + "Alist of the three section elements for HTML export. +The car of each entry is one of `preamble', `content' or `postamble'. +The cdrs of each entry are the ELEMENT_TYPE and ID for each +section of the exported document. + +Note that changing the default will prevent you from using +org-info.js for your website." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type '(list :greedy t + (list :tag "Preamble" + (const :format "" preamble) + (string :tag "element") (string :tag " id")) + (list :tag "Content" + (const :format "" content) + (string :tag "element") (string :tag " id")) + (list :tag "Postamble" (const :format "" postamble) + (string :tag " id") (string :tag "element")))) + +(defconst org-html-checkbox-types + '((unicode . + ((on . "☑") (off . "☐") (trans . "☐"))) + (ascii . + ((on . "<code>[X]</code>") + (off . "<code>[ ]</code>") + (trans . "<code>[-]</code>"))) + (html . + ((on . "<input type='checkbox' checked='checked' />") + (off . "<input type='checkbox' />") + (trans . "<input type='checkbox' />")))) + "Alist of checkbox types. +The cdr of each entry is an alist list three checkbox types for +HTML export: `on', `off' and `trans'. + +The choices are: + `unicode' Unicode characters (HTML entities) + `ascii' ASCII characters + `html' HTML checkboxes + +Note that only the ascii characters implement tri-state +checkboxes. The other two use the `off' checkbox for `trans'.") + +(defcustom org-html-checkbox-type 'ascii + "The type of checkboxes to use for HTML export. +See `org-html-checkbox-types' for the values used for each +option." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "ASCII characters" ascii) + (const :tag "Unicode characters" unicode) + (const :tag "HTML checkboxes" html))) + +(defcustom org-html-metadata-timestamp-format "%Y-%m-%d %a %H:%M" + "Format used for timestamps in preamble, postamble and metadata. +See `format-time-string' for more information on its components." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +;;;; Template :: Mathjax + +(defcustom org-html-mathjax-options + '((path "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML" ) + (scale "100") + (align "center") + (font "TeX") + (linebreaks "false") + (autonumber "AMS") + (indent "0em") + (multlinewidth "85%") + (tagindent ".8em") + (tagside "right")) + "Options for MathJax setup. + +Alist of the following elements. All values are strings. + +path The path to MathJax. +scale Scaling with HTML-CSS, MathML and SVG output engines. +align How to align display math: left, center, or right. +font The font to use with HTML-CSS and SVG output. As of MathJax 2.5 + the following values are understood: \"TeX\", \"STIX-Web\", + \"Asana-Math\", \"Neo-Euler\", \"Gyre-Pagella\", + \"Gyre-Termes\", and \"Latin-Modern\". +linebreaks Let MathJax perform automatic linebreaks. Valid values + are \"true\" and \"false\". +indent If align is not center, how far from the left/right side? + Valid values are \"left\" and \"right\" +multlinewidth The width of the multline environment. +autonumber How to number equations. Valid values are \"None\", + \"all\" and \"AMS Math\". +tagindent The amount tags are indented. +tagside Which side to show tags/labels on. Valid values are + \"left\" and \"right\" + +You can also customize this for each buffer, using something like + +#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler + +For further information about MathJax options, see the MathJax documentation: + + https://docs.mathjax.org/" + :group 'org-export-html + :package-version '(Org . "8.3") + :type '(list :greedy t + (list :tag "path (the path from where to load MathJax.js)" + (const :format " " path) (string)) + (list :tag "scale (scaling for the displayed math)" + (const :format " " scale) (string)) + (list :tag "align (alignment of displayed equations)" + (const :format " " align) (string)) + (list :tag "font (used to display math)" + (const :format " " font) + (choice (const "TeX") + (const "STIX-Web") + (const "Asana-Math") + (const "Neo-Euler") + (const "Gyre-Pagella") + (const "Gyre-Termes") + (const "Latin-Modern"))) + (list :tag "linebreaks (automatic line-breaking)" + (const :format " " linebreaks) + (choice (const "true") + (const "false"))) + (list :tag "autonumber (when should equations be numbered)" + (const :format " " autonumber) + (choice (const "AMS") + (const "None") + (const "All"))) + (list :tag "indent (indentation with left or right alignment)" + (const :format " " indent) (string)) + (list :tag "multlinewidth (width to use for the multline environment)" + (const :format " " multlinewidth) (string)) + (list :tag "tagindent (the indentation of tags from left or right)" + (const :format " " tagindent) (string)) + (list :tag "tagside (location of tags)" + (const :format " " tagside) + (choice (const "left") + (const "right"))))) + +(defcustom org-html-mathjax-template + "<script type=\"text/x-mathjax-config\"> + MathJax.Hub.Config({ + displayAlign: \"%ALIGN\", + displayIndent: \"%INDENT\", + + \"HTML-CSS\": { scale: %SCALE, + linebreaks: { automatic: \"%LINEBREAKS\" }, + webFont: \"%FONT\" + }, + SVG: {scale: %SCALE, + linebreaks: { automatic: \"%LINEBREAKS\" }, + font: \"%FONT\"}, + NativeMML: {scale: %SCALE}, + TeX: { equationNumbers: {autoNumber: \"%AUTONUMBER\"}, + MultLineWidth: \"%MULTLINEWIDTH\", + TagSide: \"%TAGSIDE\", + TagIndent: \"%TAGINDENT\" + } +}); +</script> +<script src=\"%PATH\"></script>" + "The MathJax template. See also `org-html-mathjax-options'." + :group 'org-export-html + :type 'string) + +;;;; Template :: Postamble + +(defcustom org-html-postamble 'auto + "Non-nil means insert a postamble in HTML export. + +When set to `auto', check against the +`org-export-with-author/email/creator/date' variables to set the +content of the postamble. When set to a string, use this string +as the postamble. When t, insert a string as defined by the +formatting string in `org-html-postamble-format'. + +When set to a function, apply this function and insert the +returned string. The function takes the property list of export +options as its only argument. + +Setting :html-postamble in publishing projects will take +precedence over this variable." + :group 'org-export-html + :type '(choice (const :tag "No postamble" nil) + (const :tag "Auto postamble" auto) + (const :tag "Default formatting string" t) + (string :tag "Custom formatting string") + (function :tag "Function (must return a string)"))) + +(defcustom org-html-postamble-format + '(("en" "<p class=\"author\">Author: %a (%e)</p> +<p class=\"date\">Date: %d</p> +<p class=\"creator\">%c</p> +<p class=\"validation\">%v</p>")) + "Alist of languages and format strings for the HTML postamble. + +The first element of each list is the language code, as used for +the LANGUAGE keyword. See `org-export-default-language'. + +The second element of each list is a format string to format the +postamble itself. This format string can contain these elements: + + %t stands for the title. + %s stands for the subtitle. + %a stands for the author's name. + %e stands for the author's email. + %d stands for the date. + %c will be replaced by `org-html-creator-string'. + %v will be replaced by `org-html-validation-link'. + %T will be replaced by the export time. + %C will be replaced by the last modification time. + +If you need to use a \"%\" character, you need to escape it +like that: \"%%\"." + :group 'org-export-html + :type '(repeat + (list (string :tag "Language") + (string :tag "Format string")))) + +(defcustom org-html-validation-link + "<a href=\"https://validator.w3.org/check?uri=referer\">Validate</a>" + "Link to HTML validation service." + :group 'org-export-html + :package-version '(Org . "9.4") + :type 'string) + +(defcustom org-html-creator-string + (format "<a href=\"https://www.gnu.org/software/emacs/\">Emacs</a> %s (<a href=\"https://orgmode.org\">Org</a> mode %s)" + emacs-version + (if (fboundp 'org-version) (org-version) "unknown version")) + "Information about the creator of the HTML document. +This option can also be set on with the CREATOR keyword." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type '(string :tag "Creator string")) + +;;;; Template :: Preamble + +(defcustom org-html-preamble t + "Non-nil means insert a preamble in HTML export. + +When t, insert a string as defined by the formatting string in +`org-html-preamble-format'. When set to a string, use this +formatting string instead (see `org-html-postamble-format' for an +example of such a formatting string). + +When set to a function, apply this function and insert the +returned string. The function takes the property list of export +options as its only argument. + +Setting :html-preamble in publishing projects will take +precedence over this variable." + :group 'org-export-html + :type '(choice (const :tag "No preamble" nil) + (const :tag "Default preamble" t) + (string :tag "Custom formatting string") + (function :tag "Function (must return a string)"))) + +(defcustom org-html-preamble-format '(("en" "")) + "Alist of languages and format strings for the HTML preamble. + +The first element of each list is the language code, as used for +the LANGUAGE keyword. See `org-export-default-language'. + +The second element of each list is a format string to format the +preamble itself. This format string can contain these elements: + + %t stands for the title. + %s stands for the subtitle. + %a stands for the author's name. + %e stands for the author's email. + %d stands for the date. + %c will be replaced by `org-html-creator-string'. + %v will be replaced by `org-html-validation-link'. + %T will be replaced by the export time. + %C will be replaced by the last modification time. + +If you need to use a \"%\" character, you need to escape it +like that: \"%%\". + +See the default value of `org-html-postamble-format' for an +example." + :group 'org-export-html + :type '(repeat + (list (string :tag "Language") + (string :tag "Format string")))) + +(defcustom org-html-link-up "" + "Where should the \"UP\" link of exported HTML pages lead?" + :group 'org-export-html + :type '(string :tag "File or URL")) + +(defcustom org-html-link-home "" + "Where should the \"HOME\" link of exported HTML pages lead?" + :group 'org-export-html + :type '(string :tag "File or URL")) + +(defcustom org-html-link-use-abs-url nil + "Should we prepend relative links with HTML_LINK_HOME?" + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.1") + :type 'boolean) + +(defcustom org-html-home/up-format + "<div id=\"org-div-home-and-up\"> + <a accesskey=\"h\" href=\"%s\"> UP </a> + | + <a accesskey=\"H\" href=\"%s\"> HOME </a> +</div>" + "Snippet used to insert the HOME and UP links. +This is a format string, the first %s will receive the UP link, +the second the HOME link. If both `org-html-link-up' and +`org-html-link-home' are empty, the entire snippet will be +ignored." + :group 'org-export-html + :type 'string) + +;;;; Template :: Scripts + +(defcustom org-html-head-include-scripts nil + "Non-nil means include the JavaScript snippets in exported HTML files. +The actual script is defined in `org-html-scripts'." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) + +;;;; Template :: Styles + +(defcustom org-html-meta-tags #'org-html-meta-tags-default + "Form that is used to produce meta tags in the HTML head. + +Can be a list where each item is a list of arguments to be passed +to `org-html--build-meta-entry'. Any nil items are ignored. + +Also accept a function which gives such a list when called with a +single argument (INFO, a communication plist)." + :group 'org-export-html + :package-version '(Org . "9.5") + :type '(choice + (repeat + (list (string :tag "Meta label") + (string :tag "label value") + (string :tag "Content value"))) + function)) + +(defcustom org-html-head-include-default-style t + "Non-nil means include the default style in exported HTML files. +The actual style is defined in `org-html-style-default' and +should not be modified. Use `org-html-head' to use your own +style information." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean) +;;;###autoload +(put 'org-html-head-include-default-style 'safe-local-variable 'booleanp) + +(defcustom org-html-head "" + "Org-wide head definitions for exported HTML files. + +This variable can contain the full HTML structure to provide a +style, including the surrounding HTML tags. You can consider +including definitions for the following classes: title, todo, +done, timestamp, timestamp-kwd, tag, target. + +For example, a valid value would be: + + <style> + p { font-weight: normal; color: gray; } + h1 { color: black; } + .title { text-align: center; } + .todo, .timestamp-kwd { color: red; } + .done { color: green; } + </style> + +If you want to refer to an external style, use something like + + <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\" /> + +As the value of this option simply gets inserted into the HTML +<head> header, you can use it to add any arbitrary text to the +header. + +You can set this on a per-file basis using #+HTML_HEAD:, +or for publication projects using the :html-head property." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) +;;;###autoload +(put 'org-html-head 'safe-local-variable 'stringp) + +(defcustom org-html-head-extra "" + "More head information to add in the HTML output. + +You can set this on a per-file basis using #+HTML_HEAD_EXTRA:, +or for publication projects using the :html-head-extra property." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) +;;;###autoload +(put 'org-html-head-extra 'safe-local-variable 'stringp) + +;;;; Template :: Viewport + +(defcustom org-html-viewport '((width "device-width") + (initial-scale "1") + (minimum-scale "") + (maximum-scale "") + (user-scalable "")) + "Viewport options for mobile-optimized sites. + +The following values are recognized + +width Size of the viewport. +initial-scale Zoom level when the page is first loaded. +minimum-scale Minimum allowed zoom level. +maximum-scale Maximum allowed zoom level. +user-scalable Whether zoom can be changed. + +The viewport meta tag is inserted if this variable is non-nil. + +See the following site for a reference: +https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag" + :group 'org-export-html + :version "26.1" + :package-version '(Org . "8.3") + :type '(choice (const :tag "Disable" nil) + (list :tag "Enable" + (list :tag "Width of viewport" + (const :format " " width) + (choice (const :tag "unset" "") + (string))) + (list :tag "Initial scale" + (const :format " " initial-scale) + (choice (const :tag "unset" "") + (string))) + (list :tag "Minimum scale/zoom" + (const :format " " minimum-scale) + (choice (const :tag "unset" "") + (string))) + (list :tag "Maximum scale/zoom" + (const :format " " maximum-scale) + (choice (const :tag "unset" "") + (string))) + (list :tag "User scalable/zoomable" + (const :format " " user-scalable) + (choice (const :tag "unset" "") + (const "true") + (const "false")))))) + +;; Handle source code blocks with Klipse + +(defcustom org-html-klipsify-src nil + "When non-nil, source code blocks are editable in exported presentation." + :group 'org-export-html + :package-version '(Org . "9.1") + :type 'boolean) + +(defcustom org-html-klipse-css + "https://storage.googleapis.com/app.klipse.tech/css/codemirror.css" + "Location of the codemirror CSS file for use with klipse." + :group 'org-export-html + :package-version '(Org . "9.1") + :type 'string) + +(defcustom org-html-klipse-js + "https://storage.googleapis.com/app.klipse.tech/plugin_prod/js/klipse_plugin.min.js" + "Location of the klipse javascript file." + :group 'org-export-html + :type 'string) + +(defcustom org-html-klipse-selection-script + "window.klipse_settings = {selector_eval_html: '.src-html', + selector_eval_js: '.src-js', + selector_eval_python_client: '.src-python', + selector_eval_scheme: '.src-scheme', + selector: '.src-clojure', + selector_eval_ruby: '.src-ruby'};" + "Javascript snippet to activate klipse." + :group 'org-export-html + :package-version '(Org . "9.1") + :type 'string) + + +;;;; Todos + +(defcustom org-html-todo-kwd-class-prefix "" + "Prefix to class names for TODO keywords. +Each TODO keyword gets a class given by the keyword itself, with this prefix. +The default prefix is empty because it is nice to just use the keyword +as a class name. But if you get into conflicts with other, existing +CSS classes, then this prefix can be very useful." + :group 'org-export-html + :type 'string) + + +;;; Internal Functions + +(defun org-html-xhtml-p (info) + (let ((dt (downcase (plist-get info :html-doctype)))) + (string-match-p "xhtml" dt))) + +(defun org-html-html5-p (info) + (let ((dt (downcase (plist-get info :html-doctype)))) + (member dt '("html5" "xhtml5" "<!doctype html>")))) + +(defun org-html--html5-fancy-p (info) + "Non-nil when exporting to HTML5 with fancy elements. +INFO is the current state of the export process, as a plist." + (and (plist-get info :html-html5-fancy) + (org-html-html5-p info))) + +(defun org-html-close-tag (tag attr info) + "Return close-tag for string TAG. +ATTR specifies additional attributes. INFO is a property list +containing current export state." + (concat "<" tag + (org-string-nw-p (concat " " attr)) + (if (org-html-xhtml-p info) " />" ">"))) + +(defun org-html-doctype (info) + "Return correct HTML doctype tag. +INFO is a plist used as a communication channel. Doctype tag is +extracted from `org-html-doctype-alist', or the literal value +of :html-doctype from INFO if :html-doctype is not found in the +alist." + (let ((dt (plist-get info :html-doctype))) + (or (cdr (assoc dt org-html-doctype-alist)) dt))) + +(defun org-html--make-attribute-string (attributes) + "Return a list of attributes, as a string. +ATTRIBUTES is a plist where values are either strings or nil. An +attribute with a nil value will be omitted from the result." + (let (output) + (dolist (item attributes (mapconcat 'identity (nreverse output) " ")) + (cond ((null item) (pop output)) + ((symbolp item) (push (substring (symbol-name item) 1) output)) + (t (let ((key (car output)) + (value (replace-regexp-in-string + "\"" """ (org-html-encode-plain-text item)))) + (setcar output (format "%s=\"%s\"" key value)))))))) + +(defun org-html--reference (datum info &optional named-only) + "Return an appropriate reference for DATUM. + +DATUM is an element or a `target' type object. INFO is the +current export state, as a plist. + +When NAMED-ONLY is non-nil and DATUM has no NAME keyword, return +nil. This doesn't apply to headlines, inline tasks, radio +targets and targets." + (let* ((type (org-element-type datum)) + (user-label + (org-element-property + (pcase type + ((or `headline `inlinetask) :CUSTOM_ID) + ((or `radio-target `target) :value) + (_ :name)) + datum))) + (cond + ((and user-label + (or (plist-get info :html-prefer-user-labels) + ;; Used CUSTOM_ID property unconditionally. + (memq type '(headline inlinetask)))) + user-label) + ((and named-only + (not (memq type '(headline inlinetask radio-target target))) + (not user-label)) + nil) + (t + (org-export-get-reference datum info))))) + +(defun org-html--wrap-image (contents info &optional caption label) + "Wrap CONTENTS string within an appropriate environment for images. +INFO is a plist used as a communication channel. When optional +arguments CAPTION and LABEL are given, use them for caption and +\"id\" attribute." + (let ((html5-fancy (org-html--html5-fancy-p info))) + (format (if html5-fancy "\n<figure%s>\n%s%s\n</figure>" + "\n<div%s class=\"figure\">\n%s%s\n</div>") + ;; ID. + (if (org-string-nw-p label) (format " id=\"%s\"" label) "") + ;; Contents. + (if html5-fancy contents (format "<p>%s</p>" contents)) + ;; Caption. + (if (not (org-string-nw-p caption)) "" + (format (if html5-fancy "\n<figcaption>%s</figcaption>" + "\n<p>%s</p>") + caption))))) + +(defun org-html--format-image (source attributes info) + "Return \"img\" tag with given SOURCE and ATTRIBUTES. +SOURCE is a string specifying the location of the image. +ATTRIBUTES is a plist, as returned by +`org-export-read-attribute'. INFO is a plist used as +a communication channel." + (org-html-close-tag + "img" + (org-html--make-attribute-string + (org-combine-plists + (list :src source + :alt (if (string-match-p + (concat "^" org-preview-latex-image-directory) source) + (org-html-encode-plain-text + (org-find-text-property-in-string 'org-latex-src source)) + (file-name-nondirectory source))) + (if (string= "svg" (file-name-extension source)) + (org-combine-plists '(:class "org-svg") attributes '(:fallback nil)) + attributes))) + info)) + +(defun org-html--textarea-block (element) + "Transcode ELEMENT into a textarea block. +ELEMENT is either a source or an example block." + (let* ((code (car (org-export-unravel-code element))) + (attr (org-export-read-attribute :attr_html element))) + (format "<p>\n<textarea cols=\"%s\" rows=\"%s\">\n%s</textarea>\n</p>" + (or (plist-get attr :width) 80) + (or (plist-get attr :height) (org-count-lines code)) + code))) + +(defun org-html--has-caption-p (element &optional _info) + "Non-nil when ELEMENT has a caption affiliated keyword. +INFO is a plist used as a communication channel. This function +is meant to be used as a predicate for `org-export-get-ordinal' or +a value to `org-html-standalone-image-predicate'." + (org-element-property :caption element)) + +;;;; Table + +(defun org-html-htmlize-region-for-paste (beg end) + "Convert the region between BEG and END to HTML, using htmlize.el. +This is much like `htmlize-region-for-paste', only that it uses +the settings define in the org-... variables." + (let* ((htmlize-output-type org-html-htmlize-output-type) + (htmlize-css-name-prefix org-html-htmlize-font-prefix) + (htmlbuf (htmlize-region beg end))) + (unwind-protect + (with-current-buffer htmlbuf + (buffer-substring (plist-get htmlize-buffer-places 'content-start) + (plist-get htmlize-buffer-places 'content-end))) + (kill-buffer htmlbuf)))) + +;;;###autoload +(defun org-html-htmlize-generate-css () + "Create the CSS for all font definitions in the current Emacs session. +Use this to create face definitions in your CSS style file that can then +be used by code snippets transformed by htmlize. +This command just produces a buffer that contains class definitions for all +faces used in the current Emacs session. You can copy and paste the ones you +need into your CSS file. + +If you then set `org-html-htmlize-output-type' to `css', calls +to the function `org-html-htmlize-region-for-paste' will +produce code that uses these same face definitions." + (interactive) + (unless (require 'htmlize nil t) + (error "htmlize library missing. Aborting")) + (and (get-buffer "*html*") (kill-buffer "*html*")) + (with-temp-buffer + (let ((fl (face-list)) + (htmlize-css-name-prefix "org-") + (htmlize-output-type 'css) + f i) + (while (setq f (pop fl) + i (and f (face-attribute f :inherit))) + (when (and (symbolp f) (or (not i) (not (listp i)))) + (insert (org-add-props (copy-sequence "1") nil 'face f)))) + (htmlize-region (point-min) (point-max)))) + (pop-to-buffer-same-window "*html*") + (goto-char (point-min)) + (when (re-search-forward "<style" nil t) + (delete-region (point-min) (match-beginning 0))) + (when (re-search-forward "</style>" nil t) + (delete-region (1+ (match-end 0)) (point-max))) + (beginning-of-line 1) + (when (looking-at " +") (replace-match "")) + (goto-char (point-min))) + +(defun org-html--make-string (n string) + "Build a string by concatenating N times STRING." + (let (out) (dotimes (_ n out) (setq out (concat string out))))) + +(defun org-html-fix-class-name (kwd) ; audit callers of this function + "Turn todo keyword KWD into a valid class name. +Replaces invalid characters with \"_\"." + (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" kwd nil t)) + +(defun org-html-footnote-section (info) + "Format the footnote section. +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 + "\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")))))) + + +;;; Template + +(defun org-html-meta-tags-default (info) + "A default value for `org-html-meta-tags'. + +Generate a list items, each of which is a list of arguments that can +be passed to `org-html--build-meta-entry', to generate meta tags to be +included in the HTML head. + +Use document's plist INFO to derive relevant information for the tags." + (let ((author (and (plist-get info :with-author) + (let ((auth (plist-get info :author))) + ;; Return raw Org syntax. + (and auth (org-element-interpret-data auth)))))) + (list + (when (org-string-nw-p author) + (list "name" "author" author)) + (when (org-string-nw-p (plist-get info :description)) + (list "name" "description" + (plist-get info :description))) + (when (org-string-nw-p (plist-get info :keywords)) + (list "name" "keywords" (plist-get info :keywords))) + '("name" "generator" "Org Mode")))) + +(defun org-html--build-meta-entry + (label identity &optional content-format &rest content-formatters) + "Build a meta tag using the provided information. + +Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT +is present: <meta LABEL=\"IDENTITY\" content=\"{content}\" /> + +Here {content} is determined by applying any CONTENT-FORMATTERS to the +CONTENT-FORMAT and encoding the result as plain text." + (concat "<meta " + (format "%s=\"%s" label identity) + (when content-format + (concat "\" content=\"" + (replace-regexp-in-string + "\"" """ + (org-html-encode-plain-text + (if content-formatters + (apply #'format content-format content-formatters) + content-format))))) + "\" />\n")) + +(defun org-html--build-meta-info (info) + "Return meta tags for exported document. +INFO is a plist used as a communication channel." + (let* ((title (org-html-plain-text + (org-element-interpret-data (plist-get info :title)) info)) + ;; Set title to an invisible character instead of leaving it + ;; empty, which is invalid. + (title (if (org-string-nw-p title) title "‎")) + (charset (or (and org-html-coding-system + (fboundp 'coding-system-get) + (symbol-name + (coding-system-get org-html-coding-system + 'mime-charset))) + "iso-8859-1"))) + (concat + (when (plist-get info :time-stamp-file) + (format-time-string + (concat "<!-- " + (plist-get info :html-metadata-timestamp-format) + " -->\n"))) + + (if (org-html-html5-p info) + (org-html--build-meta-entry "charset" charset) + (org-html--build-meta-entry "http-equiv" "Content-Type" + (concat "text/html;charset=" charset))) + + (let ((viewport-options + (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell))) + (plist-get info :html-viewport)))) + (if viewport-options + (org-html--build-meta-entry "name" "viewport" + (mapconcat + (lambda (elm) + (format "%s=%s" (car elm) (cadr elm))) + viewport-options ", ")))) + + (format "<title>%s\n" title) + + (mapconcat + (lambda (args) (apply #'org-html--build-meta-entry args)) + (delq nil (if (functionp org-html-meta-tags) + (funcall org-html-meta-tags info) + org-html-meta-tags)) + "")))) + +(defun org-html--build-head (info) + "Return information for the .. of the HTML output. +INFO is a plist used as a communication channel." + (org-element-normalize-string + (concat + (when (plist-get info :html-head-include-default-style) + (org-element-normalize-string org-html-style-default)) + (org-element-normalize-string (plist-get info :html-head)) + (org-element-normalize-string (plist-get info :html-head-extra)) + (when (and (plist-get info :html-htmlized-css-url) + (eq org-html-htmlize-output-type 'css)) + (org-html-close-tag "link" + (format "rel=\"stylesheet\" href=\"%s\" type=\"text/css\"" + (plist-get info :html-htmlized-css-url)) + info)) + (when (plist-get info :html-head-include-scripts) org-html-scripts)))) + +(defun org-html--build-mathjax-config (info) + "Insert the user setup into the mathjax template. +INFO is a plist used as a communication channel." + (when (and (memq (plist-get info :with-latex) '(mathjax t)) + (org-element-map (plist-get info :parse-tree) + '(latex-fragment latex-environment) #'identity info t nil t)) + (let ((template (plist-get info :html-mathjax-template)) + (options (plist-get info :html-mathjax-options)) + (in-buffer (or (plist-get info :html-mathjax) ""))) + (dolist (e options (org-element-normalize-string template)) + (let ((name (car e)) + (val (nth 1 e))) + (when (string-match (concat "\\<" (symbol-name name) ":") in-buffer) + (setq val + (car (read-from-string (substring in-buffer (match-end 0)))))) + (unless (stringp val) (setq val (format "%s" val))) + (while (string-match (concat "%" (upcase (symbol-name name))) + template) + (setq template (replace-match val t t template)))))))) + +(defun org-html-format-spec (info) + "Return format specification for preamble and postamble. +INFO is a plist used as a communication channel." + (let ((timestamp-format (plist-get info :html-metadata-timestamp-format))) + `((?t . ,(org-export-data (plist-get info :title) info)) + (?s . ,(org-export-data (plist-get info :subtitle) info)) + (?d . ,(org-export-data (org-export-get-date info timestamp-format) + info)) + (?T . ,(format-time-string timestamp-format)) + (?a . ,(org-export-data (plist-get info :author) info)) + (?e . ,(mapconcat + (lambda (e) (format "%s" e e)) + (split-string (plist-get info :email) ",+ *") + ", ")) + (?c . ,(plist-get info :creator)) + (?C . ,(let ((file (plist-get info :input-file))) + (format-time-string timestamp-format + (and file (file-attribute-modification-time + (file-attributes file)))))) + (?v . ,(or (plist-get info :html-validation-link) ""))))) + +(defun org-html--build-pre/postamble (type info) + "Return document preamble or postamble as a string, or nil. +TYPE is either `preamble' or `postamble', INFO is a plist used as a +communication channel." + (let ((section (plist-get info (intern (format ":html-%s" type)))) + (spec (org-html-format-spec info))) + (when section + (let ((section-contents + (if (functionp section) (funcall section info) + (cond + ((stringp section) (format-spec section spec)) + ((eq section 'auto) + (let ((date (cdr (assq ?d spec))) + (author (cdr (assq ?a spec))) + (email (cdr (assq ?e spec))) + (creator (cdr (assq ?c spec))) + (validation-link (cdr (assq ?v spec)))) + (concat + (and (plist-get info :with-date) + (org-string-nw-p date) + (format "

%s: %s

\n" + (org-html--translate "Date" info) + date)) + (and (plist-get info :with-author) + (org-string-nw-p author) + (format "

%s: %s

\n" + (org-html--translate "Author" info) + author)) + (and (plist-get info :with-email) + (org-string-nw-p email) + (format "

%s: %s

\n" + (org-html--translate "Email" info) + email)) + (and (plist-get info :time-stamp-file) + (format + "

%s: %s

\n" + (org-html--translate "Created" info) + (format-time-string + (plist-get info :html-metadata-timestamp-format)))) + (and (plist-get info :with-creator) + (org-string-nw-p creator) + (format "

%s

\n" creator)) + (and (org-string-nw-p validation-link) + (format "

%s

\n" + validation-link))))) + (t + (let ((formats (plist-get info (if (eq type 'preamble) + :html-preamble-format + :html-postamble-format))) + (language (plist-get info :language))) + (format-spec + (cadr (or (assoc-string language formats t) + (assoc-string "en" formats t))) + spec))))))) + (let ((div (assq type (plist-get info :html-divs)))) + (when (org-string-nw-p section-contents) + (concat + (format "<%s id=\"%s\" class=\"%s\">\n" + (nth 1 div) + (nth 2 div) + org-html--pre/postamble-class) + (org-element-normalize-string section-contents) + (format "\n" (nth 1 div))))))))) + +(defun org-html-inner-template (contents info) + "Return body of document string after HTML conversion. +CONTENTS is the transcoded contents string. INFO is a plist +holding export options." + (concat + ;; Table of contents. + (let ((depth (plist-get info :with-toc))) + (when depth (org-html-toc depth info))) + ;; Document contents. + contents + ;; Footnotes section. + (org-html-footnote-section info))) + +(defun org-html-template (contents info) + "Return complete document string after HTML conversion. +CONTENTS is the transcoded contents string. INFO is a plist +holding export options." + (concat + (when (and (not (org-html-html5-p info)) (org-html-xhtml-p info)) + (let* ((xml-declaration (plist-get info :html-xml-declaration)) + (decl (or (and (stringp xml-declaration) xml-declaration) + (cdr (assoc (plist-get info :html-extension) + xml-declaration)) + (cdr (assoc "html" xml-declaration)) + ""))) + (when (not (or (not decl) (string= "" decl))) + (format "%s\n" + (format decl + (or (and org-html-coding-system + (fboundp 'coding-system-get) + (coding-system-get org-html-coding-system 'mime-charset)) + "iso-8859-1")))))) + (org-html-doctype info) + "\n" + (concat "\n") + "\n" + (org-html--build-meta-info info) + (org-html--build-head info) + (org-html--build-mathjax-config info) + "\n" + "\n" + (let ((link-up (org-trim (plist-get info :html-link-up))) + (link-home (org-trim (plist-get info :html-link-home)))) + (unless (and (string= link-up "") (string= link-home "")) + (format (plist-get info :html-home/up-format) + (or link-up link-home) + (or link-home link-up)))) + ;; Preamble. + (org-html--build-pre/postamble 'preamble info) + ;; Document contents. + (let ((div (assq 'content (plist-get info :html-divs)))) + (format "<%s id=\"%s\" class=\"%s\">\n" + (nth 1 div) + (nth 2 div) + (plist-get info :html-content-class))) + ;; Document title. + (when (plist-get info :with-title) + (let ((title (and (plist-get info :with-title) + (plist-get info :title))) + (subtitle (plist-get info :subtitle)) + (html5-fancy (org-html--html5-fancy-p info))) + (when title + (format + (if html5-fancy + "
\n

%s

\n%s
" + "

%s%s

\n") + (org-export-data title info) + (if subtitle + (format + (if html5-fancy + "

%s

\n" + (concat "\n" (org-html-close-tag "br" nil info) "\n" + "%s\n")) + (org-export-data subtitle info)) + ""))))) + contents + (format "\n" (nth 1 (assq 'content (plist-get info :html-divs)))) + ;; Postamble. + (org-html--build-pre/postamble 'postamble info) + ;; Possibly use the Klipse library live code blocks. + (when (plist-get info :html-klipsify-src) + (concat "")) + ;; Closing document. + "\n")) + +(defun org-html--translate (s info) + "Translate string S according to specified language. +INFO is a plist used as a communication channel." + (org-export-translate s :html info)) + +;;;; Anchor + +(defun org-html--anchor (id desc attributes info) + "Format a HTML anchor." + (let* ((name (and (plist-get info :html-allow-name-attribute-in-anchors) id)) + (attributes (concat (and id (format " id=\"%s\"" id)) + (and name (format " name=\"%s\"" name)) + attributes))) + (format "%s" attributes (or desc "")))) + +;;;; Todo + +(defun org-html--todo (todo info) + "Format TODO keywords into HTML." + (when todo + (format "%s" + (if (member todo org-done-keywords) "done" "todo") + (or (plist-get info :html-todo-kwd-class-prefix) "") + (org-html-fix-class-name todo) + todo))) + +;;;; Priority + +(defun org-html--priority (priority _info) + "Format a priority into HTML. +PRIORITY is the character code of the priority or nil. INFO is +a plist containing export options." + (and priority (format "[%c]" priority))) + +;;;; Tags + +(defun org-html--tags (tags info) + "Format TAGS into HTML. +INFO is a plist containing export options." + (when tags + (format "%s" + (mapconcat + (lambda (tag) + (format "%s" + (concat (plist-get info :html-tag-class-prefix) + (org-html-fix-class-name tag)) + tag)) + tags " ")))) + +;;;; Src Code + +(defun org-html-fontify-code (code lang) + "Color CODE with htmlize library. +CODE is a string representing the source code to colorize. LANG +is the language used for CODE, as a string, or nil." + (when code + (cond + ;; No language. Possibly an example block. + ((not lang) (org-html-encode-plain-text code)) + ;; Plain text explicitly set. + ((not org-html-htmlize-output-type) (org-html-encode-plain-text code)) + ;; No htmlize library or an inferior version of htmlize. + ((not (progn (require 'htmlize nil t) + (fboundp 'htmlize-region-for-paste))) + ;; Emit a warning. + (message "Cannot fontify source block (htmlize.el >= 1.34 required)") + (org-html-encode-plain-text code)) + (t + ;; Map language + (setq lang (or (assoc-default lang org-src-lang-modes) lang)) + (let* ((lang-mode (and lang (intern (format "%s-mode" lang))))) + (cond + ;; Case 1: Language is not associated with any Emacs mode + ((not (functionp lang-mode)) + (org-html-encode-plain-text code)) + ;; Case 2: Default. Fontify code. + (t + ;; htmlize + (setq code + (let ((output-type org-html-htmlize-output-type) + (font-prefix org-html-htmlize-font-prefix) + (inhibit-read-only t)) + (with-temp-buffer + ;; Switch to language-specific mode. + (funcall lang-mode) + (insert code) + ;; Fontify buffer. + (org-font-lock-ensure) + ;; Remove formatting on newline characters. + (save-excursion + (let ((beg (point-min)) + (end (point-max))) + (goto-char beg) + (while (progn (end-of-line) (< (point) end)) + (put-text-property (point) (1+ (point)) 'face nil) + (forward-char 1)))) + (org-src-mode) + (set-buffer-modified-p nil) + ;; Htmlize region. + (let ((org-html-htmlize-output-type output-type) + (org-html-htmlize-font-prefix font-prefix)) + (org-html-htmlize-region-for-paste + (point-min) (point-max)))))) + ;; Strip any enclosing
 tags.
+	  (let* ((beg (and (string-match "\\`]*>\n?" code) (match-end 0)))
+		 (end (and beg (string-match "\\'" code))))
+	    (if (and beg end) (substring code beg end) code)))))))))
+
+(defun org-html-do-format-code
+    (code &optional lang refs retain-labels num-start wrap-lines)
+  "Format CODE string as source code.
+Optional arguments LANG, REFS, RETAIN-LABELS, NUM-START, WRAP-LINES
+are, respectively, the language of the source code, as a string, an
+alist between line numbers and references (as returned by
+`org-export-unravel-code'), a boolean specifying if labels should
+appear in the source code, the number associated to the first
+line of code, and a boolean specifying if lines of code should be
+wrapped in code elements."
+  (let* ((code-lines (split-string code "\n"))
+	 (code-length (length code-lines))
+	 (num-fmt
+	  (and num-start
+	       (format "%%%ds: "
+		       (length (number-to-string (+ code-length num-start))))))
+	 (code (org-html-fontify-code code lang)))
+    (org-export-format-code
+     code
+     (lambda (loc line-num ref)
+       (setq loc
+	     (concat
+	      ;; Add line number, if needed.
+	      (when num-start
+		(format "%s"
+			(format num-fmt line-num)))
+	      ;; Transcoded src line.
+	      (if wrap-lines
+		  (format "%s"
+			  (if num-start
+                              (format " data-ox-html-linenr=\"%s\"" line-num)
+                            "")
+			  loc)
+		loc)
+	      ;; Add label, if needed.
+	      (when (and ref retain-labels) (format " (%s)" ref))))
+       ;; Mark transcoded line as an anchor, if needed.
+       (if (not ref) loc
+	 (format "%s"
+		 ref loc)))
+     num-start refs)))
+
+(defun org-html-format-code (element info)
+  "Format contents of ELEMENT as source code.
+ELEMENT is either an example or a source block.  INFO is a plist
+used as a communication channel."
+  (let* ((lang (org-element-property :language element))
+	 ;; Extract code and references.
+	 (code-info (org-export-unravel-code element))
+	 (code (car code-info))
+	 (refs (cdr code-info))
+	 ;; Does the source block contain labels?
+	 (retain-labels (org-element-property :retain-labels element))
+	 ;; Does it have line numbers?
+	 (num-start (org-export-get-loc element info))
+	 ;; Should lines be wrapped in code elements?
+	 (wrap-lines (plist-get info :html-wrap-src-lines)))
+    (org-html-do-format-code code lang refs retain-labels num-start wrap-lines)))
+
+
+;;; Tables of Contents
+
+(defun org-html-toc (depth info &optional scope)
+  "Build a table of contents.
+DEPTH is an integer specifying the depth of the table.  INFO is
+a plist used as a communication channel.  Optional argument SCOPE
+is an element defining the scope of the table.  Return the table
+of contents as a string, or nil if it is empty."
+  (let ((toc-entries
+	 (mapcar (lambda (headline)
+		   (cons (org-html--format-toc-headline headline info)
+			 (org-export-get-relative-level headline info)))
+		 (org-export-collect-headlines info depth scope))))
+    (when toc-entries
+      (let ((toc (concat "
" + (org-html--toc-text toc-entries) + "
\n"))) + (if scope toc + (let ((outer-tag (if (org-html--html5-fancy-p info) + "nav" + "div"))) + (concat (format "<%s id=\"table-of-contents\" role=\"doc-toc\">\n" outer-tag) + (let ((top-level (plist-get info :html-toplevel-hlevel))) + (format "%s\n" + top-level + (org-html--translate "Table of Contents" info) + top-level)) + toc + (format "\n" outer-tag)))))))) + +(defun org-html--toc-text (toc-entries) + "Return innards of a table of contents, as a string. +TOC-ENTRIES is an alist where key is an entry title, as a string, +and value is its relative level, as an integer." + (let* ((prev-level (1- (cdar toc-entries))) + (start-level prev-level)) + (concat + (mapconcat + (lambda (entry) + (let ((headline (car entry)) + (level (cdr entry))) + (concat + (let* ((cnt (- level prev-level)) + (times (if (> cnt 0) (1- cnt) (- cnt)))) + (setq prev-level level) + (concat + (org-html--make-string + times (cond ((> cnt 0) "\n
    \n
  • ") + ((< cnt 0) "
  • \n
\n"))) + (if (> cnt 0) "\n
    \n
  • " "
  • \n
  • "))) + headline))) + toc-entries "") + (org-html--make-string (- prev-level start-level) "
  • \n
\n")))) + +(defun org-html--format-toc-headline (headline info) + "Return an appropriate table of contents entry for HEADLINE. +INFO is a plist used as a communication channel." + (let* ((headline-number (org-export-get-headline-number headline info)) + (todo (and (plist-get info :with-todo-keywords) + (let ((todo (org-element-property :todo-keyword headline))) + (and todo (org-export-data todo info))))) + (todo-type (and todo (org-element-property :todo-type headline))) + (priority (and (plist-get info :with-priority) + (org-element-property :priority headline))) + (text (org-export-data-with-backend + (org-export-get-alt-title headline info) + (org-export-toc-entry-backend 'html) + info)) + (tags (and (eq (plist-get info :with-tags) t) + (org-export-get-tags headline info)))) + (format "%s" + ;; Label. + (org-html--reference headline info) + ;; Body. + (concat + (and (not (org-export-low-level-p headline info)) + (org-export-numbered-headline-p headline info) + (concat (mapconcat #'number-to-string headline-number ".") + ". ")) + (apply (plist-get info :html-format-headline-function) + todo todo-type priority text tags :section-number nil))))) + +(defun org-html-list-of-listings (info) + "Build a list of listings. +INFO is a plist used as a communication channel. Return the list +of listings as a string, or nil if it is empty." + (let ((lol-entries (org-export-collect-listings info))) + (when lol-entries + (concat "
\n" + (let ((top-level (plist-get info :html-toplevel-hlevel))) + (format "%s\n" + top-level + (org-html--translate "List of Listings" info) + top-level)) + "
\n
    \n" + (let ((count 0) + (initial-fmt (format "%s" + (org-html--translate "Listing %d:" info)))) + (mapconcat + (lambda (entry) + (let ((label (org-html--reference entry info t)) + (title (org-trim + (org-export-data + (or (org-export-get-caption entry t) + (org-export-get-caption entry)) + info)))) + (concat + "
  • " + (if (not label) + (concat (format initial-fmt (cl-incf count)) + " " + title) + (format "%s %s" + label + (format initial-fmt (cl-incf count)) + title)) + "
  • "))) + lol-entries "\n")) + "\n
\n
\n
")))) + +(defun org-html-list-of-tables (info) + "Build a list of tables. +INFO is a plist used as a communication channel. Return the list +of tables as a string, or nil if it is empty." + (let ((lol-entries (org-export-collect-tables info))) + (when lol-entries + (concat "
\n" + (let ((top-level (plist-get info :html-toplevel-hlevel))) + (format "%s\n" + top-level + (org-html--translate "List of Tables" info) + top-level)) + "
\n
    \n" + (let ((count 0) + (initial-fmt (format "%s" + (org-html--translate "Table %d:" info)))) + (mapconcat + (lambda (entry) + (let ((label (org-html--reference entry info t)) + (title (org-trim + (org-export-data + (or (org-export-get-caption entry t) + (org-export-get-caption entry)) + info)))) + (concat + "
  • " + (if (not label) + (concat (format initial-fmt (cl-incf count)) + " " + title) + (format "%s %s" + label + (format initial-fmt (cl-incf count)) + title)) + "
  • "))) + lol-entries "\n")) + "\n
\n
\n
")))) + + +;;; Transcode Functions + +;;;; Bold + +(defun org-html-bold (_bold contents info) + "Transcode BOLD from Org to HTML. +CONTENTS is the text with bold markup. INFO is a plist holding +contextual information." + (format (or (cdr (assq 'bold (plist-get info :html-text-markup-alist))) "%s") + contents)) + +;;;; Center Block + +(defun org-html-center-block (_center-block contents _info) + "Transcode a CENTER-BLOCK element from Org to HTML. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + (format "
\n%s
" contents)) + +;;;; Clock + +(defun org-html-clock (clock _contents _info) + "Transcode a CLOCK element from Org to HTML. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (format "

+ +%s %s%s + +

" + org-clock-string + (org-timestamp-translate (org-element-property :value clock)) + (let ((time (org-element-property :duration clock))) + (and time (format " (%s)" time))))) + +;;;; Code + +(defun org-html-code (code _contents info) + "Transcode CODE from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual +information." + (format (or (cdr (assq 'code (plist-get info :html-text-markup-alist))) "%s") + (org-html-encode-plain-text (org-element-property :value code)))) + +;;;; Drawer + +(defun org-html-drawer (drawer contents info) + "Transcode a DRAWER element from Org to HTML. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + (funcall (plist-get info :html-format-drawer-function) + (org-element-property :drawer-name drawer) + contents)) + +;;;; Dynamic Block + +(defun org-html-dynamic-block (_dynamic-block contents _info) + "Transcode a DYNAMIC-BLOCK element from Org to HTML. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information. See `org-export-data'." + contents) + +;;;; Entity + +(defun org-html-entity (entity _contents _info) + "Transcode an ENTITY object from Org to HTML. +CONTENTS are the definition itself. INFO is a plist holding +contextual information." + (org-element-property :html entity)) + +;;;; Example Block + +(defun org-html-example-block (example-block _contents info) + "Transcode a EXAMPLE-BLOCK element from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual +information." + (let ((attributes (org-export-read-attribute :attr_html example-block))) + (if (plist-get attributes :textarea) + (org-html--textarea-block example-block) + (format "
\n%s
" + (let* ((reference (org-html--reference example-block info)) + (a (org-html--make-attribute-string + (if (or (not reference) (plist-member attributes :id)) + attributes + (plist-put attributes :id reference))))) + (if (org-string-nw-p a) (concat " " a) "")) + (org-html-format-code example-block info))))) + +;;;; Export Snippet + +(defun org-html-export-snippet (export-snippet _contents _info) + "Transcode a EXPORT-SNIPPET object from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual +information." + (when (eq (org-export-snippet-backend export-snippet) 'html) + (org-element-property :value export-snippet))) + +;;;; Export Block + +(defun org-html-export-block (export-block _contents _info) + "Transcode a EXPORT-BLOCK element from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual information." + (when (string= (org-element-property :type export-block) "HTML") + (org-remove-indentation (org-element-property :value export-block)))) + +;;;; Fixed Width + +(defun org-html-fixed-width (fixed-width _contents _info) + "Transcode a FIXED-WIDTH element from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual information." + (format "
\n%s
" + (org-html-do-format-code + (org-remove-indentation + (org-element-property :value fixed-width))))) + +;;;; Footnote Reference + +(defun org-html-footnote-reference (footnote-reference _contents info) + "Transcode a FOOTNOTE-REFERENCE element from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual information." + (concat + ;; Insert separator between two footnotes in a row. + (let ((prev (org-export-get-previous-element footnote-reference info))) + (when (eq (org-element-type 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 + (if (org-export-footnote-first-reference-p + footnote-reference info) + "" + ".100")))) + (format + (plist-get info :html-footnote-format) + (org-html--anchor + id n (format " class=\"footref\" href=\"#fn.%d\" role=\"doc-backlink\"" n) info))))) + +;;;; Headline + +(defun org-html-headline (headline contents info) + "Transcode a HEADLINE element from Org to HTML. +CONTENTS holds the contents of the headline. INFO is a plist +holding contextual information." + (unless (org-element-property :footnote-section-p headline) + (let* ((numberedp (org-export-numbered-headline-p headline info)) + (numbers (org-export-get-headline-number headline info)) + (level (+ (org-export-get-relative-level headline info) + (1- (plist-get info :html-toplevel-hlevel)))) + (todo (and (plist-get info :with-todo-keywords) + (let ((todo (org-element-property :todo-keyword headline))) + (and todo (org-export-data todo info))))) + (todo-type (and todo (org-element-property :todo-type headline))) + (priority (and (plist-get info :with-priority) + (org-element-property :priority headline))) + (text (org-export-data (org-element-property :title headline) info)) + (tags (and (plist-get info :with-tags) + (org-export-get-tags headline info))) + (full-text (funcall (plist-get info :html-format-headline-function) + todo todo-type priority text tags info)) + (contents (or contents "")) + (id (org-html--reference headline info)) + (formatted-text + (if (plist-get info :html-self-link-headlines) + (format "%s" id full-text) + full-text))) + (if (org-export-low-level-p headline info) + ;; This is a deep sub-tree: export it as a list item. + (let* ((html-type (if numberedp "ol" "ul"))) + (concat + (and (org-export-first-sibling-p headline info) + (apply #'format "<%s class=\"org-%s\">\n" + (make-list 2 html-type))) + (org-html-format-list-item + contents (if numberedp 'ordered 'unordered) + nil info nil + (concat (org-html--anchor id nil nil info) formatted-text)) "\n" + (and (org-export-last-sibling-p headline info) + (format "\n" html-type)))) + ;; Standard headline. Export it as a section. + (let ((extra-class + (org-element-property :HTML_CONTAINER_CLASS headline)) + (headline-class + (org-element-property :HTML_HEADLINE_CLASS headline)) + (first-content (car (org-element-contents headline)))) + (format "<%s id=\"%s\" class=\"%s\">%s%s\n" + (org-html--container headline info) + (format "outline-container-%s" id) + (concat (format "outline-%d" level) + (and extra-class " ") + extra-class) + (format "\n%s\n" + level + id + (if (not headline-class) "" + (format " class=\"%s\"" headline-class)) + (concat + (and numberedp + (format + "%s " + level + (concat (mapconcat #'number-to-string numbers ".") "."))) + formatted-text) + level) + ;; When there is no section, pretend there is an + ;; empty one to get the correct
%s" lang label code))) + +;;;; Inlinetask + +(defun org-html-inlinetask (inlinetask contents info) + "Transcode an INLINETASK element from Org to HTML. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + (let* ((todo (and (plist-get info :with-todo-keywords) + (let ((todo (org-element-property :todo-keyword inlinetask))) + (and todo (org-export-data todo info))))) + (todo-type (and todo (org-element-property :todo-type inlinetask))) + (priority (and (plist-get info :with-priority) + (org-element-property :priority inlinetask))) + (text (org-export-data (org-element-property :title inlinetask) info)) + (tags (and (plist-get info :with-tags) + (org-export-get-tags inlinetask info)))) + (funcall (plist-get info :html-format-inlinetask-function) + todo todo-type priority text tags contents info))) + +(defun org-html-format-inlinetask-default-function + (todo todo-type priority text tags contents info) + "Default format function for inlinetasks. +See `org-html-format-inlinetask-function' for details." + (format "
\n%s%s\n%s
" + (org-html-format-headline-default-function + todo todo-type priority text tags info) + (org-html-close-tag "br" nil info) + contents)) + +;;;; Italic + +(defun org-html-italic (_italic contents info) + "Transcode ITALIC from Org to HTML. +CONTENTS is the text with italic markup. INFO is a plist holding +contextual information." + (format + (or (cdr (assq 'italic (plist-get info :html-text-markup-alist))) "%s") + contents)) + +;;;; Item + +(defun org-html-checkbox (checkbox info) + "Format CHECKBOX into HTML. +INFO is a plist holding contextual information. See +`org-html-checkbox-type' for customization options." + (cdr (assq checkbox + (cdr (assq (plist-get info :html-checkbox-type) + org-html-checkbox-types))))) + +(defun org-html-format-list-item (contents type checkbox info + &optional term-counter-id + headline) + "Format a list item into HTML." + (let ((class (if checkbox + (format " class=\"%s\"" + (symbol-name checkbox)) "")) + (checkbox (concat (org-html-checkbox checkbox info) + (and checkbox " "))) + (br (org-html-close-tag "br" nil info)) + (extra-newline (if (and (org-string-nw-p contents) headline) "\n" ""))) + (concat + (pcase type + (`ordered + (let* ((counter term-counter-id) + (extra (if counter (format " value=\"%s\"" counter) ""))) + (concat + (format "" class extra) + (when headline (concat headline br))))) + (`unordered + (let* ((id term-counter-id) + (extra (if id (format " id=\"%s\"" id) ""))) + (concat + (format "" class extra) + (when headline (concat headline br))))) + (`descriptive + (let* ((term term-counter-id)) + (setq term (or term "(no term)")) + ;; Check-boxes in descriptive lists are associated to tag. + (concat (format "%s" + class (concat checkbox term)) + "
")))) + (unless (eq type 'descriptive) checkbox) + extra-newline + (and (org-string-nw-p contents) (org-trim contents)) + extra-newline + (pcase type + (`ordered "") + (`unordered "") + (`descriptive "
"))))) + +(defun org-html-item (item contents info) + "Transcode an ITEM element from Org to HTML. +CONTENTS holds the contents of the item. INFO is a plist holding +contextual information." + (let* ((plain-list (org-export-get-parent item)) + (type (org-element-property :type plain-list)) + (counter (org-element-property :counter item)) + (checkbox (org-element-property :checkbox item)) + (tag (let ((tag (org-element-property :tag item))) + (and tag (org-export-data tag info))))) + (org-html-format-list-item + contents type checkbox info (or tag counter)))) + +;;;; Keyword + +(defun org-html-keyword (keyword _contents info) + "Transcode a KEYWORD element from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual information." + (let ((key (org-element-property :key keyword)) + (value (org-element-property :value keyword))) + (cond + ((string= key "HTML") value) + ((string= key "TOC") + (let ((case-fold-search t)) + (cond + ((string-match "\\" value) + (let ((depth (and (string-match "\\<[0-9]+\\>" value) + (string-to-number (match-string 0 value)))) + (scope + (cond + ((string-match ":target +\\(\".+?\"\\|\\S-+\\)" value) ;link + (org-export-resolve-link + (org-strip-quotes (match-string 1 value)) info)) + ((string-match-p "\\" value) keyword)))) ;local + (org-html-toc depth info scope))) + ((string= "listings" value) (org-html-list-of-listings info)) + ((string= "tables" value) (org-html-list-of-tables info)))))))) + +;;;; Latex Environment + +(defun org-html-format-latex (latex-frag processing-type info) + "Format a LaTeX fragment LATEX-FRAG into HTML. +PROCESSING-TYPE designates the tool used for conversion. It can +be `mathjax', `verbatim', `html', nil, t or symbols in +`org-preview-latex-process-alist', e.g., `dvipng', `dvisvgm' or +`imagemagick'. See `org-html-with-latex' for more information. +INFO is a plist containing export properties." + (let ((cache-relpath "") (cache-dir "")) + (unless (or (eq processing-type 'mathjax) + (eq processing-type 'html)) + (let ((bfn (or (buffer-file-name) + (make-temp-name + (expand-file-name "latex" temporary-file-directory)))) + (latex-header + (let ((header (plist-get info :latex-header))) + (and header + (concat (mapconcat + (lambda (line) (concat "#+LATEX_HEADER: " line)) + (org-split-string header "\n") + "\n") + "\n"))))) + (setq cache-relpath + (concat (file-name-as-directory org-preview-latex-image-directory) + (file-name-sans-extension + (file-name-nondirectory bfn))) + cache-dir (file-name-directory bfn)) + ;; Re-create LaTeX environment from original buffer in + ;; temporary buffer so that dvipng/imagemagick can properly + ;; turn the fragment into an image. + (setq latex-frag (concat latex-header latex-frag)))) + (with-temp-buffer + (insert latex-frag) + (org-format-latex cache-relpath nil nil cache-dir nil + "Creating LaTeX Image..." nil processing-type) + (buffer-string)))) + +(defun org-html--wrap-latex-environment (contents _ &optional caption label) + "Wrap CONTENTS string within appropriate environment for equations. +When optional arguments CAPTION and LABEL are given, use them for +caption and \"id\" attribute." + (format "\n\n%s%s\n
" + ;; ID. + (if (org-string-nw-p label) (format " id=\"%s\"" label) "") + ;; Contents. + (format "\n%s\n" contents) + ;; Caption. + (if (not (org-string-nw-p caption)) "" + (format "\n\n%s\n" + caption)))) + +(defun org-html--math-environment-p (element &optional _) + "Non-nil when ELEMENT is a LaTeX math environment. +Math environments match the regular expression defined in +`org-latex-math-environments-re'. This function is meant to be +used as a predicate for `org-export-get-ordinal' or a value to +`org-html-standalone-image-predicate'." + (string-match-p org-latex-math-environments-re + (org-element-property :value element))) + +(defun org-html--latex-environment-numbered-p (element) + "Non-nil when ELEMENT contains a numbered LaTeX math environment. +Starred and \"displaymath\" environments are not numbered." + (not (string-match-p "\\`[ \t]*\\\\begin{\\(.*\\*\\|displaymath\\)}" + (org-element-property :value element)))) + +(defun org-html--unlabel-latex-environment (latex-frag) + "Change environment in LATEX-FRAG string to an unnumbered one. +For instance, change an 'equation' environment to 'equation*'." + (replace-regexp-in-string + "\\`[ \t]*\\\\begin{\\([^*]+?\\)}" + "\\1*" + (replace-regexp-in-string "^[ \t]*\\\\end{\\([^*]+?\\)}[ \r\t\n]*\\'" + "\\1*" + latex-frag nil nil 1) + nil nil 1)) + +(defun org-html-latex-environment (latex-environment _contents info) + "Transcode a LATEX-ENVIRONMENT element from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual information." + (let ((processing-type (plist-get info :with-latex)) + (latex-frag (org-remove-indentation + (org-element-property :value latex-environment))) + (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) + (number-to-string + (org-export-get-ordinal + latex-environment info nil + (lambda (l _) + (and (org-html--math-environment-p l) + (org-html--latex-environment-numbered-p l)))))))) + (cond + ((memq processing-type '(t mathjax)) + (org-html-format-latex + (if (org-string-nw-p label) + (replace-regexp-in-string "\\`.*" + (format "\\&\n\\\\label{%s}" label) + latex-frag) + latex-frag) + 'mathjax info)) + ((assq processing-type org-preview-latex-process-alist) + (let ((formula-link + (org-html-format-latex + (org-html--unlabel-latex-environment latex-frag) + processing-type info))) + (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link)) + (let ((source (org-export-file-uri (match-string 1 formula-link)))) + (org-html--wrap-latex-environment + (org-html--format-image source attributes info) + info caption label))))) + (t (org-html--wrap-latex-environment latex-frag info caption label))))) + +;;;; Latex Fragment + +(defun org-html-latex-fragment (latex-fragment _contents info) + "Transcode a LATEX-FRAGMENT object from Org to HTML. +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 + ((memq processing-type '(t mathjax)) + (org-html-format-latex latex-frag 'mathjax info)) + ((memq processing-type '(t html)) + (org-html-format-latex latex-frag 'html info)) + ((assq processing-type org-preview-latex-process-alist) + (let ((formula-link + (org-html-format-latex latex-frag processing-type info))) + (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link)) + (let ((source (org-export-file-uri (match-string 1 formula-link)))) + (org-html--format-image source nil info))))) + (t latex-frag)))) + +;;;; Line Break + +(defun org-html-line-break (_line-break _contents info) + "Transcode a LINE-BREAK object from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual information." + (concat (org-html-close-tag "br" nil info) "\n")) + +;;;; Link + +(defun org-html-image-link-filter (data _backend info) + (org-export-insert-image-links data info org-html-inline-image-rules)) + +(defun org-html-inline-image-p (link info) + "Non-nil when LINK is meant to appear as an image. +INFO is a plist used as a communication channel. LINK is an +inline image when it has no description and targets an image +file (see `org-html-inline-image-rules' for more information), or +if its description is a single link targeting an image file." + (if (not (org-element-contents link)) + (org-export-inline-image-p + link (plist-get info :html-inline-image-rules)) + (not + (let ((link-count 0)) + (org-element-map (org-element-contents link) + (cons 'plain-text org-element-all-objects) + (lambda (obj) + (pcase (org-element-type obj) + (`plain-text (org-string-nw-p obj)) + (`link (if (= link-count 1) t + (cl-incf link-count) + (not (org-export-inline-image-p + obj (plist-get info :html-inline-image-rules))))) + (_ t))) + info t))))) + +(defvar org-html-standalone-image-predicate) +(defun org-html-standalone-image-p (element info) + "Non-nil if ELEMENT is a standalone image. + +INFO is a plist holding contextual information. + +An element or object is a standalone image when + + - its type is `paragraph' and its sole content, save for white + spaces, is a link that qualifies as an inline image; + + - its type is `link' and its containing paragraph has no other + content save white spaces. + +Bind `org-html-standalone-image-predicate' to constrain paragraph +further. For example, to check for only captioned standalone +images, set it to: + + (lambda (paragraph) (org-element-property :caption paragraph))" + (let ((paragraph (pcase (org-element-type element) + (`paragraph element) + (`link (org-export-get-parent element))))) + (and (eq (org-element-type paragraph) 'paragraph) + (or (not (and (boundp 'org-html-standalone-image-predicate) + (fboundp org-html-standalone-image-predicate))) + (funcall org-html-standalone-image-predicate paragraph)) + (catch 'exit + (let ((link-count 0)) + (org-element-map (org-element-contents paragraph) + (cons 'plain-text org-element-all-objects) + (lambda (obj) + (when (pcase (org-element-type obj) + (`plain-text (org-string-nw-p obj)) + (`link (or (> (cl-incf link-count) 1) + (not (org-html-inline-image-p obj info)))) + (_ t)) + (throw 'exit nil))) + info nil 'link) + (= link-count 1)))))) + +(defun org-html-link (link desc info) + "Transcode a LINK object from Org to HTML. +DESC is the description part of the link, or the empty string. +INFO is a plist holding contextual information. See +`org-export-data'." + (let* ((html-ext (plist-get info :html-extension)) + (dot (when (> (length html-ext) 0) ".")) + (link-org-files-as-html-maybe + (lambda (raw-path info) + ;; Treat links to `file.org' as links to `file.html', if + ;; needed. See `org-html-link-org-files-as-html'. + (cond + ((and (plist-get info :html-link-org-files-as-html) + (string= ".org" + (downcase (file-name-extension raw-path ".")))) + (concat (file-name-sans-extension raw-path) dot html-ext)) + (t raw-path)))) + (type (org-element-property :type link)) + (raw-path (org-element-property :path link)) + ;; Ensure DESC really exists, or set it to nil. + (desc (org-string-nw-p desc)) + (path + (cond + ((member type '("http" "https" "ftp" "mailto" "news")) + (url-encode-url (concat type ":" raw-path))) + ((string= "file" type) + ;; During publishing, turn absolute file names belonging + ;; to base directory into relative file names. Otherwise, + ;; append "file" protocol to absolute file name. + (setq raw-path + (org-export-file-uri + (org-publish-file-relative-name raw-path info))) + ;; Possibly append `:html-link-home' to relative file + ;; name. + (let ((home (and (plist-get info :html-link-home) + (org-trim (plist-get info :html-link-home))))) + (when (and home + (plist-get info :html-link-use-abs-url) + (file-name-absolute-p raw-path)) + (setq raw-path (concat (file-name-as-directory home) raw-path)))) + ;; Maybe turn ".org" into ".html". + (setq raw-path (funcall link-org-files-as-html-maybe raw-path info)) + ;; Add search option, if any. A search option can be + ;; relative to a custom-id, a headline title, a name or + ;; a target. + (let ((option (org-element-property :search-option link))) + (if (not option) raw-path + (let ((path (org-element-property :path link))) + (concat raw-path + "#" + (org-publish-resolve-external-link option path t)))))) + (t raw-path))) + (attributes-plist + (org-combine-plists + ;; Extract attributes from parent's paragraph. HACK: Only + ;; do this for the first link in parent (inner image link + ;; for inline images). This is needed as long as + ;; attributes cannot be set on a per link basis. + (let* ((parent (org-export-get-parent-element link)) + (link (let ((container (org-export-get-parent link))) + (if (and (eq 'link (org-element-type container)) + (org-html-inline-image-p link info)) + container + link)))) + (and (eq link (org-element-map parent 'link #'identity info t)) + (org-export-read-attribute :attr_html parent))) + ;; Also add attributes from link itself. Currently, those + ;; need to be added programmatically before `org-html-link' + ;; is invoked, for example, by backends building upon HTML + ;; export. + (org-export-read-attribute :attr_html link))) + (attributes + (let ((attr (org-html--make-attribute-string attributes-plist))) + (if (org-string-nw-p attr) (concat " " attr) "")))) + (cond + ;; Link type is handled by a special function. + ((org-export-custom-protocol-maybe link desc 'html info)) + ;; Image file. + ((and (plist-get info :html-inline-images) + (org-export-inline-image-p + link (plist-get info :html-inline-image-rules))) + (org-html--format-image path attributes-plist info)) + ;; Radio target: Transcode target's contents and use them as + ;; link's description. + ((string= type "radio") + (let ((destination (org-export-resolve-radio-link link info))) + (if (not destination) desc + (format "%s" + (org-export-get-reference destination info) + attributes + desc)))) + ;; Links pointing to a headline: Find destination and build + ;; appropriate referencing command. + ((member type '("custom-id" "fuzzy" "id")) + (let ((destination (if (string= type "fuzzy") + (org-export-resolve-fuzzy-link link info) + (org-export-resolve-id-link link info)))) + (pcase (org-element-type destination) + ;; ID link points to an external file. + (`plain-text + (let ((fragment (concat "ID-" path)) + ;; Treat links to ".org" files as ".html", if needed. + (path (funcall link-org-files-as-html-maybe + destination info))) + (format "%s" + path fragment attributes (or desc destination)))) + ;; Fuzzy link points nowhere. + (`nil + (format "%s" + (or desc + (org-export-data + (org-element-property :raw-link link) info)))) + ;; Link points to a headline. + (`headline + (let ((href (org-html--reference destination info)) + ;; What description to use? + (desc + ;; Case 1: Headline is numbered and LINK has no + ;; description. Display section number. + (if (and (org-export-numbered-headline-p destination info) + (not desc)) + (mapconcat #'number-to-string + (org-export-get-headline-number + destination info) ".") + ;; Case 2: Either the headline is un-numbered or + ;; LINK has a custom description. Display LINK's + ;; description or headline's title. + (or desc + (org-export-data + (org-element-property :title destination) info))))) + (format "%s" href attributes desc))) + ;; Fuzzy link points to a target or an element. + (_ + (if (and destination + (memq (plist-get info :with-latex) '(mathjax t)) + (eq 'latex-environment (org-element-type destination)) + (eq 'math (org-latex--environment-type destination))) + ;; Caption and labels are introduced within LaTeX + ;; environment. Use "ref" or "eqref" macro, depending on user + ;; preference to refer to those in the document. + (format (plist-get info :html-equation-reference-format) + (org-html--reference destination info)) + (let* ((ref (org-html--reference destination info)) + (org-html-standalone-image-predicate + #'org-html--has-caption-p) + (counter-predicate + (if (eq 'latex-environment (org-element-type destination)) + #'org-html--math-environment-p + #'org-html--has-caption-p)) + (number + (cond + (desc nil) + ((org-html-standalone-image-p destination info) + (org-export-get-ordinal + (org-element-map destination 'link #'identity info t) + info 'link 'org-html-standalone-image-p)) + (t (org-export-get-ordinal + destination info nil counter-predicate)))) + (desc + (cond (desc) + ((not number) "No description for this link") + ((numberp number) (number-to-string number)) + (t (mapconcat #'number-to-string number "."))))) + (format "%s" ref attributes desc))))))) + ;; Coderef: replace link with the reference name or the + ;; equivalent line number. + ((string= type "coderef") + (let ((fragment (concat "coderef-" (org-html-encode-plain-text path)))) + (format "%s" + fragment + (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, \ +'%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\"" + fragment fragment) + attributes + (format (org-export-get-coderef-format path desc) + (org-export-resolve-coderef path info))))) + ;; External link with a description part. + ((and path desc) + (format "%s" + (org-html-encode-plain-text path) + attributes + desc)) + ;; External link without a description part. + (path + (let ((path (org-html-encode-plain-text path))) + (format "%s" path attributes path))) + ;; No path, only description. Try to do something useful. + (t + (format "%s" desc))))) + +;;;; Node Property + +(defun org-html-node-property (node-property _contents _info) + "Transcode a NODE-PROPERTY element from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual +information." + (format "%s:%s" + (org-element-property :key node-property) + (let ((value (org-element-property :value node-property))) + (if value (concat " " value) "")))) + +;;;; Paragraph + +(defun org-html-paragraph (paragraph contents info) + "Transcode a PARAGRAPH element from Org to HTML. +CONTENTS is the contents of the paragraph, as a string. INFO is +the plist used as a communication channel." + (let* ((parent (org-export-get-parent paragraph)) + (parent-type (org-element-type parent)) + (style '((footnote-definition " class=\"footpara\"") + (org-data " class=\"footpara\""))) + (attributes (org-html--make-attribute-string + (org-export-read-attribute :attr_html paragraph))) + (extra (or (cadr (assq parent-type style)) ""))) + (cond + ((and (eq parent-type 'item) + (not (org-export-get-previous-element paragraph info)) + (let ((followers (org-export-get-next-element paragraph info 2))) + (and (not (cdr followers)) + (memq (org-element-type (car followers)) '(nil plain-list))))) + ;; First paragraph in an item has no tag if it is alone or + ;; followed, at most, by a sub-list. + contents) + ((org-html-standalone-image-p paragraph info) + ;; Standalone image. + (let ((caption + (let ((raw (org-export-data + (org-export-get-caption paragraph) info)) + (org-html-standalone-image-predicate + #'org-html--has-caption-p)) + (if (not (org-string-nw-p raw)) raw + (concat "" + (format (org-html--translate "Figure %d:" info) + (org-export-get-ordinal + (org-element-map paragraph 'link + #'identity info t) + info nil #'org-html-standalone-image-p)) + " " + raw)))) + (label (org-html--reference paragraph info))) + (org-html--wrap-image contents info caption label))) + ;; Regular paragraph. + (t (format "\n%s

" + (if (org-string-nw-p attributes) + (concat " " attributes) "") + extra contents))))) + +;;;; Plain List + +(defun org-html-plain-list (plain-list contents _info) + "Transcode a PLAIN-LIST element from Org to HTML. +CONTENTS is the contents of the list. INFO is a plist holding +contextual information." + (let* ((type (pcase (org-element-property :type plain-list) + (`ordered "ol") + (`unordered "ul") + (`descriptive "dl") + (other (error "Unknown HTML list type: %s" other)))) + (class (format "org-%s" type)) + (attributes (org-export-read-attribute :attr_html plain-list))) + (format "<%s %s>\n%s" + type + (org-html--make-attribute-string + (plist-put attributes :class + (org-trim + (mapconcat #'identity + (list class (plist-get attributes :class)) + " ")))) + contents + type))) + +;;;; Plain Text + +(defun org-html-convert-special-strings (string) + "Convert special characters in STRING to HTML." + (dolist (a org-html-special-string-regexps string) + (let ((re (car a)) + (rpl (cdr a))) + (setq string (replace-regexp-in-string re rpl string t))))) + +(defun org-html-encode-plain-text (text) + "Convert plain text characters from TEXT to HTML equivalent. +Possible conversions are set in `org-html-protect-char-alist'." + (dolist (pair org-html-protect-char-alist text) + (setq text (replace-regexp-in-string (car pair) (cdr pair) text t t)))) + +(defun org-html-plain-text (text info) + "Transcode a TEXT string from Org to HTML. +TEXT is the string to transcode. INFO is a plist holding +contextual information." + (let ((output text)) + ;; Protect following characters: <, >, &. + (setq output (org-html-encode-plain-text output)) + ;; Handle smart quotes. Be sure to provide original string since + ;; OUTPUT may have been modified. + (when (plist-get info :with-smart-quotes) + (setq output (org-export-activate-smart-quotes output :html info text))) + ;; Handle special strings. + (when (plist-get info :with-special-strings) + (setq output (org-html-convert-special-strings output))) + ;; Handle break preservation if required. + (when (plist-get info :preserve-breaks) + (setq output + (replace-regexp-in-string + "\\(\\\\\\\\\\)?[ \t]*\n" + (concat (org-html-close-tag "br" nil info) "\n") output))) + ;; Return value. + output)) + + +;; Planning + +(defun org-html-planning (planning _contents info) + "Transcode a PLANNING element from Org to HTML. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (format + "

%s

" + (org-trim + (mapconcat + (lambda (pair) + (let ((timestamp (cdr pair))) + (when timestamp + (let ((string (car pair))) + (format "%s \ +%s " + string + (org-html-plain-text (org-timestamp-translate timestamp) + info)))))) + `((,org-closed-string . ,(org-element-property :closed planning)) + (,org-deadline-string . ,(org-element-property :deadline planning)) + (,org-scheduled-string . ,(org-element-property :scheduled planning))) + "")))) + +;;;; Property Drawer + +(defun org-html-property-drawer (_property-drawer contents _info) + "Transcode a PROPERTY-DRAWER element from Org to HTML. +CONTENTS holds the contents of the drawer. INFO is a plist +holding contextual information." + (and (org-string-nw-p contents) + (format "
\n%s
" contents))) + +;;;; Quote Block + +(defun org-html-quote-block (quote-block contents info) + "Transcode a QUOTE-BLOCK element from Org to HTML. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + (format "\n%s" + (let* ((reference (org-html--reference quote-block info t)) + (attributes (org-export-read-attribute :attr_html quote-block)) + (a (org-html--make-attribute-string + (if (or (not reference) (plist-member attributes :id)) + attributes + (plist-put attributes :id reference))))) + (if (org-string-nw-p a) (concat " " a) "")) + contents)) + +;;;; Section + +(defun org-html-section (section contents info) + "Transcode a SECTION element from Org to HTML. +CONTENTS holds the contents of the section. INFO is a plist +holding contextual information." + (let ((parent (org-export-get-parent-headline section))) + ;; Before first headline: no container, just return CONTENTS. + (if (not parent) contents + ;; Get div's class and id references. + (let* ((class-num (+ (org-export-get-relative-level parent info) + (1- (plist-get info :html-toplevel-hlevel)))) + (section-number + (and (org-export-numbered-headline-p parent info) + (mapconcat + #'number-to-string + (org-export-get-headline-number parent info) "-")))) + ;; Build return value. + (format "
\n%s
\n" + class-num + (or (org-element-property :CUSTOM_ID parent) + section-number + (org-export-get-reference parent info)) + (or contents "")))))) + +;;;; Radio Target + +(defun org-html-radio-target (radio-target text info) + "Transcode a RADIO-TARGET object from Org to HTML. +TEXT is the text of the target. INFO is a plist holding +contextual information." + (let ((ref (org-html--reference radio-target info))) + (org-html--anchor ref text nil info))) + +;;;; Special Block + +(defun org-html-special-block (special-block contents info) + "Transcode a SPECIAL-BLOCK element from Org to HTML. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + (let* ((block-type (org-element-property :type special-block)) + (html5-fancy (and (org-html--html5-fancy-p info) + (member block-type org-html-html5-elements))) + (attributes (org-export-read-attribute :attr_html special-block))) + (unless html5-fancy + (let ((class (plist-get attributes :class))) + (setq attributes (plist-put attributes :class + (if class (concat class " " block-type) + block-type))))) + (let* ((contents (or contents "")) + (reference (org-html--reference special-block info)) + (a (org-html--make-attribute-string + (if (or (not reference) (plist-member attributes :id)) + attributes + (plist-put attributes :id reference)))) + (str (if (org-string-nw-p a) (concat " " a) ""))) + (if html5-fancy + (format "<%s%s>\n%s" block-type str contents block-type) + (format "\n%s\n" str contents))))) + +;;;; Src Block + +(defun org-html-src-block (src-block _contents info) + "Transcode a SRC-BLOCK element from Org to HTML. +CONTENTS holds the contents of the item. INFO is a plist holding +contextual information." + (if (org-export-read-attribute :attr_html src-block :textarea) + (org-html--textarea-block src-block) + (let* ((lang (org-element-property :language src-block)) + (code (org-html-format-code src-block info)) + (label (let ((lbl (org-html--reference src-block info t))) + (if lbl (format " id=\"%s\"" lbl) ""))) + (klipsify (and (plist-get info :html-klipsify-src) + (member lang '("javascript" "js" + "ruby" "scheme" "clojure" "php" "html"))))) + (if (not lang) (format "
\n%s
" label code) + (format "
\n%s%s\n
" + ;; Build caption. + (let ((caption (org-export-get-caption src-block))) + (if (not caption) "" + (let ((listing-number + (format + "%s " + (format + (org-html--translate "Listing %d:" info) + (org-export-get-ordinal + src-block info nil #'org-html--has-caption-p))))) + (format "" + listing-number + (org-trim (org-export-data caption info)))))) + ;; Contents. + (if klipsify + (format "
%s
" + lang + label + (if (string= lang "html") + " data-editor-type=\"html\"" + "") + code) + (format "
%s
" + lang label code))))))) + +;;;; Statistics Cookie + +(defun org-html-statistics-cookie (statistics-cookie _contents _info) + "Transcode a STATISTICS-COOKIE object from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual information." + (let ((cookie-value (org-element-property :value statistics-cookie))) + (format "%s" cookie-value))) + +;;;; Strike-Through + +(defun org-html-strike-through (_strike-through contents info) + "Transcode STRIKE-THROUGH from Org to HTML. +CONTENTS is the text with strike-through markup. INFO is a plist +holding contextual information." + (format + (or (cdr (assq 'strike-through (plist-get info :html-text-markup-alist))) + "%s") + contents)) + +;;;; Subscript + +(defun org-html-subscript (_subscript contents _info) + "Transcode a SUBSCRIPT object from Org to HTML. +CONTENTS is the contents of the object. INFO is a plist holding +contextual information." + (format "%s" contents)) + +;;;; Superscript + +(defun org-html-superscript (_superscript contents _info) + "Transcode a SUPERSCRIPT object from Org to HTML. +CONTENTS is the contents of the object. INFO is a plist holding +contextual information." + (format "%s" contents)) + +;;;; Table Cell + +(defun org-html-table-cell (table-cell contents info) + "Transcode a TABLE-CELL element from Org to HTML. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (let* ((table-row (org-export-get-parent table-cell)) + (table (org-export-get-parent-table table-cell)) + (cell-attrs + (if (not (plist-get info :html-table-align-individual-fields)) "" + (format (if (and (boundp 'org-html-format-table-no-css) + org-html-format-table-no-css) + " align=\"%s\"" " class=\"org-%s\"") + (org-export-table-cell-alignment table-cell info))))) + (when (or (not contents) (string= "" (org-trim contents))) + (setq contents " ")) + (cond + ((and (org-export-table-has-header-p table info) + (= 1 (org-export-table-row-group table-row info))) + (let ((header-tags (plist-get info :html-table-header-tags))) + (concat "\n" (format (car header-tags) "col" cell-attrs) + contents + (cdr header-tags)))) + ((and (plist-get info :html-table-use-header-tags-for-first-column) + (zerop (cdr (org-export-table-cell-address table-cell info)))) + (let ((header-tags (plist-get info :html-table-header-tags))) + (concat "\n" (format (car header-tags) "row" cell-attrs) + contents + (cdr header-tags)))) + (t (let ((data-tags (plist-get info :html-table-data-tags))) + (concat "\n" (format (car data-tags) cell-attrs) + contents + (cdr data-tags))))))) + +;;;; Table Row + +(defun org-html-table-row (table-row contents info) + "Transcode a TABLE-ROW element from Org to HTML. +CONTENTS is the contents of the row. INFO is a plist used as a +communication channel." + ;; Rules are ignored since table separators are deduced from + ;; borders of the current row. + (when (eq (org-element-property :type table-row) 'standard) + (let* ((group (org-export-table-row-group table-row info)) + (number (org-export-table-row-number table-row info)) + (start-group-p + (org-export-table-row-starts-rowgroup-p table-row info)) + (end-group-p + (org-export-table-row-ends-rowgroup-p table-row info)) + (topp (and (equal start-group-p '(top)) + (equal end-group-p '(below top)))) + (bottomp (and (equal start-group-p '(above)) + (equal end-group-p '(bottom above)))) + (row-open-tag + (pcase (plist-get info :html-table-row-open-tag) + ((and accessor (pred functionp)) + (funcall accessor + number group start-group-p end-group-p topp bottomp)) + (accessor accessor))) + (row-close-tag + (pcase (plist-get info :html-table-row-close-tag) + ((and accessor (pred functionp)) + (funcall accessor + number group start-group-p end-group-p topp bottomp)) + (accessor accessor))) + (group-tags + (cond + ;; Row belongs to second or subsequent groups. + ((not (= 1 group)) '("" . "\n")) + ;; Row is from first group. Table has >=1 groups. + ((org-export-table-has-header-p + (org-export-get-parent-table table-row) info) + '("" . "\n")) + ;; Row is from first and only group. + (t '("" . "\n"))))) + (concat (and start-group-p (car group-tags)) + (concat "\n" + row-open-tag + contents + "\n" + row-close-tag) + (and end-group-p (cdr group-tags)))))) + +;;;; Table + +(defun org-html-table-first-row-data-cells (table info) + "Transcode the first row of TABLE. +INFO is a plist used as a communication channel." + (let ((table-row + (org-element-map table 'table-row + (lambda (row) + (unless (eq (org-element-property :type row) 'rule) row)) + info 'first-match)) + (special-column-p (org-export-table-has-special-column-p table))) + (if (not special-column-p) (org-element-contents table-row) + (cdr (org-element-contents table-row))))) + +(defun org-html-table--table.el-table (table _info) + "Format table.el tables into HTML. +INFO is a plist used as a communication channel." + (when (eq (org-element-property :type table) 'table.el) + (require 'table) + (let ((outbuf (with-current-buffer + (get-buffer-create "*org-export-table*") + (erase-buffer) (current-buffer)))) + (with-temp-buffer + (insert (org-element-property :value table)) + (goto-char 1) + (re-search-forward "^[ \t]*|[^|]" nil t) + (table-generate-source 'html outbuf)) + (with-current-buffer outbuf + (prog1 (org-trim (buffer-string)) + (kill-buffer) ))))) + +(defun org-html-table (table contents info) + "Transcode a TABLE element from Org to HTML. +CONTENTS is the contents of the table. INFO is a plist holding +contextual information." + (if (eq (org-element-property :type table) 'table.el) + ;; "table.el" table. Convert it using appropriate tools. + (org-html-table--table.el-table table info) + ;; Standard table. + (let* ((caption (org-export-get-caption table)) + (number (org-export-get-ordinal + table info nil #'org-html--has-caption-p)) + (attributes + (org-html--make-attribute-string + (org-combine-plists + (list :id (org-html--reference table info t)) + (and (not (org-html-html5-p info)) + (plist-get info :html-table-attributes)) + (org-export-read-attribute :attr_html table)))) + (alignspec + (if (bound-and-true-p org-html-format-table-no-css) + "align=\"%s\"" + "class=\"org-%s\"")) + (table-column-specs + (lambda (table info) + (mapconcat + (lambda (table-cell) + (let ((alignment (org-export-table-cell-alignment + table-cell info))) + (concat + ;; Begin a colgroup? + (when (org-export-table-cell-starts-colgroup-p + table-cell info) + "\n") + ;; Add a column. Also specify its alignment. + (format "\n%s" + (org-html-close-tag + "col" (concat " " (format alignspec alignment)) info)) + ;; End a colgroup? + (when (org-export-table-cell-ends-colgroup-p + table-cell info) + "\n")))) + (org-html-table-first-row-data-cells table info) "\n")))) + (format "\n%s\n%s\n%s" + (if (equal attributes "") "" (concat " " attributes)) + (if (not caption) "" + (format (if (plist-get info :html-table-caption-above) + "%s" + "%s") + (concat + "" + (format (org-html--translate "Table %d:" info) number) + " " (org-export-data caption info)))) + (funcall table-column-specs table info) + contents)))) + +;;;; Target + +(defun org-html-target (target _contents info) + "Transcode a TARGET object from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual +information." + (let ((ref (org-html--reference target info))) + (org-html--anchor ref nil nil info))) + +;;;; Timestamp + +(defun org-html-timestamp (timestamp _contents info) + "Transcode a TIMESTAMP object from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual +information." + (let ((value (org-html-plain-text (org-timestamp-translate timestamp) info))) + (format "%s" + (replace-regexp-in-string "--" "–" value)))) + +;;;; Underline + +(defun org-html-underline (_underline contents info) + "Transcode UNDERLINE from Org to HTML. +CONTENTS is the text with underline markup. INFO is a plist +holding contextual information." + (format (or (cdr (assq 'underline (plist-get info :html-text-markup-alist))) + "%s") + contents)) + +;;;; Verbatim + +(defun org-html-verbatim (verbatim _contents info) + "Transcode VERBATIM from Org to HTML. +CONTENTS is nil. INFO is a plist holding contextual +information." + (format (or (cdr (assq 'verbatim (plist-get info :html-text-markup-alist))) "%s") + (org-html-encode-plain-text (org-element-property :value verbatim)))) + +;;;; Verse Block + +(defun org-html-verse-block (_verse-block contents info) + "Transcode a VERSE-BLOCK element from Org to HTML. +CONTENTS is verse block contents. INFO is a plist holding +contextual information." + (format "

\n%s

" + ;; Replace leading white spaces with non-breaking spaces. + (replace-regexp-in-string + "^[ \t]+" (lambda (m) (org-html--make-string (length m) " ")) + ;; Replace each newline character with line break. Also + ;; remove any trailing "br" close-tag so as to avoid + ;; duplicates. + (let* ((br (org-html-close-tag "br" nil info)) + (re (format "\\(?:%s\\)?[ \t]*\n" (regexp-quote br)))) + (replace-regexp-in-string re (concat br "\n") contents))))) + + +;;; Filter Functions + +(defun org-html-final-function (contents _backend info) + "Filter to indent the HTML and convert HTML entities." + (with-temp-buffer + (insert contents) + (set-auto-mode t) + (when (plist-get info :html-indent) + (indent-region (point-min) (point-max))) + (buffer-substring-no-properties (point-min) (point-max)))) + + +;;; End-user functions + +;;;###autoload +(defun org-html-export-as-html + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer to an HTML buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\" and \"\" tags. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org HTML Export*\", which +will be displayed when `org-export-show-temporary-export-buffer' +is non-nil." + (interactive) + (org-export-to-buffer 'html "*Org HTML Export*" + async subtreep visible-only body-only ext-plist + (lambda () (set-auto-mode t)))) + +;;;###autoload +(defun org-html-convert-region-to-html () + "Assume the current region has Org syntax, and convert it to HTML. +This can be used in any buffer. For example, you can write an +itemized list in Org syntax in an HTML buffer and use this command +to convert it." + (interactive) + (org-export-replace-region-by 'html)) + +;;;###autoload +(defun org-html-export-to-html + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer to a HTML file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\" and \"\" tags. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file's name." + (interactive) + (let* ((extension (concat + (when (> (length org-html-extension) 0) ".") + (or (plist-get ext-plist :html-extension) + org-html-extension + "html"))) + (file (org-export-output-file-name extension subtreep)) + (org-export-coding-system org-html-coding-system)) + (org-export-to-file 'html file + async subtreep visible-only body-only ext-plist))) + +;;;###autoload +(defun org-html-publish-to-html (plist filename pub-dir) + "Publish an org file to HTML. + +FILENAME is the filename of the Org file to be published. PLIST +is the property list for the given project. PUB-DIR is the +publishing directory. + +Return output file name." + (org-publish-org-to 'html filename + (concat (when (> (length org-html-extension) 0) ".") + (or (plist-get plist :html-extension) + org-html-extension + "html")) + plist pub-dir)) + + +(provide 'ox-html) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; ox-html.el ends here diff --git a/elpa/org-9.5.2/ox-html.elc b/elpa/org-9.5.2/ox-html.elc new file mode 100644 index 0000000..a081038 Binary files /dev/null and b/elpa/org-9.5.2/ox-html.elc differ diff --git a/elpa/org-9.5.2/ox-icalendar.el b/elpa/org-9.5.2/ox-icalendar.el new file mode 100644 index 0000000..16c3dc9 --- /dev/null +++ b/elpa/org-9.5.2/ox-icalendar.el @@ -0,0 +1,1031 @@ +;;; ox-icalendar.el --- iCalendar Back-End for Org Export Engine -*- lexical-binding: t; -*- + +;; Copyright (C) 2004-2021 Free Software Foundation, Inc. + +;; Author: Carsten Dominik +;; Nicolas Goaziou +;; Maintainer: Nicolas Goaziou +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: https://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: +;; +;; This library implements an iCalendar back-end for Org generic +;; exporter. See Org manual for more information. +;; +;; It is expected to conform to RFC 5545. + +;;; Code: + +(require 'cl-lib) +(require 'org-agenda) +(require 'ox-ascii) +(declare-function org-bbdb-anniv-export-ical "ol-bbdb" nil) + + + +;;; User-Configurable Variables + +(defgroup org-export-icalendar nil + "Options specific for iCalendar export back-end." + :tag "Org Export iCalendar" + :group 'org-export) + +(defcustom org-icalendar-combined-agenda-file "~/org.ics" + "The file name for the iCalendar file covering all agenda files. +This file is created with the command `\\[org-icalendar-combine-agenda-files]'. +The file name should be absolute. It will be overwritten without warning." + :group 'org-export-icalendar + :type 'file) + +(defcustom org-icalendar-alarm-time 0 + "Number of minutes for triggering an alarm for exported timed events. + +A zero value (the default) turns off the definition of an alarm trigger +for timed events. If non-zero, alarms are created. + +- a single alarm per entry is defined +- The alarm will go off N minutes before the event +- only a DISPLAY action is defined." + :group 'org-export-icalendar + :version "24.1" + :type 'integer) + +(defcustom org-icalendar-combined-name "OrgMode" + "Calendar name for the combined iCalendar representing all agenda files." + :group 'org-export-icalendar + :type 'string) + +(defcustom org-icalendar-combined-description "" + "Calendar description for the combined iCalendar (all agenda files)." + :group 'org-export-icalendar + :type 'string) + +(defcustom org-icalendar-exclude-tags nil + "Tags that exclude a tree from export. +This variable allows specifying different exclude tags from other +back-ends. It can also be set with the ICALENDAR_EXCLUDE_TAGS +keyword." + :group 'org-export-icalendar + :type '(repeat (string :tag "Tag"))) + +(defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due) + "Contexts where iCalendar export should use a deadline time stamp. + +This is a list with possibly several symbols in it. Valid symbols are: + +`event-if-todo' + + Deadlines in TODO entries become calendar events. + +`event-if-todo-not-done' + + Deadlines in TODO entries with not-DONE state become events. + +`event-if-not-todo' + + Deadlines in non-TODO entries become calendar events. + +`todo-due' + + Use deadlines in TODO entries as due-dates." + :group 'org-export-icalendar + :type + '(set :greedy t + (const :tag "DEADLINE in non-TODO entries become events" + event-if-not-todo) + (const :tag "DEADLINE in TODO entries become events" + event-if-todo) + (const :tag "DEADLINE in TODO entries with not-DONE state become events" + event-if-todo-not-done) + (const :tag "DEADLINE in TODO entries become due-dates" + todo-due))) + +(defcustom org-icalendar-use-scheduled '(todo-start) + "Contexts where iCalendar export should use a scheduling time stamp. + +This is a list with possibly several symbols in it. Valid symbols are: + +`event-if-todo' + + Scheduling time stamps in TODO entries become an event. + +`event-if-todo-not-done' + + Scheduling time stamps in TODO entries with not-DONE state + become events. + +`event-if-not-todo' + + Scheduling time stamps in non-TODO entries become an event. + +`todo-start' + + Scheduling time stamps in TODO entries become start date. Some + calendar applications show TODO entries only after that date." + :group 'org-export-icalendar + :type + '(set :greedy t + (const :tag "SCHEDULED timestamps in non-TODO entries become events" + event-if-not-todo) + (const :tag "SCHEDULED timestamps in TODO entries become events" + event-if-todo) + (const :tag "SCHEDULED in TODO entries with not-DONE state become events" + event-if-todo-not-done) + (const :tag "SCHEDULED in TODO entries become start date" + todo-start))) + +(defcustom org-icalendar-categories '(local-tags category) + "Items that should be entered into the \"categories\" field. + +This is a list of symbols, the following are valid: +`category' The Org mode category of the current file or tree +`todo-state' The todo state, if any +`local-tags' The tags, defined in the current line +`all-tags' All tags, including inherited ones." + :group 'org-export-icalendar + :type '(repeat + (choice + (const :tag "The file or tree category" category) + (const :tag "The TODO state" todo-state) + (const :tag "Tags defined in current line" local-tags) + (const :tag "All tags, including inherited ones" all-tags)))) + +(defcustom org-icalendar-with-timestamps 'active + "Non-nil means make an event from plain time stamps. + +It can be set to `active', `inactive', t or nil, in order to make +an event from, respectively, only active timestamps, only +inactive ones, all of them or none. + +This variable has precedence over `org-export-with-timestamps'. +It can also be set with the #+OPTIONS line, e.g. \"<:t\"." + :group 'org-export-icalendar + :type '(choice + (const :tag "All timestamps" t) + (const :tag "Only active timestamps" active) + (const :tag "Only inactive timestamps" inactive) + (const :tag "No timestamp" nil))) + +(defcustom org-icalendar-include-todo nil + "Non-nil means create VTODO components from TODO items. + +Valid values are: +nil don't include any task. +t include tasks that are not in DONE state. +`unblocked' include all TODO items that are not blocked. +`all' include both done and not done items." + :group 'org-export-icalendar + :type '(choice + (const :tag "None" nil) + (const :tag "Unfinished" t) + (const :tag "Unblocked" unblocked) + (const :tag "All" all) + (repeat :tag "Specific TODO keywords" + (string :tag "Keyword")))) + +(defcustom org-icalendar-include-bbdb-anniversaries nil + "Non-nil means a combined iCalendar file should include anniversaries. +The anniversaries are defined in the BBDB database." + :group 'org-export-icalendar + :type 'boolean) + +(defcustom org-icalendar-include-sexps t + "Non-nil means export to iCalendar files should also cover sexp entries. +These are entries like in the diary, but directly in an Org file." + :group 'org-export-icalendar + :type 'boolean) + +(defcustom org-icalendar-include-body t + "Amount of text below headline to be included in iCalendar export. +This is a number of characters that should maximally be included. +Properties, scheduling and clocking lines will always be removed. +The text will be inserted into the DESCRIPTION field." + :group 'org-export-icalendar + :type '(choice + (const :tag "Nothing" nil) + (const :tag "Everything" t) + (integer :tag "Max characters"))) + +(defcustom org-icalendar-store-UID nil + "Non-nil means store any created UIDs in properties. + +The iCalendar standard requires that all entries have a unique identifier. +Org will create these identifiers as needed. When this variable is non-nil, +the created UIDs will be stored in the ID property of the entry. Then the +next time this entry is exported, it will be exported with the same UID, +superseding the previous form of it. This is essential for +synchronization services. + +This variable is not turned on by default because we want to avoid creating +a property drawer in every entry if people are only playing with this feature, +or if they are only using it locally." + :group 'org-export-icalendar + :type 'boolean) + +(defcustom org-icalendar-timezone (getenv "TZ") + "The time zone string for iCalendar export. +When nil or the empty string, use output +from (current-time-zone)." + :group 'org-export-icalendar + :type '(choice + (const :tag "Unspecified" nil) + (string :tag "Time zone"))) + +(defcustom org-icalendar-date-time-format ":%Y%m%dT%H%M%S" + "Format-string for exporting icalendar DATE-TIME. + +See `format-time-string' for a full documentation. The only +difference is that `org-icalendar-timezone' is used for %Z. + +Interesting value are: + - \":%Y%m%dT%H%M%S\" for local time + - \";TZID=%Z:%Y%m%dT%H%M%S\" for local time with explicit timezone + - \":%Y%m%dT%H%M%SZ\" for time expressed in Universal Time" + :group 'org-export-icalendar + :version "24.1" + :type '(choice + (const :tag "Local time" ":%Y%m%dT%H%M%S") + (const :tag "Explicit local time" ";TZID=%Z:%Y%m%dT%H%M%S") + (const :tag "Universal time" ":%Y%m%dT%H%M%SZ") + (string :tag "Explicit format"))) + +(defvar org-icalendar-after-save-hook nil + "Hook run after an iCalendar file has been saved. +This hook is run with the name of the file as argument. A good +way to use this is to tell a desktop calendar application to +re-read the iCalendar file.") + + + +;;; Define Back-End + +(org-export-define-derived-backend 'icalendar 'ascii + :translate-alist '((clock . ignore) + (footnote-definition . ignore) + (footnote-reference . ignore) + (headline . org-icalendar-entry) + (inner-template . org-icalendar-inner-template) + (inlinetask . ignore) + (planning . ignore) + (section . ignore) + (template . org-icalendar-template)) + :options-alist + '((:exclude-tags + "ICALENDAR_EXCLUDE_TAGS" nil org-icalendar-exclude-tags split) + (:with-timestamps nil "<" org-icalendar-with-timestamps) + ;; Other variables. + (:icalendar-alarm-time nil nil org-icalendar-alarm-time) + (:icalendar-categories nil nil org-icalendar-categories) + (:icalendar-date-time-format nil nil org-icalendar-date-time-format) + (:icalendar-include-bbdb-anniversaries nil nil org-icalendar-include-bbdb-anniversaries) + (:icalendar-include-body nil nil org-icalendar-include-body) + (:icalendar-include-sexps nil nil org-icalendar-include-sexps) + (:icalendar-include-todo nil nil org-icalendar-include-todo) + (:icalendar-store-UID nil nil org-icalendar-store-UID) + (:icalendar-timezone nil nil org-icalendar-timezone) + (:icalendar-use-deadline nil nil org-icalendar-use-deadline) + (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled)) + :filters-alist + '((:filter-headline . org-icalendar-clear-blank-lines)) + :menu-entry + '(?c "Export to iCalendar" + ((?f "Current file" org-icalendar-export-to-ics) + (?a "All agenda files" + (lambda (a s v b) (org-icalendar-export-agenda-files a))) + (?c "Combine all agenda files" + (lambda (a s v b) (org-icalendar-combine-agenda-files a)))))) + + + +;;; Internal Functions + +(defun org-icalendar-create-uid (file &optional bell) + "Set ID property on headlines missing it in FILE. +When optional argument BELL is non-nil, inform the user with +a message if the file was modified." + (let (modified-flag) + (org-map-entries + (lambda () + (let ((entry (org-element-at-point))) + (unless (org-element-property :ID entry) + (org-id-get-create) + (setq modified-flag t) + (forward-line)))) + nil nil 'comment) + (when (and bell modified-flag) + (message "ID properties created in file \"%s\"" file) + (sit-for 2)))) + +(defun org-icalendar-blocked-headline-p (headline info) + "Non-nil when HEADLINE is considered to be blocked. + +INFO is a plist used as a communication channel. + +A headline is blocked when either + + - it has children which are not all in a completed state; + + - it has a parent with the property :ORDERED:, and there are + siblings prior to it with incomplete status; + + - its parent is blocked because it has siblings that should be + done first or is a child of a blocked grandparent entry." + (or + ;; Check if any child is not done. + (org-element-map (org-element-contents headline) 'headline + (lambda (hl) (eq (org-element-property :todo-type hl) 'todo)) + info 'first-match) + ;; Check :ORDERED: node property. + (catch 'blockedp + (let ((current headline)) + (dolist (parent (org-element-lineage headline)) + (cond + ((not (org-element-property :todo-keyword parent)) + (throw 'blockedp nil)) + ((org-not-nil (org-element-property :ORDERED parent)) + (let ((sibling current)) + (while (setq sibling (org-export-get-previous-element + sibling info)) + (when (eq (org-element-property :todo-type sibling) 'todo) + (throw 'blockedp t))))) + (t (setq current parent)))))))) + +(defun org-icalendar-use-UTC-date-time-p () + "Non-nil when `org-icalendar-date-time-format' requires UTC time." + (char-equal (elt org-icalendar-date-time-format + (1- (length org-icalendar-date-time-format))) + ?Z)) + +(defun org-icalendar-convert-timestamp (timestamp keyword &optional end tz) + "Convert TIMESTAMP to iCalendar format. + +TIMESTAMP is a timestamp object. KEYWORD is added in front of +it, in order to make a complete line (e.g. \"DTSTART\"). + +When optional argument END is non-nil, use end of time range. +Also increase the hour by two (if time string contains a time), +or the day by one (if it does not contain a time) when no +explicit ending time is specified. + +When optional argument TZ is non-nil, timezone data time will be +added to the timestamp. It can be the string \"UTC\", to use UTC +time, or a string in the IANA TZ database +format (e.g. \"Europe/London\"). In either case, the value of +`org-icalendar-date-time-format' will be ignored." + (let* ((year-start (org-element-property :year-start timestamp)) + (year-end (org-element-property :year-end timestamp)) + (month-start (org-element-property :month-start timestamp)) + (month-end (org-element-property :month-end timestamp)) + (day-start (org-element-property :day-start timestamp)) + (day-end (org-element-property :day-end timestamp)) + (hour-start (org-element-property :hour-start timestamp)) + (hour-end (org-element-property :hour-end timestamp)) + (minute-start (org-element-property :minute-start timestamp)) + (minute-end (org-element-property :minute-end timestamp)) + (with-time-p minute-start) + (equal-bounds-p + (equal (list year-start month-start day-start hour-start minute-start) + (list year-end month-end day-end hour-end minute-end))) + (mi (cond ((not with-time-p) 0) + ((not end) minute-start) + ((and org-agenda-default-appointment-duration equal-bounds-p) + (+ minute-end org-agenda-default-appointment-duration)) + (t minute-end))) + (h (cond ((not with-time-p) 0) + ((not end) hour-start) + ((or (not equal-bounds-p) + org-agenda-default-appointment-duration) + hour-end) + (t (+ hour-end 2)))) + (d (cond ((not end) day-start) + ((not with-time-p) (1+ day-end)) + (t day-end))) + (m (if end month-end month-start)) + (y (if end year-end year-start))) + (concat + keyword + (format-time-string + (cond ((string-equal tz "UTC") ":%Y%m%dT%H%M%SZ") + ((not with-time-p) ";VALUE=DATE:%Y%m%d") + ((stringp tz) (concat ";TZID=" tz ":%Y%m%dT%H%M%S")) + (t (replace-regexp-in-string "%Z" + org-icalendar-timezone + org-icalendar-date-time-format + t))) + ;; Convert timestamp into internal time in order to use + ;; `format-time-string' and fix any mistake (i.e. MI >= 60). + (encode-time 0 mi h d m y) + (and (or (string-equal tz "UTC") + (and (null tz) + with-time-p + (org-icalendar-use-UTC-date-time-p))) + t))))) + +(defun org-icalendar-dtstamp () + "Return DTSTAMP property, as a string." + (format-time-string "DTSTAMP:%Y%m%dT%H%M%SZ" nil t)) + +(defun org-icalendar-get-categories (entry info) + "Return categories according to `org-icalendar-categories'. +ENTRY is a headline or an inlinetask element. INFO is a plist +used as a communication channel." + (mapconcat + #'identity + (org-uniquify + (let (categories) + (dolist (type org-icalendar-categories (nreverse categories)) + (cl-case type + (category + (push (org-export-get-category entry info) categories)) + (todo-state + (let ((todo (org-element-property :todo-keyword entry))) + (and todo (push todo categories)))) + (local-tags + (setq categories + (append (nreverse (org-export-get-tags entry info)) + categories))) + (all-tags + (setq categories + (append (nreverse (org-export-get-tags entry info nil t)) + categories))))))) + ",")) + +(defun org-icalendar-transcode-diary-sexp (sexp uid summary) + "Transcode a diary sexp into iCalendar format. +SEXP is the diary sexp being transcoded, as a string. UID is the +unique identifier for the entry. SUMMARY defines a short summary +or subject for the event." + (when (require 'icalendar nil t) + (org-element-normalize-string + (with-temp-buffer + (let ((sexp (if (not (string-match "\\`<%%" sexp)) sexp + (concat (substring sexp 1 -1) " " summary)))) + (put-text-property 0 1 'uid uid sexp) + (insert sexp "\n")) + (org-diary-to-ical-string (current-buffer)))))) + +(defun org-icalendar-cleanup-string (s) + "Cleanup string S according to RFC 5545." + (when s + ;; Protect "\", "," and ";" characters. and replace newline + ;; characters with literal \n. + (replace-regexp-in-string + "[ \t]*\n" "\\n" + (replace-regexp-in-string "[\\,;]" "\\\\\\&" s) + nil t))) + +(defun org-icalendar-fold-string (s) + "Fold string S according to RFC 5545." + (org-element-normalize-string + (mapconcat + (lambda (line) + ;; Limit each line to a maximum of 75 characters. If it is + ;; longer, fold it by using "\r\n " as a continuation marker. + (let ((len (length line))) + (if (<= len 75) line + (let ((folded-line (substring line 0 75)) + (chunk-start 75) + chunk-end) + ;; Since continuation marker takes up one character on the + ;; line, real contents must be split at 74 chars. + (while (< (setq chunk-end (+ chunk-start 74)) len) + (setq folded-line + (concat folded-line "\r\n " + (substring line chunk-start chunk-end)) + chunk-start chunk-end)) + (concat folded-line "\r\n " (substring line chunk-start)))))) + (org-split-string s "\n") "\r\n"))) + + + +;;; Filters + +(defun org-icalendar-clear-blank-lines (headline _back-end _info) + "Remove blank lines in HEADLINE export. +HEADLINE is a string representing a transcoded headline. +BACK-END and INFO are ignored." + (replace-regexp-in-string "^\\(?:[ \t]*\n\\)+" "" headline)) + + + +;;; Transcode Functions + +;;;; Headline and Inlinetasks + +;; The main function is `org-icalendar-entry', which extracts +;; information from a headline or an inlinetask (summary, +;; description...) and then delegates code generation to +;; `org-icalendar--vtodo' and `org-icalendar--vevent', depending +;; on the component needed. + +;; Obviously, `org-icalendar--valarm' handles alarms, which can +;; happen within a VTODO component. + +(defun org-icalendar-entry (entry contents info) + "Transcode ENTRY element into iCalendar format. + +ENTRY is either a headline or an inlinetask. CONTENTS is +ignored. INFO is a plist used as a communication channel. + +This function is called on every headline, the section below +it (minus inlinetasks) being its contents. It tries to create +VEVENT and VTODO components out of scheduled date, deadline date, +plain timestamps, diary sexps. It also calls itself on every +inlinetask within the section." + (unless (org-element-property :footnote-section-p entry) + (let* ((type (org-element-type entry)) + ;; Determine contents really associated to the entry. For + ;; a headline, limit them to section, if any. For an + ;; inlinetask, this is every element within the task. + (inside + (if (eq type 'inlinetask) + (cons 'org-data (cons nil (org-element-contents entry))) + (let ((first (car (org-element-contents entry)))) + (and (eq (org-element-type first) 'section) + (cons 'org-data + (cons nil (org-element-contents first)))))))) + (concat + (let ((todo-type (org-element-property :todo-type entry)) + (uid (or (org-element-property :ID entry) (org-id-new))) + (summary (org-icalendar-cleanup-string + (or (org-element-property :SUMMARY entry) + (org-export-data + (org-element-property :title entry) info)))) + (loc (org-icalendar-cleanup-string + (org-export-get-node-property + :LOCATION entry + (org-property-inherit-p "LOCATION")))) + (class (org-icalendar-cleanup-string + (org-export-get-node-property + :CLASS entry + (org-property-inherit-p "CLASS")))) + ;; Build description of the entry from associated section + ;; (headline) or contents (inlinetask). + (desc + (org-icalendar-cleanup-string + (or (org-element-property :DESCRIPTION entry) + (let ((contents (org-export-data inside info))) + (cond + ((not (org-string-nw-p contents)) nil) + ((wholenump org-icalendar-include-body) + (let ((contents (org-trim contents))) + (substring + contents 0 (min (length contents) + org-icalendar-include-body)))) + (org-icalendar-include-body (org-trim contents))))))) + (cat (org-icalendar-get-categories entry info)) + (tz (org-export-get-node-property + :TIMEZONE entry + (org-property-inherit-p "TIMEZONE")))) + (concat + ;; Events: Delegate to `org-icalendar--vevent' to generate + ;; "VEVENT" component from scheduled, deadline, or any + ;; timestamp in the entry. + (let ((deadline (org-element-property :deadline entry)) + (use-deadline (plist-get info :icalendar-use-deadline))) + (and deadline + (pcase todo-type + (`todo (or (memq 'event-if-todo-not-done use-deadline) + (memq 'event-if-todo use-deadline))) + (`done (memq 'event-if-todo use-deadline)) + (_ (memq 'event-if-not-todo use-deadline))) + (org-icalendar--vevent + entry deadline (concat "DL-" uid) + (concat "DL: " summary) loc desc cat tz class))) + (let ((scheduled (org-element-property :scheduled entry)) + (use-scheduled (plist-get info :icalendar-use-scheduled))) + (and scheduled + (pcase todo-type + (`todo (or (memq 'event-if-todo-not-done use-scheduled) + (memq 'event-if-todo use-scheduled))) + (`done (memq 'event-if-todo use-scheduled)) + (_ (memq 'event-if-not-todo use-scheduled))) + (org-icalendar--vevent + entry scheduled (concat "SC-" uid) + (concat "S: " summary) loc desc cat tz class))) + ;; When collecting plain timestamps from a headline and its + ;; title, skip inlinetasks since collection will happen once + ;; ENTRY is one of them. + (let ((counter 0)) + (mapconcat + #'identity + (org-element-map (cons (org-element-property :title entry) + (org-element-contents inside)) + 'timestamp + (lambda (ts) + (when (let ((type (org-element-property :type ts))) + (cl-case (plist-get info :with-timestamps) + (active (memq type '(active active-range))) + (inactive (memq type '(inactive inactive-range))) + ((t) t))) + (let ((uid (format "TS%d-%s" (cl-incf counter) uid))) + (org-icalendar--vevent + entry ts uid summary loc desc cat tz class)))) + info nil (and (eq type 'headline) 'inlinetask)) + "")) + ;; Task: First check if it is appropriate to export it. If + ;; so, call `org-icalendar--vtodo' to transcode it into + ;; a "VTODO" component. + (when (and todo-type + (cl-case (plist-get info :icalendar-include-todo) + (all t) + (unblocked + (and (eq type 'headline) + (not (org-icalendar-blocked-headline-p + entry info)))) + ((t) (eq todo-type 'todo)))) + (org-icalendar--vtodo entry uid summary loc desc cat tz class)) + ;; Diary-sexp: Collect every diary-sexp element within ENTRY + ;; and its title, and transcode them. If ENTRY is + ;; a headline, skip inlinetasks: they will be handled + ;; separately. + (when org-icalendar-include-sexps + (let ((counter 0)) + (mapconcat #'identity + (org-element-map + (cons (org-element-property :title entry) + (org-element-contents inside)) + 'diary-sexp + (lambda (sexp) + (org-icalendar-transcode-diary-sexp + (org-element-property :value sexp) + (format "DS%d-%s" (cl-incf counter) uid) + summary)) + info nil (and (eq type 'headline) 'inlinetask)) + ""))))) + ;; If ENTRY is a headline, call current function on every + ;; inlinetask within it. In agenda export, this is independent + ;; from the mark (or lack thereof) on the entry. + (when (eq type 'headline) + (mapconcat #'identity + (org-element-map inside 'inlinetask + (lambda (task) (org-icalendar-entry task nil info)) + info) "")) + ;; Don't forget components from inner entries. + contents)))) + +(defun org-icalendar--vevent + (entry timestamp uid summary location description categories timezone class) + "Create a VEVENT component. + +ENTRY is either a headline or an inlinetask element. TIMESTAMP +is a timestamp object defining the date-time of the event. UID +is the unique identifier for the event. SUMMARY defines a short +summary or subject for the event. LOCATION defines the intended +venue for the event. DESCRIPTION provides the complete +description of the event. CATEGORIES defines the categories the +event belongs to. TIMEZONE specifies a time zone for this event +only. CLASS contains the visibility attribute. Three of them +(\"PUBLIC\", \"CONFIDENTIAL\", and \"PRIVATE\") are predefined, others +should be treated as \"PRIVATE\" if they are unknown to the iCalendar server. + +Return VEVENT component as a string." + (org-icalendar-fold-string + (if (eq (org-element-property :type timestamp) 'diary) + (org-icalendar-transcode-diary-sexp + (org-element-property :raw-value timestamp) uid summary) + (concat "BEGIN:VEVENT\n" + (org-icalendar-dtstamp) "\n" + "UID:" uid "\n" + (org-icalendar-convert-timestamp timestamp "DTSTART" nil timezone) "\n" + (org-icalendar-convert-timestamp timestamp "DTEND" t timezone) "\n" + ;; RRULE. + (when (org-element-property :repeater-type timestamp) + (format "RRULE:FREQ=%s;INTERVAL=%d\n" + (cl-case (org-element-property :repeater-unit timestamp) + (hour "HOURLY") (day "DAILY") (week "WEEKLY") + (month "MONTHLY") (year "YEARLY")) + (org-element-property :repeater-value timestamp))) + "SUMMARY:" summary "\n" + (and (org-string-nw-p location) (format "LOCATION:%s\n" location)) + (and (org-string-nw-p class) (format "CLASS:%s\n" class)) + (and (org-string-nw-p description) + (format "DESCRIPTION:%s\n" description)) + "CATEGORIES:" categories "\n" + ;; VALARM. + (org-icalendar--valarm entry timestamp summary) + "END:VEVENT")))) + +(defun org-icalendar--vtodo + (entry uid summary location description categories timezone class) + "Create a VTODO component. + +ENTRY is either a headline or an inlinetask element. UID is the +unique identifier for the task. SUMMARY defines a short summary +or subject for the task. LOCATION defines the intended venue for +the task. DESCRIPTION provides the complete description of the +task. CATEGORIES defines the categories the task belongs to. +TIMEZONE specifies a time zone for this TODO only. + +Return VTODO component as a string." + (let ((start (or (and (memq 'todo-start org-icalendar-use-scheduled) + (org-element-property :scheduled entry)) + ;; If we can't use a scheduled time for some + ;; reason, start task now. + (let ((now (decode-time))) + (list 'timestamp + (list :type 'active + :minute-start (nth 1 now) + :hour-start (nth 2 now) + :day-start (nth 3 now) + :month-start (nth 4 now) + :year-start (nth 5 now))))))) + (org-icalendar-fold-string + (concat "BEGIN:VTODO\n" + "UID:TODO-" uid "\n" + (org-icalendar-dtstamp) "\n" + (org-icalendar-convert-timestamp start "DTSTART" nil timezone) "\n" + (and (memq 'todo-due org-icalendar-use-deadline) + (org-element-property :deadline entry) + (concat (org-icalendar-convert-timestamp + (org-element-property :deadline entry) "DUE" nil timezone) + "\n")) + "SUMMARY:" summary "\n" + (and (org-string-nw-p location) (format "LOCATION:%s\n" location)) + (and (org-string-nw-p class) (format "CLASS:%s\n" class)) + (and (org-string-nw-p description) + (format "DESCRIPTION:%s\n" description)) + "CATEGORIES:" categories "\n" + "SEQUENCE:1\n" + (format "PRIORITY:%d\n" + (let ((pri (or (org-element-property :priority entry) + org-priority-default))) + (floor (- 9 (* 8. (/ (float (- org-priority-lowest pri)) + (- org-priority-lowest + org-priority-highest))))))) + (format "STATUS:%s\n" + (if (eq (org-element-property :todo-type entry) 'todo) + "NEEDS-ACTION" + "COMPLETED")) + "END:VTODO")))) + +(defun org-icalendar--valarm (entry timestamp summary) + "Create a VALARM component. + +ENTRY is the calendar entry triggering the alarm. TIMESTAMP is +the start date-time of the entry. SUMMARY defines a short +summary or subject for the task. + +Return VALARM component as a string, or nil if it isn't allowed." + ;; Create a VALARM entry if the entry is timed. This is not very + ;; general in that: + ;; (a) only one alarm per entry is defined, + ;; (b) only minutes are allowed for the trigger period ahead of the + ;; start time, + ;; (c) only a DISPLAY action is defined. [ESF] + (let ((alarm-time + (let ((warntime + (org-element-property :APPT_WARNTIME entry))) + (if warntime (string-to-number warntime) 0)))) + (and (or (> alarm-time 0) (> org-icalendar-alarm-time 0)) + (org-element-property :hour-start timestamp) + (format "BEGIN:VALARM +ACTION:DISPLAY +DESCRIPTION:%s +TRIGGER:-P0DT0H%dM0S +END:VALARM\n" + summary + (if (zerop alarm-time) org-icalendar-alarm-time alarm-time))))) + + +;;;; Template + +(defun org-icalendar-inner-template (contents _) + "Return document body string after iCalendar conversion. +CONTENTS is the transcoded contents string." + contents) + +(defun org-icalendar-template (contents info) + "Return complete document string after iCalendar conversion. +CONTENTS is the transcoded contents string. INFO is a plist used +as a communication channel." + (org-icalendar--vcalendar + ;; Name. + (if (not (plist-get info :input-file)) (buffer-name (buffer-base-buffer)) + (file-name-nondirectory + (file-name-sans-extension (plist-get info :input-file)))) + ;; Owner. + (if (not (plist-get info :with-author)) "" + (org-export-data (plist-get info :author) info)) + ;; Timezone. + (if (org-string-nw-p org-icalendar-timezone) org-icalendar-timezone + (cadr (current-time-zone))) + ;; Description. + (org-export-data (plist-get info :title) info) + contents)) + +(defun org-icalendar--vcalendar (name owner tz description contents) + "Create a VCALENDAR component. +NAME, OWNER, TZ, DESCRIPTION and CONTENTS are all strings giving, +respectively, the name of the calendar, its owner, the timezone +used, a short description and the other components included." + (concat (format "BEGIN:VCALENDAR +VERSION:2.0 +X-WR-CALNAME:%s +PRODID:-//%s//Emacs with Org mode//EN +X-WR-TIMEZONE:%s +X-WR-CALDESC:%s +CALSCALE:GREGORIAN\n" + (org-icalendar-cleanup-string name) + (org-icalendar-cleanup-string owner) + (org-icalendar-cleanup-string tz) + (org-icalendar-cleanup-string description)) + contents + "END:VCALENDAR\n")) + + + +;;; Interactive Functions + +;;;###autoload +(defun org-icalendar-export-to-ics + (&optional async subtreep visible-only body-only) + "Export current buffer to an iCalendar file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"BEGIN:VCALENDAR\" and \"END:VCALENDAR\". + +Return ICS file name." + (interactive) + (let ((file (buffer-file-name (buffer-base-buffer)))) + (when (and file org-icalendar-store-UID) + (org-icalendar-create-uid file 'warn-user))) + ;; Export part. Since this back-end is backed up by `ascii', ensure + ;; links will not be collected at the end of sections. + (let ((outfile (org-export-output-file-name ".ics" subtreep))) + (org-export-to-file 'icalendar outfile + async subtreep visible-only body-only + '(:ascii-charset utf-8 :ascii-links-to-notes nil) + '(lambda (file) + (run-hook-with-args 'org-icalendar-after-save-hook file) nil)))) + +;;;###autoload +(defun org-icalendar-export-agenda-files (&optional async) + "Export all agenda files to iCalendar files. +When optional argument ASYNC is non-nil, export happens in an +external process." + (interactive) + (if async + ;; Asynchronous export is not interactive, so we will not call + ;; `org-check-agenda-file'. Instead we remove any non-existent + ;; agenda file from the list. + (let ((files (cl-remove-if-not #'file-exists-p (org-agenda-files t)))) + (org-export-async-start + (lambda (results) + (dolist (f results) (org-export-add-to-stack f 'icalendar))) + `(let (output-files) + (dolist (file ',files outputfiles) + (with-current-buffer (org-get-agenda-file-buffer file) + (push (expand-file-name (org-icalendar-export-to-ics)) + output-files)))))) + (let ((files (org-agenda-files t))) + (org-agenda-prepare-buffers files) + (unwind-protect + (dolist (file files) + (catch 'nextfile + (org-check-agenda-file file) + (with-current-buffer (org-get-agenda-file-buffer file) + (org-icalendar-export-to-ics)))) + (org-release-buffers org-agenda-new-buffers))))) + +;;;###autoload +(defun org-icalendar-combine-agenda-files (&optional async) + "Combine all agenda files into a single iCalendar file. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +The file is stored under the name chosen in +`org-icalendar-combined-agenda-file'." + (interactive) + (if async + (let ((files (cl-remove-if-not #'file-exists-p (org-agenda-files t)))) + (org-export-async-start + (lambda (_) + (org-export-add-to-stack + (expand-file-name org-icalendar-combined-agenda-file) + 'icalendar)) + `(apply #'org-icalendar--combine-files ',files))) + (apply #'org-icalendar--combine-files (org-agenda-files t)))) + +(defun org-icalendar-export-current-agenda (file) + "Export current agenda view to an iCalendar FILE. +This function assumes major mode for current buffer is +`org-agenda-mode'." + (let* ((org-export-use-babel) ;don't evaluate Babel blocks + (contents + (org-export-string-as + (with-output-to-string + (save-excursion + (let ((p (point-min)) + (seen nil)) ;prevent duplicates + (while (setq p (next-single-property-change p 'org-hd-marker)) + (let ((m (get-text-property p 'org-hd-marker))) + (when (and m (not (member m seen))) + (push m seen) + (with-current-buffer (marker-buffer m) + (org-with-wide-buffer + (goto-char (marker-position m)) + (princ + (org-element-normalize-string + (buffer-substring (point) + (org-entry-end-position)))))))) + (forward-line))))) + 'icalendar t + '(:ascii-charset utf-8 :ascii-links-to-notes nil + :icalendar-include-todo all)))) + (with-temp-file file + (insert + (org-icalendar--vcalendar + org-icalendar-combined-name + user-full-name + (or (org-string-nw-p org-icalendar-timezone) (cadr (current-time-zone))) + org-icalendar-combined-description + contents))) + (run-hook-with-args 'org-icalendar-after-save-hook file))) + +(defun org-icalendar--combine-files (&rest files) + "Combine entries from multiple files into an iCalendar file. +FILES is a list of files to build the calendar from." + ;; At the end of the process, all buffers related to FILES are going + ;; to be killed. Make sure to only kill the ones opened in the + ;; process. + (let ((org-agenda-new-buffers nil)) + (unwind-protect + (progn + (with-temp-file org-icalendar-combined-agenda-file + (insert + (org-icalendar--vcalendar + ;; Name. + org-icalendar-combined-name + ;; Owner. + user-full-name + ;; Timezone. + (or (org-string-nw-p org-icalendar-timezone) + (cadr (current-time-zone))) + ;; Description. + org-icalendar-combined-description + ;; Contents. + (concat + ;; Agenda contents. + (mapconcat + (lambda (file) + (catch 'nextfile + (org-check-agenda-file file) + (with-current-buffer (org-get-agenda-file-buffer file) + ;; Create ID if necessary. + (when org-icalendar-store-UID + (org-icalendar-create-uid file t)) + (org-export-as + 'icalendar nil nil t + '(:ascii-charset utf-8 :ascii-links-to-notes nil))))) + files "") + ;; BBDB anniversaries. + (when (and org-icalendar-include-bbdb-anniversaries + (require 'ol-bbdb nil t)) + (with-output-to-string (org-bbdb-anniv-export-ical))))))) + (run-hook-with-args 'org-icalendar-after-save-hook + org-icalendar-combined-agenda-file)) + (org-release-buffers org-agenda-new-buffers)))) + + +(provide 'ox-icalendar) + +;; Local variables: +;; generated-autoload-file: "org-loaddefs.el" +;; End: + +;;; ox-icalendar.el ends here diff --git a/elpa/org-9.5.2/ox-icalendar.elc b/elpa/org-9.5.2/ox-icalendar.elc new file mode 100644 index 0000000..6166ac3 Binary files /dev/null and b/elpa/org-9.5.2/ox-icalendar.elc differ diff --git a/elpa/org-9.5.2/ox-koma-letter.el b/elpa/org-9.5.2/ox-koma-letter.el new file mode 100644 index 0000000..978e4e4 --- /dev/null +++ b/elpa/org-9.5.2/ox-koma-letter.el @@ -0,0 +1,989 @@ +;;; ox-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine -*- lexical-binding: t; -*- + +;; Copyright (C) 2007-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou +;; Alan Schmitt +;; Viktor Rosenfeld +;; Rasmus Pank Roulund +;; Maintainer: Marco Wahl +;; Keywords: org, wp, tex + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: +;; +;; This library implements a KOMA Scrlttr2 back-end, derived from the +;; LaTeX one. +;; +;; Depending on the desired output format, three commands are provided +;; for export: `org-koma-letter-export-as-latex' (temporary buffer), +;; `org-koma-letter-export-to-latex' ("tex" file) and +;; `org-koma-letter-export-to-pdf' ("pdf" file). +;; +;; On top of buffer keywords supported by `latex' back-end (see +;; `org-latex-options-alist'), this back-end introduces the following +;; keywords: +;; - CLOSING: see `org-koma-letter-closing', +;; - FROM_ADDRESS: see `org-koma-letter-from-address', +;; - LCO: see `org-koma-letter-class-option-file', +;; - OPENING: see `org-koma-letter-opening', +;; - PHONE_NUMBER: see `org-koma-letter-phone-number', +;; - URL: see `org-koma-letter-url', +;; - FROM_LOGO: see `org-koma-letter-from-logo', +;; - SIGNATURE: see `org-koma-letter-signature', +;; - PLACE: see `org-koma-letter-place', +;; - LOCATION: see `org-koma-letter-location', +;; - TO_ADDRESS: If unspecified this is set to "\mbox{}". +;; +;; TO_ADDRESS, FROM_ADDRESS, LOCATION, CLOSING, and SIGNATURE can also +;; be specified using "special headings" with the special tags +;; specified in `org-koma-letter-special-tags-in-letter'. LaTeX line +;; breaks are not necessary for TO_ADDRESS, FROM_ADDRESS and LOCATION. +;; If both a headline and a keyword specify a to or from address the +;; value is determined in accordance with +;; `org-koma-letter-prefer-special-headings'. +;; +;; A number of OPTIONS settings can be set to change which contents is +;; exported. +;; - backaddress (see `org-koma-letter-use-backaddress') +;; - foldmarks (see `org-koma-letter-use-foldmarks') +;; - phone (see `org-koma-letter-use-phone') +;; - url (see `org-koma-letter-use-url') +;; - from-logo (see `org-koma-letter-use-from-logo') +;; - email (see `org-koma-letter-use-email') +;; - place (see `org-koma-letter-use-place') +;; - location (see `org-koma-letter-use-location') +;; - subject, a list of format options +;; (see `org-koma-letter-subject-format') +;; - after-closing-order, a list of the ordering of headings with +;; special tags after closing (see +;; `org-koma-letter-special-tags-after-closing') +;; - after-letter-order, as above, but after the end of the letter +;; (see `org-koma-letter-special-tags-after-letter'). +;; +;; The following variables works differently from the main LaTeX class +;; - AUTHOR: Default to user-full-name but may be disabled. +;; (See also `org-koma-letter-author'.) +;; - EMAIL: Same as AUTHOR. (See also `org-koma-letter-email'.) +;; +;; FROM_LOGO uses LaTeX markup. FROM_LOGO provides the +;; "includegraphics" command to tell LaTeX where to find the logo. +;; This command needs to know the logo's directory and file name. The +;; directory can either be relative or absolute, just as you would +;; expect. LaTeX can use three file types for the logo: PDF, JPEG, or +;; PNG. The logo can either include or exclude its extension, which +;; might surprise you. When you exclude its extension, LaTeX will +;; search the directory for the "best" quality graphics format. For +;; example if it finds both logo.pdf and logo.png then it will +;; identify the PDF as "better", and include "logo.pdf". This can be +;; useful, for example, when you are mocking up a logo in the PNG +;; raster format and then switch over to the higher quality PDF vector +;; format. When you include the file extension then LaTeX will +;; include it without searching for higher quality file types. +;; Whatever file type you choose, it will probably require a few +;; design iterations to get the best looking logo size for your +;; letter. Finally, the directory and file name are specified +;; *without* quotes. Here are some examples with commentary, in the +;; location of your letter, with a logo named "logo", to get you +;; started: +;; +;; Logo in the same directory: \includegraphics{logo} +;; or a sub-directory: \includegraphics{logos/production/logo} +;; +;; Logos specified using absolute paths on Linux or Windows: +;; +;; \includegraphics{~/correspondence/logo} +;; \includegraphics{~/correspondence/logos/production/logo} +;; \includegraphics{c:/you/correspondence/logo} +;; \includegraphics{c:/you/correspondence/logos/production/logo} +;; +;; Logos in the same directory where the "better" quality PDF will +;; be chosen over the JPG: +;; +;; \includegraphics{logo.pdf} +;; \includegraphics{logo.png} +;; +;; Headlines are in general ignored. However, headlines with special +;; tags can be used for specified contents like postscript (ps), +;; carbon copy (cc), enclosures (encl) and code to be inserted after +;; \end{letter} (after_letter). Specials tags are defined in +;; `org-koma-letter-special-tags-after-closing' and +;; `org-koma-letter-special-tags-after-letter'. Currently members of +;; `org-koma-letter-special-tags-after-closing' used as macros and the +;; content of the headline is the argument. +;; +;; Headlines with to and from may also be used rather than the keyword +;; approach described above. If both a keyword and a headline with +;; information is present precedence is determined by +;; `org-koma-letter-prefer-special-headings'. +;; +;; You need an appropriate association in `org-latex-classes' in order +;; to use the KOMA Scrlttr2 class. By default, a sparse scrlttr2 +;; class is provided: "default-koma-letter". You can also add you own +;; letter class. For instance: +;; +;; (add-to-list 'org-latex-classes +;; '("my-letter" +;; "\\documentclass\[% +;; DIV=14, +;; fontsize=12pt, +;; parskip=half, +;; subject=titled, +;; backaddress=false, +;; fromalign=left, +;; fromemail=true, +;; fromphone=true\]\{scrlttr2\} +;; \[DEFAULT-PACKAGES] +;; \[PACKAGES] +;; \[EXTRA]")) +;; +;; Then, in your Org document, be sure to require the proper class +;; with: +;; +;; #+LATEX_CLASS: my-letter +;; +;; Or by setting `org-koma-letter-default-class'. +;; +;; You may have to load (LaTeX) Babel as well, e.g., by adding +;; it to `org-latex-packages-alist', +;; +;; (add-to-list 'org-latex-packages-alist '("AUTO" "babel" nil)) + +;;; Code: + +(require 'cl-lib) +(require 'ox-latex) + +;; Install a default letter class. +(unless (assoc "default-koma-letter" org-latex-classes) + (add-to-list 'org-latex-classes + '("default-koma-letter" "\\documentclass[11pt]{scrlttr2}"))) + + +;;; User-Configurable Variables + +(defgroup org-export-koma-letter nil + "Options for exporting to KOMA scrlttr2 class in LaTeX export." + :tag "Org Koma-Letter" + :group 'org-export) + +(defcustom org-koma-letter-class-option-file "NF" + "Letter Class Option File. +This option can also be set with the LCO keyword." + :type 'string) + +(defcustom org-koma-letter-author 'user-full-name + "Sender's name. + +This variable defaults to calling the function `user-full-name' +which just returns the current function `user-full-name'. +Alternatively a string, nil or a function may be given. +Functions must return a string. + +This option can also be set with the AUTHOR keyword." + :type '(radio (function-item user-full-name) + (string) + (function) + (const :tag "Do not export author" nil))) + +(defcustom org-koma-letter-email 'org-koma-letter-email + "Sender's email address. + +This variable defaults to the value `org-koma-letter-email' which +returns `user-mail-address'. Alternatively a string, nil or +a function may be given. Functions must return a string. + +This option can also be set with the EMAIL keyword." + :type '(radio (function-item org-koma-letter-email) + (string) + (function) + (const :tag "Do not export email" nil))) + +(defcustom org-koma-letter-from-address "" + "Sender's address, as a string. +This option can also be set with one or more FROM_ADDRESS +keywords." + :type 'string) + +(defcustom org-koma-letter-phone-number "" + "Sender's phone number, as a string. +This option can also be set with the PHONE_NUMBER keyword." + :type 'string) + +(defcustom org-koma-letter-url "" + "Sender's URL, e. g., the URL of her homepage. +This option can also be set with the URL keyword." + :type 'string + :safe #'stringp) + +(defcustom org-koma-letter-from-logo "" + "Commands for inserting the sender's logo, e. g., \\includegraphics{logo}. +This option can also be set with the FROM_LOGO keyword." + :type 'string + :safe #'stringp) + +(defcustom org-koma-letter-place "" + "Place from which the letter is sent, as a string. +This option can also be set with the PLACE keyword." + :type 'string) + +(defcustom org-koma-letter-location "" + "Sender's extension field, as a string. + +This option can also be set with the LOCATION keyword. +Moreover, when: + (1) Either `org-koma-letter-prefer-special-headings' is non-nil + or there is no LOCATION keyword or the LOCATION keyword is + empty; + (2) the letter contains a headline with the special + tag \"location\"; +then the location will be set as the content of the location +special heading. + +The location field is typically printed right of the address +field (See Figure 4.9. in the English manual of 2015-10-03)." + :type 'string) + +(defcustom org-koma-letter-opening "" + "Letter's opening, as a string. + +This option can also be set with the OPENING keyword. Moreover, +when: + (1) Either `org-koma-letter-prefer-special-headings' is non-nil + or the CLOSING keyword is empty + (2) `org-koma-letter-headline-is-opening-maybe' is non-nil; + (3) the letter contains a headline without a special + tag (e.g. \"to\" or \"ps\"); +then the opening will be implicitly set as the untagged headline title." + :type 'string) + +(defcustom org-koma-letter-closing "" + "Letter's closing, as a string. +This option can also be set with the CLOSING keyword. Moreover, +when: + (1) Either `org-koma-letter-prefer-special-headings' is non-nil + or the CLOSING keyword is empty; + (2) `org-koma-letter-headline-is-opening-maybe' is non-nil; + (3) the letter contains a headline with the special + tag \"closing\"; +then the opening will be set as the title of the closing special +heading title." + :type 'string) + +(defcustom org-koma-letter-signature "" + "Signature, as a string. +This option can also be set with the SIGNATURE keyword. +Moreover, when: + (1) Either `org-koma-letter-prefer-special-headings' is non-nil + or there is no CLOSING keyword or the CLOSING keyword is empty; + (2) `org-koma-letter-headline-is-opening-maybe' is non-nil; + (3) the letter contains a headline with the special + tag \"closing\"; +then the signature will be set as the content of the +closing special heading. + +Note if the content is empty the signature will not be set." + :type 'string) + +(defcustom org-koma-letter-prefer-special-headings nil + "Non-nil means prefer headlines over keywords for TO and FROM. +This option can also be set with the OPTIONS keyword, e.g.: +\"special-headings:t\"." + :type 'boolean) + +(defcustom org-koma-letter-subject-format t + "Non-nil means include the subject. + +Support formatting options. + +When t, insert a subject using default options. When nil, do not +insert a subject at all. It can also be a list of symbols among +the following ones: + + `afteropening' Subject after opening + `beforeopening' Subject before opening + `centered' Subject centered + `left' Subject left-justified + `right' Subject right-justified + `titled' Add title/description to subject + `underlined' Set subject underlined + `untitled' Do not add title/description to subject + +Please refer to the KOMA-script manual (Table 4.16. in the +English manual of 2012-07-22). + +This option can also be set with the OPTIONS keyword, e.g.: +\"subject:(underlined centered)\"." + :type + '(choice + (const :tag "No export" nil) + (const :tag "Default options" t) + (set :tag "Configure options" + (const :tag "Subject after opening" afteropening) + (const :tag "Subject before opening" beforeopening) + (const :tag "Subject centered" centered) + (const :tag "Subject left-justified" left) + (const :tag "Subject right-justified" right) + (const :tag "Add title or description to subject" underlined) + (const :tag "Set subject underlined" titled) + (const :tag "Do not add title or description to subject" untitled)))) + +(defcustom org-koma-letter-use-backaddress nil + "Non-nil prints return address in line above to address. +This option can also be set with the OPTIONS keyword, e.g.: +\"backaddress:t\"." + :type 'boolean) + +(defcustom org-koma-letter-use-foldmarks t + "Configure appearance of folding marks. + +When t, activate default folding marks. When nil, do not insert +folding marks at all. It can also be a list of symbols among the +following ones: + + `B' Activate upper horizontal mark on left paper edge + `b' Deactivate upper horizontal mark on left paper edge + + `H' Activate all horizontal marks on left paper edge + `h' Deactivate all horizontal marks on left paper edge + + `L' Activate left vertical mark on upper paper edge + `l' Deactivate left vertical mark on upper paper edge + + `M' Activate middle horizontal mark on left paper edge + `m' Deactivate middle horizontal mark on left paper edge + + `P' Activate punch or center mark on left paper edge + `p' Deactivate punch or center mark on left paper edge + + `T' Activate lower horizontal mark on left paper edge + `t' Deactivate lower horizontal mark on left paper edge + + `V' Activate all vertical marks on upper paper edge + `v' Deactivate all vertical marks on upper paper edge + +This option can also be set with the OPTIONS keyword, e.g.: +\"foldmarks:(b l m t)\"." + :type '(choice + (const :tag "Activate default folding marks" t) + (const :tag "Deactivate folding marks" nil) + (set + :tag "Configure folding marks" + (const :tag "Activate upper horizontal mark on left paper edge" B) + (const :tag "Deactivate upper horizontal mark on left paper edge" b) + (const :tag "Activate all horizontal marks on left paper edge" H) + (const :tag "Deactivate all horizontal marks on left paper edge" h) + (const :tag "Activate left vertical mark on upper paper edge" L) + (const :tag "Deactivate left vertical mark on upper paper edge" l) + (const :tag "Activate middle horizontal mark on left paper edge" M) + (const :tag "Deactivate middle horizontal mark on left paper edge" m) + (const :tag "Activate punch or center mark on left paper edge" P) + (const :tag "Deactivate punch or center mark on left paper edge" p) + (const :tag "Activate lower horizontal mark on left paper edge" T) + (const :tag "Deactivate lower horizontal mark on left paper edge" t) + (const :tag "Activate all vertical marks on upper paper edge" V) + (const :tag "Deactivate all vertical marks on upper paper edge" v)))) + +(defcustom org-koma-letter-use-phone nil + "Non-nil prints sender's phone number. +This option can also be set with the OPTIONS keyword, e.g.: +\"phone:t\"." + :type 'boolean) + +(defcustom org-koma-letter-use-url nil + "Non-nil prints sender's URL. +This option can also be set with the OPTIONS keyword, e.g.: +\"url:t\"." + :type 'boolean + :safe #'booleanp) + +(defcustom org-koma-letter-use-from-logo nil + "Non-nil prints sender's FROM_LOGO. +This option can also be set with the OPTIONS keyword, e.g.: +\"from-logo:t\"." + :type 'boolean + :safe #'booleanp) + +(defcustom org-koma-letter-use-email nil + "Non-nil prints sender's email address. +This option can also be set with the OPTIONS keyword, e.g.: +\"email:t\"." + :type 'boolean) + +(defcustom org-koma-letter-use-place t + "Non-nil prints the letter's place next to the date. +This option can also be set with the OPTIONS keyword, e.g.: +\"place:nil\"." + :type 'boolean) + +(defcustom org-koma-letter-default-class "default-koma-letter" + "Default class for `org-koma-letter'. +The value must be a member of `org-latex-classes'." + :type 'string) + +(defcustom org-koma-letter-headline-is-opening-maybe t + "Non-nil means a headline may be used as an opening and closing. +See also `org-koma-letter-opening' and +`org-koma-letter-closing'." + :type 'boolean) + +(defcustom org-koma-letter-prefer-subject nil + "Non-nil means title should be interpreted as subject if subject is missing. +This option can also be set with the OPTIONS keyword, +e.g. \"title-subject:t\"." + :type 'boolean) + +(defconst org-koma-letter-special-tags-in-letter '(to from closing location) + "Header tags related to the letter itself.") + +(defconst org-koma-letter-special-tags-after-closing '(after_closing ps encl cc) + "Header tags to be inserted in the letter after closing.") + +(defconst org-koma-letter-special-tags-as-macro '(ps encl cc) + "Header tags to be inserted as macros.") + +(defconst org-koma-letter-special-tags-after-letter '(after_letter) + "Header tags to be inserted after the letter.") + +(defvar org-koma-letter-special-contents nil + "Holds special content temporarily.") + + +;;; Define Back-End + +(org-export-define-derived-backend 'koma-letter 'latex + :options-alist + '((:latex-class "LATEX_CLASS" nil org-koma-letter-default-class t) + (:lco "LCO" nil org-koma-letter-class-option-file) + (:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) parse) + (:author-changed-in-buffer-p "AUTHOR" nil nil t) + (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline) + (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number) + (:url "URL" nil org-koma-letter-url) + (:from-logo "FROM_LOGO" nil org-koma-letter-from-logo) + (:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t) + (:to-address "TO_ADDRESS" nil nil newline) + (:place "PLACE" nil org-koma-letter-place) + (:location "LOCATION" nil org-koma-letter-location) + (:subject "SUBJECT" nil nil parse) + (:opening "OPENING" nil org-koma-letter-opening parse) + (:closing "CLOSING" nil org-koma-letter-closing parse) + (:signature "SIGNATURE" nil org-koma-letter-signature newline) + (:special-headings nil "special-headings" org-koma-letter-prefer-special-headings) + (:special-tags-as-macro nil nil org-koma-letter-special-tags-as-macro) + (:special-tags-in-letter nil nil org-koma-letter-special-tags-in-letter) + (:special-tags-after-closing nil "after-closing-order" + org-koma-letter-special-tags-after-closing) + (:special-tags-after-letter nil "after-letter-order" + org-koma-letter-special-tags-after-letter) + (:with-backaddress nil "backaddress" org-koma-letter-use-backaddress) + (:with-email nil "email" org-koma-letter-use-email) + (:with-foldmarks nil "foldmarks" org-koma-letter-use-foldmarks) + (:with-phone nil "phone" org-koma-letter-use-phone) + (:with-url nil "url" org-koma-letter-use-url) + (:with-from-logo nil "from-logo" org-koma-letter-use-from-logo) + (:with-place nil "place" org-koma-letter-use-place) + (:with-subject nil "subject" org-koma-letter-subject-format) + (:with-title-as-subject nil "title-subject" org-koma-letter-prefer-subject) + (:with-headline-opening nil nil org-koma-letter-headline-is-opening-maybe) + ;; Special properties non-nil when a setting happened in buffer. + ;; They are used to prioritize in-buffer settings over "lco" + ;; files. See `org-koma-letter-template'. + (:inbuffer-author "AUTHOR" nil 'koma-letter:empty) + (:inbuffer-from "FROM" nil 'koma-letter:empty) + (:inbuffer-email "EMAIL" nil 'koma-letter:empty) + (:inbuffer-phone-number "PHONE_NUMBER" nil 'koma-letter:empty) + (:inbuffer-url "URL" nil 'koma-letter:empty) + (:inbuffer-from-logo "FROM_LOGO" nil 'koma-letter:empty) + (:inbuffer-place "PLACE" nil 'koma-letter:empty) + (:inbuffer-location "LOCATION" nil 'koma-letter:empty) + (:inbuffer-signature "SIGNATURE" nil 'koma-letter:empty) + (:inbuffer-with-backaddress nil "backaddress" 'koma-letter:empty) + (:inbuffer-with-email nil "email" 'koma-letter:empty) + (:inbuffer-with-foldmarks nil "foldmarks" 'koma-letter:empty) + (:inbuffer-with-phone nil "phone" 'koma-letter:empty) + (:inbuffer-with-url nil "url" 'koma-letter:empty) + (:inbuffer-with-from-logo nil "from-logo" 'koma-letter:empty) + (:inbuffer-with-place nil "place" 'koma-letter:empty)) + :translate-alist '((export-block . org-koma-letter-export-block) + (export-snippet . org-koma-letter-export-snippet) + (headline . org-koma-letter-headline) + (keyword . org-koma-letter-keyword) + (template . org-koma-letter-template)) + :menu-entry + '(?k "Export with KOMA Scrlttr2" + ((?L "As LaTeX buffer" org-koma-letter-export-as-latex) + (?l "As LaTeX file" org-koma-letter-export-to-latex) + (?p "As PDF file" org-koma-letter-export-to-pdf) + (?o "As PDF file and open" + (lambda (a s v b) + (if a (org-koma-letter-export-to-pdf t s v b) + (org-open-file (org-koma-letter-export-to-pdf nil s v b)))))))) + + + +;;; Helper functions + +(defun org-koma-letter-email () + "Return the current `user-mail-address'." + user-mail-address) + +;; The following is taken from/inspired by ox-grof.el +;; Thanks, Luis! + +(defun org-koma-letter--get-tagged-contents (key) + "Get contents from a headline tagged with KEY. +The contents is stored in `org-koma-letter-special-contents'." + (let ((value (cdr (assoc-string (org-koma-letter--get-value key) + org-koma-letter-special-contents)))) + (when value (org-string-nw-p (org-trim value))))) + +(defun org-koma-letter--get-value (value) + "Turn value into a string whenever possible. +Determines if VALUE is nil, a string, a function or a symbol and +return a string or nil." + (when value + (cond ((stringp value) value) + ((functionp value) (funcall value)) + ((symbolp value) (symbol-name value)) + (t value)))) + +(defun org-koma-letter--special-contents-inline (keywords info) + "Process KEYWORDS members of `org-koma-letter-special-contents'. + +KEYWORDS is a list of symbols. Return them as a string to be +formatted. + +The function is used for inserting content of special headings +such as the one tagged with PS." + (mapconcat + (lambda (keyword) + (let* ((name (org-koma-letter--get-value keyword)) + (value (org-koma-letter--get-tagged-contents name)) + (macrop (memq keyword (plist-get info :special-tags-as-macro)))) + (cond ((not value) nil) + (macrop (format "\\%s{%s}\n" name value)) + (t value)))) + keywords + "\n")) + + +(defun org-koma-letter--add-latex-newlines (string) + "Replace regular newlines with LaTeX newlines (i.e. `\\\\')." + (let ((str (org-trim string))) + (when (org-string-nw-p str) + (replace-regexp-in-string "\n" "\\\\\\\\\n" str)))) + + + +;;; Transcode Functions + +;;;; Export Block + +(defun org-koma-letter-export-block (export-block _contents _info) + "Transcode an EXPORT-BLOCK element into KOMA Scrlttr2 code. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (when (member (org-element-property :type export-block) + '("KOMA-LETTER" "LATEX")) + (org-remove-indentation (org-element-property :value export-block)))) + +;;;; Export Snippet + +(defun org-koma-letter-export-snippet (export-snippet _contents _info) + "Transcode an EXPORT-SNIPPET object into KOMA Scrlttr2 code. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (when (memq (org-export-snippet-backend export-snippet) '(latex koma-letter)) + (org-element-property :value export-snippet))) + +;;;; Keyword + +(defun org-koma-letter-keyword (keyword contents info) + "Transcode a KEYWORD element into KOMA Scrlttr2 code. +CONTENTS is nil. INFO is a plist used as a communication +channel." + (let ((key (org-element-property :key keyword)) + (value (org-element-property :value keyword))) + ;; Handle specifically KOMA-LETTER keywords. Otherwise, fallback + ;; to `latex' back-end. + (if (equal key "KOMA-LETTER") value + (org-export-with-backend 'latex keyword contents info)))) + +;; Headline + +(defun org-koma-letter-headline (headline contents info) + "Transcode a HEADLINE element from Org to LaTeX. +CONTENTS holds the contents of the headline. INFO is a plist +holding contextual information. + +Note that if a headline is tagged with a tag from +`org-koma-letter-special-tags' it will not be exported, but +stored in `org-koma-letter-special-contents' and included at the +appropriate place." + (let ((special-tag (org-koma-letter--special-tag headline info))) + (if (not special-tag) + contents + (push (cons special-tag contents) org-koma-letter-special-contents) + ""))) + +(defun org-koma-letter--special-tag (headline info) + "Non-nil if HEADLINE is a special headline. +INFO is a plist holding contextual information. Return first +special tag headline." + (let ((special-tags (append + (plist-get info :special-tags-in-letter) + (plist-get info :special-tags-after-closing) + (plist-get info :special-tags-after-letter)))) + (cl-some (lambda (tag) (and (assoc-string tag special-tags) tag)) + (org-export-get-tags headline info)))) + +(defun org-koma-letter--keyword-or-headline (plist-key pred info) + "Return the correct version of opening or closing. +PLIST-KEY should be a key in info, typically :opening +or :closing. PRED is a predicate run on headline to determine +which title to use which takes two arguments, a headline element +and an info plist. INFO is a plist holding contextual +information. Return the preferred candidate for the exported of +PLIST-KEY." + (let* ((keyword-candidate (plist-get info plist-key)) + (headline-candidate (when (and (plist-get info :with-headline-opening) + (or (plist-get info :special-headings) + (not keyword-candidate))) + (org-element-map (plist-get info :parse-tree) + 'headline + (lambda (h) + (and (funcall pred h info) + (org-element-property :title h))) + info t)))) + (org-export-data (or headline-candidate keyword-candidate "") info))) + +;;;; Template + +(defun org-koma-letter-template (contents info) + "Return complete document string after KOMA Scrlttr2 conversion. +CONTENTS is the transcoded contents string. INFO is a plist +holding export options." + (concat + ;; Time-stamp. + (and (plist-get info :time-stamp-file) + (format-time-string "%% Created %Y-%m-%d %a %H:%M\n")) + ;; LaTeX compiler + (org-latex--insert-compiler info) + ;; Document class and packages. + (org-latex-make-preamble info) + ;; Settings. They can come from three locations, in increasing + ;; order of precedence: global variables, LCO files and in-buffer + ;; settings. Thus, we first insert settings coming from global + ;; variables, then we insert LCO files, and, eventually, we insert + ;; settings coming from buffer keywords. + (org-koma-letter--build-settings 'global info) + (mapconcat (lambda (file) (format "\\LoadLetterOption{%s}\n" file)) + (split-string (or (plist-get info :lco) "")) + "") + (org-koma-letter--build-settings 'buffer info) + ;; Date. + (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info)) + ;; Hyperref, document start, and subject and title. + (let* ((with-subject (plist-get info :with-subject)) + (with-title (plist-get info :with-title)) + (title-as-subject (and with-subject + (plist-get info :with-title-as-subject))) + (subject* (org-string-nw-p + (org-export-data (plist-get info :subject) info))) + (title* (and with-title + (org-string-nw-p + (org-export-data (plist-get info :title) info)))) + (subject (cond ((not with-subject) nil) + (title-as-subject (or subject* title*)) + (t subject*))) + (title (cond ((not with-title) nil) + (title-as-subject (and subject* title*)) + (t title*))) + (hyperref-template (plist-get info :latex-hyperref-template)) + (spec (append (list (cons ?t (or title subject ""))) + (org-latex--format-spec info)))) + (concat + (when (and with-subject (not (eq with-subject t))) + (format "\\KOMAoption{subject}{%s}\n" + (if (symbolp with-subject) with-subject + (mapconcat #'symbol-name with-subject ",")))) + ;; Hyperref. + (and (stringp hyperref-template) + (format-spec hyperref-template spec)) + ;; Document start. + "\\begin{document}\n\n" + ;; Subject and title. + (when subject (format "\\setkomavar{subject}{%s}\n" subject)) + (when title (format "\\setkomavar{title}{%s}\n" title)) + (when (or (org-string-nw-p title) (org-string-nw-p subject)) "\n"))) + ;; Letter start. + (let ((keyword-val (plist-get info :to-address)) + (heading-val (org-koma-letter--get-tagged-contents 'to))) + (format "\\begin{letter}{%%\n%s}\n\n" + (org-koma-letter--add-latex-newlines + (or (if (plist-get info :special-headings) + (or heading-val keyword-val) + (or keyword-val heading-val)) + "\\mbox{}")))) + ;; Opening. + (format "\\opening{%s}\n\n" + (org-koma-letter--keyword-or-headline + :opening + (lambda (h i) + (not (org-koma-letter--special-tag h i))) + info)) + ;; Letter body. + contents + ;; Closing. + (format "\\closing{%s}\n" + (org-koma-letter--keyword-or-headline + :closing + (lambda (h i) + (let ((special-tag (org-koma-letter--special-tag h i))) + (and special-tag + (string= "closing" special-tag)))) + info)) + (org-koma-letter--special-contents-inline + (plist-get info :special-tags-after-closing) info) + ;; Letter end. + "\n\\end{letter}\n" + (org-koma-letter--special-contents-inline + (plist-get info :special-tags-after-letter) info) + ;; Document end. + "\n\\end{document}")) + +(defun org-koma-letter--build-settings (scope info) + "Build settings string according to type. +SCOPE is either `global' or `buffer'. INFO is a plist used as +a communication channel." + (let* ((check-scope + ;; Non-nil value when SETTING was defined in SCOPE. + (lambda (setting) + (let ((property (intern (format ":inbuffer-%s" setting)))) + (if (eq scope 'global) + (eq (plist-get info property) 'koma-letter:empty) + (not (eq (plist-get info property) 'koma-letter:empty)))))) + (heading-or-key-value + (lambda (heading key &optional scoped) + (let* ((heading-val + (org-koma-letter--get-tagged-contents heading)) + (key-val (org-string-nw-p (plist-get info key))) + (scopedp (funcall check-scope (or scoped heading)))) + (and (or (and key-val scopedp) heading-val) + (not (and (eq scope 'global) heading-val)) + (if scopedp key-val heading-val)))))) + (concat + ;; Name. + (let ((author (plist-get info :author))) + (and author + (funcall check-scope 'author) + (format "\\setkomavar{fromname}{%s}\n" + (org-export-data author info)))) + ;; From. + (let ((from (funcall heading-or-key-value 'from :from-address))) + (and from + (format "\\setkomavar{fromaddress}{%s}\n" + (org-koma-letter--add-latex-newlines from)))) + ;; Email. + (let ((email (plist-get info :email))) + (and email + (funcall check-scope 'email) + (format "\\setkomavar{fromemail}{%s}\n" email))) + (and (funcall check-scope 'with-email) + (format "\\KOMAoption{fromemail}{%s}\n" + (if (plist-get info :with-email) "true" "false"))) + ;; Phone number. + (let ((phone-number (plist-get info :phone-number))) + (and (org-string-nw-p phone-number) + (funcall check-scope 'phone-number) + (format "\\setkomavar{fromphone}{%s}\n" phone-number))) + (and (funcall check-scope 'with-phone) + (format "\\KOMAoption{fromphone}{%s}\n" + (if (plist-get info :with-phone) "true" "false"))) + ;; URL + (let ((url (plist-get info :url))) + (and (org-string-nw-p url) + (funcall check-scope 'url) + (format "\\setkomavar{fromurl}{%s}\n" url))) + (and (funcall check-scope 'with-url) + (format "\\KOMAoption{fromurl}{%s}\n" + (if (plist-get info :with-url) "true" "false"))) + ;; From Logo + (let ((from-logo (plist-get info :from-logo))) + (and (org-string-nw-p from-logo) + (funcall check-scope 'from-logo) + (format "\\setkomavar{fromlogo}{%s}\n" from-logo))) + (and (funcall check-scope 'with-from-logo) + (format "\\KOMAoption{fromlogo}{%s}\n" + (if (plist-get info :with-from-logo) "true" "false"))) + ;; Signature. + (let* ((heading-val + (and (plist-get info :with-headline-opening) + (pcase (org-koma-letter--get-tagged-contents 'closing) + ((and (pred org-string-nw-p) closing) (org-trim closing)) + (_ nil)))) + (signature (org-string-nw-p (plist-get info :signature))) + (signature-scope (funcall check-scope 'signature))) + (and (or (and signature signature-scope) + heading-val) + (not (and (eq scope 'global) heading-val)) + (format "\\setkomavar{signature}{%s}\n" + (if signature-scope signature heading-val)))) + ;; Back address. + (and (funcall check-scope 'with-backaddress) + (format "\\KOMAoption{backaddress}{%s}\n" + (if (plist-get info :with-backaddress) "true" "false"))) + ;; Place. + (let ((with-place-set (funcall check-scope 'with-place)) + (place-set (funcall check-scope 'place))) + (and (or (and with-place-set place-set) + (and (eq scope 'buffer) (or with-place-set place-set))) + (format "\\setkomavar{place}{%s}\n" + (if (plist-get info :with-place) (plist-get info :place) + "")))) + ;; Location. + (let ((location (funcall heading-or-key-value 'location :location))) + (and location + (format "\\setkomavar{location}{%s}\n" location))) + ;; Folding marks. + (and (funcall check-scope 'with-foldmarks) + (let ((foldmarks (plist-get info :with-foldmarks))) + (cond ((consp foldmarks) + (format "\\KOMAoptions{foldmarks=true,foldmarks=%s}\n" + (mapconcat #'symbol-name foldmarks ""))) + (foldmarks "\\KOMAoptions{foldmarks=true}\n") + (t "\\KOMAoptions{foldmarks=false}\n"))))))) + + + +;;; Commands + +;;;###autoload +(defun org-koma-letter-export-as-latex + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a KOMA Scrlttr2 letter. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org KOMA-LETTER Export*\". It +will be displayed if `org-export-show-temporary-export-buffer' is +non-nil." + (interactive) + (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))))) + +;;;###autoload +(defun org-koma-letter-export-to-latex + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a KOMA Scrlttr2 letter (tex). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +When optional argument PUB-DIR is set, use it as the publishing +directory. + +Return output file's name." + (interactive) + (let ((outfile (org-export-output-file-name ".tex" subtreep)) + (org-koma-letter-special-contents)) + (org-export-to-file 'koma-letter outfile + async subtreep visible-only body-only ext-plist))) + +;;;###autoload +(defun org-koma-letter-export-to-pdf + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a KOMA Scrlttr2 letter (pdf). + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only write code +between \"\\begin{letter}\" and \"\\end{letter}\". + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return PDF file's name." + (interactive) + (let ((file (org-export-output-file-name ".tex" subtreep)) + (org-koma-letter-special-contents)) + (org-export-to-file 'koma-letter file + async subtreep visible-only body-only ext-plist + #'org-latex-compile))) + + +(provide 'ox-koma-letter) +;;; ox-koma-letter.el ends here diff --git a/elpa/org-9.5.2/ox-koma-letter.elc b/elpa/org-9.5.2/ox-koma-letter.elc new file mode 100644 index 0000000..4eda30c Binary files /dev/null and b/elpa/org-9.5.2/ox-koma-letter.elc differ diff --git a/elpa/org-9.5.2/ox-latex.el b/elpa/org-9.5.2/ox-latex.el new file mode 100644 index 0000000..c45dc98 --- /dev/null +++ b/elpa/org-9.5.2/ox-latex.el @@ -0,0 +1,3828 @@ +;;; ox-latex.el --- LaTeX Back-End for Org Export Engine -*- lexical-binding: t; -*- + +;; Copyright (C) 2011-2021 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou +;; Keywords: outlines, hypermedia, calendar, wp + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: +;; +;; See Org manual for details. + +;;; Code: + +(require 'cl-lib) +(require 'ox) +(require 'ox-publish) + +;;; Function Declarations + +(defvar org-latex-default-packages-alist) +(defvar org-latex-packages-alist) +(defvar orgtbl-exp-regexp) + + + +;;; Define Back-End + +(org-export-define-backend 'latex + '((bold . org-latex-bold) + (center-block . org-latex-center-block) + (clock . org-latex-clock) + (code . org-latex-code) + (drawer . org-latex-drawer) + (dynamic-block . org-latex-dynamic-block) + (entity . org-latex-entity) + (example-block . org-latex-example-block) + (export-block . org-latex-export-block) + (export-snippet . org-latex-export-snippet) + (fixed-width . org-latex-fixed-width) + (footnote-definition . org-latex-footnote-definition) + (footnote-reference . org-latex-footnote-reference) + (headline . org-latex-headline) + (horizontal-rule . org-latex-horizontal-rule) + (inline-src-block . org-latex-inline-src-block) + (inlinetask . org-latex-inlinetask) + (italic . org-latex-italic) + (item . org-latex-item) + (keyword . org-latex-keyword) + (latex-environment . org-latex-latex-environment) + (latex-fragment . org-latex-latex-fragment) + (line-break . org-latex-line-break) + (link . org-latex-link) + (node-property . org-latex-node-property) + (paragraph . org-latex-paragraph) + (plain-list . org-latex-plain-list) + (plain-text . org-latex-plain-text) + (planning . org-latex-planning) + (property-drawer . org-latex-property-drawer) + (quote-block . org-latex-quote-block) + (radio-target . org-latex-radio-target) + (section . org-latex-section) + (special-block . org-latex-special-block) + (src-block . org-latex-src-block) + (statistics-cookie . org-latex-statistics-cookie) + (strike-through . org-latex-strike-through) + (subscript . org-latex-subscript) + (superscript . org-latex-superscript) + (table . org-latex-table) + (table-cell . org-latex-table-cell) + (table-row . org-latex-table-row) + (target . org-latex-target) + (template . org-latex-template) + (timestamp . org-latex-timestamp) + (underline . org-latex-underline) + (verbatim . org-latex-verbatim) + (verse-block . org-latex-verse-block) + ;; Pseudo objects and elements. + (latex-math-block . org-latex-math-block) + (latex-matrices . org-latex-matrices)) + :menu-entry + '(?l "Export to LaTeX" + ((?L "As LaTeX buffer" org-latex-export-as-latex) + (?l "As LaTeX file" org-latex-export-to-latex) + (?p "As PDF file" org-latex-export-to-pdf) + (?o "As PDF file and open" + (lambda (a s v b) + (if a (org-latex-export-to-pdf t s v b) + (org-open-file (org-latex-export-to-pdf nil s v b))))))) + :filters-alist '((:filter-options . org-latex-math-block-options-filter) + (:filter-paragraph . org-latex-clean-invalid-line-breaks) + (:filter-parse-tree org-latex-math-block-tree-filter + org-latex-matrices-tree-filter + org-latex-image-link-filter) + (:filter-verse-block . org-latex-clean-invalid-line-breaks)) + :options-alist + '((:latex-class "LATEX_CLASS" nil org-latex-default-class t) + (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t) + (:latex-header "LATEX_HEADER" nil nil newline) + (:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline) + (:description "DESCRIPTION" nil nil parse) + (:keywords "KEYWORDS" nil nil parse) + (:subtitle "SUBTITLE" nil nil parse) + ;; Other variables. + (:latex-active-timestamp-format nil nil org-latex-active-timestamp-format) + (:latex-caption-above nil nil org-latex-caption-above) + (:latex-classes nil nil org-latex-classes) + (:latex-default-figure-position nil nil org-latex-default-figure-position) + (: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-diary-timestamp-format nil nil org-latex-diary-timestamp-format) + (:latex-footnote-defined-format nil nil org-latex-footnote-defined-format) + (:latex-footnote-separator nil nil org-latex-footnote-separator) + (:latex-format-drawer-function nil nil org-latex-format-drawer-function) + (:latex-format-headline-function nil nil org-latex-format-headline-function) + (:latex-format-inlinetask-function nil nil org-latex-format-inlinetask-function) + (:latex-hyperref-template nil nil org-latex-hyperref-template t) + (:latex-image-default-scale nil nil org-latex-image-default-scale) + (:latex-image-default-height nil nil org-latex-image-default-height) + (:latex-image-default-option nil nil org-latex-image-default-option) + (:latex-image-default-width nil nil org-latex-image-default-width) + (:latex-images-centered nil nil org-latex-images-centered) + (:latex-inactive-timestamp-format nil nil org-latex-inactive-timestamp-format) + (:latex-inline-image-rules nil nil org-latex-inline-image-rules) + (:latex-link-with-unknown-path-format nil nil org-latex-link-with-unknown-path-format) + (:latex-listings nil nil org-latex-listings) + (:latex-listings-langs nil nil org-latex-listings-langs) + (:latex-listings-options nil nil org-latex-listings-options) + (:latex-minted-langs nil nil org-latex-minted-langs) + (:latex-minted-options nil nil org-latex-minted-options) + (:latex-prefer-user-labels nil nil org-latex-prefer-user-labels) + (:latex-subtitle-format nil nil org-latex-subtitle-format) + (:latex-subtitle-separate nil nil org-latex-subtitle-separate) + (:latex-table-scientific-notation nil nil org-latex-table-scientific-notation) + (:latex-tables-booktabs nil nil org-latex-tables-booktabs) + (:latex-tables-centered nil nil org-latex-tables-centered) + (:latex-text-markup-alist nil nil org-latex-text-markup-alist) + (:latex-title-command nil nil org-latex-title-command) + (:latex-toc-command nil nil org-latex-toc-command) + (:latex-compiler "LATEX_COMPILER" nil org-latex-compiler) + ;; Redefine regular options. + (:date "DATE" nil "\\today" parse))) + + + +;;; Internal Variables + +(defconst org-latex-babel-language-alist + '(("af" . "afrikaans") + ("bg" . "bulgarian") + ("ca" . "catalan") + ("cs" . "czech") + ("cy" . "welsh") + ("da" . "danish") + ("de" . "germanb") + ("de-at" . "naustrian") + ("de-de" . "ngerman") + ("el" . "greek") + ("en" . "english") + ("en-au" . "australian") + ("en-ca" . "canadian") + ("en-gb" . "british") + ("en-ie" . "irish") + ("en-nz" . "newzealand") + ("en-us" . "american") + ("es" . "spanish") + ("et" . "estonian") + ("eu" . "basque") + ("fi" . "finnish") + ("fr" . "french") + ("fr-ca" . "canadien") + ("gl" . "galician") + ("hr" . "croatian") + ("hu" . "hungarian") + ("id" . "indonesian") + ("is" . "icelandic") + ("it" . "italian") + ("la" . "latin") + ("ms" . "malay") + ("nl" . "dutch") + ("nb" . "norsk") + ("nn" . "nynorsk") + ("no" . "norsk") + ("pl" . "polish") + ("pt" . "portuguese") + ("pt-br" . "brazilian") + ("ro" . "romanian") + ("ru" . "russian") + ("sa" . "sanskrit") + ("sb" . "uppersorbian") + ("sk" . "slovak") + ("sl" . "slovene") + ("sq" . "albanian") + ("sr" . "serbian") + ("sv" . "swedish") + ("ta" . "tamil") + ("tr" . "turkish") + ("uk" . "ukrainian")) + "Alist between language code and corresponding Babel option.") + +(defconst org-latex-polyglossia-language-alist + '(("am" "amharic") + ("ar" "arabic") + ("ast" "asturian") + ("bg" "bulgarian") + ("bn" "bengali") + ("bo" "tibetan") + ("br" "breton") + ("ca" "catalan") + ("cop" "coptic") + ("cs" "czech") + ("cy" "welsh") + ("da" "danish") + ("de" "german" "german") + ("de-at" "german" "austrian") + ("de-de" "german" "german") + ("dsb" "lsorbian") + ("dv" "divehi") + ("el" "greek") + ("en" "english" "usmax") + ("en-au" "english" "australian") + ("en-gb" "english" "uk") + ("en-nz" "english" "newzealand") + ("en-us" "english" "usmax") + ("eo" "esperanto") + ("es" "spanish") + ("et" "estonian") + ("eu" "basque") + ("fa" "farsi") + ("fi" "finnish") + ("fr" "french") + ("fu" "friulan") + ("ga" "irish") + ("gd" "scottish") + ("gl" "galician") + ("he" "hebrew") + ("hi" "hindi") + ("hr" "croatian") + ("hsb" "usorbian") + ("hu" "magyar") + ("hy" "armenian") + ("ia" "interlingua") + ("id" "bahasai") + ("is" "icelandic") + ("it" "italian") + ("kn" "kannada") + ("la" "latin" "modern") + ("la-classic" "latin" "classic") + ("la-medieval" "latin" "medieval") + ("la-modern" "latin" "modern") + ("lo" "lao") + ("lt" "lithuanian") + ("lv" "latvian") + ("ml" "malayalam") + ("mr" "maranthi") + ("nb" "norsk") + ("nko" "nko") + ("nl" "dutch") + ("nn" "nynorsk") + ("no" "norsk") + ("oc" "occitan") + ("pl" "polish") + ("pms" "piedmontese") + ("pt" "portuges") + ("pt-br" "brazilian") + ("rm" "romansh") + ("ro" "romanian") + ("ru" "russian") + ("sa" "sanskrit") + ("se" "samin") + ("sk" "slovak") + ("sl" "slovenian") + ("sq" "albanian") + ("sr" "serbian") + ("sv" "swedish") + ("syr" "syriac") + ("ta" "tamil") + ("te" "telugu") + ("th" "thai") + ("tk" "turkmen") + ("tr" "turkish") + ("uk" "ukrainian") + ("ur" "urdu") + ("vi" "vietnamese")) + "Alist between language code and corresponding Polyglossia option.") + +(defconst org-latex-table-matrix-macros '(("bordermatrix" . "\\cr") + ("qbordermatrix" . "\\cr") + ("kbordermatrix" . "\\\\")) + "Alist between matrix macros and their row ending.") + +(defconst org-latex-math-environments-re + (format + "\\`[ \t]*\\\\begin{%s\\*?}" + (regexp-opt + '("equation" "eqnarray" "math" "displaymath" + "align" "gather" "multline" "flalign" "alignat" + "xalignat" "xxalignat" + "subequations" + ;; breqn + "dmath" "dseries" "dgroup" "darray" + ;; empheq + "empheq"))) + "Regexp of LaTeX math environments.") + + +;;; User Configurable Variables + +(defgroup org-export-latex nil + "Options for exporting Org mode files to LaTeX." + :tag "Org Export LaTeX" + :group 'org-export) + +;;;; Generic + +(defcustom org-latex-caption-above '(table) + "When non-nil, place caption string at the beginning of elements. +Otherwise, place it near the end. When value is a list of +symbols, put caption above selected elements only. Allowed +symbols are: `image', `table', `src-block' and `special-block'." + :group 'org-export-latex + :version "26.1" + :package-version '(Org . "8.3") + :type '(choice + (const :tag "For all elements" t) + (const :tag "For no element" nil) + (set :tag "For the following elements only" :greedy t + (const :tag "Images" image) + (const :tag "Tables" table) + (const :tag "Source code" src-block) + (const :tag "Special blocks" special-block)))) + +(defcustom org-latex-prefer-user-labels nil + "Use user-provided labels instead of internal ones when non-nil. + +When this variable is non-nil, Org will use the value of +CUSTOM_ID property, NAME keyword or Org target as the key for the +\\label commands generated. + +By default, Org generates its own internal labels during LaTeX +export. This process ensures that the \\label keys are unique +and valid, but it means the keys are not available in advance of +the export process. + +Setting this variable gives you control over how Org generates +labels during LaTeX export, so that you may know their keys in +advance. One reason to do this is that it allows you to refer to +various elements using a single label both in Org's link syntax +and in embedded LaTeX code. + +For example, when this variable is non-nil, a headline like this: + + ** Some section + :PROPERTIES: + :CUSTOM_ID: sec:foo + :END: + This is section [[#sec:foo]]. + #+BEGIN_EXPORT latex + And this is still section \\ref{sec:foo}. + #+END_EXPORT + +will be exported to LaTeX as: + + \\subsection{Some section} + \\label{sec:foo} + This is section \\ref{sec:foo}. + And this is still section \\ref{sec:foo}. + +A non-default value of `org-latex-reference-command' will change the +command (\\ref by default) used to create label references. + +Note, however, that setting this variable introduces a limitation +on the possible values for CUSTOM_ID and NAME. When this +variable is non-nil, Org passes their value to \\label unchanged. +You are responsible for ensuring that the value is a valid LaTeX +\\label key, and that no other \\label commands with the same key +appear elsewhere in your document. (Keys may contain letters, +numbers, and the following punctuation: `_' `.' `-' `:'.) There +are no such limitations on CUSTOM_ID and NAME when this variable +is nil. + +For headlines that do not define the CUSTOM_ID property or +elements without a NAME, Org will continue to use its default +labeling scheme to generate labels and resolve links into proper +references." + :group 'org-export-latex + :type 'boolean + :version "26.1" + :package-version '(Org . "8.3")) + +(defcustom org-latex-reference-command "\\ref{%s}" + "Format string that takes a reference to produce a LaTeX reference command. + +The reference is a label such as sec:intro. A format string of \"\\ref{%s}\" +produces numbered references and will always work. It may be desirable to make +use of a package such as hyperref or cleveref and then change the format string +to \"\\autoref{%s}\" or \"\\cref{%s}\" for example." + :group 'org-export-latex + :type 'string + :package-version '(Org . "9.5") + :safe #'stringp) + +;;;; Preamble + +(defcustom org-latex-default-class "article" + "The default LaTeX class." + :group 'org-export-latex + :type '(string :tag "LaTeX class")) + +(defcustom org-latex-classes + '(("article" + "\\documentclass[11pt]{article}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + ("report" + "\\documentclass[11pt]{report}" + ("\\part{%s}" . "\\part*{%s}") + ("\\chapter{%s}" . "\\chapter*{%s}") + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) + ("book" + "\\documentclass[11pt]{book}" + ("\\part{%s}" . "\\part*{%s}") + ("\\chapter{%s}" . "\\chapter*{%s}") + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) + "Alist of LaTeX classes and associated header and structure. +If #+LATEX_CLASS is set in the buffer, use its value and the +associated information. Here is the structure of each cell: + + (class-name + header-string + (numbered-section . unnumbered-section) + ...) + +The header string +----------------- + +The HEADER-STRING is the header that will be inserted into the +LaTeX file. It should contain the \\documentclass macro, and +anything else that is needed for this setup. To this header, the +following commands will be added: + +- Calls to \\usepackage for all packages mentioned in the + variables `org-latex-default-packages-alist' and + `org-latex-packages-alist'. Thus, your header definitions + should avoid to also request these packages. + +- Lines specified via \"#+LATEX_HEADER:\" and + \"#+LATEX_HEADER_EXTRA:\" keywords. + +If you need more control about the sequence in which the header +is built up, or if you want to exclude one of these building +blocks for a particular class, you can use the following +macro-like placeholders. + + [DEFAULT-PACKAGES] \\usepackage statements for default packages + [NO-DEFAULT-PACKAGES] do not include any of the default packages + [PACKAGES] \\usepackage statements for packages + [NO-PACKAGES] do not include the packages + [EXTRA] the stuff from #+LATEX_HEADER(_EXTRA) + [NO-EXTRA] do not include #+LATEX_HEADER(_EXTRA) stuff + +So a header like + + \\documentclass{article} + [NO-DEFAULT-PACKAGES] + [EXTRA] + \\providecommand{\\alert}[1]{\\textbf{#1}} + [PACKAGES] + +will omit the default packages, and will include the +#+LATEX_HEADER and #+LATEX_HEADER_EXTRA lines, then have a call +to \\providecommand, and then place \\usepackage commands based +on the content of `org-latex-packages-alist'. + +If your header, `org-latex-default-packages-alist' or +`org-latex-packages-alist' inserts \"\\usepackage[AUTO]{inputenc}\", +AUTO will automatically be replaced with a coding system derived +from `buffer-file-coding-system'. See also the variable +`org-latex-inputenc-alist' for a way to influence this mechanism. + +Likewise, if your header contains \"\\usepackage[AUTO]{babel}\" +or \"\\usepackage[AUTO]{polyglossia}\", AUTO will be replaced +with the language related to the language code specified by +`org-export-default-language'. Note that constructions such as +\"\\usepackage[french,AUTO,english]{babel}\" are permitted. For +Polyglossia the language will be set via the macros +\"\\setmainlanguage\" and \"\\setotherlanguage\". See also +`org-latex-guess-babel-language' and +`org-latex-guess-polyglossia-language'. + +The sectioning structure +------------------------ + +The sectioning structure of the class is given by the elements +following the header string. For each sectioning level, a number +of strings is specified. A %s formatter is mandatory in each +section string and will be replaced by the title of the section. + +Instead of a cons cell (numbered . unnumbered), you can also +provide a list of 2 or 4 elements, + + (numbered-open numbered-close) + +or + + (numbered-open numbered-close unnumbered-open unnumbered-close) + +providing opening and closing strings for a LaTeX environment +that should represent the document section. The opening clause +should have a %s to represent the section title. + +Instead of a list of sectioning commands, you can also specify +a function name. That function will be called with two +parameters, the (reduced) level of the headline, and a predicate +non-nil when the headline should be numbered. It must return +a format string in which the section title will be added." + :group 'org-export-latex + :type '(repeat + (list (string :tag "LaTeX class") + (string :tag "LaTeX header") + (repeat :tag "Levels" :inline t + (choice + (cons :tag "Heading" + (string :tag " numbered") + (string :tag "unnumbered")) + (list :tag "Environment" + (string :tag "Opening (numbered)") + (string :tag "Closing (numbered)") + (string :tag "Opening (unnumbered)") + (string :tag "Closing (unnumbered)")) + (function :tag "Hook computing sectioning")))))) + +(defcustom org-latex-inputenc-alist nil + "Alist of inputenc coding system names, and what should really be used. +For example, adding an entry + + (\"utf8\" . \"utf8x\") + +will cause \\usepackage[utf8x]{inputenc} to be used for buffers that +are written as utf8 files." + :group 'org-export-latex + :type '(repeat + (cons + (string :tag "Derived from buffer") + (string :tag "Use this instead")))) + +(defcustom org-latex-title-command "\\maketitle" + "The command used to insert the title just after \\begin{document}. + +This format string may contain these elements: + + %a for AUTHOR keyword + %t for TITLE keyword + %s for SUBTITLE keyword + %k for KEYWORDS line + %d for DESCRIPTION line + %c for CREATOR line + %l for Language keyword + %L for capitalized language keyword + %D for DATE keyword + +If you need to use a \"%\" character, you need to escape it +like that: \"%%\". + +Setting :latex-title-command in publishing projects will take +precedence over this variable." + :group 'org-export-latex + :type '(string :tag "Format string")) + +(defcustom org-latex-subtitle-format "\\\\\\medskip\n\\large %s" + "Format string used for transcoded subtitle. +The format string should have at most one \"%s\"-expression, +which is replaced with the subtitle." + :group 'org-export-latex + :version "26.1" + :package-version '(Org . "8.3") + :type '(string :tag "Format string")) + +(defcustom org-latex-subtitle-separate nil + "Non-nil means the subtitle is not typeset as part of title." + :group 'org-export-latex + :version "26.1" + :package-version '(Org . "8.3") + :type 'boolean) + +(defcustom org-latex-toc-command "\\tableofcontents\n\n" + "LaTeX command to set the table of contents, list of figures, etc. +This command only applies to the table of contents generated with +the toc:nil option, not to those generated with #+TOC keyword." + :group 'org-export-latex + :type 'string) + +(defcustom org-latex-hyperref-template + "\\hypersetup{\n pdfauthor={%a},\n pdftitle={%t},\n pdfkeywords={%k}, + pdfsubject={%d},\n pdfcreator={%c}, \n pdflang={%L}}\n" + "Template for hyperref package options. + +This format string may contain these elements: + + %a for AUTHOR keyword + %t for TITLE keyword + %s for SUBTITLE keyword + %k for KEYWORDS line + %d for DESCRIPTION line + %c for CREATOR line + %l for Language keyword + %L for capitalized language keyword + %D for DATE keyword + +If you need to use a \"%\" character, you need to escape it +like that: \"%%\". + +As a special case, a nil value prevents template from being +inserted. + +Setting :latex-hyperref-template in publishing projects will take +precedence over this variable." + :group 'org-export-latex + :version "26.1" + :package-version '(Org . "8.3") + :type '(choice (const :tag "No template" nil) + (string :tag "Format string"))) + +;;;; Headline + +(defcustom org-latex-format-headline-function + 'org-latex-format-headline-default-function + "Function for formatting the headline's text. + +This function will be called with six arguments: +TODO the todo keyword (string or nil) +TODO-TYPE the type of todo (symbol: `todo', `done', nil) +PRIORITY the priority of the headline (integer or nil) +TEXT the main headline text (string) +TAGS the tags (list of strings or nil) +INFO the export options (plist) + +The function result will be used in the section format string." + :group 'org-export-latex + :version "24.4" + :package-version '(Org . "8.0") + :type 'function) + + +;;;; Footnotes + +(defcustom org-latex-footnote-separator "\\textsuperscript{,}\\," + "Text used to separate footnotes." + :group 'org-export-latex + :type 'string) + +(defcustom org-latex-footnote-defined-format "\\textsuperscript{\\ref{%s}}" + "Format string used to format reference to footnote already defined. +%s will be replaced by the label of the referred footnote." + :group 'org-export-latex + :type '(choice + (const :tag "Use plain superscript (default)" "\\textsuperscript{\\ref{%s}}") + (const :tag "Use Memoir/KOMA-Script footref" "\\footref{%s}") + (string :tag "Other format string")) + :version "26.1" + :package-version '(Org . "9.0")) + +;;;; Timestamps + +(defcustom org-latex-active-timestamp-format "\\textit{%s}" + "A printf format string to be applied to active timestamps." + :group 'org-export-latex + :type 'string) + +(defcustom org-latex-inactive-timestamp-format "\\textit{%s}" + "A printf format string to be applied to inactive timestamps." + :group 'org-export-latex + :type 'string) + +(defcustom org-latex-diary-timestamp-format "\\textit{%s}" + "A printf format string to be applied to diary timestamps." + :group 'org-export-latex + :type 'string) + + +;;;; Links + +(defcustom org-latex-images-centered t + "When non-nil, images are centered." + :group 'org-export-latex + :version "26.1" + :package-version '(Org . "9.0") + :type 'boolean + :safe #'booleanp) + +(defcustom org-latex-image-default-option "" + "Default option for images." + :group 'org-export-latex + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-latex-image-default-width ".9\\linewidth" + "Default width for images. +This value will not be used if a height is provided." + :group 'org-export-latex + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-latex-image-default-scale "" + "Default scale for images. +This value will not be used if a width or a scale is provided, +or if the image is wrapped within a \"wrapfigure\" environment. +Scale overrides width and height." + :group 'org-export-latex + :package-version '(Org . "9.3") + :type 'string + :safe #'stringp) + +(defcustom org-latex-image-default-height "" + "Default height for images. +This value will not be used if a width is provided, or if the +image is wrapped within a \"figure\" or \"wrapfigure\" +environment." + :group 'org-export-latex + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-latex-default-figure-position "htbp" + "Default position for LaTeX figures." + :group 'org-export-latex + :type 'string + :version "26.1" + :package-version '(Org . "9.0") + :safe #'stringp) + +(defcustom org-latex-inline-image-rules + `(("file" . ,(rx "." + (or "pdf" "jpeg" "jpg" "png" "ps" "eps" "tikz" "pgf" "svg") + eos))) + "Rules characterizing image files that can be inlined into LaTeX. + +A rule consists in an association whose key is the type of link +to consider, and value is a regexp that will be matched against +link's path. + +Note that, by default, the image extension *actually* allowed +depend on the way the LaTeX file is processed. When used with +pdflatex, pdf, jpg and png images are OK. When processing +through dvi to Postscript, only ps and eps are allowed. The +default we use here encompasses both." + :group 'org-export-latex + :package-version '(Org . "9.4") + :type '(alist :key-type (string :tag "Type") + :value-type (regexp :tag "Path"))) + +(defcustom org-latex-link-with-unknown-path-format "\\texttt{%s}" + "Format string for links with unknown path type." + :group 'org-export-latex + :type 'string) + + +;;;; Tables + +(defcustom org-latex-default-table-environment "tabular" + "Default environment used to build tables." + :group 'org-export-latex + :version "24.4" + :package-version '(Org . "8.0") + :type 'string) + +(defcustom org-latex-default-quote-environment "quote" + "Default environment used to `quote' blocks." + :group 'org-export-latex + :package-version '(Org . "9.5") + :type 'string + :safe #'stringp) + +(defcustom org-latex-default-table-mode 'table + "Default mode for tables. + +Value can be a symbol among: + + `table' Regular LaTeX table. + + `math' In this mode, every cell is considered as being in math + mode and the complete table will be wrapped within a math + environment. It is particularly useful to write matrices. + + `inline-math' This mode is almost the same as `math', but the + math environment will be inlined. + + `verbatim' The table is exported as it appears in the Org + buffer, within a verbatim environment. + +This value can be overridden locally with, i.e. \":mode math\" in +LaTeX attributes. + +When modifying this variable, it may be useful to change +`org-latex-default-table-environment' accordingly." + :group 'org-export-latex + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice (const :tag "Table" table) + (const :tag "Matrix" math) + (const :tag "Inline matrix" inline-math) + (const :tag "Verbatim" verbatim)) + :safe (lambda (s) (memq s '(table math inline-math verbatim)))) + +(defcustom org-latex-tables-centered t + "When non-nil, tables are exported in a center environment." + :group 'org-export-latex + :type 'boolean + :safe #'booleanp) + +(defcustom org-latex-tables-booktabs nil + "When non-nil, display tables in a formal \"booktabs\" style. +This option assumes that the \"booktabs\" package is properly +loaded in the header of the document. This value can be ignored +locally with \":booktabs t\" and \":booktabs nil\" LaTeX +attributes." + :group 'org-export-latex + :version "24.4" + :package-version '(Org . "8.0") + :type 'boolean + :safe #'booleanp) + +(defcustom org-latex-table-scientific-notation nil + "Format string to display numbers in scientific notation. + +The format should have \"%s\" twice, for mantissa and exponent +\(i.e., \"%s\\\\times10^{%s}\"). + +When nil, no transformation is made." + :group 'org-export-latex + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (string :tag "Format string") + (const :tag "No formatting" nil))) + +;;;; Text markup + +(defcustom org-latex-text-markup-alist '((bold . "\\textbf{%s}") + (code . protectedtexttt) + (italic . "\\emph{%s}") + (strike-through . "\\sout{%s}") + (underline . "\\uline{%s}") + (verbatim . protectedtexttt)) + "Alist of LaTeX expressions to convert text markup. + +The key must be a symbol among `bold', `code', `italic', +`strike-through', `underline' and `verbatim'. The value is +a formatting string to wrap fontified text with. + +Value can also be set to the following symbols: `verb' and +`protectedtexttt'. For the former, Org will use \"\\verb\" to +create a format string and select a delimiter character that +isn't in the string. For the latter, Org will use \"\\texttt\" +to typeset and try to protect special characters. + +If no association can be found for a given markup, text will be +returned as-is." + :group 'org-export-latex + :version "26.1" + :package-version '(Org . "8.3") + :type 'alist + :options '(bold code italic strike-through underline verbatim)) + + +;;;; Drawers + +(defcustom org-latex-format-drawer-function (lambda (_ contents) contents) + "Function called to format a drawer in LaTeX code. + +The function must accept two parameters: + NAME the drawer name, like \"LOGBOOK\" + CONTENTS the contents of the drawer. + +The function should return the string to be exported. + +The default function simply returns the value of CONTENTS." + :group 'org-export-latex + :version "26.1" + :package-version '(Org . "8.3") + :type 'function) + + +;;;; Inlinetasks + +(defcustom org-latex-format-inlinetask-function + 'org-latex-format-inlinetask-default-function + "Function called to format an inlinetask in LaTeX code. + +The function must accept seven parameters: + TODO the todo keyword (string or nil) + TODO-TYPE the todo type (symbol: `todo', `done', nil) + PRIORITY the inlinetask priority (integer or nil) + NAME the inlinetask name (string) + TAGS the inlinetask tags (list of strings or nil) + CONTENTS the contents of the inlinetask (string or nil) + INFO the export options (plist) + +The function should return the string to be exported." + :group 'org-export-latex + :type 'function + :version "26.1" + :package-version '(Org . "8.3")) + + +;; Src blocks + +(defcustom org-latex-listings nil + "Non-nil means export source code using the listings package. + +This package will fontify source code, possibly even with color. +If you want to use this, you also need to make LaTeX use the +listings package, and if you want to have color, the color +package. Just add these to `org-latex-packages-alist', for +example using customize, or with something like: + + (require \\='ox-latex) + (add-to-list \\='org-latex-packages-alist \\='(\"\" \"listings\")) + (add-to-list \\='org-latex-packages-alist \\='(\"\" \"color\")) + +Alternatively, + + (setq org-latex-listings \\='minted) + +causes source code to be exported using the minted package as +opposed to listings. If you want to use minted, you need to add +the minted package to `org-latex-packages-alist', for example +using customize, or with + + (require \\='ox-latex) + (add-to-list \\='org-latex-packages-alist \\='(\"newfloat\" \"minted\")) + +In addition, it is necessary to install pygments +\(URL `https://pygments.org>'), and to configure the variable +`org-latex-pdf-process' so that the -shell-escape option is +passed to pdflatex. + +The minted choice has possible repercussions on the preview of +latex fragments (see `org-preview-latex-fragment'). If you run +into previewing problems, please consult +URL `https://orgmode.org/worg/org-tutorials/org-latex-preview.html'." + :group 'org-export-latex + :type '(choice + (const :tag "Use listings" t) + (const :tag "Use minted" minted) + (const :tag "Export verbatim" nil)) + :safe (lambda (s) (memq s '(t nil minted)))) + +(defcustom org-latex-listings-langs + '((emacs-lisp "Lisp") (lisp "Lisp") (clojure "Lisp") + (c "C") (cc "C++") + (fortran "fortran") + (perl "Perl") (cperl "Perl") (python "Python") (ruby "Ruby") + (html "HTML") (xml "XML") + (tex "TeX") (latex "[LaTeX]TeX") + (shell-script "bash") + (gnuplot "Gnuplot") + (ocaml "[Objective]Caml") (caml "Caml") + (sql "SQL") (sqlite "sql") + (makefile "make") + (R "r")) + "Alist mapping languages to their listing language counterpart. +The key is a symbol, the major mode symbol without the \"-mode\". +The value is the string that should be inserted as the language +parameter for the listings package. If the mode name and the +listings name are the same, the language does not need an entry +in this list - but it does not hurt if it is present." + :group 'org-export-latex + :version "26.1" + :package-version '(Org . "8.3") + :type '(repeat + (list + (symbol :tag "Major mode ") + (string :tag "Listings language")))) + +(defcustom org-latex-listings-options nil + "Association list of options for the latex listings package. + +These options are supplied as a comma-separated list to the +\\lstset command. Each element of the association list should be +a list containing two strings: the name of the option, and the +value. For example, + + (setq org-latex-listings-options + \\='((\"basicstyle\" \"\\\\small\") + (\"keywordstyle\" \"\\\\color{black}\\\\bfseries\\\\underbar\"))) + +will typeset the code in a small size font with underlined, bold +black keywords. + +Note that the same options will be applied to blocks of all +languages. If you need block-specific options, you may use the +following syntax: + + #+ATTR_LATEX: :options key1=value1,key2=value2 + #+BEGIN_SRC + ... + #+END_SRC" + :group 'org-export-latex + :type '(repeat + (list + (string :tag "Listings option name ") + (string :tag "Listings option value")))) + +(defcustom org-latex-minted-langs + '((emacs-lisp "common-lisp") + (cc "c++") + (cperl "perl") + (shell-script "bash") + (caml "ocaml")) + "Alist mapping languages to their minted language counterpart. +The key is a symbol, the major mode symbol without the \"-mode\". +The value is the string that should be inserted as the language +parameter for the minted package. If the mode name and the +listings name are the same, the language does not need an entry +in this list - but it does not hurt if it is present. + +Note that minted uses all lower case for language identifiers, +and that the full list of language identifiers can be obtained +with: + + pygmentize -L lexers" + :group 'org-export-latex + :type '(repeat + (list + (symbol :tag "Major mode ") + (string :tag "Minted language")))) + +(defcustom org-latex-minted-options nil + "Association list of options for the latex minted package. + +These options are supplied within square brackets in +\\begin{minted} environments. Each element of the alist should +be a list containing two strings: the name of the option, and the +value. For example, + + (setq org-latex-minted-options + \\='((\"bgcolor\" \"bg\") (\"frame\" \"lines\"))) + +will result in source blocks being exported with + +\\begin{minted}[bgcolor=bg,frame=lines]{} + +as the start of the minted environment. Note that the same +options will be applied to blocks of all languages. If you need +block-specific options, you may use the following syntax: + + #+ATTR_LATEX: :options key1=value1,key2=value2 + #+BEGIN_SRC + ... + #+END_SRC" + :group 'org-export-latex + :type '(repeat + (list + (string :tag "Minted option name ") + (string :tag "Minted option value")))) + +(defcustom org-latex-custom-lang-environments nil + "Alist mapping languages to language-specific LaTeX environments. + +It is used during export of source blocks by the listings and +minted LaTeX packages. The environment may be a simple string, +composed of only letters and numbers. In this case, the string +is directly the name of the LaTeX environment to use. The +environment may also be a format string. In this case the format +string will be directly exported. This format string may contain +these elements: + + %s for the formatted source + %c for the caption + %f for the float attribute + %l for an appropriate label + %o for the LaTeX attributes + +For example, + + (setq org-latex-custom-lang-environments + \\='((python \"pythoncode\") + (ocaml \"\\\\begin{listing} +\\\\begin{minted}[%o]{ocaml} +%s\\\\end{minted} +\\\\caption{%c} +\\\\label{%l}\"))) + +would have the effect that if Org encounters a Python source block +during LaTeX export it will produce + + \\begin{pythoncode} + + \\end{pythoncode} + +and if Org encounters an Ocaml source block during LaTeX export it +will produce + + \\begin{listing} + \\begin{minted}[]{ocaml} + + \\end{minted} + \\caption{} + \\label{